octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #57603] quadv gives wrong results integrating


From: Rik
Subject: [Octave-bug-tracker] [bug #57603] quadv gives wrong results integrating sin^2 or cos^2 on multiple of 8 periods
Date: Wed, 15 Jan 2020 13:06:54 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Follow-up Comment #3, bug #57603 (project octave):

Check the Octave manual for guidance about which integrands are appropriate
for which numerical integration function.  Quoting


The best quadrature algorithm to use depends on the integrand. If you have
empirical data, rather than a function, the choice is trapz or cumtrapz. If
you are uncertain about the characteristics of the integrand, quadcc will be
the most robust as it can handle discontinuities, singularities, oscillatory
functions, and infinite intervals. When the integrand is smooth quadgk may be
the fastest of the algorithms.

Function
 Characteristics
quad
 Low accuracy with nonsmooth integrands
quadv
 Medium accuracy with smooth integrands
quadl
 Medium accuracy with smooth integrands. Slower than quadgk.
quadgk
 Medium accuracy (1e-6 – 1e-9) with smooth integrands.
Handles oscillatory functions and infinite bounds
quadcc
 Low to High accuracy with nonsmooth/smooth integrands
Handles oscillatory functions, singularities, and infinite bounds


For an oscillatory integrand the programmer should be using quadcc, or maybe
quadgk.

However, I do agree that quadv can probably be improved.  All of the other
integration routines seem to be able to handle the integrand and bounds
mentioned.  There must be something quite specific about quadv that is
preventing it from reaching the correct result.



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57603>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]