help-octave
[Top][All Lists]
Advanced

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

RE: Optimization: Replace NaN by Inf


From: Gabriel Arcos
Subject: RE: Optimization: Replace NaN by Inf
Date: Mon, 6 Aug 2001 21:12:24 -0400

Suppose you have the problem max F(x), and suppose F(x) have derivative
DF(x). Now, suppose DF(x) can be expressed as DF(x)=P(x)/Q(x). Suppose F
have his maximun at x=x0, so DF(x0) vanish.

Example 1: think  P(x)=R(x)T(x) where R(x0)=0 and T(x0)=0, and Q(x)=R(x)G(x)
where G(x0)=1.

then DF(x0) = P(x0)/Q(x0) = R(x0)T(x0)/R(x0)G(x0) = T(x0)/G(x0) = 0/1 = 0,
but octave must return DF(x0)=0/0=NaN

so, when you change NaN by Inf=1/0 you will ignorate that maximun x0. :-)

Is a thing of concepts, NaN represents expresion of the form 0/0 and Inf
represents expresions of the form 1/0.

Regards. Gabriel.


----- Original Message -----
From: Etienne Grossmann <address@hidden>
To: <address@hidden>; <address@hidden>
Cc: <address@hidden>; <address@hidden>
Sent: Monday, August 06, 2001 1:14 PM
Subject: Optimization: Replace NaN by Inf


>
>   Hello,
>
>   when optimizing a function 'f', I am tempted to replace any NaNs
> that it returns by Infs. This way, the returned value can be compared
> w/ other values, and the optimization algorithm is happy.
>
>   Can anyone think of a reason not to replace NaNs by Infs inside an
> optimization algorithm?
>
>   If not, I'll have my various optimization functions do the
> replacement.
>
>   Etienne
>
>
>
> -------------------------------------------------------------
> 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
-------------------------------------------------------------



reply via email to

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