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: sage-9.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:


I use sage 4.1.2alpha4. This plot is right with this version :


I apply the patch 7122 by copy/paste in emacs and run sage -br. Now this plot is also right, it draw a half-circle :


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 quarter-circle 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 was

  • Milestone changed from sage-4.1.2 to sage-4.1.3

comment:2 Changed 10 years ago by fmaltey

  • Summary changed from an other bug in plot, real_part, imaginary_part and sqrt. to a

I browse the two previous expressions real(...) and imaginary(...), and test real(sqrt(...)).

Theses calculus are right and remain real.

real(sqrt(m)) ; real(sqrt(I*m)) ; real(sqrt(I*m+1)) # are right 

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.

plot (real(sqrt(m)+i+1),m,-3,3) # fails with a system error
plot (real(m+i+1),m,-3,3) # is a pretty line

comment:3 Changed 10 years ago by jason

  • 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 kcrisman

  • Cc kcrisman added

comment:5 Changed 7 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:6 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:7 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:8 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:9 Changed 10 months ago by vdelecroix

  • Milestone changed from sage-6.4 to sage-duplicate/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 chapoton

This needs a doctest.

comment:11 Changed 8 weeks ago by chapoton

  • Authors set to Frédéric Chapoton
  • Branch set to public/ticket/7165
  • Commit set to 354f92954073e3c1783015bf21e9791d32515d91
  • Milestone changed from sage-duplicate/invalid/wontfix to sage-9.1

Here is a tiny doctest. After that, I think one can close this old ticket.

New commits:

354f929one doctest for 7165

comment:12 Changed 8 weeks ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review


comment:13 Changed 7 weeks ago by vbraun

  • Branch changed from public/ticket/7165 to 354f92954073e3c1783015bf21e9791d32515d91
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.