2
$\begingroup$

Here's my code.

Int1 = Integrate[((1 - Cos[x])/(L^2 (1 - Cos[x]) + 1)^2) Sin[x], {x, 
   0, Pi}]
Int2 = Integrate[((1 - Cos[x])/(L^2 (1 - Cos[x]) + 1)^2) Sin[x], x]
r1 = Int1[[1]];
r2 = Limit[Int2, x -> Pi] - Limit[Int2, x -> 0];
Plot[r1, {L, -1000, 1000}]
Plot[r2, {L, -1000, 1000}]
Plot[Abs[r2 - r1], {L, -1000, 1000}]

The results of plot r1, r2 and their difference are, respectively, r1 [r2] Difference

I have results of the integration obtained by two different ways. The results are almost identical as we can see the plot of r1 and r2. Small differences are in order of $10^{-25}-10^{-24}$ which is acceptable. I want to know where the differences are from. And which one should I use for further calculation?

$\endgroup$
  • 1
    $\begingroup$ FullSimplify[r1 == r2] gives true. There's just a tiny difference in the formulas that lead to a tiny numerical difference. Use FullSimplify[r1] to continue, it's the same as FullSimplify[r2]. $\endgroup$ – Roman Jul 30 at 22:00
  • 1
    $\begingroup$ Compare combinations of Simplify and WorkingPrecision->128 $\endgroup$ – Bill Jul 30 at 22:05
  • 1
    $\begingroup$ @Panithi If you accepted one of the answers, don't forget to also upvote it. A good rule of thumb is: Vote for all the answers you like or that helped you. Accept the one that solved your problem. $\endgroup$ – halirutan Jul 31 at 0:04
  • $\begingroup$ @halirutan I really want to upvote for all the answers. Unfortunately, I am still a newbie with low reputation point and system message shows "Votes cast by those with less than 15 reputation are recorded, but do not change the publicly displayed post score.". Thank you for all helps. $\endgroup$ – Panithi Nakkhruea Jul 31 at 0:08
  • 1
    $\begingroup$ Uhh, I didn't know that you need 15 rep to vote for answers on your own question. I gave you a thumbs up for your question, so at least you are over the 15 rep boundary now :) $\endgroup$ – halirutan Jul 31 at 0:14
3
$\begingroup$

For Int1, FullSimplify with the assumption that L is real.

Int1 = Integrate[
  ((1 - Cos[x])/(L^2 (1 - Cos[x]) + 1)^2) Sin[x], {x, 0, Pi}] //
   FullSimplify[#, Element[L, Reals]] &

(* (-1 + 1/(1 + 2 L^2) + Log[1 + 2 L^2])/L^4 *)

Also FullSimplify Int2

Int2 = Integrate[((1 - Cos[x])/(L^2 (1 - Cos[x]) + 1)^2) Sin[x], x] // 
  FullSimplify

(* (1/(1 + L^2 - L^2 Cos[x]) + Log[1 + L^2 - L^2 Cos[x]])/L^4 *)

r2 = Limit[Int2, x -> Pi] - Limit[Int2, x -> 0]

(* -(1/L^4) + (1/(1 + 2 L^2) + Log[1 + 2 L^2])/L^4 *)

Then Int1 and r2 are equal

Int1 == r2 // Simplify

(* True *)

r2 - Int1 // Simplify

(* 0 *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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