[Jprogramming] J question

Scott Russell SRUSSELL01 at MSN.COM
Tue May 9 02:33:52 HKT 2006


Hello,

I'm a newbie to J and I have a general programming question.

Say I wanted to find a solution to a problem that would normally require an iterative technique.  For a very simplified example:

Say you purchased a CD or some other financial instrument where you wanted to accumulate $1,000 at the end of 3 years.
This CD had an annual fee of $50 (payable at the beginning of the year) and it guaranteed an interest rate of 10%.  How much would you need to invest at the beginning of the 3 years ?  In other words, solve for X:

(((((X-50) * 1.10) - 50) * 1.10) - 50) * 1.10 = $1,000

In Excel, I could set up a macro that searched for the solution through the bisection algorithm or I could use the "Goal Seek" function if I really wanted to take a short cut.

But I wouldn't know where to start in J.  Any ideas ? Thanks


More information about the Programming mailing list