From: Gayathri S on 25 Feb 2010 08:07 Hi, I have a square matrix of size 11x11. This matrix is built such that it is traceless. It does satisfy the property that sum of the eigenvalues is equal to the trace of the matrix. But it does not quite seem to satisfy the property that, product of eigenvalues is equal to the determinant of the matrix. Seems like this problem occurs only with this matrix. Can anyone help? Thanks. I have given the elements of the matrix below. Each row has 11 elements and each row is separated by a blank horizontal space. This is what I did in matlab: --------------------------------------------------------------------------------- >> load A.dat; >> eigval=eig(A); >> prod(eigval) ans = -2.8424e-06 - 1.0588e-22i >> det(A) ans = -1.3201e-06 --------------------------------------------------------------------------------- Any help will be appreciated. Thanks. 33.5000000000000 -40.8634581890614 10.4721359549996 -4.8518399963192 2.8944271909999 -2.0000000000000 1.5278640450004 -1.2596161836825 1.1055728090001 -1.0250856309369 0.5000000000000 10.2158645472653 -4.9797965697656 -7.0402940426804 2.7527638409423 -1.5575365158351 1.0514622242383 -0.7936044933348 0.6498393924658 -0.5681580876808 0.5257311121191 -0.2562714077342 -2.6180339887499 7.0402940426804 -1.1708203932499 -4.5201470213402 2.0000000000000 -1.2360679774998 0.8944271909999 -0.7159209561596 0.6180339887499 -0.5681580876808 0.2763932022500 1.2129599990798 -2.7527638409423 4.5201470213402 -0.4490279765796 -3.5872089866697 1.7013016167041 -1.1150730316701 0.8506508083520 -0.7159209561596 0.6498393924658 -0.3149040459206 -0.7236067977500 1.5575365158351 -2.0000000000000 3.5872089866697 -0.1708203932499 -3.2360679774998 1.6180339887499 -1.1150730316701 0.8944271909999 -0.7936044933348 0.3819660112501 0.5000000000000 -1.0514622242383 1.2360679774998 -1.7013016167041 3.2360679774998 0.0000000000000 -3.2360679774998 1.7013016167041 -1.2360679774998 1.0514622242383 -0.5000000000000 -0.3819660112501 0.7936044933348 -0.8944271909999 1.1150730316701 -1.6180339887499 3.2360679774998 0.1708203932499 -3.5872089866697 2.0000000000000 -1.5575365158351 0.7236067977500 0.3149040459206 -0.6498393924658 0.7159209561596 -0.8506508083520 1.1150730316701 -1.7013016167041 3.5872089866697 0.4490279765796 -4.5201470213402 2.7527638409423 -1.2129599990798 -0.2763932022500 0.5681580876808 -0.6180339887499 0.7159209561596 -0.8944271909999 1.2360679774998 -2.0000000000000 4.5201470213402 1.1708203932499 -7.0402940426804 2.6180339887499 0.2562714077342 -0.5257311121191 0.5681580876808 -0.6498393924658 0.7936044933348 -1.0514622242383 1.5575365158351 -2.7527638409423 7.0402940426804 4.9797965697656 -10.2158645472653 -0.5000000000000 1.0250856309369 -1.1055728090001 1.2596161836825 -1.5278640450004 2.0000000000000 -2.8944271909999 4.8518399963192 -10.4721359549996 40.8634581890614 -33.5000000000000
From: Matt J on 25 Feb 2010 10:49 "Gayathri S" <gayathri(a)jncasr.ac.in> wrote in message <hm5slm$s72$1(a)fred.mathworks.com>... > Hi, > I have a square matrix of size 11x11. This matrix is built such that it is traceless. It does satisfy the property that sum of the eigenvalues is equal to the trace of the matrix. But it does not quite seem to satisfy the property that, product of eigenvalues is equal to the determinant of the matrix. Seems like this problem occurs only with this matrix. Can anyone help? Thanks. I have given the elements of the matrix below. > > Each row has 11 elements and each row is separated by a blank horizontal space. > This is what I did in matlab: > --------------------------------------------------------------------------------- > >> load A.dat; > >> eigval=eig(A); > >> prod(eigval) > > ans = > > -2.8424e-06 - 1.0588e-22i > > >> det(A) > > ans = > > -1.3201e-06 > --------------------------------------------------------------------------------- Since A is approximately singular, it is to be expected that both det(A) and prod(eig(A)) approximate zero, which they do. So, the 2 results seem quite consistent up to numerical round-off. How accurate an approximation were you hoping for?
From: Gayathri S on 26 Feb 2010 00:30 "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hm665g$gmm$1(a)fred.mathworks.com>... > "Gayathri S" <gayathri(a)jncasr.ac.in> wrote in message <hm5slm$s72$1(a)fred.mathworks.com>... > > Hi, > > I have a square matrix of size 11x11. This matrix is built such that it is traceless. It does satisfy the property that sum of the eigenvalues is equal to the trace of the matrix. But it does not quite seem to satisfy the property that, product of eigenvalues is equal to the determinant of the matrix. Seems like this problem occurs only with this matrix. Can anyone help? Thanks. I have given the elements of the matrix below. > > > > Each row has 11 elements and each row is separated by a blank horizontal space. > > This is what I did in matlab: > > --------------------------------------------------------------------------------- > > >> load A.dat; > > >> eigval=eig(A); > > >> prod(eigval) > > > > ans = > > > > -2.8424e-06 - 1.0588e-22i > > > > >> det(A) > > > > ans = > > > > -1.3201e-06 > > --------------------------------------------------------------------------------- > > > Since A is approximately singular, it is to be expected that both det(A) and > prod(eig(A)) approximate zero, which they do. So, the 2 results seem quite consistent up to numerical round-off. How accurate an approximation were you hoping for? Thanks for the reply. I gave 'not a good' example due to space constraint. This matrix which I had posted is nothing but the Chebyshev differentiation operator, with n=11 grid points. If I generate the same with n=31 grid points, what I get in matlab is the following. The imaginary part of the product of eigenvalues is 'huge'. I have also given the matlab code to generate the matrix (from 'Spectral methods in matlab' by Trefethen). Usage is also given below. ---------------------------------------------------------------------------- >> A=cheb(30); >> size (A) ans = 31 31 >> eigval=eig(A); >> prod(eigval) ans = 6.1975e+26 - 1.7180e+10i >> det(A) ans = 2.6983e+26 >> ---------------------------------------------------------------------------- *************************** Matlab program cheb.m *************************** % CHEB compute D = differentiation matrix, x = Chebyshev grid function [D,x] = cheb(N) if N==0, D=0; x=1; return, end x = cos(pi*(0:N)/N)'; c = [2; ones(N-1,1); 2].*(-1).^(0:N)'; X = repmat(x,1,N+1); dX = X-X'; D = (c*(1./c)')./(dX+(eye(N+1))); % off-diagonal entries D = D - diag(sum(D')); % diagonal entries
From: Gayathri S on 26 Feb 2010 01:14 Hi, Seems like there is a problem with this differentiation matrix if we try to calculate its eigenvalues without any boundary conditions. Refer to matlab's documentation of 'chebspec' in the test matrices gallery. I think the problem is inherent with this type of matrix. Thanks, Gaytahri.S.
From: Steven Lord on 26 Feb 2010 10:43 "Gayathri S" <gayathri(a)jncasr.ac.in> wrote in message news:hm7m8v$i5c$1(a)fred.mathworks.com... > "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message > <hm665g$gmm$1(a)fred.mathworks.com>... >> "Gayathri S" <gayathri(a)jncasr.ac.in> wrote in message >> <hm5slm$s72$1(a)fred.mathworks.com>... *snip* > Thanks for the reply. I gave 'not a good' example due to space constraint. > This matrix which I had posted is nothing but the Chebyshev > differentiation operator, with n=11 grid points. If I generate the same > with n=31 grid points, what I get in matlab is the following. The > imaginary part of the product of eigenvalues is 'huge'. Not relative to the magnitude of the real part of the product. If you compute: P = prod(eigval); imag(P)/real(P) you'll see that the ratio is very, VERY small. When compared with the real part, the imaginary part is like a penny to Bill Gates. So one question that I don't think anyone's asked you yet -- why are you looking at the determinant of the matrix in the first place? As the help and documentation for DET both say, if you're using it to try to determine if your matrix is singular you should use COND instead. For example, this matrix has determinant 0: d = 1e-5; A = d*eye(100); det(A) but it is of course invertible and very well conditioned. cond(A) Ainv = (1/d)*eye(100); norm(A*Ainv-eye(100)) -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
|
Next
|
Last
Pages: 1 2 Prev: ode45 solver - outputfcn problem Next: Why I can't get a vector from raylfit? |