How does matlab improve matrix storage accuracy
9 ビュー (過去 30 日間)
古いコメントを表示
Hi,everyone,I encountered a problem. The number in a matrix is too large and exceeds the storage space of 16 bits. I want to expand the storage space of the matrix. It is best if it can be expanded to 200 bits. I know that the vpa function can help us perform high-precision simple operations, but storing high-precision data in a matrix will store double type data by default. Is there any way to expand the number stored in the matrix to 200 digits? The amount of calculation is not a problem.

this is a 10 order martix.
i need calculate 20 order martix.the maximum date of the 20 order martix can reach 10 to the 200th power
0 件のコメント
回答 (1 件)
Walter Roberson
2020 年 8 月 28 日
storing high-precision data in a matrix will store double type data by default.
The data type of an array is determined by the first value you store to the array.
If you initialize the array
M = zeros(10,10);
then that creates M as a double precision array, and if you attempt to store a symbolic number into part of M, then the symbolic number will be converted to double precision.
So instead initialize the array as symbolic:
M = zeros(10, 10, 'sym');
After which, for example,
M(1,1) = vpa(exp(sym(pi)),200);
Note that the full 200 digits will not be displayed, but you can tell with calculations that they are stored internally.
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!