Jason: wow, that was quick. I'll try out the plot_vector_field patch
as soon as I figure out how to test patches etc

I ended up using Hector's example and some things from the matplotlib
documentation for my assignment. A notable improvement is using
axis('tight'), which solves the window mis-alignment problem.
Uploaded to https://www.sagenb.org/home/pub/1721

On Mar 3, 8:34 pm, Eric Drechsel <[EMAIL PROTECTED]> wrote:
> Thanks for the matplotlib recipe! I just had the same problem with
> plot_vector_field not accepting coordinate functions of two arguments.
> I went ahead and created an 
> issue:http://trac.sagemath.org/sage_trac/ticket/2381
>
> - Eric
>
> On Feb 17, 10:19 am, "Hector Villafuerte" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> > I would like to plot the gradient (i.e. vector field) of functions
> > such as  f(x,y) = exp(-(x^2 + y^2)); in this case:
> > grad(f(x,y)) = vector([ -2*x*exp(-(x^2 + y^2)), -2*y*exp(-(x^2 + y^2)) ])
>
> > Initially I tried with plot_vector_field, but as of now it just "takes
> > two functions of one variable". For my second attempt I used
> > matplotlib, as indicated below (also, see attached plots).
>
> > So my question: is there a SAGEly way to plot this type of vector fields?
> > Thanks in advance!
> > --
> >  Hector
>
> > sage: %python
> > sage: from pylab import *
> > sage: X,Y = meshgrid( arange(-2,2,.2),arange(-2,2,.2) )
> > sage: U = -2*X*exp(-(X*X + Y*Y))
> > sage: V = -2*Y*exp(-(X*X + Y*Y))
> > sage: figure()
> > sage: Q = quiver( U, V)
> > sage: l,r,b,t = axis()
> > sage: dx, dy = r-l, t-b
> > sage: axis([l-0.05*dx, r+0.05*dx, b-0.05*dy, t+0.05*dy])
> > sage: savefig(DATA+'quiver.png')
>
> >  quiver.png
> > 96KViewDownload
>
> >  3d.png
> > 1020KViewDownload
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to