Actually I just took your equation and translated it into J. Then I used the J phrase for 'find the inverse'.
Your formula is 'subtract 50, then multiply by 1.1, repeated 3 times'. subtract 50, then multiply by 1.1 is, in J, (1.1 * 50 -~ ]) which I could have (should have) written more readably as 13 : '1.1 * y - 50' 'repeat 3 times' is ^:3 'find the inverse' is ^:_1 so the inverse function is just 13 : '1.1 * y - 50' ^:3 ^:_1 and we can apply this inverse to an operand by giving it one: 13 : '1.1 * y - 50' ^:3 ^:_1 (1000) To reiterate, I didn't find the inverse. I coded your function and asked J to find the inverse. Henry Rich > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Scott Russell > Sent: Monday, May 08, 2006 4:14 PM > To: Programming forum > Subject: Re: [Jprogramming] J question > > Thanks Henry. > > Can you give me the original equation and then how do you > make an inverse of the equation ? > > Scott > > ----- Original Message ----- > From: Henry Rich<mailto:[EMAIL PROTECTED]> > To: 'Programming forum'<mailto:[email protected]> > Sent: Monday, May 08, 2006 2:59 PM > Subject: RE: [Jprogramming] J question > > > I would never have thought of doing it this way, but you can > solve it in J just as you would in Excel. Defines the function, > and use the inverse to ask what value would give you 1000: > > (1.10 * 50 -~ ])^:3 ^:_1 (1000) > 888.092 > > Henry Rich > > > -----Original Message----- > > From: > [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED] > software.com> > > [mailto:[EMAIL PROTECTED] On Behalf Of > Scott Russell > > Sent: Monday, May 08, 2006 2:34 PM > > To: [email protected]<mailto:[email protected]> > > Subject: [Jprogramming] J question > > > > 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 > > > ---------------------------------------------------------------------- > > For information about J forums see > > > http://www.jsoftware.com/forums.htm<http://www.jsoftware.com/f > orums.htm> > > > ---------------------------------------------------------------------- > For information about J forums see > http://www.jsoftware.com/forums.htm<http://www.jsoftware.com/f > orums.htm> > ---------------------------------------------------------------------- > For information about J forums see > http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
