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 cubic inequality by finding its rational zeros with their multiplicities, then reading the sign of each interval.
- Owner-tested on a TI calculator
- Downloaded 45 times
- Version 1.0.0
- 3648 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 a is nonzero.
- Every zero of the cubic is rational.
- Zeros are found with the Rational Zero Theorem, so a cubic with an irrational or complex zero reports Could not factor.
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 solving a cubic inequality works
The idea
A cubic changes sign only at its zeros. Find the zeros, split the number line there, and the sign in each piece tells you where the inequality holds.
A zero that repeats an even number of times touches the axis without crossing, so the sign does not change there.
The formula
ax^3 + bx^2 + cx + d > 0 (or >=, <, <=)
a, b, c, d- whole-number coefficients
multiplicity- how many times a zero repeats
Using the program
- Enter a, b, c, and d, then choose the inequality: 1 for > 0, 2 for >= 0, 3 for < 0, 4 for <= 0.
- The program lists the rational zeros with their multiplicities and the solution intervals.
Worked example
Solve x^3 - 6x^2 + 11x - 6 > 0. Enter 1, -6, 11, -6, then choose 1.
The program shows zeros 1, 2, and 3, each with multiplicity 1, and the solution (1,2) and (3,inf).
Tips and common mistakes
- The program finds rational zeros. If the cubic does not factor over the rationals it reports that it could not factor.
- Read the two intervals as a union: x is in one or the other.
- inf means the interval continues forever.
Where this comes up
Polynomial inequalities are taught in precalculus and college algebra after zeros and multiplicity, and they are used again in calculus to find where a function is increasing or positive.
Exact reviewed bytes
Source code
"""DuckieDai Cubic Inequality 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 factors(n):n=abs(n)if n==0:return [0]f=[]for i in range(1,n+1):if n%i==0:f.append(i)return fdef frac(x):for d in range(1,101):n=round(x*d)if abs(x-n/d)<0.000001:if d==1:return str(n)return str(n)+"/"+str(d)return str(round(x,4))def divide(c,r):q=[c[0]]for i in range(1,len(c)-1):q.append(c[i]+q[-1]*r)rem=c[-1]+q[-1]*rreturn q,remduckiedai_intro("Cubic Inequality")a=int(input("a: "))b=int(input("b: "))c=int(input("c: "))d=int(input("d: "))print("1 >0")print("2 >=0")print("3 <0")print("4 <=0")op=input("Choice: ")coef=[a,b,c,d]# Rational Zero Theorem candidatescand=[]if d==0:cand.append(0)p=factors(d)q=factors(a)for x in p:for y in q:if y!=0:r=x/yif r not in cand:cand.append(r)if -r not in cand:cand.append(-r)roots=[]mult=[]# Find roots and multiplicitiesfor r in cand:count=0while len(coef)>1:new,rem=divide(coef,r)if abs(rem)<0.000001:count+=1coef=newelse:breakif count>0:roots.append(r)mult.append(count)if len(coef)>1:print("Could not factor")else:# sort rootsfor i in range(len(roots)):for j in range(i+1,len(roots)):if roots[i]>roots[j]:roots[i],roots[j]=roots[j],roots[i]mult[i],mult[j]=mult[j],mult[i]n=len(roots)print("Roots:")for i in range(n):print(frac(roots[i]),"mult",mult[i])# Interval signssigns=[0]*(n+1)if a>0:signs[n]=1else:signs[n]=-1for i in range(n-1,-1,-1):signs[i]=signs[i+1]if mult[i]%2==1:signs[i]=-signs[i]if op=="1" or op=="2":want=1else:want=-1include=(op=="2" or op=="4")print("Solution:")found=Falsefor i in range(n+1):if signs[i]==want:found=Trueif i==0:left="-inf"lb="("else:left=frac(roots[i-1])if include:lb="["else:lb="("if i==n:right="inf"rb=")"else:right=frac(roots[i])if include:rb="]"else:rb=")"print(lb+left+","+right+rb)# Include isolated zeros for >= or <=if include:for i in range(n):if signs[i]!=want and signs[i+1]!=want:found=Trues=frac(roots[i])print("["+s+","+s+"]")if not found:print("EMPTY SET")
- Filename
wcsol.py- Size
- 3648 bytes
- SHA-256
793d3d805b839c643fe2a3c4892559264ec1224cdb2870f5c0bda9bb18a48513
Usage
Inputs
- Integer coefficients a, b, c, and d for ax^3 + bx^2 + cx + d
- One menu choice: 1 greater than zero, 2 greater than or equal, 3 less than zero, 4 less than or equal
Outputs
- Each rational zero as a whole number or fraction, with its multiplicity
- Solution intervals, including single points for the or-equal choices when a repeated zero touches the axis
- EMPTY SET when nothing satisfies the inequality
- Could not factor when the cubic does not split completely into rational zeros
Units: Polynomial coefficients; no physical units.
Assumptions and limitations
Assumptions
- The leading coefficient a is nonzero.
- Every zero of the cubic is rational.
Constraints
- Zeros are found with the Rational Zero Theorem, so a cubic with an irrational or complex zero reports Could not factor.
- A zero is accepted when its synthetic-division remainder is within 0.000001 of zero.
- The search tries every factor of d over every factor of a, so very large coefficients take longer.
Known failures
- A cubic such as x^3 - 2 has no complete rational factoring and reports Could not factor.
- An a value of zero is not a cubic and is outside the supported input domain.
- A menu choice other than 1 to 4 is treated as choice 3.
- Non-integer 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 before the DuckieDai opening screen and website line were added. The steps after the opening screen are unchanged and were compared with the owner's file on desktop; this exact file has not yet been rerun on a calculator.
- Dependencies
- No imports
- Suggested calculator name
WCSOL— 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 WCSOL 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.