Assignment 1. ASTR 407 Due: Monday Jan 8, 10:00 AM ----------------------- I assume you can write and use simple C/Perl/pyton codes (or some other programming environment), and use software to make plots. For this homework, each solution must have a written/textual outline explaining what you have done (think of it as explaining how you approached the problem to another student in the course, refering to numbered figures/tables as though it was an article). If you wrote computer code for the question, you should provide a printout of the numerical code you used to solve the problem and the output of the code for each case you execute it for; make your code output well explained (for example, print out column headings). 1. Find the zero (numerically) of f(x) = x**3 - 6x - 7 by coding a Newton's method using x=2 as a starting guess (by inspection, the root is clearly between x=2 and 3). How many iterations are needed to get to 1 part in a billion accuracy? (That is, the absolute value of the difference from the previous iteration is less that 1.0e-9). Thus, show a table where iteration 0 is the intial guess, and then your columns are iteration current_estimate_x diff_with_last_iter Then repeat with using x=3 as a starting guess. By plotting a graph of the function explain why one of these guesses is better for this numerical method than the other. 2. Review the midpoint rule for performing an approximate numerical calcuation of a definite integral, and briefly summarize how it works. Then write a piece of code that uses this method to estimate the integral of f(x) = 1/x from x=1 to x=10 numerically. Show that this method converges (to the correct answer easily obtainable from the analytical integration you should do), as you increase the number of 'bins' from 10 to 100 to 1000. 3. Given the differential equation versus time t for the variable 'a': da/dt = 2 * a**(-4) (that is, 2 times 'a' to the negative fourth power) then, if we consider the case where a(t=0) = 1, i. Analytically (not numerically), solve the equation and determine a(8). ii. roughly sketch (or plot with a computer) a graph of a(t) from t=0 to 8. 4. Download the file MPCxyz.txt from the web site. Your professor has obtained the 3-dimensional cartesian position and velocity vectors for the first 9999 minor planets, so the file format is n x y z vx vy vz where n is the object's identification number. You need not provide code for this question as you are just plotting. The units are in au and au/year, and positions and velocities are heliocentric. i. Adjusting your plotting limits so that you see every minor planet within 7 au of the sun, make a plot of the position of all these objects projected down onto the (x,y) plane. Draw circles at the semimajor axes a for all that planets that appear on the diagram (they are listed in appendix E.1). You must choose your axes so that the circles appear as circles on your plot (if you software doesn't force square axes, you may have to fiddle). Make the symbol for the data points small so that you can see them all. ii.Compute the norm of the two vectors r and v (many plotting programs may let you do this inside the program, otherwise you may need to read in MPCxyz.txt to a program and write out another file). Make a plot of v as a function of r out to r=7 au.