Using the full toolkit? Read the step-by-step Polynomial Toolkit guide for quartic, cubic, and quadratic workflows, worked examples, and a reminder to keep every root you find.
algebra · MIT License
Overview
Count sign changes in f(x) and f(-x) to list the possible numbers of positive and negative real zeros.
- Tested on a TI calculator
- Downloaded 81 times
- Version 1.0.1
- 2612 bytes
- No imports
Tried it? Did this program work on your calculator?
Before you run it
- TI-84 Plus CE Python · tested on OS 5.8.3, Python App 5.8.3.0048
- TI Connect CE .py conversion to a Python AppVar in RAM; physically tested one program at a time
- Zero coefficients are ignored when counting sign changes.
- Descartes' Rule gives possible counts, not the actual zeros.
- A negative degree is not a valid polynomial input.
Try the DuckieDai calculator screen
Follow the program's prompts and result flow before downloading.
TI-84 Plus CE Python · screen preview
Learn the math
How Descartes' Rule of Signs works
The idea
Descartes' Rule of Signs predicts how many positive and negative real zeros a polynomial can have, just from the signs of its coefficients.
Count how many times the sign changes from one term to the next. The number of positive real zeros is that count, or less than it by an even number.
The formula
positive zeros: sign changes in f(x), or fewer by 2, 4, ...
negative zeros: sign changes in f(-x), or fewer by 2, 4, ...
f(x)- the polynomial with terms in descending order
f(-x)- the same polynomial with the sign of every odd-power term flipped
Using the program
- Enter the degree, then each coefficient from the highest power down.
- The program lists the possible numbers of positive zeros, then negative zeros, then the sign-change counts.
Worked example
For x^3 - 6x^2 + 11x - 6, enter degree 3 and the coefficients 1, -6, 11, -6.
The signs go +, -, +, -, which is three changes. The program shows POSITIVE ZEROS 3 or 1 and NEGATIVE ZEROS 0.
Tips and common mistakes
- The rule gives possibilities, not a final count.
- Skip zero coefficients when counting sign changes.
- Zeros that are not real come in pairs, which is why the count drops by twos.
Where this comes up
Descartes' Rule of Signs is taught with the Rational Zero Theorem in precalculus and college algebra, to cut down the list of candidates before testing them.
Go further: How to Find All the Zeros of a Polynomial
Exact reviewed bytes
Source code
"""DuckieDai Descartes Rule Solver for TI-84 Plus CE Python."""def duckiedai_intro(program_name, wait=True):title = program_name[:16]empty = 16 - len(title)left = empty // 2right = empty - leftprint("+----------------------+")print("| " + " " * left + title + " " * right + " |")print("| |")print("| __ |")print("| ___(o )> quack! |")print("| \\ <_. ) |")print("| `---' |")print("| by DuckieDai |")print("| hiddenwordscanner.com|")print("+----------------------+")print("Loading...")if wait:input("Press enter to start ")print("\n" * 8)def clear_screen():print("\n" * 8)def count_changes(values):signs = []for value in values:if value > 0:signs.append(1)elif value < 0:signs.append(-1)changes = 0for i in range(1, len(signs)):if signs[i] != signs[i - 1]:changes += 1return changesdef possible_zeros(changes):answers = []while changes >= 0:answers.append(changes)changes -= 2return answersdef show_answers(title, answers):clear_screen()print(title)print("-------------")for i in range(len(answers)):if i > 0:print(",", end="")print(answers[i], end="")print("")input("\nPress enter ")def run_test():clear_screen()print("DESCARTES RULE")print("Enter polynomial")print("")degree = int(input("Degree: "))coeffs = []power = degreewhile power >= 0:if power == 0:value = float(input("Const: "))elif power == 1:value = float(input("x coef: "))else:value = float(input("x^" + str(power) + ": "))coeffs.append(value)power -= 1pos_changes = count_changes(coeffs)neg_coeffs = []power = degreefor value in coeffs:neg_coeffs.append(-value if power % 2 == 1 else value)power -= 1neg_changes = count_changes(neg_coeffs)show_answers("POSITIVE ZEROS", possible_zeros(pos_changes))show_answers("NEGATIVE ZEROS", possible_zeros(neg_changes))clear_screen()print("SIGN CHANGES")print("------------")print("Positive:", pos_changes)print("Negative:", neg_changes)duckiedai_intro("Descartes Rule")while True:run_test()print("")if input("Again? y/n: ").lower() != "y":breakclear_screen()print("DuckieDai says: done!")
- Filename
DESCART.py- Size
- 2612 bytes
- SHA-256
e310762456142a6f658562caf34388eeabfb84a2c14e2a70a6bb199a1659018b
Usage
Inputs
- Polynomial degree
- Coefficient of every power from the leading term through the constant
Outputs
- Possible positive-real-zero counts
- Possible negative-real-zero counts
- Sign-change totals
Units: Coefficients are real numbers.
Assumptions and limitations
Assumptions
- Zero coefficients are ignored when counting sign changes.
Constraints
- Descartes' Rule gives possible counts, not the actual zeros.
Known failures
- A negative degree is not a valid polynomial input.
Compatibility and review
- Review status
- Tested on a TI calculator
- Tested on
- Owner-tested TI-84 Plus CE Python calculator; exact branded .py transferred and launched individually
- What happened
- Passed: owner tested the exact 1.0.1 branded source bytes on a TI 84 Plus CE Python calculator.
- Dependencies
- No imports
- Suggested calculator name
DESCART— you can give it another valid, unique name when you transfer it- Desktop test cases
- Not available for this interactive-only source
This exact source auto-launches an interactive calculator session, so compatibility evidence comes from the recorded physical-device review rather than an importable desktop fixture.
Transfer and launch
Download the .py file, send it to your calculator with TI Connect CE as DESCART or another name, then open the Python App and try the worked example on this page first.
Full installation and troubleshooting guide. Check your teacher's or exam's rules before using any program.
Version history
- 1.0.1 — current version, published . Download this reviewed version
- 1.0.0 — superseded by 1.0.1, published . Download this reviewed version
Related learning
Did a DuckieDai program help with your homework? Every program here is free. If you would like to say thanks, you can leave a tip on Cash App ($duckiedai214) or read what tips pay for.
Independent compatibility resource: Hidden Word Scanner is independent and is not affiliated with or endorsed by Texas Instruments. TI product names describe compatibility only.
Action-count privacy: Successful downloads, preview starts, and preview completions increment same-origin aggregate counters, and so does a Yes or No answer about whether the program worked. Your browser notes that you answered; that note is never sent to the site. No entered values, source text, IP address, account, cookie, device identifier, or fingerprint is stored with these counts.