Table of Contents

Class WaveFunction1D

Namespace
QuantumWaves
Assembly
QuantumLibrary.dll

Base class for one dimensional wave functions.

public abstract class WaveFunction1D
Inheritance
WaveFunction1D
Derived
Inherited Members

Constructors

WaveFunction1D(FloatRange, ComplexF)

Initializes a new wave function with a domain and amplitude.

protected WaveFunction1D(FloatRange domain, ComplexF amplitude)

Parameters

domain FloatRange

The spatial domain of the wave function.

amplitude ComplexF

The amplitude of the wave function.

Properties

Amplitude

Gets or sets the amplitude of the wave function.

public ComplexF Amplitude { get; set; }

Property Value

ComplexF

Domain

Gets the spatial domain of the wave function.

public FloatRange Domain { get; protected set; }

Property Value

FloatRange

Methods

Evaluate(float, float)

Evaluates the wave function ψ(x, t).

public ComplexF Evaluate(float x, float t)

Parameters

x float

The position at which to evaluate the wave function.

t float

The time at which to evaluate the wave function.

Returns

ComplexF

The value of the wave function at x and t, or zero if x is outside the domain.

EvaluateRaw(float, float)

Evaluates the unscaled wave function at (x, t).

protected abstract ComplexF EvaluateRaw(float x, float t)

Parameters

x float

The position at which to evaluate the unscaled wave function.

t float

The time at which to evaluate the unscaled wave function.

Returns

ComplexF

The unscaled value of the wave function at x and t.

IntegrateRaw(float, FloatRange, int)

Integrates the squared magnitude of the unscaled wave function over a range.

protected float IntegrateRaw(float t, FloatRange domain, int intervals = 100000)

Parameters

t float

The time at which the raw wave function is evaluated.

domain FloatRange

The range over which to integrate the raw probability density.

intervals int

The number of intervals used by Simpson integration.

Returns

float

The approximate integral of the unscaled probability density over the specified range.

ProbabilityDensity(float, float)

Evaluates the probability density |ψ(x, t)|².

public float ProbabilityDensity(float x, float t)

Parameters

x float

The position at which to evaluate the probability density.

t float

The time at which to evaluate the probability density.

Returns

float

The probability density at x and t.

ProbabilityInRange(float, FloatRange, int)

Approximates the probability over a given range.

public float ProbabilityInRange(float t, FloatRange domain, int intervals = 100000)

Parameters

t float

The time at which the probability density is evaluated.

domain FloatRange

The range over which to integrate the probability density.

intervals int

The number of intervals used by Simpson integration.

Returns

float

The approximate probability over the specified range.

Sample(int, out float[], float, int, int, Random?, float, float, int)

Generates random position samples of the wave.

public bool Sample(int sampleCount, out float[] samples, float t = 0, int pointCount = 1000, int segmentIntervals = 8, Random? rng = null, float tolerance = 0.0001, float maxAllowed = 1000000, int maxCount = 10000)

Parameters

sampleCount int

The number of samples to generate. Must be greater than zero.

samples float[]

Contains the samples if successful, otherwise an empty array.

t float

The time at which the wave function is sampled.

pointCount int

The number of discrete points used to approximate the cumulative distribution. Must be greater than one.

Larger values improve the accuracy of the sampled distribution but increase preprocessing cost.

segmentIntervals int

The number of Simpson integration intervals used for each cumulative distribution segment. Must be greater than zero.

Larger values improve local integration accuracy but increase computation cost. Simpson integration requires an even number of intervals, odd values are automatically rounded up.

rng Random

The random number generator used for sampling.

tolerance float

Relative convergence tolerance for infinite domain expansion. Must be greater than zero.

maxAllowed float

Maximum allowed integral value. Must be greater than zero.

maxCount int

Maximum number of expansion iterations. Must be greater than zero.

Returns

bool

true if sampling succeeded, otherwise false.

Exceptions

ArgumentOutOfRangeException

Thrown if sampleCount is less than or equal to zero, pointCount is less than or equal to one, segmentIntervals is less than or equal to zero, tolerance is less than or equal to zero, maxAllowed is less than or equal to zero, or maxCount is less than or equal to zero.

TryNormalize(float, float, float, int)

Attempts to normalize the wave function.

public bool TryNormalize(float t = 0, float tolerance = 0.0001, float maxAllowed = 1000000, int maxCount = 10000)

Parameters

t float

Time at which normalization is evaluated.

tolerance float

Relative convergence tolerance for infinite domain expansion.

maxAllowed float

Maximum allowed integral value.

maxCount int

Maximum number of expansion iterations.

Returns

bool

true if normalization was successful, otherwise false.