On 7/6/11 6:20 PM, robin hankin wrote:
[apologies if this is a resend]

Hi.  I am having difficulty using sage to manipulate square roots.

Consider:

a = 1 + sqrt(2) + sqrt(3)
b= (a^2).expand()
c = sqrt(b)

Then 'y' should be equal to 'a'.

I get:

sage: a = 1 + sqrt(2) + sqrt(3)
sage: b= (a^2).expand()
sage: c = sqrt(b)
sage: y
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

/Volumes/Private/pass/<ipython console> in <module>()

NameError: name 'y' is not defined


You haven't said what y is.

However, assuming that you really mean c instead of y, here is one way:

sage: QQbar(a)==QQbar(c)
True

You're in luck since these numbers are roots of rational polynomials, and we have other tools like QQbar to deal with roots of rational polynomials.


Thanks,

Jason

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