Opened 5 years ago

Closed 3 years ago

# solve(x==x, x) returns [x == r1]

Reported by: Owned by: pelegm aashu12 minor sage-8.4 symbolics solve, days79 Ashutosh Ahelleya Bryan Gin-ge Chen N/A 224e064 224e0641f083472bda753ca8c1a833073b08a218 #21554

Not sure if it's a bug or a problem with the documentation, but without any assumptions on `x`, `solve(x==x, x)` returns `[x == r1]`. The documentation does not state what `r1` is, but gives the following example:

```   If there is a parameter in the answer, that will show up as a new
variable.  In the following example, "r1" is a real free variable
(because of the "r"):

sage: solve([x+y == 3, 2*x+2*y == 6],x,y)
[[x == -r1 + 3, y == r1]]
```

However, without assumptions on `x`, there's no reason to believe that `x` is real.

This ticket also fixes a grammar issue introduced in #21554 (see comments).

### comment:1 Changed 5 years ago by aashu12

• Owner changed from (none) to aashu12

### comment:2 Changed 5 years ago by aashu12

• Branch set to u/aashu12/documentation

### comment:3 Changed 5 years ago by aashu12

• Authors set to Ashutosh Ahelleya
• Commit set to e8760d5ba490fa59a043879c2993b14c8ababde3

New commits:

 ​c7acfd6 `Fixes #21554` ​e8760d5 ` Fixed: #21946`

### comment:4 Changed 5 years ago by aashu12

• Status changed from new to needs_review

### comment:5 Changed 5 years ago by dimpase

• Dependencies set to #21554

### comment:6 follow-up: ↓ 7 Changed 5 years ago by dimpase

• Milestone changed from sage-7.5 to sage-7.6

what do you mean to say by

```+    In case one of the solutions while solving an equation is a real number::
```

First of all, I would have written

```+    In case one of the solutions of an equation is a real number::
```

Still, it's unclear what the following sequence of assumptions following this line has to do with the one of solutions being real. Do you mean to say that in order to make sure that one (rather, every?) solution is real, you need to make the following assumptions? Something else?

### comment:7 in reply to: ↑ 6 ; follow-up: ↓ 8 Changed 5 years ago by aashu12

what do you mean to say by

```+    In case one of the solutions while solving an equation is a real number::
```

First of all, I would have written

```+    In case one of the solutions of an equation is a real number::
```

It was a part of ticket #21554 which has already been merged.

Still, it's unclear what the following sequence of assumptions following this line has to do with the one of solutions being real. Do you mean to say that in order to make sure that one (rather, every?) solution is real, you need to make the following assumptions? Something else?

According to the documentation, the solution of the equation described in the issue is r1, which is a real number (That is what the documentation says!). But the solution to this equation can be a complex number too! So, I just changed the documentation and redefined r1 to be any arbitrary constant. You can refer to this conversation: https://groups.google.com/forum/#!topic/sage-support/_XWjrYjk_3A

Version 0, edited 5 years ago by aashu12 (next)

### comment:8 in reply to: ↑ 7 ; follow-up: ↓ 9 Changed 5 years ago by dimpase

what do you mean to say by

```+    In case one of the solutions while solving an equation is a real number::
```

First of all, I would have written

```+    In case one of the solutions of an equation is a real number::
```

It was a part of ticket #21554 which has already been merged.

OK, I didn't notice this. But this makes no sense regardless, and you should fix it here.

Still, it's unclear what the following sequence of assumptions following this line has to do with the one of solutions being real. Do you mean to say that in order to make sure that one (rather, every?) solution is real, you need to make the following assumptions? Something else?

According to the documentation provided earlier, the solution of the equation described in the issue is r1, which is a real number (That is what the documentation says!). But the solution to this equation can be a complex number too! So, I just changed the documentation and redefined r1 to be any arbitrary constant. You can refer to this conversation: https://groups.google.com/forum/#!topic/sage-support/_XWjrYjk_3A

I understand this --- my question is wholly about the commit from #21554. How does this docstring clarify anything about assuming non-integer? I don't get it.

### comment:9 in reply to: ↑ 8 ; follow-up: ↓ 10 Changed 5 years ago by aashu12

I understand this --- my question is wholly about the commit from #21554. How does this docstring clarify anything about assuming non-integer? I don't get it.

No. The commits are different. I pushed them in different branches. But they showed up when I changed the author name. That was what my doubt was about -> https://groups.google.com/forum/#!topic/sage-support/iqqEhA4K2Gg

### comment:10 in reply to: ↑ 9 ; follow-up: ↓ 11 Changed 5 years ago by dimpase

I understand this --- my question is wholly about the commit from #21554. How does this docstring clarify anything about assuming non-integer? I don't get it.

No. The commits are different. I pushed them in different branches. But they showed up when I changed the author name. That was what my doubt was about -> https://groups.google.com/forum/#!topic/sage-support/iqqEhA4K2Gg

Differently named branches always have some common commits (and as I wrote on sage-support, it is the case that the commit c7acfd6 from #21554 is present in the branch here). Branch names are merely labels in the directed graph of commits in a repo.

Anyhow, c7acfd6 needs fixing, if only because it's broken English there...

### comment:11 in reply to: ↑ 10 Changed 5 years ago by aashu12

Differently named branches always have some common commits (and as I wrote on sage-support, it is the case that the commit c7acfd6 from #21554 is present in the branch here). Branch names are merely labels in the directed graph of commits in a repo.

Anyhow, c7acfd6 needs fixing, if only because it's broken English there...

Yea, I will fix it :)

### comment:12 Changed 5 years ago by git

• Commit changed from e8760d5ba490fa59a043879c2993b14c8ababde3 to b88104716685c7864077452950ceee7280933b67

Branch pushed to git repo; I updated commit sha1. New commits:

 ​b881047 ` Fixed #21946`

### comment:13 Changed 5 years ago by git

• Commit changed from b88104716685c7864077452950ceee7280933b67 to ea063c358af8349cac165083099a381a29f5e922

Branch pushed to git repo; I updated commit sha1. New commits:

 ​ea063c3 `Fixed #21946 and added example for #21554`

### comment:14 Changed 3 years ago by gh-bryangingechen

• Status changed from needs_review to needs_work

This no longer merges.

### comment:15 Changed 3 years ago by gh-bryangingechen

• Branch changed from u/aashu12/documentation to public/21946_solve_returns_r1
• Commit changed from ea063c358af8349cac165083099a381a29f5e922 to 224e0641f083472bda753ca8c1a833073b08a218
• Description modified (diff)
• Status changed from needs_work to positive_review

I fixed the merge conflict. Unless there are other outstanding objections, I'm setting this to positive_review as this is certainly an improvement to the docs.

New commits:

 ​e8760d5 ` Fixed: #21946` ​b881047 ` Fixed #21946` ​ea063c3 `Fixed #21946 and added example for #21554` ​224e064 `Merge branch 'u/aashu12/documentation' of git://trac.sagemath.org/sage into 21946_solve_returns_r1`

### comment:16 Changed 3 years ago by gh-bryangingechen

• Reviewers set to Bryan Gin-ge Chen

### comment:17 Changed 3 years ago by chapoton

• Milestone changed from sage-7.6 to sage-8.4

### comment:18 Changed 3 years ago by vbraun

• Branch changed from public/21946_solve_returns_r1 to 224e0641f083472bda753ca8c1a833073b08a218
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.