I have a system of six differential equations (linear for the sake of the discussion). I want to set the initial condition to start at time t=18 and not time t=0. I know the values of the dependent variables at t=18 because they derive from the experimental data. So let's say I have an ode describing x(t) and y(t) and I want to start the differential equation at t=18 as my initial condition. How do I do this? I have looked at a myriad of examples at they all start off with x(0)=some value and y(0)=some value. What I need is for Mathematica to solve the system starting from the initial conditions of x(18) and y(18). Ideas?
$\begingroup$
$\endgroup$
6
-
3$\begingroup$ Just use the condition x[18]==some value... $\endgroup$– Quantum_OliCommented Apr 29, 2016 at 9:01
-
$\begingroup$ They always start at t=0 since you can always change to another variable t' = t -18 and the equations remain the same. $\endgroup$– tsuresuregusaCommented Apr 29, 2016 at 14:33
-
$\begingroup$ Thank you for the info. That seems really weird that you cannot do something like $\endgroup$– tmwittenCommented May 3, 2016 at 8:29
-
$\begingroup$ Sorry, hit the return key. To finish, seems strange that you cannot do something like $\endgroup$– tmwittenCommented May 3, 2016 at 8:30
-
$\begingroup$ set tstart=18 and then do something like u[tstart]=value $\endgroup$– tmwittenCommented May 3, 2016 at 8:31
|
Show 1 more comment
1 Answer
$\begingroup$
$\endgroup$
The second comment on this post is incorrect. You can set a condition for any time t0
, whether initial or not. Independently of this, you can solve the equation for any interval of the variable. Example:
NDSolve[{f'[t] == -f[t], f[2] == 1}, f, {t, 1, 3}]
Here the equation is solved for the interval $t \in [1,3]$, but the condition is set for $t == 2$ as f[2] == 1
.
You can even have the condition outside of the solution range:
NDSolve[{f'[t] == -f[t], f[0] == 1}, f, {t, 1, 3}]