#14630: Add `simplify_real` method to symbolic expressions
-------------------------------------+-------------------------------------
Reporter: mjo | Owner: burcin
Type: enhancement | Status: needs_info
Priority: major | Milestone: sage-6.4
Component: symbolics | Resolution:
Keywords: | Merged in:
Authors: Michael Orlitzky | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/mjo/ticket/14630 | 24cc55466abd2f02a9187186364fb4373d7900e9
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by kcrisman):
This seems fine, given that it is extremely unlikely a context manager
will appear and that having many options seems undesirable. However, if
someone gets a sage-devel discussion on this going I'm not going to stop
them.
{{{
sage: A = e^(sqrt(x^2))
sage: A
e^(sqrt(x^2))
sage: A.simplify_real()
e^abs(x)
}}}
I was pleased this worked, wasn't sure how much it would do. Maybe the
following would be a useful test to show what it does and doesn't do.
{{{
sage: var('y z')
(y, z)
sage: A = e^(sqrt(x^2)+sqrt(y^2)+sqrt(i*z^2))
sage: A.simplify_real()
e^((-1)^(1/4)*abs(z) + abs(x) + abs(y))
}}}
Here's another one that, again, pleasantly works as one would think.
{{{
sage: C = (x^2+y^2).imag()
sage: C
2*imag_part(x)*real_part(x) + 2*imag_part(y)*real_part(y)
sage: C.simplify_real()
0
}}}
Now if only we ''had'' to use this for the following simplification!
{{{
sage: B = conjugate(z)
sage: B.simplify_real()
z
sage: B.simplify() # wa-wa "you lose" noise
z
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/14630#comment:18>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.