🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: sci.math.num-analysis
5 messages
5 total messages Started by Michael E. Adams Sun, 23 Aug 1992 11:30
*moan*beg*: HELP : sob,snif "forlorn looks", much suffering....
#558
Author: Michael E. Adams
Date: Sun, 23 Aug 1992 11:30
34 lines
1554 bytes
Did I forget, or did I just sleep in class too much in 1980 and
never really learned how to....

      >>>>> solve the "Time Value of Money" equation for 'i' <<<<<<

                             ?????????

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

Or,
                    -n
      1 - (1 + i/100)^   =  -b
      ---------------      -----
             i             100 p

And that's as far as I get.  I need HELP!!!!! *sniff*
Pascal code would be nice.  But I can live with an equation: 'i' alone.

Thank you for you time
-Michael

         (___)      |  Michael E. Adams
         (o o)      |  
  /-------\ /       |  P.O. Box 5027
 / |     ||O        |  Chico,  California  95927-5025    U.S.A.
*  ||,---||         |
   ~~    ~~         |  Internet: madams@cscihp.ecst.csuchico.edu
-- 
Hi! I am a .signature virus. Copy me into your .signature to join in!
Re: *moan*beg*: HELP : sob,snif "forlorn looks", much suffering....
#559
Author: Keith Dow
Date: Sun, 23 Aug 1992 14:16
10 lines
995 bytes
>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...
Re: *moan*beg*: HELP : sob,snif "forlorn looks", much suffering....
#322
Author: Michael E. Adams
Date: Sun, 23 Aug 1992 22:36
27 lines
1793 bytes
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 would not know about the party thing, I'm more of the rioting kind of guy ;-)
FYI I finished my degree in 82 and am now just a plain applications programmer
with a bad case of the "forgets".

This problem MAY be trivial to you, but I have been unable to solve it.  That's
why I asked for help.  Why don't you show me what a smart boy you are and
code the solution into Pascal for me.  I can also read Fortran, C, COBOL,
BASIC, 80x86 & 680x0 Assembly.  Use what ever you like, your pick. 

remember: "if you can't say anything nice....."

-Michael
-- 
Hi! I am a .signature virus. Copy me into your .signature to join in!
Re: *moan*beg*: HELP : sob,snif "forlorn looks", much suffering....
#325
Author: 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
Re: *moan*beg*: HELP : sob,snif "forlorn looks", much suffering....
#324
Author: RAI Ranjan
Date: Mon, 24 Aug 1992 03:49
30 lines
1788 bytes
In article <1992Aug23.113011.816@ecst.csuchico.edu> madams@ecst.csuchico.edu (Michael E. Adams) 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


   To all the guys who responded to this original posting:  Mike DIDN'T mean
 p = n = b = f = 0.  Only f = 0.  You would think the guy from Stanford would
 have figured that out :)  

   Anyway, there is no general `formula' for `i' in terms of the other 
 quantities, but you can make some considerable simplifications to the given
 equation: 
                                        -n                   
                        1 - (1 + i/100)^               
                   100p ---------------    + b = 0  
                              i
   let y = 1 + i/100 and after some manipulation you get the much nicer eqn.
           (b/p)*y^(n+1) + (1-b/p)*y^(n) = 1, which is a polynomial.

   Now use whatever root-finding code you may have (remember i !=0 ).

-- 
---
Ranjan Rai                             <rairan@ecf.toronto.edu> 
Engineering Science 9T3                <rairan@eecg.toronto.edu>
University of Toronto                      
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads