jbprimes

10 Reputation

2 Badges

13 years, 10 days

MaplePrimes Activity


These are replies submitted by jbprimes

@PatrickT 

For the simulations I described above, I have used the following:

  • Digits = 10
  • No stepsize specified
  • Default method (rkf45)
  • Default values for abserr, relerr
  • Integrating with respect to t, from 0 up to 3500 (t represents days)

Here are some plots. U is blue, V is black, U+V is red. The green line is a function that has an effect on the ODEs for U and V.

The first plot is without any events specified.  The dashed lines around t = 200 are caused by stopping and starting the simulation using new initial conditions representing near-instantaneous changes in U and V.  I do not think this part of the negative values issue, which generally occurs later on.


The second plot is with events=[[[U(t),U(t)<0],halt],[[V(t),V(t)<0],halt]]:


If the event specification events = [[U(t) = 0..1, halt], [V(t) = 0..1, halt]] is used, the simulation halts around t = 600.

 

You can see that after a long period where U and V are near zero, the values can grow once again.  The values of U and V, while small, are important in determining the long-term behaviour.  I would like to find a way to simulate this behaviour while minimizing the effect numerical approximation/error has on the behaviour.  Although it is impossible to see on the graph, there are a few negative values for U in the second plot.

Let me know if any other info would help.

Thanks.

@PatrickT 

For the simulations I described above, I have used the following:

  • Digits = 10
  • No stepsize specified
  • Default method (rkf45)
  • Default values for abserr, relerr
  • Integrating with respect to t, from 0 up to 3500 (t represents days)

Here are some plots. U is blue, V is black, U+V is red. The green line is a function that has an effect on the ODEs for U and V.

The first plot is without any events specified.  The dashed lines around t = 200 are caused by stopping and starting the simulation using new initial conditions representing near-instantaneous changes in U and V.  I do not think this part of the negative values issue, which generally occurs later on.


The second plot is with events=[[[U(t),U(t)<0],halt],[[V(t),V(t)<0],halt]]:


If the event specification events = [[U(t) = 0..1, halt], [V(t) = 0..1, halt]] is used, the simulation halts around t = 600.

 

You can see that after a long period where U and V are near zero, the values can grow once again.  The values of U and V, while small, are important in determining the long-term behaviour.  I would like to find a way to simulate this behaviour while minimizing the effect numerical approximation/error has on the behaviour.  Although it is impossible to see on the graph, there are a few negative values for U in the second plot.

Let me know if any other info would help.

Thanks.

Hi Preben,

I may a similar piecewise function to set U = 0 or U' = 0 should U fall below some cut-off value, e.g. E-10.

I notice that in your example, the value of x is not actually zero but ~ -1.05E-7.  I suppose this is considered equivalent to zero given the error bounds on the method?

Thanks.

Hi Preben,

I may a similar piecewise function to set U = 0 or U' = 0 should U fall below some cut-off value, e.g. E-10.

I notice that in your example, the value of x is not actually zero but ~ -1.05E-7.  I suppose this is considered equivalent to zero given the error bounds on the method?

Thanks.

Hi Patrick,

Thank you for the links.  I know a fair bit more about events thanks to these.

I haven't posted any examples as my model is fairly long and complicated and the plots are big.  I should mention that I have been using "assuming U(t)>=0, V(t)>=0" with dsolve.

I have tried the following events:

events = [[U(t) = 0..1, halt], [V(t) = 0..1, halt]]   These events halt dsolve, but it seems this only occurs when the value of U or V is large negative enough.  For example, U(t) = -2.5E-16 will not cause a halt. Perhaps the value must be greater in magnitude than the abserr + relerr for the method I am using?  I believe this is 1.1E-6 for rkf45.


events=[[[U(t),U(t)<0],halt],[[V(t),V(t)<0],halt]]   What's interesting about these events, is that under the same conditions where the first event will cause a halt, these conditions do not.  Negative values do occur (on the order of E-13), but do not halt the simulation.  Further, my long-term behaviour is large positive instead of large negative. (The long-term behaviour with no events is large negative & undesired/nonsensical.)  It seems that conditioning for negative values may actually cause Maple to avoid negative values larger than the abserr + relerr?

I have considered using events to reverse the sign of U (or V) should U (or V) become negative, but I have no feeling for how appropriate this would be.  I am interested in small positive values of U and V, as small as 1E-10, maybe smaller.  Perhaps a cut-off function, setting U = 0 for values say < 1E-10 may be appropriate, since such small values indicate a biologically unrealistic size for my simulation.

Thanks

Hi Patrick,

Thank you for the links.  I know a fair bit more about events thanks to these.

I haven't posted any examples as my model is fairly long and complicated and the plots are big.  I should mention that I have been using "assuming U(t)>=0, V(t)>=0" with dsolve.

I have tried the following events:

events = [[U(t) = 0..1, halt], [V(t) = 0..1, halt]]   These events halt dsolve, but it seems this only occurs when the value of U or V is large negative enough.  For example, U(t) = -2.5E-16 will not cause a halt. Perhaps the value must be greater in magnitude than the abserr + relerr for the method I am using?  I believe this is 1.1E-6 for rkf45.


events=[[[U(t),U(t)<0],halt],[[V(t),V(t)<0],halt]]   What's interesting about these events, is that under the same conditions where the first event will cause a halt, these conditions do not.  Negative values do occur (on the order of E-13), but do not halt the simulation.  Further, my long-term behaviour is large positive instead of large negative. (The long-term behaviour with no events is large negative & undesired/nonsensical.)  It seems that conditioning for negative values may actually cause Maple to avoid negative values larger than the abserr + relerr?

I have considered using events to reverse the sign of U (or V) should U (or V) become negative, but I have no feeling for how appropriate this would be.  I am interested in small positive values of U and V, as small as 1E-10, maybe smaller.  Perhaps a cut-off function, setting U = 0 for values say < 1E-10 may be appropriate, since such small values indicate a biologically unrealistic size for my simulation.

Thanks

Page 1 of 1