Initialization

SetOptions[Plot,PlotStyle->{Blue,AbsoluteThickness[2]},
ImageSize->500,AxesStyle->Directive[FontFamily->"Arial",FontSize->18,Black,AbsoluteThickness[0.5],Arrowheads[0.04]]];

Work

PH424 Mathematica Template

Basics

To execute a line of code, press "enter" (not return) or "shift return".
In this worksheet, text, or comment, is in Times font, formatted to appear against a blue background.  You can change this and other formatting under Edit Stylesheet in the Format menu.

It is often helpful to clear variables of any value that may be assigned to them.  Either of the following command works to clear the variables x and A.  It does NOT set them to zero, it just clears them.

Clear[x,A]
x=.
A=.

f[x_,t_]:=Exp[-x^2/(1+2*I*t)]/(1+Sqrt[1+2*I*t])
P[x_,t_]:=f[x,t]*Conjugate[f[x,t]]
Maxplot=P[0,0]

f[x,t]

Plot

Plot the probability distribution at t = 0

Plot[P[x,0],{x,-5,5},PlotRange->{{-5,5},{0,Maxplot}},AxesLabel->{x,"P[x,t]"},PlotStyle->{Red,AbsoluteThickness[2]}]

Animation/Manipulation

This plot is a snapshot of the probability distribution P(x,t) as a function of horizontal position x, at successive time intervals.  Note the time slider, and the start/stop and faster/slower controls.  Click on the "+" to start the movie.

Manipulate[Plot[P[x,t],{x,-5,5},PlotRange->{{-5,5},{0,Maxplot}},PlotLabel->t,AxesLabel->{x,"P[x,t]"},PlotStyle->{Red,AbsoluteThickness[2]}],{t,0,2}]

Copyright 2011 Oregon State University
Version September 13, 2011