Open tranleduy2000 opened 2 months ago
There is too much precision loss for the following input:
m = {{-2,-2,4},
{-1,-3,7},
{2,4,6}};
s= Transpose[Eigenvectors[m]];
j = {{1+Sqrt[61],0,0},{0,1-Sqrt[61],0},{0,0,-1}};
s1 = Inverse[s];
s.j.s1 // N
The result should be
{{-2.0,-2.0,4.0},
{-1.0,-3.0,7.0},
{2.0,4.0,6.0}}
That gives wrong result:
𝟦𝟦𝟨𝟤𝟪𝟧.𝟥
It's only the "output format" if you get the result as "input format"
Rationalize(878159.58,1*10^-12) - Rationalize(431874.32,1*10^-12) // N //InputForm
it returns 446285.26
s.j.s1 // N
You can get a better result, if you increase the precision:
N[s.j.s1 ,30]
A simplification before the numeric calculation may also get a better result.
s.j.s1 // FullSimplify // N
The result should be
{{-2.0,-2.0,4.0}, {-1.0,-3.0,7.0}, {2.0,4.0,6.0}}
See test case testNIssue1065()
with Config.USE_EXTENDED_PRECISION_IN_N = true;
you can enable using apfloat for calculating in better precision.
with
Config.USE_EXTENDED_PRECISION_IN_N = true;
you can enable using apfloat for calculating in better precision.
Note: Because of using Simplify
for evaluating the Dot(...)
function:
it's not necessary anymore to use Config.USE_EXTENDED_PRECISION_IN_N = true
at least for this Eigenvectors
example.
There is the input:
That gives wrong result:
Expected result: