Ask Your Question

dxvxd's profile - activity

2017-04-07 04:58:29 +0100 received badge  Notable Question (source)
2015-03-20 10:09:31 +0100 received badge  Nice Question (source)
2014-01-15 15:04:32 +0100 received badge  Famous Question (source)
2013-12-23 16:17:08 +0100 received badge  Popular Question (source)
2013-06-17 12:53:55 +0100 received badge  Notable Question (source)
2013-03-03 03:07:50 +0100 received badge  Popular Question (source)
2013-01-20 22:54:50 +0100 marked best answer Animation example from does not work.

I posted this answer in sage-support, but for completeness, I'll post it here as well. The following works for me:

sage: from animate_decay import *
2013-01-17 13:10:25 +0100 asked a question Animation example from does not work.

I'm trying to run thisexample from I downloaded the source code and ran:

sage: load('')

sage: plt.savefig('foo.png')

The file, foo.png, contained an empty Cartesian plane. I also typed in the code verbatim into the Sage interpreter and had the same results. I am running Sage Version 5.5, Release Date: 2012-12-22 on Ubuntu 12.04.1 LTS. Any suggestions would be greatly appreciated!

2012-11-11 06:46:17 +0100 received badge  Student (source)
2012-10-17 13:57:51 +0100 commented answer Publishing worksheets in Wordpress, Blogger...

Could you give a bit more detail in this answer, please?

2012-10-15 13:00:18 +0100 commented answer Phase portraits of 2-dimensional systems

How can I restrict the max/min values in the solutions? Is there a uniform way to do this or restrict the axes' range (e.g., force the plot onto [-2,2]x[-2,2] )

2012-10-15 00:48:02 +0100 received badge  Supporter (source)
2012-10-15 00:48:00 +0100 marked best answer Phase portraits of 2-dimensional systems
sage: maxima('plotdf([-y,-x],[x,y],[x,-2,2],[y,-2,2])')

Every click in the obtained field gives you a new trajectory

Precise coordinates of an initial point can be provided in plot setup

New x y coordinates + Enter adds a new trajectory

2012-10-15 00:47:59 +0100 received badge  Scholar (source)
2012-10-15 00:20:50 +0100 commented answer Phase portraits of 2-dimensional systems

@calc314: could you describe what happens when you enter the above code?

2012-10-14 15:02:40 +0100 asked a question Phase portraits of 2-dimensional systems

I'm trying to plot solutions to two dimensional ordinary differential equations. I found that Sage makes it easy to plot a vector field and, using ode_solver(), I can plot solutions on top of the vector field by specifying an initial condition y_0 and some range of time to run (t_span).

However, this method I'm using seems to be quite ad hoc, as I have to choose the right initial conditions and time span / know a lot about my system in order to plot a nice picture. Let's make this more concrete:

Say I want to draw a nice phase portrait for

$\dot{x} = -y$

$\dot{y} = -x$

First I generate the vector field:

var('x y')

Then I use ode_solver() to plot solutions with initial conditions going around the unit circle:

T = ode_solver()
T.function=lambda t,y:[-y[1],-y[0]]
solutions = []
c = circle((0,0), 1, rgbcolor=(1,0,1))
for k in range(0,8):
    solutions.append(line([p[1] for p in T.solution]))

This generates the following picture:

But if I change run the system for one more unit of time (set t_span=[0,2]), the picture gets skewed:

This makes sense, of course, because the magnitude of the vectors along $y=-x$ get big as you get further away from the origin. Similarly, the trajectory along $y=x$ has trouble getting to the origin because the magnitude of those vectors get very small. Which all makes me think there's a better way to do this. Thoughts?