|
Contents | Previous | Next | Subchapters |
| Syntax |
gaussq2d(function fvec, limx, function limy) |
| See Also | quad2d , gaussq , gaussleg |
x2 y1(x)
/ /
| dx | f(x, y) dy
/ /
x1 y1(x)
as a scalar with the same type as limx.
The real or double-precision vector limx has three elements:
the first is the lower limit for integration in the
x direction (x1);
the second is the upper limit (x2);
and the third is a bound for the size of quadrature intervals in the
x direction.
limy(x)
Returns a three-element vector with the same type as limx:
the first is the lower limit for integration in the
y direction [y1(x)];
the second is the upper limit [y2(x)];
and the third is a bound for the size of quadrature intervals in the
y direction.
fvec(x, yvec)
Returns the column vector
T
[f(x, yvec(1)), f(x, yvec(2)), ... , f(x, yvec(n))]
with the same type as limx,
where the scalar x has the same type as limx
and yvec is a column vector of length n
with the same type as limx.
The third element or limx and of limy(x)
control the
accuracy and amount of work by determining how many quadrature
intervals are necessary.
1 1 1 2 1 1
/ / / y | 1 / 1
| dx | x y dy = | dx x --- | = - | x dx = -
/ / / 2 | 2 / 4
0 0 0 0 0
clear
#
function fvec(x, yvec) begin
return x % yvec
end
function limy(x) begin
y1 = 0.
y2 = 1.
ybnd = .2
return {y1, y2, ybnd}
end
x1 = 0.
x2 = 1.
xbnd = .2
limx = {x1, x2, xbnd}
gaussq2d(function fvec, limx, function limy)