# How to use an interpolating function as an intial condition for a PDE? [closed]

I want to be able to approximate a PDE, but my eigenfunction is an Interpolating function. Is there a way I can use an interpolating function as an initial condition in the PDE. For Example:

k = NDEigensystem[Laplacian[y[x], {x}] , y[x], {x, -1, 1}, 1]
(* {{3.40468*10^-14}, {InterpolatingFunction[{{-1., 1.} *)

NDSolve[
{
-Laplacian[u[x, t], {x}]/2 + x^4*u[x, t] == i*D[u[x, t], t],
u[x, 0] == k[2]
}
, u
, {x, -1, 1}
, {t, 1, 2}
]

During evaluation of In[18]:= NDSolve::ndnum:
Encountered non-numerical value for a derivative at t == 0.

• Can you show a very simple example, a few lines showing a very simple interpolating function and very simple PDE? Something where the answer to that would show you how to use the idea to solve your real problem? Put four spaces in front of each line of code instead of a screenshot so someone can scrape it off the screen into their MMA notebook. That can help someone who can't see your screen from here or what you have been working on for hours. – Bill Jul 22 at 15:24
• Excellent! Progress! Compare character by character this NDSolve[{-Laplacian[u[x,t],{x}]/2 +x^4*u[x,t]==I*D[u[x,t],t], u[x,0]== -k[[2,1]]}, u, {x,-1,1}, {t,1,2}] with yours. – Bill Jul 22 at 16:52
• It seems that the last comment solved your problem and at the end it was just a simple mistake. That implies that your question may be put on-hold. Small mistakes are off-topic in the sense we don't want to archive them forever, because they are unlikely to help any future visitors. It's ok to ask, don't be discouraged by that cleaning-up policy. Your future good questions are welcome. Learn about common pitfalls here. – rhermans Jul 23 at 7:40