Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sage fails to plot a quarter circle when it should #7165

Closed
sagetrac-fmaltey mannequin opened this issue Oct 9, 2009 · 11 comments
Closed

sage fails to plot a quarter circle when it should #7165

sagetrac-fmaltey mannequin opened this issue Oct 9, 2009 · 11 comments

Comments

@sagetrac-fmaltey
Copy link
Mannequin

sagetrac-fmaltey mannequin commented Oct 9, 2009

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 half-circle :

parametric_plot([real(m+sqrt(m<sup>2-1)),imaginary(m+sqrt(m</sup>2-1))],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 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.

CC: @kcrisman

Component: graphics

Author: Frédéric Chapoton

Branch/Commit: 354f929

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/7165

@sagetrac-fmaltey sagetrac-fmaltey mannequin added this to the sage-4.1.2 milestone Oct 9, 2009
@williamstein williamstein modified the milestones: sage-4.1.2, sage-4.2 Oct 10, 2009
@sagetrac-fmaltey
Copy link
Mannequin Author

sagetrac-fmaltey mannequin commented Oct 25, 2009

comment:2

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 :

real(sqrt(sqrt(m)+i+1))

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

@sagetrac-fmaltey sagetrac-fmaltey mannequin changed the title an other bug in plot, real_part, imaginary_part and sqrt. a Oct 25, 2009
@jasongrout
Copy link
Member

comment:3

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.

@jasongrout jasongrout changed the title a sage fails to plot a quarter circle when it should Jan 1, 2010
@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@videlec
Copy link
Contributor

videlec commented Apr 19, 2019

comment:9

Now this does work

m = SR.var('m')
parametric_plot([real(exp(i*m)),imaginary(exp(i*m))], (m,0,7))

@videlec videlec removed this from the sage-6.4 milestone Apr 19, 2019
@fchapoton
Copy link
Contributor

comment:10

This needs a doctest.

@fchapoton
Copy link
Contributor

Commit: 354f929

@fchapoton
Copy link
Contributor

Author: Frédéric Chapoton

@fchapoton
Copy link
Contributor

Branch: public/ticket/7165

@fchapoton
Copy link
Contributor

comment:11

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


New commits:

354f929one doctest for 7165

@fchapoton fchapoton added this to the sage-9.1 milestone Jan 4, 2020
@tscrim
Copy link
Collaborator

tscrim commented Jan 4, 2020

Reviewer: Travis Scrimshaw

@tscrim
Copy link
Collaborator

tscrim commented Jan 4, 2020

comment:12

LGTM.

@vbraun
Copy link
Member

vbraun commented Jan 9, 2020

Changed branch from public/ticket/7165 to 354f929

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants