Re: [sage-support] desolve_system in sage

2012-10-11 Thread Doaa El-Sakout
Many thanks now I solved Lorentz equations and I plot in 2D.

But when I try to plot in 3D phase space I get result different about the
true "spirals "

This is what I did


from sage.calculus.desolvers import desolve_system_rk4
x,y,sigma,r,z,b,t=var('x,y,sigma,r,z,b,t')
sigma=10
b=8/3
r=10
P=desolve_system_rk4([sigma*(y-x),r*x-y-x*z,x*y-b*z],[x,y,z],ics=[0,0,1,0]
,ivar=t,end_points=20)

py=list_plot3d([[x,y,z] for t,x,y,z in P],plotjoined=True,axes_label=True)
show(py)

Please find the attached file to  see the plot
Thanks
Doaa

On 11 October 2012 12:55, David Joyner  wrote:

> On Thu, Oct 11, 2012 at 7:28 AM, Doaa El-Sakout  wrote:
> > Dear David,
> > I would like to plot x(t) against t similar for y and z
> > and after that plot [x,y,z] in phase space
> > So I want know the solution first for the system
> > before plot the result.
> > Thanks
> > Doaa
>
>
> Your system is similar to one used to model a Zombie attack (which is
> in turn borrowed from an infection model). The sage code is here:
> http://wdjoyner.org/zombies/love-war-zombies.sage
> The commands I think you want are towards the bottom.
> Slides going into more detail is here:
> http://wdjoyner.org/zombies/love-war-zombies_slides.pdf
> There is even a video:-)
>
> http://www.mosaic-web.org/go/MCAST/videos/MCAST-2011-04-22/lib/playback.html
>
>
> >
> >
> > On 11 October 2012 10:55, David Joyner  wrote:
> >>
> >> On Thu, Oct 11, 2012 at 3:20 AM, Doaa El-Sakout 
> wrote:
> >> > Hi everyone,
> >> > I try to solve a system of ODE by sage as follows
> >> >
> >> > x,y,sigma,r,z,b,t=var('x,y,sigma,r,z,b,t')
> >> > sigma=10
> >> > b=8/3
> >> > r=10
> >> > x= function('x',t)
> >> > y= function('y',t)
> >> > z= function('z',t)
> >> > d1=(diff(x,t)-sigma*(y-x)==0)
> >> > d2=(diff(y,t)-r*x+y+x*z==0)
> >> > d3=(diff(z,t)-x*y+b*z==0)
> >>
> >> This makes it non-linear. Did you intend to type that?
> >>
> >> > sol=desolve_system([d1,d2,d3],[x,y,z],ics=[0,1,0],ivar=t);show(sol)
> >> >
> >> > But I got the following error
> >> >
> >> > TypeError: unable to make sense of Maxima expression
> >> >
> >> >
> 'x(t)=ilt((?g3817-10*laplace(x(t)*z(t),t,?g3817)+1)/(?g3817^2+11*?g3817-90),?g3817,t)'
> >> > in Sage
> >> >
> >> >
> >> >
> >> > Any suggestion
> >> > Doaa
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups
> >> > "sage-support" group.
> >> > To post to this group, send email to sage-support@googlegroups.com.
> >> > To unsubscribe from this group, send email to
> >> > sage-support+unsubscr...@googlegroups.com.
> >> > Visit this group at http://groups.google.com/group/sage-support?hl=en
> .
> >> >
> >> >
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "sage-support" group.
> >> To post to this group, send email to sage-support@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> sage-support+unsubscr...@googlegroups.com.
> >> Visit this group at http://groups.google.com/group/sage-support?hl=en.
> >>
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "sage-support" group.
> > To post to this group, send email to sage-support@googlegroups.com.
> > To unsubscribe from this group, send email to
> > sage-support+unsubscr...@googlegroups.com.
> > Visit this group at http://groups.google.com/group/sage-support?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To post to this group, send email to sage-support@googlegroups.com.
> To unsubscribe from this group, send email to
> sage-support+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support?hl=en.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.


<>

Re: [sage-support] desolve_system in sage

2012-10-11 Thread David Joyner
On Thu, Oct 11, 2012 at 7:28 AM, Doaa El-Sakout  wrote:
> Dear David,
> I would like to plot x(t) against t similar for y and z
> and after that plot [x,y,z] in phase space
> So I want know the solution first for the system
> before plot the result.
> Thanks
> Doaa


Your system is similar to one used to model a Zombie attack (which is
in turn borrowed from an infection model). The sage code is here:
http://wdjoyner.org/zombies/love-war-zombies.sage
The commands I think you want are towards the bottom.
Slides going into more detail is here:
http://wdjoyner.org/zombies/love-war-zombies_slides.pdf
There is even a video:-)
http://www.mosaic-web.org/go/MCAST/videos/MCAST-2011-04-22/lib/playback.html


>
>
> On 11 October 2012 10:55, David Joyner  wrote:
>>
>> On Thu, Oct 11, 2012 at 3:20 AM, Doaa El-Sakout  wrote:
>> > Hi everyone,
>> > I try to solve a system of ODE by sage as follows
>> >
>> > x,y,sigma,r,z,b,t=var('x,y,sigma,r,z,b,t')
>> > sigma=10
>> > b=8/3
>> > r=10
>> > x= function('x',t)
>> > y= function('y',t)
>> > z= function('z',t)
>> > d1=(diff(x,t)-sigma*(y-x)==0)
>> > d2=(diff(y,t)-r*x+y+x*z==0)
>> > d3=(diff(z,t)-x*y+b*z==0)
>>
>> This makes it non-linear. Did you intend to type that?
>>
>> > sol=desolve_system([d1,d2,d3],[x,y,z],ics=[0,1,0],ivar=t);show(sol)
>> >
>> > But I got the following error
>> >
>> > TypeError: unable to make sense of Maxima expression
>> >
>> > 'x(t)=ilt((?g3817-10*laplace(x(t)*z(t),t,?g3817)+1)/(?g3817^2+11*?g3817-90),?g3817,t)'
>> > in Sage
>> >
>> >
>> >
>> > Any suggestion
>> > Doaa
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "sage-support" group.
>> > To post to this group, send email to sage-support@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > sage-support+unsubscr...@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/sage-support?hl=en.
>> >
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sage-support" group.
>> To post to this group, send email to sage-support@googlegroups.com.
>> To unsubscribe from this group, send email to
>> sage-support+unsubscr...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/sage-support?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To post to this group, send email to sage-support@googlegroups.com.
> To unsubscribe from this group, send email to
> sage-support+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] desolve_system in sage

2012-10-11 Thread Doaa El-Sakout
Dear David,
I would like to plot x(t) against t similar for y and z
and after that plot [x,y,z] in phase space
So I want know the solution first for the system
before plot the result.
Thanks
Doaa

On 11 October 2012 10:55, David Joyner  wrote:

> On Thu, Oct 11, 2012 at 3:20 AM, Doaa El-Sakout  wrote:
> > Hi everyone,
> > I try to solve a system of ODE by sage as follows
> >
> > x,y,sigma,r,z,b,t=var('x,y,sigma,r,z,b,t')
> > sigma=10
> > b=8/3
> > r=10
> > x= function('x',t)
> > y= function('y',t)
> > z= function('z',t)
> > d1=(diff(x,t)-sigma*(y-x)==0)
> > d2=(diff(y,t)-r*x+y+x*z==0)
> > d3=(diff(z,t)-x*y+b*z==0)
>
> This makes it non-linear. Did you intend to type that?
>
> > sol=desolve_system([d1,d2,d3],[x,y,z],ics=[0,1,0],ivar=t);show(sol)
> >
> > But I got the following error
> >
> > TypeError: unable to make sense of Maxima expression
> >
> 'x(t)=ilt((?g3817-10*laplace(x(t)*z(t),t,?g3817)+1)/(?g3817^2+11*?g3817-90),?g3817,t)'
> > in Sage
> >
> >
> >
> > Any suggestion
> > Doaa
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "sage-support" group.
> > To post to this group, send email to sage-support@googlegroups.com.
> > To unsubscribe from this group, send email to
> > sage-support+unsubscr...@googlegroups.com.
> > Visit this group at http://groups.google.com/group/sage-support?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To post to this group, send email to sage-support@googlegroups.com.
> To unsubscribe from this group, send email to
> sage-support+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support?hl=en.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] desolve_system in sage

2012-10-11 Thread David Joyner
On Thu, Oct 11, 2012 at 3:20 AM, Doaa El-Sakout  wrote:
> Hi everyone,
> I try to solve a system of ODE by sage as follows
>
> x,y,sigma,r,z,b,t=var('x,y,sigma,r,z,b,t')
> sigma=10
> b=8/3
> r=10
> x= function('x',t)
> y= function('y',t)
> z= function('z',t)
> d1=(diff(x,t)-sigma*(y-x)==0)
> d2=(diff(y,t)-r*x+y+x*z==0)
> d3=(diff(z,t)-x*y+b*z==0)

This makes it non-linear. Did you intend to type that?

> sol=desolve_system([d1,d2,d3],[x,y,z],ics=[0,1,0],ivar=t);show(sol)
>
> But I got the following error
>
> TypeError: unable to make sense of Maxima expression
> 'x(t)=ilt((?g3817-10*laplace(x(t)*z(t),t,?g3817)+1)/(?g3817^2+11*?g3817-90),?g3817,t)'
> in Sage
>
>
>
> Any suggestion
> Doaa
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To post to this group, send email to sage-support@googlegroups.com.
> To unsubscribe from this group, send email to
> sage-support+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




[sage-support] desolve_system in sage

2012-10-11 Thread Doaa El-Sakout
Hi everyone,
I try to solve a system of ODE by sage as follows

x,y,sigma,r,z,b,t=var('x,y,sigma,r,z,b,t')
sigma=10
b=8/3
r=10
x= function('x',t)
y= function('y',t)
z= function('z',t)
d1=(diff(x,t)-sigma*(y-x)==0)
d2=(diff(y,t)-r*x+y+x*z==0)
d3=(diff(z,t)-x*y+b*z==0)
sol=desolve_system([d1,d2,d3],[x,y,z],ics=[0,1,0],ivar=t);show(sol)

But I got the following error

TypeError: unable to make sense of Maxima expression
'x(t)=ilt((?g3817-10*laplace(x(t)*z(t),t,?g3817)+1)/(?g3817^2+11*?g3817-90),?g3817,t)'
in Sage


Any suggestion
Doaa

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.