exp(x) in APL

Root Boy Jim rbj at icst-cmr
Tue Jul 1 01:22:28 AEST 1986


> In article <brl-smok.1611> rbj at icst-cmr.arpa (Root Boy Jim) writes:
> >My favorite one liner is `1 + +/ % ! i 12' (where `%' is DIVIDE (reciprocal)
> >and `i' is IOTA). Twelve is a good approximation to infinity here. Anyway,
> >you can see what happens when x is zero. All the other terms flake out
> >except the first, which has to be one. Isn't this fun?
> 
> Whoops, don't you mean:
> 		1 + +/ (x ^ i12) % (! i12)
> ??  (Ya need x^n in the numerator of each term....  I'm using "^" for 
> exponentiation.)

Of course! In the general case that is. Your expression is a function,
whereas mine is a long name for a constant (the function evaluated at zero,
or a very familiar looking number).

I said it was my favorite one liner because that's what it is. I type it
in without the carriage return and say `Guess what this is!' I could
have done `)origin 0' before and changed 12 to 13, but that's two lines.
I could also have dispensed with the first `1' and changed `i12' to
`0,i12', or `_1 + i13' (`_' is negation for constants).

> Peter S. Shenkin	 Columbia Univ. Biology Dept., NY, NY  10027
> {philabs,rna}!cubsvax!peters		cubsvax!peters at columbia.ARPA

Nice to know someone out there is awake and paying attention.

	(Root Boy) Jim Cottrell		<rbj at icst-cmr.arpa>
	MMM-MM!! So THIS is BIO-NEBULATION! 



More information about the Comp.lang.c mailing list