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
- Version 1.0.0
- 3648 bytes
- No imports
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
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
- Confirm that your calculator is the Python-capable model named above. This release has no verified calculator OS or Python App version; treat transfer and execution as unverified until independently tested.
- Download the
.pysource above and verify its SHA-256 digest if your computer provides that option. - Use TI Connect CE to send the Python file to a compatible calculator.
WCSOLis a suggested name; you may choose another valid, unique calculator name. - 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
- 1.0.0 — current version, published . Download this reviewed version
Any source change requires a new immutable version and digest. Historical downloads remain available only while their review records remain valid.
Related learning
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.