0
$\begingroup$
inttau[r_]=-(1/Sqrt[0.0345106153943703 - ((37.3042 - r) (-25.578 + r) (62.8822 + 
 r))/(3000 r)])

This is my function of r, now I integrated it w r t r

tauanalytical[r_] = Integrate[inttau[r], r]

This is what I got after integration, I got this result.

-((2.3094 Sqrt[1. + 62.1447/r] (-31.0723 + r) EllipticPi[3.,ArcSin[0.57735 Sqrt[1. + 62.1447/r]], 1.])/Sqrt[-0.965489 + 20./r + 0.000333333 r^2])

later I tried to find the numerical value of;

tauanalytical[30] // N 

I got this, no the exact number , which I was expecting

-126.491 EllipticPi[3., -1.5708 + 0.153761 I, 1.]

Here the second argument of Ellepticpi comes out to be imaginary , it should be real . Please provide necessary assistance.

$\endgroup$
2
  • $\begingroup$ Why do you think it should be real? $\endgroup$
    – thorimur
    Commented Apr 29, 2021 at 21:05
  • $\begingroup$ MMA version 12.1 For tauanalytical[30] // N I get -91.3533 - 72.7262 I` $\endgroup$ Commented Apr 30, 2021 at 7:39

1 Answer 1

2
$\begingroup$
Clear["Global`*"]

$Version

(* "12.2.0 for Mac OS X x86 (64-bit) (December 12, 2020)" *)

inttau[r_] = -(1/
     Sqrt[0.0345106153943703 - ((37.3042 - r) (-25.578 + r) (62.8822 + 
            r))/(3000 r)]);

tauanalytical[r_] = Integrate[inttau[r], r];

tauanalytical /@ Range[5, 30, 5]

(* {-1.80511 + 99.3459 I, -5.63104 + 99.3459 I, -11.7122 + 99.3459 I, -21.3022 + 
  99.3459 I, -38.3228 + 99.3459 I, -91.3533 + 99.3459 I} *)

Note that the imaginary part is constant. Since you are using an indefinite integral (antiderivative) the result includes an arbitrary (complex) constant.

ReImPlot[tauanalytical[r], {r, 0, 30},
 PlotLegends -> Placed[Automatic, {.8, .7}]]

enter image description here

Alternatively, use exact numbers to the extent possible.

inttau[r_] = -(1/
       Sqrt[0.0345106153943703 - ((37.3042 - r) (-25.578 + r) (62.8822 + 
              r))/(3000 r)]) // Rationalize[#, 0] & // ExpandAll // Simplify

(* -(1/Sqrt[-(7721175797271411311/7997151075000000000) + 250000455360453/(
  12500000000000 r) + r^2/3000]) *)

tauanalytical[r_] = (Integrate[inttau[r], r] // RootReduce);

This antiderivative is real in the range of interest.

tauanalytical[30.]

(* -91.3533 *)

Plot[tauanalytical[r], {r, 0, 30}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.