HP Forums
Summation based benchmark for calculators - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Summation based benchmark for calculators (/thread-9750.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13


RE: Summation based benchmark for calculators - Guenter Schink - 04-22-2021 06:33 PM

I think we have new champion -- by quite a margin

Prime G2 Beta 2.1.14549 using Python
Code:
#PYTHON name
from math import *
import sys
import hpprime
t=hpprime.eval("time")
c=int(sys.argv[0])
print()
print("Exponent = ",c)
print("Iterations = ", 10**c)
a=0
for i in range(1, 10**c+1):
    a=a+pow((e**(sin(atan(i)))),1/3) 
print("Time (sec) = ",round(hpprime.eval("time")-t,4))
print("Sum = ",a)
#end
Export sums(c)
Begin
  PYTHON(name, c);
End;

From the Home screen invoke this Python program with sums(?)

where "?" question mark has to be replaced by the exponent which denotes the magnitude
  • 3 for 1000
  • 4 for 10 000
  • 5 for 100 000
  • 6 for 1 000 000

Output will be the exponent, the resulting number, the time and the sum. E.g.
3
1000
0.036 sec
1395.3462877433426


Code:
Results:
3       1 000  0.036 sec     1395.3462877433426
4      10 000  0.159 sec    13955.857904429155
5     100 000  1.425 sec   139560.9761410521
6   1 000 000 14.046 sec  1395612.158725383

I think that's quite impressive specifically when compared with the values for native PPL.

Günter

Edit: put the timing into the Python code rather than using TEVAL


RE: Summation based benchmark for calculators - OlidaBel - 05-01-2021 09:18 AM

Something new to me, maybe a lack of Prime knowledge.
My Prime is configured in RPN (for stack Home computations).

I tried the sum "benchmark" proposed here, then Pick (copy) the first formula to modify it in the command line, I want to run a bigger one, from a 1000 to 10000 sum.
I only added a zero behind "1000", the Editor refuses to validate the formula. Why ?

[Image: wgZJbrL] https://ibb.co/wgZJbrL
[Image: VD2Wzp6] https://ibb.co/VD2Wzp6
[Image: WfpDSGv] https://ibb.co/WfpDSGv


RE: Summation based benchmark for calculators - pier4r - 08-05-2021 04:06 PM

Finally updated up to post #221 (yay after years! Well priorities...)

It took more than 2 hours, so it wasn't that trivial.

Updated also here: http://www.wiki4hp.com/doku.php?id=benchmarks:sum_trig_exp_root
and here: https://osdn.net/users/pier4r/pf/various_works_only_code/scm/blobs/master/rpl_hp48-50/wiki_notes_backup/summation_based_benchmark.txt

I am not so sure about some results regarding 500k with the prime G2. Now you all need to add more entries so that I have to catch up again Big Grin


RE: Summation based benchmark for calculators - Guenter Schink - 08-08-2021 10:59 AM

(08-05-2021 04:06 PM)pier4r Wrote:  Finally updated up to post #221 (yay after years! Well priorities...)

It took more than 2 hours, so it wasn't that trivial.

Updated also here: http://www.wiki4hp.com/doku.php?id=benchmarks:sum_trig_exp_root
and here: https://osdn.net/users/pier4r/pf/various_works_only_code/scm/blobs/master/rpl_hp48-50/wiki_notes_backup/summation_based_benchmark.txt

I am not so sure about some results regarding 500k with the prime G2. Now you all need to add more entries so that I have to catch up again Big Grin

The HP Expander (not XP Expander) is a calculator from HP, not a mobile device. It never saw the light of the markets. I've got a prototype at one of the HHCCs.

Günter


RE: Summation based benchmark for calculators - Massimo Gnerucci - 08-08-2021 11:03 AM

(08-08-2021 10:59 AM)Guenter Schink Wrote:  The HP Expander (not XP Expander) is a calculator from HP, not a mobile device. But I think it never saw the light of the markets. I've got a prototype at one of the HHCCs.

It actually was "HP Xpander".
Have a couple, from different development stages.


RE: Summation based benchmark for calculators - Guenter Schink - 08-08-2021 11:44 AM

(08-08-2021 11:03 AM)Massimo Gnerucci Wrote:  
(08-08-2021 10:59 AM)Guenter Schink Wrote:  The HP Expander (not XP Expander) is a calculator from HP, not a mobile device. But I think it never saw the light of the markets. I've got a prototype at one of the HHCCs.

It actually was "HP Xpander".
Have a couple, from different development stages.

Thanks for the correction. I could have had a closer look either to the device or the Wiki article Smile

Günter


RE: Summation based benchmark for calculators - Felix Stehli - 08-12-2021 08:00 AM

ThetaCalc, an RPN calculator app running on iOS which can be programmed in JavaScript, produced the following result for n = 1000000 on an iPhone 12:

HP museum benchmark (n = 1000000)
Sum = 1395612.1587253837
Time = 0.189 seconds

I don't know, however, whether the app fits into one of the given categories.

Here is the program:

Code:
function benchmark(n) {
  let s = 0;
  for (let i = 1; i <= n; i++) {
    s += Math.pow(
      Math.exp(
        Math.sin(
          Math.atan(i))), 1/3);
  }
  return s;
}

const n = 1000000;
startTimer();
let s = benchmark(n);
stopTimer();
println(`HP museum benchmark (n = ${n})`);
println(`Sum = ${s}`);
printlnElapsed();



RE: Summation based benchmark for calculators - Marc van Lemmen - 08-17-2021 11:04 PM

I recently received a Sharp PC-1201 and was currious how this nice little machine would perform, here are the results :

N=10 ~25s result 13,318529402
N=100 ~285s result 138,90159786
N=1000 ~2844s result 1394,95067416


RE: Summation based benchmark for calculators - toml_12953 - 08-17-2021 11:23 PM

(04-22-2021 06:33 PM)Guenter Schink Wrote:  I think we have new champion -- by quite a margin

Prime G2 Beta 2.1.14549 using Python

When I copy and paste that code into the emulator, I get

Code:
Traceback (most recent call last):  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 10: '10\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'



RE: Summation based benchmark for calculators - Guenter Schink - 08-18-2021 03:09 PM

(08-17-2021 11:23 PM)toml_12953 Wrote:  
(04-22-2021 06:33 PM)Guenter Schink Wrote:  I think we have new champion -- by quite a margin

Prime G2 Beta 2.1.14549 using Python

When I copy and paste that code into the emulator, I get

Code:
Traceback (most recent call last):  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 10: '10\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'

I just also copied it to the virtual Prime. works flawlessly. (?)

The error actually points to line 6 "c=int(sys.argv[0])" Can't assume what's going wrong.

Günter


RE: Summation based benchmark for calculators - toml_12953 - 08-18-2021 04:01 PM

(08-18-2021 03:09 PM)Guenter Schink Wrote:  
(08-17-2021 11:23 PM)toml_12953 Wrote:  When I copy and paste that code into the emulator, I get

Code:
Traceback (most recent call last):  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 10: '10\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'

I just also copied it to the virtual Prime. works flawlessly. (?)

The error actually points to line 6 "c=int(sys.argv[0])" Can't assume what's going wrong.

Günter

I had digit grouping set to 123,456.789. When I change it to 123456.789, I don't get an error but I get a lot of zeroes on the screen and what may be an infinite loop.


RE: Summation based benchmark for calculators - Guenter Schink - 08-18-2021 06:56 PM

(08-18-2021 04:01 PM)toml_12953 Wrote:  I had digit grouping set to 123,456.789. When I change it to 123456.789, I don't get an error but I get a lot of zeroes on the screen and what may be an infinite loop.

o.K. I think I found the problem. It wasn't clearly explained. You have to enter the exponent rather then the number. E.g. enter 3 to get 1000 iterations. Have a look at the code and now it should become obvious.

I chose this because "sys.argv[0]" doesn't seem to work reliably with numbers greater 999. Consequently if it works somehow, the first output is a digit with as many zeros as requested, and that output takes a while.

Günter

edit: I just realized that I can't run the program from the command line I had to go to the program catalog <SHIFT> <1> and run it fro there


RE: Summation based benchmark for calculators - toml_12953 - 08-18-2021 07:18 PM

(08-18-2021 06:56 PM)Guenter Schink Wrote:  
(08-18-2021 04:01 PM)toml_12953 Wrote:  I had digit grouping set to 123,456.789. When I change it to 123456.789, I don't get an error but I get a lot of zeroes on the screen and what may be an infinite loop.

o.K. I think I found the problem. It wasn't clearly explained. You have to enter the exponent rather then the number. E.g. enter 3 to get 1000 iterations. Have a look at the code and now it should become obvious.

I chose this because "sys.argv[0]" doesn't seem to work reliably with numbers greater 999. Consequently if it works somehow, the first output is a digit with as many zeros as requested, and that output takes a while.

Günter

edit: I just realized that I can't run the program from the command line I had to go to the program catalog <SHIFT> <1> and run it fro there

Oof! Es tuit mir leid! Yes, an exponent of 1000 would take a long time! Thank you for replying.


RE: Summation based benchmark for calculators - pier4r - 11-27-2022 10:34 AM

Updated up to post #233
Also the HP Xpander name and category fixed. Hopefully I didn't miss anything.


RE: Summation based benchmark for calculators - BINUBALL - 01-24-2023 01:12 PM

I have bought newer casio model, fx-570CW several months ago and reminded this thread. Test results below:

max = 10000
~ 581s - casio fx-570CW, 13955.8579 (sum function)
max = 1000
~ 59s - casio fx-570CW, 1395.346288 (sum function)
max = 100
~ 7s - casio fx-570CW, 139.297187 (sum function)
max = 10
~ 1s - casio fx-570CW, 13.71183502 (sum function)

fx-570CW is significantly faster than fx-570EX. Let's compare them.

1s / 2s (max = 10)
7s / 12s (max = 100)
59s / 109s (max = 1000)
581s / 1073s (max = 10000)


RE: Summation based benchmark for calculators - BINUBALL - 01-28-2023 09:22 AM

Tested with HP-200LX too.

max = 10000
~ 257s - HP-200LX turbo c 2.01, 13955.857904
max = 1000
~ 27s - HP-200LX turbo c 2.01, 1395.346288
max = 100
~ 4s - HP-200LX turbo c 2.01, 139.297187
max = 10
~ 2s - HP-200LX turbo c 2.01, 13.711835

Code:
#include <math.h>
main()
{
double i,sum;
i=1;
sum=0;
for(i=1;i<=10000;i++)
{
sum+=pow(exp(sin(atan(i))),1/3.);
}
printf("%lf\n",sum);
}



RE: Summation based benchmark for calculators - Eddie W. Shore - 04-05-2023 12:53 PM

Σ( ³√[e^(sin(tan^-1(x)))], x=1 to 1000)

Casio fx-991CW:
Result: 1395.346288
Time: approx. 57 seconds

TI-30X Pro MathPrint (Europe):
Result: 1395.346288
Time: approx. 1 minute, 44 seconds


RE: Summation based benchmark for calculators - Guenter Schink - 04-05-2023 08:01 PM

Once again Python on PRIME

This time using "Generator"
Code:
from math import *
from hpprime import *
Number=input("Enter number:")
Number=int(Number)
print(" {:,d}".format(Number))
t=eval('time')
Sum = sum(pow(e**(sin(atan(i))),1/3) for i in range(1,Number+1)) 
t=eval('time')-t
print("Sum = {:}".format(Sum),"\nTime = {:}".format(round(t,8)))

significantly faster than the previous published Python code (Top of this page). The calculation is done in this one-liner:
>>Sum = sum(pow(e**(sin(atan(i))),1/3) for i in range(1,Number+1)) <<

Code:
10,000      ->   0.101 sec     13955.8579042916
100,000     ->   1.038 sec    139560.9761411052
1,000,000   ->  10.381 sec   1395612.15872538
10,000,000  -> 103.724 sec  13956123.9815476

Günter


RE: Summation based benchmark for calculators - gehakte_bits - 04-10-2023 02:13 PM

HP Prime G2 V.14603 Python
==========================
100.000 -> 0.84s
1.000.000 -> 8.4s
10.000.000 -> 84.1s

optimized post #238:

x=1/3
Sum = sum(exp(sin(atan(i)))**x for i in range(1,Number+1))


RE: Summation based benchmark for calculators - Mike T. - 04-10-2023 10:21 PM

(01-28-2023 09:22 AM)BINUBALL Wrote:  Tested with HP-200LX too.

Couldn't resist trying this on a modern PC...

Code:

#include <math.h>
#include <stdio.h>

void main()
{
  double i,sum;
  i=1;
  sum=0;
  for(i=1;i<=10000;i++)
  {
  sum+=pow(exp(sin(atan(i))),1/3.);
  }
  printf("%lf\n",sum);
}

$ gcc sum.c -o sum -lm
$ time ./sum 
13955.857904

real    0m0.005s
user    0m0.005s
sys    0m0.001s
$