PHYSICS 360 Problem Set #2: "Numerical Methods" Due 10/7

 
Problem 1: 20pts Numerical Differentiation
Create a function "nd" :

nd[fun_, {x_, x0_}] := Block[ ..... etc .....]

which will numerically differentiate its first argument, the function "fun", with respect to the argument "x" and evaluated at "x0".  The precision of your answer should be at least 10^6.

Using your "nd" operator, verify these properties of differentiation:

    nd[ x^3] = 3 x^2
    nd[ f[g[x]]] = f'[g[x]]* g'[x]
    nd[ f[x]*g[x] = f'[x]*g[x] + f[x]*g'[x]

You can do this in several ways, say by Plotting: Plot[ nd[ x^3, { x, x0}]/ (3 x0^2) , { x0, 0, 1}].  The result should be a straight line, at the value 1.


 
Problem 2: 20 pts Numerical Integration
Create a numerical integration routine "nintegrate" 

nintegrate[ fun_, { x_, xi_, xf_}] := Block[ ..... etc  ..... ]

that uses Simpson's rule to approximate a numerical integral: f[x] from x= xi to x= xf.  Be sure to devise an appropriate test measure, and prove to me that your routine can numerically integrate the following functions from x = 0 to x=1.

A) Cos[Exp[x^2]]
B)  Tan[3 x^2 -2]


 
Problem 3: 20 pts Statistics of Random Walks
We have constructed in class a one-dimensional random walk of nstep = 100 steps, and determined two quantities: the averagelocation of the last step, and the"spread" of the distribution of the last step.  This amounts to nothing other than the standarddeviationof a set of numbers.  For: 

nstep= 10, 100, 1000, 10000

create 100 random walks, and make a list of the end-step location.  Taking the standarddeviation make a plot of  Log[nstep]vs. Log[ standarddeviation].  A straight line on such a plot implies what relationship? Fit a linear relationship to your data, and tell me how standarddeviation depends on nstep.


 
Problem 4: 20 pts Cannon Fodder
The first use modern electronic computers were put to was calculating artillery tables for use in World War II.  We are going to reproduce some of those calculations, by integrating Newton's equations explicitly.

(A) Linear Drag.  The forces acting on the projectile are (1) gravity acting downward, and (2) a drag force appositely directed to the velocity, with a magnitude proportional to the instantaneous speed of the projectile.

Using units of LENGTH -> Meters, TIME -> Sec, and for a 1-kilogram mass use:

drag_x = - 1 Kg/(10 sec) * vx,
drag_y = - 1 Kg/(10 sec) * vy.

What is the "terminal velocity" of the object based on this definition of drag?

Integrate the equation of motion for the projectile when its initial velocity is fixed at 500 Meter/Sec.  Adjust the elevation angle of the initial velocity, and determine which barrel elevation gives the maximum range for the projectile.

(B) Head wind.  Now use the following as the drag force:

drag_x = - 1 Kg/(10 sec) * ( vx - 10 Meter/sec)
drag_y = - 1 Kg/(10 sec) * vy.

Do the same as in (A) and determine the maximal range when firing into a 10 Meter/sec headwind.