Re: General solution to equation



grove.matthew@xxxxxxxxx a écrit :
I need to solve the following equation for n, and I'm having a lot of
trouble.

(s*(1+t)^n-s)*(1-z) = (s*(1+x)^n-(s+(s*d*(1-(1+x)^n)/-x)))*(1-c)+
(s*d*(1-(1+x)^n)/-x)

Any help finding a general solution for n would be much appreciated.
It would even be helpful if someone could tell me that it's not
possible to find a general solution so I stop banging my head against
the wall. Thanks in advance.


The 's' factor appears everywhere and may be removed.

Let's note L= 1-z and R= (c-1) (1-d/x) + d/x then your equation is simply (if L not 0 that is z not 1) :
((1+t)^n - 1) = R/L ((1+x)^n - 1)

I'll define a function of n (with r= R/L) :
f(n)= ((1+t)^n - 1) - r ((1+x)^n - 1)

I'll suppose that t and x are different and not -1 and that you are searching a real positive solution for n

A simple solution of f(n)= 0 is of course n=0

Let's study the behavior of f(n) for positive values of n.

The derivative of f(n) is
f'(n)= ln(1+t) (1+t)^n - r ln(1+x) (1+x)^n

f'(n)= 0 iff ln(1+t)/ln(1+x) = r ((1+x)/(1+t))^n
that is n0= ln(ln(1+t)/ln(1+x)/r)/ln((1+x)/(1+t)) verifies f'(n0)=0
n0 may be complex, real and negative or real and positive.

Since f is smooth, f(0)= 0 and since limit_{n->+oo} f(n)= +/- oo you may obtain a positive solution for f(n)= 0 only in the last case (n0 positive real).

In this case you may solve f(n)= 0 by iterations for example using Newton's method :

Start with a 'large enough' value of n (say 2 n0) and compute
g(n)= n - f(n)/f'(n)= n - (((1+t)^n - 1) - r ((1+x)^n - 1))/(ln(1+t) (1+t)^n - r ln(1+x) (1+x)^n)
replace n by g(n) and continue until required precision

Should this method be unstable for your t, x, r values then try one of the methods proposed here : http://en.wikipedia.org/wiki/Root-finding_algorithm


Hoping it helped,
Raymond
.



Relevant Pages