Hacker News new | ask | show | jobs
by waynecolvin 3417 days ago
You are describing "generalization". Lookup Tables (LUT) can still be a valid technique if the problem space is small enough.

If you use a table for trigonometry functions then interpolation is generally used... So it doesn't have to be all-or-nothing.

Compression generally works by removing redundancy via some means or another according to some scheme... But compressed data can take up more space if it goes against the grain (i.e. RLE when the repeated byte is the same as escape byte). Randon number generators with simple seeds (not a hidden entropy pool) can be thought of as disrupting simple patterns in a sequence.

EDIT: just thought of this. http://mathworld.wolfram.com/Prime-GeneratingPolynomial.html

1 comments

You can use a LUT, but that's not required to define sin and cos. You can define them perfectly fine as

sin(kπ) = 0 sin(kπ + ½π) = (-1)^k cos(kπ) = (-1)^k cos(kπ + ½π) = 0 dsin/dx = -cos dcos/dx = sin

Sine and cosine are the only smooth continuous functions that are solutions to that system of equations. There are also numerous geometric ways to define them. That's what's meant by "understanding". If all you had was the LUT and no other way to compute the value of sine, then you don't really understand what sine is.

Table lookup is a common solution when a FPU isn't available and speed is a higher priority than accuracy.

I've actually used formulas for trig functions before with IEEE double floating-point until the accuracy didn't improve.

(think it was a continued fraction or or some other technique I didn't understand, didn't -lm or something for builtin functions and worked around it lol...)

It was very slow! Makes your computer's fan spin faster, even changes the smell in the room while grinding away!