Advertisement
Neveles

© 2021 Neveles. All rights reserved.

May 1st, 2021
842
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. int funForRKF(int n, double t, double* x, double* dxdt)
  2. {
  3.   dxdt[0] = x[1]; // m1' = m2
  4.   dxdt[2] = x[3]; // m3' = m4
  5.  
  6.   dxdt[1] = -(1 - u) * x[0] / ((sqrt(x[0] * x[0] + x[2] * x[2])) * (x[0] * x[0] + x[2] * x[2])) -
  7.     (x[0] - 1) / (sqrt(pow(x[0] - 1, 2) + x[2] * x[2]) * (pow(x[0] - 1, 2) + x[2] * x[2]));
  8.  
  9.   dxdt[3] = -(1 - u) * x[2] / ((sqrt(x[0] * x[0] + x[2] * x[2])) * (x[0] * x[0] + x[2] * x[2])) -
  10.     x[2] / (sqrt(pow(x[0] - 1, 2) + x[2] * x[2]) * (pow(x[0] - 1, 2) + x[2] * x[2]));
  11.  
  12.   return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement