QuestionQuestion

Transcribed TextTranscribed Text

Assignment 1. Root-finding: Bisection An underground tank for storing diesel has the shape of a cylinder laying on its side. The (horizontal) length of the cylinder is L, and its (vertical) radius is R. The volume of diesel inside the container when the level is h from the bottom is given by V (h) = L �R2 cos−1 �R − h� − (R − h) √2Rh − h2� R (A) Use the formula to find the volume of diesel in the tank when h = 0, R, & 2R, and check using the regular formula for the (total) volume of a cylinder (V = πR2L) that the above formula is correct for these special values of h. (B) The owner of the tank wants to order more diesel when the volume of diesel in the tank drops below 10% of the total volume, at which point the height from the bottom will be below h10. Find the condition for the value of h10 for which the owner should place an order when the level drops below this value. Write this condition in the form f(h) = 0 if the tank dimensions are L = 10m and R = 3m. (C) Use the bisection method to find h10 to 2 decimal places. Write your answer in a tabular form similar to page 40 of the type-set notes. Take the initial values for h in the bisection method to be a0 = 0 and b0 = R. 2. Root-finding: Newton-Raphson There are two locations on the interval 0 < x < 4 where the function intersects with the function At these points f(x) = g(x) − h(x) = 0. g(x) = x3 − 4.4x2 + 4.05x + 11.5 h(x) = 10 sin2(2x) (A) Find the derivative of f(x) with respect to x. (B) Use the Newton-Raphson method to find the two solutions to f(x) = 0 for 0 < x < 4. Perform the method for the following 2 initial guesses x0 = {2,3} and iterate for 10 steps unless f(xn) drops below 10−10, in which case you have converged. (C) You should have found that for each of the 2 starting points converges to the same root. This is one of the pitfalls of the Newton-Raphson method. Plot the function f(x) for 0 < x < 4 (try desmos.com), and by looking where it crosses y = 0 choose a appropriate starting value (with no more than 2 significant figures) so that the algorithm converges to the second root. 1 3. ODE-solver Application The orbit of a asteroid or satellite around the Sun can be com- puted by solving ordinary differential equations for the position and velocity. Such an orbit will lie in a plane, which we assume to be the xy-plane. The object will feel a force due to gravity of r2 where rˆ is a unit vector pointing out radially from the Sun. This force results in an accel- � eration �a = F/m by Newton’s second Law. We can thus describe the motion of the object using the following set of ODEs: dx = vx = vy = ax = − = ay = − GM◦ m F=− rˆ � dt dy dt dvx dt dvy GM◦ x r3 GM◦ y r3 Sun is M◦ = 1.98847 × 1030 kg. To apply Euler’s method (pg 44 of the typeset notes) to solve for the orbit, we use the following algorithm based on an appropriate small step in time h: dt where the gravitational constant is G = 6.67408 × 10−11 m3 kg−1 s−2, and the mass of the (i) Start with given values for xn, yn, vx,n, vy,n. Compute rn = (ii) Compute the derivative functions: k1x = hvx,n , k1y = hvy,n , k1vx = −hGM◦xn r3 (iii) Step along the orbit to the next point using xn+1 = xn + k1x yn+1 = yn + k1y vx,n+1 = vx,n + k1vx vy,n+1 = vy,n + k1vy �22 xn + yn. , k1vy = −hGM◦yn r3 (iv) Return to step (i) and repeat with the new values obtained in step (iii). I have included a sample MATLAB (or Octave) code that implements Euler’s method for this problem. I have also created a sample spreadsheet that implements Euler’s method in case you do not have access to any other form of programming language. In what follows we will make use of “astronomical units”, where 1 AU = 1.495978707 × 1011 m is the average distance between the Earth and the Sun. 2 Questions: (A) Plot the orbit (i.e. x versus y) for Euler’s method for the conditions: � GM◦ r0 where r0 = 1 AU. Run the code for 250 steps (i.e. a total time of 500 days). By considering the physical parameters used in this problem, comment on the accuracy of the resulting orbit. (HINT: just take my code or spreadsheet, increase the number of steps from 100 to 250 and capture the plot. Also, compare these parameters to those of Earth’s orbit around the Sun). (B) Adapt either the MATLAB code or the spreadsheet to use the second order Runge- Kutta (RK2) method (also called the “Improved Euler” or “Cauchy Euler” method) from Chapter 5, Section 2 (pg 46) of the typeset notes. (C) Run your RK2 method for the same conditions as the Euler method I provided (i.e. those listed in part A) for 250 steps. Plot the resulting orbit on the same axes as the one you obtained for Euler’s method (or side by side on axes with the same scale). Comment on the accuracy of the RK2 method compared to Euler’s method. (D) Determine the approximate amount (∼ 2 significant figures is fine) that the trajectory deviates from 1 AU after one orbit (i.e. the “error”) of the RK2 method with h = 1 day, then repeat this for h = 2 days and h = 4 days. The quantity to compute here is the relative error ((|r − r0|)/r0). Comment on the results. • BONUS (an additional 5% of the assignment total): Extend your code to employ the RK4 method. Repeat the analysis of the error from part (D) for your RK4 method. Comment on the results. x0 =r0 , y0 =0, vx,0 =0, vy,0 = , h=2×60×60×24 3

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

    By purchasing this solution you'll be able to access the following files:
    Solution.pdf and Solution.xlsx.

    $60.00
    for this solution

    or FREE if you
    register a new account!

    PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

    Find A Tutor

    View available Mathematics - Other Tutors

    Get College Homework Help.

    Are you sure you don't want to upload any files?

    Fast tutor response requires as much info as possible.

    Decision:
    Upload a file
    Continue without uploading

    SUBMIT YOUR HOMEWORK
    We couldn't find that subject.
    Please select the best match from the list below.

    We'll send you an email right away. If it's not in your inbox, check your spam folder.

    • 1
    • 2
    • 3
    Live Chats