About solve(x*abs(x)==1, x)

69 views
Skip to first unread message

Jori Mäntysalo

unread,
Dec 13, 2017, 4:36:10 AM12/13/17
to sage-...@googlegroups.com
This has been discussed earlier, but I was again asked about this:

sage: solve(x*abs(x)==1, x)
[x == (1/abs(x))]
sage: solve([x*abs(x)==1, x==x], x)
[[x == 1]]

And yes, to_poly_solve=True can be used. But this is annoying to teach and
gives bad impression of Sage. Is there any plans to make this better?

--
Jori Mäntysalo

rjf

unread,
Dec 13, 2017, 7:36:27 PM12/13/17
to sage-devel
how much of Sage are you using?  If you are
just using Sage as a front end to Maxima, maybe
you should just use Maxima.

The relationship of solve and to_poly_solve has been
discussed from time to time in the maxima newsgroup.

Whether there is a feasible "upgrade" to just use sympy's
solve is perhaps another path.  
RJF

Jori Mäntysalo

unread,
Dec 14, 2017, 12:17:00 AM12/14/17
to sage-devel
On Wed, 13 Dec 2017, rjf wrote:

> how much of Sage are you using?  If you arejust using Sage as a front end to Maxima, maybe
> you should just use Maxima.

I don't use. I was asked about this by a man who teaches course about
"Computer programs for mathematics and statistics". And he is not happy
about this.

--
Jori Mäntysalo

Ralf Stephan

unread,
Dec 14, 2017, 10:04:13 AM12/14/17
to sage-devel
On Thursday, December 14, 2017 at 1:36:27 AM UTC+1, rjf wrote:
Whether there is a feasible "upgrade" to just use sympy's
solve is perhaps another path.  

Indeed, with Sage-8.1:
sage: solve(x*abs(x)==1, x, algorithm='sympy')

ValueError:
Absolute values cannot be inverted in the complex domain.

Unfortunately assumptions are not copied to SymPy at the moment see

However the situation in SymPy is unclear because there are two competing solve functions available:
In [5]: x = symbols('x', real=True)

In [6]: x.is_real
Out[6]: True

In [7]: solve(x*abs(x)-1, x)
Out[7]: [1]

In [8]: solveset(x*abs(x)-1, x)
ValueError:
Absolute values cannot be inverted in the complex domain.


Regards,

Ralf Stephan

unread,
Dec 14, 2017, 10:07:26 AM12/14/17
to sage-devel


On Thursday, December 14, 2017 at 6:17:00 AM UTC+1, Jori Mäntysalo wrote:
I don't use. I was asked about this by a man who teaches course about
"Computer programs for mathematics and statistics". And he is not happy
about this.

Tell him solving in general is hard, esp. if there are more than just polynomials given.
Reply all
Reply to author
Forward
0 new messages