Hector Villafuerte 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!

There is now!  It turned out to be a pretty simple fix to 
plot_vector_field; see http://trac.sagemath.org/sage_trac/ticket/2381

Here's an example:


     sage: x,y=var('x y')
     sage: f(x,y) = exp(-(x^2+y^2))
     sage: grad_f = [diff(f,var) for var in (x,y)]
     sage: plot_vector_field(grad_f, (-2,2), (-2,2))

Thanks,

Jason


--~--~---------~--~----~------------~-------~--~----~
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