- #1
nofilbarlas
- 4
- 0
Hi guys,
I have a differential equation in NDSolve and for example let's say it is just one equation. Based on some time value, I would like to add another differential equation in the NDSolve function and then the system will solve two ODEs. For example,
y' = 2 with y[0] = 1
Let says I run the code from t = 0 until t = 100. I would like Mathematica to add another differential equation in the NDSolve function as soon as it reachs time, let's say, t = 50. So at t = 50 I would then have
x' = x - y with x[50] = 1
Is there a way to do this in Mathematica? Any help would be appreciated. I was able to setup x' as a piecewise function so that when t >= 50 I can turn on x' = x - y but then the initial conditions will be a problem cause I can't setup initial conditions as a piecewise function. Thanks for your help
I have a differential equation in NDSolve and for example let's say it is just one equation. Based on some time value, I would like to add another differential equation in the NDSolve function and then the system will solve two ODEs. For example,
y' = 2 with y[0] = 1
Let says I run the code from t = 0 until t = 100. I would like Mathematica to add another differential equation in the NDSolve function as soon as it reachs time, let's say, t = 50. So at t = 50 I would then have
x' = x - y with x[50] = 1
Is there a way to do this in Mathematica? Any help would be appreciated. I was able to setup x' as a piecewise function so that when t >= 50 I can turn on x' = x - y but then the initial conditions will be a problem cause I can't setup initial conditions as a piecewise function. Thanks for your help