DOC PREVIEW
Berkeley MATH 128A - MATH 128A Programming Assignment

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Prof. Ming Gu, 861 Evans, tel: 2-3145Office Hours: MWF 1:00-2:000PMEmail: [email protected]://www.math.berkeley.edu/∼mgu/MA128A2008FMath128A: Numerical AnalysisProgramming Assignments #3 and #4, Due Nov.19, 2008In classical mechanics, the two-body problem is to determine the motion of two point particlesthat interact only with each other. An example is the earth orbiting the sun.Let x1and x2be the positions of the two bodies, the Earth, and the Sun, and let m1andm2be their masses. We would like to determine the trajactories x1(t) and x2(t) for time t, giveninitial positions x1(t == 0), x2(t == 0), and initial velocities v1(t == 0), v2(t == 0). Accordingto Newton’s second law,F12(x1, x2) = m1¨x1,F21(x1, x2) = m2¨x2,where F12(x1, x2) is the force on mass 1 due to its interaction with mass 2; and F21(x1, x2) =−F12(x1, x2) is the force on mass 2 due to its interaction with mass 1.We assume that• The two masses are on a plane, so that x1and x2have two components each.•F12(x1, x2) =γm1m2rα(x2− x1) ,where α is a given constant and r = kx2− x1k.We choose the following set of parameters:• m1= 10, m2= 15000;• γ = 4 × 103;•x1(t == 0) =10000x2(t == 0) =00, v1(t == 0) =0300, v2(t == 0) =00;Math128A: Numerical Analysis, Programming Assignments #3 and #4, Due Nov. 19, 2008 2• tolerance τ = 1 × 10−8;• hmin = 1 × 10−5; hmax = 1 × 10−1;• time interval on which to recover the orbits: [0, 200].Reformulate this problem as a system of first order ODEs.For Programming Assignment #3:• Solve the system of ODEs using both the matlab function ode45 and the matlab code RKFv.mon the class website, for α = 2.95, 3, 3.05. Only α = 3 will give a closed orbit for the Earth.• Your output should be three plots depicting the orbits of the Earth and the Sun for thethree values of α from both methods. On the plots comment on the amount of time ode45and RKFv took to finish their jobs.For Programming Assignment #4, we let α = 3. Let x1= (u(t) v(t))T. The calculations ofode45 provides values of u(t) and v(t) at a selected set of points in time.• Use clamped splines to generate a function that can compute approximations to u(t) andv(t) at any time t in [0 200].• Calculate the period T (the time it takes) for the Earth to complete one orbit (going from10000to approximately10000).• Calculate the distance D the Earth travels in one period:D =ZT0q(u0(t))2+ (v0(t))2dt.The derivatives u0(t) and v0(t) can be obtained by differentiating the splines within eachsubinterval. Rewrite this integral as the sum of 4 subintegrals on intervals of length T/4each, and compute each subintegral with the Gaussian quadrature of degree n = 100.• Report the values of T and D on the orbit plot for α = 3 from Assignment


View Full Document
Download MATH 128A Programming Assignment
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view MATH 128A Programming Assignment and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view MATH 128A Programming Assignment 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?