Hi Robert,

I wasn't aware of the real() function; pretty cool. I tried it out
myself in the above example and found an error. Not sure whether this
is an error in the real() function or in simplify_full. I suspect the
latter. Could you comment on this? I would also be very interested in
a way of defining symbolic variables such that they can only be real.
Is this only possible by doing assume(omgo,'real')?

Here is the error I found. The result given by omgo.simplify_full
().real() is different to the one obtained by omgo.factor().

Thanks for your help!

Stan

----------------------------------------------------------------------
| Sage Version 3.2, Release Date: 2008-11-20                         |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------

sage: var('omgo zr ys cz')
(omgo, zr, ys, cz)
sage: omgo = (sqrt(-zr^2 + 2*ys*zr + (2*cz - zr)^2 - 2*ys*(2*cz - zr))
+ 2*zr- 2*cz)/(2*zr - 2*cz)
sage: assume(cz>ys,cz>zr)
sage: omgo.factor()
(zr + sqrt(cz - ys)*sqrt(cz - zr) - cz)/(zr - cz)
sage: omgo.simplify_full().real()
(zr - sqrt(cz - ys)*sqrt(cz - zr) - cz)/(zr - cz)

On Nov 28, 9:14 am, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> On Nov 27, 2008, at 6:58 AM, [EMAIL PROTECTED] wrote:
>
> > Hello,
>
> > the example below shows that a complex number ( i think the "I" stands
> > for it ? ) appears by doing a simplify_full. Is there a way to prevent
> > this and to get output in real number format?
>
> > sage: var('omgo zr ys cz')
> > sage: eqomgo = omgo == (sqrt(2*ys - 2*cz)*sqrt(2*zr - 2*cz))/(2*zr -
> > 2*cz)
> > sage: eqomgo.rhs().simplify_full()
> > I*sqrt(cz - ys)/sqrt(zr - cz)
>
> Is ys assumed to be larger than cz? What about zr and cz? You can use  
> the assume command
>
> sage: assume(ys > cz)
> sage: assume(zr > cz)
>
> Then do
>
> sage: sage: eqomgo.rhs().simplify_full().real()
> -sqrt(ys - cz)/sqrt(zr - cz)
>
> - Robert
--~--~---------~--~----~------------~-------~--~----~
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