Two point particles (or two planetary bodies) interacting only with each other under Newton's laws of gravitational attraction are well understood and the equation of motion can be integrated analytically. However, here, the trajectories of the two planets will be computed numerically. (1) Write down, in vector form, the four ODEs governing the motion of the two planets interacting gravitationally. (If written in component form, these four equations would give 12 equations.) (2) Write a Python function two_body (x) which returns the vector f(x), as defined in (5.1), for the two-body problem. The NumPy array x must be of size 12, and its shape must be [2, 2, 3]. For the entry x[i,j,k], i=0,1 corresponds to the first or second planet; j=0,1 corresponds to the position vector or the velocity of the planet considered; and k=0,1,2 corresponds to the x, y or z component of the vector (position or velocity). You can assume that the masses of the planets, mo and m₁, are defined outside the function two_body. (3) Consider two planets, Po and P₁, of mass m₁ = 1 and m₁ = 2, respectively. At time t = 0, Po is at ro = (1,0,0) with velocity vo = = (0, 1/2, 0) and P₁ is at г₁ = (−1,0,0) with velocity V₁ = (0, -1/4,0). The trajectories of the two planets are periodic and remain in the (x, y)-plane. Solve the equations of motion numerically, using your function rk4, then plot the complete orbits of the two planets.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter1: Fundamentals Of C++ Programming
Section: Chapter Questions
Problem 2PP: (Conversion) An object’s polar moment of inertia, J, represents its resistance to twisting. For a...
icon
Related questions
Question

use python code

Two point particles (or two planetary bodies) interacting only with each other under Newton's
laws of gravitational attraction are well understood and the equation of motion can be integrated
analytically. However, here, the trajectories of the two planets will be computed numerically.
(1) Write down, in vector form, the four ODEs governing the motion of the two planets interacting
gravitationally. (If written in component form, these four equations would give 12 equations.)
(2) Write a Python function two_body (x) which returns the vector f(x), as defined in (5.1), for
the two-body problem. The NumPy array x must be of size 12, and its shape must be [2, 2, 3].
For the entry x[i,j,k], i=0,1 corresponds to the first or second planet; j=0,1 corresponds
to the position vector or the velocity of the planet considered; and k=0,1,2 corresponds to
the x, y or z component of the vector (position or velocity). You can assume that the masses
of the planets, mo and m₁, are defined outside the function two_body.
(3) Consider two planets, Po and P₁, of mass m₁ = 1 and m₁ = 2, respectively. At time
t = 0, Po is at ro = (1,0,0) with velocity vo = = (0, 1/2, 0) and P₁ is at г₁ = (−1,0,0) with
velocity V₁ = (0, -1/4,0). The trajectories of the two planets are periodic and remain in the
(x, y)-plane. Solve the equations of motion numerically, using your function rk4, then plot
the complete orbits of the two planets.
Transcribed Image Text:Two point particles (or two planetary bodies) interacting only with each other under Newton's laws of gravitational attraction are well understood and the equation of motion can be integrated analytically. However, here, the trajectories of the two planets will be computed numerically. (1) Write down, in vector form, the four ODEs governing the motion of the two planets interacting gravitationally. (If written in component form, these four equations would give 12 equations.) (2) Write a Python function two_body (x) which returns the vector f(x), as defined in (5.1), for the two-body problem. The NumPy array x must be of size 12, and its shape must be [2, 2, 3]. For the entry x[i,j,k], i=0,1 corresponds to the first or second planet; j=0,1 corresponds to the position vector or the velocity of the planet considered; and k=0,1,2 corresponds to the x, y or z component of the vector (position or velocity). You can assume that the masses of the planets, mo and m₁, are defined outside the function two_body. (3) Consider two planets, Po and P₁, of mass m₁ = 1 and m₁ = 2, respectively. At time t = 0, Po is at ro = (1,0,0) with velocity vo = = (0, 1/2, 0) and P₁ is at г₁ = (−1,0,0) with velocity V₁ = (0, -1/4,0). The trajectories of the two planets are periodic and remain in the (x, y)-plane. Solve the equations of motion numerically, using your function rk4, then plot the complete orbits of the two planets.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole