Ch-8-Prob-9-New-강산

1852 days ago by matrix

var('x','y','z','w') a=4; b=2; c=1; d=4; e=1; f=-2; g=-3; h=4; i=-1; j=6; A=matrix(4,4,[a,e/2,f/2,g/2,e/2,b,h/2,i/2,f/2,h/2,c,j/2,g/2,i/2,j/2,d]) X=matrix(4,1,[x,y,z,w]) print expand(X.transpose() * A * X) print "A=" print A 
       
[4*w^2 - 3*w*x - w*y + 6*w*z + 4*x^2 + x*y - 2*x*z + 2*y^2 + 4*y*z +
z^2]
A=
[   4  1/2   -1 -3/2]
[ 1/2    2    2 -1/2]
[  -1    2    1    3]
[-3/2 -1/2    3    4]
[4*w^2 - 3*w*x - w*y + 6*w*z + 4*x^2 + x*y - 2*x*z + 2*y^2 + 4*y*z + z^2]
A=
[   4  1/2   -1 -3/2]
[ 1/2    2    2 -1/2]
[  -1    2    1    3]
[-3/2 -1/2    3    4]