2011-01-26 09:14, Minh Nguyen skrev:
On Wed, Jan 26, 2011 at 6:41 PM,<xl...@free.fr>  wrote:
sage: sqrt(2)*sqrt(3)-sqrt(6)
sqrt(2)*sqrt(3)-sqrt(6)

I would expect results sqrt(6) and 0...
I try with the command simplify() but it doesn't do anything.

> In the above Sage session, you declared two symbolic expressions. So
> it is possible to use methods defined on symbolic expressions other
> than simplify(). In the present case, you want to use the
> simplify_radical() method to simplify radicals:

Thanks.
However...

I am surprised that simplify is sufficient on symbolic variables denoting positive numbers:

sage: assume(x>0, y>0)
sage: (sqrt(x)*sqrt(y)-sqrt(x*y)).simplify()
0
sage: (sqrt(2)*sqrt(3)-sqrt(2*3)).simplify()
sqrt(2)*sqrt(3) - sqrt(6)


I am particularly surprised by:

sage: (sqrt(x)*sqrt(y)-sqrt(x*y)).subs(x=2)
0
sage: (sqrt(x)*sqrt(y)-sqrt(x*y)).subs(x=2, y=3).simplify()
sqrt(2)*sqrt(3) - sqrt(6)

(We did not even need the call to simplify when substituting only x=2.)

Is it reasonable to consider the last example a bug?

Of course, the answer sage gives is correct, but it is certainly not the behaviour I would expect.

Regards

Johan

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to