PHYS 5900 Class 1 (8/26/2009)
Syllabus at https:/blackboard.ecu.edu/ under "Course Info" Announcements (if any) at https:/blackboard.ecu.edu/ under "Announcements"
Before we start: * In Edit/Preferences/Evaluation on Windows (on Mac: Mathematic
PHYS 5900 Class 21 (10/16/2009 Fri)
Test 2 will be on Nov 6 (F) 11:00am-1:30pm. There will be no classes on Nov 2 (M) & 4 (W); instead, the four classes on Oct 19, 21, 26 & 28 will be extended by 25 minutes each, i.e., they will go from 11:00am
PHYS 5900 Class 22 (10/19/2009 11am-12:15pm)
Named functions and variables are global. They need to be cleared after they are no longer needed in order to avoid problems. So it is better to minimize the number of na
PHYS 5900 Class 23 (10/21/2009 11am-12:15pm)
Recursive Functions and Dynamic Programming
We can define a recursive function (i.e., defined in terms of the function itself).
the Hermite polynomial can be defined as
Hn z 2 z Hn 1 z 2 n
PHYS 5900 Class 24 (10/23/2009Fri)
Upvalues and Downvalues The usual function definitions f[arg_] = rhs f[arg_] := rhs are downvalues for f because they are associated with the symbol (head) f:
f0 1; f x_ , y_ : x ^ 2 f g x_ , h y_ :
PHYS 5900 Class 25 (10/26/2009 11am-12:15pm)
Changing Values of Variables in loops we often need to change/update the value of variables.
Commands include x+ +x x-x x+=dx x-=dx x*=c x/=c cfw_x,y=cfw_y,x PrependTo[s,element] AppendTo[s,ele
PHYS 5900 Class 26 (10/28/2009 11am-12:15pm)
FORTRAN program for efield: download the following files from blackboard electric-field.f & efield.input
Some basics of Fortran programming: REAL array_name(n_dimension) declares an array of type REA
PHYS 5900 Class 27 (10/30/2009Fri)
Named Optional Arguments
Example: Motion of a Particle in One Dimension
For a particle in one dimension with any given expression for the acceleration a and initial values of position x0 and velocity v0, write
PHYS 5900 Class 28 (11/09/2009)
Two - Dimensional Graphics
Two-Dimensional Graphics Primitives in c lu d e Arrow[ ], Circle[ ], Disk[ ], Inset, GraphicsComplex, Line[ ], Point[ ], Polygon[ ], Rectangle[ ], Text[ ]. The full list can be foun
PHYS 5900 Class 31 (11/16/2009)
Homework #5 is due.
Three-Dimensional Graphics Options in c lu d e AxesEdge, Boxed, BoxRatios, FaceGrids, Lighting, RotationAction, SphericalRegion, ViewCenter. ViewPoint and some of the 2-dimesional graphics opt
PHYS 5900 Class 33 (11/20/2009Fri)
Example4 If a Mathematica operation takes a long time, it may be time to think how to make it more efficient:
[email protected]_, y_, nmax_ D :=
nmax nmax n=1 m=1
[email protected]@x, y, 10D, 8x, 0, Pi<, 8y, 0,
PHYS 5900 Class 34 (11/23/2009)
Rule-Based Programming in the form of a collection of user-defined rules (assignments, function definitions); lhs=rhs i.e. Set[lhs,rhs] lhs^=rhs UpSet[lhs,rhs] lhs:=rhs SetDelayed[lhs,rhs] lhs^:=rhs UpSetDelayed[
PHYS 5900 Class 35 (11/30/2009)
Please fill out the Fall 2009 Online Student Opinion of Instruction Survey (SOIS) Survey Period: November 23 to midnight December 6 Repeat our re-definition of the * operator:
PHYS 5900 Class 36-37 (12/02/2009,12/04/2009Fri)
Hw6 is due now; it will be graded by Monday 12/07/2009.
Final: will be from 11:00am to 1:30pm on Friday 12/11/2009; open-book, and you can bring notes (but not your laptop); 150 points, 30% of yo
PHYS 5900 Class 20 (10/14/2009)
Example on Patterns:
plot the function V[x]:
V[x]= 0 = V0
for |x|>a for |x|<=a.
We can choose
as the unit of x and
V0 as the unit of V, the function then becomes
V[x]= 0 = -1
for |x|>1 for |x|<=1.
PHYS 5900 Class 19 (10/07/2009)
Names of patterns must be symbols , i.e., Head[patternName] must return Symbol. 2-dimensional forms can not be pattern names.
Symbol "name" refers to a symbol with the specified n
PHYS 5900 Class 18 (10/05/2009)
Example A projectile in the x-y plane has an initial speed of v0 and angle theta0. A) Derive its vertical position y as a function of x; B) Derive the range in x; C) Plot y as a function of
PHYS 5900 Class 3 (8/31/2009)
EulerGamma is Eulers constant g, with numerical value > 0.577216.
[email protected]@1 k, 8k, 1, m<D Log@ mDD . m 1000
Programming with Fortran:
m NAk=1 1 k
Steps to take on Mac
PHYS 5900 Class 5 (9/04/2009Fri)
[email protected]@ x ^ 2 2D [email protected] PiD, 8x, 2, 2<D
Fortran program of the integral
is available at http:/siyu.physics.ecu.edu/zlin/Fortran/ as integral.f, download it to your Ma
PHYS 5900 Class 6 (9/08/2009Tu)
* Homework #1 will be available under "Assignments" at Blackboard after this class. * Your homework should be returned via "Assignments" at Blackboard before next week's Wednesday class; do not use Digital Dropbo
PHYS 5900 Class 7 (9/09/2009)
Unit symbols can be tagged to numbers :
[email protected]@H5 m sL ^ 2D, 3D m2 s2 [email protected]@H5 m sL ^ 2D + [email protected] m sL ^ 2D, 3D m2 s2
PowerExpand @%D 8. m s
PHYS 5900 Class 8 (9/11/2009Fri)
D@ f , 8x, n<D gives the multiple derivative n f xn . D@ f , x, y, D differentiates f successively with respect to x, y, . D@ f , 88x1 , x2 , <D for a scalar f gives the vector
PHYS 5900 Class 11 (9/18/2009Fri)
NSolve may not solve equations such as transcendental equations:
Solve:tdep : The equations appear to involve the variables to be solved for in an essentially non-algebraic way.