Symbolic Integration

Symbolic Integration

15-355: Modern Computer Algebra V. Adamchik Symbolic Integration Victor Adamchik Carnegie Mellon University The Rioboo algorithm Consider the following integral x2 +2x+4 dx x4 -7x 2 +2x+ 17 Since the denominator is square free SquareFreeQ17+2x-7x 2 +x 4, x True we proceed with Trager’s algorithm p =4+2x+x 2; q= 17+2x-7x 2 +x 4; Resultant[q, p-zD[q, x], x] // Factor 21691+4z 22 roots= Union[z/. Solve[%⩵ 0, z]]; args= PolynomialGCD[q, p-#D[q, x]]&/@ roots; res= Inner[#1 Log[#2] &, roots, args, Plus] 1 1 - ⅈ Log(-4-ⅈ)-ⅈx+x 2+ ⅈ Log(-4+ⅈ) +ⅈx+x 2 2 2 However, the integral can be computed without the complex numbers extension V. Adamchik 2 4+2x+x 2 Integrate , x 17+2x-7x 2 +x 4 1 -1-x 1 1+x ArcTan - ArcTan 2 -4+x 2 2 -4+x 2 ■ Idea 1 - Log to Arctan Given a field K of characteristic 0 such that -1∉K, and A,B∈K[x] with B ≠ 0, return a sum of arctangents defined by d A d i A+iB arctan = log d x B d x 2 A-iB We will be using =D to denote that computations are correct under differentiation (or up to a constant). Indeed, A i A+iB arctan =D log B 2 A-iB We use differentiation to eliminate the constant of integration A I A+IB A = 1.234; B= 0.432; ArcTan - Log B 2 A-IB 1.5708+ 0.ⅈ A I A+IB A = -1.234; B= 0.432; ArcTan - Log B 2 A-IB -1.5708+ 0.ⅈ The identity readily follows from the definition of the arctangent function i i i 1-ix arctan(x) = log(1-ix)- log(1+ix) =D log 2 2 2 1+ix Indeed, A B A i 1-i i B-iA i -A i -i B-A i A+iB arctan =D log B = log = log i = log =D log B 2 1+i A 2 B+iA 2 B +A 2 -i B+A 2 A-iB B i Using this idea we can rewrite the result of integration as follows 15-355: Modern Computer Algebra V. Adamchik i i i x2 +i(x+1)-4 x2 -4 logx2 +ix + (-4+i)- logx2 -ix + (-4-i)= D log =D arctan 2 2 2 x2 -i(x+1)-4 x+1 Therefore, x2 +2x+4 x2 -4 dx= arctan +C x4 -7x 2 +2x+ 17 x+1 x2 -4 DArcTan , x// Simplify x+1 4+2x+x 2 17+2x-7x 2 +x 4 which matches Mathematica’s result up to the constant of integration 4+2x+x 2 Integrate , x// Simplify 17+2x-7x 2 +x 4 1+x ArcTan 4-x 2 Note, 1 DArcTan[x] + ArcTan , x// Together x 0 It follows, that both results are correct under differentiation x2 +2x+4 x2 -4 x+1 dx= arctan +C 1 = arctan +C 2 x4 -7x 2 +2x+ 17 x+1 4-x 2 ■ Definite Integration The proposed simplification causes computational problems for a definite integration, since an arctan- gent of a rational function contains hidden singularities V. Adamchik 4 x+1 PlotArcTan ,{x, 1, 3} 4-x 2 1.5 1.0 0.5 1.5 2.0 2.5 3.0 -0.5 -1.0 -1.5 We all know that proper definite integrals are evaluated by means of the Newton-Leibniz theorem b f(x)dx=F(b)-F(a) a where F(x) is an antiderivative. In case of the integral discussed above, we get 4 x2 +2x+4 x+1 x+1 dx= arctan x=4 - arctan x=0 4 2 2 2 0 x -7x +2x+ 17 4-x 4-x And this is simply wrong x+1 res= ArcTan ; 4-x 2 (res/. x→4)-(res/. x→0) //N -0.63977 x2 +2x+4 NIntegrate ,{x, 0, 4} x4 -7x 2 +2x+ 17 2.50182 The problem is that the path of integration (0, 4) crosses singularities of the antiderivative. The follow- ing picture demonstrates this 15-355: Modern Computer Algebra V. Adamchik x+1 ContourPlotEvaluateReArcTan /. x ->x+Iy, 4-x 2 {x,-3, 4},{y,-3, 4}, ContourShading -> False, Contours -> 20, PlotPoints -> 40, Epilog -> {Hue[0], Thickness[0.005], Line[{{0, 0},{4, 0}}], RGBColor[0, 0, 0], Thickness[0.003], Line[{{1.95,-0.756},{1.95, 0.756}}], Line[{{-1.95,-0.246},{-1.95, 0.246}}] } 4 3 2 1 0 -1 -2 -3 -3 -2 -1 0 1 2 3 4 Observe that Mathematica computes the definite integral correctly x2 +2x+4 Integrate ,{x, 0, 4}//N x4 -7x 2 +2x+ 17 2.50182 How does Mathematica do it? By computing limits at singularities V. Adamchik 6 Limit[res, x→ 4, Direction ->1]- Limit[res, x→ 2, Direction -> -1] + Limit[res, x→ 2, Direction ->1]- Limit[res, x→ 0, Direction -> -1] //N 2.50182 There is a better idea! We can convert logs into arctangents of polynomials. ■ Idea 2 The “identity” (under differentiation) we used in the previous section A i A+iB arctan =D log B 2 A-iB can be further expanded A i A+iB A d+Bc i d+ic arctan =D log =D arctan + log B 2 A-iB g 2 d-ic where g=Bd-Ac, deg(d) < deg(A), deg(c) < deg(A) Proof. We will simplify log d+i c by using d-i c A i A+iB arctan =D log B 2 A-iB We get i d+ic d log =D arctan 2 d-ic c Thus, A d+Bc i d+ic A d+Bc d arctan + log =D arctan + arctan B d-Ac 2 d-ic B d-Ac c Next, we apply the summation formula for arctangents x+y arctan(x) + arctan(y) = arctan 1-xy 15-355: Modern Computer Algebra V. Adamchik Clear[A, B, c, d]; A d+Bc d x+y x= ; y= ; Simplify B d-Ac c 1-xy B - A We obtain, A d+Bc d B A arctan + arctan =D arctan - =D arctan g c A B whih concludes the proof. QED ■ Example Consider the result of Trager’s algorihm x2 +2x+4 i x2 -4+i(x+1) dx= log +C x4 -7x 2 +2x+ 17 2 x2 -4-i(x+1) We will convert the complex log function into a sum of arctangents by recursively applying this i A+iB A d+Bc i d+ic log =D arctan + log 2 A-iB g 2 d-ic First we find g by running the EEA Clear[x]; A =x 2 - 4; B=x+ 1; {g,{d, c}} = PolynomialExtendedGCD[B,-A, x] 1 1 1, (-1+x), 3 3 and then compute V. Adamchik 8 A d+Bc I d+Ic ArcTan // Simplify+ Log g 2 d-Ic ⅈ + 1 (- + ) 1 1 1 x ArcTan 5-3x-x 2 +x 3+ ⅈ Log 3 3 ⅈ 3 2 - + 1 (-1+x) 3 3 to get the following x-1 i i x2 -4+i(x+1) 1 i + log =D arctan x3 -x 2 -3x+5 + log 3 3 2 x2 -4-i(x+1) 3 2 x-1 - i 3 3 Apply the same procedure to the remaining log x-1 1 A = ;B= ; 3 3 {g,{d, c}} = PolynomialExtendedGCD[B,-A, x]; A d+Bc I d+Ic ArcTan // Simplify+ Log g 2 d-Ic -ArcTan[1-x] we get x-1 i i + log 3 3 =D -arctan(1-x) 2 x-1 - i 3 3 Combining steps together, yields i x2 -4+i(x+1) 1 log =D arctan x3 -x 2 -3x+5 - arctan(1-x) 2 x2 -4-i(x+1) 3 and 2 x +2x+4 1 3 2 dx= arctan x -x -3x+5 - arctan(1-x) +C x4 -7x 2 +2x+ 17 3.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us