Mercurial > hg > octave-nkf
diff src/DLD-FUNCTIONS/lsode.cc @ 14501:60e5cf354d80
Update %!tests in DLD-FUNCTIONS/ directory with Octave coding conventions.
* __contourc__.cc, __delaunayn__.cc, __dispatch__.cc, __dsearchn__.cc,
__fltk_uigetfile__.cc, __glpk__.cc, __lin_interpn__.cc, __magick_read__.cc,
__pchip_deriv__.cc, __qp__.cc, __voronoi__.cc, besselj.cc, betainc.cc,
bsxfun.cc, cellfun.cc, chol.cc, conv2.cc, convhulln.cc, dassl.cc, det.cc,
dlmread.cc, dmperm.cc, dot.cc, eig.cc, eigs.cc, fft.cc, fft2.cc, filter.cc,
find.cc, gammainc.cc, gcd.cc, givens.cc, hess.cc, hex2num.cc, inv.cc, kron.cc,
lookup.cc, lsode.cc, lu.cc, luinc.cc, matrix_type.cc, max.cc, mgorth.cc,
nproc.cc, qr.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc,
schur.cc, spparms.cc, sqrtm.cc, str2double.cc, strfind.cc, sub2ind.cc, svd.cc,
syl.cc, time.cc, tril.cc, tsearch.cc: Update %!tests in DLD-FUNCTIONS/
directory with Octave coding conventions.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Tue, 27 Mar 2012 22:46:45 -0700 |
parents | 72c96de7a403 |
children | 460a3c6d8bf1 |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/lsode.cc +++ b/src/DLD-FUNCTIONS/lsode.cc @@ -475,25 +475,27 @@ /* -%% dassl-1.m -%% -%% Test lsode() function -%% -%% Author: David Billinghurst (David.Billinghurst@riotinto.com.au) -%% Comalco Research and Technology -%% 20 May 1998 -%% -%% Problem -%% -%% y1' = -y2, y1(0) = 1 -%% y2' = y1, y2(0) = 0 -%% -%% Solution -%% -%% y1(t) = cos(t) -%% y2(t) = sin(t) +## dassl-1.m +## +## Test lsode() function +## +## Author: David Billinghurst (David.Billinghurst@riotinto.com.au) +## Comalco Research and Technology +## 20 May 1998 +## +## Problem +## +## y1' = -y2, y1(0) = 1 +## y2' = y1, y2(0) = 0 +## +## Solution +## +## y1(t) = cos(t) +## y2(t) = sin(t) +## %!function xdot = __f (x, t) %! xdot = [-x(2); x(1)]; +%!endfunction %!test %! %! x0 = [1; 0]; @@ -502,15 +504,15 @@ %! %! tol = 500 * lsode_options ("relative tolerance"); %! -%! %! x = lsode ("__f", x0, t); %! %! y = [cos(t), sin(t)]; %! -%! assert(all (all (abs (x - y) < tol))); +%! assert (x, y, tol); %!function xdotdot = __f (x, t) %! xdotdot = [x(2); -x(1)]; +%!endfunction %!test %! %! x0 = [1; 0]; @@ -521,10 +523,11 @@ %! %! y = [1, 0; 1, 0]; %! -%! assert(all (all (abs (x - y) < tol))); +%! assert (x, y, tol); %!function xdot = __f (x, t) %! xdot = x; +%!endfunction %!test %! %! x0 = 1; @@ -535,12 +538,11 @@ %! %! y = [1; e]; %! -%! assert(all (all (abs (x - y) < tol))); +%! assert (x, y, tol); %!test %! lsode_options ("absolute tolerance", eps); -%! assert(lsode_options ("absolute tolerance") == eps); +%! assert (lsode_options ("absolute tolerance") == eps); -%!error <Invalid call to lsode_options> lsode_options ("foo", 1, 2); - +%!error lsode_options ("foo", 1, 2) */