The easiest way is to use Python functions rather than symbolic ones; define a function that is 1 outside the unit disk, and implicitly plot it.
sage: def f_uv(u,v): ....: if u^2+v^2>=1: ....: return 1 ....: else: ....: x=u*sqrt(9/(1-u^2-v^2)) ....: y=v*sqrt(9/(1-u^2-v^2)) ....: return y^2-x^3+x ....: implicit_plot(f_uv,(u,-1,1),(v,-1,1)) On Wednesday, March 4, 2020 at 12:45:19 AM UTC, Dima Pasechnik wrote: > > On Wed, Mar 4, 2020 at 12:20 AM Fernando Gouvea <fqgou...@colby.edu> > wrote: > > > > But no, it doesn't work, since it gives a rectangular plot instead of > one in polar coordinates. But maybe we are closer. > > I looked at the labels on the axes, and they do match the ranges of r > and phi, so I don't udnerstand > how it's possible. > > > > > I still think implicit_plot should be smarter about values that do not > make sense. > > > > Fernando > > > > On 3/3/2020 6:26 PM, Dima Pasechnik wrote: > > > > even better: > > > > sage: var('x y u v r phi') > > ....: u=r*cos(phi) > > ....: v=r*sin(phi) > > ....: x=u*sqrt(9/(1-r^2)) > > ....: y=v*sqrt(9/(1-r^2)) > > ....: implicit_plot(y^2-x^3+x==0,(r,0,999/1000),(phi,-pi,pi)) > > > > On Tue, Mar 3, 2020 at 10:28 PM Dima Pasechnik <dimp...@gmail.com> > wrote: > > > > On Tue, Mar 3, 2020 at 10:10 PM Fernando Gouvea <fqgou...@colby.edu> > wrote: > > > > The whole point of this is to show the behavior of the curve near > infinity, so changing the limits is not an option. > > > > just paste together a number of rectangles where (u,v) stay inside the > > unit circle. > > (yes, this would need writing a loop, ideally) > > > > Fernando > > > > On 3/3/2020 4:15 PM, 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. > > > > > > -- > > ============================================================= > > 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/6117cc36-6771-179c-2887-38c05305fd58%40colby.edu. > > > > > > -- > > ============================================================= > > 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/f7ea288f-80fc-478f-a89c-f514612b6802%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/5922a29f-ae3b-42a1-9e0c-fcdf33751557%40googlegroups.com.