Edward Cherlin wrote:
[sigh]
Do math tables in a math array language.
degrees =. i. 91 NB. 0..90
radians =. degrees * o. % 180
table =. |: degrees, 1 2 3 o./ radians
Sorry, I don't know J (Kirby does), but this is exactly the reason I prefer Python. Readability counts (for me). For creating a table, most people would probably use a spreadsheet anyway, but as I happen to know Python, I use it for such tasks from time to time. I can even remember the syntax without having used Python for months. Don't think that would be the case with J. Not very inclined to learn that.
where
=. is assignment i. creates a list of consecutive numbers starting at 0.
Who on earth would think of that without a manual?
NB. is the comment marker o. x is pi times x Why not pi? % x is reciprocal of x, so o. % 180 is pi/180 Don't think that is very useful. |: is transpose Another very special symbol. , appends an array to another. It turns a list into a table in order to match dimensions. Lost you there... 1 2 3 o. x gives sine, cosine, tangent of x Why don't they use sin(), cos(), tan() like the rest of the mathematical world? / creates a table with the given function (o.) applied to two list arguments
The result is a 91 row, 4 column table of angles and trig function values.
Impressive ;-))
I can easily give you a short sequence of lessons leading to this level, introducing some other arithmetic, transcendental, and array-handling functions along the way, and a little more about operating on functions to define new functions.
Python is much nearer to standard Math-notation, that is a good thing. I like to learn new languages - up to a point. I don't see the added value of J in this case. Just my 2c Christian