1 | initial version |

OK, I think I have a path to a solution. I have changed the differential equation so that it has zeros and this code prints the values on either side of where the function crosses zero. I can do something similar for the extrema. So I guess I am now asking if there is a function call that does this, or if there is a smarter way. Thanks, Wayne

var('t y z') P=desolve_system_rk4([z,-z^2*(-2+t/(1+t))-y],[y,z],ics=[0.1,10,2],ivar=t,end_points=100) Q=[ [t1,y1] for t1,y1,z1 in P] line(Q).show() print len(Q) [a1,b1]=Q[0] for i in range(1,len(Q)): [a2,b2]=Q[i] if(((b1<0.)and(b2>0.)) or ((b1>0.)and(b2<0.))): print a1,b1,a2,b2 a1=a2 b1=b2

2 | No.2 Revision |

OK, I think I have a path to a solution. I have changed the differential equation so that it has zeros and this code prints the values on either side of where the function crosses zero. I can do something similar for the extrema. So I guess I am now asking if there is a function call that does this, or if there is a smarter way. Thanks, Wayne

var('t y ~~z')
P=desolve_system_rk4([z,-z^2*(-2+t/(1+t))-y],[y,z],ics=[0.1,10,2],ivar=t,end_points=100)
~~z')

P=desolve_system_rk4([z,-z^2*(-2+t/(1+t))-y],[y,z],ics=[0.1,10,2],ivar=t,end_points=100)

Q=[ [t1,y1] for t1,y1,z1 in ~~P]
line(Q).show()
~~P]

line(Q).show()

print ~~len(Q)
[a1,b1]=Q[0]
~~len(Q)

[a1,b1]=Q[0]

for i in ~~range(1,len(Q)):
~~range(1,len(Q)):

```
[a2,b2]=Q[i]
```~~ ~~ if(((b1<0.)and(b2>0.)) or ((b1>0.)and(b2<0.))):
~~ ~~ print a1,b1,a2,b2
~~ ~~ a1=a2
~~ b1=b2~~ b1=b2

3 | No.3 Revision |

OK, I think I have a path to a solution. I have changed the differential equation so that it has zeros and this code prints the values on either side of where the function crosses zero. I can do something similar for the extrema. So I guess I am now asking if there is a function call that does this, or if there is a smarter way. Thanks, Wayne

var('t y z')

P=desolve_system_rk4([z,-z^2*(-2+t/(1+t))-y],[y,z],ics=[0.1,10,2],ivar=t,end_points=100)

Q=[ [t1,y1] for t1,y1,z1 in P]

line(Q).show()

print len(Q)

[a1,b1]=Q[0]

for i in range(1,len(Q)):

```
[a2,b2]=Q[i]
if(((b1<0.)and(b2>0.)) or ((b1>0.)and(b2<0.))):
print a1,b1,a2,b2
a1=a2
b1=b2
```

4 | No.4 Revision |

`var('t y `~~z')~~z')
P=desolve_system_rk4([z,-z^2*(-2+t/(1+t))-y],[y,z],ics=[0.1,10,2],ivar=t,end_points=100)
P=desolve_system_rk4([z,-z^2*(-2+t/(1+t))-y],[y,z],ics=[0.1,10,2],ivar=t,end_points=100)

Q=[ [t1,y1] for t1,y1,z1 in ~~P]~~

P]
line(Q).show()
line(Q).show()

print len(Q)
[a1,b1]=Q[0]
print len(Q)

[a1,b1]=Q[0]

for i in ~~range(1,len(Q)):~~

range(1,len(Q)):
~~ ~~```
[a2,b2]=Q[i]
if(((b1<0.)and(b2>0.)) or ((b1>0.)and(b2<0.))):
print a1,b1,a2,b2
a1=a2
b1=b2
```

` `

` `

` `

` `

```
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
```