Anonymous avatar Anonymous committed 8d990d7

.

Comments (0)

Files changed (1)

 pi pi f* 4e f* fconstant solarmass
 365.24e fconstant #days
 5 constant nb
+0.01e fconstant dt
 
 : f?  f@ f. ;
 
 : sun+  px f@ solarmass f/ fnegate 0 vx f!  py f@ solarmass f/ fnegate 0 vy f!  pz f@ solarmass f/ fnegate 0 vz f! ;
 : offp   p+ sun+ ;
 
+: sq  fdup f* ;
+
+: dx  ( j i -- F: dx )  x f@  x f@ f- ;
+: dy  ( j i -- F: dy )  y f@  y f@ f- ;
+: dz  ( j i -- F: dz )  z f@  z f@ f- ;
+: ds  ( j i -- F: ds )  2dup dx sq  2dup dy sq  dz sq f+ f+ fsqrt ;
+
+: enext  ( i F: e1 -- F: e2 )  dup 1+ nb swap cr ?do I mass f@ dup mass f@ f*  I over ds f/ f- loop drop ;
+: energy  ( -- F: e )  0e nb 0 do  0.5e0 I mass f@  I vx f@ sq I vy f@ sq I vz f@ sq f+ f+ f* f*  f+  I enext loop ;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.