Opened 10 years ago

# sage fails to plot a quarter circle when it should

Reported by: Owned by: fmaltey was major sage-duplicate/invalid/wontfix graphics kcrisman N/A

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

`parametric_plot([real(m+sqrt(m^2-1)),imaginary(m+sqrt(m^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), 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), m, -5,5)
```

The local `solve2pplot(res)` 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.

### 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 :

```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
```

### 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:5 Changed 6 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 5 years ago by vbraun_spam

• Milestone changed from sage-6.3 to sage-6.4

### comment:9 Changed 8 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 8 months ago by chapoton

This needs a doctest.

Note: See TracTickets for help on using tickets.