How to keep more digits when use symbolic expressions

4 ビュー (過去 30 日間)
zongxian
zongxian 2022 年 2 月 21 日
回答済み: Star Strider 2022 年 2 月 21 日
my codes is simple,
syms x
f(x)=0.123456789*x
f(x) = 
f(1)
ans = 
sympref('FloatingPointOutput', true);
f(x)=0.123456789*x
f(x) = 
f(1)
ans = 
0.1235
When use sympref, it will only keep four digits, (I want to show 0.123456789). Is there any way to keep them all.

採用された回答

Star Strider
Star Strider 2022 年 2 月 21 日
From the documentation on 'FloatingPointOutput'
  • The true value option displays symbolic results in the short fixed-decimal format with 4 digits after the decimal point.
To get more digits, use the digits function and the vpa function, together or separately —
syms x
f(x)=0.123456789*x
f(x) = 
f(x)=0.123456789*x
f(x) = 
F = vpa(f,64) % Specify 64 Digits In The 'vpa' Output
F(x) = 
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematical Functions についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by