aboutsummaryrefslogtreecommitdiff
path: root/src/hyper/pages/exint.ht
blob: 63964bcff1935818a449b419bc05dc1139cdc9b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
% Copyright The Numerical Algorithms Group Limited 1991.
% Certain derivative-work portions Copyright (C) 1988 by Leslie Lamport.
% All rights reserved

% Title: Integration

\begin{page}{ExIntRationalFunction}{Integral of a Rational Function}
\beginscroll
The following fraction has a denominator which factors into
a quadratic and a quartic irreducible polynomial. The usual
partial fraction approach used by most other computer algebra
systems either fails or introduces expensive unneeded algebraic
numbers.
We use a factorization-free algorithm.
\spadpaste{integrate((x**2+2*x+1)/((x+1)**6+1),x)}
There are cases where algebraic numbers are absolutely necessary.
In that case the answer to the \spadfun{integrate} command will contain
symbols like \spad{\%\%F0} denoting the algebraic numbers used.
To find out what the definitions for these numbers is use the
\spadfun{definingPolynomial} operation on these numbers.
\spadpaste{integrate(1/(x**3+x+1),x) \bound{i}}
For example, if a symbol like \spad{\%\%F0} appears in the result of this last
integration, then \spad{definingPolynomial \%\%F0} will return the
polynomial that \spad{\%\%F0} is a root of. The next command isolates the
algebraic number from the expression and displays its defining polynomial.
\spadpaste{definingPolynomial(tower(\%).2::EXPR INT) \free{i}}

\endscroll
\autobuttons\end{page}

\begin{page}{ExIntRationalWithRealParameter}{Integral of a Rational Function with a Real Parameter}
\beginscroll
When real parameters are present, the form of the integral can depend on
the signs of some expressions. Rather than query the user or make
sign assumptions, \Language{} returns all possible answers.
\spadpaste{integrate(1/(x**2 + a),x)}
The integrate command generally assumes that all parameters are real.
\endscroll
\autobuttons\end{page}

\begin{page}{ExIntRationalWithComplexParameter}{Integral of a Rational Function with a Complex Parameter}
\beginscroll
If the parameter is complex instead of real, then the notion of
sign is undefined and there is a unique answer.
You can request
this answer by prepending the word `complex' to the command name:
\spadpaste{complexIntegrate(1/(x**2 + a),x)}
\endscroll
\autobuttons\end{page}

\begin{page}{ExIntTwoSimilarIntegrands}{Two Similar Integrands Producing Very Different Results}
\beginscroll
The following two examples illustrate the limitations of table based
approaches. The two integrands are very similar, but the answer to one
of them requires the addition of two new algebraic numbers.
This one is the easy one:
\spadpaste{integrate(x**3 / (a+b*x)**(1/3),x)}
The next one looks very similar
but the answer is much more complicated. Only an algorithmic approach
is guaranteed to find what new constants must be added in order to
find a solution:
\spadpaste{integrate(1 / (x**3 * (a+b*x)**(1/3)),x)}
\endscroll
\autobuttons\end{page}

\begin{page}{ExIntNoSolution}{An Integral Which Does Not Exist}
\beginscroll
Most computer algebra systems use heuristics or table-driven
approaches to integration. When these systems cannot determine
the answer to an integration problem, they reply "I don't know".
\Language{} uses a complete algorithm for integration.
It will conclusively prove that an integral
cannot be expressed in terms of elementary functions.
When \Language{} returns an integral sign, it has proved
that no answer exists as an elementary function.
\spadpaste{integrate(log(1 + sqrt(a*x + b)) / x,x)}
\endscroll
\autobuttons\end{page}

%% This example is broken
%\begin{page}{ExIntChangeOfVariables}{No Change of Variables is Required}
%\beginscroll
%Unlike computer algebra systems which rely on heuristics and
%table-lookup, the algorithmic integration facility
%of \Language{} never requires you to make a change of variables
%in order to integrate a function.
%\spadpaste{integrate(sec(x)**(4/5)*csc(x)**(6/5),x)}
%\endscroll
%\autobuttons\end{page}

\begin{page}{ExIntTrig}{A Trigonometric Function of a Quadratic}
\beginscroll
\Language{} can handle complicated mixed functions way beyond what you can
find in tables:
\spadpaste{integrate((sinh(1+sqrt(x+b))+2*sqrt(x+b))/(sqrt(x+b)*(x+cosh(1+sqrt(x+b)))),x)}
Whenever possible, \Language{} tries to express the answer using the functions
present in the integrand.
\endscroll
\autobuttons\end{page}

\begin{page}{ExIntAlgebraicRelation}{Integrating a Function with a Hidden Algebraic Relation}
\beginscroll
A strong structure checking algorithm in \Language{} finds hidden algebraic
relationships between functions.
\spadpaste{integrate(tan(atan(x)/3),x)}
The discovery of this algebraic relationship is necessary
for correctly integrating this function.
\downlink{Details.}{ExIntAlgebraicRelationExplain} \space{1}
\endscroll
\autobuttons\end{page}

\begin{page}{ExIntAlgebraicRelationExplain}{Details for integrating a function wiht a Hidden Algebraic Relation}
\beginscroll
Steps taken for integration of:
\centerline{{\em f := tan(atan(x)/3)}}
\beginitems
\item
1. Replace {\em f} by an equivalent algebraic function {\em g}
satisfying the algebraic relation:
\centerline{{\em g**3 - 3*x*g - 3*g + x = 0}}
\item
2. Integrate {\em g} using using this algebraic relation; this produces:
\centerline{{\em (24g**2 - 8)log(3g**2 - 1) + (81x**2 + 24)g**2 + 72xg - 27x**2 - 16}}
\centerline{{\em /   (54g**2 - 18)}}
\item
3. Rationalize the denominator, producing:
\centerline{{\em (8log(3g**2-1) - 3g**2 + 18xg + 15)/18}}
\item
4. Replace {\em g} by the initial {\em f} to produce the final result:
\centerline{{\em (8log(3tan(atan(x/3))**2-1) - 3tan(atan(x/3))**2 - 18xtan(atan(x/3) + 16)/18)}}
\enditems
\endscroll
\autobuttons\end{page}

\begin{page}{ExIntRadicalOfTranscendental}{An Integral Involving a Root of a Transcendental Function}
\beginscroll
This is an example of a mixed function where
the algebraic layer is over the transcendental one.
\spadpaste{integrate((x + 1) / (x * (x + log x)**(3/2)),x)}
\endscroll
\autobuttons\end{page}

\begin{page}{ExIntNonElementary}{An Integral of a Non-elementary Function}
\beginscroll
While incomplete for non-elementary functions, \Language{} can
handle some of them:
\spadpaste{integrate(exp(-x**2) * erf(x) / (erf(x)**3 - erf(x)**2 - erf(x) + 1),x)}
\endscroll
\autobuttons\end{page}