This is why the hp will calculate 6.25! and give a result
You may also want to check there:
http://www.rskey.org/detail.asp?manufacturer=Hewlett-Packard&model=HP-48SX
For an implementation of the gamma function
Arnaud
Exact, like 100!
You want to know the algorithm?
There is no shortcut for exact answers
That's what i figured...I know about the shortcut for approximate
answers, there ar some nice java apps online that use it for factorials
for very high numbers resulting in instant results.
There IS a sort of shortcut that has wide application actually. It is
called 'memo-ization' or caching.
If you want to calc 100! and you have not calculated any factorial
before, then there is no shortcut.
But if you had previously calculated 99! and you wanted 100! there is
an obvious shortcut provided you make it a policy to save (cache) the
value of 99! (Which means you have saved 98! etc.)
The cost is trivial (a couple of hundred memory locations) on large
machines, and the benefits enormous. Not sure if it is viable as a
strategy for calculators, but it is certainly viable for calculator
based programs.
Another example is if you are doing date calculations. Since most dates
of interest are within the last month, you can cache the 'epoch' value
of the beginning of the month, and then do all future date calcs as
offset from there.
and so on.
As I said, the technique has wide application.
pgmer6809
Hi
Arnaud Amiel wrote:
> Actually the hp calculators use a slightly modified Gamma function.
> See there:
> http://en.wikipedia.org/wiki/Gamma_function
>
> This is why the hp will calculate 6.25! and give a result
This is only true for fractional number..
For integers, there's no much choice other than doing it the long way...
JY
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFQ/g+OgesMt/k2XMRAm21AJ9XtkklXQo/7K02oxOSpLTWmR4ZKACfSWQu
gAqgVptQX8vQSPprkk04LGg=
=aYmS
-----END PGP SIGNATURE-----
yours,
Peter Martin.
> I suspect, but don't know, that calculators that just calculate
> integer values use look-up tables.
I doubt that. It's very fast doing 69 multiplications.
Regards
Steen
Right - but with infinite integers of the 49G/49g+/50G
one would need quite a big lookup table
;-)
Indeed, I remember doing that as well.
In particular I recall that my Casio 4000P was exactly twice as slow as my
brother's Casio 7000G -- the first widely-known graphing calculator.
TI calculators often seemed quite slow compared to Casios and Sharps...
Except that the HP-50G (49g+)
is extremely fast in such calculations
but the amount of expensive Static CMOS RAM is limited
(also due to Saturn CPU addressing limitations)