Hongyi Zhao on Sun, 20 Nov 2022 01:16:17 +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 Sun, Nov 20, 2022 at 1:52 AM Thomas D. Dean <tomdean@wavecable.com> wrote: > > 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 version > > compiled: 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 Group > > > > PARI/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 I encountered the same error as shown below: werner@X10DAi-00:~$ gp Reading GPRC: /etc/gprc ...Done. GP/PARI CALCULATOR Version 2.11.2 (released) amd64 running linux (x86-64/GMP-6.1.2 kernel) 64-bit version compiled: Jul 12 2019, gcc version 9.1.0 (Ubuntu 9.1.0-8ubuntu1) threading engine: pthread (readline v8.0 enabled, extended help enabled) Copyright (C) 2000-2018 The PARI Group PARI/GP is free software, covered by the GNU General Public License, and comes WITHOUT ANY WARRANTY WHATSOEVER. Type ? for help, \q to quit. Type ?17 for how to get moral (and possibly technical) support. parisize = 8000000, primelimit = 500000, nbthreads = 88 ? 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> > > > ? 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 > Best, Zhao