HP71B Integral Questions
|
02-05-2020, 05:09 PM
(This post was last modified: 02-09-2020 11:31 PM by Albert Chan.)
Post: #7
|
|||
|
|||
RE: HP71B Integral Questions
I noticed u-transformation can be applied more than once, accelerate some integrals.
Example: \( \int _{-1} ^1 {dx \over \sqrt{1-x^2}} = 2\;\sin^{-1} 1 = \pi\) Below, FNB(U) is u-transformed FNA(X), which is more accurate, and run much faster. Code: 10 INPUT "P=? ";P >RUN P=? 1E-4 IA( 8191 ) = 3.14133371246 3.14116984016E-4 6.34 SEC IB( 31 ) = 3.14159247755 3.14127673304E-4 .03 SEC >RUN P=? 1E-5 IA( 65535 ) = 3.14156045534 -3.1415397954E-5 50.97 SEC IB( 31 ) = 3.14159263336 3.14127673304E-4 .03 SEC Lets call integrand of IB (= u-transformed FNB) as FNC. If we plot FNB and FNC, u = -1 to 1, FNB is much flatter, min=FNB(0)=3/2, max=FNB(±1)=√3 Intuition may suggest IA is easier to integrate, but it will be dead wrong. The code never evaluate the end-points integrand limit, and skip over them. That's why we only have 2^N-1 samples points, instead of 2^N+1. → Trapezoid number, T1 = 0 (*always*) FNB, which T1 should really be 2√3, skewed badly all the romberg numbers. To confirm, I tried doing by hand, with T1=2√3, IA(31+2) = 3.14159265428 FNC does not suffer from this, since limit(FNC, U=-1) = limit(FNC, U=+1) = 0 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)