2
$\begingroup$

Consider the following DDE:

$ f''(x)+ f(x+ 1) = 0.$

For $ x \gg 1$, this DDE should approximately reduce to that of a simple harmonic oscillator: $f''(x)+f(x) \approx 0$. Suppose that for some physical reason I require $f(x) = \sin{x}$ for large $x$ and then use this as a ``history'' for the above DDE. I am then interested to see what $f(x)$ is in the vicinity of $x=0$.

The problem is that (not surprisingly) depending on where I set the history condition (when using NDSolve), I get a different answer for $f(x)$ near $x=0$. Any suggestions for how to properly handle this?

$\endgroup$
7
  • $\begingroup$ Plase read Math Stackexchange question 2765086 "Writing the recursive as explicit" and its answers for ideas. Also see [MSE question 2245492] (math.stackexchange.com/q/2245492) "Continuous recursive iteration" for $\,f'(x)=f(x-1).$ $\endgroup$
    – Somos
    Commented Jan 2, 2019 at 2:06
  • $\begingroup$ Thanks Somos, but my question is how to use NDSolve to handle this problem. $\endgroup$
    – Sina
    Commented Jan 2, 2019 at 2:22
  • $\begingroup$ Ah, yes. I should have mentioned that I don't think NDSolve[] is going to help. $\endgroup$
    – Somos
    Commented Jan 2, 2019 at 2:34
  • $\begingroup$ In the documentation of NDSolveValue I found an example which might help(NDSolveValue[{x'[t] == x[t] (x[t - Pi] - x'[t - 1]), x[t /; t <= 0] == Cos[t]}, x, {t, 0, 8}]): Instead of initial conditions try f[t /; t >= 0] == Sin[t] $\endgroup$ Commented Jan 2, 2019 at 9:34
  • 11
    $\begingroup$ You haven't accepted any answers to any of your questions. You can accept the answer, if any, that solves your problem, by clicking the checkmark sign. $\endgroup$
    – Michael E2
    Commented Feb 3, 2019 at 23:23

2 Answers 2

3
$\begingroup$

Assuming an asymptotic 2Pi-periodic solution f[t]==s Sin[t]+ c Cos[t] the ode can be integrated:

first integration:

gl1 = f'[x] - f'[0] == Integrate[f[1 + u], {u, 0, x}] /. f -> (c Cos[#]+ s Sin[#] &)
gl1/. x->2Pi (* 2Piperiodic boundary conditions*)
(* True*)

second integration

gl2 = f[x] - f[0] - f'[0] x ==Integrate[f[1 + u], {v, 0, x}, {u, 0, v}] /.f -> (c Cos[#] + s Sin[#] &)
sol=Solve[gl2 /. x -> 2 Pi, s][[1]]
(*{s -> (c Sin[1])/(1 + Cos[1])}*)

Asymptotic solution:

fasy=(c Cos[#] + s Sin[#] )& /. sol /.c->1;
fasy[x]
(*Cos[x] + (Sin[1] Sin[x])/(1 + Cos[1])*)

The initial values evalute to

{fasy[0], Derivative[1][fasy][0]}
(*{1, Sin[1]/(1 + Cos[1])}*)
$\endgroup$
2
$\begingroup$
sol = NDSolve[{f''[x] + f[x + 1] == 0, f[x /; x >= 0] == Sin[x]}, f, {x, 0, 8Pi}][[1]]
Plot[{Evaluate[f[x] /. sol], Sin[x]}, {x, 0, 8 Pi}]
$\endgroup$
1
  • $\begingroup$ For the case x /; x >= 0 NDSolve returns Sin[x] as result. Varying the lower limit for x (x /; x >= x0 ) shows, that the initial values change and increase depending on x0. $\endgroup$ Commented Jan 2, 2019 at 10:15

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.