Valhalla Legends Forums Archive | Yoni's Math Forum | Program the Rational Roots Theorem Using TI-83 BASIC

AuthorMessageTime
Dynobird
Given that the rational roots theorem states that given a (factorable) polynomial...
{
a_n * x^n + a_n-1 * x^(n-1) ... + a_0
The possible rational roots* are p/q
Where p are the factors of a_0 and q are the factors of a_n.
(The reasoning behind this is the potential roots of (3x-5) will be p/q = 5/3, p/q = -(5/3) since the a_n and q cancel out.)
Note: these factors p and q give you a pool of possible outcomes.  You may have many potential roots that aren't actual roots.
So you must plug them all into your calculator.
}

Make a program that finds all the rational roots for any given (factorable) polynomial.

* rational means it can be expressed as integer/integer
  - for example: .6 barred is rational because its 2/3
  - pi is not, sq. root of 5 also is not
  - negative numbers are also rational, so is zero ( 0 / 1 )

Time-Saver: I used lists for my databases, to store values in them and to iterate through them.
BTW, for those who don't have a keyboard for their TI-83 or don't know the language you can look it up online somewhere and post it here.
Programming on a calc w/o a keyboard is a major pain in the ass.
October 9, 2005, 9:48 PM
CrAzY
If your factoring, its easiest just to program for trinomials...  Those are used most in class :-/
October 12, 2005, 1:21 AM
Yoni
You think we're in class?!
October 12, 2005, 2:27 AM
rabbit
T.T
I'm doing this in number theory now...except with Gaussian integers and not a calculator (go pen + paper).  I don't have a keyboard for my calculator, yet I program all the time.  In fact, here is the bestest program ever:
[tt]:A->0
:Lbl 1
:A+1->A
:Disp A
:Goto 1[/tt]

I honestly have no idea how to start this out...
October 13, 2005, 10:06 PM
Dynobird
Hints:
Utilize your calculator's easy-to-use extensive math capabilities.
I mean, compare this to Sun's pitiful java.lang.Math !
So when getting factors, you can use the greatest integer function (or rounding).
Example, is p/q a factor? If p/q == greatestinteger(p/q) then p/q = factor.

Of course, in calculator BASIC you write to lists to store your factors.
So here's an example:

[code]
:1 -> I                          // for index
:If p/q == int(p/q)
:Then
:p/q -> L_1(I)
:I+1 -> I
:END                      // WTF did they not make ++/-- operators!
[/code]

I know this is not a fun thing to program, lol, but it's really useful if you take precalc or are going to.
Especially once you combine it with a program that does quadratic formula, quadr. formula with complex numbers,
and a program that reads from a table in order to find irrational roots (still working on that!)
In a precalc class, this program (** if efficient **) would be like the power of the sun in the palm of your hand!
(Yes, I know it's a spiderman reference ::) )
October 18, 2005, 8:58 PM
JoeTheOdd
[quote author=rabbit link=topic=12997.msg130917#msg130917 date=1129241170]
T.T
I'm doing this in number theory now...except with Gaussian integers and not a calculator (go pen + paper). I don't have a keyboard for my calculator, yet I program all the time. In fact, here is the bestest program ever:
[tt]:A->0
:Lbl 1
:A+1->A
:Disp A
:Goto 1[/tt]

I honestly have no idea how to start this out...
[/quote]

[pre]:Lbl 1
:Disp "Hello."
:Goto 1[/pre]
November 5, 2005, 6:05 AM
rabbit
That's crap.
November 5, 2005, 5:01 PM
Ender
The rational roots theorem says that given the polynomial:

(Ax-a)(Bx-b)(Cx-c) ...

The possible factors roots, x, are  a/A  b/B  c/C etc. You can find these by taking the factors of the constant term and the coefficient of the leading term, since ABC ... are multiplied together to make the coefficient of the leading term, and abc ... are multiplied together to make the constant term.  Factoring the constant term and the coefficient of the leading term get you the possible pool of factors.

This is very useful for factoring a polynomial in expanded form

Such as ax[sup]n[/sup] + bx[sup]n-1[/sup] + ... +  the constant term.

So to program this on your calculator, you take the coefficient of the leading term. TI-83's don't have the mod function, but you can use the greatest integer function or the rounding function in place of this. The greatest integer function looks like int( ) in math -> num.

The simplest factoring program to make just takes an integer n and divides it by 1, 2, 3, 4, ... , n and sees if the integer n / possible factor == int ( n / possible factor)         

So for instance, if 4 is a factor of 6, then 6/4 == int ( 6 / 4 ) => 1.5 == 1    And we see that four is not a factor of six.

After you factor the coefficient of the leading term and the constant term, plug in the factors of the constant term divided by the factors of the coefficient of the leading term as x. Obviously, you will need a few loops to do this. Less obviously, you are best off using lists to store your data.
November 19, 2005, 5:25 PM

Search