Post Reply 
Improper (difficult) integrals at SwissMicros Calculator Forum
11-26-2023, 03:55 AM (This post was last modified: 11-26-2023 03:56 AM by Valentin Albillo.)
Post: #3
RE: Improper (difficult) integrals at SwissMicros Calculator Forum
.
Hi, peacecalc,

(11-25-2023 08:29 PM)peacecalc Wrote:  I tried to integrate your fifth integral from your test-set numericaly:
\[ I = \int_{-1}^{1}\exp\left(x + \sin\left(\exp\left(\exp\left(\exp\left(x + \frac{1}{3}\right)\right)\right)\right)\right)dx \]

Good. The more people interested, the merrier.

Quote:The argument from the sin has a range from 5 to 1.9E19 , so its a wild oscillating story.

Yes, it is. Quite wildly.

        [Image: GraphExpExp01.jpg]

Quote:[...] the simple program of mine does it better: 2.994... (but with 10^6 calls of function, but prime needs only 4 minutes for this).

Getting four digits (save 2 ulp) is no mean feat, congratulations. And speed is one of the redeeming hardware features the to.. er, the Prime has. Did you use its native programming language or its limited Python implementation, which I'm told is much faster ? Nevertheless, some 4,200 f(x) evals per sec. is no mean feat.

Quote:So the midpoint rule is "blind" for the behavier of the function values. If the oscillating is very wild, the rule will calculate a statistical mean value which is near by the true value. That is only my assumption.

Well, as seen in the plot above, the oscillations of f(x) are so fast that the graph becomes an impenetrably dense yellow blur, but if you subtract the mean value of the oscillations over one period of sin(x) (plotted in light blue) from f(x) itself (plotted in yellow), the positive and negative contributions to the area tend to cancel each other out and so contribute very little in all.

Thus, we can obtain a decently accurate value (about 3 correct digits) of I5 by simply computing the relevant mean value (a constant which we'll call C) over a full [0..2\(\pi\)] period, then we just compute the integral of the exponential function times C like this (because exp(x+sin(...)) = exp(x) * exp(sin(...)) ):
        [Image: GraphExpExp02.jpg]
where both integrals are very easily computed (and very quickly at that) using e.g. the HP-71B:
    >FIX 2 @ K=1E-3 @ INTEGRAL(0,2*PI,K,EXP(SIN(IVAR)))/(2*PI)*INTEGRAL(-1,1,K,EXP(IVAR))

          2.98

or the second integral can be simply replaced by its obvious value:
    >FIX 2 @ INTEGRAL(0,2*PI,1E-3,EXP(SIN(IVAR)))/(2*PI)*(EXP(1)-EXP(-1))

          2.98

Quote:My questions are: from where you know so many valid digits for your test-integral? [...]

I got them from two different reputed sources using two different programs, whose results perfectly agree so it's quite safe to assume they're correct.

Quote:[...] in some posts you wrote about your own in basic programmed integrator for your HP-71. Do you like to share the code or if you have had already shared it, can you tell us the link?

I'd like to but my ancient integration program, which I initially wrote for the HP-71B several decades ago and then also ported it to UBASIC (thus providing me with up to 1,200-digit results and several orders of magnitude speedup,) was never completely finalized to my satisfaction, some improvements were still pending.

A few years ago I set up to complete its implementation and once done I was about to create an article in the format and style of my many articles already published, intending to publish it as well, but when I participated in some thread about such matters and announced its next availabilty, I was subjected out of the blue to unpolite attempts to ruin my announcement by outguessing my implementation, belittling previous contributions by me, and finally subjecting me to thinly-veiled attacks and uncalled-for disrespect, which was the last thing I expected as a reply to my highly technical posts in that thread. Thus, I ditched it all for good, dismissing any attempts at publication and left the forum for a time out of sheer disgust.

The bottom line is that I've misplaced its source code since then and I only have the carefully-crafted ancient tests nowadays, but in general it was as fast as the assembler INTEGRAL keyword for normal integrals and many times faster for difficult integrals. A pity. It was the second time something like this happened to me, with identical results.

Quote:Thank you very much for test suite in case of numeric integration, I learned a lot, even I failed for getting much more valid digits for your integral number 5. I like this experimental way of doing mathematics, because my mathematical skills, aren't that good, they should be.

You're welcome, that's my main goal here: to provide entertainment and knowledge whenever possible via my posts, challenges, articles, the works !

Thanks for your interest and regards.
V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Improper (difficult) integrals at SwissMicros Calculator Forum - Valentin Albillo - 11-26-2023 03:55 AM



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