help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: : Nonlinear equation


From: Humberto Nanni
Subject: RE: : Nonlinear equation
Date: Wed, 16 Apr 2003 12:43:27 %z (CDT)

>Can you help me how to solve a nonlinear equation given by:
>x = a*y*ln(b) - a*y*ln(y) + a*y
>where a and b are constant parameters.
>I know the inital value of x0 and I want to know the value of y.
>Can I use Newton's method? How?

Yes you can. How?, well first take a look at 
http://www.library.cornell.edu/nr/bookcpdf/c9-4.pdf (numerical recipes 
on-line). 
and of  course, in the messages posted in this list that shows how to set-up 
the equation in the form of f(y).


Also, I want to point some heuristics that maybe have to be related to the 
problem.

1. b have to be a positive number (and nonzero), yet NR (newton-rasphson) can´t 
deal with the complex numbers that will result using ln(negative number). 
(Unless you move to a complex space and make tangent planes instead tangent 
lines to do the itereations)

If you expect that the result of y is positive then you have to attach 
something like this logic to the NR algoritmh´s implementation:

 routine that do a newton step (calculates deltaY)
 y:=y + deltaY
----------------------
 If (y less than zero) 
  then                         <----------------
   y:= epsilon;
 endif;
-----------------------
continue with the iterations

epsilon is system dependent. Try to use the very less floating number that your 
system can resolve (that works for me).

2. NR steps always point to the solution. However the step could be so large, 
that it could lead to a far point (than which it started) growing the error 
metric. In this case, you´ll need to use a damped version of the NR´s method 
this is explained in the numerical recipes text or alternatively in the works 
of M.Hanke, (search for him in the archives of this mailing list).



I´m unsure if octave´s fsolve is numerically stable as to avoid wander in 
usless iterations (never converge) under stressing probles, like optimisations 
of  functions involving ln(). Would the developers give me insight about this?.

kindly
H.Nanni



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]