Here's what I ended up trying, with r=3:

var('x y u v')
x=u*sqrt(9/(1-u^2-v^2))
y=v*sqrt(9/(1-u^2-v^2))
implicit_plot(y^2-x^3+x==0,(u,-1,1),(v,-1,1))

That gives an error:

/opt/sagemath-8.9/local/lib/python2.7/site-packages/sage/ext/interpreters/wrapper_rdf.pyx insage.ext.interpreters.wrapper_rdf.Wrapper_rdf.__call__ (build/cythonized/sage/ext/interpreters/wrapper_rdf.c:2237)()
74          for  ifrom  0  <=  i<  len(args):
75              self._args[i]  =  args[i]
---> 76return self._domain(interp_rdf(c_args 77              ,  self._constants
78              ,  self._py_constants

ValueError: negative number to a fractional power not real

Is there some way to tell implicit_plot to stay inside u^2+v^2\leq 1? Or to ignore complex values?

The equivalent code seems to give the correct graph in Mathematica.

Fernando

On 2/29/2020 5:29 PM, Fernando Gouvea wrote:
Some years ago in a book review, David Roberts had the idea of plotting an algebraic curve using the transformation  (u,v) = (x,y)/(r^2  + x^2  + y^2 )^1/2 , which transforms the plane into a circle and makes it easy to visualize the projective completion of the curve. You can see some of his plots at https://www.maa.org/press/maa-reviews/rational-algebraic-curves-a-computer-algebra-approach

I’d love to do this kind of plot for my students. Can anyone offer help on how to do it with Sage? (Of course the dream scenario would be to add this option to the plot method for curves...)

I’ve been using implicit_plot for most of my examples, which seems to be equivalent of using C.plot() when C is a curve.

Thanks,

Fernando





--
==================================================================
Fernando Q. Gouvea                             Editor, MAA Reviews
Dept of Mathematics and Statistics http://www.colby.edu/~fqgouvea
Colby College http://www.maa.org/press/maa-reviews
Mayflower Hill 5836
Waterville, ME 04901

A training in mathematics is a prerequisite today for work in almost
any scientific field, but even for those who are not going to become
scientists, it is essential because, if it is only through speech that
we can understand what freedom means, only through mathematics
can we understand what necessity means.
  -- W. H. Auden


--
=============================================================
Fernando Q. Gouvea         http://www.colby.edu/~fqgouvea
Carter Professor of Mathematics
Dept. of Mathematics and Statistics
Colby College
5836 Mayflower Hill
Waterville, ME 04901

If little else, the brain is an educational toy.
  -- Tom Robbins

--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/b1b0c01c-7dfd-0e17-a3d4-61012ab66d8b%40colby.edu.

Reply via email to