While trying to solve
With[{h = h[x]},
{eq, bc} = {D[h, x, x] == Sin[Pi x], {h == 0 /. x -> 0,
D[h, x, x] == -D[h, x] + h /. x -> 1}}];
g = NDSolveValue[{eq, bc}, h, {x, 0, 1}]
I got the error
NDSolve::nlnum1: The function value {0.,0.31831 +(NDSolve`h$9$1^[Prime])1} is not a list of numbers with dimensions {2} when the arguments are {0.,0.,0.31831,0.63662}.
Then I found this trick so I tried
With[{h = h[x]},
{eq, bc} = {D[h, x, x, x] ==
Pi Cos[Pi x], {D[h, x, x] == Sin[Pi x] /. x -> 0,
h == 0 /. x -> 0, D[h, x, x] == -D[h, x] + h /. x -> 1}}];
g = NDSolveValue[{eq, bc}, h, {x, 0, 1}]
Plot[g[x], {x, 0, 1}]
I guess this solution is not correct due to high values (maybe instability).
Is there a better way to solve such an equation?
ode = h''[x] == Sin[Pi x]
andbc = {h[0] == 0, h''[1] == -h'[1] + h[1]}
which is much more readable and clear. $\endgroup$