Question: Use the Verlet method ( see script, section 5 . 3 . 1 , from page 7 6 - note that the expression F /
Use the Verlet method see script, section from page note that the expression Fm in that section is of course, the acceleration, the second order derivatives as shown below as ODE's to calculate the orbit of the Earth around the Sun. The equations of motion for the position of the planet in its orbital plane are:
where
Task: Calculate the orbit of the Earth around the Sun in steps of one hour for a total period of three years. Use the solution for the orbit, and the velocity, to calculate additionally the potential and kinetic energy of Earth at each evaluation point. Create a function potentialEnergyrpar and a function kineticEnergyvpar which implement these requested calculations separately from solving the ODE's and can be called from tests. Also create a function solvepar which returns the value arrays for and as a tuple such that the tests can call solvepar and obtain the results. Note that the potential energy depends only on the Earth location, and its kinetic energy only on its velocity, The variable par should be a tuple containing the required constant values in order GMm see Data below.
Data: Use times m kg s as Newton's gravitational constant, times kg as mass of the Sun. For Earth mass, use times kg The initial conditions should be times m and times ms Time evaluation points are in the task description and note that you work in SI units.
Create two plots: a draw the kinetic energy, potential energy and total energy, superimposed on a single canvas and observe how the kinetic and potential energies change as a function of time while the total energy appears to be constant. Note that working in SI units means you will get large numbers of the order J
b Plot only the total energy as a function of time and observe the oscillating character while the mean remains constant to high precision which demonstrates the inherent energy conservation of the Verlet method.
Note: you may wish to solve the problem using solveivp but that is not recommended. It is entirely possible and possibly illuminating in comparison to the Verlet method but effectively similar effort for worse results. The tests are likely to fail and deduct marks for this case.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
