[S] Bug(s) in optimize().

Rolf Turner (rolf@math.unb.ca)
Sat, 11 Jul 1998 15:33:44 -0300 (ADT)


Unless I'm being even more obtuse than usual, there is a
serious problem with the optimize() function in Splus
version 3.4 for Unix. There is also a minor bug with the
sign of the objective when ``maximum=T''.

Has anyone else noticed these glitches?

cheers,

Rolf Turner
rolf@math.unb.ca

===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===

Example illustrating major problem:
===================================

Splus3.4 > optimize(function(x){-x},c(0,1),max=T)
$maximum:
[1] 0.381966

$objective:
[1] -0.381966

$nf:
[1] 18

$interval:
[1] 0.3818903 0.3820360

$message:
[1] "normal termination"

$aux:
NULL

$call:
optimize(f = function(x)
{
- x
}
, interval = c(0, 1), maximum = T)

Example illustrating minor problem:
===================================

This is in fact the example given in the documentation
of optimize()!!!

Splus3.4 > optimize(function(x){x*(4-x)},c(0,4),max=T)
$maximum:
[1] 2

$objective:
[1] -4 # They forgot to flip the sign back.

$nf:
[1] 8

$interval:
[1] 1.999959 2.000041

$message:
[1] "normal termination"

$aux:
NULL

$call:
optimize(f = function(x)
{
x * (4 - x)
}
, interval = c(0, 4), maximum = T)
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news