How to make syms functions have specific values

2 ビュー (過去 30 日間)
Yang Metin
Yang Metin 2021 年 9 月 27 日
回答済み: Star Strider 2021 年 9 月 28 日
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)

回答 (1 件)

Star Strider
Star Strider 2021 年 9 月 28 日
One approach —
syms c F(x) x
dF = diff(F)
dF(x) = 
F(x) = dsolve(dF == c, F(0)==0)
F(x) = 
c = solve(diff(F)==1,c) % Determine 'c’
c = 
1
F = subs(F)
F(x) = 
x
G(x) = 1/F(x)
G(x) = 
dG = diff(G)
dG(x) = 
Evaluating ‘dG(0)’ of course results in a division-by-zero error, so it is indeterminate,
Lim_dG = limit(dG, x, 0)
Lim_dG = 
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.
.

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by