Re: Plot Complex Interpol .Func.
- To: mathgroup at smc.vnet.net
- Subject: [mg9615] Re: Plot Complex Interpol .Func.
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Fri, 14 Nov 1997 21:39:56 -0500
- Organization: University of Western Australia
- Sender: owner-wri-mathgroup at wolfram.com
Debbie Leddon wrote: > I am trying to solve the schrodinger equation as follows and I want to > be able to plot the resulting interpolating function (which should > contain complex values). > > In[6]:=Schrodinger[V_,A_] := D[f[a],{a,2}] + (V - A)f[a]] > > In[7]:= R[x_,y_] := x + I y > > In[8]:= V[R_,a_] := > R[1,2](-1/(Cos[a] - Sin[a]) -1/Sin[a] + 1/Cos[a]) > > In[9]:= eq1 = 0 == Schrodinger[V[R,a],-900] > > Out[9]= 0==f[a] (900 + (1 + 2 I) (-Csc[a] + Sec[a] - > 1/(Cos[a] - Sin[a])) + f''[a] > > In[10]:= soln =NDSolve[{eq1, f[0.00005] ==0, f'[0.00005] ==.5}, > f, {a, 0.00005, 0.785348}][[1]] > > Out[10]= {f->InterpolatingFunction[{{0.00005,0.785348}},"<>"]} As you note above f is Complex. > In[11]:= ParametricPlot[f /. soln[[1]], {a, 0.00005, 1}] > > The error message I got at this point was: > function f/. soln[[1]] cannot be compiled; plotting will proceed.. f/. > soln[[1]] does not evaluate to a real pair of numbers > at a =0.000050041664...., etc. > > What went wrong ? How can I plot the interpolating function? You need to plot the Re or Im parts. Also f is a function of the parameter a. Finally, you can just use Plot; Evaluate improves the efficiency: Plot[Evaluate[Re[f[a] /. soln]], {a, 0.00005, 1}] Plot[Evaluate[Im[f[a] /. soln]], {a, 0.00005, 1}] Since you are interested in Quantum-based applications you might want to have a look at the University of Western Australia library site where there is a listing of our Physics Electronic Course Materials: http://www.library.uwa.edu.au/edocs/ecourse/ecourse-phys.html Second Year : Electromagnetism Second Year : Quantum Mechanics Third Year: Computational Physics Third Year: Computational Biophysics Of these, I am responsible for the 3rd year computational physics course: http://www.pd.uwa.edu.au/Physics/Courses/Third_Year/Computational_Physics.html (which includes one Notebook devoted to the Schroedinger Equation) and the second year Electromagnetism course: http://www.pd.uwa.edu.au/Physics/Courses/Second_Year/ElectroMagnetism.html You might also find the second year courseware at http://www.pd.uwa.edu.au/Physics/Courses/Second_Year/Quantum.html interesting. Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul at physics.uwa.edu.au AUSTRALIA http://www.pd.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________