Thomas D. Dean on Sat, 19 Nov 2022 18:53:37 +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 11/19/22 04:58, Charles Greathouse wrote:
? 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] Cheers, Bill.
Ubuntu 20.04 latest gp.I get an error with this code. The value of D is not the same order and is enclosed with brackets.
> /usr/local/bin/gp Reading GPRC: /home/tomdean/.gprc GPRC Done. GP/PARI CALCULATOR Version 2.16.0 (development 28175-12b43bac1) amd64 running linux (x86-64/GMP-6.2.1 kernel) 64-bit versioncompiled: Nov 19 2022, gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
threading engine: pthread (readline v8.0 enabled, extended help enabled) Copyright (C) 2000-2022 The PARI GroupPARI/GP is free software, covered by the GNU General Public License, and comes
WITHOUT ANY WARRANTY WHATSOEVER. Type ? for help, \q to quit. Type ?18 for how to get moral (and possibly technical) support. parisizemax = 4000002048, primelimit = 1000000, nbthreads = 4 ? 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]~] [ [-c, 0, a - d, c]~] [[b, -a + d, 0, -b]~] [ [0, -c, b, 0]~] ? matker(D) *** at top-level: matker(D) *** ^--------- *** matker: forbidden division t_INT / t_COL (4 elts). *** Break loop: type 'break' to go back to GP prompt break> break ? E = [0,-c,b,0;-b,a-d,0,b;c,0,-a+d,-c;0,c,-b,0] %5 = [ 0 -c b 0] [-b a - d 0 b] [ c 0 -a + d -c] [ 0 c -b 0] ? matker(E) %6 = [1/c*a - d/c 1] [ 1/c*b 0] [ 1 0] [ 0 1] Tom Dean