# Problem with interpolating function returned by NDEigensystem

I'm trying to evaluate interpolating function returned by NDEigensystem at a point but Mathematica won't evaluate it.

{vals, funs} = NDEigensystem[-Laplacian[u[x], {x}], u[x], {x, 0, \[Pi]}, 4];
f = funs[[3]] (*3rd eigenfunction*)
Plot[f[x], {x, 0, Pi}] (*this plot returns blank plot*)
Plot[f, {x, 0, Pi}] (*this plot works fine*)
f[2]


As you can see, f[2] is not evaluated. Any help with the problem with the plot and function evaluation would be appreciated.

Change u[x] to u

{vals, funs} =NDEigensystem[-Laplacian[u[x], {x}], u , {x, 0, \[Pi]}, 4]


now

Plot[funs[[3]][x],{x,0,Pi}]


does what you are looking for.

To plot all the eigenfunctions try Plot[Through[funs[x]],{x,0,Pi}]

• Thank you so much, this fixed my problem. Commented Jul 15, 2019 at 13:33
• You're welcome! Commented Jul 15, 2019 at 13:33
• On a related note, how can I define new functions using my interpolating function f (or manipulate interpolating functions in general)? For example in my above code, if I define ff=f+2 or ff=2*f, I'm not able to evaluate this function (e.g., ff[2] does not evaluate). Or how can I define new function ff= Sin[x]*f for example? Commented Jul 15, 2019 at 13:50
• Try ff = FunctionInterpolation[2 funs[[3]][x], {x, 0, Pi}] or fff = Function[{x}, funs[[3]][x] + 2] Commented Jul 15, 2019 at 13:53
• There are no errors in both variants( of my comment). Perhaps the second variant is preferable. Commented Jul 15, 2019 at 14:09