Post Reply 
Integration: TI-86 & Casio Algebra 2.0 Plus
03-23-2024, 05:09 PM (This post was last modified: 03-23-2024 05:16 PM by carey.)
Post: #1
Integration: TI-86 & Casio Algebra 2.0 Plus
Valentin’s excellent set of 2024 PI day examples for vintage HP calculators includes in the 1st example the integral \( \int_{0}^{1} \frac{tan^{-1} tanh^{-1} x}{x} dx \). When attempting this integral on two of my favorite non-hp calculators, the TI-86 and the Casio Algebra 2.0 Plus, I found it interesting that the TI-86 proceeded (albeit slowly) to an answer (screenshot 1) but the Casio Algebra 2.0 Plus gave an “Ma Error” (math error) if either the lower limit was 0 or, independently, if the upper limit was 1 (only one screenshot shown) and it was necessary to back away slightly from both limits of integration (0 and 1, substituting, for example, 0.001 and 0.999) to obtain a result.

My guess is that the Casio “freaked out” (to use technical language :) at the lower integration limit of 0 because of apparent division by 0 and ignored that the integrand approaches a limit of 1 at x=0. My guess for the Casio balking at the upper integration limit of 1 is that it’s a cusp, and ignored that the integrand approaches a limit of \( \frac{\pi}{2} \) at x=1.

I’d be interested in hearing your thoughts about this discrepancy between the numerical integration methods and results for these two calculators. Thanks!


Attached File(s) Thumbnail(s)
           
Find all posts by this user
Quote this message in a reply
03-27-2024, 12:10 PM
Post: #2
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
(03-23-2024 05:09 PM)carey Wrote:  the TI-86 proceeded (albeit slowly)

That's just how the TI-86 does things. Big Grin It's a great calculator (maybe TI's best) despite the slowness.
Visit this user's website Find all posts by this user
Quote this message in a reply
03-27-2024, 01:56 PM (This post was last modified: 03-27-2024 01:59 PM by carey.)
Post: #3
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
(03-27-2024 12:10 PM)Dave Britten Wrote:  
(03-23-2024 05:09 PM)carey Wrote:  the TI-86 proceeded (albeit slowly)
That's just how the TI-86 does things. Big Grin It's a great calculator (maybe TI's best) despite the slowness.

Thanks Dave for your reply and yes, I agree with all the above and appreciate that you once pointed out that the TI-85, rather than being fully replaced by the TI-86, has several unique advantages, including speed.

Now if only I could figure out how to get the Ti85/86 (or the HP48g) to perform numerical integration of a complex function with real limits. Despite the TI85/86's wide range of complex function handling, when I try integrating a complex function between real limits, e.g., \( \int_0^\pi e^{iz}dz \) (which should evaluate to 0+2i, or (0,2) on the TI85/86 as it doesn't have the imaginary i), I get the infamous "ERROR 10 DATA TYPE" message after entering fnInt(e^((0,1)*Z),Z,0,\(\pi\)).

Integrating complex functions may be beyond the limits of what the TI-85/86 can do and is a reason for keeping a TI Voyage200 (or HP50g) handy. While I like the TI-89 keyboard (the only calculator that gives top-level access to the "with" operator |), the small font size, as has often been remarked, renders the TI-89 nearly unusable for older eyes, like mine!.
Find all posts by this user
Quote this message in a reply
03-27-2024, 07:58 PM
Post: #4
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
(03-23-2024 05:09 PM)carey Wrote:  Valentin’s excellent set of 2024 PI day examples for vintage HP calculators includes in the 1st example the integral \( \int_{0}^{1} \frac{tan^{-1} tanh^{-1} x}{x} dx \). When attempting this integral on two of my favorite non-hp calculators, the TI-86 and the Casio Algebra 2.0 Plus, I found it interesting that the TI-86 proceeded (albeit slowly) to an answer (screenshot 1) but the Casio Algebra 2.0 Plus gave an “Ma Error” (math error) if either the lower limit was 0 or, independently, if the upper limit was 1 (only one screenshot shown) and it was necessary to back away slightly from both limits of integration (0 and 1, substituting, for example, 0.001 and 0.999) to obtain a result.

My guess is that the Casio “freaked out” (to use technical language Smile at the lower integration limit of 0 because of apparent division by 0 and ignored that the integrand approaches a limit of 1 at x=0. My guess for the Casio balking at the upper integration limit of 1 is that it’s a cusp, and ignored that the integrand approaches a limit of \( \frac{\pi}{2} \) at x=1.

I’d be interested in hearing your thoughts about this discrepancy between the numerical integration methods and results for these two calculators. Thanks!

For reference, here are a few timings and results for integrating the above problem using some of the calculators I had handy. The Casio fx-991EX is the only one that gave an error if I used the limits of 0 to 1.

Model, lower limit, upper limit, timing = result
------------------------------------------------------
HP Prime (simulation), 0, 1, instant = 1.02576051093
Casio fx-CG50, 0, 1, 2.5 seconds = 1.025760511
Casio fx-991EX, .0001, .9999, 16 seconds = 1.025521692
HP 35s, 0, 1, (FIX 4) 7 seconds = 1.02574948999
HP 35s, 0, 1, (FIX 5) 14 seconds = 1.02575840691
HP 35s, 0, 1, (FIX 6) 45 seconds = 1.02576041372
HP-48G, 0, 1 4.5, (fix 5) 4.5 seconds = 1.02575840691
HP-48G, 0, 1 4.5, (fix 7) 29 seconds = 1.02576049152
TI-89, 0, 1, 18 seconds = 1.0257605126
Visit this user's website Find all posts by this user
Quote this message in a reply
03-27-2024, 09:23 PM (This post was last modified: 03-27-2024 11:41 PM by carey.)
Post: #5
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
(03-27-2024 07:58 PM)Steve Simpkin Wrote:  For reference, here are a few timings and results for integrating the above problem using some of the calculators I had handy. The Casio fx-991EX is the only one that gave an error if I used the limits of 0 to 1.

Model, lower limit, upper limit, timing = result
------------------------------------------------------
HP Prime (simulation), 0, 1, instant = 1.02576051093
Casio fx-CG50, 0, 1, 2.5 seconds = 1.025760511
Casio fx-991EX, .0001, .9999, 16 seconds = 1.025521692
HP 35s, 0, 1, (FIX 4) 7 seconds = 1.02574948999
HP 35s, 0, 1, (FIX 5) 14 seconds = 1.02575840691
HP 35s, 0, 1, (FIX 6) 45 seconds = 1.02576041372
HP-48G, 0, 1 4.5, (fix 5) 4.5 seconds = 1.02575840691
HP-48G, 0, 1 4.5, (fix 7) 29 seconds = 1.02576049152
TI-89, 0, 1, 18 seconds = 1.0257605126

Thanks Steve, this is very helpful! It’s also very telling that the only two cases of integration hiccups with this composite trig function are both Casio models (Algebra 2.0 & 991EX), yet the Casio CG50 (and also CG500) handle it fine.

For a comparison of digits, here’s Wolfram Alpha’s result: 1.025760510931330450398548660969552795334871856215069394223386844015851920899070​94222678787919779530713296457148872019952569383155579574734512368046551

It looks like the HP Prime’s result is closest to Wolfram’s Alpha’s result. Since this numerical integration is obtained iteratively and the Prime is the fastest of the lot, I wonder if that’s part of the reason the Prime reaches greater accuracy by the time it reports its result.
Find all posts by this user
Quote this message in a reply
03-27-2024, 10:24 PM
Post: #6
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
(03-27-2024 09:23 PM)carey Wrote:  
(03-27-2024 07:58 PM)Steve Simpkin Wrote:  For reference, here are a few timings and results for integrating the above problem using some of the calculators I had handy. The Casio fx-991EX is the only one that gave an error if I used the limits of 0 to 1.

Model, lower limit, upper limit, timing = result
------------------------------------------------------
HP Prime (simulation), 0, 1, instant = 1.02576051093
Casio fx-CG50, 0, 1, 2.5 seconds = 1.025760511
Casio fx-991EX, .0001, .9999, 16 seconds = 1.025521692
HP 35s, 0, 1, (FIX 4) 7 seconds = 1.02574948999
HP 35s, 0, 1, (FIX 5) 14 seconds = 1.02575840691
HP 35s, 0, 1, (FIX 6) 45 seconds = 1.02576041372
HP-48G, 0, 1 4.5, (fix 5) 4.5 seconds = 1.02575840691
HP-48G, 0, 1 4.5, (fix 7) 29 seconds = 1.02576049152
TI-89, 0, 1, 18 seconds = 1.0257605126

Thanks Steve, this is very helpful! It’s also very telling that the only two cases of integration hiccups with this composite trig function are both Casio models (Algebra 2.0 & 991EX), yet the Casio CG50 (and also CG500) handle it fine.

For a comparison of digits, here’s Wolfram Alpha’s result: 1.02576051093133045039854866096955279533487185621506939422338684
40158519208990709422267878791977953071329645714887201995256938
3155579574734512368046551

It looks like the HP Prime’s result is closest to Wolfram’s Alpha’s result. Since this numerical integration is obtained iteratively and the Prime is the fastest of the lot, I wonder if that’s part of the reason the Prime reaches greater accuracy by the time it reports its result.

Very interesting.
I forgot to test Free42 and Plus42.
Free42 (and the DM42) is even more precise than the HP Prime.
Here is the 34-digit result from Free42 (Decimal) and Plus42. The timings were done on an old 2011 Win7 PC and an iPhone 12. Free42 uses an RPN program while Plus42 uses an algebraic equation from its equation list (which makes it run a bit slower).

Free42 (Decimal-Win), 0, 1, (acc=0) 7.5 seconds = 1.025760510931324876159041385002141
Plus42 (Decimal-Win), 0, 1, (acc=0) 8.5 seconds = 1.025760510931324876159041385002141
Free42 (iPhone 12), 0, 1, (acc=0) 3.0 seconds = 1.025760510931324876159041385002141
Plus42 (iPhone 12), 0, 1, (acc=0) 4.0 seconds = 1.025760510931324876159041385002141

The results differ from Wolfram Alpha starting at the 14th decimal place.
1.025760510931330450398548660969552 (Wolfram Alpha)
1.025760510931324876159041385002141 (Free42)
Visit this user's website Find all posts by this user
Quote this message in a reply
03-28-2024, 12:13 AM (This post was last modified: 03-28-2024 02:57 PM by carey.)
Post: #7
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
(03-27-2024 10:24 PM)Steve Simpkin Wrote:  The results differ from Wolfram Alpha starting at the 14th decimal place.
1.025760510931330450398548660969552 (Wolfram Alpha)
1.025760510931324876159041385002141 (Free42)
Impressive. I was always curious whether the high precision Free42 uses in calculations translates into actual precision of results since the choice of algorithms implemented in a calculator also makes a difference. However, this example shows Free 42's high precision is real.

Just to add some 15c results, in the original 2024 pi day thread, C.Ret includes a 15c program and obtained 1.02576051 with Fix 8. I'm away from my 15C CE, but using HP's 15C Iphone app set to Fix 9, the results are: 1.025760511, which agrees with Wolfram Alpha rounded to 9 decimal places.
Find all posts by this user
Quote this message in a reply
03-28-2024, 02:27 AM
Post: #8
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
The CASIO fx-991CW, using endpoints of 1*10^-17 to 1-1*10^-17 produces 1.025760511 after 32 seconds.
Find all posts by this user
Quote this message in a reply
03-28-2024, 04:40 AM (This post was last modified: 03-28-2024 04:41 AM by Steve Simpkin.)
Post: #9
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
(03-28-2024 02:27 AM)lrdheat Wrote:  The CASIO fx-991CW, using endpoints of 1*10^-17 to 1-1*10^-17 produces 1.025760511 after 32 seconds.

That is a better approach to the limit extremes required for the lower cost Casios. On the fx-991EX I can only go down to 1*10^-12 for the lower limit and up to 1-1*10^-12 for the upper limit. This produces 1.025760511 after 35 seconds.

Casio fx-991EX, 1*10^-12, 1-1*10^-12, 35 seconds = 1.025760511
Visit this user's website Find all posts by this user
Quote this message in a reply
03-28-2024, 02:38 PM
Post: #10
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
DM 32:

Code:
F01 LBL F
F02 RAD
F03 INPUT X
F04 ATANH
F05 ATAN
F06 RCL÷ X
F07 RTN

Set FN = F, and integral variable to X, ALL mode:
Result: 1.02574948999

TI-36X Pro: 1.025759818 (about 48 seconds)
TI-30X Pro MathPrint: 1.025759818 (about 20 seconds)
Casio fx-CG 50: 1.025760511
Visit this user's website Find all posts by this user
Quote this message in a reply
03-28-2024, 03:21 PM (This post was last modified: 03-28-2024 06:16 PM by klesl.)
Post: #11
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
points 0;1
fx-9860g slim - approx 6.5s, 1.025760511
fx-5800P - approx 55.5s, 1.025760511
Sharp EL-9950 - approx. 4.5s, 1.025759818
--------------------------------------------------
fx-CG 50, Casio Basic, Gauss–Kronrod quadrature formula, n=10 - less than 1s, 1.025574982
Find all posts by this user
Quote this message in a reply
03-28-2024, 04:02 PM (This post was last modified: 03-28-2024 04:06 PM by carey.)
Post: #12
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
(03-28-2024 02:38 PM)Eddie W. Shore Wrote:  DM 32:

Code:
F01 LBL F
F02 RAD
F03 INPUT X
F04 ATANH
F05 ATAN
F06 RCL÷ X
F07 RTN

Set FN = F, and integral variable to X, ALL mode:
Result: 1.02574948999

Thanks Eddie! I'm surprised by the DM32 result that rounds to 1.02575 whereas Wolfram Alpha and several other calculator results in this thread round to 1.02576. Hence, the above DM32 result appears to be accurate only to 4 decimal places.

From the DM32 manual: "Once the integral is calculated, the estimated uncertainty of the integral’s result is stored in the y-register. To view the value of the uncertainty, press x⇔y."
It would be interesting to know the uncertainty value stored in the y-register for the above DM32 result.

Also from the DM32 manual: "To control the level of accuracy in the integration, adjust the display format to show only the number of digits that are deemed accurate for the integrand’s values. This chosen level of accuracy will also be reflected in the calculated integral result." While it is common to change a calculator's display format (e.g., changing FIX 4 to FIX 7) for greater accuracy, since the above DM32 result is already expressed to 11 decimal places, yet appears accurate to only 4, is increased accuracy via display format change an option in this example?
Find all posts by this user
Quote this message in a reply
03-28-2024, 04:46 PM
Post: #13
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
Stock HP71 with MathPac
Radians mode. 8^)

Relative error: 1E-6
Value: 1.02576041372
Time: 35 sec

Relative Error: 1E-11
Value: 1.02576051092
Time: ~84 minutes

I wish the HP71 would give an indication that it was doing something.
Find all posts by this user
Quote this message in a reply
03-28-2024, 07:03 PM (This post was last modified: 03-30-2024 12:11 PM by Albert Chan.)
Post: #14
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
Hi, KeithB

The problem for HP71B is that integrand, after u-transformed, is still inverted U shaped.

We would really like bell shaped, for efficient integration.
One way is to apply u-transform twice. (1 explicit, 1 internal)

10 DEF FNF(X)=ATAN(ATANH(X))/X
20 DEF FNU(U)=FNF(U*U*(3-2*U))*6*U*(1-U)
30 DISP INTEGRAL(0, 1, 1E-10, FNU(IVAR))
>run
 1.02576051093

Or, remove cusp at x=1. Let x=1-u^2, turn curve close to a straight line.
Internal u-transform will again get a bell shaped curve.

>20 DEF FNU(U)=FNF(1-U*U)*2*U
>run
 1.02576051093

Or, pick a curve close to what we had, and we know its area.
Let y = atanh(x) --> x = tanh(y) --> dx = sech(y)^2 dy

∫(atan(atanh(x))/x, x = 0 .. 1) = ∫(atan(y)/tanh(y) * sech(y)^2, y = 0 .. ∞)

Cas> series(atan(y), y)      → y - 1/3*y^3 + 1/5*y^5 + y^6*order_size(y)
Cas> series(tanh(y),y)       → y - 1/3*y^3 + 2/15*y^5 + y^6*order_size(y)

atan(y)/tanh(y) = 1 + 1/15*y^4 + ... ≈ 1 if y is small,
And, we know ∫(sech(y)^2, y = 0 .. ∞) = ∫(1, x = 0 .. 1) = 1

2 curves are close, and its difference give a nice bell curve, easy to integrate.

plot (atan(y)/tanh(y)-1) * sech(y)^2, y = 0 ..​ 10

>INTEG(.01, 100, 1E-9, (ATAN(IX)/TANH(IX)-1) / COSH(IX)^2)
 2.57605109301E-2
>1+RES
 1.02576051093
Find all posts by this user
Quote this message in a reply
03-28-2024, 07:56 PM
Post: #15
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
(03-28-2024 02:38 PM)Eddie W. Shore Wrote:  DM 32:

Code:
F01 LBL F
F02 RAD
F03 INPUT X
F04 ATANH
F05 ATAN
F06 RCL÷ X
F07 RTN

Set FN = F, and integral variable to X, ALL mode:
Result: 1.02574948999

TI-36X Pro: 1.025759818 (about 48 seconds)
TI-30X Pro MathPrint: 1.025759818 (about 20 seconds)
Casio fx-CG 50: 1.025760511

Eddie, the results from the DM32 are interesting. An emulation of the HP-32SII set to the same setup values has a result of 1.02576051092 which is considerably more accurate than the DM32.


For reference, here are the results of a few more calculator models:
HP-42S (emulation), 0, 1, (acc=0) 39 seconds = 1.02576051093
HP-32SII (emulation), 0, 1, (All) 17 seconds = 1.02576051092
HP-32 (emulation), 0, 1, (FIX 10) 7 seconds = 1.02576051092
Casio fx-115ES Plus, 1*10^-12, 1-1+10^-12, 205 seconds = 1.025760511
HP 35s (simulation), 0, 1, (FIX 9) 120 seconds = 1.02576051072
Visit this user's website Find all posts by this user
Quote this message in a reply
03-28-2024, 08:13 PM
Post: #16
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
(03-28-2024 07:03 PM)Albert Chan Wrote:  We would really like bell shaped, for efficient integration.

This is the idea behind Tanh-sinh quadrature
Transform integrand to bell-shaped, then sum rectangle areas.

Cas> N := 0
Cas> f(x) := BEGIN N+=1; atan(atanh(x))/x-1; END
Cas> quad(f, 0, 1)

2.57605109313e-2, 4.33754153356e-9

Cas> Ans[1]+1, N

1.02576051093, 30
Find all posts by this user
Quote this message in a reply
03-28-2024, 10:48 PM
Post: #17
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
Regarding the TI-30X Pro MathPrint, if one goes to the last choice on the math menu, choice 8, fnInt( and chose an epsilon of 1*10^-12, it finds an answer of 1.025760511 after ~82 seconds.
Find all posts by this user
Quote this message in a reply
03-30-2024, 12:11 AM
Post: #18
RE: Integration: TI-86 & Casio Algebra 2.0 Plus
(03-28-2024 02:38 PM)Eddie W. Shore Wrote:  TI-36X Pro: 1.025759818 (about 48 seconds)
TI-30X Pro MathPrint: 1.025759818 (about 20 seconds)

The TI-84 Plus Pocket SE gave the same result as the TI-36X Pro and the TI-30X Pro MathPrint quoted above, but in around 6 seconds (8X faster than the TI-36X and 3X faster than the TI-30X).
Find all posts by this user
Quote this message in a reply
Post Reply 




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