Re: TI-M: Algebra
[Prev][Next][Index][Thread]
Re: TI-M: Algebra
> I have been working on different
> routines that exact a number, but they are all so slow. Does anyone know
a
> FAST assembly routine to do something like that.
For any rational finite decimal, you just have to make it num/10^x, where x
is the number of decimal places, and then cancel out any common prime
factors of the numerator and denominator until they're relatively prime (ie,
the fraction is fully simplified - the only factor shared by the numerator
and denominator is one). BTW, in this case the denominator's prime factors
will only be 2 and 5.
For rational infinite decimals, they're going to start repeating a pattern
at one point. Take, for example, 5/33 = .15151515... Now, the mathematical
process to "exact" this would be:
let x = .151515...
100x = 15.151515...
(subtract x from both sides)
99x = 15
x = 15/99 = 5/33
So, let y be the decimal place of the last digit xdigit in the first
occurance of this patter (in this case, the second decimal place, which
contains a five). x (the fraction for the infinite decimal) will always
equal the simplified form of [the integer part of x*10^y]/[10^y-1].
Confusing, but it works. I don't know what a good algorithm to find the
spot where it starts repeating is, though, which is probably why the 89's
CAS doesn't attempt to try it =)
I know of no way to "exact" the decimal equivalent of an irrational number,
and I doubt there is one.
> Also, are there any set
> formulas for factoring and other stuff like that.
See below, where I rant about the rational zero test.
> As far as i can tell,
> binomial factoring is just hit an miss, but i could be wrong.
Quadratic formula and see if both roots are integers, at least for
binomials. Or, use a general routine for all polynomials, using the
rational zero test (IIRC, you often use it to find all roots via synthetic
division - the set of all possible rational factors of a polynomial equal to
zero is (+/-){factors of q}/{factors of p}, where p is the coefficient of
the first term and q is the coefficient of the last term) to find all
integer roots.
-Scott
References: