[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Nonlinear equation
From: |
Heber Farnsworth |
Subject: |
Re: Nonlinear equation |
Date: |
Tue, 15 Apr 2003 23:03:55 -0500 |
Newton's method finds (hopefully) zeros of functions. So if you move
the x0 to the right hand side you have a function which is zero at the
correct value of y. If a, b, and x0 are constants then just define
your function that way. If they are parameters that you may have to
change on subsequent runs you may want to make them global variables as
I've done below. Define a function
function f = myfunc(y)
global a b x0
f = a*y*log(b) - a*y*log(y) + a*y - x0;
endfunction
Then at the octave prompt (after you have set your global variables)
type
fsolve("myfunc",1)
where 1 is a starting value for y. You may want to pick a better one
if you have an idea where y is.
Heber
On Tuesday, April 15, 2003, at 09:43 PM, address@hidden wrote:
Hello,
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?
Regards,
Paulo
-------------------------------------------------------------
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
-------------------------------------------------------------
-------------------------------------------------------------
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
-------------------------------------------------------------