If $x = \frac{1}{2}y(y^2-3)$, how do I use Mathematica to evaluate $\frac{\text{d}y}{\text{d}x}$ at the point where $y=0$? Doing f[y_] = 1/2*y*(y^2 - 3)
and then D[y, f[y]] /. y -> 0
gives the errors "$\frac{1}{2}y(-3+y^2)$ is not a valid variable" and "$0$ is not a valid variable".
-
$\begingroup$ Maybe you mean: D[f[y], y] /. y -> 0 ? $\endgroup$– bill sCommented Oct 26, 2019 at 23:24
-
$\begingroup$ But as $x=f(y)$, that would give me $\frac{\text{d}x}{\text{d}y}$, whereas I want $\frac{\text{d}y}{\text{d}x}$. $\endgroup$– PrasiortleCommented Oct 26, 2019 at 23:25
-
2$\begingroup$ So then maybe you are looking for: D[InverseFunction[f][y], y] /. y -> 0? $\endgroup$– bill sCommented Oct 26, 2019 at 23:43
-
$\begingroup$ Yes, that works in this case. $\endgroup$– PrasiortleCommented Oct 27, 2019 at 0:05
-
$\begingroup$ Duplicate: mathematica.stackexchange.com/questions/124399/… $\endgroup$– Michael E2Commented Oct 27, 2019 at 2:32
3 Answers
This is basically the same approach as coolwaters, just packaged up differently. You can use Dt
:
Dt[x == 1/2 y (y^2-3), x]
1 == y^2 Dt[y, x] + 1/2 (-3 + y^2) Dt[y, x]
Using Solve, and then replacing y
with 0:
Dt[y, x] /. First @ Solve[Dt[x == 1/2 y (y^2-3), x], Dt[y, x]] /. y->0
-2/3
One approach is to find an explicit representation for the inverse function, and then take the derivative:
D[InverseFunction[f][y], y] /. y -> 0
Consider y
as a function of x
:
d = D[x == 1/2 y[x] (y[x]^2 - 3), x]
(* 1 == y[x]^2 y'[x] + 1/2 (-3 + y[x]^2) y'[x] *)
Replace y[x]
by 0:
d /. y[x] -> 0
(* 1 == -(3/2) y'[x] *)
Which solves as y'[x] -> -(2/3)
. Note this is only valid if the original equation has a solution after letting y == 0
.