Skip to content

Instantly share code, notes, and snippets.

@23Skidoo
Created June 21, 2011 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 23Skidoo/1038315 to your computer and use it in GitHub Desktop.
Save 23Skidoo/1038315 to your computer and use it in GitHub Desktop.
Wrong SO answer illustration
http://stackoverflow.com/questions/6411771/nested-triangular-loop-in-haskell/6413934
Java version:
0.06072334190603272
2.590520221772998
5.098582403887274
7.59983261470893
10.096589520693144
12.588688490747979
15.07411200036769
17.546971772169545
19.98705206400796
22.268125074484058
Haskell version (imperative)
http://stackoverflow.com/questions/6411771/nested-triangular-loop-in-haskell/6413934#6413934
6.072334190603272e-2
2.590520221772998
5.098582403887274
7.59983261470893
10.096589520693144
12.588688490747979
15.07411200036769
17.546971772169545
19.98705206400796
22.268125074484058
Haskell version (functional)
http://stackoverflow.com/questions/6411771/nested-triangular-loop-in-haskell/6427776#6427776
(1,Body {x = 0.5, v = 2.5932342605084737, m = 5.5})
(2,Body {x = 1.0, v = 5.10201668374689, m = 11.0})
(3,Body {x = 1.5, v = 7.60431691852258, m = 16.5})
(4,Body {x = 2.0, v = 10.102690460746846, m = 22.0})
(5,Body {x = 2.5, v = 12.597467412909273, m = 27.5})
(6,Body {x = 3.0, v = 15.08781059853185, m = 33.0})
(7,Body {x = 3.5, v = 17.571254154329772, m = 38.5})
(8,Body {x = 4.0, v = 20.041237257534245, m = 44.0})
(9,Body {x = 4.5, v = 22.47555560203406, m = 49.5})
(10,Body {x = 5.0, v = 24.735614155881624, m = 55.0})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment