**TI92**mainHW`Z:KW`>9`9`HW` >9`\9RgsolveZs(ineq,var) Func ineq is the original inequality var is the free variable Next are the local variables for the main function. Their purpose will be discussed below. Local oneside,combined,top,bottom,z,s,endpt,a,b,answ,i,tryright,newint,test,inb,ina,addon,gettestv,inlist,makestr,mysort The main function will make use of the functions defined next. Note the intervals/singletons that make up the final solution will be stored in a list as strings to support interval notation. This function returns an interval or singleton in string form or null string to be potentially added to the solutionl ist. a and b are the potential interval endpoints, ina and inb are boolean values that determine if the enpoints should be included. Define addon(a,ina,b,inb)=Func If a=b and inb Then Return "{"&string(a)&"}" Else If inb Then If ina Then Return "["&string(a)&","&string(b)&"]" Else Return "("&string(a)&","&string(b)&"]" EndIf Else If a=b Then Return "" Else If ina Then Return "["&string(a)&","&string(b)&")" Else Return "("&string(a)&","&string(b)&")" EndIf EndIf EndIf EndIf EndFunc This function returns an appropriate test value. l is the list of endpoints generated by the inequality including and . i is the current endpoint. Define gettestv(l,i)=Func If l[i]= and l[i+1]= Then Return 0 Else If l[i]= Then Return l[i+1]-1 Else If l[i+1]= Then Return l[i]+1 Else Return (l[i]+l[i+1])/2 EndIf EndIf EndIf EndFunc This boolean function determines if the value target is in list l. Define inlist(l,target)=Func Local i,n,found falsefound dim(l)n 1i While in and not found If l[i]=target Then truefound EndIf i+1i EndWhile Return found EndFunc This function returns the final solution to the inequality combining the i ntervals in the solution list l with  appropriately. Define makestr(l)=Func Local i,x If dim(l)=0 Then Return l Else l[1]x 2i While idim(l) x&""&l[i]x i+1i EndWhile Return x EndIf EndFunc This function returns a sorted version of of a list l. The built-in sort is a program. Define mysort(l)=Func Local i,j,n,temp dim(l)n 1i While il[j+1] Then l[j]temp l[j+1]l[j] templ[j+1] EndIf j+1j EndWhile i+1i EndWhile Return l EndFunc Main function oneside is translated left side of ineq where 0 would be the understood rightside. left(ineq)-right(ineq)oneside combined is oneside with a common denominator. comDenom(oneside,var)combined top and bottom are the numerator and denominator of combined respectively. getNum(combined)top getDenom(combined)bottom z is the list of endpoints that solve the equn corresponding to ineq. These endpoints might be included in the finalsolution. s is the list of singular endpoints which can not be included in the final solution. endpoints is the complete list of endpoints. zeros(top,var)z zeros(bottom,var)s augment(s,{,})s zendpt augment(endpt,s)endpt mysort(endpt)endpt The outer loop below builds the solution of the ineq one interval/singleton at a time. The individual intervals/singletons are stored in the list answ as strings. Recall a represents the left enpoint and b represents right endpoint of the potential interval under construction. bis initially a. i is the current position in endpoints. The purpose of the inner loop below isto advance b as far right as possib When tryright becomes false, b has been determined--either a test values test fails or the endpoint in question is a singular endpoint. 1i endpt[i]a {}answ When a reaches there can be no more additions to answ. ina and inb are booleans that determine whether or not a and b will be included. While a If inlist(s,a) Then falseina Else ineq|var=aina EndIf endpt[i]b truetryright While tryright If endpt[i+1]= Then falsetryright EndIf gettestv(endpt,i)test If ineq|var=test Then endpt[i+1]b i+1i If inlist(s,b) Then falsetryright Else If not ineq|var=b Then falsetryright EndIf EndIf Else falsetryright EndIf EndWhile At this point b has advanced as far aspossible. addon will return the potential interval/singleton newint to appendto answ. If inlist(s,b) Then falseinb Else ineq|var=binb EndIf addon(a,ina,b,inb)newint If newint"" Then augment(answ,{newint})answ EndIf Reset a for the next part of the solution. If a=b or inb Then i+1i EndIf endpt[i]a EndWhile Return makestr(answ) EndFunc '