I have a little question. I used the built in function 'NDEigensystem' to solve a differential equation; the results of this operation give me several functions; so I type in imput one of this like:


and the output is the following: enter image description here

To evaluate this x-dependent function, in a particular value of x, I have to use the following:


Is there a way to create a new function that has explicit x-dependence like:


Thanks for any tips and helps!

There is my code that find the functions mentioned previously:

For[i = 0, i < passiL + 1, i++,For[j = 0, j < passiw + 1, j++,H:=(-Laplacian[#,{x}]+V[x, a, Lin + incrementoL i] #) &; {{energies[1][i][j],energies[2][i][j]},{funcs[1][i][j],funcs[2][i][j]}}=NDEigensystem[{H@\[Psi][x],DirichletCondition[\[Psi][x]==0,True]},\[Psi][x],{x,0,a+Lin+incrementoL i + win + incrementow j },dim,Method->{"SpatialDiscretization"->{"FiniteElement",\"MeshOptions" ->"MaxCellMeasure" -> 0.05}}},"Eigensystem" -> {"FEAST","Interval"->{0,a+Lin + incrementoL i + win + incrementow j }}}]]]

I don't think it is all necessary, but I post all of it.

  • 1
    $\begingroup$ You mention that these functions come from NDEigensystem[]; you might only need to specify its second argument in the form {u} instead of {u[t, x]} to get what you want. (And if you want a more definite answer, you need to disclose the code that generates these functions of yours.) $\endgroup$ Dec 17, 2021 at 10:16
  • $\begingroup$ Ok, I edit the question so you can see my code to evaluate that functions. $\endgroup$ Dec 17, 2021 at 10:19

1 Answer 1


I can't get your code to work due to missing brackets. However, if we pull an example out of Help we can work with an alternative.

ℒ = -Laplacian[u[x, y], {x, y}];
{vals, funs} = 
   u[x, y], {x, 0, π}, {y, 0, π}, 4];

Looking at one of the funs we see


enter image description here

Now to get something more usable which is what I think you want we can do

f4 = Head[funs[[4]]]

which strips off the square brackets at the end and gives

enter image description here

We now have a name for our interpolation function and we can put back the square brackets with the notation we need.

Plot3D[f4[x, y], {x, 0, π}, {y, 0, π}]

enter image description here

Does that help?

  • $\begingroup$ Yes! It helps me! Thank you.Is there a difference between the interpolating function with '[x,y]' and without '[x,y]'? $\endgroup$ Dec 17, 2021 at 15:45
  • $\begingroup$ What I was trying to say in the comments to @Lorenzo is that if you instead evaluate {vals, funs} = NDEigensystem[ℒ, u, {x, 0, π}, {y, 0, π}, 4];, you wouldn't need to fiddle with heads. $\endgroup$ Dec 17, 2021 at 16:10
  • $\begingroup$ Yes, I understand it. My question is if there are differences between thath two type of interpolating functions. $\endgroup$ Dec 17, 2021 at 16:18
  • $\begingroup$ No difference at all to the interpolation function. $\endgroup$
    – Hugh
    Dec 17, 2021 at 16:29

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.