[sage-support] Re: Vector fields and Quivers
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 -~--~~~~--~~--~--~---
[sage-support] Re: sage installation Ubuntu 7.10 - extracting .tar error
OK, thanks. I am happy to report I downloaded the source successfully using wget and compiled it in about 5 hours (AMD Athlon XP1800 - 1.5 GHz) Chris On Mar 3, 3:10 pm, Carlo Hamalainen [EMAIL PROTECTED] wrote: On Mon, Mar 3, 2008 at 8:01 PM, Chris S. [EMAIL PROTECTED] wrote: As William said, you didn't get the full file. If your connection is a bit flaky then wget is better than Firefox/IE/etc: $ wget -chttp://sagemath.org/SAGEbin/linux/32bit/sage-2.10.2-linux-32bit-ubunt... The -c means continue so you can stop and restart the download. Cheers, -- Carlo Hamalainenhttp://carlo-hamalainen.net --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sage-support] Re: mixed Integer Linear Programming solvers in SAGE?
SAGE includes CVXOPT, which might include it in future releases. We're in the process of making simple interfaces to the ILP solvers in GLPK and MOSEK, and we have considered lpsolve also. The default solvers in CVXOPT does not handle integer constraints. On Mar 4, 8:25 pm, Reckoner [EMAIL PROTECTED] wrote: Does SAGE already contain the following package: http://sourceforge.net/projects/lpsolve for mixed Integer Linear Programming (MILP) solver lp_solve solves pure linear, (mixed) integer/binary, semi-continuous and special ordered sets (SOS) models. If not, will it? Are there already alternatives to this in SAGE already? Thanks in advance --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sage-support] Re: Vector fields and Quivers
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 -~--~~~~--~~--~--~---
[sage-support] Spline question
Playing with splines for other reasons, I found what I beat down to the following snippet (see attached) *v = [] # Will hold points step = 0.5 # Fineness of my approximation for x in srange(0, 2*pi, step): # Fill parameter *v* with points v.append((cos(x), sin(x))) # on the unit circle. show(points(v, rgbcolor=(1,0,0), pointsize=20) + plot(spline(v), rgbcolor=(0,0,1)))* Aha!, I thought, I'm being clueless. No one splines a parametric curve. But curious, I did some googleing. At http://www.tau.ac.il/~kineret/amit/scipy_tutorial/ there is a nice example at Figure 3, as there is at http://www.tau.ac.il/~kineret/amit/scipy_tutorial/ at Curve fitting and fairing using conic splines. Glanced at a couple SAGE pages, http://www.sagemath.org/doc/html/ref/module-sage.plot.plot.html http://www.sagemath.org/doc/html/ref/module-sage.plot.plot3d.list-plot3d.html, but nothing seemed helpful. Thanks for any ideas. Dean --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~--- inline: spline_attempt.png
[sage-support] Re: file with .sage extension question
On Thu, Feb 28, 2008 at 9:36 AM, Kate [EMAIL PROTECTED] wrote: What gives with the following session below? More specifically, what happens to the file docstring when the file has a .sage extension? There is a bug in the .sage -- .py conversion process that your example below illustrates. We are tracking this at http://trac.sagemath.org/sage_trac/ticket/2391 and a patch fixing the problem will be posted very very soon. -- William === begin shell session === $ cat sanity #!/usr/bin/env sage rHere is a docstring for this file. print __doc__ control-d $ cat sanity #!/usr/bin/env sage rHere is a docstring for this file. print __doc__ $ chmod +x sanity $ ./sanity Here is a docstring for this file. $ cp sanity madness.sage $ ./madness.sage None $ === end shell session === Kate -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sage-support] Re: Spline question
Maybe I'm missing something, but what is your question? --Mike On Tue, Mar 4, 2008 at 12:00 PM, dean moore [EMAIL PROTECTED] wrote: Playing with splines for other reasons, I found what I beat down to the following snippet (see attached) v = [] # Will hold points step = 0.5 # Fineness of my approximation for x in srange(0, 2*pi, step): # Fill parameter *v* with points v.append((cos(x), sin(x))) # on the unit circle. show(points(v, rgbcolor=(1,0,0), pointsize=20) + plot(spline(v), rgbcolor=(0,0,1))) Aha!, I thought, I'm being clueless. No one splines a parametric curve. But curious, I did some googleing. At http://www.tau.ac.il/~kineret/amit/scipy_tutorial/ there is a nice example at Figure 3, as there is at http://www.tau.ac.il/~kineret/amit/scipy_tutorial/ at Curve fitting and fairing using conic splines. Glanced at a couple SAGE pages, http://www.sagemath.org/doc/html/ref/module-sage.plot.plot.html http://www.sagemath.org/doc/html/ref/module-sage.plot.plot3d.list-plot3d.html , but nothing seemed helpful. Thanks for any ideas. Dean --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sage-support] Re: Animation speed question
When I used *step = 0.095*, I have 64 frames, close enough to the wikipedia image's of 66. But resultant animation is choppy, where wikipedia's is fairly smooth. I tinkered with a spline to smooth out a different curve, but it ran fantastically slow, -- something about too many points? -- so gave up on it for this image. Thanks anyway. Will occasionally return to this -- the problem interests me. Dean --- On Sun, Mar 2, 2008 at 1:15 PM, Carl Witty [EMAIL PROTECTED] wrote: On Mar 1, 1:09 pm, dean moore [EMAIL PROTECTED] wrote: When I wrote the code living at https://www.sagenb.org/home/pub/1687/ I was inspired by the wikipedia image (made via MuPAD) on the page at http://en.wikipedia.org/wiki/Hypotrochoid (permalink http://en.wikipedia.org/wiki/Image:HypotrochoidOutThreeFifths.gif). It looks like both images animate at about 10 frames per second in my Firefox; your image has 240 frames, and the Wikipedia image has 66, so the Wikipedia animation completes in about 1/4 the time. I don't know why setting delay=1 doesn't seem to be honored. I tried delay=100 and that worked. (I'm guessing it's a deliberate design decision in Firefox, to prevent people from making fast, flickery animated GIFs; but it also might be a bug in Sage, or a bug in ImageMagick or Firefox.) But anyway, the solution is to use fewer frames. Carl --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---