Welcome, guest | Sign In | My Account | Store | Cart
def det(l):
    n=len(l)
    if (n>2):
        i=1
        t=0
        sum=0
        while t<=n-1:
            d={}
            t1=1
            while t1<=n-1:
                m=0
                d[t1]=[]
                while m<=n-1:
                    if (m==t):
                        u=0
                    else:
                        d[t1].append(l[t1][m])
                    m+=1
                t1+=1
            l1=[d[x] for x in d]
            sum=sum+i*(l[0][t])*(det(l1))
            i=i*(-1)
            t+=1
        return sum
    else:
        return (l[0][0]*l[1][1]-l[0][1]*l[1][0])
def simul(leq,lcoeff):
    D=float(det(leq))
    if D==0:
        return -1
    else:
        t=0
        n=len(leq)
        l=[]
        while t<=(n-1):
            lt=[]
            for x in leq:
                ltemp=[]
                for y in x:
                    ltemp.append(y)
                lt.append(ltemp)
            m=0
            while m<=(n-1):
                lt[m][t]=lcoeff[m]
                m+=1
            l.append(det(lt)/D)
            t+=1
        return l

History