Casio fx-991EX vs Hp 50g speed difference - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: Not HP Calculators (/forum-7.html) +--- Forum: Not remotely HP Calculators (/forum-9.html) +--- Thread: Casio fx-991EX vs Hp 50g speed difference (/thread-11046.html) Casio fx-991EX vs Hp 50g speed difference - Tugdual - 07-13-2018 08:50 PM Found something weird. Was speed testing the fx991ex vs 50g on $$\int_0^{500}e^{-x} dx$$ Results: fx-991EX: result:1 time:6.64s 50g using ->NUM : result:1 time:46.69s Huge difference... Pressing EVAL on the 50g returns instantly $$- \frac {1-e^{500}}{e^{500}}$$ which seems to indicate that CAS was used since this is the exact result. I'm a bit surprised the 50g performs so poorly since I doubt the fx991ex uses any smart CAS behind the scene. Any thoughts on that? RE: Casio fx-991EX vs Hp 50g speed difference - StephenG1CMZ - 07-13-2018 10:36 PM On HP Prime I get result 1-(1/e^500), in 20 ms (Android), using CAS. RE: Casio fx-991EX vs Hp 50g speed difference - Carsen - 07-13-2018 11:13 PM (07-13-2018 08:50 PM)Tugdual Wrote:  I'm a bit surprised the 50g performs so poorly since I doubt the fx991ex uses any smart CAS behind the scene. Any thoughts on that? I can't really say why the HP 50g takes awhile to get an approximate answer for the given integral. I do know that if you take it out of Standard format and put it into a smaller number format like Fix 4, it would get a numeric answer quicker with an accuracy up to the given number format. But you probably knew that already. (07-13-2018 08:50 PM)Tugdual Wrote:  Pressing EVAL on the 50g returns instantly $$- \frac {1-e^{500}}{e^{500}}$$ which seems to indicate that CAS was used since this is the exact result. Weird right? The difference between Exact and Approx. speeds in this case is very interesting and I don't know why that is. I get the answer in 0.70 milliseconds if I want an exact result. And when I press ->NUM on the exact result, it solves the exact answer in .06 milliseconds. This means I can get the approximate result of the integral in .76 milliseconds, beating the Casio. But every attempt to solve the integral approximately, I get a 47 second wait. I'm sorry, I don't have a guess on why it does this. (07-13-2018 10:36 PM)StephenG1CMZ Wrote:  On HP Prime I get result 1-(1/e^500), in 20 ms (Android), using CAS. The Prime is great isn't it? But the 50g getting the same answer in .70 milliseconds is also impressive to me. RE: Casio fx-991EX vs Hp 50g speed difference - Thomas Okken - 07-14-2018 01:45 AM (07-13-2018 08:50 PM)Tugdual Wrote:  Found something weird. Was speed testing the fx991ex vs 50g on $$\int_0^{500}e^{-x} dx$$ Results: fx-991EX: result:1 time:6.64s 50g using ->NUM : result:1 time:46.69s Huge difference... The function e^-x is not very well-behaved for integration over the interval [0, 500], being close to zero for most of it. Everything happens in a small interval near 0, and that kind of thing makes some numerical integrators converge rather slowly. On my HP-42S, which I'm guessing uses the same Romberg integration algorithm as the RPL numerical integrator, the integral in question takes 2047 evaluations of the function (with ACC=0, which is full accuracy), taking 4 minutes and 4 seconds. RE: Casio fx-991EX vs Hp 50g speed difference - Albert Chan - 07-14-2018 03:17 AM I wonder if Casio flush values below 1e-99 to zero, which might save time for integration (flush-to-zero section "converge" to zero area right the way) For a fair test, try limit of 0 to 200 Just curious, is the final result same for both calculator ? RE: Casio fx-991EX vs Hp 50g speed difference - pier4r - 07-14-2018 10:27 AM another result that may be interesting. http://www.hpmuseum.org/forum/thread-9750.html (sum, trig, power/root , exp/log) RE: Casio fx-991EX vs Hp 50g speed difference - ijabbott - 07-14-2018 03:10 PM (07-14-2018 10:27 AM)pier4r Wrote:  another result that may be interesting. http://www.hpmuseum.org/forum/thread-9750.html (sum, trig, power/root , exp/log) I appear to have one of the "fast" batch. The diagnostics show "CY-235 VerB". To enter diagnostics mode, while holding "SHIFT" and "7" together, press "ON", then release all buttons. You should see: Quote:DIAGNOSTIC Press AC (If it doesn't work, press and release "ON" first, then try again.) Pressing "9" in diagnostic mode shows: Quote:8888888888888888 8.888888889x10^15 Then pressing "SHIFT" repeatedly goes through some display tests, ending with: Quote:CY-235 VerB Press AC (The version may be different on the "slow" batch.) Pressing "AC" shows "00" in the top corner of the display. If you press the keys in the correct order, it increments to "01", "02" etc. On the initial diagnostic screen, pressing "8" goes into a more brief keyboard test where various labels get highlighted when you press the corresponding key (although the $$x$$ key is labelled as "[logab]" for some reason!). After pressing all the keys, the display changes to: Quote:Solar MODEL OK! RE: Casio fx-991EX vs Hp 50g speed difference - Tugdual - 07-16-2018 07:07 AM Just for the records mine says CY-235 VerF And seems to belong to the fast batch RE: Casio fx-991EX vs Hp 50g speed difference - brickviking - 07-18-2018 04:28 AM (07-13-2018 08:50 PM)Tugdual Wrote:  Found something weird. Was speed testing the fx991ex vs 50g on $$\int_0^{500}e^{-x} dx$$ Results: fx-991EX: result:1 time:6.64s 50g using ->NUM : result:1 time:46.69s Huge difference... My upgraded 9750GII gave me 1 for that formula: $$\int$$(e^-X,0,500), almost immediately. If I add a tolerance value: $$\int$$(e^-X,0,500,0.01) I get 1.000000014 in about 0.5 seconds for tolerance values of 0.009 to 0.1724, and 1.000050478 (for a tolerance value of >0.1724 to 0.66558). Larger tolerance values affect the result more. It'd be interesting to see whether the 991EX has this tolerance value in the formula it uses. (07-13-2018 08:50 PM)Tugdual Wrote:  Pressing EVAL on the 50g returns instantly $$- \frac {1-e^{500}}{e^{500}}$$ which seems to indicate that CAS was used since this is the exact result. My HP50G gave me $$\frac {e^{500}-1}{e^{500}}$$ instantly instead of $$- \frac {1-e^{500}}{e^{500}}$$ when I hit EVAL from the equation writer. I presume those two are equivalent. I also observed the Approx/Exact discrepancy. (Post 258) RE: Casio fx-991EX vs Hp 50g speed difference - Albert Chan - 07-25-2018 01:50 AM (07-13-2018 08:50 PM)Tugdual Wrote:  Found something weird. Was speed testing the fx991ex vs 50g on $$\int_0^{500}e^{-x} dx$$ Results: fx-991EX: result:1 time:6.64s 50g using ->NUM : result:1 time:46.69s Try this: $$\int_0^{200}sin(x) dx$$ = 1 - cos(200) ~ 0.51281 If 50g returned -96.581, that means: 1. No symbolic processing used for integration 2. Integration by Simpson rule, thus poor performance (and wrong!) RE: Casio fx-991EX vs Hp 50g speed difference - Carsen - 07-25-2018 02:44 AM When I enter the integral in exact mode, I get -(COS(200)-1) in .51 seconds. Then I proceed to get the numerical answer of 0.512812324993 in .04 seconds by executing ->NUM on the equation. Thus, computing it in .55 seconds. When I enter the integral in approx. mode, I get the answer of 0.512812324889 in 111.36 seconds with an error of 1.3E-9. RE: Casio fx-991EX vs Hp 50g speed difference - Albert Chan - 07-25-2018 12:55 PM (07-25-2018 01:50 AM)Albert Chan Wrote:  Try this: $$\int_0^{200}sin(x) dx$$ = 1 - cos(200) ~ 0.51281 If 50g returned -96.581, that means: 1. No symbolic processing used for integration 2. Integration by Simpson rule, thus poor performance (and wrong!) My mistake, Simpson Rule + Romberg's Extrapolation led to a wrong answer Code: Intervals Simpson Rule     Romberg Extrapolation 2         -96.6253287218 4         -96.5838952128   -96.5811329788 8         -96.5813742133   -96.5812072753 16        -96.5812176925   -96.5812072753 32        -96.5812079261   -96.5812072753 Simpson Rule alone will eventually converge: 0.51281 (2048 intervals), 0.5128123250 (32768 intervals) RE: Casio fx-991EX vs Hp 50g speed difference - Albert Chan - 07-25-2018 06:32 PM Just learned there is a trick to use Romberg's method for periodic function: Casio keisan on-line Romberg Integration calculator, option non-linear substitution Code: def nonlinear(f, a, b):     c, d = (b-a)/4, (b+a)/2     return lambda u, k=3*c: k*(1 - u*u) * f(c*u*(3-u*u) + d) Just integrate above transformed f, from -1 to 1: $$\int_0^{200}sin(x) dx$$ = $$\int_{-1}^{1}150(1-u^2) sin[50u (3 - u^2) + 100] du$$ On my Casio FX-115MS, it had gotten the sin(x) integral wrong: -96.581 With transformed integral, after 3 minutes 45 seconds, I got 0.51281 :-) Amazingly, Mathematica can solve the messy transformed integral symbolically: 2 (sin(100))^2 RE: Casio fx-991EX vs Hp 50g speed difference - Carsen - 07-25-2018 08:07 PM (07-25-2018 06:32 PM)Albert Chan Wrote:  Just integrate above transformed f, from -1 to 1: $$\int_0^{200}sin(x) dx$$ = $$\int_{-1}^{1}150(1-u^2) sin[50u (3 - u^2) + 100] du$$ My 50g reduces the transformed integral to -(COS(200)-1) in 1.7 seconds. If I evaluate the same transformed integral in approx. mode, I get the answer of .512812325001 in 61.45 seconds. RE: Casio fx-991EX vs Hp 50g speed difference - Albert Chan - 07-25-2018 10:13 PM (07-25-2018 06:32 PM)Albert Chan Wrote:  Just integrate above transformed f, from -1 to 1: $$\int_0^{200}sin(x) dx$$ = $$\int_{-1}^{1}150(1-u^2) sin[50u (3 - u^2) + 100] du$$ (07-25-2018 02:44 AM)Carsen Wrote:  When I enter the integral in approx. mode, I get the answer of 0.512812324889 in 111.36 seconds with an error of 1.3E-9. (07-25-2018 08:07 PM)Carsen Wrote:  If I evaluate the transformed integral in approx. mode, I get the answer of .512812325001 in 61.45 seconds. For transformed integral, it only take half the time ? And, compare against 1 - cos(200), more accurate ? Is it tested on the same calculator ? What if it were applied not just to periodic function, but others ? Say, this thread original post ? $$\int_0^{500}e^{-x}dx$$ = $$\int_{-1}^{1}375(1-u^2) e^{-(125u (3 - u^2) + 250)} du$$ RE: Casio fx-991EX vs Hp 50g speed difference - Carsen - 07-26-2018 03:01 AM (07-25-2018 10:13 PM)Albert Chan Wrote:  For transformed integral, it only take half the time ? No. It took 0.51 seconds to solve the SIN(X) integral symbolically (This time is found in post #11 in this thread. I apologize for not defining what integral I evaluated in that post). On the other hand, it took 1.7 seconds to solve the transformed SIN(X) integral symbolically (This time is found in post #14 in this thread). Both of them returned the same answer of -(COS(200)-1). (07-25-2018 10:13 PM)Albert Chan Wrote:  And, compare against 1 - cos(200), more accurate ? I would say that 1-COS(200) has the same accuracy as -(COS(200)-1). They both are the same. (07-25-2018 10:13 PM)Albert Chan Wrote:  Is it tested on the same calculator ? Yes. All is tested on the same HP 50g. (07-25-2018 10:13 PM)Albert Chan Wrote:  What if it were applied not just to periodic function, but others ? Say, this thread original post ? $$\int_0^{500}e^{-x}dx$$ = $$\int_{-1}^{1}375(1-u^2) e^{-(125u (3 - u^2) + 250)} du$$ Same as the first integral of SIN(X). Symbolically, the 50g solves the integral e^-x in .76 seconds, while it solves its transformed counterpart in 2.84 seconds. Again, both get the same answer of (e^500-1)/e^500. Here are some pictures of my results. RE: Casio fx-991EX vs Hp 50g speed difference - Albert Chan - 07-26-2018 03:28 AM Hi, Carsen I might have phrase the question poorly. I am not interested in the performance of symbolic solver. Taking longer to solve the transformed integral is not surprising. I am more interested in numerical integration. I noticed your timings in the approx mode, transformed integral solving time is halved, with better accuracy. What is the timings for the transformed exponential integral (in approx mode) ? Tried the transformed exponential integral on my old computer. It speed up both Romberg and Gaussian Quadrature code. RE: Casio fx-991EX vs Hp 50g speed difference - Carsen - 07-26-2018 04:53 PM (07-26-2018 03:28 AM)Albert Chan Wrote:  I might have phrase the question poorly. Possibly but this was the main reason. (07-25-2018 10:13 PM)Albert Chan Wrote:  And, compare against 1 - cos(200), more accurate ? I saw the 1-COS(200) and immediately thought, "that's a symbolic answer so that must be what we are talking about". Of course, I didn't really understand how you could mention accuracy with an symbolic answer but I didn't give that much thought. I should think a little more to see if what I'm am doing (posting, solving, fixing, anything in general). But now that I understand the miscommunication, here is the result. The time it took to evaluate the approx. answer of the transformed integral of e^-x is 234.53 seconds. That's 3 minutes and 54.53 seconds. RE: Casio fx-991EX vs Hp 50g speed difference - Albert Chan - 07-26-2018 07:08 PM Thanks, Carsen for the test. I think the transformed sine integral is faster because it converge slightly faster, skipping 1 Simpson iteration (that is why the halved timing). But, that is just lucky. It could be the other way around, like the transformed exponential integral. 5X slow down possibly caused by 2 extra Simpson iteration for convergence. Transformed integral is not really for performance, but to avoid false convergence. RE: Casio fx-991EX vs Hp 50g speed difference - gomefun2 - 09-03-2018 07:40 PM I know for me personally when I solve the exponential integral on the TI-nspire it takes a really long time depending on the value chosen for x: https://en.wikipedia.org/wiki/Exponential_integral When I program it into my WP34s (real hardware) it takes probably 1/20th the time. This is because I use an algorithm specifically designed to solve the exponential integral quickly. I found in my personal research in regards to integrals of exponential functions that algorithms that are really good at them are generally worse at other types of integrals and vice versa. The HP 50g probably just uses an algorithm that is not very efficient at solving integrals of exponential functions. You could test this by programming the 50g with your own custom solver that is good with exponentials, I'm sure it would be must faster.