# Mathematica Can Find the Primitive Function But It Cannot Find the Closed Form for Corresponding Definite Integral

Consider the following function

f = 1/2 (-3 + 4 u) Sqrt[-u (1 + u) (-1 - u + u^2)]


where it is assumed that

phi = (1+Sqrt[5])/2
1 < u < phi


Then I want to find

Integrate[f,{u,1,phi}]


But Mathematica cannot find the exact value of the above definite integral. It gets surprising when I found that it can find the primitive function

Integrate[f,u]


Can someone tell me that why this happens?

• Mathematica does not really do too well with cleanly evaluating elliptic integrals; some amount of analytical hand-holding can be needed. – J. M. will be back soon Feb 12 '16 at 14:19
• the antiderivative returned has a complex part that blows up at phi – george2079 Feb 12 '16 at 15:03
• NIntegrate gives an answer with an infinitesimal complex part which you can drop 0.773512+4.17354*10^-26 I. – Jack LaVigne Feb 12 '16 at 16:05
• I just observed that numerically, Integrate[f, u] /. u -> phi // N throws an error. This: (Integrate[f, u] /. u -> (phi - 10^-10)) - (Integrate[f, u] /. u -> 1) // N gives the same result as NIntegrate so I believe the integal converges, its just an issue with the particular form of the antiderivative. – george2079 Feb 12 '16 at 16:29
• The solution to Integrate[f, u] has the denominator, (2 (1 + Sqrt[5]) Sqrt[-1 + Sqrt[5] - 2/u] (1 + u) (1 + u - u^2)), which vanishes at u -> (1 + Sqrt[5])/2. Of course, this does not mean that the solution itself is singular there. – bbgodfrey Feb 13 '16 at 23:19

## 1 Answer

As noted in the question, the definite integral Integrate[f,{u, 1, phi}] returns unevaluated, although the indefinite integral Integrate[f,u] does not. Nonetheless, the definite integral can be determined with a bit of work. To begin,

s = FullSimplify[Integrate[f, u], 1 < u < phi]
(* 1/2 ((Sqrt[u + 2 u^2 - u^4] (1 + 2 u (-1 + (-1 + u) u)))/(2 u) +
(1/(4 (1 + Sqrt[5] - 2 u)))Sqrt[(2 + u - Sqrt[5] u)/(1 + 2 u - u^3)]
(Sqrt[(1 + u) (1 + Sqrt[5] + (3 + Sqrt[5]) u)] ((-2 + (-1 + Sqrt[5]) u)
EllipticE[ArcSin[Sqrt[1 + Sqrt[5] + 2/u]/(Sqrt[2] 5^(1/4))],
1/2 (5 + Sqrt[5])] + (1 + Sqrt[5] - 2 u)
EllipticF[ArcSin[Sqrt[1 + Sqrt[5] + 2/u]/(Sqrt[2] 5^(1/4))],
1/2 (5 + Sqrt[5])]) - 4 Sqrt[-(1 + Sqrt[5] - 2 u) (-1 - 2 u + u^3)]
EllipticPi[1/2 (5 - Sqrt[5]), ArcSin[Sqrt[1 + Sqrt[5] + 2/u]/(Sqrt[2] 5^(1/4))],
1/2 (5 + Sqrt[5])])) *)


Plotting s shows that it is well-behaved over the region of interest.

Plot[Evaluate[ReIm[s]], {u, 1, phi}]


Hence, the definite integral is simply s at phi minus s at 1. Unfortunately, s /. u -> phi returns Power::infy: Infinite expression 1/0 encountered. >>. (This is because several of the terms in s evaluate to 0/0 at u -> phi.) Moreover, extending the Plot beyond phi shows that s is discontinuous there. Although it is impossible to know precisely why the definite integral of f returns unevaluated, it seems likely that one or both of these issues prevents the definite integral from returning evaluated.

There are a number of ways, however, to evaluate s at phi. For instance,

s /. ArcSin[z_] :> Simplify[ArcSin[z] /. u -> phi];


which evaluates ArcSin to Pi/2 and simplifies the elliptic integrals, followed by

Limit[%, u -> phi, Direction -> 1] // FullSimplify
(* 1/8 (Sqrt[2 (1 + Sqrt[5])] EllipticK[1/2 (5 + Sqrt[5])] -
Sqrt[2 (-1 + Sqrt[5])] (EllipticE[1/2 (5 + Sqrt[5])] +
2 EllipticPi[1/2 (5 - Sqrt[5]), 1/2 (5 + Sqrt[5])])) *)


Note that Direction -> 1 is necessary to handle the discontinuity mentioned above. (The seemingly simpler Limit[s, u -> phi, Direction -> 1] // FullSimplify returns unevaluated, and Series[s, {u, phi, 0}] runs for hours without returning.)

Evaluating s at the lower limit of integration works without these difficulties.

Simplify[s /. u -> 1]
(* (1/(8 Sqrt[2]))(-4 + (1/(-1 + Sqrt[5])) 2 Sqrt[1 + Sqrt[5]] ((-3 + Sqrt[5])
EllipticE[ArcSin[Sqrt[3 + Sqrt[5]]/(Sqrt[2] 5^(1/4))], 1/2 (5 + Sqrt[5])] +
(-1 + Sqrt[5]) EllipticF[ArcSin[Sqrt[3 + Sqrt[5]]/(Sqrt[2] 5^(1/4))],
1/2 (5 + Sqrt[5])]) - 4 Sqrt[-1 + Sqrt[5]]
EllipticPi[1/2 (5 - Sqrt[5]), ArcSin[Sqrt[3 + Sqrt[5]]/(Sqrt[2] 5^(1/4))],
1/2 (5 + Sqrt[5])]) *)


Evaluating the two expressions numerically (with N) returns values equal to the endpoint values in the Plot above, confirming the accuracy of the analysis. Taking the difference of these two expressions yields an analytical expression for the definite integral. Of course,

N[%% - %] // N // Chop
(* 0.773512 *)


yields the same value as NIntegrate[f, {u, 1, phi}] // Chop.