Up | Next | Prev | PrevTail | Tail |
Author: Neil Langmead
This package was written when the author was a placement student at ZIB Berlin.
This package is an implementation of a new algorithm proposed by D. J. Jeffrey and A. D. Rich [JR94] to remove "spurious" discontinuities from integrals. Their paper focuses on the Weierstraß substitution, \(u=\tan (x/2)\), currently used in conjunction with the Risch algorithm in most computer algebra systems to evaluate trigonometric integrals. Expressions obtained using this substitution sometimes contain discontinuities, which limit the domain over which the expression is correct. The algorithm presented finds a better expression, in the sense that it is continous on wider intervals whilst still being an anti derivative of the integrand.
Consider the following problem:
REDUCE computes an anti derivative to the given function using the Weierstraß substitution \(u=\tan (\frac {x}{2})\), and then the Risch algorithm is used, returning:
Jeffery and Richs’ algorithm returns the following to the given problem:
We define a Weierstraß substitution to be one that uses a function \(u=\Phi (x)\) appearing in the following table:
Choice | \(\Phi (x)\) | \(\sin (x)\) | \(\cos (x)\) | \(dx\) | \(b\) | \(p\) |
\((a)\) | \(\tan (x/2)\) | \(\frac {2u}{1+u^{2}}\) | \( \frac {1-u^{2}}{1+u^{2}}\) | \(\frac {2du}{1+u^{2}}\) | \(\pi \) | \(2\pi \) |
\((b)\) | \(\tan (\frac {x}{2}+\frac {\pi }{4})\) | \(\frac {u^{2}-1}{u^{2}+1}\) | \(\frac {2u}{u^{2}+1} \) | \(\frac {2du}{1+u^{2}}\) | \(\frac {\pi }{2}\) | \(2\pi \) |
\((c)\) | \(\cot (x/2)\) | \(\frac {2u}{1+u^{2}}\) | \(\frac {u^{2}-1}{1+u^{2}}\) | \(\frac {-2du}{1+u^{2}}\) | \(0\) | \(2\pi \) |
\((d)\) | \(\tan (x)\) | \(\frac {u}{\sqrt {1+u^{2}}}\) | \(\frac {1}{\sqrt {1+u^{2}}}\) | \(\frac {du}{1+u^{2}}\) | \(\frac {\pi }{2}\) | \(\pi \) |
There are of course, other trigonometric substitutions, used by REDUCE, such as \(\sin \) and \(\cos \), but since these are never singular, they cannot lead to problems with discontinuities.
Given an integrable function \(f(\sin x,\cos x)\) whose indefinite integral is required, select one of the substitutions listed in the table. The choice is based on the following heuristics: choice (a) is used for integrands not containing \(\sin x\), choice (b) for integrands not containing \(\cos x\); (c) is useful in cases when (a) gives an integral that cannot be evaluated by REDUCE, and (d) is good for conditions described in Gradshteyn and Ryzhik (1979, sect 2.50). The integral is then transformed using the entries in the table,; for example, with choice (c), we have:
The integral in \(u\) is now evaluated using the standard routines of the system, then \(u\) is substituted for. Call the result \(\hat {g}(x)\). Next we calculate
The name of the function used in REDUCE to implement these ideas is trigint, which has the following syntax:
trigint(\(\langle \)exp\(\rangle \), \(\langle \)var\(\rangle \))
where \(\langle \)exp\(\rangle \) is the expression to be integrated, and \(\langle \)var\(\rangle \) is the variable of integration.
If trigint is used to calculate the integrals of trigonometric functions for which no
substitution is necessary, then non standard results may occur. For example, if we
calculate trigint(cos(x), x)
, we obtain
Using our example in (1), we compute the corrected result, and show a few other examples as well:
REDUCE Development Version, 4-Nov-96 ... 1: trigint(3/(5-4*cos(x)),x); x - pi + x 2*(atan(3*tan(---)) + floor(-----------)*pi) 2 2*pi
2: trigint(3/(5+4*sin(x)),x); pi + 2*x 2*(atan(3*tan(----------)) 4 - pi + 2*x + floor(-------------)*pi) 4*pi 3: trigint(15/(cos(x)*(5-4*cos(x))),x); x - pi + x 8*atan(3*tan(---)) + 8*floor(-----------)*pi 2 2*pi x x - 3*log(tan(---) - 1) + 3*log(tan(---) + 1) 2 2
The corrected expressions can now be used to calculate some definite integrals, provided the region of integration lies between adjacent singularities. For example, using our earlier function, we can use the corrected primitive to calculate
x tan(---) 2 - pi + x 2*sqrt(3)*(atan(----------) + floor(-----------)*pi) sqrt(3) 2*pi ------------------------------------------------------ 3
And now, we can apply the Fundamental Theorem of Calculus to give
sub(x=4*pi,F)-sub(x=0,F); 4*sqrt(3)*pi ----------------- 3
and this is the correct value of the definite integral. Note that although the expression in (*) is continuous, the functions value at the points \(x=\pi ,3\pi \) etc. must be intepreted as a limit, and these values cannot substituted directly into the formula given in (*). Hence care should be taken to ensure that the definite integral is well defined, and that singularities are dealt with appropriately. For more details of this in REDUCE, please see the documentation for the cwi addition to the DEFINT package.
The package includes a facility to trace in some detail the inner workings of
the trigint
program. Messages are given at key points of the algorithm,
together with the results obtained. These messages are displayed whenever the
switch tracetrig
is on, which is done in REDUCE with the command on
tracetrig;
This switch is off by default. In particular, the messages inform the user
which substitution is being tried, and the result of that substitution. The error
message
***** system cannot integrate after subs
means that REDUCE has tried all four of the Weierstraß substitutions, and the system’s standard integrator is unable to integrate after the substitution has been completed.
This program was written whilst the author was a placement student at ZIB Berlin.
Up | Next | Prev | PrevTail | Front |