home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-29 | 47.7 KB | 1,264 lines |
-
- (****************************************************************************
- *
- * Victor Adamchik
- * Package for Evaluation Integrals
- *
- *
- *****************************************************************************)
-
-
- IntegrateG[f_,{x_,xmin_,xmax_}] :=
- Block[ {r,inter,z,positivearg=positivetrigarg={},trigintegral=False,
- $IntegrateAssumptions=sumintegrals=True,dummy=var},
- r = PowerExpand[f,{x}]//.{E^(d_.+Complex[c_,a_] b_.) :>
- E^(c b+d) Cos[a b]+I E^(c b+d) Sin[a b]}//.
- {(n_ z_)^k_ :> n^k z^k/; NumberQ[N[n]]};
- inter = (Numerator[r]/Factor[Denominator[r]])/.InputHard;
- If[ FreeQ[inter, MeijerG[__]],
- inter = Dispatcher[1,r,x,xmin,xmax],
- inter = Dispatcher[1,inter,x,xmin,xmax];
- If[ !FreeQ[inter,FailInt], inter = Dispatcher[1,r,x,xmin,xmax] ]
- ];
- If[ !FreeQ[inter,FailInt],
- If[ PolynomialQ[Numerator[r],x] && PolynomialQ[Denominator[r],x],
- inter = Dispatcher[1,Apart[r,x],x,xmin,xmax]
- ];
- If[ !FreeQ[inter,FailInt] && xmin=!=0 && FreeQ[xmin,DirectedInfinity],
- inter = Dispatcher[1,f/.x->z+xmin,z,0,
- If[ !FreeQ[xmax,DirectedInfinity],xmax,xmax-xmin] ]
- ]
- ];
- inter = TransfAnswer[inter/.SimpGfunction];
- $IntegrateAssumptions=$IntegrateAssumptions//SimpLogic;
- If[ trigintegral,
- If@@{$IntegrateAssumptions, inter, ComplexInfinity},
- inter
- ]/; SimpLogic[$IntegrateAssumptions]=!=False && And@@(FreeQ[inter,#]&/@{
- Indeterminate,FailInt,MeijerG,KellyIntegrate,FailIntDiv})
- ] /; FreeQ[{xmin, xmax}, Complex] &&
- And@@(FreeQ[Hold[{f,xmin,xmax}],#]&/@{Blank,Integrate,IntegrateG}) &&
- Convergent[f,{x,xmin,xmax}]
-
- Attributes[ IntegrateG ] = { HoldFirst, ReadProtected }
-
- (* ======================================================================== *)
-
- Dispatcher[done_,c_,x_,xmin_,xmax_] := FailInt/;Not[FreeQ[{done,c},FailInt]]
-
- Dispatcher[done_,0,x_,xmin_,xmax_] := 0
-
- Dispatcher[1,c_,x_,xmin_,xmax_] := c (xmax-xmin)/;FreeQ[c,x]
-
- Dispatcher[done_,c_,x_,xmin_,xmax_] :=
- c Dispatcher[done,1,x,xmin,xmax]/;FreeQ[c,x] && c=!=1
-
- Dispatcher[done_,c_ f_,x_,xmin_,xmax_] :=
- c Dispatcher[done,f,x,xmin,xmax]/;FreeQ[c,x]
-
- Dispatcher[done_,f_,x_,xmin_,xmax_] :=
- -If[ xmax<0,
- Module[ {z},
- Dispatcher[done/.x->-z,PowerExpand[f/.x->-z,{z}],z,-xmin,-xmax] ],
- Dispatcher[done,f,x,xmax,xmin]
- ]/;
- NumberQ[xmin] && NumberQ[xmax] && xmin > xmax
-
- Dispatcher[done_,f_,x_,-Infinity,Infinity] :=
- Module[ {z,answer},
- If[ Expand[f/.x->-z] === Expand[f/.x->z],
- 2 Dispatcher[done,f,x,0,Infinity],
- answer =
- Dispatcher[done,ExpandDenominator[Together[
- (f/.x->z) + PowerExpand[(f/.x->-z), {z}] ]],z,0,Infinity];
- If[ FreeQ[answer,FailInt],
- answer,
- Dispatcher[done,f,x,0,Infinity] +
- Dispatcher[done,PowerExpand[(f/.x->-z)/.z->x,{x}],x,0,Infinity]
- ]
- ]
- ]
-
- Dispatcher[done_,f_,x_,-Infinity,xmax_/; xmax=!=Infinity] :=
- Module[ {z},
- Dispatcher[done/.x->-z,PowerExpand[f/.x->-z,{z}],z,-xmax,Infinity]
- ]
-
- Dispatcher[done_,f_,x_,0,xmax_] :=
- Dispatcher[done,Together[f/.HBfun],x,0,xmax]/;
- Not[FreeQ[f,Csch[_]]] || Not[FreeQ[f,Sech[_]]]
-
- Dispatcher[done_,f_,x_,0,xmax_] :=
- Dispatcher[done,Factor[Expand[f/.HBfun]],x,0,xmax] /;
- Not[FreeQ[f,Sinh[_]]] || Not[FreeQ[f,Cosh[_]]]
-
- Dispatcher[done_,f_/;Not[FreeQ[f,E]],x_,0,xmax_/; xmax=!=Infinity] :=
- AnalysExp1[done,f,x,0,xmax]
-
- Dispatcher[done_,f_,x_,xmin_,xmax_] :=
- Module[ {inter},
- inter = f/.ExpandIntoTrig/.{
- Sin[z_. Complex[a_,b_]] :>
- Sin[z a] Cos[z b I] + Cos[z a] Sin[z b I]};
- Dispatcher[done,Expand[inter], x,xmin,xmax] /; inter =!= f
- ] /;
- (!FreeQ[f,Sin[_]] || !FreeQ[f,Cos[_]]) && !FreeQ[f,Complex]
-
- Dispatcher[1,f1_[w1_]^n_. f2_[w2_]^m_.,x_,0,xmax_/;xmax=!=Infinity] :=
- AnalysTrig[1,f1[w1]^n,f2[w2]^m,x,xmax]/;
- Complement[{f1,f2},{Sin,Cos,Sec,Csc,Tan,Cot}]==={}
-
- Dispatcher[1,x_ f_[w_]^n_.,x_,0,xmax_/;xmax=!=Infinity] :=
- AnalysTrig1[1,f[w]^n,x,x,xmax]/;
- Complement[{f},{Sin,Cos,Sec,Csc,Tan,Cot}]==={}
-
- Dispatcher[1,f_[w_]^n_.,x_,0,xmax_/;xmax=!=Infinity] :=
- AnalysTrig1[1,f[w]^n,1,x,xmax]/;
- Complement[{f},{Sin,Cos,Sec,Csc,Tan,Cot}]==={}
-
- Dispatcher[done_,f_/;!FreeQ[f,Log[_]],x_,xmin_,xmax_] :=
- AnalysLog[done,f,x,xmin,xmax]
-
- Dispatcher[1,(b_+a_ x_^dg_.)^n_Integer?Positive f_.,
- x_,0,xmax_/;xmax=!=Infinity]:=
- KellyIntegrate[f (b+a x^dg)^n,{x,0,xmax}]
-
- Dispatcher[done_,(b_ + a_ x_^dg_.)^n_ f_.,x_,0,xmax_/;xmax=!=Infinity] :=
- AnalysAlg[done,b,1,a x^dg,n,f,x,{0,xmax}] /;
- FreeQ[b,x] && FreeQ[a,x] && Znak[a] && Expand[b+a xmax^dg]=!=0
-
- Dispatcher[done_,(f1_ + f2_)^n_ f_.,x_,xmin_,xmax_] :=
- AnalysAlg[done,f1,1,Expand[f2],n,f,x,{xmin,xmax}] /;
- FreeQ[f1,x] && Not[FreeQ[f2,x]]
-
- Dispatcher[done_,(f1_ + f2_)^n_ f_.,x_,xmin_,xmax_] :=
- AnalysAlg[done,1,1,Simplify[f2/f1],n,f f1^n,x,{xmin,xmax}] /;
- Not[FreeQ[f1,x]] && Not[FreeQ[f2,x]]
-
- Dispatcher[1,f_,x_,a_/;a=!=0&&a=!=-Infinity,b_/;b=!=0&&b=!=Infinity] :=
- Block[ {z, HyperInteg},
- positiveList[a]; positiveList[b];
- Dispatcher[1,MeijerG[{},{1},{0},{},{1,z/b}] (f/.x->z) -
- If[ NumberQ[a] && Im[a]==0 && a<0,
- -MeijerG[{},{1},{0},{},{1,-z/a}] (f/.x->-z),
- MeijerG[{},{1},{0},{},{1,z/a}] (f/.x->z)
- ],
- z,0,Infinity]
- ]
-
- Dispatcher[1,f_/;Head[Expand[f]]==Plus,x_,xmin_,xmax_] :=
- Block[ {IntFF,inter},
- sumintegrals=False;
- inter = Dispatcher[1,#,x,xmin,xmax]&/@Expand[f];
- IntFF[1,Together[inter/.IntFF[a_,b_,c_] :> a b],x]
- ]
-
- Dispatcher[done_,f_,x_,xmin_/;xmin=!=0 && xmin=!=-Infinity,Infinity] :=
- If[ done=!=1,
- Dispatcher[done,f,x,0,Infinity],
- If[ !NumberQ[N[xmin]] || Positive[xmin],
- $IntegrateAssumptions = $IntegrateAssumptions && Positive[xmin];
- Dispatcher[MeijerG[{1},{},{},{0},{1,x/xmin}],f,x,0,Infinity],
- Module[ { z },
- Dispatcher[1,(f/.x->-z)/.z->x,x,0,-xmin] +
- Dispatcher[1,f,x,0,Infinity] ]
- ]
- ]
-
- Dispatcher[done_,f_,x_,0,xmax_/;xmax=!=Infinity] :=
- If[ done=!=1,
- Dispatcher[done,f,x,0,Infinity],
- If[ !NumberQ[N[xmax]] || Positive[xmax],
- $IntegrateAssumptions = $IntegrateAssumptions && Positive[xmax];
- Dispatcher[MeijerG[{},{1},{0},{},{1,x/xmax}],f,x,0,Infinity],
- Module[ { z }, -Dispatcher[1,(f/.x->-z)/.z->x,x,0,-xmax] ]
- ]
- ]
-
- Dispatcher[done_, a_^(b_. x_^dg_.) f_.,x_,0,Infinity] :=
- Dispatcher[done Release[
- InputElem[Hold[E^(-(-b) x^dg Log[a])],x]], f,x,0,Infinity]/;
- Not[SameQ[a,E]] && FreeQ[a,x] && FreeQ[b,x] && FreeQ[dg,x]
-
- Dispatcher[done_,f_/;!FreeQ[f,Exp[_]],x_,0,Infinity] :=
- AnalysExp2[done,f,x,0,Infinity]
-
- Dispatcher[done_,MeijerG[par__] f_/;FreeQ[f,MeijerG[__]],x_,0,Infinity] :=
- Dispatcher[done MeijerG[par],f,x,0,Infinity]/; !MatchQ[f,x^_.]
-
- Dispatcher[done_,f_,x_,0,Infinity] := IntFF[ done,f,x]
-
- Dispatcher[done_,f_,x_,xmin_,xmax_] := f FailInt
-
- (*****************************************************************************
- * Search Logarithmic Expression
- *
- *****************************************************************************)
-
- AnalysLog[1,Log[w_. x_^dg_.]^n_. f_.,x_,0,Infinity] :=
- (-1)^n AnalysLog[1,Log[w^(-1) x^(-dg)]^n f,x,0,Infinity]/;
- IntegerQ[n] && n>0 && IntegerQ[dg] && dg<0
-
- AnalysLog[1,Log[w_. x_^dg_.]^n_. f_.,x_,0,Infinity] :=
- Module[ {z,var,answer},
- answer = Dispatcher[1,PowerExpand[(f/.x->w^(-1/dg) z^(1/dg))*
- z^(1/dg-1+var),{z}],z,0,Infinity];
- If[ Not[FreeQ[answer,FailInt]], FailInt,
- If[Not[NumberQ[dg]] , 1, Sign[dg]] dg^(-1) w^(-1/dg) n!*
- Coefficient[Expand[Normal[Series[answer,
- {var,0,n}] ]],var,n]]
- ]/;IntegerQ[n] && n>0
-
- AnalysLog[done_,Log[w_. x_^dg_.]^n_. f_.,x_,xmin_/;xmin=!=0,Infinity] :=
- If[ SameQ[w xmin^dg,1] && FreeQ[{dg,w},x] && !Znak[w],
- Dispatcher[ done*
- If[ Not[NumberQ[dg]] || dg > 0, Log[w x^dg]^n/.LogRule1,
- (-1)^n Log[w^(-1) x^(-dg)]^n/.LogRule1 ],f,x,xmin,Infinity],
- FailInt ] /;IntegerQ[n] && n>0
-
- AnalysLog[done_,Log[w_. x_^dg_.]^n_. f_.,x_,0,xmax_/;xmax=!=Infinity] :=
- If[ SameQ[w xmax^dg,1] && FreeQ[{dg,w},x] && !Znak[w],
- Dispatcher[ done *
- If[ Not[NumberQ[dg]] || dg > 0 ,Log[w x^dg]^n/.LogRule2,
- (-1)^n Log[w^(-1) x^(-dg)]^n/.LogRule2 ],f,x,0,xmax],
- FailInt ] /;IntegerQ[n] && n>0
-
- AnalysLog[done_,Log[w_. x_^dg_.]^n_. f_.,x_,xmin_/;xmin=!=0,Infinity] :=
- Module[ {z},
- If[ SameQ[w xmin^dg,1] && FreeQ[w,x] && Not[Znak[w]],
- If[ done===1 && (Not[NumberQ[dg]] || dg > 0),
- Dispatcher[ done,z^n*
- PowerExpand[E^(z/dg) f//.x->(1/w)^(1/dg) E^(z/dg), {z,E}],
- z,0,Infinity] (1/w)^(1/dg)/dg,
- (-1)^(-n) AnalysLog[done,Log[w^(-1) x^(-dg)]^n f,x,xmin,Infinity] ],
- FailInt ] ]
-
- AnalysLog[done_,Log[w_. x_^dg_.]^n_. f_.,x_,0,xmax_/;xmax=!=Infinity] :=
- Module[ {z},
- If[ SameQ[w xmax^dg,1] && FreeQ[w,x] && Not[Znak[w]],
- If[ done===1 && (Not[NumberQ[dg]] || dg < 0),
- -Dispatcher[ done,z^n *
- PowerExpand[E^(z/dg) f//.x->(1/w)^(1/dg) E^(z/dg), {z,E}],
- z,0,Infinity] (1/w)^(1/dg)/dg,
- (-1)^(-n) AnalysLog[done,Log[w^(-1) x^(-dg)]^n f,x,0,xmax] ],
- FailInt ] ]
-
- AnalysLog[1,Log[g_[a_. x_]]^n_. f_.,x_,0,xmax_] :=
- Module[ {z},
- Which[
- g===Tan && xmax=== Pi/(4 a),
- Dispatcher[1,Log[z]^n (1+z^2)^(-1) (f//.x->ArcTan[z]/a)//.LogTrig,
- z,0,1]/a,
- g===Tan && xmax=== Pi/(2 a),
- Dispatcher[1,Log[z]^n (1+z^2)^(-1) (f//.x->ArcTan[z]/a)//.LogTrig,
- z,0,Infinity]/a,
- g===Sin && xmax=== Pi/(2 a),
- Dispatcher[1,Log[z]^n (1-z^2)^(-1/2)*
- (f/.x->ArcSin[z]/a)//.LogTrig,z,0,1]/a,
- g===Csc && xmax=== Pi/(2 a),
- Dispatcher[1,Log[1/z]^n (1-z^2)^(-1/2) (f//.x->ArcSin[z]/a)//.LogTrig,
- z,0,1]/a,
- g===Cos && xmax=== Pi/(2 a),
- Dispatcher[1,Log[z]^n (1-z^2)^(-1/2) (f//.x->ArcCos[z]/a)//.LogTrig,
- z,0,1]/a,
- g===Sec && xmax=== Pi/(2 a),
- Dispatcher[1,Log[1/z]^n (1-z^2)^(-1/2) (f//.x->ArcCos[z]/a)//.LogTrig,
- z,0,1]/a,
- g===Sin && xmax=== Pi/a,
- Dispatcher[1,Log[z]^n (1-z^2)^(-1/2) (f//.x->ArcSin[z]/a)//.LogTrig,
- z,0,1]/a +
- AnalysLog[1,Log[Cos[a z]]^n (f//.x->z+Pi/(2 a))/.ExpandIntoTrig,
- z,0,Pi/(2 a)],
- True, FailInt
- ]]/; FreeQ[a,x] && Complement[{g},{Sin,Cos,Sec,Csc,Tan}]==={}
-
- AnalysLog[1,h_[a_. Log[x_]]^n_. f_.,x_,0,1] :=
- Module[ {z},
- If[ h===Sin,-1,1] *
- Dispatcher[1,h[a z] PowerExpand[E^(-z) f/.x->E^(-z),{z,E}],z,0,Infinity]
- ]/;FreeQ[a,x] && Complement[{h},{Sin,Cos}]==={}
-
- AnalysLog[1,Log[a_+b_] f_.,x_,0,xmax_] :=
- Module[ {inter},
- inter = Log[a]//.{
- Log[q_ w_] :> Log[q] + Log[w]/;!FreeQ[q w, x],
- Log[q_^n_] :> n Log[q]/;!FreeQ[q w, x]};
- If[ Head[inter]===Plus,
- Map[ Dispatcher[1,f #,x,0,xmax]&,inter ],
- Dispatcher[1,inter f,x,0,xmax]
- ] +
- AnalysLog[1,Log[1+Expand[b/a]] f,x,0,xmax]
- ]/;
- Not[FreeQ[b,x]] && Not[FreeQ[a,x]] && Not[Znak[a]] && Not[Znak[b]]
-
- AnalysLog[done_,Log[1 + a_ x_^p_.]^n_. f_.,x_,0,xmax_] :=
- Module[ {z},
- If[ Not[Znak[p]],
- p^(-1) Dispatcher[(done//.x->z^(1/p)),InputElem[Log[1+a z]^n,z] *
- PowerExpand[(f//.x->z^(1/p)) z^(1/p-1),{z}],z,0, xmax^p ],
- (-p)^(-1) Dispatcher[(done//.x->z^(-1/p)),InputElem[Log[1+a/z]^n,z]*
- PowerExpand[(f//.x->z^(-1/p)) z^(-1/p-1),{z}],z,0,xmax^(-p)] ]
- ]/;xmax=!=Infinity && FreeQ[{a,p},x] &&
- Expand[1+a xmax^p]===0 && IntegerQ[n]
-
- AnalysLog[done_,Log[1 + a_. x_^p_.]^n_. f_.,x_,0,xmax_] :=
- Module[ {z},
- If[ Not[Znak[p]],
- p^(-1) Dispatcher[done//.x->z^(1/p),InputElem[Log[1+a z]^n,z] *
- PowerExpand[(f//.x->z^(1/p)) z^(1/p-1),{z}],z,0,
- If[xmax===Infinity,Infinity,xmax^p] ],
- (-p)^(-1) Dispatcher[done//.x->z^(-1/p), InputElem[Log[1+a/z]^n,z] *
- PowerExpand[(f//.x->z^(-1/p)) z^(-1/p-1),{z}],z,0,
- If[xmax===Infinity,Infinity,xmax^(-p)]] ]
- ]/;FreeQ[{a,p},x] && IntegerQ[n]
-
- AnalysLog[done_,Log[1 + a_. x_^p_.]^n_. f_.,x_,xmin_,Infinity] :=
- Module[ {z},
- If[ Not[Znak[p]],
- p^(-1) Dispatcher[done//.x->z^(1/p),InputElem[Log[1+a z]^n,z] *
- PowerExpand[(f//.x->z^(1/p)) z^(1/p-1),{z}],z,xmin^p,Infinity],
- (-p)^(-1) Dispatcher[done//.x->z^(-1/p),InputElem[Log[1+a/z]^n,z] *
- PowerExpand[(f//.x->z^(-1/p)) z^(-1/p-1),{z}],z,xmin^(-p),Infinity] ]
- ]/;FreeQ[a,x] && FreeQ[p,x] && IntegerQ[n]
-
- AnalysLog[1,Log[1 + a_. E^(b_. x_)]^n_. f_.,x_,0,Infinity] :=
- Module[ {z},
- If[ Not[Znak[b]],
- b^(-1) Dispatcher[1,Log[1+a z]^n (f//.x->1/b Log[z])/z,z,1,Infinity],
- -b^(-1) Dispatcher[1,Log[1+a z]^n (f//.x->1/b Log[z])/z,z,0,1] ]
- ]/; FreeQ[b,x] && FreeQ[a,x]
-
- AnalysLog[1,Log[1+b_. f_[a_. x_]^m_.]^n_. g_[w_]^m_.,x_,0,xmax_] :=
- Module[ {int},
- int = Integrate[g[w]^m,x];
- (int Log[1+b f[a x]^m]^n/.{x->xmax}) -
- (int Log[1+b f[a x]^m]^n/.{x->0}) +
- b m Map[ Dispatcher[1,#/(1+b f[a x]^m),x,0,xmax]&,
- Expand[int f[a x]^(m-1) D[f[a x],x], Trig->True] ]
- ]/; FreeQ[a,x] && xmax=== Pi/(2 a) && IntegerQ[n] &&
- Complement[{f,g},{Sin,Cos}]==={}
-
- AnalysLog[1,Log[1+b_. Sin[a_. x_]^m_.]^n_. f_.,x_,0,xmax_] :=
- Module[ {z},
- Dispatcher[1,Log[1+b z^m]^n (1-z^2)^(-1/2) (f//.x->ArcSin[z]/a)//.LogTrig,
- z,0,1]/a
- ]/; FreeQ[a,x] && xmax=== Pi/(2 a) && IntegerQ[n]
-
- AnalysLog[1,Log[1+b_. Cos[a_. x_]^m_.]^n_. f_.,x_,0,xmax_] :=
- Module[ {z},
- Dispatcher[1,Log[1+b z^m]^n (1-z^2)^(-1/2) (f//.x->ArcCos[z]/a)//.LogTrig,
- z,0,1]/a
- ]/; FreeQ[a,x] && xmax=== Pi/(2 a) && IntegerQ[n]
-
- AnalysLog[1,Log[1+b_. Tan[a_. x_]^m_.]^n_. f_.,x_,0,xmax_] :=
- Module[ {z},
- Dispatcher[1,Log[1+b z^m]^n (1+z^2)^(-1) (f//.x->ArcTan[z]/a)//.LogTrig,
- z,0,Infinity]/a
- ]/; FreeQ[a,x] && xmax=== Pi/(2 a) && IntegerQ[n]
-
- AnalysLog[1,Log[1+b_. Cot[a_. x_]^m_.]^n_. f_.,x_,0,xmax_] :=
- Module[ {z},
- Dispatcher[1,Log[1+b z^(-m)]^n (1+z^2)^(-1) *
- (f//.x->ArcTan[z]/a)//.LogTrig,z,0,Infinity]/a
- ]/; FreeQ[a,x] && xmax=== Pi/(2 a) && IntegerQ[n]
-
- AnalysLog[1,Log[1+b_. Sin[a_. x_]^m_.]^n_. f_.,x_,0,xmax_] :=
- Block[ {zn,HyperInteg},Factor[Expand[
- AnalysLog[1,Log[1+b Sin[a zn]^m]^n (f//.x->zn),zn,0,Pi/(2 a)]/a +
- AnalysLog[1,Log[1+b Cos[a zn]^m]^n (f//.x->zn+Pi/(2 a))/.ExpandIntoTrig,
- zn,0,Pi/(2 a)]]]
- ]/; FreeQ[a,x] && xmax=== Pi/a && IntegerQ[n]
-
- AnalysLog[1,Log[1+b_. Cos[a_. x_]^m_.]^n_. f_.,x_,0,xmax_] :=
- Block[ {zn,HyperInteg},Factor[Expand[
- AnalysLog[1,Log[1+b Cos[a zn]^m]^n (f//.x->zn),zn,0,Pi/(2 a)]/a +
- AnalysLog[1,Log[1-b Sin[a zn]^m]^n (f//.x->zn+Pi/(2 a))/.
- ExpandIntoTrig,zn,0,Pi/(2 a)]]]
- ]/; FreeQ[a,x] && xmax=== Pi/a && IntegerQ[n]
-
- AnalysLog[1,Log[1+b_. Sin[a_. x_]^m_.]^n_. f_.,x_,0,xmax_] :=
- Block[ {z,HyperInteg},Expand[
- AnalysLog[1,Log[1+b Sin[a z]^m]^n (f//.x->z+Pi/a)/.ExpandIntoTrig,
- z,0,Pi/a] +
- AnalysLog[1,Log[1+(-1)^m b Sin[a z]^m]^n (f//.x->z+Pi/a)/.
- ExpandIntoTrig,z,0,Pi/a]]
- ]/; FreeQ[a,x] && xmax=== 2 Pi/a && IntegerQ[n]
-
- AnalysLog[1,Log[1+b_. Cos[a_. x_]^m_.]^n_. f_.,x_,0,xmax_] :=
- Block[ {z,HyperInteg},Expand[
- AnalysLog[1,Log[1+b Cos[a z]^m]^n (f//.x->z+Pi/a)/.ExpandIntoTrig,
- z,0,Pi/a] +
- AnalysLog[1,Log[1+(-1)^m b Cos[a z]^m]^n (f//.x->z+Pi/a)/.
- ExpandIntoTrig,z,0,Pi/a]]
- ]/; FreeQ[a,x] && xmax=== 2 Pi/a && IntegerQ[n]
-
- AnalysLog[done_,Log[Abs[1+a_ x_^n_.]] f_.,x_,0,Infinity] :=
- Dispatcher[done,InputElem[Log[Abs[1+a x^n]],x] f,x,0,Infinity]
-
- AnalysLog[done_,Log[(1+ x_)/(1-x_)] f_.,x_,0,xmax_] :=
- Module[ {inter},
- inter = InputElem[Log[(1+x)/(1-x)],x];
- If[ FreeQ[inter,MeijerG], FailInt,
- Dispatcher[done,inter f,x,0,xmax]]
- ]
-
- AnalysLog[done_,Log[(1+x_)/(x_-1)] f_.,x_,1,xmax_] :=
- Module[ {inter},
- inter = InputElem[Log[(1+x)/(x-1)],x];
- If[ FreeQ[inter,MeijerG], FailInt,
- Dispatcher[done,inter f,x,1,xmax]]
- ]
-
- AnalysLog[1,Log[a_Plus] f_.,x_,0,xmax_] :=
- Module[ {add},
- add = ComPlus[a,x];
- If[ add===0 || add===1, FailInt,
- Log[add] Dispatcher[1,f,x,0,xmax] +
- AnalysLog[1,Log[1+Expand[(a-add)/add]] f,x,0,xmax]
- ]]
-
- AnalysLog[1,Log[Abs[a_Plus]] f_.,x_,0,xmax_] :=
- Module[ {add},
- add = ComPlus[a,x];
- If[ add===0 || add===1, FailInt,
- Log[Abs[add]] Dispatcher[1,f,x,0,xmax] +
- AnalysLog[1,Log[Abs[1+Expand[(a-add)/add]]] f,x,0,xmax]
- ]]
-
- AnalysLog[ __ ] := Module[ {w}, w FailInt ]
-
- (**************************************************************************
- * Search Algebraic Expression
- *
- ***************************************************************************)
-
- AnalysAlg[done_,s_,m_,s1_+s2_,n_,f_,x_,lim_] :=
- AnalysAlg[done,s+s1,m,s2,n,f,x,lim]/;
- FreeQ[s1,x]
-
- AnalysAlg[done_,s_,m_,m1_ m2_,n_,f_,x_,lim_] :=
- AnalysAlg[done,s,m m1,m2,n,f,x,lim]/;
- FreeQ[m1,x]
-
- AnalysAlg[done_,p_,m_,x_^dg_.,n_,f_,x_,{xmin_,xmax_}] :=
- (-1)^n AnalysAlg[done,-xmin,-m,x^dg,n,f,x,{xmin,xmax}]/;
- Expand[p-xmin]===0 && Znak[p m]
-
- AnalysAlg[done_,p_,m_,x_^dg_.,n_,f_,x_,{xmin_,xmax_}] :=
- (-1)^n AnalysAlg[done,-p,-m,x^dg,n,f,x,{xmin,xmax}]/;
- Expand[p+xmax]===0 && Znak[p m]
-
- AnalysAlg[done_,s_,m_,x_^dg_/; !NumberQ[N[dg]],n_,f_,x_,{xmin_,xmax_}] :=
- Module[ {z},
- $IntegrateAssumptions=$IntegrateAssumptions&&Im[dg]==0;
- dg^(-1) SearchRule[done/.x->z^(1/dg)/.z->x,s,m,1,n,PowerExpand[Simplify[
- (f/.x->z^(1/dg)/.z->x) x^(1/dg-1)],{x}],
- x,{If[xmin===-Infinity,-Infinity,
- If[xmin===0,0,xmin^dg]],
- If[xmax===Infinity, Infinity,
- If[xmax===0,0,xmax^dg]]}]
- ]/;sumintegrals
-
- AnalysAlg[done_,s_,m_,x_^dg_.,n_,f_,x_,lim_] :=
- SearchRule[done,s,m,dg,n,f,x,lim]
-
- AnalysAlg[1,s_,m_,Exp[a_. x_^dg_?Negative+const_.],n_,f_,x_,{0,Infinity}] :=
- Module[ {var},
- AnalysAlg[1,s,m,Exp[a var^(-dg)+const/.x->1/var]/.var->x,n,
- (f/.x->1/var/.var->x) x^(-2),x,{0,Infinity}] ]/;
- FreeQ[a,x]
-
- AnalysAlg[1,s_,m_,Exp[a_. x_^dg_.+ const_/;FreeQ[const,x]],
- n_,f_,x_,interv_] :=
- E^(const n) AnalysAlg[1,s E^(-const),m,E^(a x^dg),n,f,x,interv]
-
- AnalysAlg[1,s_,m_,Exp[a_ x_^dg_.],n_?Negative,x_^k_. f_.,x_,{0,Infinity}] :=
- Block[{z,var,var1,var2,HyperInteg},
- var1 = s/m;
- $IntegrateAssumptions = $IntegrateAssumptions && Positive[-a];
- If[ Znak[var1],var=-var2;var1=-s/m,var=var2];
- m^n (-1/a)^(1/dg) dg^(-1) Dispatcher[1,Gamma[-n]^(-1)*
- MeijerG[ {n+1},{},{0},{},{1,var x^dg} ]*
- Log[x]^(1/dg-1) *
- PowerExpand[x^k f/.x->(-1/a)^(1/dg) Log[z]^(1/dg)/.z->x,{x}]/
- x^(n+1),x,1,Infinity]/.{var2->var1}
- ]/;
- FreeQ[a,x] && Znak[a] && Positive[N[dg]]
-
- AnalysAlg[1,s_,m_,Exp[a_. x_^dg_.],n_?Negative,x_^k_. f_.,x_,{0,Infinity}] :=
- Block[{z,var,var1,var2,HyperInteg},
- var1 = m/s;
- $IntegrateAssumptions = $IntegrateAssumptions && Positive[a];
- If[ Znak[var1],var=-var2;var1=-m/s,var=var2];
- s^n (1/a)^(1/dg)/dg Dispatcher[1,Gamma[-n]^(-1)*
- MeijerG[ {n+1},{},{0},{},{1,var x^dg} ]*
- Log[x]^(1/dg-1) x^(-1) *
- Expand[x^k f/.x->(1/a)^(1/dg) Log[z]^(1/dg)/.z->x]/.{E^(r1_+r2_) :>
- (E^r1) (E^r2)},x,1,Infinity]/.{var2->var1}
- ]/;
- FreeQ[a,x] && Not[Znak[a]] && Positive[dg]
-
- AnalysAlg[1,s_,m_,Exp[a_. x_^dg_.],n_?Negative,f_,x_,{0,Infinity}] :=
- Block[{z,var,var1,var2,HyperInteg},
- var1 = m/s;
- If[ Znak[var1],var=-var2;var1=-m/s,var=var2];
- s^n (1/a)^(1/dg)/dg Dispatcher[1,Gamma[-n]^(-1)*
- MeijerG[ {n+1},{},{0},{},{1,var x^dg} ]*
- Log[x]^(1/dg-1) x^(-1) *
- Expand[f//.x->(1/a)^(1/dg) Log[z]^(1/dg)/.z->x]/.{E^(r1_+r2_) :>
- (E^r1) (E^r2)},x,1,Infinity]/.{var2->var1}
- ]/;
- Not[Znak[s/m]] && FreeQ[a,x] && Not[Znak[a]] && Positive[dg]
-
- AnalysAlg[done_,s_,m_,trigf_[a_. x_]^dg_.,n_,f_,x_,lim_] :=
- AnalysAlgTrig[done,s,m,trigf[a x]^dg,n,f,x,lim]/;
- FreeQ[a,x] && Complement[{trigf},{Sin,Cos,Tan,Cot}]==={}
-
- AnalysAlg[ __ ] := Module[ {w}, w FailInt ]
-
- SearchRule[done_,num1_?Negative s_,num2_?Negative m_,dg_,n_,f_,x_,lim_] :=
- E^(I Pi n) SearchRule[done,Abs[num1] s,Abs[num2] m,dg,n,f,x,lim]
-
- SearchRule[done_,num_?Negative s_,m_,dg_,n_,f_,x_,{xmin_,xmax_}] :=
- SearchRuleGen2[done,num,s,m,dg,n,f,x,{xmin,xmax}]
-
- SearchRule[done_,Complex[0,num_?Negative],m_,dg_,n_,f_,x_,{xmin_,xmax_}] :=
- SearchRuleGen2[done,num I,1,m,dg,n,f,x,{xmin,xmax}]
-
- SearchRule[done_,num_?Negative,m_,dg_,n_,f_,x_,{xmin_,xmax_}] :=
- SearchRuleGen2[done,num,1,m,dg,n,f,x,{xmin,xmax}]
-
- SearchRuleGen2[done_,num_,s_,m_,dg_,n_,f_,x_,{xmin_,xmax_}] :=
- If[ N[n]<-1,FailInt,
- (s num)^n Pi Dispatcher[ done,
- MeijerG[ {0},{1/2},{0},{1/2},{1,-m x^dg/(s num)} ] f,
- x,xmin,xmax ]]/;xmax=!=Infinity &&xmin<N[(-s num/m)^(1/dg)]<xmax&&
- (And@@(NumberQ[#]&/@N[{s,num,m,dg,xmin,xmax}]))&&N[n]<=-1
-
- SearchRuleGen2[done_,num_,s_,m_,dg_,n_,x_^k_. f_.,x_,{xmin_,xmax_}] :=
- Module[ {z,lim1,lim2,function},
- lim1 = xmin; lim2 = xmax;
- function =
- If[ n === -1 && (xmin==0&&xmax===Infinity||done=!=1||!FreeQ[f,Power]
- || !FreeQ[f,Log] || !FreeQ[f,ArcCos] || !FreeQ[f,ArcSin]),
- Pi MeijerG[ {0},{1/2},{0},{1/2},{1,m x^dg/(-num s)}]/(num s),
- If[ !n === -1,
- If[ xmax===Infinity && xmin =!=-Infinity &&
- Expand[m xmin^dg+num s] === 0 ||
- xmax===Infinity && xmin===0 && done=!=1, lim1 = 0;
- (-num s)^n *
- If[NumberQ[n] && Im[n]==0 && n<-1,FailInt,Gamma[Expand[n+1]]]*
- MeijerG[ {n+1},{},{},{0},{1,m x^dg/(-num s)} ] ,
- If[ EvenQ[dg] &&xmin ===-Infinity&&Expand[m xmax^dg+num s]===0 &&
- Expand[x^k f//.x->-z] === Expand[x^k f//.x->z],
- lim1 = 0; lim2 = Infinity;
- (-num s)^n *
- If[NumberQ[n] && Im[n]==0 && n<-1,FailInt,Gamma[Expand[n+1]]]*
- MeijerG[ {n+1},{},{},{0},{1,m x^dg/(-num s)} ],
- FailInt ]],
- FailInt ]];
- Dispatcher[ done function,x^k f,x,lim1,lim2 ]
- ]
-
- SearchRuleGen2[done_,num_,s_,m_,dg_,n_,f_,x_,{xmin_,xmax_}] :=
- Module[ {z,lim1,lim2,function},
- lim1 = xmin; lim2 = xmax;
- function =
- If[ n === -1 && (xmin==0&&xmax===Infinity||done=!=1||!FreeQ[f,Power]
- || !FreeQ[f,Log] || !FreeQ[f,ArcCos] || !FreeQ[f,ArcSin]),
- Pi MeijerG[ {0},{1/2},{0},{1/2},{1,m x^dg/(-num s)}]/(num s),
- If[ !n === -1,
- If[ xmax===Infinity && xmin =!=-Infinity &&
- Expand[m xmin^dg+num s] === 0 ||
- xmax===Infinity && xmin===0 && done=!=1, lim1 = 0;
- (-num s)^n*
- If[NumberQ[n] && Im[n]==0 && n<-1,FailInt,Gamma[Expand[n+1]]]*
- MeijerG[ {n+1},{},{},{0},{1,m x^dg/(-num s)} ] ,
- If[ EvenQ[dg] &&xmin ===-Infinity&&Expand[m xmax^dg+num s]===0 &&
- Expand[f//.x->-z] === Expand[f//.x->z],
- lim1 = 0; lim2 = Infinity;
- (-num s)^n*
- If[NumberQ[n] && Im[n]==0 && n<-1,FailInt,Gamma[Expand[n+1]]]*
- MeijerG[ {n+1},{},{},{0},{1,m x^dg/(-num s)} ],
- FailInt ]],
- FailInt ]];
- Dispatcher[ done function,f,x,lim1,lim2 ]
- ]
-
- SearchRule[done_,s_,num_ m_,dg_,n_,f_,x_,{xmin_,xmax_}] :=
- SearchRuleGen1[done,s,num,m,dg,n,f,x,{xmin,xmax}]/;
- NumberQ[num] && Im[num]==0 && num<0
-
- SearchRule[done_,s_,num_,dg_,n_,f_,x_,{xmin_,xmax_}] :=
- SearchRuleGen1[done,s,num,1,dg,n,f,x,{xmin,xmax}]/;
- NumberQ[num] && Im[num]==0 && num<0
-
- SearchRuleGen1[done_,s_,num_,m_,dg_,n_/;N[n]<=-1,f_,x_,{xmin_,xmax_}] :=
- If[ N[n]<-1,FailInt,
- s^n Pi Dispatcher[ done,
- MeijerG[ {0},{1/2},{0},{1/2},{1,-m num x^dg/s} ] f,x,
- xmin,xmax]]/;xmax=!=Infinity&&xmin<N[(-s/(num m))^(1/dg)]<xmax&&
- (And@@(NumberQ[#]&/@N[{s,num,m,dg,n,xmin,xmax}]))
-
- SearchRuleGen1[done_,s_,num_,m_,dg_,n_,x_^k_. f_.,x_,{xmin_,xmax_}] :=
- Block[ {z,lim1,lim2,function, Dispatcher},
- lim1 = xmin; lim2 = xmax;
- If[ xmax=!=Infinity && Expand[m num xmax^dg+s] =!= 0 &&
- Expand[m num xmin^dg+s] =!= 0,
- positiveList[exp[Pi I]]; positiveList[m num/s];
- Return[
- s^n Gamma[-n]^(-1)*
- Dispatcher[ done,
- MeijerG[ {n+1},{},{0},{},{1,-m num x^dg/s exp[Pi I]} ] x^k f,
- x,lim1,lim2 ] ],
- function =
- If[ n === -1 && (xmin===0&&xmax===Infinity||done=!=1||
- Or@@(Not[FreeQ[f,#]]&/@{Power[_,_],Log[_],ArcCos[_],
- ArcSin[_],PolyLog[_,_]})),
- s^n Pi MeijerG[ {0},{1/2},{0},{1/2},{1,-m num x^dg/s} ],
- If[ !n === -1,
- If[ xmax=!=Infinity && Expand[m num xmax^dg+s] === 0 &&
- Expand[m num xmin^dg+s] =!= 0 && xmin=!=0,
- Dispatcher[done,(s+num*m*x^dg)^n f x^k,x,0,xmax] -
- Dispatcher[done,(s+num*m*x^dg)^n f x^k,x,0,xmin],
- If[ xmax=!=Infinity && Expand[m num xmax^dg+s] === 0 &&
- Expand[m num xmin^dg+s] =!= 0 ||
- xmax===Infinity && done=!=1, lim2 = Infinity;
- s^n *
- If[NumberQ[n] && Im[n]==0 && n<-1,FailInt,Gamma[Expand[n+1]]]*
- MeijerG[ {},{n+1},{0},{},{1,-num m x^dg/s} ],
- If[ Expand[m num xmin^dg+s] === 0 && xmax === 0 && EvenQ[dg] &&
- Expand[x^k f//.x->-z] === (x^k f//.x->z),
- lim1 = 0; lim2 = -xmin;
- s^n *
- If[NumberQ[n] && Im[n]==0 && n<-1,FailInt,Gamma[Expand[n+1]]]*
- MeijerG[ {},{n+1},{0},{},{1,-num m x^dg/s} ],
- If[ Expand[m num xmin^dg+s] === 0 && Expand[m num xmax^dg+s] === 0 &&
- EvenQ[dg] && Expand[x^k f//.x->-z] === (x^k f//.x->z),
- lim1 = 0; lim2 = Infinity;
- 2 s^n *
- If[NumberQ[n] && Im[n]==0 && n<-1,FailInt,Gamma[Expand[n+1]]]*
- MeijerG[ {},{n+1},{0},{},{1,-num m x^dg/s} ],
- FailInt ]]]],
- FailInt ]]];
- If[ FreeQ[function, Dispatcher],
- Dispatcher[ done function,x^k f,x,lim1,lim2 ],
- function]
- ]
-
- SearchRuleGen1[done_,s_,num_,m_,dg_,n_,f_,x_,{xmin_,xmax_}] :=
- Block[ {z, lim1, lim2, function, Dispatcher},
- lim1 = xmin; lim2 = xmax;
- If[ xmax=!=Infinity && Expand[m num xmax^dg+s] =!= 0 &&
- Expand[m num xmin^dg+s] =!= 0,
- positiveList[exp[Pi I]]; positiveList[m num/s];
- Return[
- s^n Gamma[-n]^(-1)*
- Dispatcher[ done,
- MeijerG[ {n+1},{},{0},{},{1,-m num x^dg/s exp[Pi I]} ] f,
- x,lim1,lim2 ] ]
- ,
- function =
- If[ n === -1 && (xmin===0&&xmax===Infinity||done=!=1||
- Or@@(Not[FreeQ[f,#]]&/@{Power[_,_],Log[_],ArcCos[_],
- ArcSin[_],PolyLog[_,_]})),
- s^n Pi MeijerG[ {0},{1/2},{0},{1/2},{1,-m num x^dg/s} ],
- If[ !n === -1,
- If[ xmax=!=Infinity && Expand[m num xmax^dg+s] === 0 &&
- Expand[m num xmin^dg+s] =!= 0 && xmin=!=0 &&
- !CondForIntegrate[f, {x,xmin,z}],
- Dispatcher[done,(s+num*m*x^dg)^n f,x,0,xmax] -
- Dispatcher[done,(s+num*m*x^dg)^n f,x,0,xmin],
- If[ xmax=!=Infinity && Expand[m num xmax^dg+s] =!= 0 &&
- Expand[m num xmin^dg+s] =!= 0 && xmin===0,
- s^n Dispatcher[done,
- If[NumberQ[n] && Im[n]==0 && n<-1,FailInt,Gamma[Expand[n+1]]]*
- MeijerG[ {},{n+1},{0},{},{1,-num m x^dg/s} ] f,x,0,xmax],
- If[ xmax=!=Infinity && Expand[m num xmax^dg+s] === 0 &&
- Expand[m num xmin^dg+s] =!= 0 ||xmax===Infinity && done=!=1,
- lim2 = Infinity;
- s^n *
- If[NumberQ[n] && Im[n]==0 && n<-1,FailInt,Gamma[Expand[n+1]]]*
- MeijerG[ {},{n+1},{0},{},{1,-num m x^dg/s} ],
- If[ Expand[m num xmin^dg+s] === 0 && xmax === 0 && EvenQ[dg] &&
- Expand[f//.x->-z] === (f//.x->z),
- lim1 = 0; lim2 = -xmin;
- s^n *
- If[NumberQ[n] && Im[n]==0 && n<-1,FailInt,Gamma[Expand[n+1]]]*
- MeijerG[ {},{n+1},{0},{},{1,-num m x^dg/s} ],
- If[ Expand[m num xmin^dg+s] === 0 && Expand[m num xmax^dg+s] === 0 &&
- xmin*xmax =!= 0 ,
- If[ Expand[(f//.x->-z) + (f//.x->z)]===0,0,
- If[ Expand[f//.x->-z] === (f//.x->z),
- lim1 = 0; lim2 = Infinity;
- 2 s^n *
- If[ NumberQ[n] && Im[n]==0 && n<-1,
- FailInt,
- Gamma[Expand[n+1]]
- ] *
- MeijerG[ {},{n+1},{0},{},{1,-num m x^dg/s} ]
- ,
- Dispatcher[done,(s+num*m*x^dg)^n f,x,0,xmax] +
- Dispatcher[done,(s+num*m*z^dg*(-1)^dg)^n (f/.x->-z),z,0,-xmin]
- ]
- ]
- ,
- FailInt
- ]]]]],
- FailInt ]]];
- If[ function===0,0,
- If[ FreeQ[function, Dispatcher],
- Dispatcher[ done function,f,x,lim1,lim2 ],
- function]
- ]
- ]
-
- SearchRule[done_,s_,m_,dg_,n_Integer?Positive,f_,x_,{0,xmax_}] :=
- s^n Dispatcher[done (1+x^dg)^n,f,x,0,xmax]
-
- SearchRule[done_,s_,m_,dg_,n_,f_,x_,{xmin_,xmax_}] :=
- Module[ {lim1,lim2,function,z},
- lim1 = xmin; lim2 = xmax;
- function =
- If[ xmin === -Infinity && xmax === Infinity &&EvenQ[dg] &&
- Expand[f//.x->-z] === (f//.x->z),
- lim1 = 0; lim2 = Infinity;
- positiveList[m]; positiveList[s];
- 2 s^n*
- If[NumberQ[n] && Im[n]==0 && n>0,FailInt,Gamma[Expand[-n]]^(-1) ]*
- MeijerG[ {n+1},{},{0},{},{1,m x^dg/s} ],
- positiveList[m]; positiveList[s];
- s^n *
- If[NumberQ[n] && Im[n]==0 && n>0,FailInt,Gamma[Expand[-n]]^(-1) ]*
- MeijerG[ {n+1},{},{0},{},{1,m x^dg/s} ]
- ];
- Dispatcher[ done,function f,x,lim1,lim2 ]
- ]
-
- (****************************************************************************
- * Trigonometric Functions into Algebraic Functions
- *
- *****************************************************************************)
-
- AnalysAlgTrig[1,s_,m_,h_[a_. x_]^dg_.,n_,f_,x_,{0,xmax_}] :=
- Module[{z,r},
- r = Expand[((f/.x->InverseFunction[h][z]/a)/.TrigMultArg//.LogTrig)*
- (1-z^2)^(-1/2)]/.z->x;
- a^(-1)*
- If[Head[r]===Plus,
- Map[Dispatcher[1, (s+m x^dg)^n #,x,0,1]&,r],
- Dispatcher[1, (s+m x^dg)^n r,x,0,1]]
- ]/; xmax=== Pi/(2 a) && (h==Sin || h==Cos)
-
- AnalysAlgTrig[1,s_,m_,h_[a_. x_]^dg_.,n_,f_,x_,{0,xmax_}] :=
- Module[{z},
- a^(-1) Dispatcher[1,(1+z^2)^(-1) (s+m z^dg)^n *
- Expand[f/.x->InverseFunction[h][z]/a]//.LogTrig,z,0,Infinity]
- ]/; xmax=== Pi/(2 a) && (h==Tan || h==Cot)
-
- AnalysAlgTrig[done_,s_,m_,trigf_[a_. x_]^dg_.,n_,f_,x_,{0,xmax_}] :=
- Block[ {z,answer,HyperInteg},
- answer = AnalysAlg[done/.x->z,s,m,trigf[a z]^dg,n,f/.x->z,z,{0,Pi/(2 a)}];
- If[ FreeQ[answer,FailInt],
- Expand[answer +
- AnalysAlg[done,s,m,trigf[a z+Pi/2]^dg,n,
- (f/.x->z+Pi/(2 a))/.ExpandIntoTrig,
- z,{0,Pi/(2 a)}]]
- ,
- FailInt]
- ]/; xmax=== Pi/a
-
- AnalysAlgTrig[done_,s_,m_,trigf_[a_. x_]^dg_.,n_,f_,x_,{0,xmax_}] :=
- Block[ {z,answer,HyperInteg},
- answer = AnalysAlg[done//.x->z,s,m,trigf[a z]^dg,n,f//.x->z,z,{0,Pi/a}];
- If[ FreeQ[answer,FailInt], Expand[answer +
- AnalysAlg[done,s,m,trigf[a z+Pi]^dg,n,
- (f//.x->z+Pi/a)/.ExpandIntoTrig,z,{0,Pi/a}]],
- FailInt]
- ]/; xmax=== 2 Pi/a
-
- AnalysAlgTrig[ __ ] := Module[ {var}, var FailInt]
-
- (*****************************************************************************
- * Search Trigonometric Functions
- *
- *****************************************************************************)
-
- AnalysTrig[done_,f1_,f2_Plus,x_,xmax_] :=
- Map[AnalysTrig[done,f1,#,x,xmax]&,f2]
-
- AnalysTrig[done_,f1_,const_ f2_,x_,xmax_] :=
- const AnalysTrig[done,f1,f2,x,xmax]/;FreeQ[const,x]
-
- AnalysTrig[done_,const_ f1_,f2_,x_,xmax_] :=
- const AnalysTrig[done,f1,f2,x,xmax]/;FreeQ[const,x]
-
- AnalysTrig[done_,f1_[a_. x_]^n1_.,f2_[b_. x_]^n2_.,x_,xmax_] :=
- If[ a xmax=!=Pi/2 ,AnalysTrig[done,f2[b x]^n2,f1[a x]^n1,x,xmax],
- a^(-1) Dispatcher[done 2,((f1[ArcCos[x]]^n1 f2[b/a ArcCos[x]]^n2*
- (1-x^2)^(-1/2))//.LogTrig)//.InputInvTrig,x,0,1]/2]/;
- a xmax===Pi/2 || b xmax===Pi/2
-
- AnalysTrig[done_,Sin[x_]^n_.,f2_[b_. x_],x_,Pi] :=
- 2^(n+1) Dispatcher[done,x^n (1-x^2)^(n/2-1/2) *
- f2[2 b ArcCos[x]]/.InputInvTrig,x,0,1]
-
- AnalysTrig[done_,f1_[x_]^n_.,f2_[b_. x_],x_,Pi] :=
- Block[ {answer,HyperInteg},
- answer = AnalysTrig[done,f1[x]^n,f2[b x],x,Pi/2];
- If[ FreeQ[answer,FailInt], Expand[answer +
- AnalysTrig[done,PowerExpand[f1[x + Pi/2]^n,{x}],
- f2[b x+b Pi/2],x,Pi/2]],
- FailInt] ]
-
- AnalysTrig[done_,f1_[a_. x_]^n_,f2_[b_. x_]^m_.,x_,xmax_] :=
- a^(-1) AnalysTrig[done,f1[x]^n,f2[b x/a],x,Pi]/;
- a xmax===Pi && m==1
-
- AnalysTrig[done_,f1_[a_. x_]^n_.,f2_[b_. x_]^m_,x_,xmax_] :=
- b^(-1) AnalysTrig[done,f2[x]^m,f1[a x/b],x,Pi]/;
- b xmax===Pi && n==1
-
- AnalysTrig[ __ ] := Module[ {var}, var FailInt]
-
- AnalysTrig1[1,f_[a_. x_]^n_.,1,x_,xmax_] :=
- Module[ {answer},
- answer = Integrate[f[a x]^n,x];
- (answer/.x->xmax) - (answer/.x->0)
- ]/;Complement[{f},{Sin,Cos}]==={} && IntegerQ[n]
-
- AnalysTrig1[done_,f_[a_. x_]^n_.,w_,x_,xmax_] :=
- a^(-1) Dispatcher[done,(f[ArcCos[x]]^n If[w===1,1,ArcCos[x]/a] *
- (1-x^2)^(-1/2)//.LogTrig)//.InputInvTrig,x,0,1]/;
- a xmax===Pi/2
-
- AnalysTrig1[done_,Sin[a_. x_]^n_.,w_,x_,xmax_] :=
- a^(-1) If[w===1,2,Pi/a] AnalysTrig1[done,Sin[x]^n,1,x,Pi/2]/;
- a xmax===Pi
-
- AnalysTrig1[done_,const_ Sin[a_. x_]^n_.,w_,x_,xmax_] :=
- a^(-1) If[w===1,2,Pi/a] Dispatcher[done,(1-x^2)^(n/2-1/2)*
- If[w===1,1,ArcCos[x]],x,0,1] const/;
- a xmax===Pi && FreeQ[const,x]
-
- AnalysTrig1[ __ ] := Module[ {var}, var FailInt]
-
-
- (*****************************************************************************
- * Search Exp Functions
- *
- *****************************************************************************)
-
- AnalysExp1[done_,f_,x_,0,xmax_] :=
- AnalysExp11[done, f/.{
- E^z_ :> Module[ {inter},
- inter = Together[Expand[z]];
- E^(Collect[Numerator[inter],x]/
- Collect[Denominator[inter],x])
- ] /;!FreeQ[z,x] && PolynomialQ[z,x]
- },x,0,xmax]
-
- AnalysExp11[done_,E^(a_. x_^dg_. + c_.) f_.,x_,0,xmax_] :=
- If[ done===1 && f===1 && Negative[dg], FailInt,
- E^c Dispatcher[done,If[ Znak[a],InputElem[E^(a x^dg),x],
- E^(a x^dg)/.InputExp ] f,x,0,xmax]
- ]/;
- FreeQ[a,x] && FreeQ[c,x]
-
- AnalysExp11[done_,E^(a_. x_^dg1_. + b_. x_^dg2_. + c_.) f_.,x_,0,xmax_] :=
- E^c Dispatcher[done,(E^(a x^dg1)/.InputExp) (E^(b x^dg2)/.InputExp) f,
- x,0,xmax]/;FreeQ[a,x] && FreeQ[b,x] && FreeQ[c,x]
-
- AnalysExp11[ __ ] := Module[ {var}, var FailInt]
-
- AnalysExp2[done_,E^c_. f_.,x_,0,Infinity] :=
- E^c AnalysExp21[done, f/.{
- E^z_ :> E^Collect[z,x]/;!FreeQ[z,x] && PolynomialQ[z,x]},
- x,0,Infinity]/;FreeQ[c,x]
-
- AnalysExp2[done_,f_,x_,0,Infinity] :=
- AnalysExp21[done, Expand[f]/.{
- E^z_ :> E^Collect[z,x]/;!FreeQ[z,x] && PolynomialQ[z,x]},x,0,Infinity]
-
- AnalysExp21[done_,f_,x_,0,Infinity] :=
- IntFF[done,
- f/.{
- d_ - d_. E^(a_. x^dg_.+c_.) :>
- (
- positiveList[-a];
- $IntegrateAssumptions=$IntegrateAssumptions && Positive[-a];
- d InputElem[1- E^(a x^dg),x] E^c
- )/;FreeQ[d,E] && FreeQ[a,x] && FreeQ[c,x],
- d_. E^(a_. x^dg_.+c_.) - d_ :>
- (
- positiveList[-a];
- $IntegrateAssumptions=$IntegrateAssumptions && Positive[-a];
- -d InputElem[1- E^(a x^dg),x] E^c
- )/;FreeQ[d,E] && FreeQ[a,x] && FreeQ[c,x],
- E^(a_. x^dg_.+c_.) :> FailInt/;
- NumberQ[a] && Im[a]==0 &&a>0 && FreeQ[c,x],
- E^(a_. x^dg_.+c_.) :>
- (
- positiveList[-a];
- $IntegrateAssumptions=$IntegrateAssumptions && Positive[-a];
- InputElem[ E^(a x^dg),x] E^c
- )/;FreeQ[a,x] && FreeQ[c,x],
- E^(a_. Abs[x]^dg_.+c_.) :>
- (
- positiveList[-a];
- $IntegrateAssumptions=$IntegrateAssumptions && Positive[-a];
- InputElem[ E^(a x^dg),x] E^c
- )/;FreeQ[a,x] && FreeQ[c,x],
- E^(a_. x^dg1_. + b_. x^dg2_.+c_.) :>
- If[ NumberQ[N[dg1]] && NumberQ[N[dg2]],
- positiveList[-a]; positiveList[-b];
- If[ N[dg1-dg2] > 0,
- $IntegrateAssumptions=$IntegrateAssumptions && Positive[-a],
- $IntegrateAssumptions=$IntegrateAssumptions &&Positive[-b]];
- InputElem[E^(If[Znak[a],a,positiveList[exp[I Pi]];-a exp[Pi I]]*
- x^dg1),x] *
- InputElem[E^(If[Znak[b],b,positiveList[exp[I Pi]];-b exp[Pi I]]*
- x^dg2),x] E^c
- ]/;FreeQ[a,x] && FreeQ[b,x] && FreeQ[c,x]
- },x]
-
- AnalysExp21[ done_,f_,x_,xmin_,xmax_ ] := f FailInt
-
- (*****************************************************************************
- * Search Other Functions
- *
- *****************************************************************************)
-
- IntFF[w__] := Module[ {var}, var FailInt ]/;!FreeQ[{w}, FailInt]
-
- IntFF[done_,MeijerG[par__] f_.,x_] := IntFF[done MeijerG[par],f,x]
-
- IntFF[done_,x_^dg_.,x_] := IntGG[dg+1,done,x] /; FreeQ[dg,x]
-
- IntFF[done_,const_ f_,x_] := const IntFF[done,f,x]/;FreeQ[const,x]
-
- IntFF[done_,const_,x_] := const IntGG[1,done,x]/;FreeQ[const,x]
-
- IntFF[done_,x_^deg_. f_,x_] :=
- FindIntegrand[ deg+1,done,f,x ] /;FreeQ[deg,x]
-
- IntFF[done_,f_,x_] := FindIntegrand[ 1,done,f,x ]
-
- FindIntegrand[alfa_,1,pol1_. f_[w_]^n_.+pol2_.,x_] :=
- Module[ {answer},
- answer = SingleGfunction[
- alfa,CollectSC[Expand[Expand[
- pol1 f[w]^n+pol2,Trig->True]/.ColTerm]],
- pol1 f[w]^n+pol2,x];
- answer/;FreeQ[answer,FailInt]
- ] /;
- Complement[{f},{Sin,Cos}]==={} && PolynomialQ[pol1,x] &&
- PolynomialQ[pol2,x]
-
- FindIntegrand[alfa_,1,f1_[w1_]^n_. f2_[w2_]^m_.+pol_.,x_] :=
- Module[ {answer},
- answer = SingleGfunction[
- alfa,CollectSC[Expand[Expand[
- f1[w1]^n f2[w2]^m+pol,Trig->True]/.ColTerm]],
- f1[w1]^n f2[w2]^m+pol,x];
- answer/;FreeQ[answer,FailInt]
- ] /;
- Complement[{f1,f2},{Sin,Cos}]==={} && PolynomialQ[pol,x]
-
- FindIntegrand[alfa_,1,pol1_. f1_[w1_]^n_.+pol2_. f2_[w2_]^m_.+pol3_.,x_] :=
- Module[ {answer},
- answer = SingleGfunction[
- alfa,CollectSC[Expand[Expand[ pol1 f1[w1]^n +
- pol2 f2[w2]^m+pol3,Trig->True]/.ColTerm]],
- pol1 f1[w1]^n + pol2 f2[w2]^m+pol3,x];
- answer/;FreeQ[answer,FailInt]
- ] /;
- Complement[{f1,f2},{Sin,Cos}]==={} &&
- (And@@(PolynomialQ[#,x]&/@{pol1,pol2,pol3}))
-
- FindIntegrand[alfa_,done_,f_,x_] :=
- GGfunctions[alfa,done,CollectSC[Expand[
- Expand[f,Trig->True]/.ColTerm]]//.{
- Sin[w_+v_] :>
- Sin[w] Cos[v] + Cos[w] Sin[v]/;Not[FreeQ[v,x]] && Not[FreeQ[w,x]],
- Cos[w_+v_] :>
- Cos[w] Cos[v] - Sin[w] Sin[v]/;Not[FreeQ[v,x]] && Not[FreeQ[w,x]],
- Sin[w_Plus] :>
- Module[ {add = ComPlus[w,x]},
- Sin[add] Cos[w-add] + Cos[add] Sin[w-add]
- ],
- Cos[w_Plus] :>
- Module[ {add = ComPlus[w,x]},
- Cos[add] Cos[w-add] - Sin[add] Sin[w-add]
- ]
- },x]/;
- Not[FreeQ[f,Sin[_]]] || Not[FreeQ[f,Cos[_]]]
-
- FindIntegrand[alfa_,done_,f_,x_] := GGfunctions[alfa,done,f,x]
-
- SingleGfunction[alfa_,f_,oldf_,x_] :=
- TaylorSeriesTrig[alfa,CondTrigDegree[f,x],f,oldf,x]/;
- CondTrig[f,x]
-
- SingleGfunction[alfa_,f_,oldf_,x_] := GGfunctions[alfa,1,oldf,x]
-
- TaylorSeriesTrig[ alfa_,{dg_?Negative,True},f_,oldf_,x_ ] :=
- Module[ {var},
- -1/dg *
- TaylorSeriesTrig[ alfa/dg,{1,True},f/.x->var^(1/dg),oldf,var]
- ]
-
- GGfunctions[ alfa_,done_,f_,x_ ] := f IntGG[alfa,done,x] /; FreeQ[f,x]
-
- GGfunctions[ alfa_,done_,f_,x_ ] :=
- IntGG[alfa,FindGfunction[done,f,x]//Expand,x]
-
- FindGfunction[done_,f_,x_] :=
- Which[
- Apply[Or,Not[FreeQ[f,#]]&/@ListBessel],
- FindGfunction[done,f/.InputBessel,x],
- Apply[Or,Not[FreeQ[f,#]]&/@ListOther],
- FindGfunction[done,f/.InputOther,x],
- Apply[Or,Not[FreeQ[f,#]]&/@ListHypergeometric],
- FindGfunction[done,f/.InputHypergeometric,x],
- Apply[Or,Not[FreeQ[f,#]]&/@ListElem],
- FindGfunction1[done,InputElem[f,x],x],
- True,f done
- ]/; !FreeQ[f,x]
-
- FindGfunction1[ done_,f_Plus,x_] := Map[FindGfunction1[done,#,x]&,f]
-
- FindGfunction1[done_,f_,x_] := done f
-
- (*************************************************************************
- * Convergent
- *
- **************************************************************************)
-
- Convergent[ b_. f_[a_.x_^r_. + c_.],{x_,xmin_,Infinity} ] :=
- If[ NumberQ[r] && Re[r]<=1, False, True ] /;
- (f===Sin || f===Cos) && FreeQ[{a,b,r,c},x]
-
- Convergent[ f_,{x_,xmin_/;xmin=!=0,Infinity} ] :=
- Module[
- {answer =
- Module[ {test},
- Off[General::indet,Infinity::indet,Power::infy,General::dbyz];
- test = {PowerExpand[x f//.{
- a_ + b_. x^n_. :> b x^n /; Re[n]>0 && FreeQ[{a,b},x],
- a_. x^n1_. + b_. x^n2_. :> b x^Max[n1,n2] /; Im[n1]==0 &&
- Im[n2]==0 && FreeQ[{a,b},x] }
- ]/.x->Infinity, f/.x->Infinity};
- On[General::indet,Infinity::indet,Power::infy,General::dbyz];
- test
- ]},
- If[ FreeQ[x f,x] ||
- answer[[1]] === DirectedInfinity[-1] ||
- answer[[1]] === DirectedInfinity[1] ||
- answer[[2]] === RealInterval[{-Infinity, Infinity}] ||
- (FreeQ[answer[[1]],x] && answer[[1]]=!=0 && answer[[2]]=!=0 &&
- And@@(FreeQ[answer,#]&/@{ComplexInfinity,Indeterminate,
- DirectedInfinity,RealInterval})),
- False,
- True
- ]
- ] /; FreeQ[xmin,DirectedInfinity]
-
- Convergent[ f_,{x_,0,xmax_/;FreeQ[xmax,DirectedInfinity]} ] :=
- Module[ {z},
- Convergent[Together[PowerExpand[f/.x->1/z]/z^2],{z,1/xmax,Infinity}]
- ]
-
- Convergent[ f_,{x_,0,Infinity} ] :=
- Convergent[f,{x,0,1}] && Convergent[f,{x,1,Infinity}]
-
- Convergent[ f_,{x_,-Infinity,xmax_} ] :=
- Convergent[f,{x,0,Infinity}] && If[xmax===0, True, Convergent[f,{x,0,xmax}]]
-
- Convergent[ f_,{x_,xmin_/;NumberQ[N[xmin]],xmax_/;NumberQ[N[xmax]]} ] :=
- Module[ { z },
- Convergent[ f/.x->xmin+z, {z,0,xmax-xmin}]
- ]
-
- Convergent[ f_,{x_,xmin_,xmax_} ] := True
-
- (***************************************************************************
- * Supplement
- *
- ***************************************************************************)
-
- LogarithmCase[ {___,v_,___,u_,___} ] := True /;
- IntegerQ[Expand[u-v]]
-
- LogarithmCase[ {___} ] := False
-
- Delta[k_,x_] :=
- Expand[Flatten[ Map[ Table[ (#+i)/Floor[k],{i,0,Floor[k]-1} ] &,x]]] /;
- NumberQ[k] && NonNegative[k] && (k-Floor[k])==0
-
- Delta[k_,x_] := {}
-
- ReducePar[{w1___,u_,w2___},{w3___,v_,w4___}] :=
- ReducePar[{w1,w2},{w3,w4}]/;u===v
-
- ReducePar[w1_,w2_] := {w1,w2}
-
- MultGamma[a_] :=
- Apply[ Times, Map[ Gamma, Expand[a] ] ]
-
- MultPochham[a_,k_] :=
- Apply[ Times, Map[ Pochhammer[ #,k] &, a] ]
-
- Znak[n_?Negative] := True
- Znak[n_?Negative a_] := True
- Znak[Complex[0,n_?Negative] a_.] := True
- Znak[_] := False
-
- CondTrig[f_,x_] := Apply[ And,Map[ TrigMon[#,x]&,Cases[f,z_]]]
-
- TrigMon[u_. Sin[c_. x_^n_.],x_] := True/;PolynomialQ[Expand[u],x]
-
- TrigMon[u_. Cos[c_. x_^n_.],x_] := True/;PolynomialQ[Expand[u],x]
-
- TrigMon[u_,x_] := True/;PolynomialQ[Expand[u],x]
-
- CollectSC[v_] :=
- Fold[ Collect[#1,#2[[2]]]&,
- v,
- Cases[Apply[Plus,
- Cases[v,Sin[_] | Cos[_],2]],a_ b_] ]
- ColTerm = {
- Sin[a_] :> Sin[Simplify[a]],
- Cos[a_] :> Cos[Simplify[a]]
- }
- CondTrigDegree[Sin[a_. x_^n_.],x_] := {n,True}/;FreeQ[a,x]
-
- CondTrigDegree[Cos[a_. x_^n_.],x_] := {n,True}/;FreeQ[a,x]
-
- CondTrigDegree[f_Plus,x_] := CondTrigDegree1[
- Cases[ Cases[f,Sin[_] | Cos[_],2],a_. x^_.,2 ],x]
-
- CondTrigDegree[f_,x_] := CondTrigDegree1[
- Cases[ Cases[f,Sin[_] | Cos[_]],a_. x^_.,2],x]
-
- CondTrigDegree1[{u_. x_^n_.},x_] := {n,True}/;FreeQ[u,x]
-
- CondTrigDegree1[{___,u_. x_^n_.,___,v_. x_^m_.,___},x_] :=
- {n,True} /; n===m && FreeQ[u,x] && FreeQ[v,x]
-
- ComMult[b_ f_,x_] := b ComMult[f,x]/;FreeQ[b,x]
-
- ComMult[f_,x_] := 1
-
- ComPlus[b_ + f_,x_] := b + ComPlus[f,x]/;FreeQ[b,x]
-
- ComPlus[f_,x_] := 0
-
- positiveList[ v_ n_/;NumberQ[n] ] :=
- ( positivearg = Join[ positivearg, {v n}, positiveList[v] ] )
-
- positiveList[ n_ ] := {} /; NumberQ[n]
-
- positiveList[ v_^n_/;NumberQ[n] ] :=
- ( positivearg = Join[ positivearg, {v^n,v^(-n)} ]);
-
- positiveList[v_] := (positivearg = Join[ positivearg,{v} ])
-
- SimpGfunction = {
- MeijerG[{0},{},{0},{0,1/2},{a_,z_}] :> Cos[2 Sqrt[z]]/Sqrt[Pi],
- MeijerG[{1/2},{},{1/2},{1/2,0},{a_,z_}] :>
- Sin[2 Sqrt[z]]/Sqrt[Pi]
- }
-
- TransfAnswer[v_. If[c_,t_,f_]] :=
- Apply[ If,{c, TransfAnswer[v t], TransfAnswer[v f] }]
-
- TransfAnswer[ v_ ] :=
- Block[ { Hypergeometric2F1, HypergeometricPFQ, answer },
- answer = Expand[v//.LogTrig];
- answer = PowerExpand[ answer, Union[positivearg] ]/.exp->Exp/.sum->Sum;
- If[ Not[FreeQ[v,PolyGamma]],
- answer = SimplifyPolyGamma[answer]//.SimpTrigSum];
- If[ Not[FreeQ[v,Gamma]],
- answer = SimplifyGamma[answer] ];
- If[ !FreeQ[answer,Log[_]],answer = SimpLogFun[answer] ];
- If[ Depth[answer]<8 && Length[answer]<8,
- Simplify[answer],
- answer]
- ]/;FreeQ[v,Which[_,__]]
-
- TransfAnswer[ v_ ] :=
- (PowerExpand[ v, Union[positivearg] ]/.exp->Exp/.sum->Sum)/.
- Which[w_,p__] :> Which@@Expand[{w,p}]
-
- PowerExpand2[ expr_, {} ]:= expr
- PowerExpand2[ expr_, {a_} ]:=
- expr//.{(w_ a^k_.)^m_ :> w^m Abs[a]^(k m) (Sign[a]^k)^m}//.
- {(a^k_)^m_ :> Abs[a]^(k m) (Sign[a]^k)^m}
- PowerExpand2[ expr_, {a_,r__} ]:=
- PowerExpand2[ PowerExpand2[ expr,{a}], {r}]
-
- SimpLogFun[ expr_Plus ] :=
- Module[ {exprN = Expand[expr//.
- {Log[n_?Positive w_] :> Log[n] + Log[w],
- Log[Rational[p_,k_]] :> Log[p]-Log[k],
- Log[(n_?Positive)^p_] :> p Log[n]/;NumberQ[p]} ],
- list,div,pos = {},i=0 },
- list = Union[Cases[exprN,w_. Log[n_Integer]/;FreeQ[w,Log]]/.
- w_. Log[n_] :> n];
- div = GCD@@list;
- If[ Length[list]>1 && div!=1,
- list = Complement[list,{div}];
- SimpLogFun[exprN//.BuildRule[
- Log[#]&/@list ,Log[div]+Log[#]&/@(list/div) ]]
- ,
- If[ Length[list]==1 || Length[list]==2,
- exprN,
- While[Length[pos]==0 && Length[list]>1,
- i = i+ 1;
- listN = {list[[1]],#}&/@Rest[list];
- list = Rest[list];
- pos = Position[ (GCD@@#)&/@listN,a_/; a != 1 ]
- ];
- If[ Length[pos]!=0,
- list = Take[listN,pos[[1]]][[1]];
- div = GCD@@list;
- SimpLogFun[exprN//.BuildRule[Log[#]&/@list ,
- Log[div]+Log[#]&/@(list/div) ]],
- expr
- ]
- ]
- ]
- ]
-
- SimpLogFun[ expr_ ] := expr
-
- BuildRule[{l_,lR___},{r_,rR___}] :=
- Join[{l :> r},BuildRule[{lR},{rR}]]
-
- BuildRule[{},{}] := {}
-
- SimpTrigSum = {
- a_. Tan[x_] + b_. Cot[x_] +c_.:> c + 2 a Csc[2 x]/;a===b,
- a_. Tanh[x_] + n_?Negative b_. Coth[x_] +c_.:> c-2 a Csch[2 x]/;
- a+b n===0&&Not[Znak[a]],
- n_?Negative a_. Tanh[x_] + b_. Coth[x_] +c_.:> c+2 a Csch[2 x]/;
- a n+b===0&&Not[Znak[b]]
- }
-
- SimpLogic[ And[w1___,Negative[k_],w2___,Positive[k_],w3___] ] := False
-
- SimpLogic[ expr_ ] :=
- And@@Union[ If[ Head[expr] === And,
- expr/.And->List,
- {expr} ]/.{
- Positive[ n_ a_] :> If[ Positive[n], Positive[a], Negative[a] ]/;
- NumberQ[n] && Im[n]==0,
- Negative[ n_ a_] :> If[ Positive[n], Negative[a], Positive[a] ]/;
- NumberQ[n] && Im[n]==0}]
-
- (* ======================================================================== *)
-
-
-
-