home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Press 1997 July
/
Sezamfile97_1.iso
/
msdos
/
misc
/
sm30a.a03
/
SYMBMATH.H38
< prev
next >
Wrap
Text File
|
1993-11-07
|
3KB
|
119 lines
4.6 Integration
You can find integrals of x^m*e^(x^n), x^m*e^(-x^n),
e^((a*x+b)^n), e^(-(a*x+b)^n), x^m*ln(x)^n, ln(a*x+b)^n, etc., (where m
and n are any real number).
It is recommended that to expand the integrand by expand() and/or
by setting the switch expand:=on before symbolic integration.
If symbolic integration fails, you can define a simple
integral or derivative, (or adding integral into the inte.(x) library),
then do integration again (see Chapter 4.14 Learning from User).
4.6.1 Indefinite Integration
Find indefinite integrals by
inte(expr, x)
Note that the arbitrary constant is not represented.
Example 4.6.1.
Find indefinite integrals.
IN: assume(a>0), isreal(b):=1
IN: inte(1/x, x), inte(1/a, a), inte(1/b, b)
OUT: ln(x sign(x)), ln(a), ln(|b|)
IN: inte(sin(x)*e^x, x)
OUT: 1/2 * (sin(x) - cos(x)) * e^x
IN: inte(sin(x)*cos(x), x)
OUT: (1/2)*sin(x)^2
IN: inte(x^1.5*exp(x), x)
OUT: ei(1.5, x)
Example 4.6.2.
Find indefinite double integrals.
IN: inte(inte(x*y, x), y)
OUT: 1/4 x^2 y^2
Example 4.6.3.
Find the line integral.
IN: x:=2*t
IN: y:=3*t
IN: z:=5*t
IN: u:=x+y
IN: v:=x-y
IN: w:=x+y+z
IN: inte(u*d(u,t)+v*d(v,t)+w*d(w,t), t)
OUT: 63 t^2
Example 4.6.4.
Integrate x^2*e^x and x^2*e^-x, then expand it by the mean of the
packages "ExpandEi.sm" (expand ei()) and "ExpandGa.sm" (expand gamma()).
IN: inte(x^2*e^x, x)
OUT: ei(2,x) # ei()
IN: readfile("ExpandEi.sm")
IN: inte(x^2*e^x, x)
OUT: x^2 e^x - 2 x e^x + 2 e^x # ei() is expanded
IN: inte(x^2*e^-x, x)
OUT: gamma(2,x) # gamma()
IN: readfile("ExpandGa.sm")
IN: inte(x^2*e^-x, x)
OUT: -x^2 e^(-x) - 2 x e^(-x) - 2 e^(-x) # gamma() is expanded
Defining integrals is similar to defining rules.
Example 4.6.5
IN: inte(f(x_), x_) := sin(x)
IN: inte(f(t), t)
OUT: sin(t)
4.6.2 Definite Integration
Find definite integrals by external functions
inte(expr, x from xmin to xmax)
inte(expr, x from xmin to singularity to xmax)
Example 4.6.6.
Find the definite integral of y=exp(1-x) with respect to x taken
from 0 to infinity.
IN: inte(exp(1-x), x from 0 to inf)
OUT: e
Example 4.6.7.
do discontinuous integration of 1/x^2 and 1/x^3 with discontinuty at x=0.
IN: inte(1/x^2, x from -1 to 2) # singularity at x=0
OUT: inf
IN: inte(1/x^3, x from -1 to 1) # singularity at x=0
OUT: 0
IN: inte(sqrt((x-1)^2), x from 0 to 2) # singularity at x=1
OUT: 1
SymbMath usually detect singularity, but sometime it cannot,
in this case you must provide singularity.
Example:
IN: inte(1/(x-1)^2, x from 0 to 1 to 2) # provide singularity at x=1
OUT: inf
Example 4.6.8
do complex integration.
IN: inte(1/x, x from i to 2*i)
OUT: ln(2)
4.6.3 Numeric Integration: NInte()
The external function
ninte(y, x from xmin to xmax)
does numeric integration.
Example 4.6.3.1.
Compare numeric and symbolic integrals of 4/(x^2+1) with
respect to x taken from 0 to 1.
IN: ninte(4/(x^2+1), x from 0 to 1)
OUT: 3.1415
IN: num(inte(4/(x^2+1), x from 0 to 1))
OUT: 3.1416