Solve IVP with Taylor method of order

6 ビュー (過去 30 日間)
Minjae Cho
Minjae Cho 2022 年 6 月 23 日
編集済み: Minjae Cho 2022 年 6 月 24 日
I wanna implement this into a code.
My code is followed by :
  • syms x y(x)
  • f = y(x) - x^3 + x + 1
  • df = diff(f, x)
  • f = subs(df, diff(y(x), x), f)
and it gives OUTPUT
  • f = x + y(x) - 3*x^2 - x^3 + 2
What I am trying to do is change y(x) (symfun) to new y variable
so that I can use the function of f(x,y) = x + y - 3*x^2 - x^3 + 2; to plug f(a,b) into x and y variable.
  1 件のコメント
Torsten
Torsten 2022 年 6 月 24 日
So what's your numerical method to solve the IVP ?
y_(n+1) = y_n + dx*y_n' + dx^2/2 * y_n''
?

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

採用された回答

Walter Roberson
Walter Roberson 2022 年 6 月 23 日
If you really really need it to be in terms of y and no other name will do then you can follow with
syms y
subs(sol, yx, y)
The "syms y" will destroy the association between the name y and the symbolic function y(x) allowing a substitution as a name instead of a function.
There are ways to do this without using a temporary variable name such as the "yx" that I showed.
But I already showed you exactly how to substitute in numeric values.
  1 件のコメント
Minjae Cho
Minjae Cho 2022 年 6 月 24 日
編集済み: Minjae Cho 2022 年 6 月 24 日
Thanks a lot!
I was gonna do it recursively for Taylor method of order.
It was a lot of help thanks!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by