# Define inverse Laplace operator as map from functions to functions

I am trying to implement the inverse Laplace operator through

P[g_] := h /.NDSolve[{h''[x] == g[x], h[0] == 0, h[1] == 0}, h, {x, 0, 1}][[1]]


If I now define some $f$ and apply $P$,

f[x_] = 0.5 - Abs[x - 0.5];
P[f]


I do get an InterpolatingFunction, that takes the correct values, i.e. P[f][0.5] is defined and is what I expect. However, if I try to add a normalization of the solution,

P[g_] := h/h[0.5] /.NDSolve[{h''[x] == g[x], h[0] == 0, h[1] == 0}, h, {x, 0, 1}][[1]]


then I get -24.*InterpolatingFunction{...}, which cannot be evaluated, i.e. P[f][0.5] gives (-24.*InterpolatingFunction{...})[0.5]

Like this,

P[g_] := h[#]/h[0.5] & /.
NDSolve[{h''[x] == g[x], h[0] == 0, h[1] == 0}, h, {x, 0, 1}][[1]]


or like this

P[g_] := With[{h =
NDSolveValue[{h''[x] == g[x], h[0] == 0, h[1] == 0},
h, {x, 0, 1}]}, h[#]/h[.5] &]


Both evaluate as expected,

P[f][.5]
(* 1. *)

• Works, but when I try to evaluate a derivative with $ND[P[f][s],s,0.7]$ I get a non-numerical output containing ND itself and a few interpolatingFunctions – Bananach May 11 '16 at 12:59
• I can't reproduce that, for me ND[P[f][s], s, 0.7] gives an error but then gives the right answer. You can get the same answer without the NumericalCalculus package by evaluating D[P[f][s], s] /. s -> .3. Maybe you need to clear the definition of s? – Jason B. May 11 '16 at 13:11
• clearing s worked – Bananach May 11 '16 at 13:51