Python to MATLAB accuracy
이전 댓글 표시
Hi, so I am translating code from Python to MATLAB and I am using very presice numbers in my calculations.
I am getting very small differences which have a very large impact on the final result. I need the MATLAB code to function the same as the Python.
For example, the numbers from Python are: mu20= 10.1859163332|80940 & mu02= 10.1859163332|81872
And the supposedly same numbers in MATLAB are: mu20 =10.1859163332|72582 & mu02 =10.1859163332|72116
As you can see the last 5 numbers in both are different. Is there anyway to make it so that they are the same in MATLAB as they are in Python?
Cheers,
Ollie
댓글 수: 2
the cyclist
2020년 9월 16일
For your current python calculation, do you have reason to believe that those trailing 5 digits are meaningful? If you are doing the python version as 64-bit floating-point, then I would assume they are not. It seems possible to me that you have a case of false precision.
And if that is the case, and if differences beyond 12 digits of precision are causing very large impact on your final result, then I'd question whether your final result is meaningful.
If your python result is such that you know all of those digits are meaningful, then 64-bit MATLAB (or 64-bit anything) calculations are not going to be able to replicate it.
Oliver Horrobin
2020년 9월 18일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!