Hidden WordScanner
Private scans · No account required

DuckieDai Quadratic Solver

Solve a quadratic equation, classify its discriminant, and display real or complex roots.

Version 1.0.0 · Tested on a TI calculator

← Back to Calculator Program Library

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.

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

Solve a quadratic equation, classify its discriminant, and display real or complex roots.

Usage

Inputs

  • Coefficients a, b, and c for a*x^2 + b*x + c = 0

Outputs

  • Discriminant classification
  • Real or complex roots and an exact-form display

Units: Inputs represent a quadratic equation with a not equal to zero.

Assumptions and limitations

Assumptions

  • Exact-form simplification for complex roots assumes integer-like negative discriminants.

Constraints

  • The leading coefficient a cannot be zero.

Known failures

  • Non-integer negative discriminants can make the exact complex-form simplification less suitable.

Compatibility and review

Review status
Tested on a TI calculator
Tested on
Creator-owned TI-84 Plus CE Python calculator; exact .py transferred and launched individually
What happened
Passed: creator tested the exact program on a personal TI 84 Plus CE Python calculator and confirmed real root, repeated root, and complex root workflows.
Dependencies
math
Suggested calculator name
P4QUAD — 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.

Browser preview

Try the DuckieDai calculator screen

A browser implementation of the documented calculation flow. It does not execute the downloaded Python.

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.

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

Exact reviewed bytes

Source code

Download .py

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

  1. """DuckieDai Quadratic Solver for TI-84 Plus CE Python."""
  2. from math import sqrt
  3. def duckiedai_intro(program_name, wait=True):
  4. title = program_name[:16]
  5. empty = 16 - len(title)
  6. left = empty // 2
  7. right = empty - left
  8. print("+----------------------+")
  9. print("| " + " " * left + title + " " * right + " |")
  10. print("| |")
  11. print("| __ |")
  12. print("| ___(o )> quack! |")
  13. print("| \\ <_. ) |")
  14. print("| `---' |")
  15. print("| by DuckieDai |")
  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 clean_num(n):
  24. if abs(n - round(n)) < 0.0000001:
  25. return int(round(n))
  26. return round(n, 6)
  27. def number(prompt):
  28. while True:
  29. try:
  30. text = input(prompt)
  31. if "/" in text:
  32. parts = text.split("/")
  33. if len(parts) != 2:
  34. raise ValueError
  35. top = float(parts[0])
  36. bottom = float(parts[1])
  37. if bottom == 0:
  38. print("Cannot divide by 0")
  39. continue
  40. return top / bottom
  41. return float(text)
  42. except ValueError:
  43. print("Enter a number")
  44. print("or fraction")
  45. def run_solver():
  46. clear_screen()
  47. print("ENTER QUADRATIC")
  48. print("ax^2+bx+c=0")
  49. print("")
  50. a = number("a: ")
  51. b = number("b: ")
  52. c = number("c: ")
  53. if a == 0:
  54. clear_screen()
  55. print("NOT QUADRATIC")
  56. print("a cannot be 0")
  57. return
  58. disc = b * b - 4 * a * c
  59. # SCREEN 1
  60. clear_screen()
  61. print("DISCRIMINANT")
  62. print("------------")
  63. print(clean_num(disc))
  64. if disc > 0:
  65. print("2 real roots")
  66. elif abs(disc) < 0.0000001:
  67. print("1 repeated root")
  68. else:
  69. print("2 complex roots")
  70. input("\nPress enter ")
  71. # SCREEN 2
  72. clear_screen()
  73. print("ROOTS")
  74. print("-----")
  75. if abs(disc) < 0.0000001:
  76. x = -b / (2 * a)
  77. print("x =", clean_num(x))
  78. elif disc > 0:
  79. x1 = (-b + sqrt(disc)) / (2 * a)
  80. x2 = (-b - sqrt(disc)) / (2 * a)
  81. print("x1 =", clean_num(x1))
  82. print("x2 =", clean_num(x2))
  83. input("\nPress enter ")
  84. # SCREEN 3
  85. clear_screen()
  86. print("EXACT FORM")
  87. print("----------")
  88. print(clean_num(-b), "+/-")
  89. print("sqrt(", clean_num(disc), ")")
  90. print("over", clean_num(2 * a))
  91. else:
  92. real = -b / (2 * a)
  93. imag = sqrt(-disc) / abs(2 * a)
  94. print("x1 =")
  95. print(clean_num(real), "+")
  96. print(clean_num(imag), "i")
  97. print("")
  98. print("x2 =")
  99. print(clean_num(real), "-")
  100. print(clean_num(imag), "i")
  101. input("\nPress enter ")
  102. # SCREEN 3
  103. clear_screen()
  104. print("EXACT COMPLEX")
  105. print("-------------")
  106. imag_disc = int(round(-disc))
  107. outside = 1
  108. inside = imag_disc
  109. factor = 2
  110. while factor * factor <= inside:
  111. square = factor * factor
  112. while inside % square == 0:
  113. outside *= factor
  114. inside //= square
  115. factor += 1
  116. den = int(round(abs(2 * a)))
  117. # Reduce outside / denominator
  118. x = outside
  119. y = den
  120. while y != 0:
  121. x, y = y, x % y
  122. common = x
  123. outside //= common
  124. den //= common
  125. if abs(real) < 0.0000001:
  126. if outside == 1 and den == 1:
  127. print("x = +/- i")
  128. print("* sqrt(", inside, ")")
  129. elif den == 1:
  130. print("x = +/-", outside, "i")
  131. print("* sqrt(", inside, ")")
  132. else:
  133. print("x = +/-")
  134. print(outside, "i*sqrt(", inside, ")")
  135. print("over", den)
  136. else:
  137. print("Real part:")
  138. print(clean_num(real))
  139. print("")
  140. print("Imaginary part:")
  141. if outside == 1 and den == 1:
  142. print("+/- i")
  143. print("* sqrt(", inside, ")")
  144. elif den == 1:
  145. print("+/-", outside, "i")
  146. print("* sqrt(", inside, ")")
  147. else:
  148. print("+/-")
  149. print(outside, "i*sqrt(", inside, ")")
  150. print("over", den)
  151. duckiedai_intro("Quadratic")
  152. while True:
  153. run_solver()
  154. print("")
  155. again = input("Again? y/n: ")
  156. if again.lower() != "y":
  157. break
  158. clear_screen()
  159. print("DuckieDai says: done!")
Filename
P4QUAD.py
Size
4779 bytes
SHA-256
6d7e67a728fd417773a62cbe68a144a68599d35ef2ed22bf6b36e83ef5e48fcf

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