Glenn M. Lewis wrote:
> 
>    fn =. 3 : 0
> +/(1+i.y)^5
> )
>    fn 839
> 58340773411141200
> 
>     Now, I wish to make a table of all the values of 'fn' from 1 to 
> 1000...  Do I have to write a 'for' loop?
> 
>     Obviously, 'fn i. 1000' doesn't work and changing 'y' to "0 y in the 
> function also doesn't work because of the '+/'.
> 
Just use fn"0:
  fn"0 >: i. 1000 NB. if you want calc fn values from 1 to 1000 you should
use >: i.1000, not just i.1000

But you can get the same result more effectively:
  +/\(1+i.1000)^5

--
Mikl
-- 
View this message in context: 
http://www.nabble.com/Another-newbie-J-question---generating-a-table-from-a-monadic-function-tf4108474s24193.html#a11683752
Sent from the J Programming mailing list archive at Nabble.com.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to