|
User's Schrödinger Equation
Time-independent Schrödinger
Equation
_________
- Have a Schrödinger equation to solve? Or
any other math equations? For the first few months of 2009, we are
willing to help you solve them using Calculus-level programming.
(Fortran Calculus is scheduled to be online in mid-2009 so take
advantage of this free offer will it last.) To start, copy and modify
the source code below in a file we'll call it {abc}{123}.fc where {abc}
= your initials and {123} = any number or id; 8 characters max. for
filename. Edit your {abc}{123}.fc file, especially lines starting with
a "!" character.
E-mail
us your {abc}{123}.fc file. We will compile & execute it and
send you the output file. (For more [~60] example
problems to choose from, download FC-Win
program.)
- All "!" characters in columns 1 or 2 must
be deleted before compiling. These "!" were added in order to point out
areas needing work.
- Next, you may modify a copy of this web
page and send it to us for viewing. If accepted, we will post your
webpage showing your problem with solution. If you want people to be
able to contact you, please include your e-mail address on this web
page.
- Please mention our
www.digitalCalculus.com website to others. Thanks!
|
|
|
User's Schrödinger Equation Source
Code:
-
For 1-dimensional Schrödinger Equation use
following:
global all
problem SchrodingerPDE ! time-independent version
C ------------------------------------------------------------------------
C --- Calculus Programming example: Schrödinger Equation; a PDE (1D) Initial
C --- Value Problem solved using Method of Lines.
C ------------------------------------------------------------------------
C
C User parameters ...
h = 6.6260689633e-34 ! Js ... Planck's constant
! m = ... ! mass of the particle
! ipoints = 10 ! grid pts. over x-axis
C
C x-parameter initial settings: x ==> i
! xFinal = 1: xPrint = xFinal/ipoints: ip = ipoints
pi= 4*atan(1): ip = ipoints
C
call xAxis !
end ! Stmt.s not necessary in IVP, but used in BVP version
model xAxis !
C ... Integrate over x-axis
C
x= 0: xPrt = xPrint: dx = xPrt / 10
! PSI = PSI0(x): PSIx = 0: PSIxx = 0 ! Initial Condition
Initiate pegasus; for PDE;
~ equations PSIxx/PSIx, PSIx/PSI; of x; step dx; to xPrt
do while (x .lt. xFinal)
Integrate PDE; by pegasus
if( x .ge. xPrt) then
print 79, x, PSI, PSIx, PSIxx
xPrt = xPrt + xPrint
end if
end do
79 format( 1h , f8.4, 2x, 10(g14.5, 1x))
end
model PDE ! Partial Differential Equation
! U = ???
! E = ??? ! energy of particle
PSIxx = 2*m/(h*h) * (E - U) * PSI
end
Fmodel PSI0(xx) ! Initial starting values @ t = 0
! if( xx .le. 0) then
! PSI0 = 0
! elseif( xx .lt. .5 ) then
! PSI0 = (1 - cos( 4 * pi * xx))/2
else
! PSI0 = 0
endif
end
-
For 2-dimensional Schrödinger Equation use
following:
global all
problem SchrodingerPDE
C ------------------------------------------------------------------------
C --- Calculus Programming example: Schrödinger Equation; a PDE (2D) Initial
C --- Value Problem solved using Method of Lines.
C ------------------------------------------------------------------------
dynamic PSI, PSIx, PSIxx
C
C User parameters ...
h = 6.6260689633e-34 ! Js ... Planck's constant
! m = ... ! mass of the particle
! ipoints = 100 ! grid pts. over x-axis
! jpoints = 50 ! grid pts. over y-axis
C
C x-parameter initial settings: x ==> i
! xFinal = 1: xPrint = xFinal/ipoints: ip = ipoints
C
C y-parameter initial settings: y ==> j
! yFinal = 1: dy = yFinal/(jpoints-1)
pi= 4*atan(1): jp = jpoints
allot PSI( jp), PSIx( jp), PSIxx( jp)
C
call xAxis !
end ! Stmt.s not necessary in IVP, but used in BVP version
model xAxis !
C ... Integrate over x-axis
C
x= 0: xPrt = xPrint: dx = xPrt / 10
Initiate athena; for PDE;
~ equations PSIxx/PSIx, PSIx/PSI; of x; step dx; to xPrt
do while (x .lt. xFinal)
Integrate PDE; by athena
if( x .ge. xPrt) then
print 79, x, (PSI(jj), jj = 1, jp)
xPrt = xPrt + xPrint
end if
end do
79 format( 1h , f8.4, 2x, 10(g14.5, 1x))
end
model PDE ! Partial Differential Equation
C ! Method of Lines
! PSI(1) = PSI0(y): PSIx(1) = 0: PSIxx(1) = 0 ! Initial Conditions
do 40 jj = 2, jpoints - 1 ! System of ODEs
! U = ???
! E = ??? ! energy of particle
PSIyy = (PSI(jj+1) - 2*PSI(jj) + PSI(jj-1))/dy**2
PSIxx(jj)= 2*m/(h*h) * (E - U) * PSI - PSIyy
40 continue
! PSIx(jp)= ???: PSIxx(jp)= ??? ! Initial Conditions, if any
end
Fmodel PSI0(yy) ! Initial starting values @ x = 0
! if( yy .le. 0) then
! PSI0 = 0
! elseif( yy .lt. .5 ) then
! PSI0 = (1 - cos( 4 * pi * yy))/2
! else
! PSI0 = 0
! endif
end
-
For 3-dimensional Schrödinger Equation use
following:
global all
problem SchrodingerPDE
C ------------------------------------------------------------------------
C --- Calculus Programming example: Schrödinger Equation; a PDE (3D) Initial
C --- Value Problem solved using Method of Lines.
C ------------------------------------------------------------------------
dynamic PSI, PSIx, PSIxx
C
C User parameters ...
h = 6.6260689633e-34 ! Js ... Planck's constant
! m = ... ! mass of the particle
! ipoints = 100 ! grid pts. over x-axis
! jpoints = 50 ! grid pts. over y-axis
! kpoints = 10 ! grid pts. over z-axis
C
C x-parameter initial settings: x ==> i
! xFinal = 1: xPrint = xFinal/ipoints: ip = ipoints
C
C y-parameter initial settings: y ==> j
! yFinal = 1: dy = yFinal/(jpoints-1)
jp = jpoints
C
C t-parameter initial settings: z ==> k
! zFinal = 1: dz = zFinal/(kpoints-1)
pi= 4*atan(1): kp = kpoints
allot PSI(jp,kp), PSIx(jp,kp), PSIxx(jp,kp)
C
call xAxis !
end ! Stmt.s not necessary in IVP, but used in BVP version
model xAxis !
C ... Integrate over x-axis
C
x= 0: xPrt = xPrint: dx = xPrt / 10
Initiate gemini; for PDE;
~ equations PSIxx/PSIx, PSIx/PSI; of x; step dx; to xPrt
do while (x .lt. xFinal)
Integrate PDE; by gemini
if( x .ge. xPrt) then
do 30 jj = 2, jpoints
y = (jj - 1) * dy
print 79, x, y, (PSI(jj,kk), kk = 1, kp)
30 continue
xPrt = xPrt + xPrint
end if
end do
79 format( 1h , f8.4, 1x, f8.4, 2x, 10(g14.5, 1x))
end
model PDE ! Partial Differential Equation
C ! Method of Lines
! PSI(1,1) = PSI0(x): PSIx(1,1) = 0: PSIxx(1,1) = 0 ! Initial Conditions
do 40 jj = 2, jpoints ! System of ODEs
y = (jj - 1) * dy
do 20 kk = 2, kpoints-1
! U = ???
! E = ??? ! energy of particle
PSIyy = (PSI(jj+1,kk) - 2*PSI(jj,kk) + PSI(jj-1,kk))/(dy*dy)
PSIzz = (PSI(jj,kk+1) - 2*PSI(jj,kk) + PSI(jj,kk-1))/(dz*dz)
PSIxx(jj,kk)= 2*m/(h*h) * (E - U) * PSI - PSIyy - PSIzz
20 continue
40 continue
end
Fmodel PSI0(zz) ! Initial starting values @ x = 0 and y = 0
! if( zz .le. 0) then
! PSI0 = 0
! elseif( zz .lt. .5 ) then
! PSI0 = (1 - cos( 4 * pi * zz))/2
else
! PSI0 = 0
endif
end
User's Schrödinger Equation Output:
-
selected output goes here ...
- Visit ODEcalc
for an Ordinary Differential
Equations Calculator. Try it and see the power of Calculus programming.
HTML code for linking to this page:
- <a
href="http://www.digitalcalculus.com/math-problems/schrodinger-equation.html"><img
align="middle" width="100"
src="http://www.digitalcalculus.com/image/fc-win-icon.gif"/>
<strong>Schrödinger Equation</strong>
</a>; Simulation, Optimization, and Tweak Parameters for Optimal
Solution.
Go to top
|
|