• Home
  • About Us
  • Contact Us
  • Privacy Policy
  • Special Offers
Business Intelligence Info
  • Business Intelligence
    • BI News and Info
    • Big Data
    • Mobile and Cloud
    • Self-Service BI
  • CRM
    • CRM News and Info
    • InfusionSoft
    • Microsoft Dynamics CRM
    • NetSuite
    • OnContact
    • Salesforce
    • Workbooks
  • Data Mining
    • Pentaho
    • Sisense
    • Tableau
    • TIBCO Spotfire
  • Data Warehousing
    • DWH News and Info
    • IBM DB2
    • Microsoft SQL Server
    • Oracle
    • Teradata
  • Predictive Analytics
    • FICO
    • KNIME
    • Mathematica
    • Matlab
    • Minitab
    • RapidMiner
    • Revolution
    • SAP
    • SAS/SPSS
  • Humor

Rubi/Mathematica gives different values for the same integrand

May 24, 2020   BI News and Info
 Rubi/Mathematica gives different values for the same integrand

Consider this integral:
$ $
\int_0^\pi d\theta \sin\theta\, {1 \over \gamma^q}\left((1-\gamma^2)^2\sqrt{1 \over 1-\left(1-(1-\gamma^2)^4\right)\cos^2\theta} – 1\right)^q
$ $

for $ 0\leq \gamma < 1$ . We can caclulate it directly, or integrate

$ $
\int_0^\pi d\theta \sin\theta\, {1 \over \gamma^q}\left(b\sqrt{1 \over 1-a \cos^2\theta} – 1\right)^q
$ $

and afterward replace $ b\to (1-\gamma^2)^2$ and $ a \to \left(1-(1-\gamma^2)^4\right)$ . Also, the term $ 1/\gamma^q$ is a constant and can be inside or outside the integration. So, there are four scenarios. Below is the code for these scenarios that uses Rubi for integration.

Here is the code:

<< Rubi`

For[q = 1, q <= 15,

  A1 = Assuming[
    gamma \[Element] Reals && 0 <= gamma < 1 && theta >= 0 && 
     theta \[Element] Reals,
    Int[Sin[theta] 1/gamma^
      q ((1 - gamma^2)^2 Sqrt[1/(
         1 - (1 - (1 - gamma^2)^4) Cos[theta]^2)] - 1)^q, theta]];
  A2 = 1/gamma^
    q Assuming[
     gamma \[Element] Reals && 0 <= gamma < 1 && theta >= 0 && 
      theta \[Element] Reals,
     Int[Sin[
        theta] ((1 - gamma^2)^2 Sqrt[1/(
          1 - (1 - (1 - gamma^2)^4) Cos[theta]^2)] - 1)^q, theta]];
  A3 = Assuming[
     gamma \[Element] Reals && 0 <= gamma < 1 && a \[Element] Reals && 
      0 <= a < 1 && b \[Element] Reals && 0 <= b < 1 && theta >= 0 && 
      theta \[Element] Reals,
     Int[Sin[theta] 1/gamma^q (b Sqrt[1/(1 - a Cos[theta]^2)] - 1)^q, 
      theta]] /. {a -> (1 - (1 - gamma^2)^4), b -> (1 - gamma^2)^2};
  A4 = 1/gamma^
     q Assuming[
      gamma \[Element] Reals && 0 <= gamma < 1 && a \[Element] Reals && 
       0 <= a < 1 && b \[Element] Reals && 0 <= b < 1 && theta >= 0 &&
        theta \[Element] Reals,
      Int[Sin[theta] (b Sqrt[1/(1 - a Cos[theta]^2)] - 1)^q, 
       theta]] /. {a -> (1 - (1 - gamma^2)^4), b -> (1 - gamma^2)^2};

  B1 = Limit[A1, theta -> Pi, Direction -> "FromBelow"] - 
    Limit[A1, theta -> 0, Direction -> "FromAbove"];
  B2 = Limit[A2, theta -> Pi, Direction -> "FromBelow"] - 
    Limit[A2, theta -> 0, Direction -> "FromAbove"];
  B3 = Limit[A3, theta -> Pi, Direction -> "FromBelow"] - 
    Limit[A3, theta -> 0, Direction -> "FromAbove"];
  B4 = Limit[A4, theta -> Pi, Direction -> "FromBelow"] - 
    Limit[A4, theta -> 0, Direction -> "FromAbove"];

  Print["---------------------------------------"];
  Print["q = ", q, " --> B1/.gamma\[Rule] 0.1 = ", B1 /. gamma -> 0.1];
  Print["q = ", q, " --> B2/.gamma\[Rule] 0.1 = ", B2 /. gamma -> 0.1];
  Print["q = ", q, " --> B3/.gamma\[Rule] 0.1 = ", B3 /. gamma -> 0.1];
  Print["q = ", q, " --> B4/.gamma\[Rule] 0.1 = ", B4 /. gamma -> 0.1];
  q = q + 1;

  ];

As you see below, for small values of $ q$ all the four approaches give the same value, but as $ q$ increases they start to give different values. I am curious about what is the problem here and how to fix it? which outcome is the correct value?

---------------------------------------
q = 1 --> B1/.gamma-> 0.1 = -0.266929
q = 1 --> B2/.gamma-> 0.1 = -0.266929
q = 1 --> B3/.gamma-> 0.1 = -0.266929
q = 1 --> B4/.gamma-> 0.1 = -0.266929
---------------------------------------
q = 2 --> B1/.gamma-> 0.1 = 0.0426047
q = 2 --> B2/.gamma-> 0.1 = 0.0426047
q = 2 --> B3/.gamma-> 0.1 = 0.0426047
q = 2 --> B4/.gamma-> 0.1 = 0.0426047
---------------------------------------
q = 3 --> B1/.gamma-> 0.1 = -0.00727758
q = 3 --> B2/.gamma-> 0.1 = -0.00727758
q = 3 --> B3/.gamma-> 0.1 = -0.00727758
q = 3 --> B4/.gamma-> 0.1 = -0.00727758
---------------------------------------
q = 4 --> B1/.gamma-> 0.1 = 0.0012885
q = 4 --> B2/.gamma-> 0.1 = 0.0012885
q = 4 --> B3/.gamma-> 0.1 = 0.0012885
q = 4 --> B4/.gamma-> 0.1 = 0.0012885
---------------------------------------
q = 5 --> B1/.gamma-> 0.1 = -0.000233249
q = 5 --> B2/.gamma-> 0.1 = -0.000233249
q = 5 --> B3/.gamma-> 0.1 = -0.000233249
q = 5 --> B4/.gamma-> 0.1 = -0.000233249
---------------------------------------
q = 6 --> B1/.gamma-> 0.1 = 0.0000428724
q = 6 --> B2/.gamma-> 0.1 = 0.0000428599
q = 6 --> B3/.gamma-> 0.1 = 0.0000428777
q = 6 --> B4/.gamma-> 0.1 = 0.0000428777
---------------------------------------
q = 7 --> B1/.gamma-> 0.1 = -7.95808*10^-6
q = 7 --> B2/.gamma-> 0.1 = -7.95808*10^-6
q = 7 --> B3/.gamma-> 0.1 = -8.10966*10^-6
q = 7 --> B4/.gamma-> 0.1 = -8.2423*10^-6
---------------------------------------
q = 8 --> B1/.gamma-> 0.1 = 7.62939*10^-6
q = 8 --> B2/.gamma-> 0.1 = 0.
q = 8 --> B3/.gamma-> 0.1 = 1.51582*10^-6
q = 8 --> B4/.gamma-> 0.1 = 4.26326*10^-6
---------------------------------------
q = 9 --> B1/.gamma-> 0.1 = 0.00012207
q = 9 --> B2/.gamma-> 0.1 = 0.0000568434
q = 9 --> B3/.gamma-> 0.1 = -0.0000247955
q = 9 --> B4/.gamma-> 0.1 = -0.000033091
---------------------------------------
q = 10 --> B1/.gamma-> 0.1 = -0.00195313
q = 10 --> B2/.gamma-> 0.1 = 0.
q = 10 --> B3/.gamma-> 0.1 = 0.
q = 10 --> B4/.gamma-> 0.1 = 0.
---------------------------------------
q = 11 --> B1/.gamma-> 0.1 = 0.
q = 11 --> B2/.gamma-> 0.1 = -0.0227374
q = 11 --> B3/.gamma-> 0.1 = -0.0117188
q = 11 --> B4/.gamma-> 0.1 = -0.0113687
---------------------------------------
q = 12 --> B1/.gamma-> 0.1 = -1.
q = 12 --> B2/.gamma-> 0.1 = 0.
q = 12 --> B3/.gamma-> 0.1 = 0.
q = 12 --> B4/.gamma-> 0.1 = 0.
---------------------------------------
q = 13 --> B1/.gamma-> 0.1 = 16.
q = 13 --> B2/.gamma-> 0.1 = -9.09495
q = 13 --> B3/.gamma-> 0.1 = 0.
q = 13 --> B4/.gamma-> 0.1 = 0.
---------------------------------------
q = 14 --> B1/.gamma-> 0.1 = -256.
q = 14 --> B2/.gamma-> 0.1 = -363.798
q = 14 --> B3/.gamma-> 0.1 = -128.
q = 14 --> B4/.gamma-> 0.1 = -181.899
---------------------------------------
q = 15 --> B1/.gamma-> 0.1 = 8192.
q = 15 --> B2/.gamma-> 0.1 = 3637.98
q = 15 --> B3/.gamma-> 0.1 = 2048.
q = 15 --> B4/.gamma-> 0.1 = -1818.99

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange

different, Gives, integrand, Rubi/Mathematica, Same, Values
  • Recent Posts

    • Experimenting to Win with Data
    • twice-impeached POTUS* boasts: “I may even decide to beat [Democrats] for a third time”
    • Understanding Key Facets of Your Master Data; Facet #2: Relationships
    • Quality Match raises $6 million to build better AI datasets
    • Teradata Joins Open Manufacturing Platform
  • Categories

  • Archives

    • March 2021
    • February 2021
    • January 2021
    • December 2020
    • November 2020
    • October 2020
    • September 2020
    • August 2020
    • July 2020
    • June 2020
    • May 2020
    • April 2020
    • March 2020
    • February 2020
    • January 2020
    • December 2019
    • November 2019
    • October 2019
    • September 2019
    • August 2019
    • July 2019
    • June 2019
    • May 2019
    • April 2019
    • March 2019
    • February 2019
    • January 2019
    • December 2018
    • November 2018
    • October 2018
    • September 2018
    • August 2018
    • July 2018
    • June 2018
    • May 2018
    • April 2018
    • March 2018
    • February 2018
    • January 2018
    • December 2017
    • November 2017
    • October 2017
    • September 2017
    • August 2017
    • July 2017
    • June 2017
    • May 2017
    • April 2017
    • March 2017
    • February 2017
    • January 2017
    • December 2016
    • November 2016
    • October 2016
    • September 2016
    • August 2016
    • July 2016
    • June 2016
    • May 2016
    • April 2016
    • March 2016
    • February 2016
    • January 2016
    • December 2015
    • November 2015
    • October 2015
    • September 2015
    • August 2015
    • July 2015
    • June 2015
    • May 2015
    • April 2015
    • March 2015
    • February 2015
    • January 2015
    • December 2014
    • November 2014
© 2021 Business Intelligence Info
Power BI Training | G Com Solutions Limited