/usr/share/axiom-20170501/src/algebra/FSINT.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | )abbrev package FSINT FunctionSpaceIntegration
++ Author: Manuel Bronstein
++ Date Created: 4 February 1988
++ Date Last Updated: 11 June 1993
++ Description:
++ Top-level real function integration
++ \spadtype{FunctionSpaceIntegration} provides functions for the
++ indefinite integration of real-valued functions.
FunctionSpaceIntegration(R, F) : SIG == CODE where
R : Join(EuclideanDomain, OrderedSet, CharacteristicZero,
RetractableTo Integer, LinearlyExplicitRingOver Integer)
F : Join(TranscendentalFunctionCategory, PrimitiveFunctionCategory,
AlgebraicallyClosedFunctionSpace R)
B ==> Boolean
G ==> Complex R
K ==> Kernel F
P ==> SparseMultivariatePolynomial(R, K)
SE ==> Symbol
IR ==> IntegrationResult F
FG ==> Expression G
ALGOP ==> "%alg"
TANTEMP ==> "%temptan"::SE
SIG ==> with
integrate : (F, SE) -> Union(F, List F)
++ integrate(f, x) returns the integral of \spad{f(x)dx}
++ where x is viewed as a real variable.
CODE ==> add
import IntegrationTools(R, F)
import ElementaryIntegration(R, F)
import ElementaryIntegration(G, FG)
import AlgebraicManipulations(R, F)
import TrigonometricManipulations(R, F)
import IntegrationResultToFunction(R, F)
import TranscendentalManipulations(R, F)
import IntegrationResultFunctions2(FG, F)
import FunctionSpaceComplexIntegration(R, F)
import ElementaryFunctionStructurePackage(R, F)
import InnerTrigonometricManipulations(R, F, FG)
import PolynomialCategoryQuotientFunctions(IndexedExponents K,
K, R, SparseMultivariatePolynomial(R, K), F)
K2KG : K -> Kernel FG
postSubst : (F, List F, List K, B, List K, SE) -> F
rinteg : (IR, F, SE, B, B) -> Union(F, List F)
mkPrimh : (F, SE, B, B) -> F
trans? : F -> B
goComplex?: (B, List K, List K) -> B
halfangle : F -> F
Khalf : K -> F
tan2temp : K -> K
optemp:BasicOperator := operator(TANTEMP, 1)
K2KG k == retract(tan F2FG first argument k)@Kernel(FG)
tan2temp k == kernel(optemp, argument k, height k)$K
trans? f ==
any?(x1+->is?(x1,"log"::SE) or is?(x1,"exp"::SE) or is?(x1,"atan"::SE),
operators f)$List(BasicOperator)
mkPrimh(f, x, h, comp) ==
f := real f
if comp then f := removeSinSq f
g := mkPrim(f, x)
h and trans? g => htrigs g
g
rinteg(i, f, x, h, comp) ==
not elem? i => integral(f, x)$F
empty? rest(l := [mkPrimh(f, x, h, comp) for f in expand i]) => first l
l
-- replace tan(a/2)**2 by (1-cos a)/(1+cos a) if tan(a/2) is in ltan
halfangle a ==
a := 2 * a
(1 - cos a) / (1 + cos a)
Khalf k ==
a := 2 * first argument k
sin(a) / (1 + cos a)
-- ltan = list of tangents in the integrand after real normalization
postSubst(f, lv, lk, comp, ltan, x) ==
for v in lv for k in lk repeat
if ((u := retractIfCan(v)@Union(K, "failed")) case K) then
if has?(operator(kk := u::K), ALGOP) then
f := univariate(f, kk, minPoly kk) (kk::F)
f := eval(f, [u::K], [k::F])
if not(comp or empty? ltan) then
ltemp := [tan2temp k for k in ltan]
f := eval(f, ltan, [k::F for k in ltemp])
f := eval(f, TANTEMP, 2, halfangle)
f := eval(f, ltemp, [Khalf k for k in ltemp])
removeConstantTerm(f, x)
-- can handle a single unnested tangent directly, otherwise go
-- complex for now
-- l is the list of all the kernels containing x
-- ltan is the list of all the tangents in l
goComplex?(rt, l, ltan) ==
empty? ltan => rt
not empty? rest rest l
integrate(f, x) ==
not real? f => complexIntegrate(f, x)
f := distribute(f, x::F)
tf := [k for k in tower f | member?(x,variables(k::F)@List(SE))]$List(K)
ltf := select(x1+->is?(operator x1, "tan"::SE), tf)
ht := any?(x1+->has?(operator x1, "htrig"), tf)
rec := rischNormalize(realElementary(f, x), x)
g := rootSimp(rec.func)
tg := [k for k in tower g | member?(x, variables(k::F))]$List(K)
ltg := select(x1+->is?(operator x1, "tan"::SE), tg)
rtg := any?(x1+->has?(operator x1, "rtrig"), tg)
el := any?(x1+->has?(operator x1, "elem"), tg)
i:IR
if (comp := goComplex?(rtg, tg, ltg)) then
i := map(FG2F, lfintegrate(trigs2explogs(F2FG g,
[K2KG k for k in tf | is?(k, "tan"::SE) or
is?(k, "cot"::SE)], [x]), x))
else i := lfintegrate(g, x)
ltg := setDifference(ltg, ltf) -- tan's added by normalization
(u := rinteg(i, f, x, el and ht, comp)) case F =>
postSubst(u::F, rec.vals, rec.kers, comp, ltg, x)
[postSubst(h, rec.vals, rec.kers, comp, ltg, x) for h in u::List(F)]
|