Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
/* * This file: * http://anggtwu.net/MAXIMA/LI_Axb1.mac.html * http://anggtwu.net/MAXIMA/LI_Axb1.mac * (find-angg "MAXIMA/LI_Axb1.mac") * Author: Eduardo Ochs <eduardoochs@gmail.com> * * (defun e () (interactive) (find-angg "MAXIMA/LI_Axb1.mac")) * (defun o () (interactive) (find-angg "MAXIMA/LI_split1.mac")) * * Supersedes: * (find-angg "MAXIMA/LI_split1.mac") */ mycolumnvector([entries]) := transpose(matrix(entries))$ LI_2to1 (eqs2) := makelist(lhs(eqs2[ii])-rhs(eqs2[ii]), ii,1,length(eqs2))$ LI_delta (i,j) := if is(i=j) then 1 else 0$ LI_makesubsts (vars,pos) := makelist(vars[ii]=LI_delta(ii,pos), ii,1,length(vars))$ LI_b0 (eqs1,vars) := -subst(LI_makesubsts(vars,0), eqs1)$ LI_b (eqs1,vars) := apply('mycolumnvector, LI_b0(eqs1,vars)); LI_eqs1b (eqs1,vars) := eqs1 + LI_b0(eqs1,vars); LI_A00 (eqs1,vars,pos) := subst(LI_makesubsts(vars,pos), LI_eqs1b(eqs1,vars))$ LI_A0 (eqs1,vars) := makelist(LI_A00(eqs1,vars,ii), ii,1,length(vars))$ LI_A (eqs1,vars) := apply('matrix, LI_A0(eqs1, vars)); LI_x (vars) := apply('mycolumnvector, vars); LI_Axb (eqs1,vars) := [LI_A(eqs1,vars), LI_x(vars), LI_b(eqs1,vars)]; /* * (eepitch-maxima) * (eepitch-kill) * (eepitch-maxima) load("~/MAXIMA/LI_Axb1.mac"); LI_2to1([1*x+2*y=3, 4*x+5*y=6]); LI_Axb(LI_2to1([1*x+2*y=3, 4*x+5*y=6]), [x,y]); myvars : [x,y]; myeqs2 : [1*x + 2*y = 3, 4*x + 5*y = 6]; myeqs1 : LI_2to1(myeqs2); mycolumnvector(2,3,4); LI_makesubsts (myvars, 2); LI_makesubsts (myvars, 1); LI_makesubsts (myvars, 0); LI_b0 (myeqs1, myvars); LI_b (myeqs1, myvars); LI_eqs1b (myeqs1, myvars); LI_A00 (myeqs1, myvars, 1); LI_A00 (myeqs1, myvars, 2); LI_A0 (myeqs1, myvars); LI_A (myeqs1, myvars); LI_x (myvars); LI_Axb (myeqs1, myvars); */ /* * Local Variables: * coding: utf-8-unix * End: */