On Jan 26, 8:42 am, Loïc <xl...@free.fr> wrote:
> Hello list,
>
> Version: sage 4.6.1
> I'm quite a newbie with Sage but I'm really impressed this powerful
> software.
> Since an hour, I'm on a stupid problem:
>
> sage: sqrt(2)*sqrt(3)
> sqrt(2)*sqrt(3)
> sage: sqrt(2)*sqrt(3)-sqrt(6)
> sqrt(2)*sqrt(3)-sqrt(6)
>
> I would expect sqrt(6) and 0...
> I try with the command simplify() too but it doesn't do anything.
>
> That's very odd because:
>
> sage: sqrt(75)+2*sqrt(48)
> 13*sqrt(3)
>
> (Here it simplifies the operation)
> Can anyone help me ?

Hi,

There are several simplify procedures, by default sage does not apply
them. For simplifying radicals, the preferable one is simplify_radical
that is not available as a top command.

If you do

sage: a = sqrt(2)*sqrt(3) - sqrt(6)

and then write a.simplify and press the tab button, you will see the
different possibilities for simplifying that expression, these methods
depend on the input. In this case, you get:

a.simplify            a.simplify_factorial  a.simplify_log
a.simplify_rational
a.simplify_exp        a.simplify_full       a.simplify_radical
a.simplify_trig

It looks that simplify_radical is what you are looking for:

sage: a.simplify_radical()
0

In doubt, you can always try simplify_full that will try to do its
bests applying different methods.

With the second example, sqrt(75) is transformed into 5*sqrt(3) and
sqrt(48) into 4*sqrt(3), since there is a common factor sqrt(3), then
sage collects these terms without asking to do so, but for other kind
of identities like sqrt(2)*sqrt(3) = sqrt(6) you have to be explicit.

Luis

-- 
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