Question: The solution returned by dsolve seems to be lost

Hi everybody,

I use dsolve(..., numeric, events =[...], parameters = [...], range=0..TMAX) to solve a parameterized system of 2 ODEs (unknowns x(t) and v(t)).

The solution over the whole range [0, TMAX] is constructed by assembling partial solutions over adjacent subranges of [0, TMAX].

(please look the attached file and feel free to contact me if you need more details than those given below

There exist two types of solution :

  • Type 1 : trivial solution : for all t in some range [a>=0, b<= TMAX], the solution is x(t)=0 and v(t)=0
  • Type 2 : for all t in some range [b>=0, c<= TMAX] {x(t), v(t)} is the solution of the differential system


The end of the simulation corresponds :

  • either to t=TMAX
  • either to x(t) = CMAX where CMAX is some predefined value for x(t)
     

I use events to manage the two following situations 

  • x(t) = CMAX
  • x(t) = 0 and v(t) < 0 : this is the situation which describes the transition between Type 2 solutution and Type 1 solution


The global solution is constructed by assembling partial solutions over subranges [0, b[1]], [b[1], b[2]], [b[2], b[3]] ... where type 1 solutions "live" in [b[n], b[n+1]] if n is odd and type 2 solutions in  [b[n], b[n+1]] if  n is even.
 
The assembly of the partial solutions doesn't work correctly : I identified the reason but I'm not capable to fix it.
If you look to the red instructions on yellow background you will see they do not return the same answer than the pink instructions (look to the blue outputs over the plot) . 

This is probably due to a very big mistake on my part  but I can't fix it !

Once again, if my explanations are not sufficient or if I'm not enough clear, feel free to ask me any questions you need.

Thanks in advance

 

ParametricDsolve.mw

 



 

Please Wait...