Opened 10 years ago
Closed 7 weeks ago
#7165 closed defect (fixed)
sage fails to plot a quarter circle when it should
Reported by:  fmaltey  Owned by:  was 

Priority:  major  Milestone:  sage9.1 
Component:  graphics  Keywords:  
Cc:  kcrisman  Merged in:  
Authors:  Frédéric Chapoton  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  354f929 (Commits)  Commit:  354f92954073e3c1783015bf21e9791d32515d91 
Dependencies:  Stopgaps: 
Description
I use sage 4.1.2alpha4. This plot is right with this version :
parametric_plot([real(exp(i*m)),imaginary(exp(i*m))],m,0,7)
I apply the patch 7122 by copy/paste in emacs and run sage br. Now this plot is also right, it draw a halfcircle :
parametric_plot([real(m+sqrt(m^21)),imaginary(m+sqrt(m^21))],m,5,5)
I also get it by this function :
def solve2pplot (eq) : return [real(eq.rhs()),imaginary(eq.rhs())] res = solve(z^2+2*m*z+1,z) parametric_plot (solve2pplot (res[0]), m, 5,5)
Now I solve this 4 degree equation. The solve is right with sqrt at 2 levels.
But I get an error in the parametric_plot :
res = solve(z^4+2*m*z^2+1,z) parametric_plot (solve2pplot (res[0]), m, 5,5)
The local solve2pplot(res[0])
generates a long formula.
real axe and imaginary axe are right.
But sage doesn't plot the quartercircle between axes at position 1=(1,0) and i=(0,1) and claims failed to evaluate function at 40 points
. So the plot is a line between the 2 axes.
Change History (13)
comment:1 Changed 10 years ago by
 Milestone changed from sage4.1.2 to sage4.1.3
comment:2 Changed 10 years ago by
 Summary changed from an other bug in plot, real_part, imaginary_part and sqrt. to a
comment:3 Changed 10 years ago by
 Report Upstream set to N/A
 Summary changed from a to sage fails to plot a quarter circle when it should
The plot (real(sqrt(m)+i+1),m,3,3)
now works, probably as a result of #7614. However, I don't think the original question is addressed.
comment:4 Changed 9 years ago by
 Cc kcrisman added
comment:5 Changed 7 years ago by
 Milestone changed from sage5.11 to sage5.12
comment:6 Changed 6 years ago by
 Milestone changed from sage6.1 to sage6.2
comment:7 Changed 6 years ago by
 Milestone changed from sage6.2 to sage6.3
comment:8 Changed 6 years ago by
 Milestone changed from sage6.3 to sage6.4
comment:9 Changed 10 months ago by
 Milestone changed from sage6.4 to sageduplicate/invalid/wontfix
 Status changed from new to needs_review
Now this does work
m = SR.var('m') parametric_plot([real(exp(i*m)),imaginary(exp(i*m))], (m,0,7))
comment:10 Changed 10 months ago by
This needs a doctest.
comment:11 Changed 8 weeks ago by
 Branch set to public/ticket/7165
 Commit set to 354f92954073e3c1783015bf21e9791d32515d91
 Milestone changed from sageduplicate/invalid/wontfix to sage9.1
Here is a tiny doctest. After that, I think one can close this old ticket.
New commits:
354f929  one doctest for 7165

comment:12 Changed 8 weeks ago by
 Reviewers set to Travis Scrimshaw
 Status changed from needs_review to positive_review
LGTM.
comment:13 Changed 7 weeks ago by
 Branch changed from public/ticket/7165 to 354f92954073e3c1783015bf21e9791d32515d91
 Resolution set to fixed
 Status changed from positive_review to closed
I browse the two previous expressions real(...) and imaginary(...), and test real(sqrt(...)).
Theses calculus are right and remain real.
But this one is the shorter that contains complex expressions :
The outer sqrt(...) assume that the inner sqrt is obvious ; so sqrt(m)+i+1 remains, even if it's a complex expression. Then plot fails with this internal complex computation.