Unable to compute taylor expansion using taylortool

9 ビュー (過去 30 日間)
Rafael
Rafael 2022 年 12 月 12 日
コメント済み: Torsten 2022 年 12 月 12 日
Im trying to use taylortool but keep getting "cant compute taylor expansion", and I think it is because my function has decimal points.
If f(x) does not have a decimal point, it works fine, even with fractions like (1/4*x*cos(x)).

採用された回答

VBBV
VBBV 2022 年 12 月 12 日
編集済み: VBBV 2022 年 12 月 12 日
Since you are using a Edit box to read the function, it returns a string expression
A = 1.176*x*cos(x); % A is variable to read the input function entered
str2sym(A) % convert to string function to symbolic expression and try
An example shown below works fine
syms x
f = 1.176*x*cos(x);
T6 = taylor(f,x)
T6 = 
  2 件のコメント
VBBV
VBBV 2022 年 12 月 12 日
I think it may be due to the order used for the expression to evaluate the expansion
syms x
f = 1.176*x*cos(x);
T6 = taylor(f,x,'Order',1) % this might be reason
T6 = 
0
syms x
f = 1.176*x*cos(x);
T6 = taylor(f,x,'Order',2)
T6 = 
Torsten
Torsten 2022 年 12 月 12 日
@Rafael comment moved here:
To make my function work, my f(x) is 1176/1000*x*cos(x), but I think it's weird that 1.176 doesn't work

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by