フィルターのクリア

Format coefficients of the derivative of a function

2 ビュー (過去 30 日間)
Aleem Andrew
Aleem Andrew 2020 年 10 月 3 日
コメント済み: Aleem Andrew 2020 年 10 月 3 日
The following code is meant to output the derivative of a function but the coefficients are displayed as fractions even when I try to change the format to short or long.
syms x
e = 2.718282;
f = x * e^x^2;
format short
diff(f)
The output is a function whose coefficients are the ratios of large integers. How can their format be changed?

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 10 月 3 日
編集済み: Ameer Hamza 2020 年 10 月 3 日
Convert everthing to symbolic to prevent the loss of precision
syms x
e = exp(sym(1));
f = x * e^x^2;
format short
df = diff(f)
Result
>> df
df =
exp(2*x) + 2*x*exp(2*x)
  1 件のコメント
Aleem Andrew
Aleem Andrew 2020 年 10 月 3 日
Thank you for your help

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by