so the equations to be solved are
a + b + c = -1
4a + 2b + c = -11
9a + 3b + c = -29
To make the eventual routine more general-purpose, rewrite the equations to set the right-hand sides
equal to zero:
a + b + c + 1= 0
4a + 2b + c + 11 = 0
9a + 3b + c + 29 = 0
This routine, called solvemul(), returns the solutions as a list:
solvemul(eqlist,vlist)
func
©Solve multiple equations
©eqlist: list of expressions
©vlist: list of variables
©returns list of solutions in vlist order
©calls strsub() in same folder
©25dec99/[email protected]
local s,vdim,k,t,vk,vloc,dloc
dim(vlist)
→
vdim
©Build expression to solve
""
→
s
for k,1,vdim-1
s&string(eqlist[k])&"=0 and "
→
s
endfor
s&string(eqlist[vdim])&"=0"
→
s
©Solve for unknown variables
string(expr("solve("&s&","&string(vlist)&")"))
→
s
©Convert solution string to list
newlist(vdim)
→
t
strsub(s,"and",":")
→
s ©Change "and" to ":"
strsub(s," ","")
→
s ©Strip blanks
for k,1,vdim
instring(s,string(vlist[k]))
→
vloc
instring(s,":",vloc)
→
dloc
if dloc=0: dim(s)+1
→
dloc
mid(s,vloc+2,dloc-vloc-2)
→
t[k]
endfor
©Return coefficient list
seq(expr(t[k]),k,1,vdim)
Endfunc
The input parameters are eqlist and vlist, where eqlist is a list of expressions to solve, and vlist is the
list of variables for which to solve. solvemul() assumes that the expressions in eqlist are equal to zero.
11 - 3
Summary of Contents for TI-92+
Page 52: ...Component side of PCB GraphLink I O connector detail 1 41...
Page 53: ...LCD connector detail PCB switch side 1 42...
Page 54: ...Key pad sheet contact side Key pad sheet key side 1 43...
Page 55: ...Key cap detail 1 44...
Page 57: ...Component side of PCB with shield removed A detail view of the intergrated circuits 1 46...
Page 410: ...void extensionroutine2 void Credit to Bhuvanesh Bhatt 10 4...