Post Reply 
Integration methods...an error-proof method?
09-02-2017, 09:42 PM (This post was last modified: 09-02-2017 09:44 PM by Matt Agajanian.)
Post: #1
Integration methods...an error-proof method?
Hi all.

Although methods like Simpson's and Trapezoidal need evaluation at the endpoint, I can see a minefield if either endpoint produces a mathematical discontinuity or undefined result thus causing an HP-67, 41, etc. program to stop. So, it seems that error-checking or implementing an error-handling flag setting (HP-41, 42, etc.). Thus, further necessitating error-handling program code.

So, rather than this approach, what are some improved integration methods to avoid, aleviate, bypass, or resolve discontinuities in functions?

Thanks.
Find all posts by this user
Quote this message in a reply
09-02-2017, 10:21 PM
Post: #2
RE: Integration methods...an error-proof method?
The modified Romberg method used by the HP-71B Math Pac avoids that problem by avoiding the endpoints altogether. It also has some other features as explained on page 118 of the owner's manual. You can read that page here: http://holyjoe.net/HP71/integral.htm

X<> c
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
09-02-2017, 10:43 PM (This post was last modified: 09-02-2017 10:51 PM by Matt Agajanian.)
Post: #3
RE: Integration methods...an error-proof method?
(09-02-2017 10:21 PM)Joe Horn Wrote:  The modified Romberg method used by the HP-71B Math Pac avoids that problem by avoiding the endpoints altogether. It also has some other features as explained on page 118 of the owner's manual. You can read that page here: http://holyjoe.net/HP71/integral.htm

Thanks. As I do not have a 71B, is there a port to the 67 or 41?

Also, how does this algorithm differ from the Romberg Integration program found in the program from the Math/Utilities module for TI-58/59?
Find all posts by this user
Quote this message in a reply
09-02-2017, 11:05 PM (This post was last modified: 09-02-2017 11:14 PM by Joe Horn.)
Post: #4
RE: Integration methods...an error-proof method?
(09-02-2017 10:43 PM)Matt Agajanian Wrote:  Thanks. As I do not have a 71B, is there a port to the 67 or 41?

The HP-41 PPC ROM contains a routine called IG (InteGrate) which uses a modified Romberg, similar to the HP-71's Math Pac. Its code and some commentary can be found here: https://coertvonk.com/technology/hp41/integrate-4625

There are a few other implementations of Romberg for the HP-41 here: http://www.hpmuseum.org/software/41/41rombrg.htm

There are a BUNCH of various integration programs for the HP-41 in the "Differentiation & Integration" section of this page: http://hp41programs.yolasite.com/

(09-02-2017 10:43 PM)Matt Agajanian Wrote:  Also, how does this algorithm differ from the Romberg Integration program found in the program from the Math/Utilities module for TI-58/59?

Anybody? Anybody? Bueller?

X<> c
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
09-03-2017, 02:47 AM
Post: #5
RE: Integration methods...an error-proof method?
I would say: do the math. Analyse any "bad behaviour" and either factor (transform) it out or use an algorithm that is suited to the particular type of issue(s) (thinking of Gauss-Legendre with weight functions for example). Of course chopping up the interval of integration to isolate the issues as much as you can first is probably a good idea as well.

But perhaps I am just too old to expect any silver bullets...
Find all posts by this user
Quote this message in a reply
09-03-2017, 04:09 AM
Post: #6
RE: Integration methods...an error-proof method?
(09-02-2017 09:42 PM)Matt Agajanian Wrote:  So, rather than this approach, what are some improved integration methods to avoid, aleviate, bypass, or resolve discontinuities in functions?

Avoiding the endpoints is straightforward, the rectangle method can do this by evaluating the rectangle mid-points.

I suspect this is impossible in general. A discontinuity between two evaluation points is going to be impossible to detect. Where both sides run to opposite signed infinities can be detected (e.g. tangent) but I'm not sure how helpful that is -- the area under each side could be infinite and then there is the question as to what infinity - infinity means?

Avoiding undefined evaluation points seems problematic -- it would be possible to shift the point on error and increase the resolution around the failure which would be a start. I'm sure it could be tricked up easily.


Pauli
Find all posts by this user
Quote this message in a reply
09-03-2017, 05:24 AM
Post: #7
RE: Integration methods...an error-proof method?
Let me rephrase my earlier response: if your aim is to get an accurate approximation of the integral then you should not (use algorthims that) avoid "singularities", but you need to embrace, understand and deal with them.

Simply avoiding them (i.e. sweeping them under the rug) will give you an answer, but no indication as to how (in)accurate that answer is.
Find all posts by this user
Quote this message in a reply
09-03-2017, 06:30 AM
Post: #8
RE: Integration methods...an error-proof method?
(09-03-2017 05:24 AM)AlexFekken Wrote:  Simply avoiding them (i.e. sweeping them under the rug) will give you an answer, but no indication as to how (in)accurate that answer is.

Exactly.


Pauli
Find all posts by this user
Quote this message in a reply
09-03-2017, 08:07 AM
Post: #9
RE: Integration methods...an error-proof method?
In the mean time (lazy Sunday afternoon), I have come to realise that this is not just an issue when there are "discontinuities" or other types of singularities are in play.

This is one way how you can "trick up" (as suggested by Pauli) most algorithms:

Select an arbitrarily small but postive number eps and an arbitrary "value" V. For example chose eps as the smallest positive number that your system can represent, and V as the largest...

You can then construct a function that has the following properties:

- it is arbitrarily smooth everywhere (i.e. it can be differentiated everywhere and as often as you like; this also implies continuity of the function and all of its derivatives everywhere)
- the function is 0 everywhere except inside the open interval (0, eps)
- the integral over [0, eps] is V
- you can make it unimodal (a single bump), i.e. you need no weird oscillations and/or jumps to construct it.

I have only added the unimodal bit so that you do not think that this would have to be a very special, "artificial" function... Explicit details for constructing such a function are in many textbooks on analysis; typically, only the exponential function is used beyond +, -, * and / (think exp(-1/x^2) and be creative).

Now you can add this "bump" to an arbitrary function f to obtain a new function g so that

- g = f everywhere except inside the tiny interval (0,eps)
- g is just as smooth as f
- the integral of g, over any interval including [0, eps], differs by V from the integral of f

In other words: as long as you don't investigate inside (0,eps) you cannot distinguish between f and g and yet their integrals differ by as much as you like.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)