#19797: Disallow automatic abs() simplifications resulting non-real expressions
-------------------------------------+-------------------------------------
Reporter: jdemeyer | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-7.0
Component: packages: | Resolution:
standard | Merged in:
Keywords: | Reviewers:
Authors: Jeroen Demeyer | Work issues:
Report Upstream: Reported | Commit:
upstream. Developers acknowledge | 694feb2d71ebf521cf5f32dba69e0406d16e9f11
bug. | Stopgaps:
Branch: |
u/jdemeyer/ticket/19797 |
Dependencies: |
-------------------------------------+-------------------------------------
Old description:
> Calling `abs()` on certain expressions can yield something which is not
> guaranteed to be evaluated as a real number:
> {{{
> sage: abs(x^2)
> x*conjugate(x)
> }}}
>
> In the presence of numerical noise, the expression `x*conjugate(x)` can
> have a non-zero imaginary part. And even if there is no noise, the type
> would be wrong: complex instead of real.
>
> This causes the following doctest failure:
> {{{
> sage -t --long --warn-long 62.3 src/sage/symbolic/expression.pyx
> **********************************************************************
> File "src/sage/symbolic/expression.pyx", line 11105, in
> sage.symbolic.expression.Expression._plot_fast_callable
> Failed example:
> plot(s)
> Expected:
> Graphics object consisting of 1 graphics primitive
> Got:
> Graphics object consisting of 0 graphics primitives
> **********************************************************************
> }}}
>
> See https://github.com/pynac/pynac/issues/117
New description:
Calling `abs()` on certain expressions can yield something which is not
guaranteed to be evaluated as a real number:
{{{
sage: abs(x^2)
x*conjugate(x)
sage: abs(x)^2
x*conjugate(x)
}}}
In the presence of numerical noise, the expression `x*conjugate(x)` can
have a non-zero imaginary part. And even if there is no noise, the type
would be wrong: complex instead of real.
This causes the following doctest failure:
{{{
sage -t --long --warn-long 62.3 src/sage/symbolic/expression.pyx
**********************************************************************
File "src/sage/symbolic/expression.pyx", line 11105, in
sage.symbolic.expression.Expression._plot_fast_callable
Failed example:
plot(s)
Expected:
Graphics object consisting of 1 graphics primitive
Got:
Graphics object consisting of 0 graphics primitives
**********************************************************************
}}}
See https://github.com/pynac/pynac/issues/117
--
Comment (by jdemeyer):
The simplification `abs(ex^real)-->abs(ex)^real` is safe since the result
is still manifestly real.
--
Ticket URL: <http://trac.sagemath.org/ticket/19797#comment:27>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.