Opened 10 years ago
Last modified 6 months ago
#8450 new defect
intermediate complex expression in real functions make many plot functions fail
Reported by: | jason | Owned by: | was |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | graphics | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
All of the following plots fail
x, y = SR.var('x y') contour_plot(abs(x+i*y), (x,-1,1), (y,-1,1)) density_plot(abs(x+i*y), (x,-1,1), (y,-1,1)) plot3d(abs(x+i*y), (x,-1,1),(y,-1,1)) streamline_plot(abs(x+i*y), (x,-1,1),(y,-1,1))
with
TypeError: unable to coerce to a real number
The culprit is the call to setup_for_eval_on_grid
(from sage/plot/misc.py
) that tries to compile the symbolic expression with fast_float
. But since the expression involves an intermediate complex number the compilation fails. This can be tested with any of the two
fast_float(abs(x + i*y), x, y) fast_callable(abs(x + i*y), vars=[x,y])
The function compilation succeeds if we ask for a complex function instead
fast_callable(abs(x + i*y), vars=[x,y], domain=complex)
See also this question on ask.sagemath.org.
Change History (9)
comment:1 Changed 10 years ago by
comment:2 Changed 6 years ago by
- Milestone changed from sage-5.11 to sage-5.12
comment:3 Changed 6 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:4 Changed 6 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:5 Changed 5 years ago by
- Milestone changed from sage-6.3 to sage-6.4
comment:6 Changed 8 months ago by
- Description modified (diff)
- Milestone changed from sage-6.4 to sage-8.8
comment:7 Changed 8 months ago by
- Description modified (diff)
- Summary changed from contour_plot chokes on function which involves imaginary numbers to intermediate complex expression in real functions make many plot functions fail
comment:8 Changed 8 months ago by
- Description modified (diff)
comment:9 Changed 6 months ago by
- Milestone sage-8.8 deleted
As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).
#5572 will help solve this.