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 CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by