0

I don't know how to solve the next problem, and if anyone could explain to me step by step how it is solved I would thank you a lot. I know it's not hard, but I'm not seeing how to do it. Thank you in advance!

An asteroid passes next to a planet with mass m, and position (0, 0). The asteroid has an initial velocity (Vx, Vy) and a starting position (Px, Py). Considering that gravity is 1, and ignoring the size of both objects, get the formula to calculate the asteroid position in the future.

  • Draw a picture. Surely, you'll be able to draw the force of gravity vector into the picture. Then, remember that $\vec{F}=m\vec{a}$. Input $\vec{F}$ as Newton's law of universal gravitation. There, you'll get a differential equation, since acceleration is the second time derivative of location. – Matti P. Dec 08 '20 at 11:27
  • I'm not understanding what I have to draw exactly. For now, I have this: link. – Pol Vega Dec 08 '20 at 11:35
  • Perhaps you should forget about the initial velocity for a second and focus on the acceleration. The acceleration of the object, obviously, points to the planet with mass $m$. Continue from there ... – Matti P. Dec 08 '20 at 11:38
  • Okay, and what is the acceleration in ⃗ =⃗ ? Because given the information I have in the problem I don't know how to get it. – Pol Vega Dec 08 '20 at 11:41
  • One thing that confuses me is what is meant by "gravity is 1". Does it mean that the force of gravity is $$ \vec{F}{\text{gravity}} = 1 \vec{r} $$ or does it mean that the gravitational constant is equal to 1, so that $$ \vec{F}{\text{gravity}} = \underbrace{G}{=1} m{\text{asteroid}} \cdot \frac{m}{P_x^2 + P_y^2} \vec{r} $$ ? I think it's the latter ... – Matti P. Dec 08 '20 at 11:49
  • Yes, I have read again the information. Is referring to the gravitational constant. 100% sure. – Pol Vega Dec 08 '20 at 11:53
  • Okay good, so now we should have all the information. So the acceleration is the one that you want to solve for. So you want an expression of the form $$ \vec{a} = \text{something} ... $$ because you know that that is the second derivative of the position vector. – Matti P. Dec 08 '20 at 11:54
  • Okay... I'm really sorry if I sound very very stupid, I haven't done math in a long time... But what is the second derivative and how is calculated? I'm really sorry, but I'm not getting it :( – Pol Vega Dec 08 '20 at 11:58
  • I really need to find how to solve this problem... Please @MattiP. don't let me down – Pol Vega Dec 08 '20 at 13:38

1 Answers1

0

enter image description here

Here is the coordinate system and the force diagram. At first, it's a good idea to forget about any initial velocities and just focus on the forces. There's only one force acting, which is the gravity on the asteroid. According to Newton's law of universal gravitation, it can be calculated as $$ \vec{F_g} = G \frac{m_{\text{asteroid}} m_{\text{planet}}}{r^2} \vec{r} $$ where $G=1$ is a constant (set to $1$ by the problem statement) and $\vec{r}$ is a unit vector pointing from the asteroid to the planet (overlapping with the blue vector in the picture). $r$ is just the distance between the two objects, so $r^2 = x ^2 + y^2$.

Next, we want to split this into $x$ and $y$ components. The angle that the blue vector makes (let's call it $\theta$) with the horizontal satisfies $$ \tan \theta = \frac{x}{y} $$ Now, the components of the force are $$ \begin{cases} x\text{-component}: F_x = -\sin \theta |\vec{F_g}| = -\sin \theta \frac{m_{\text{asteroid}} m_{\text{planet}}}{x ^2 + y^2} \\ y\text{-component}: F_x = -\cos \theta |\vec{F_g}| = -\cos \theta \frac{m_{\text{asteroid}} m_{\text{planet}}}{x ^2 + y^2} \\ \end{cases} $$ To wrap up the analysis with the forces, we apply Newton's second law of motion to the asteroid: $\sum \vec{F} = m_{\text{asteroid}} \vec{a}$. Since gravity is the only force, the previous expressions give the $x$ and $y$-components of the acceleration: $$ \begin{cases} x\text{-component}:-\sin \theta \frac{m_{\text{asteroid}} m_{\text{planet}}}{x ^2 + y^2} = m_{\text{asteroid}} a_x \\ y\text{-component}:-\cos \theta \frac{m_{\text{asteroid}} m_{\text{planet}}}{x ^2 + y^2} = m_{\text{asteroid}} a_y \\ \end{cases} $$ Here, $a_x$ and $a_y$ are the components of acceleration. The mass of the asteroid gets cancelled,and we set $m_{\text{planet}}=m$, and now we have the acceleration components $$ \begin{cases} a_x = \frac{d^2 x}{dt^2} = -\frac{m \sin \theta }{x ^2 + y^2} \\ a_y = \frac{d^2 y}{dt^2} = - \frac{m \cos \theta}{x ^2 + y^2} \\ \end{cases} $$ But we're not done yet. We have to form the equations of motion. So far, we only have commented on the second derivative of position. We have to incorporate the initial conditions as well (we know the initial values of $P_x$ and $P_y$, and also the initial values of the first derivative of these). So now we have the coupled second-order differential equations $$ \begin{cases} \frac{d^2 x}{dt^2} = -\frac{m \sin \theta }{x ^2 + y^2} \\ \frac{d^2 y}{dt^2} = - \frac{m \cos \theta}{x ^2 + y^2} \\ \end{cases} \qquad \text{with} \quad \begin{cases} \frac{d x}{dt} (0) = V_x \\ \frac{d y}{dt} (0) = V_y \\ \end{cases} \quad \text{and} \quad \begin{cases} x (0) = P_x \\ y(0) = P_y \\ \end{cases} $$ This can be solved numerically with a computer. When implementing the solution algorithm to a computer, one must be a bit careful with that, but there are several methods. The simplest is Euler's method, but there you have to choose a really small time step. You would have to make hundreds if not thousands of steps to have a decent accuracy. Another way to solve would be some version of Runge-Kutta.


Here's a quickly put together Python3 code that could serve as an example on how to numerically solve this problem:

import math
import sys

m = 10.0 delta_t = 0.001 # Don't put this to zero! V_x = 10.0 V_y = -3.0 P_x = 2.0 P_y = 3.0 T_max = 500 total_iterations = int(T_max / delta_t) + 1

def calculateAcceleration(x,y): global m theta = math.atan2(x,y) acceleration_x = -mmath.sin(theta)/(x2 + y2) acceleration_y = -mmath.cos(theta)/(x2 + y2) return [acceleration_x,acceleration_y]

def iterate(x,y,velocity_x, velocity_y): global delta_t acceleration_vector = calculateAcceleration(x,y) acceleration_x = acceleration_vector[0] acceleration_y = acceleration_vector[1] # Using first-order Euler method velocity_x_new = acceleration_x + delta_tacceleration_x velocity_y_new = acceleration_y + delta_tacceleration_y x_new = x + velocity_x_newdelta_t y_new = y + velocity_y_newdelta_t

return [x_new,y_new,velocity_x_new,velocity_y_new]

def fly(): global V_x, V_y global P_x, P_y global delta_t global total_iterations

iteration_number = 0
time = 0

# Initial values
x = P_x
y = P_y
velocity_x = V_x
velocity_y = V_y

while iteration_number < total_iterations:
    iteration_number += 1
    new_parameters = iterate(x,y,velocity_x, velocity_y)
    x       = new_parameters[0]
    y       = new_parameters[1]
    velocity_x  = new_parameters[2]
    velocity_y  = new_parameters[3]
    print(x,y)
    input() 

fly()

Matti P.
  • 6,012
  • Thanks for your answer @MattiP. ! I have all the problem clearer. But I still have a question. I implemented your formula since I obtain the acceleration formula (the fifth one).

    Then, I don't clearly understand what are you doing to obtain the position of the asteroid. I see you are using the initial velocity and the initial position, but I don't know how to integrate it with the acceleration formula.

    In other words, can you explain me how I have to use the calculated acceleration vector to obtain the asteroid position I'm searching? Can you develop a little bit more the last step?

    – Pol Vega Dec 09 '20 at 21:14
  • Thanks, you are helping me a lot! – Pol Vega Dec 09 '20 at 21:14
  • If you think the image is very large (which I do), you can add the suffix 'm' or 's' at the end of the url. E.g. https://i.stack.imgur.com/Z3Lyv.jpg $\rightarrow$ https://i.stack.imgur.com/Z3Lyvm.jpg – Anindya Prithvi Dec 10 '20 at 08:56
  • 1
    @AnindyaPrithvi Thanks, I was wondering if there's a simple way like that! Lesson of the day for me ... – Matti P. Dec 10 '20 at 09:00
  • @MattiP. THANK YOU VERY VERY MUCH! I totally understand now!! I honestly want to thank you for the help you bring to me! Have a nice day. – Pol Vega Dec 10 '20 at 11:09
  • @PolVega Nice to hear. Good luck and happy holidays! – Matti P. Dec 10 '20 at 11:15