It uses 4 sub routines that he sent me via email on txt (below)
Any sugestions? For sure they wont run out-of-the-box on the classpad - I never programmed anything for calculator, and dont even know how to do it on the classpad!
Any help would be appreciated
Define LibPub gausstep(mat)=Prgm:©gausstep(Mat): step-by-step row reduc.:Local i,l,c,k,nbl,nbc,s:check_vars_row():s:=check_type_arg(mat,"MAT",0):If s?"ok" Then: dispstring(s): Stop:EndIf:If is_cp_matrix(mat) Then: lib_msg("too_cplx",true): Stop:EndIf:Disp mat:l:=dim(mat):nbl:=l[1]:nbc:=l[2]:?matg:=mat:l:=1:c:=1:While not (l>nbl) and not (c>nbc): Define condpiv(l,c)=?matg[l,c]=1: gauss1(l,c,nbl): Define condpiv(l,c)=?matg[l,c]^(2)=1: gauss1(l,c,nbl): Define condpiv(l,c)=not (?matg[l,c]=0): gauss1(l,c,nbl): If not (?matg[l,c]=0) Then: For i,l+1,nbl: If not (?matg[i,c]=0) Then: k:=((-?matg[i,c])/(?matg[l,c])): gauss2(i,k,l): EndIf: EndFor: l:=l+1: EndIf: c:=c+1:EndWhile:dispstring(lib_msg("rank",false)&" = "&string(l-1)):DelVar condpiv:EndPrgm
Define LibPriv gausstep2(mat)=Prgm:©gausstep2(mat): step by step row reduc.:©without check for a formal coefficient...:Local i,l,c,k,nbl,nbc,s:check_vars_row():s:=check_type_arg(mat,"MAT",0):If s?"ok" Then: dispstring(s): Stop:EndIf:Disp mat:l:=dim(mat):nbl:=l[1]:nbc:=l[2]:?matg:=mat:l:=1:c:=1:While not (l>nbl) and not (c>nbc): Define condpiv(l,c)=?matg[l,c]=1: gauss1(l,c,nbl): Define condpiv(l,c)=?matg[l,c]^(2)=1: gauss1(l,c,nbl): Define condpiv(l,c)=not (?matg[l,c]=0): gauss1(l,c,nbl): If not (?matg[l,c]=0) Then: For i,l+1,nbl: If not (?matg[i,c]=0) Then: k:=((-?matg[i,c])/(?matg[l,c])): gauss2(i,k,l): EndIf: EndFor: l:=l+1: EndIf: c:=c+1:EndWhile:dispstring(lib_msg("rank",false)&" = "&string(l-1)):DelVar condpiv:EndPrgm
Define LibPriv gauss1(l,c,nbl)=Prgm:©LibPriv function:Local i:If not condpiv(l,c) Then: For i,l+1,nbl: If condpiv(i,c) Then: gauss2(i,0,l): Exit: EndIf: EndFor:EndIf:EndPrgm
Define LibPriv gauss2(i1,k,i2)=Prgm:©LibPriv function:Local s1,s2,r<img src='/dot/public/style_emoticons/<#EMO_DIR#>/r.bmp' class='bbc_emoticon' alt=':r:' />=lib_msg("row",false):s1:=r&string(i1):s2:=r&string(i2):If i2=0 Then: Disp #s1=k*#s1: ?matg:=mRow(k,?matg,i1):ElseIf k=0 Then: Disp #s1,"?",#s2: ?matg:=rowSwap(?matg,i1,i2):Else: Disp #s1=#s1+k*#s2: ?matg:=mRowAdd(k,?matg,i2,i1):EndIf:Disp ?matg:EndPrgm