[sage-support] Re: phase portrait with sage.

2011-03-21 Thread achrzesz
Also introducing lambda function wasn't necessary: import scipy.integrate a=1.0 b=2.0 def fun(t): if t<=-b: return -a elif fhttp://groups.google.com/group/sage-support URL: http://www.sagemath.org

[sage-support] Re: phase portrait with sage.

2011-03-21 Thread achrzesz
Of course N=100 in "my" code and repeated x0=[[0.5*k,0.5*k] for k in range(-10,10)] in Marshall one are superfluous :) Andrzej Chrzeszczyk On 21 Mar, 13:58, kcrisman wrote: > On Mar 20, 9:55 pm, Marshall Hampton wrote: > > > > > Slightly more Sage-ified version of the above very nice solution

[sage-support] Re: phase portrait with sage.

2011-03-21 Thread kcrisman
On Mar 20, 9:55 pm, Marshall Hampton wrote: > Slightly more Sage-ified version of the above very nice solution: > > import scipy.integrate > a=1.0 > b=2.0 > > def fun(t): >     if t<=-b: >         return -a >     elif f         return t*a/b >     else: >         return a > > g=lambda t:fun(t) >

[sage-support] Re: phase portrait with sage.

2011-03-20 Thread Marshall Hampton
Slightly more Sage-ified version of the above very nice solution: import scipy.integrate a=1.0 b=2.0 def fun(t): if t<=-b: return -a elif fhttp://groups.google.com/group/sage-support URL: http://www.sagemath.org

[sage-support] Re: phase portrait with sage.

2011-03-20 Thread achrzesz
import scipy.integrate import matplotlib.pyplot as plt import numpy a=1.0 b=2.0 def fun(t): if t<=-b: return -a elif fhttp://groups.google.com/group/sage-support URL: http://www.sagemath.org