Mercurial > hg > octave-lyh
changeset 10393:7df8f8194c96
fix tests in fminbnd
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 05 Mar 2010 07:29:26 +0100 |
parents | b4e5dcf023c9 |
children | bc475cd49147 |
files | scripts/ChangeLog scripts/optimization/fminbnd.m |
diffstat | 2 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2010-03-04 Jaroslav Hajek <highegg@gmail.com> + + * optimization/fminbnd.m: Fix tests. + 2010-03-04 Jaroslav Hajek <highegg@gmail.com> * optimization/fminbnd.m: Fix termination tolerances.
--- a/scripts/optimization/fminbnd.m +++ b/scripts/optimization/fminbnd.m @@ -204,7 +204,7 @@ %!shared opt0 %! opt0 = optimset ("tolx", 0); -%!assert (fminbnd (@cos, pi/2, 3*pi/2, opt0), pi, 10*eps) -%!assert (fminbnd (@(x) (x - 1e-3)^4, -1, 1, opt0), 1e-3, 10e-3*eps) -%!assert (fminbnd (@(x) abs(x-1e7), 0, 1e10, opt0), 1e7, 10e7*eps) -%!assert (fminbnd (@(x) x^2 + sin(2*pi*x), 0.4, 1, opt0), fzero (@(x) 2*x + 2*pi*cos(2*pi*x), [0.4, 1], opt0), 1e-7) +%!assert (fminbnd (@cos, pi/2, 3*pi/2, opt0), pi, 10*sqrt(eps)) +%!assert (fminbnd (@(x) (x - 1e-3)^4, -1, 1, opt0), 1e-3, 10e-3*sqrt(eps)) +%!assert (fminbnd (@(x) abs(x-1e7), 0, 1e10, opt0), 1e7, 10e7*sqrt(eps)) +%!assert (fminbnd (@(x) x^2 + sin(2*pi*x), 0.4, 1, opt0), fzero (@(x) 2*x + 2*pi*cos(2*pi*x), [0.4, 1], opt0), sqrt(eps))