Hi Jason thanks for this ( I did mean 'c' not 'y'; apologies).
I didn't know about QQbar(). Why does QQbar(c) return what appears to be a numerical result, with a question mark after it? thanks again Robin On Thu, Jul 7, 2011 at 4:43 PM, Jason Grout <[email protected]> wrote: > 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 [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/sage-support > URL: http://www.sagemath.org > -- Robin Hankin Uncertainty Analyst [email protected] -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
