Redox Equation Balancer Source Code- TI-85/86

 

Type the TI-85/86 BASIC code listed below into your calculator’s program editor EXACTLY as it is shown below to create your very own Redox Equation Balancing program.

 

:ClLCD

:Disp "Select solution type"

:Menu(1,"acid",AC,2,"base",BS)

:Lbl AC

:1→TY

:Goto BG

:Lbl BS

:2→TY

:Lbl BG

:{5,5}→dim MAT

:5→dim VEC

:For(x,1,2)

:ClLCD

:Disp "reactant   subscripts"

:Outpt(1,10,x)

:Input "hydrogen=",D

:D→MAT(1,1+x)

:Input "oxygen=",D

:D→MAT(2,1+x)

:Input "element=",D

:D→MAT(2+x,1+x)

:Input "charge=",D

:D→MAT(5,1+x)

:End

:For(x,1,2)

:ClLCD

:Disp "product   subscripts"

:Outpt(1,9,x)

:Input "hydrogen=",D

:If x==1

:D→VEC(1)

:If x==2

:(-D)→MAT(1,4)

:Input "oxygen=",D

:If x==1

:D→VEC(2)

:If x==2

:(-D)→MAT(2,4)

:Input "element=",D

:If x==1

:D→VEC(3)

:If x==2

:(-D)→MAT(4,4)

:Input "charge=",D

:If x==1

:D→VEC(5)

:If x==2

:(-D)→MAT(5,4)

:End

:If (MAT(2,2)+MAT(2,3))==(VEC(2)-(MAT(2,4))

:0→H

:If (MAT(2,2)+MAT(2,3))>(VEC(2)-MAT(2,4))

:Then

:1→MAT(1,1)

:-2→MAT(1,5)

:-1→MAT(2,5)

:1→MAT(5,1)

:1→H

:End

:If (VEC(2)-MAT(2,4))>(MAT(2,2)+MAT(2,3))

:Then

:2→MAT(1,1)

:-1→MAT(1,5)

:1→MAT(2,1)

:-1→MAT(5,5)

:2→H

:End

:5→dim SOL

:simult(MAT,VEC)→SOL

:5→dim W

:For(x,1,5)

:SOL(x)→W(x)

:End

:0→M

:While abs (round(W(1),0)-W(1))>.001 or abs (round(W(2),0)-W(2))>.001 or abs (round(W(3),0)-W(3))>.001 or abs (round(W(4),0)-W(4))>.001 or abs (round(W(5),0)-W(5))>.001

:M+1→M

:For(x,1,5)

:SOL(x)*M→W(x)

:End

:End

:DelVar(SOL)

:DelVar(VEC)

:DelVar(MAT)

:If W(1)==0 and W(5)==0

:0→H

:If H==0

:Goto DP

:ClLCD

:If TY==1 and H==1

:Disp "H+ on left"

:If TY==1 and H==2

:Disp "H+ on right"

:If TY==2 and H==1

:Disp "OH- on right"

:If TY==2 and H==2

:Disp "OH- on left"

:If (TY==1 and H==1) or (TY==2 and H==2)

:Disp "H20 on right"

:If (TY==1 and H==2) or (TY==2 and H==1)

:Disp "H20 on left"

:Disp "coefficients"

:If TY==1

:Disp "H+="

:If TY==2

:Disp "OH-="

:Disp "H2O="

:If TY==1 and H==1

:Then

:Outpt(4,4,W(1))

:Outpt(5,5,W(5))

:End

:If TY==1 and H==2

:Then

:Outpt(4,4,W(5))

:Outpt(5,5,W(1))

:End

:If TY==2 and H==1

:Then

:Outpt(4,5,W(1))

:Outpt(5,5,(W(1)-W(5)))

:End

:If TY==2 and H==2

:Then

:Outpt(4,5,W(5))

:Outpt(5,5,(W(5)-W(1)))

:End

:Disp "Press enter to"

:Disp "continue"

:Pause

:Lbl DP

:ClLCD

:Disp "coefficients"

:For(x,1,2)

:Disp "reactant  ="

:Outpt(x+1,10,x)

:Outpt(x+1,12,W(x+1))

:End

:For(x,1,2)

:Disp "product  ="

:Outpt(x+3,9,x)

:End

:If M==0

:1→M

:Outpt(4,11,M)

:Outpt(5,11,W(4))

:DelVar(W)