
The NUMERICAL RECIPES in Fortran 90 book[0]
The NUMERICAL RECIPES website[1]
0 - https://www.cambridge.org/us/universitypress/subjects/mathem...I once found a real incompatibilty. This collector assumes that a pointer to a block must point to somewhere in the block, or, in later versions, at least somewhere really close.
The original Numerical Recipes in C was a conversion of Numerical Recipes in FORTRAN. FORTRAN arrays start at 1. So, NR in C had an array allocator which returned an array address computed such that subscripts starting at 1 would work.[1] If you allocated a 100x100 array of 4-byte f32 values, the array address would be offset downward by (100+1)*4 bytes. That would not look like a pointer to the array to the garbage collector.
By the third edition, in 1986, the Numerical Recipes people had converted to C++, dropped FORTRAN array compatibility, and the problem went away.
[1] http://s3.amazonaws.com/nrbook.com/book_C210.html page 19.
The dynamic inheritance part of Ruby is still core even in a non-Rails ecosystem. That does make optimizing performance more difficult.
But on a much simpler level, a lot of Pythonic data code is just functions + values, without them being complected in an object. That makes a lot of stuff like wrapping numerical libraries in C very easy in Python. I think you'd still have a bit of a culture shock writing procedural, return-by-value code in Ruby. That's pretty normal in Python and I think one of the (many) reasons it got picked up by STEM disciplines in academia. Looks over shoulder at awful code in Numerical Recipes in Fortran book.
Different strokes for different folks and all that, I just think there are probably constraints (and cultural values) that Python has that make it more suited to data problems than Ruby.
It’s to optimize finding the median from a tape drive in the 70s, but the technique is pretty cute.
You make a guess at the median, then basically sum how many are over, and under that value, then guess again until you have an even split.
It’s also a problem I like to use to nerd snipe people, because why not.
Check my work, because it’s been a long time since I worked with FORTRAN and I could have just remembered incorrectly :)
Cool, I'll give it a go, thanks for sharing :)
In 1992 I was in my final year of secondary school and got into a science extension program which paired students with industry.
Somehow or other I ended up with a guy from DSTO (Australia's publicly funded defence arm), and he thought it would be a good idea for me to test the results of underwater acoustic transmissions against some results they had (he didn't tell me why this was needed, but it was pretty obvious..)
Anyway, he was a Fortran programmer who used a VAX. My family had a Mac Plus with Hypercard. He gave me "Numerical Recipes in Fortran"[1] and I ended up implementing Newton's method[1] in Hypercard. After that I felt I really understood calculus...