0
$\begingroup$

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?

$\endgroup$
6
  • 3
    $\begingroup$ Just use the condition x[18]==some value... $\endgroup$ Commented 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$ Commented Apr 29, 2016 at 14:33
  • $\begingroup$ Thank you for the info. That seems really weird that you cannot do something like $\endgroup$
    – tmwitten
    Commented May 3, 2016 at 8:29
  • $\begingroup$ Sorry, hit the return key. To finish, seems strange that you cannot do something like $\endgroup$
    – tmwitten
    Commented May 3, 2016 at 8:30
  • $\begingroup$ set tstart=18 and then do something like u[tstart]=value $\endgroup$
    – tmwitten
    Commented May 3, 2016 at 8:31

1 Answer 1

1
$\begingroup$

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}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.