On Sun, Nov 2, 2008 at 7:48 AM, Kevin Buzzard <[EMAIL PROTECTED]> wrote:
> In fact I'm having my first bit of real confusion with these square roots.
> Probably because I know nothing of mathematica/maple and only of pari/magma
>
> sage: 1 == 1
> True
> sage: sqrt(4) == sqrt(4)
> 2 == 2

That's very annoying.  I think sqrt(4) should return
an integer, but it isn't.  I.e., I consider this a bug:

sage: n = 4
sage: type(sqrt(n))
<class 'sage.calculus.calculus.SymbolicComposition'>
sage: type(n.sqrt())
<type 'sage.rings.integer.Integer'>

http://trac.sagemath.org/sage_trac/ticket/4425

> sage: sqrt(5) == sqrt(5)
> sqrt(5) == sqrt(5)

You've created a symbolic equation.   If you use any comparison
operator with either side a symbolic expression then you get
a formal symbolic equation or inequality.  Here's another example
of that sort of thing:

sage: var('x,a,b,c')
(x, a, b, c)
sage: a*x^2 + b*x + c == 0
a*x^2 + b*x + c == 0
sage: solve(a*x^2 + b*x + c == 0, x)
[x == (-sqrt(b^2 - 4*a*c) - b)/(2*a), x == (sqrt(b^2 - 4*a*c) - b)/(2*a)]

Above you might want to do

sage: bool(sqrt(5) == sqrt(5))
True

to get a true or false value.  Note that for some complicated
expressions Sage (actually Maxima) can't determine whether
or not the equation is true, in which case it (annoyingly?)
always returns False.   E.g.,

sage: a = arcsinh(1) == log(sqrt(2) + 1)
sage: bool(a)
False
sage: a.lhs().n(100)
0.88137358701954302523260932498
sage: a.rhs().n(100)
0.88137358701954302523260932498

This can be confusing, but there is little we can do until we
switch to not using Maxima for this symbolic stuff, since
this is a "feature" of maxima:

(%i2) is (arcsinh(1) = log(sqrt(2) + 1) )
;
(%o2)                                false


I would prefer to get an error message in such cases...

> sage: sqrt(4) == 2
> 2 == 2
>
> Should that make some sort of sense to me?

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to