How to make syms functions have specific values
2 ビュー (過去 30 日間)
古いコメントを表示
For example, there is a function F(x) which has F(0) = 0 and F'(0) = 1. I want to calculate the value of the derivative G'(0) of G(x) = 1/F(x) (this is the example), how do I write the code?
syms F(x)
G(x)=1/F(x)
dG=diff(G)
F(0)=0??
dG(0)
0 件のコメント
回答 (1 件)
Star Strider
2021 年 9 月 28 日
One approach —
syms c F(x) x
dF = diff(F)
F(x) = dsolve(dF == c, F(0)==0)
c = solve(diff(F)==1,c) % Determine 'c’
F = subs(F)
G(x) = 1/F(x)
dG = diff(G)
Evaluating ‘dG(0)’ of course results in a division-by-zero error, so it is indeterminate,
Lim_dG = limit(dG, x, 0)
and so is the limit.
There might be other approaches to solving this, for example incorporating a constant-of-integration and the evaluating it as well. However since this was not presented as an integral with integration bounds, I use this approach.
If a better apporoach is posted, I will delete my Answer.
.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Assumptions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!