]> hackdaworld.org Git - physik/computational_physics.git/commitdiff
use r³ !
authorhackbard <hackbard>
Fri, 24 Oct 2003 08:47:09 +0000 (08:47 +0000)
committerhackbard <hackbard>
Fri, 24 Oct 2003 08:47:09 +0000 (08:47 +0000)
zentral.c

index cf071cd699b56a59a62f71240c71a2cbe70eaa78..e7a9430014f8934e984a7203aa641ce4aec7e5a9 100644 (file)
--- a/zentral.c
+++ b/zentral.c
@@ -46,7 +46,7 @@ int main(int argc,char **argv) {
 
  /* loop */
  for(i=0;i<steps;i++) {
-  r_3=x_p*x_p+y_p*y_p;
+  r_3=sqrt(x_p*x_p+y_p*y_p)*(x_p*x_p+y_p*y_p);
   f_x=-alpha*x_p/r_3; f_y=-alpha*y_p/r_3;
   x=x_p+vx_p*tau; y=y_p+vy_p*tau;
   vx=vx_p+f_x*tau; vy=vy_p+f_y*tau;