Re: [sage-support] Re: Plotting algebraic curves

2020-03-05 Thread Fernando Gouvea
Yes, and I should have thought of that! Fernando On 3/5/2020 12:13 PM, Dima Pasechnik wrote: In fact, substituting x and y directly into the equation of the curve to plot, and clearing denominators, produces something pretty good,IMHO: implicit_plot(v^2*3*sqrt(1-u^2-v^2)-u^3*9+u*(1-u^2-v^2),(u

Re: [sage-support] Re: Plotting algebraic curves

2020-03-05 Thread Dima Pasechnik
More conceptually, one can use, with care, Sage's substitution facilities: sage: var('u v x y t'); sage: f=y^2-x^3+x sage: fs=(f.subs(x=u*3*t^(-1/2),y=v*3*t^(-1/2))*t^(3/2)).expand() # only works with extra variable t sage: implicit_plot(fs.subs(t=1-u^2-v^2),(u,-1,1),(v,-1,1)) On Thu, Mar 5, 2020

Re: [sage-support] Re: Plotting algebraic curves

2020-03-05 Thread Dima Pasechnik
In fact, substituting x and y directly into the equation of the curve to plot, and clearing denominators, produces something pretty good,IMHO: implicit_plot(v^2*3*sqrt(1-u^2-v^2)-u^3*9+u*(1-u^2-v^2),(u,-1,1),(v,-1,1)) On Thu, Mar 5, 2020 at 4:51 PM Dima Pasechnik wrote: > > On Thu, Mar 5, 2020

Re: [sage-support] Re: Plotting algebraic curves

2020-03-05 Thread Dima Pasechnik
On Thu, Mar 5, 2020 at 2:32 PM Fernando Gouvea wrote: > > This works, in the sense that there's no error. One does get a bunch of > extraneous points near the boundary of the disk. It's as if plot_points were > trying to connect the point at (0,1) and the point at (0,-1) along the > circle, eve

Re: [sage-support] Re: Plotting algebraic curves

2020-03-05 Thread Fernando Gouvea
This works, in the sense that there's no error. One does get a bunch of extraneous points near the boundary of the disk. It's as if plot_points were trying to connect the point at (0,1) and the point at (0,-1) along the circle, even though f_uv is 1 on the circle. Strangely, they occur only on

Re: [sage-support] Re: Plotting algebraic curves

2020-03-05 Thread Dima Pasechnik
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^

Re: [sage-support] Re: Plotting algebraic curves

2020-03-03 Thread Dima Pasechnik
On Wed, Mar 4, 2020 at 12:20 AM Fernando Gouvea 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 poss

Re: [sage-support] Re: Plotting algebraic curves

2020-03-03 Thread Fernando Gouvea
But no, it doesn't work, since it gives a rectangular plot instead of one in polar coordinates. But maybe we are closer. 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

Re: [sage-support] Re: Plotting algebraic curves

2020-03-03 Thread Fernando Gouvea
Nice idea. Thanks. Fernando On Tue, Mar 3, 2020 at 6:27 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

Re: [sage-support] Re: Plotting algebraic curves

2020-03-03 Thread Dima Pasechnik
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 wrote: > > On Tue, Mar 3, 2020 at 10:10 PM Fernando Gouve

Re: [sage-support] Re: Plotting algebraic curves

2020-03-03 Thread Dima Pasechnik
On Tue, Mar 3, 2020 at 10:10 PM Fernando Gouvea 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 lo

Re: [sage-support] Re: Plotting algebraic curves

2020-03-03 Thread Augustin Lefèvre
A caveat is that at the boundary, the mapping you describe becomes non differentiable (the determinant of the differential blows up to infinity), so it's going to be painful for implicit_plot to work. That being said, the following tweak runs ok but it's not ex

Re: [sage-support] Re: Plotting algebraic curves

2020-03-03 Thread Fernando Gouvea
The whole point of this is to show the behavior of the curve near infinity, so changing the limits is not an option. Fernando On 3/3/2020 4:15 PM, Dima Pasechnik wrote: On Tue, Mar 3, 2020 at 8:20 PM Fernando Gouvea wrote: Here's what I ended up trying, with r=3: var('x y u v') x=u*sqrt(9/(

Re: [sage-support] Re: Plotting algebraic curves

2020-03-03 Thread Dima Pasechnik
On Tue, Mar 3, 2020 at 9:15 PM Dima Pasechnik wrote: > > On Tue, Mar 3, 2020 at 8:20 PM Fernando Gouvea 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)) > > > >

Re: [sage-support] Re: Plotting algebraic curves

2020-03-03 Thread Dima Pasechnik
On Tue, Mar 3, 2020 at 8:20 PM Fernando Gouvea 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-support] Re: Plotting algebraic curves

2020-03-03 Thread Fernando Gouvea
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_r