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
  • 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.

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

  1. Confirm that your calculator is the Python-capable model named above. Check that its OS and Python App versions match the reviewed record.
  2. Download the .py source above and verify its SHA-256 digest if your computer provides that option.
  3. Use TI Connect CE to send the Python file to a compatible calculator. DESCART is a suggested name; you may choose another valid, unique calculator name.
  4. Open the Python App, select the program, and check sample inputs before relying on other results.

Read the complete installation, launch, troubleshooting, and removal guide.

Availability does not mean a teacher, school, or exam permits this program. Follow the applicable rules.

Version history

Any source change requires a new immutable version and digest. Historical downloads remain available only while their review records remain valid.

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. No entered values, source text, IP address, account, cookie, device identifier, or fingerprint is stored with these counts.