using System;
using Science.Mathematics;
using L = Science.Physics.QuantumMechanics;
namespace ScienceTest.PhysicsTest.QuantumMechanicsTest
{
///
/// We solve the differential equation :
/// -0.5\Psi''(x) + V(x)\Psi(x) = E\Psi(x)
///
public class SchroedingerEq1DTest
{
public SchroedingerEq1DTest()
{
}
private string result;
public string Result
{
get{return result;}
}
public void Compute()
{
L.SchroedingerEquation1D equation = new L.SchroedingerEquation1D();
Function.ToLastType func = new Function.ToLastType(V);
equation.PotentialEnergy = func;
for (int i = 0; i < 10; i++)
{
equation.EnergyGuess = 2.5+0.001*i; // change as you wish
equation.SlopeGuess = (i+1)*1.0E-14; // change to adjust \Psi(x)
equation.Solve();
result += Convert.ToString(equation.SolvedQ) +i.ToString() + "\r\n";
}
for(int k = 0; k < equation.WaveFunction.Length; k++)
result += Convert.ToString(equation.WaveFunctionXCoordinate[k])+"\t" // position
+ Convert.ToString(equation.WaveFunction[k])+"\r\n"; // value
result += "Energy="+Convert.ToString(equation.Energy)+"\r\n";
}
private double V(double x)
{
return 0.5 * x * x -0.0000000007 * x; // change as you wish
}
}
}
/*
True0
True1
True2
True3
True4
True5
True6
True7
True8
True9
-10 0
-9.5 4.48903362146652E-13
-9 2.99574316159805E-11
-8.5 2.33997930112369E-09
-8 1.28126484650248E-07
-7.5 5.42002533859732E-06
-7 0.000176935787378723
-6.5 0.00445117122571794
-6 0.0861422934448301
-5.5 1.27959249094545
-5 14.5470125095315
-4.5 126.073619857871
-4 828.44674325812
-3.5 4095.17926117565
-3 15044.6645787918
-2.5 40251.8959491098
-2 75468.8675820331
-1.5 90520.2010209937
-1 48318.2857008955
-0.5 -35151.3452473938
0 -79663.3852315315
0 -79663.3852315314
0.5 -35151.3454688472
1 48318.2854979587
1.5 90520.2009938376
2 75468.8676725957
2.5 40251.8960409891
3 15044.6646271117
3.5 4095.17927782647
4 828.446747298801
4.5 126.073620571702
5 14.547012603048
5.5 1.27959250013593
6 0.0861422941276591
6.5 0.00445117126428319
7 0.000176935789041189
7.5 5.42002539346595E-06
8 1.28126486040067E-07
8.5 2.33997932819328E-09
9 2.99574319866198E-11
9.5 4.48903367919588E-13
10 0
Energy=2.49999999999999
*/