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
Expand a monic cubic from its three zeros: enter r1, r2, and r3 and read the coefficients of x^3 + ax^2 + bx + c.
- Owner-tested on a TI calculator
- Downloaded 41 times
- Version 1.0.0
- 701 bytes
- No imports
Tried it? Did this program work on your calculator?
Before you run it
- TI-84 Plus CE Python · No calculator OS or Python App version has been verified.
- TI Connect CE .py transfer to the Python App; the owner's transfer details were not recorded
- The leading coefficient is 1; multiply every coefficient by a afterwards for a different leading coefficient.
- Zeros are real decimals; a complex zero cannot be entered.
- Coefficients print as decimals, so a zero coefficient can show as -0.0.
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 building a cubic from its zeros works
The idea
If you know a cubic's three zeros, you can write it as three brackets and multiply them out. This is the reverse of factoring.
Problems that say "write a polynomial with zeros at 1, 2, and 3" are asking for exactly this, and it is a quick way to check a factoring answer.
The formula
(x - r1)(x - r2)(x - r3)
= x^3 - (r1+r2+r3)x^2 + (r1*r2 + r1*r3 + r2*r3)x - r1*r2*r3
r1, r2, r3- the three zeros
Using the program
- Enter the three zeros.
- The program shows the expanded cubic one term per line, with a leading coefficient of 1.
Worked example
Build the cubic with zeros 1, 2, and 3. Enter 1, 2, and 3.
(x - 1)(x - 2)(x - 3)
The program shows x^3, -6.0 x^2, 11.0 x, and -6.0, which is x^3 - 6x^2 + 11x - 6.
Tips and common mistakes
- The result is monic (it starts with 1x^3). Multiply through if you need a different leading coefficient.
- Enter a repeated zero as many times as it repeats.
- Check: the constant term is minus the product of the zeros.
Where this comes up
Writing a polynomial from its zeros is a regular question in the polynomial unit of algebra 2, precalculus, and college algebra.
Exact reviewed bytes
Source code
def intro():print("+----------------------+")print("| Cubic Expand |")print("| |")print("| __ |")print("| ___(o )> quack! |")print("| \\ <_. ) |")print("| `---' |")print("| by DuckieDai |")print("| hiddenwordscanner.com|")print("+----------------------+")input("Press enter ")print("\n"*6)intro()r1=float(input("r1: "))r2=float(input("r2: "))r3=float(input("r3: "))a=-(r1+r2+r3)b=r1*r2+r1*r3+r2*r3c=-(r1*r2*r3)print()print("Standard form:")print("x^3")print(a,"x^2")print(b,"x")print(c)print()print("DuckieDai says:")print("done!")
- Filename
cubexp.py- Size
- 701 bytes
- SHA-256
c84dc00076d34ede72f31795acbffd439934b3c1dc147dac4c523a81e8d0e2d2
Usage
Inputs
- Three real zeros r1, r2, and r3 as decimals
Outputs
- The x^2 coefficient, the x coefficient, and the constant of the expanded cubic
Units: Polynomial zeros and coefficients; no physical units.
Assumptions and limitations
Assumptions
- The leading coefficient is 1; multiply every coefficient by a afterwards for a different leading coefficient.
Constraints
- Zeros are real decimals; a complex zero cannot be entered.
- Coefficients print as decimals, so a zero coefficient can show as -0.0.
Known failures
- Fractions typed with a slash are not accepted; enter a decimal.
- Non-numeric input uses the calculator Python input error path.
Compatibility and review
- Review status
- Owner-tested on a TI calculator
- Tested on
- Owner reports personally testing this program on a TI-84 Plus CE Python calculator; the test date, OS version, and Python App version were not recorded
- What happened
- Owner reported pass on the calculator. The published file is the owner's tested source.
- Dependencies
- No imports
- Suggested calculator name
CUBEXP— 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 CUBEXP or another name, then open the Python App and try the worked example on this page first. This release has no verified calculator OS or Python App version; treat transfer and execution as unverified until independently tested.
Full installation and troubleshooting guide. Check your teacher's or exam's rules before using any program.
Version history
- 1.0.0 — current version, 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.