🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sci.math.num-analysis
Article #325

Re: *moan*beg*: HELP : sob,snif "forlorn looks", much suffering....

#325
From: Christopher Browne
Date: Mon, 24 Aug 1992 01:45
83 lines
3421 bytes
In article <1992Aug23.223610.6707@ecst.csuchico.edu> madams@ecst.csuchico.edu (Michael E. Adams) writes:
>In article <1992Aug23.141644.8398@morrow.stanford.edu> dow@nova2.stanford.edu (Keith Dow) writes:
>>>Given:  p, n, b, & f = 0;  How do you solve for 'i'?
>>>
>>>                            -n                       -n
>>>     100 p  1 - (1 + i/100)^   +  b = -f (1 + i/100)^
>>>            ---------------
>>>                   i
>>
>>Plug in p,n,b and f and you get i can be anthing except zero.  Sounds
>>like a hoax since the problem is trivial.  Since Chico was rated the 
>>number one party school by Playboy...

I wonder what they rated Stanford?  #1 for turkeys?...  And people who
think that i=0 \forall i?

i is NOT anything but zero...

What you'll want to do is probably some sort of Newton's method or a
secant approximation.  It is POSSIBLE that i has a closed-form
representation, but I strongly suspect not.

Reform this so that you get F(i) = 0, thus:

F(i) = 100*p*(1-(1+i/100)^(-n))/i+f*(1+i/100)^(-n)+b

You'll want to find a root (a point where F(i)=0) of this.  There
COULD be multiple roots, and I don't think you can directly solve for
i (Some Mathematica/Maple whiz may contradict me here - but I strongly
doubt it).

I'll not bother doing the program - but will sketch out a quick secant
formula.

(1) Consider the infamous iterative Newton method.  We calculate
successively better (we hope!) approximations of the value at which
F(x) becomes zero.

We start with some estimate of i, say i0= 0.10.

Then, we determine the next estimate, i1, as follows:

i1 = i0 - F(i0)/F'(i0)

F'(i0) is the value of the derivative of F at i0.

i1 will be closer to the answer than i0.

Then, compute i2 = i1 - F(i1)/F'(i1),

and so forth...

in = in-1 - F(in-1)/F'(in-1)

When the two values, in and in-1 get close enough, you can stop.

The unfortunate part here is that this computation requires that you
take the derivative of F, which is somewhat painful.

So, to avoid this, we go to the secant method, which approximates the
derivative.

You'll need to have TWO estimates (say, i0=0 and i1=0.1).

Then, the new estimate, x[n] is computed as follows:

x[n] = x[n-1] - F(x[n-1]) * (x[n-1] - x[n-2])/(F(x[n-1])-F(x[n-2]))

This is somewhat more complicated-looking than Newton's method, and
may not converge as fast, but it certainly should work for your
problem.

I suggest doing NOT doing this in assembly language :-).

There is most probably something in the NETLIB libraries to do this -
but it's simple enough that it's either (a) Trivial to hack up, or (b)
Something you REALLY SHOULD learn to code...

-- 
Christopher Browne
cbbrowne@csi.uottawa.ca
University of Ottawa
Master of System Science Program
Technical Details
Message-ID: <1992Aug24.014507.25420@csi.uottawa.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!cunews!csi.uottawa.ca!news
References: <1992Aug23.113011.816@ecst.csuchico.edu> <1992Aug23.141644.8398@morrow.stanford.edu> <1992Aug23.223610.6707@ecst.csuchico.edu>

Show Full Headers
Complete Article Headers
Newsgroups: sci.math.num-analysis
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!cunews!csi.uottawa.ca!news
From: cbbrowne@csi.uottawa.ca (Christopher Browne)
Subject: Re: *moan*beg*: HELP : sob,snif "forlorn looks", much suffering....
Message-ID: <1992Aug24.014507.25420@csi.uottawa.ca>
Sender: news@csi.uottawa.ca
Nntp-Posting-Host: prgv
Organization: Dept. of Computer Science, University of Ottawa
References: <1992Aug23.113011.816@ecst.csuchico.edu> <1992Aug23.141644.8398@morrow.stanford.edu> <1992Aug23.223610.6707@ecst.csuchico.edu>
Distribution: usa
Date: Mon, 24 Aug 92 01:45:07 GMT
Lines: 83