- #1
nearc
Gold Member
- 66
- 6
In practice I’ve found that a valid gravitational model of orbiting bodies only works when the force is computed with only the other mass and not both masses. Thus, the original equation does not work but the modified one does. Is using one mass ok or am I doing something wrong? thanks. [also i included is the agent based model I'm using [you will need to change the file extension to .nlogo], it can be run with a free download of netlogo [ https://ccl.northwestern.edu/netlogo/download.shtml ]]F = G*m1*m2/ r^2, original
F = G*m1/ r^2, modifiedusing Finite difference; Euler's method. with the time step is built into the gravitational constant, Gvaluenew=valueold + time step*differential equationmi, mj, mass of objects,[tex]
d_x=m_{i_x}-m_{j_x}
[/tex][tex]
d_y=m_{i_y}-m_{j_y}
[/tex][tex]
R^2=d^2_x+d^2_y
[/tex][tex]
F = \frac {Gm_im_j}{R^2}
[/tex][tex]
\Theta = tan^{-1}(\frac {d_y}{d_x})
[/tex][tex]
F_{x_{new}}= F_{x_{old}}+ Fcos(\Theta)
[/tex][tex]
F_{y_{new}}= F_{y_{old}}+ Fsin(\Theta)
[/tex][tex]
v_{x_{new}}= v_{x_{old}}+ F_{x_{new}}
[/tex][tex]
v_{y_{new}}= v_{y_{old}}+ F_{y_{new}}
[/tex][tex]
m_{ix_{new}}= m_{ix_{old}}+ v_{x_{new}}
[/tex][tex]
m_{iy_{new}}= m_{iy_{old}}+ v_{y_{new}}
[/tex]Rewritten in algorithm form [i.e. computational model]:[tex]
F_{ix_{new}} =F_{ix_{old}} + G\sum_{j=1}^{k} \frac{m_im_j}{{(m_{i_x }-m_{j_x }})^2 +({m_{i_y }-m_{j_y }})^2} cos(tan^{-1}(\frac { m_{i_x }-m_{j_x } } { m_{i_y }-m_{j_y } }))), i\neq j
[/tex][tex]
F_{iy_{new}} =F_{iy_{old}} + G\sum_{j=1}^{k} \frac{m_im_j}{{(m_{i_x }-m_{j_x }})^2 +({m_{i_y }-m_{j_y }})^2} sin(tan^{-1}(\frac { m_{i_x }-m_{j_x } } { m_{i_y }-m_{j_y } }))), i\neq j
[/tex][tex]
v_{x_{new}}= v_{x_{old}}+ F_{x_{new}}
[/tex][tex]
v_{y_{new}}= v_{y_{old}}+ F_{y_{new}}
[/tex][tex]
m_{ix_{new}}= m_{ix_{old}}+ v_{x_{new}}
[/tex][tex]
m_{iy_{new}}= m_{iy_{old}}+ v_{y_{new}}
[/tex]
F = G*m1/ r^2, modifiedusing Finite difference; Euler's method. with the time step is built into the gravitational constant, Gvaluenew=valueold + time step*differential equationmi, mj, mass of objects,[tex]
d_x=m_{i_x}-m_{j_x}
[/tex][tex]
d_y=m_{i_y}-m_{j_y}
[/tex][tex]
R^2=d^2_x+d^2_y
[/tex][tex]
F = \frac {Gm_im_j}{R^2}
[/tex][tex]
\Theta = tan^{-1}(\frac {d_y}{d_x})
[/tex][tex]
F_{x_{new}}= F_{x_{old}}+ Fcos(\Theta)
[/tex][tex]
F_{y_{new}}= F_{y_{old}}+ Fsin(\Theta)
[/tex][tex]
v_{x_{new}}= v_{x_{old}}+ F_{x_{new}}
[/tex][tex]
v_{y_{new}}= v_{y_{old}}+ F_{y_{new}}
[/tex][tex]
m_{ix_{new}}= m_{ix_{old}}+ v_{x_{new}}
[/tex][tex]
m_{iy_{new}}= m_{iy_{old}}+ v_{y_{new}}
[/tex]Rewritten in algorithm form [i.e. computational model]:[tex]
F_{ix_{new}} =F_{ix_{old}} + G\sum_{j=1}^{k} \frac{m_im_j}{{(m_{i_x }-m_{j_x }})^2 +({m_{i_y }-m_{j_y }})^2} cos(tan^{-1}(\frac { m_{i_x }-m_{j_x } } { m_{i_y }-m_{j_y } }))), i\neq j
[/tex][tex]
F_{iy_{new}} =F_{iy_{old}} + G\sum_{j=1}^{k} \frac{m_im_j}{{(m_{i_x }-m_{j_x }})^2 +({m_{i_y }-m_{j_y }})^2} sin(tan^{-1}(\frac { m_{i_x }-m_{j_x } } { m_{i_y }-m_{j_y } }))), i\neq j
[/tex][tex]
v_{x_{new}}= v_{x_{old}}+ F_{x_{new}}
[/tex][tex]
v_{y_{new}}= v_{y_{old}}+ F_{y_{new}}
[/tex][tex]
m_{ix_{new}}= m_{ix_{old}}+ v_{x_{new}}
[/tex][tex]
m_{iy_{new}}= m_{iy_{old}}+ v_{y_{new}}
[/tex]
Attachments
Last edited: