A caveat is that at the boundary, the mapping you describe becomes non differentiable (the determinant of the differential blows up to infinity),
$$ \det \frac{d\vec{x}}{d\vec{u}}=
      (1-\|\vec{u}\|^2)^{-\frac{1}{2}}$$
so it's going to be painful for implicit_plot to work.

That being said, the following tweak runs ok but it's not exactly what you describe.

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



This other tweak raises an error, I don't see why :

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

>> ValueError: negative number to a fractional power not real


On 03/03/2020 22:15, Dima Pasechnik wrote:
On Tue, Mar 3, 2020 at 8:20 PM Fernando Gouvea <fqgou...@colby.edu> wrote:
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 in sage.ext.interpreters.wrapper_rdf.Wrapper_rdf.__call__ (build/cythonized/sage/ext/interpreters/wrapper_rdf.c:2237)()
     74         for i from 0 <= i < len(args):
     75             self._args[i] = args[i]
---> 76         return 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?
I'd just change the limits of u and v to make the rectangle of the
values you plot in, anyway,
to well stay inside the unit circle.

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)/(r2 + x2 + y2)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.

    

--
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/2f897853-0a23-8fa5-c7d8-bc53273e10c5%40gmail.com.

Reply via email to