Mercurial > hg > octave-nkf
diff scripts/general/triplequad.m @ 12616:eb4afb6a1a51
dblquad.m,triplequad.m: Switch to quadcc as default integrator.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Mon, 18 Apr 2011 10:40:20 -0700 |
parents | 0713ad019e53 |
children | 25d4e163ee38 |
line wrap: on
line diff
--- a/scripts/general/triplequad.m +++ b/scripts/general/triplequad.m @@ -37,14 +37,14 @@ ## ## The optional argument @var{quadf} specifies which underlying integrator ## function to use. Any choice but @code{quad} is available and the default -## is @code{quadgk}. +## is @code{quadcc}. ## ## Additional arguments, are passed directly to @var{f}. To use the default -## value for @var{tol} or @var{quadf} one may pass an empty matrix ([]). +## value for @var{tol} or @var{quadf} one may pass ':' or an empty matrix ([]). ## @seealso{dblquad, quad, quadv, quadl, quadgk, quadcc, trapz} ## @end deftypefn -function q = triplequad (f, xa, xb, ya, yb, za, zb, tol = 1e-6, quadf = @quadgk, varargin) +function q = triplequad (f, xa, xb, ya, yb, za, zb, tol = 1e-6, quadf = @quadcc, varargin) if (nargin < 7) print_usage (); @@ -55,7 +55,7 @@ tol = 1e-6; endif if (isempty (quadf)) - quadf = @quadgk; + quadf = @quadcc; endif inner = @__triplequad_inner__; @@ -76,10 +76,9 @@ endfunction -%% Very simple calculation of volume of a rectangular box (~3 sec) -%!assert (triplequad (@(x,y,z) ones(length(x),1,1), 0,1, 0,2, 0,3, 1e-1, @quadcc), 6, 1e-1) +%!assert (triplequad (@(x,y,z) exp(-x.^2 - y.^2 - z.^2) , -1, 1, -1, 1, -1, 1, [], @quadcc), pi ^ (3/2) * erf(1).^3, 1e-6) -%% These tests are too expensive to run normally (~30 sec each). Disable them +%% These tests are too expensive to run normally (~30 sec each). Disable them #%!assert (triplequad (@(x,y,z) exp(-x.^2 - y.^2 - z.^2) , -1, 1, -1, 1, -1, 1, [], @quadgk), pi ^ (3/2) * erf(1).^3, 1e-6) #%!#assert (triplequad (@(x,y,z) exp(-x.^2 - y.^2 - z.^2) , -1, 1, -1, 1, -1, 1, [], @quadl), pi ^ (3/2) * erf(1).^3, 1e-6) #%!#assert (triplequad (@(x,y,z) exp(-x.^2 - y.^2 - z.^2) , -1, 1, -1, 1, -1, 1, [], @quadv), pi ^ (3/2) * erf(1).^3, 1e-6)