[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using quad() for multidimensional integration
From: |
Vinayak Dutt |
Subject: |
Using quad() for multidimensional integration |
Date: |
Wed, 16 Aug 95 18:52:53 CDT |
Hi Octavers:
I am trying to use Octave to do multidimensional integration using the
quadrature method: quad(). I have a triple integral of type:
(TeX Notation)
\int_{x=0}^{R} F(x) \int_{y=0}^{f(x)} G(y) \int_{0}^{g(y)} H(z) dz dy dx
I guess, th exact integral does not matter, except that its triple integral.
So I implement this by having the integral function itself involve another
integration using quad() which again involves another integration.
a = quad('func1',x1,x2);
% and
function f2 = func1(x)
y1=0;
y2 = f(x);
f2 = F(x)*quad('func2',y1,y2);
endfunction
% and
function f3 = func2(y)
z1 = 0;
z2 = g(y);
f3 = G(y)*quad('H',z1,z2);
endfunction
But when I do triple integral this way, I find that first two quadratures are
not
evaulated at all. The functions func1 and func2 were evaluated only once. Only
func2 was used to completely evaluate func1 for that single func1 evaluation.
It seems the recursion in quad() is somehow killing the hiher level quad()
evaluation.
Could this be due to usage of some globals in quad() which make it
non-recursive?
Any comments?
I am using Octave-1.1.1 on SPARC-Solaris2.4 with gcc2.6.3.
--vinayak-
/*
* vinayak dutt
* ex-graduate student, ultrasound research
* mayo graduate school, rochester mn
*
* e-mail: address@hidden
* address@hidden
* address@hidden
*
*/
#include "disclaimer.h"
- Using quad() for multidimensional integration,
Vinayak Dutt <=