help-octave
[Top][All Lists]
Advanced

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

## RE: Nonlinear equation

 From: Bill Kreamer Subject: RE: Nonlinear equation Date: Sun, 20 Apr 2003 13:09:19 -0400

```The equation x = a*y*log(b) - a*y*log(y) + a*y  is non-linear, but it is
well behaved for positive numbers. I used Octave to apply the Newton-Raphson
formula to find y for various values of given x, with excellent results.
First, let's simplify the equation. Step one is to define w = x/a .

The equation becomes w = log(b)*y - y*log(y) + y
Then let K = log(b) + 1, so that the equation becomes w = K*y - y*log(y).
Remembering that the limit of y*log(y) as y approaches zero, is zero, the
picture of a plot comes into mind. You can plot this equation with Octave,
but start at a small positive number instead of 0, because Octave will
produce NaN for y*log(y) at y=0.

As y increases from zero, the function starts at zero, increasing to a
maximum, and then decreasing and crossing zero, and decreasing without
limit.

The Newton-Raphson formula is  new y = y - ((function of y)/(first
derivative of function of y).
The function of y is K*y - y*log(y) - w     where w is a given value for
which you are finding y.
The first derivative  is (K - 1) - log(y)

The start value of y should be near where the solution should be. The plot
will provide the clues.
Newton - Raphson converges rapidly for most solutions, but more slowly for
solutions near the function's maximum.  If you happen to enter a value of w
that is greater than the maximum, Octave will dutifully converge to a
complex number that satisfies the equation!

-------------------------------------------------------------
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]