numeric::int
-- numerical
integration (the float attribute of int)numeric::int
(f(x), x = a..b, ..)
computes
a numerical approximation of int(f(x), x = a..b).
numeric::int(f(x), x = a..b <, options>)
float(hold(int)(f(x), x = a..b <, options>))
float(freeze(int)(f(x), x = a..b <, options>))
f(x) |
- | expression in x |
x |
- | identifier or indexed identifier. |
a,b |
- | arbitrary expressions. |
|
- | all options of numeric::quadrature can be
used. |
a floating point number or an unevaluated int(f(x), x = a..b
<, options>)
, if the integral cannot be evaluated
numerically.
numeric::int(arguments)
, float
(
freeze
(int)(arguments))
and float
(
hold
(int)(arguments))
are
equivalent.numeric::int(arguments)
and
numeric::quadrature(arguments)
are almost equivalent:
numeric::int
calls numeric::quadrature
. A
numerical result produced by numeric::quadrature
is
returned as is. Otherwise hold(int)(arguments)
is
returned.numeric::quadrature
for
details.We demonstrate some equivalent calls for numerical integration:
>> numeric::int(exp(x^2), x = -1..1), float(hold(int)(exp(x^2), x = -1..1)), float(freeze(int)(exp(x^2), x = -1..1)), numeric::quadrature(exp(x^2), x = -1..1)
2.925303492, 2.925303492, 2.925303492, 2.925303492
>> numeric::int(max(1/10, cos(PI*x)), x = -2..0.0123), float(hold(int)(max(1/10, cos(PI*x)), x = -2..0.0123)), float(freeze(int)(max(1/10, cos(PI*x)), x = -2..0.0123)), numeric::quadrature(max(1/10, cos(PI*x)), x = -2..0.0123)
0.7521024709, 0.7521024709, 0.7521024709, 0.7521024709
>> numeric::int(exp(-x^2), x = -2..infinity), float(hold(int)(exp(-x^2), x = -2..infinity)), float(freeze(int)(exp(-x^2), x = -2..infinity)), numeric::quadrature(exp(-x^2), x = -2..infinity)
1.768308316, 1.768308316, 1.768308316, 1.768308316
>> numeric::int(sin(x)/x, x = -1..10, GaussLegendre = 5), float(hold(int)(sin(x)/x, x = -1..10, GaussLegendre = 5)), float(freeze(int)(sin(x)/x, x = -1..10, GaussLegendre = 5)), numeric::quadrature(sin(x)/x, x = -1..10, GaussLegendre = 5)
2.604430665, 2.604430665, 2.604430665, 2.604430665
The calls numeric::int(..)
,
float(hold(int)(..))
and
numeric::quadrature(..)
are equivalent in multiple
numerical integrations, too:
>> numeric::int(numeric::int(x*y, x = 0..y), y = 0..1), numeric::int(numeric::quadrature(x*y, x = 0..y), y = 0..1), float(freeze(int)(numeric::int(x*y, x = 0..y), y = 0..1)), float(hold(int)(numeric::quadrature(x*y, x = 0..y), y = 0..1)), numeric::quadrature(numeric::int(x*y, x = 0..y), y = 0..1), numeric::quadrature(numeric::quadrature(x*y, x = 0..y), y = 0..1)
0.125, 0.125, 0.125, 0.125, 0.125, 0.125
The following integral do not exist. Consequently, numerical integration runs into problems:
>> numeric::quadrature(exp(x^2), x = 0..infinity)
Error: Overflow/underflow in arithmetical operation; during evaluation of 'exp::float'
Note that numeric::int
handles errors
produced by numeric::quadrature
and returns an unevaluated
call to int
:
>> numeric::int(exp(x^2), x = 0..infinity)
2 int(exp(x ), x = 0..infinity)
numeric::fint
int
as well as numeric::fint
of MuPAD
1.4. Symbolic analysis of the integrand was disabled, every aspect of
the quadrature is now handled numerically.numeric::quadrature
are now
allowed.