Hongyi Zhao on Sat, 19 Nov 2022 13:38:52 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Obtaining the coefficient matrix of multivariable homogeneous linear equation system. |
On Fri, Nov 18, 2022 at 7:21 PM Bill Allombert <Bill.Allombert@math.u-bordeaux.fr> wrote: > > On Fri, Nov 18, 2022 at 10:36:34AM +0800, Hongyi Zhao wrote: > > But I still have some further minor questions: > > > > 1. How to reshape the above output so that it can be feed to matker > > directly, as follows: > > Do as told in linear algebra course: > Choose a basis and apply your linear function to all elements of the basis. > > That is instead of > ? trmat=[x1,x2;x3,x4];A=[a,b;c,d]; > ? A * trmat - trmat *A > > do > > ? A = [a,b;c,d]; > ? basis = [matrix(2,2,k,l,k==i&&l==j)|i<-[1..2];j<-[1..2]] > %2 = [[1,0;0,0],[0,1;0,0],[0,0;1,0],[0,0;0,1]] > ? C = [A * B - B * A | B<-basis] > %3 = [[0,-b;c,0],[-c,a-d;0,c],[b,0;-a+d,-b],[0,b;-c,0]] > ? D = Mat([concat(Vec(c)) | c<-C]~) > %4 = [0,-c,b,0;-b,a-d,0,b;c,0,-a+d,-c;0,c,-b,0] > ? matker(D) > %5 = [1/c*a-d/c,1;1/c*b,0;1,0;0,1] Thanks for the insightful tip. I will try to apply this approach to my actual problem. > Cheers, > Bill. Best, Zhao