Post Reply 
[VA] Short & Sweet Math Challenge #25 "San Valentin's Special: Weird Math"
03-01-2021, 03:03 AM
Post: #45
RE: [VA] Short & Sweet Math Challenge #25 "San Valentin's Special: Weird Math...
(02-28-2021 02:18 AM)Valentin Albillo Wrote:  [*]robve computed the integral using the HP Prime but alas, the result he posted is wrong. He also posted a BASIC program for the SHARP PC-1350 which produced the same wrong result. Anyway, thanks for trying ...

Ah, that explains why I was getting nowhere with this one! Thanks for debugging my answer now that this challenge is over. Garbage in, garbage out: by putting the wrong expression in the integral the integration area did not offer any insights in what is weird about this integration. Somehow I missed the LN in the numerator of the integrand. The rest of the integrand expression was correct. Go figure...

With the LN correction applied to the numerator, I noticed that the Romberg integration ran much faster this time on the SHARP PC-1350 compared to the incorrect integrand. When viewing the value of I (the iterator) I noticed that I=2 when the integration converges. Two successive trapezoidal approximations at alternating points are indistinguishable within MachEps. This means that the curve should be sufficiently close to linear between 1<=x<=phi. Plotting the integrand on the HP PRIME shows that this hunch is indeed the case:

   

Observing 0<=f(x)=(x-1)/(phi-1)<=1 for 1<=x<=phi. Integrating this f gives the same result 0.309016994375. Analytically, the value of the integral of f between 1 and phi is:

$$\frac{\phi^2-2\phi+1}{2\phi-2}=\frac{(1-\phi)^2}{2\phi-2}=-\frac{1}{2}\frac{(1-\phi)^2}{1-\phi}=\frac{\phi-1}{2}$$

Noticing this behavior of the quadrature algorithm is now (a bit late) helpful to answer what is weird about this integral. I am glad to use my trusty (albeit crusty) Romberg on the PC-1350.

Also, what is the fun of doing math and calc exercises if we don't implement numerical integration ourselves?

The Romberg quadrature program on the PC-1350 produces 0.3090169944 (10 digits exact) with the change X=LN(X*X-V) to line 300 to correct the integrand:

300 "F1" V=X,X=1.618033989,X=LN(X*X-V): GOSUB "GAMMA": W=Y

- Rob

"I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx...
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] Short & Sweet Math Challenge #25 "San Valentin's Special: Weird Math... - robve - 03-01-2021 03:03 AM



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