How to make syms functions have specific values
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Star Strider
am 28 Sep. 2021
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 Kommentare
Siehe auch
Kategorien
Mehr zu Assumptions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!