Hidden WordScanner
Private scans · No account required

DuckieDai Descartes' Rule Solver

Count sign changes in f(x) and f(-x) to list the possible numbers of positive and negative real zeros.

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

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.

JavaScript is required for the optional browser simulation. Source viewing and downloading remain available without it.

Simulation boundary: This preview uses a reviewed browser adapter. It does not execute the downloaded Python and does not prove TI-Python or calculator compatibility.

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

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

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

Download .py

View source below, copy it when JavaScript is available, or download the exact .py bytes.

  1. """DuckieDai Descartes Rule Solver for TI-84 Plus CE Python."""
  2. def duckiedai_intro(program_name, wait=True):
  3. title = program_name[:16]
  4. empty = 16 - len(title)
  5. left = empty // 2
  6. right = empty - left
  7. print("+----------------------+")
  8. print("| " + " " * left + title + " " * right + " |")
  9. print("| |")
  10. print("| __ |")
  11. print("| ___(o )> quack! |")
  12. print("| \\ <_. ) |")
  13. print("| `---' |")
  14. print("| by DuckieDai |")
  15. print("| hiddenwordscanner.com|")
  16. print("+----------------------+")
  17. print("Loading...")
  18. if wait:
  19. input("Press enter to start ")
  20. print("\n" * 8)
  21. def clear_screen():
  22. print("\n" * 8)
  23. def count_changes(values):
  24. signs = []
  25. for value in values:
  26. if value > 0:
  27. signs.append(1)
  28. elif value < 0:
  29. signs.append(-1)
  30. changes = 0
  31. for i in range(1, len(signs)):
  32. if signs[i] != signs[i - 1]:
  33. changes += 1
  34. return changes
  35. def possible_zeros(changes):
  36. answers = []
  37. while changes >= 0:
  38. answers.append(changes)
  39. changes -= 2
  40. return answers
  41. def show_answers(title, answers):
  42. clear_screen()
  43. print(title)
  44. print("-------------")
  45. for i in range(len(answers)):
  46. if i > 0:
  47. print(",", end="")
  48. print(answers[i], end="")
  49. print("")
  50. input("\nPress enter ")
  51. def run_test():
  52. clear_screen()
  53. print("DESCARTES RULE")
  54. print("Enter polynomial")
  55. print("")
  56. degree = int(input("Degree: "))
  57. coeffs = []
  58. power = degree
  59. while power >= 0:
  60. if power == 0:
  61. value = float(input("Const: "))
  62. elif power == 1:
  63. value = float(input("x coef: "))
  64. else:
  65. value = float(input("x^" + str(power) + ": "))
  66. coeffs.append(value)
  67. power -= 1
  68. pos_changes = count_changes(coeffs)
  69. neg_coeffs = []
  70. power = degree
  71. for value in coeffs:
  72. neg_coeffs.append(-value if power % 2 == 1 else value)
  73. power -= 1
  74. neg_changes = count_changes(neg_coeffs)
  75. show_answers("POSITIVE ZEROS", possible_zeros(pos_changes))
  76. show_answers("NEGATIVE ZEROS", possible_zeros(neg_changes))
  77. clear_screen()
  78. print("SIGN CHANGES")
  79. print("------------")
  80. print("Positive:", pos_changes)
  81. print("Negative:", neg_changes)
  82. duckiedai_intro("Descartes Rule")
  83. while True:
  84. run_test()
  85. print("")
  86. if input("Again? y/n: ").lower() != "y":
  87. break
  88. clear_screen()
  89. 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

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.