-1

The function is -((28359.7 (25.64 -8. Cos[(2 \[Phi])/3]) (-145751.-42339.7 Cos[0.666667 \[Phi]]))/(6.35447*10^9+1.09431*10^10 Cos[(2 \[Phi])/3]+0.8 (1.36789*10^10+4.88831*10^8 Cos[(2 \[Phi])/3]) Cos[0.666667 \[Phi]])). I found this function is singular at \[Phi] = 2.80043. Then I try to integrate it numerically by excluding \[Phi] = 2.80043. The code is as follows. NIntegrate[R, {\[Phi], 0, 2 \[Pi]}, Method -> "PrincipalValue", Exclusions -> {2.8}]

I am getting a negative value, which is not true. i should get the value around 20. Please someone look into this, where I have done mistake.

  • NIntegrate[R, {\[Phi],0,2 Pi},Method->"PrincipalValue",Exclusions->{2.80046}] returns 33.707 but I wouldn't trust any of this with constants like 6.3544710^9, 1.0943110^10, 1.3678910^10, 4.8883110^8 in your denominator. – Bill May 23 '22 at 14:47
  • 1
    Replacing the two Cos[0.666667 \[Phi]] with Cos[2 \[Phi]/3] like your other three Cos expressions and then doing FullSimplify on that whole expression returns a result with far smaller constants. Giving that to NIntegrate[R,{\[Phi],0,2 Pi},Method->"PrincipalValue",Exclusions->{2.80046}] returns 2.3526. See how fragile and badly conditioned your problem is? No one can know what the accurate result should be. – Bill May 23 '22 at 15:26
  • Yes Bill, that's the concern. This evening even i had got 33.707, but then i again ran the program with same code, but i got negative. – sachiraj mishra May 23 '22 at 15:26
  • 3
    Using Rationalize can give you 20 or even 50 digit numbers as exact fractions, But that is just replacing one badly conditioned problem with another, neither one of which will give an answer which means anything. If you need an answer that you can depend on then I would suggest you go back and carefully derive a well conditioned problem before trying to give anything to Mathematica. – Bill May 23 '22 at 15:33
  • @Bill: Can you ground you claim " But that is just replacing one badly conditioned problem"? – user64494 May 23 '22 at 16:10
  • @user64494 Rationalize effectively assumes all decimal approximations are infinitely precise. But decimal approximations are almost never infinitely precise. For example, take every subset of coefficients in his problem and increase or decrease or leave alone each by a factor of 10^-7 and then perform the integration, or even just very carefully plot all those different integrands and see how large a band of uncertainty there is. Unfortunately NIntegrate isn't telling him that the integral is zero+/-30 because of uncertainty in the decimal approximations. If it did that then he would know – Bill May 23 '22 at 19:36
  • @user64494 And do the same 10^-7 factor changes with your 100 digit rationals and see that the results will be the same. – Bill May 23 '22 at 19:42
  • You wrote "I am getting a negative value, which is not true. i should get the value around 20." but no details for this claim. Why do you think you know what the value should be? – Somos May 24 '22 at 00:44
  • Its actually a resistance value in the electric current. So obviously the resistance is not negative. That's why i told it should be positive.By the way, it is not necessary for the value to be 20. It can be any positive value. But it should be a positive value. – sachiraj mishra May 24 '22 at 02:24

1 Answers1

1

Let us switch to rationals by

R = Rationalize[-((28359.7 (25.64 - 8. Cos[(2 \[Phi])/3]) (-145751. - 
      42339.7 Cos[0.666667 \[Phi]]))/(6.35447*10^9 + 
    1.09431*10^10 Cos[(2 \[Phi])/3] + 
    0.8 (1.36789*10^10 + 4.88831*10^8 Cos[(2 \[Phi])/3]) Cos[
      0.666667 \[Phi]])) - ((28359.7 (25.64 - 
     8. Cos[(2 \[Phi])/3]) (-145751. - 
     42339.7 Cos[0.666667 \[Phi]]))/(6.35447*10^9 + 
   1.09431*10^10 Cos[(2 \[Phi])/3] + 
   0.8 (1.36789*10^10 + 4.88831*10^8 Cos[(2 \[Phi])/3]) Cos[
     0.666667 \[Phi]])), 10^-6];

Now we find the singularity

Reduce[Denominator[%] == 0 && \[Phi] >= 0 && \[Phi] <=  2*Pi, \[Phi], Reals]

\[Phi] == 3/2 ArcCos[((-11474682511359999 + Sqrt[ 128936041852524956596599521280001])/410061163724800)

and verify whether the principal value exists:

Normal[Series[R, {\[Phi], 3/2 ArcCos[(-11474682511359999 + Sqrt[
 128936041852524956596599521280001])/410061163724800], 1}]]

(283597 (-\ 8150874560502974171386525279586377768479544128931229678029921919909621\ 7882393287690779 + 7177980461245791809133043915542851489143779773506255352808120017\ 909221 Sqrt[ 128936041852524956596599521280001]))/(\ 1890838028244348811742170217604725064930000 Sqrt[ 128936041852524956596599521280001] \ (-43406038405173438824145660586667 + 3824894170453333 Sqrt[ 128936041852524956596599521280001])) + (283597 \ (-12788928541097983 + Sqrt[ 128936041852524956596599521280001]) (-4260677904521756248603 + 423397 Sqrt[ 128936041852524956596599521280001]) \ \[Sqrt](3/(257872083705049913193199042560002 \ (-43406038405173438824145660586667 + 3824894170453333 Sqrt[ 128936041852524956596599521280001]))))/(9776620000 \ (\[Phi] - 3/2 ArcCos[(-11474682511359999 + Sqrt[ 128936041852524956596599521280001])/ 410061163724800])) + (283597 \ (-14155375205447098928680471998526538311923178615746222212518203042223\ 03228798422400804127604557075641388359898840791914277845526702933 + 1246620367110647775006547791183469130900148171581433830671783967\ 60849011665904411755292709563971603283924005230417067 Sqrt[ 128936041852524956596599521280001]) (\[Phi] - 3/2 ArcCos[(-11474682511359999 + Sqrt[ 128936041852524956596599521280001])/ 410061163724800]))/(\ 157569835687029067645180851467060422077500 Sqrt[ 773616251115149739579597127680006] \ (-43406038405173438824145660586667 + 3824894170453333 Sqrt[128936041852524956596599521280001])^(5/2))

The above long output confirms it. In principal,

Integrate[R, {\[Phi], 0, 2*Pi}, PrincipalValue -> True]

should work, but its execution is spinning on my comp. Because of this reason, let us switch to numeric integration by

NIntegrate[R, {\[Phi], 0, 
3/2 ArcCos[(-11474682511359999 + Sqrt[128936041852524956596599521280001])/410061163724800], 2*Pi}, Method -> PrincipalValue]

-31.6315

The result is a negative number despite your claim. To be sure, let us verify it by the definition of the principal value

NIntegrate[ R, {\[Phi], 0, 
3/2 ArcCos[(-11474682511359999 + Sqrt[128936041852524956596599521280001])/410061163724800] - 0.01}] +
  NIntegrate[ R, {\[Phi],  3/2 ArcCos[(-11474682511359999 + Sqrt[
   128936041852524956596599521280001])/410061163724800] + 0.01,  2*Pi}]

-31.603

Addition. Working only with the original function,

NSolve[Denominator[-((28359.7 (25.64 - 
       8. Cos[(2 \[Phi])/3]) (-145751. - 
       42339.7 Cos[0.666667 \[Phi]]))/(6.35447*10^9 + 
     1.09431*10^10 Cos[(2 \[Phi])/3] + 
     0.8 (1.36789*10^10 + 4.88831*10^8 Cos[(2 \[Phi])/3]) Cos[
       0.666667 \[Phi]]))] == 0 && \[Phi] >= 0 && \[Phi] <=  2*Pi, \[Phi], Reals]

{{\[Phi] -> 2.80046}}

, we obtain

NIntegrate[-((28359.7 (25.64 - 8. Cos[(2 \[Phi])/3]) (-145751. - 
    42339.7 Cos[0.666667 \[Phi]]))/(6.35447*10^9 + 
  1.09431*10^10 Cos[(2 \[Phi])/3] + 
  0.8 (1.36789*10^10 + 4.88831*10^8 Cos[(2 \[Phi])/3]) Cos[
    0.666667 \[Phi]])), {\[Phi], 0, 2.800455227678918`, 2*Pi}, Method -> PrincipalValue]

-15.8158

without any warnings/errors. As we see, Rationalize somewhat changes the result quantitatively, but not qualitatively. PS. It should be noticed that

N[3/2 ArcCos[(-11474682511359999 + 
  Sqrt[128936041852524956596599521280001])/410061163724800]]

2.80046

user64494
  • 26,149
  • 4
  • 27
  • 56
  • I'd like to add that replacing R by -((28359.7 (25.64 -8. Cos[(2 \[Phi])/3]) (-145751.-42339.7 Cos[0.666667 \[Phi]]))/(6.35447*10^9+1.09431*10^10 Cos[(2 \[Phi])/3]+0.8 (1.36789*10^10+4.88831*10^8 Cos[(2 \[Phi])/3]) Cos[0.666667 \[Phi]])) in the latest command, we also obtain a negative number. – user64494 May 23 '22 at 15:33
  • https://mathematica.stackexchange.com/questions/268501/getting-a-wrong-plot-after-nintegration – sachiraj mishra May 23 '22 at 15:34
  • https://mathematica.stackexchange.com/questions/268501/getting-a-wrong-plot-after-nintegration. This was my yesterday's question. In that long expression i have simply used R = 0.8. please click this link and suggest me what to do. – sachiraj mishra May 23 '22 at 15:35
  • @sachirajmishra: Sorry, I answered that was asked, not another additional question about a plot you linked. The plot of the function under consideratio is produced by Plot[R, {\[Phi], 0, 2*Pi}]. – user64494 May 23 '22 at 15:38
  • I get -15.8158 whether or not I rationalize the integrand. I think that you have an extra factor of precisely two in your answer using rationalized numbers. Otherwise, a good answer. – bbgodfrey May 24 '22 at 02:25