[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Nonlinear equation
From: |
Lorenzo Fiorentini |
Subject: |
Re: Nonlinear equation |
Date: |
Wed, 16 Apr 2003 12:36:36 +0200 |
If you really want to use Newton's method you need to
calculate the derivative dy/dx first.
If I am not wrong, differentiating both sides...
dy/dx= 1/(a*(1-1/b-ln(y/b))
Use this derivative at your own risk (bla bla, GPL stuff ;-)
Please check it!!
Lorenzo
Il 16/04/2003 6.03.55, Heber Farnsworth
<address@hidden> ha scritto:
>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
>------------------------------------------------------------
-
>
>
-------------------------------------------------------------
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
-------------------------------------------------------------