### Homework Assignments

1. Due 8:30am, Tuesday, 1/20/04.  Work through Chapters 1 & 2 of the text.  In Chapter 1, do E1.3, E1.4, P1.2 and P1.3.  There is nothing to hand in for Chapter 1.  In Chapter 2, do the Building Block and E2.1.  There is nothing to hand in for this.  Create a VI that calculates the roots of a quadratic equation.  How will you handle a negative discriminant?  You should email me this VI to be graded.

2. Due 8:30am, Tuesday, 1/27/04.  Download the Learning with LabView7 files from http://www.ni.com/labviewse/lvse.htm . Work through Chapters 3 & 4 of the text.  In Chapter 3, do the Building Block, E3.4, P3.2, and P3.3.  In Chapter 4, do the Building Block, E4.3, P4.1, and P4.3.  You will be turning in the four problems for a grade.  Please use your last name as part of the filename.

3. Due 8:30am, Tuesday, 2/3/04.

1. Problem P5.2.
2. Find a value of pi by comparing the area of a unit square to a unit circle.  Find whether a point whose coordinates, determined by two random numbers, lies within the circle.  Do this for many points. Take the ratio of the number within the circle to the number of total points and use this to find a value of pi.
3. Write a VI that calculates the first derivative of a function f(x), correct to fourth order. Set the initial step size to be 10% of x and adjust the step size until the derivative is accurate to 3 significant figures.

4. Due 8:30am, Tuesday, 2/10/04.

1. Do Practice with Arrays, page 255.
2. P6.2
3. Write a VI that multiplies the 5-element array {-2, 2, 5, 2, -2} by 5 and adds -10 to each element.
4. Lissajous figures. Plot Asin(mt+c) on the y-axis and Bcos(nt+d) on the x-axis and observe the effects of changing each of the parameters A, B, m, n, c and d.  Include in your program, control knobs for each parameter and bundle the two arrays and connect the bundle to an XY Graph. Describe your observations in paragraph form. For further information, look at the information on Lissajous Curves and the Java applet link in the following URL: www-groups.dcs.st-and.ac.uk/~history/Curves/Lissajous.html .

5. Due 8:30am, Tuesday, 2/17/04.

1. The trajectory of a particle moving under the influence of a central force whose magnitude is inversely proportional to the square of the distance between the particle and the force center is determined by the equation  a/r = 1 + e cos(theta).  The polar variable r is the distance between the particle and the force center, located at the origin.  e is the eccentricity and 2a is the latus rectum of the orbit.  Investigate the shape of the trajectory for e>1, e=1, 1>e>0, and e=0.
2. Adapt your derivate VI from Exercise 3 to be a subVI.  Use it to generate the derivative of an array of numbers generated by a parsed formula from the front panel.  The front panel should contain the graph of the formula and its first derivative.
3. Create a VI that uses Simpson's 1/3 rule to integrate a parsed formula.  Graph the formula and its integral on the front panel.

6. Due 8:30am, Thursday, 2/19/04.

a.  For the hydrogen atom, the radial solution to Schroedinger's equation for the ground state is

where a0 is the Bohr radius (52.9pm). Show that this wavefunction is normalized by integrating the probability density P(r)dr = (R10)2r2dr from 0 to infinity. Scaling may be a problem. How big is infinity to an atom?

b.  The wave function for the n=2, l=0 state of the hydrogen atom is

.

Show that this wavefunction is normalized and that it is normal to R10(r).

c.  Find the most probable radial value for the (n=1,l= 0) and (2,0) states.

d.  Create a VI that uses Monte Carlo integration to integrate the following:

Examine the convergence of this integral to the exact value as the number of points increases.  Does the error go to zero as n-0.5?

7. Due 8:30am, Thursday, 2/26/04.

Adapt the euler.vi and euler.compare.vi that I have emailed you to use the 4th order Runge-Kutta method for solving a first order differential equation.

8. Due 8:30am, Wednesday, 3/10/04.

a.  Find the best population model that fits the census population data for MA, NY and NC from 1790 to 1990.  Use the data in the handout.  Compare the parameters.

b. Suppose the fish population for a pond with a constant harvesting rate of n follows the logistic function

Before observing the behavior of this differential equation with the program, calculate the values of P for which the growth rate equals zero (i.e., the population is a constant). Show that your values reduce to the expected values for n = 0. At what critical value of nc does the discriminant equal zero? What happens if n > nc?

Now using the program, for a value of m = 0.4, observe the behavior of the solution starting with n = 0 and N = 50. What happens to the fish population for small values of n? What happens as n approaches nc ? What happens if n just barely exceeds nc ? Use print screen to support your answers. How could the NC game and fish commission use this model? What changes should be made in order to make the model more realistic?

9. Due 8:30am, Tuesday, 3/16/04.

Convert the 1-D Runge-Kutta equation solver into a multidimensional one.  Class presentations on Lotka-Volterra, Kermack-McKendrick, and arms race models.  The Lorenz and Roessler systems of chaotic equations will also be presented.  You will be graded on your presentation and on the VI's you submit.

10. Due 8:30am, Tuesday, 3/23/04.

Construct the pendulum VI (page 498-501 in text).  Graph theta and angular velocity (theta dot) vs. time, and theta dot vs. theta.  Also plot the kinetic energy, the potential energy and their sum vs. time.  Look at energy considerations for the Euler and RK4 methods for this problem with NO damping.

11. Due 8:30am, Thursday, 3/25/04.

Consider a mass m sitting on a horizontal table and connected to a spring with a spring constant k.  There is a velocity dependent damping force with a damping coefficient b. The mass is driven by a force F*cos(2*pi*f*t) where f is the driving frequency.  Using the usual definitions for b and w0, the differential equation describing the motion is

.

In a manner of your own choosing, investigate either

• the amplitude as a function of the driving frequency w=2pf, or

• the phase angle d between the driving force and the resultant motion.

for quality factors quality factors Q = 3, 7, 13.  The Q of the system is defined as

.

12.  Bring your work to class on Tuesday, March 30.  Laplace and Poisson's equations.

• Group 1.  Create a VI that initializes a 2d array with the array size being user-defined.  The left and right columns should be initialized at two user-defined constant potentials.  The top and bottom rows should change linearly between the left and right column potentials.  The potential of the cells inside this frame should be set to zero.   The user should be able to add either a constant potential point or a charge density point.  The user can then add cells with the selected value by mouse clicking on the cells.

• Group 2.  Create two VI's: ones that solve Laplace's and Poisson's equations in two dimensions by the simultaneous overrelaxation method.  I would suggest studying the Jacobi method VI I emailed you, then write a solver for the same initial array, but with the Gauss-Seidel method.  This method should converge to the solution faster (fewer iterations to the same accuracy) than the Jacobi method.  It also takes less memory.  Then add the overrelaxation parameter to optimize the convergence.

• We will combine the work of Groups 1 & 2 in class.

• For Thursday, April. Combine the Poisson's equation VI with the variable array size initializer VI.  Place a unit charge at the center of a square array whose outer edges are held at zero potential.  Investigate the 1/r dependence of the potential as a function of array size.  Plot potential vs. r for a variety of array sizes and compare them with the 1/r function.

13. Due 4:30am, Friday, 4/9/04.

• Random number generators.  Investigate the quality of linear congruential random number generators by mapping 2 consecutive random numbers onto 2-D space using the points {xn , xn+1}.  Such sequences are generated by

Try the following parameters:

 r xn c N 4 3 1 9 57 10 1 256 899 1 0 32768 1277 1 0 217 16807 1 0 231-1

Also try different seeds for the last 3 in the table (c will still be 0).  Write a paragraph reporting what you found for each RNG.

Choose one of the following exercises:

• Random walks in multiple dimensions.  Write a program that simulates random walks in 1, 2, 3, and 4 dimensions.  The program should plot the average of the square of the distance from the origin as a function of time (# of steps).  The step length should be unity and the results for 500 walkers taking 100 steps each should be averaged.  The motion should be diffusive and follow the Einstein relation, <r2> = D t , where D is the diffusion constant and t is time.  Does it?  Determine D for each of the different dimensional walks.

• Self-avoiding random walk. Write a program that simulates a self-avoiding random walk on a 2D square lattice.  Find the parameters D and a in the relation <r2> = D ta.