<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Comparison of numerical integration methods</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Alicja Winnicka Institute of Mathematics Silesian University of Technology Kaszubska 23</institution>
          ,
          <addr-line>44-100 Gliwice</addr-line>
          ,
          <country country="PL">Poland</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>-The calculation of the integral is formally based on the calculation of the integral in a given range, i.e. the area between the specified function and the OX axis. Integrals find a variety of applications in the description of certain phenomena, whether objects in industry or information technology. Therefore, the numerical approach is an important element. In this work, we analyze three different approaches to this problem relative to selected, test functions.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>I. INTRODUCTION</title>
      <p>Numeric integration consists in the elimination of the
integral value by means of a specific algorithm. Integration of
a specific function will consist in approximating the value of
the surface area between this function determined in a given
range and the OX axis. Such algorithms determine the value
of the definite integral is important in the industry, as well in
informatics, which can be seen on the example of the latest
research results published around the world.</p>
      <p>As an intermediate tool, numerical integration was used in
estimating the population abundance [1] or in reconstructing
medical images [2] or in physics [3]. Again, in [4], the authors
analyze the complexity of this type of algorithms, and in [5],
[6] the idea of integrating in many dimensions was considered.</p>
      <p>In this paper, we compare classic numerical numeric
algorithms on selected sets of test functions to determine the
selection of the approximation method.</p>
    </sec>
    <sec id="sec-2">
      <title>II. NUMERICAL INTEGRATION</title>
      <p>Integrals are important part in mathematical analysis. There
are two types of integral - indefinite and definite integral.
The first one is called primitive function and it is reverse of
derivative. It is also generalization of definite integral. After
using the range [a; b] we get definite integral on this range.
It can be understood as the area between the function graph
and the OX axis, where for the positive values it takes sign
plus and for negative minus. Integrals are very useful not only
in mathematics analysis, but in the physics calculations too.
Because of this interpretation of the integral, we can use it
to calculate values in physics, e.g. work W = F s, which the
result is area of the graph.</p>
      <p>However many function are not possible to calculate
precisely, which means that we can not calculate them with
analitical mathematics methods. For this reason the another
method was established. It is called numerical integration and
c 2019 for this paper by its authors. Use permitted under Creative
Commons License Attribution 4.0 International (CC BY 4.0)
its purspose is to find approximation of searched integral.
Depending on our needs, we can use methods, which allow
us to calculate the result with specific error. There are a few
basic methods of numerical integration, differing in a way of
approximation:
midpoint rule,
trapezoidal rule,</p>
      <p>Simpson’s rule.</p>
      <p>In all of them we get approximated value of integral,
but they are determined with various errors and speed of
convergence to the correct result. All of these methods consist
on dividing the interval [a; b] on n same subintervals and
calculating area of function for each of the subintervals with
using specific formulas.</p>
      <sec id="sec-2-1">
        <title>A. Midpoint rule</title>
        <p>Le us assume that f : [a; b] ! R is our function, which
we want to integrate. In the case of midpoint rule, we use
value f ( xi+xi+1 ) as an approximation for the value in the
2
subinterval. We get
where h is the length of subintervals, xi is end of i th
subinterval for i = 0; :::; n 1, x0 = a and pi is approximated value
for whole subinterval, which means rectangle h f ( xi+2xi+1 ).
Then</p>
        <p>Z b
n 1
X pih
i=0</p>
        <p>Midpoint rule is one of the least accurate methods, however
it gives us quite accurate approximation in the case, when
function doesn’t change a lot in the subintervals. Error of this
rule is estimated by the following formula
24n2</p>
        <p>
          M 2
where M is maximum of second derivative of the function f .
According to this formula, we can see, that significant impact
of the value of error has number n of subintervals – the bigger
n, the smaller error.
(
          <xref ref-type="bibr" rid="ref1">1</xref>
          )
(
          <xref ref-type="bibr" rid="ref2">2</xref>
          )
(
          <xref ref-type="bibr" rid="ref3">3</xref>
          )
(
          <xref ref-type="bibr" rid="ref4">4</xref>
          )
h =
b
        </p>
        <p>a
n
pi =
yi + yi 1
2</p>
        <p>h
Z b
a
where M is maxixmum of the fourth derivative. Usually this
error is the smallest one from these three rules.</p>
        <p>For trapezoid rule error has following formula:
and similar to midpoint rule, M is maximum of the second
derivative.</p>
      </sec>
      <sec id="sec-2-2">
        <title>C. Simpson’s rule</title>
        <p>Simpson’s rule is based on polynomial interpolation and
uses second degree polynomial. It is the most acurate method
from these three. It is similar to trapezoid rule, because like
there, here we use h, yi 1 and yi as three sides of the figure,
but the fourth side is parabola approximated to graph of the
function. Values at the beginning and end of the subinterval
are used as the points needed to approximate this parabola.</p>
        <p>Value of the area for [xi 1; xi] is calculated in the following
way
where i = 1; :::; n and h = b na . Then the whole integral can
be approximated to the value</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>This method has a following error:</title>
      <p>
        Trapezoid rule is similar to midpoint rule, but instead
of taking rectangles, we use trapezoid. In other words, we
approximate by inscribing polygonal chain in the graph of the
function, taking separate segment for each subinterval. In this
case we calculate following values:
where h is a length of subinterval and yi = f (xi) for i =
1; :::; n. Then pi means area of the trapezoid for [xi 1; xi].
The whole integral on the range of [a; b] equals
(
        <xref ref-type="bibr" rid="ref5">5</xref>
        )
(
        <xref ref-type="bibr" rid="ref6">6</xref>
        )
(
        <xref ref-type="bibr" rid="ref7">7</xref>
        )
(8)
(10)
(11)
      </p>
    </sec>
    <sec id="sec-4">
      <title>III. EXPERIMENTS</title>
      <p>In the experiments we wanted to compare the results for
three rules, suing a few functions:
f (x) = sinx dla x 2 0; 4 ,
f (x) = x3 for x 2 [0; 2:5],
f (x) = ex for x 2 [0; 2],
f (x) = lnx for x 2 [1; 3],
f (x) = x for x 2 [0; 2],
f (x) = x3 x for x 2 [0; 2],
and various number of subintervals. These functions are
possible to calculate precise value, which allow us to compare
our result. The effect of our calculations was showed in Tab.
I, where additionaly was showed precise value of integral.</p>
      <p>Also in Tab. II, we computed relative errors for each result.
We can draw some conclusions from them:</p>
      <sec id="sec-4-1">
        <title>A. Simple functions</title>
        <p>Simple functions, here f (x) = x and f (x) = x3 x,
calculated numericaly have a precise solution very fast. Sometimes
even we don’t need to divide the interval into many
subintervals to find very approximated result and often additionaly the
choosen rule covers precisely the graph of the function. For
f (x) = x all of these three methods find the precise solution
and for f (x) = x3 x Simpson’s rule finds it very fast, because
in specific division graphs in subintervals are covered with
Simpson’s parabolas.</p>
      </sec>
      <sec id="sec-4-2">
        <title>B. Imperfection of midpoint rule</title>
        <p>Midpoint rule is one of the least accurate methods and can
lead to very wrong result, for example it can calculate that the
integral equals 0. It is visible in f (x) = x3 x, where for not
divided interval, so n = 1, the middle of the interval is x = 1,
for which value of function equals 0. From the formula for the
area of the rectangle we can see, that whole integral equals 0.
However it changes when we start to divide the intervals and
eliminate the x = 1 as the midpoint.</p>
      </sec>
      <sec id="sec-4-3">
        <title>C. Simpson’s rule</title>
        <p>Simpson’s rule is the most accurate method and the fastest
convergent. The easiest way to see this is the more complicated
function, where none of the rules find precise solution. For
example for f (x) = x3 or f (x) = sin(x) we can see, that the
error for n = 1 is big, but it rapidly deacreases for n = 4 and
n = 10.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>IV. CONCLUSIONS</title>
      <p>In this paper we compared three methods of numerical
integration – midpoint, trapezoid and Simpson’s rules – to
find out which one is the most accurate and the fastest. To
compare we used a few simple function and calculated values
for various number of subintervals and looked at them to find
the best one. The Simpson’s rule errors decrease fastest, so
this method is the best one.
b
0.77
0.77
0.77
2.5
2.5
2.5
2
2
2
3
3
3
2
2
2
2
2
2</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>G. C.</given-names>
            <surname>White</surname>
          </string-name>
          and
          <string-name>
            <given-names>E. G.</given-names>
            <surname>Cooch</surname>
          </string-name>
          , “
          <article-title>Population abundance estimation with heterogeneous encounter probabilities using numerical integration,”</article-title>
          <source>The Journal of Wildlife Management</source>
          , vol.
          <volume>81</volume>
          , no.
          <issue>2</issue>
          , pp.
          <fpage>322</fpage>
          -
          <lpage>336</lpage>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>W.</given-names>
            <surname>Wei</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Zhou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Połap</surname>
          </string-name>
          , and
          <string-name>
            <surname>M.</surname>
          </string-name>
          <article-title>Woz´niak, “A regional adaptive variational pde model for computed tomography image reconstruction,” Pattern Recognition</article-title>
          , vol.
          <volume>92</volume>
          , pp.
          <fpage>64</fpage>
          -
          <lpage>81</lpage>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>M.</given-names>
            <surname>Liang</surname>
          </string-name>
          and
          <string-name>
            <given-names>T.</given-names>
            <surname>Simos</surname>
          </string-name>
          , “
          <article-title>A new four stages symmetric two-step method with vanished phase-lag and its first derivative for the numerical integration of the schrödinger equation</article-title>
          ,
          <source>” Journal of Mathematical Chemistry</source>
          , vol.
          <volume>54</volume>
          , no.
          <issue>5</issue>
          , pp.
          <fpage>1187</fpage>
          -
          <lpage>1211</lpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>E.</given-names>
            <surname>Novak</surname>
          </string-name>
          , “
          <article-title>Some results on the complexity of numerical integration,” in Monte Carlo and Quasi-Monte Carlo Methods</article-title>
          . Springer,
          <year>2016</year>
          , pp.
          <fpage>161</fpage>
          -
          <lpage>183</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>A. P.</given-names>
            <surname>Nagy</surname>
          </string-name>
          and
          <string-name>
            <given-names>D. J.</given-names>
            <surname>Benson</surname>
          </string-name>
          , “
          <article-title>On the numerical integration of trimmed isogeometric elements</article-title>
          ,”
          <source>Computer Methods in Applied Mechanics and Engineering</source>
          , vol.
          <volume>284</volume>
          , pp.
          <fpage>165</fpage>
          -
          <lpage>185</lpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>V.</given-names>
            <surname>Keshavarzzadeh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. M.</given-names>
            <surname>Kirby</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Narayan</surname>
          </string-name>
          , “
          <article-title>Numerical integration in multiple dimensions with designed quadrature,”</article-title>
          <source>SIAM Journal on Scientific Computing</source>
          , vol.
          <volume>40</volume>
          , no.
          <issue>4</issue>
          , pp.
          <fpage>A2033</fpage>
          -
          <lpage>A2061</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>R.</given-names>
            <surname>Damaševicˇius</surname>
          </string-name>
          , C. Napoli, T. Sidekerskiene˙, and
          <string-name>
            <surname>M.</surname>
          </string-name>
          <article-title>Woz´niak, “Imf mode demixing in emd for jitter analysis</article-title>
          ,
          <source>” Journal of Computational Science</source>
          , vol.
          <volume>22</volume>
          , pp.
          <fpage>240</fpage>
          -
          <lpage>252</lpage>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <source>a 0 0</source>
          <volume>0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0</volume>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>