FixYa.com
Technical Support, Instructions & Repair Service


Tags:

Casio FX-250HC Calculator

Calculator overflow?

By maartenw - usenet poster


With its built in nCr function, a calculator
(Casio fx-250HC fraction) evaluates C(343,39) as
3.903378076*10^51. But when asked to evaluate
C(343,40), it returns "-E-", as if an
overflow error had occurred. But
C(343,40) = 343!/(40!303!) = 343!304/(39!40*304!)
= (304/40)*C(343,39), which is well within the
calculator's displayable range (just short of 10^100).
What is going on here? Why does the calculator
not evaluate C(343,40) as (304/40)*C(343,39)
= (304/40)*3.903378076*10^51 = 2.966567338*10^52 ?

-- Mark Spahn

This Problem has been added to the Share Your Expertise Page under "My Work Queue".
Best Solution
posted on Aug 02, 2007
FixYa! (100)

Lizzy

Lizzy - usenet poster

Rank:Apprentice Apprentice
Rating: 0%, 0 votes
...

Patrick, Do you have any specifics on what such a "heavily optimised
numerical approximation based on fast-conversion series" would be?
But in any case, this is peculiar. It's like the calculator designers are
saying,
"Our fast algorithm can handle C(343,39), so we'll give you that,
but if you ask for C(343,40), our fast algorithm can't handle it,
so rather than give you an answer could easily be computed,
albeit more slowly, we'll refuse to give you any answer at all."
How does this benefit calculator users? I think most would want
a correct, slow answer rather than an "I give up!" answer.
A naive program I quickly wrote on a programmable calculator
(Casio FX-502P) takes 28 seconds to compute that
C(343,144) = 9.322744238*10^99.
C(343,145) overflows, being greater than 10^100. -- Mark

Was this solution helpful? Show your Appreciation by rating it:

Solution #2
posted on Aug 02, 2007
Not Rated (0)

Kim1

Kim1 - usenet poster

Rank:Apprentice Apprentice
Rating: 0%, 0 votes
Just a guess but if they calculated the answer as
(343*342304)/(40*391)
the numerator would exceed 1e100 and give you overflow problems.

Ian Smith

Was this solution helpful? Show your Appreciation by rating it:

Solution #3
posted on Aug 02, 2007
Not Rated (0)

Pasty

Pasty - usenet poster

Rank:Apprentice Apprentice
Rating: 0%, 0 votes
This is heading into the science of numerical methods, not my forte. I'll throw
this one to the panel.

Unfortunately manufacturer-specific details are sparse, mainly because the
manufacturers regard the details of their numerical methods as valuable
intellectual property.

I have no specifics on the Casio, and nothing obvious pops up with Google, but
you can get an idea of the sort of thing they use by studying Numerical Methods
in general, eg here is a page for Mathematica:
#

A sample:

Combinatorial functions

Most combinatorial functions use sparse caching and recursion.

Factorial, Binomial and related functions use a divide-and-conquer algorithm to
balance the number of digits in subproducts.

Fibonacci[n] uses an iterative method based on the binary digit sequence of n.

PartitionsP[n] uses Euler's pentagonal formula for small n, and the
non-recursive Hardy-Ramanujan-Rademacher method for larger n.

ClebschGordan and related functions use generalized hypergeometric series.


Of course all of Mathematica's methods are designed in such a way as to avoid
the overflow problems you found, and they have plenty more CPU and RAM at their
disposal.
--
Patrick Hamlyn posting from Perth, Western Australia
Windsurfing capital of the Southern Hemisphere
Moderator: polyforms group ()

Was this solution helpful? Show your Appreciation by rating it:

Solution #4
posted on Aug 02, 2007
Not Rated (0)

Jimmy NY

Jimmy NY - usenet poster

Rank:Apprentice Apprentice
Rating: 0%, 0 votes
It's more likely that it uses some sort of heavily optimised numerical
approximation based on a fast-converging series.
--
Patrick Hamlyn posting from Perth, Western Australia
Windsurfing capital of the Southern Hemisphere
Moderator: polyforms group ()

Was this solution helpful? Show your Appreciation by rating it:

Solution #5
posted on Aug 02, 2007
Not Rated (0)

lawyer

lawyer - usenet poster

Rank:Apprentice Apprentice
Rating: 0%, 0 votes
...

I suppose my question really is, What algorithm does this calculator use
that allows it to compute C(343,39) = 343!/(39!304!) but makes it
unable to compute C(343,40) = 343!/(40!303!) ?
We know that it does not first calculate 343! and then divide,
because calculating 343! will cause overflow. My guess is that
it calculates C(343,39) by (343/39)*(342/38)(306/2)*(305/1),
thus avoiding overflow. So a similar calculation of
C(343,40) by (343/40)*(342/39)(305/2)*(304/1)
should similarly avoid overflow, but doesn't. What explains this?
-- Mark Spahn (West Seneca, NY, USA)

Was this solution helpful? Show your Appreciation by rating it:

Solution #6
posted on Aug 02, 2007
Not Rated (0)

paulrmc

paulrmc - usenet poster

Rank:Apprentice Apprentice
Rating: 0%, 0 votes
There isn't actually a little person in there doing the calculation, and making
tricky algorithmic decisions on the fly. Very early calculator models that did
this were impractical and only made an appearance in the circus, on stage etc.

What they do nowadays is pre-define an algorithm suitably simple for the tiny
electronic brain of the calculator, which unfortunately is not terribly
creative.
--
Patrick Hamlyn posting from Perth, Western Australia
Windsurfing capital of the Southern Hemisphere
Moderator: polyforms group ()

Was this solution helpful? Show your Appreciation by rating it:

Can you Help with these Calculators problems?

Calculators
Problem withi scientific...
How do i restore the basic math... Answer This...
Casio FX-250HC Calculator
calculator...
I'm trying to get rid of this... Answer This...
Casio FX-250HC Calculator
casio fx-250hc
I can't get the rad grad or deg... Answer This...
Casio FX-250HC Calculator
calculator freezes
I have a fx-260 solar casio... Answer This...
Casio FX-250HC Calculator
standard deviation- variance...
how to calculate standard... Answer This...
Repair Service
Find Calculator Repairman Near You:

FixYa does not evaluate or guarantee the accuracy of any information provided through its proposed solutions, posts, or Expert Assistance Sessions. By entering this site you declare you read and agreed to its Terms. You may NOT copy or distribute the content that appears on this site without written permission from FixYa Inc.
© 2005-2008, FixYa, Inc. or its affiliates
When the original poster rates a solution that was given to his own problem, that rating is locked!
X

Are you sure the solution content is Inappropriate?
   
Tech buddies can communicate directly to answer questions. Become a Tech Buddy and have direct access to your favorite expert for FREE!