# algorithms

Discussion in 'Microsoft VC .NET' started by Guest, Feb 1, 2005.

1. ### GuestGuest

I need help!!!
What should i do if i want to get out r from this function where i already
have a and b.

(1-(1/(1+r))^b)/r=a is there any logarithm and if there is in what library
do i find it

Guest, Feb 1, 2005

2. ### Fredrik WahlgrenGuest

"Lembit" <> wrote in message
news:...
> I need help!!!
> What should i do if i want to get out r from this function where i already
> have a and b.
>
> (1-(1/(1+r))^b)/r=a is there any logarithm and if there is in what library
> do i find it

I think this is correct. Check it.

(1-(1/(1+r))^b)/r=a
(1-(1/(1+r))^b)=a*r
1-(1/(1+r)) = (a*r)^(1/b)
-1/(1+r) = (a*r)^(1/b)-1
1/(1+r) = -((a*r)^(1/b)-1)
1+r = 1/(-((a*r)^(1/b)-1))
r = 1/(-((a*r)^(1/b)-1))-1

/Fredrik

Fredrik Wahlgren, Feb 1, 2005

3. ### Fredrik WahlgrenGuest

"Fredrik Wahlgren" <> wrote in message
news:%...
>
> "Lembit" <> wrote in message
> news:...
> > I need help!!!
> > What should i do if i want to get out r from this function where i

> > have a and b.
> >
> > (1-(1/(1+r))^b)/r=a is there any logarithm and if there is in what

library
> > do i find it

>

Forget my previous reply

Fredrik Wahlgren, Feb 1, 2005
4. ### Carl Daniel [VC++ MVP]Guest

Lembit wrote:
> I need help!!!
> What should i do if i want to get out r from this function where i
> already have a and b.
>
> (1-(1/(1+r))^b)/r=a is there any logarithm and if there is in what
> library do i find it

I'm too lazy to attempt the algebra at the moment, but looking at it, I'd
say no, there is no formula for that value - you'll have to use numerical
methods to search for a suitable r for a given a and b. For example, you
might use "Newton's Method" to solve this. You'll likely have to look it up
in a numerical methods book or a calculus book.

-cd

Carl Daniel [VC++ MVP], Feb 2, 2005