Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4531
| From | raj kumar <rajesh7796gm@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: problem with Graphics array --plots don't appear |
| Date | 2011-08-23 09:48 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j2vt0l$2k4$1@smc.vnet.net> (permalink) |
| References | <j2t9l4$m0h$1@smc.vnet.net> |
oops...forgot to provide the starting potential p[x_]:= x+ 8 EXP[-x^2]
On Aug 22, 6:05 pm, raj kumar <rajesh779...@gmail.com> wrote:
> hi mathematica experts,
> i have come across a code to obtain the wave functions and energies
> for bound states of the schroedinger equation. however, plots of the
> the eigen functions cannot be generated-see graphics array below.
> since i am a novice in mathematica, any advise will be most
> appreciated.here is that code...... thanks
>
> ShootBSWF2[pot_, m_, emin_, emax_, xmin_, xmax_,
> xmatch_, opts___Rule] :=
> Module[{\[Psi], x, y, x0, trial, eq, bc, bc1, bc2,
> \[Psi]1, \[Psi]2, ratio, evalue, e, norm1, norm2,
> norm, optsRoot, optsND, opts2},
> optsRoot = Sequence @@ FilterRules[
> Flatten[{opts}], Options[FindRoot]];
> optsND = Sequence @@ FilterRules[
> Flatten[{opts}], Options[NDSolve]];
> eq[e_, x_, x0_] :=
> {-(Derivative[2][y][x]/(2*m)) +
> pot[x]*y[x] == e*y[x], y[x0] == 0,
> Derivative[1][y][x0] == 1/10^6};
> y1[e_, x_] := y[x] /. NDSolve[eq[e, x, xmin],
> y, {x, xmin, xmatch}, optsND][[1]];
> bc1[e_] := D[y1[e, x], x]/y1[e, x] /.
> x -> xmatch; y2[e_, x_] :=
> y[x] /. NDSolve[eq[e, x, xmax], y,
> {x, xmax, xmatch}, optsND][[1]];
> bc2[e_] := D[y2[e, x], x]/y2[e, x] /.
> x -> xmatch; bc[(e_)?NumericQ] :=
> bc1[e] - bc2[e]; evalue = If[emax == emin,
> emin, e /. With[{opts2 = optsRoot},
> FindRoot[bc[e], {e, emin, emax}, opts2]]];
> \[Psi]1[x_] = y1[evalue, x]; \[Psi]2[x_] =
> y2[evalue, x]; ratio = \[Psi]1[xmatch]/
> \[Psi]2[xmatch]; norm1 = NIntegrate[\[Psi]1[x]^2,
> {x, xmin, xmatch}]; norm2 =
> NIntegrate[\[Psi]2[x]^2, {x, xmatch, xmax}];
> norm = 1/Sqrt[norm1 + ratio^2*norm2];
> \[Psi][x_] = If[x <= xmatch, norm*\[Psi]1[x],
> norm*ratio*\[Psi]2[x]]; {energy -> evalue,
> wavefunction -> (\[Psi][#1] & ),
> normalization -> norm}]
>
> solutions = {ShootBSWF2[pot, 0.5, 3, 4, -5, 5,
> 0.5, MaxIterations -> 50], ShootBSWF2[pot,
> 0.5, 4.4, 4.5, -5, 5, 0.5, MaxIterations ->
> 50], ShootBSWF2[pot, 0.5, 6, 7, -5, 5, 0.5,
> MaxIterations -> 50], ShootBSWF2[pot, 0.5, 8,
> 9, -5, 5, 0.5, MaxIterations -> 50]};
>
> plot1 = PlotBSWF[solutions[[1]], -5, 5,
> PlotRange -> {All, {2.5, 5.5}},
> DisplayFunction -> Identity];
> plot2 = PlotBSWF[solutions[[2]], -5, 5,
> PlotRange -> {All, {2.5, 5.5}},
> DisplayFunction -> Identity];
> plot3 = PlotBSWF[solutions[[3]], -5, 5,
> PlotRange -> {All, {5.5, 7.5}},
> DisplayFunction -> Identity];
> plot4 = PlotBSWF[solutions[[4]], -5, 5,
> PlotRange -> {All, {7.5, 9}},
> DisplayFunction -> Identity];
> plots = {{plot1, plot2}, {plot3, plot4}};
>
> GraphicsArray[{{plot1, plot2}, {plot3, plot4}},
> DisplayFunction -> $DisplayFunction]
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
problem with Graphics array --plots don't appear raj kumar <rajesh7796gm@gmail.com> - 2011-08-22 10:05 +0000 Re: problem with Graphics array --plots don't appear raj kumar <rajesh7796gm@gmail.com> - 2011-08-23 09:48 +0000
csiph-web