Hi guys,(adsbygoogle = window.adsbygoogle || []).push({});

I have a differential equation in NDSolve and for example lets 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, lets 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 cant setup initial conditions as a piecewise function. Thanks for your help

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Add new equations in NDSolve

**Physics Forums | Science Articles, Homework Help, Discussion**