expanding a given function as a power series?

39 ビュー (過去 30 日間)
Michael Vaughan
Michael Vaughan 2020 年 9 月 26 日
編集済み: Ameer Hamza 2020 年 9 月 26 日
say I have a function, for example f(x)=x^3+2x. I want to know how take an arbitrary function like this, and for each x value supstitute , the expontential function in h. I then want to expand this newly represneted function as a power series in h, as each will equal 1+h+h^2/2+h^3/3+....
Now, I understand it will have an infinite amount of terms, so if there was a way I could pick an integer (say m) such that it only calculates this power series up to the h^m term I think that would be awesome
This is quite a big endevor for me, as I have no programming experience. Could somebody show me how to write this script?? Thank you so much I really appreciate it

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 9 月 26 日
編集済み: Ameer Hamza 2020 年 9 月 26 日
You need the symbolic toolbox for this problem!
syms x y
f(x) = x^3+2*x;
g = f(exp(y));
g_approx = taylor(g, y, 'Order', 10)
Result
>> g_approx
g_approx =
(3937*y^9)/72576 + (6563*y^8)/40320 + (2189*y^7)/5040 + (731*y^6)/720 + (49*y^5)/24 + (83*y^4)/24 + (29*y^3)/6 + (11*y^2)/2 + 5*y + 3

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by