numerical error after matrix multiplication

142 Views Asked by At

I have these two 3D vectors m_v and f_v (the numerical values are given below in matlab syntax) that differ in the first, second and third coordinates on the 13th, 13th and 16th decimal places respectively. Then I have a matrix d. after multiplication of the matrix and the vectors, the resulting elements of the vectors differ on 16th, 9th, 15th decimal places respectively. I am trying to understand why the second coordinate gains so much numerical error and if there is something i can do about this (in general without knowing ahead the numbers as this is in a part of numerical calculation).

m_v=[-0.453862111410900437e+00;
     -0.890872580944745307e+00;
      0.188475023938862625e-01];

f_v=[-0.45386211141074218E+00;
     -0.89087258094482580E+00;
      0.18847502393886207E-01];
      
d=[-0.452262928824558430e+00  -0.887615975361606746e+00  0.871557427476580687e-01;
    0.891006524188367788e+00  -0.453990499739546749e+00 -0.106735001383229597e-16;
    0.395678792051806713e-01   0.776563354086463598e-01  0.996194698091745545e+00];

the results after multiplication are

d*m_v=[0.997660410717451374e+00;
       0.535858783446104938e-04;
      -0.683644791952653791e-01];

d*f_v=[0.997660410717451152e+00;
       0.535858785221510458e-04;
      -0.683644791952654207e-01];
1

There are 1 best solutions below

0
On

The $\infty$ matrix norm of your matrix $d$ is somewhere between 1 and 2, so without numerical error you would expect that the difference between $dx$ and $dy$ would be no more than $2\| x-y \|_\infty$ in each component. Your results for the difference in the second components is consistent with that, since your $\| x-y \|_\infty$ is on the order of $10^{-13}$ while $\| dx - dy \|_\infty$ is maybe a few times larger than that at most. It looks worse in terms of number of correct decimal places because the second component of the product is on the order of $10^{-4}$ while the original vectors had components on the order of $1$ or $10^{-1}$.