Ticket #7122 (closed defect: fixed)
plot real part and imaginary part of function sqrt.
| Reported by: | fmaltey | Owned by: | was |
|---|---|---|---|
| Priority: | major | Milestone: | sage-4.2 |
| Component: | graphics | Keywords: | |
| Cc: | Work issues: | ||
| Report Upstream: | Reviewers: | Karl-Dieter Crisman | |
| Authors: | Mike Hansen | Merged in: | sage-4.2.alpha1 |
| Dependencies: | Stopgaps: |
Description
I try to plot a half-circle with the
var('m')
parametric_plot ([real(m+sqrt(1-m^2)), imaginary(m+sqrt(1-m^2))],m,-1,1)
and get a severe error.
Theses plots are right :
plot([sqrt(m2+1)],m,0,6) plot(real (sqrt(m2+1)),m,0,6)
But this one with AND real(...) or imaginary(...) AND list AND sqrt(...) fails :
plot([real (sqrt(m2+1))],m,0,6)
On devel-support kcrisman proposes :
After looking at the traceback about an extra argument, I have a sneaky suspicion this is because sqrt takes an extra keyword prec, which perhaps is getting caught up in fast_float somehow. What's interesting is that the problem also only shows up for a list, so again fast_float([]) is what's getting concerned. Those who know how fast_float and the expression trees work will hopefully check this out as they get an opportunity.
Attachments
Change History
comment:1 Changed 4 years ago by mhansen
- Summary changed from plot real part and imaginary part of function sqrt. to [with patch, needs review] plot real part and imaginary part of function sqrt.
comment:4 Changed 4 years ago by kcrisman
- Status changed from needs_review to positive_review
Looks good, passes all the tests I can think of.
If it's significant enough that
sage: plot([real (sqrt(m^2-1))],m,0,6)
now works, maybe there should be a doctest in plot/plot.py?
Otherwise positive review.
comment:5 Changed 4 years ago by mhansen
- Status changed from positive_review to closed
- Reviewers set to Karl-Dieter Crisman
- Resolution set to fixed
- Merged in set to sage-4.2.alpha1
- Summary changed from [with patch, needs review] plot real part and imaginary part of function sqrt. to plot real part and imaginary part of function sqrt.


I've attached a patch which fixes the error you get. However, I don't think that's the right equation to draw a half circle since sqrt(1-m2) is always going to be real for -1 <= m <= 1.