# Numerically solving an ODE depending on an unknown boundary value

I am trying to solve a ODE related to its boundary value with NDSolve

NDSolve[
{f'''[x] + 1/2*f[x]*f''[x] + f'' == 0,
f' == 0, f == 0, f' == 1},
f, {x, 0, 10}]


The error message is:

NDSolve::litarg: To avoid possible ambiguity, the arguments of the dependent variable in {(f^′′)+1/2 f[η] (f^′′)[η]+(f^(3))[η]==0} should literally match the independent variables.

I guess the issue is that I cannot define the boundary value within the equation in this way. How could I add this term into equation and solve it?

• Your ode do not make too much sense. What is f'' doing in the ODE itself? This is a constant. So you could just as well write NDSolve[{f'''[x]+1/2*f[x]*f''[x]+c==0..... or may be you meant to have it in the B.C. but then you have too many boundary conditions Dec 17, 2017 at 23:11
• f'' is unknown. The ODE is still with three boundary conditions Dec 17, 2017 at 23:18
• You have 3rd order ODE, and you have given 3 boundary conditions already. Dec 17, 2017 at 23:21
• Yes. BCs are enough to solve the ODE. However, f'' is also involved into the equation. Dec 17, 2017 at 23:25
• Your ODE is equivalent to $f'''(x)+f(x)f''(x)/2+c=0$ with the boundary conditions $f'(0)=f(0)=0$, $f'(1000)=1$ and $f''(0)=0$. So it is equivalent to a third ODE with four BCs. I don't think there is a solution for an arbitrary $c$. Even if there were, you cannot solve numerically a problem with an unspecified BC (and thus not your equivalent problem either). Dec 17, 2017 at 23:54

You get a solution when searching for f''==c

g[y_?NumericQ, c_?NumericQ] := f[y] /. First@
NDSolve[{f'''[x] + 1/2*f[x]*f''[x] + c == 0, f' == 0, f == 0,
f'' == c}, f, {x, 0, 1000}]

h[y_?NumericQ, c_?NumericQ] := f'[y] /. First@
NDSolve[{f'''[x] + 1/2*f[x]*f''[x] + c == 0, f' == 0, f == 0,
f'' == c}, f, {x, 0, 1000}]

cfr = c /. First@FindRoot[h[1000, c] == 1, {c, -.03}, WorkingPrecision -> 20,
AccuracyGoal -> 8, PrecisionGoal -> 8]

(*    -0.025783801817875997941    *)

h[1000, cfr]

(*    1.    *)

Plot[g[y, cfr], {y, 0, 10}, GridLines -> Automatic, PlotStyle -> Red] 