0
Terminé

As it is done to work with subs ?

Hector il y a 9 ans mis à jour par Pavel Holoborodko il y a 9 ans 2

clc

clear all;

%addpath('.....................\Multiprecision Computing Toolbox\')

syms A B C;

T=A+B*C;

mp.Digits(20);

a=37456795;

b=576879678;
c=7888797;

t=subs(T,{'A','B','C'},{a,b,c})

now I want a b c t are multiple precision

+1
À l'étude

The 'subs' is part of Symbolic Math Toolbox and it requires input to be of 'sym' type.

To use it with multiprecision toolbox, please use explicit conversion function: mp2sym.


So that the code becomes:

digits(mp.Digits()); % make sure we use the same precision for 'sym' as in multiprecision toolbox.

....

t=subs(T,{'A','B','C'},{mp2sym(a),mp2sym(b),mp2sym(c)})

Reverse conversion can be done with sym2mp function.


Let me know if this fixes the issue.