4
$\begingroup$

I'm relearning Mathematica after a long time away, and trying to remember how to do some things best.

At this point, I'm trying to evaluate $\frac{dy}{dx}$, given: $$ \begin{align} y&=\frac{3}{t}\\ x&=\sqrt{1-3t} \end{align} $$

I can, of course, find it using the identity $dy/dx=\frac{dy/dt}{dx/dt}$:

In[1]:= y[t_] = 3/t; x[t_] = Sqrt[1-3t];                                 

In[2]:= D[y[t],t] / D[x[t],t]

        2 Sqrt[1 - 3 t]
Out[2]= ---------------
               2
              t

But it seems that Mathematica probably has a more straightforward way to do this. What is the best way to do this?

Edit: In this case, it's easy to use the identity $dy/dx=\frac{dy/dt}{dx/dt}$ myself. I'm looking for a more general case, though, when it's not as obvious.

Really, I suppose I'm looking for something roughly equivalent to:

Solve[{y == 3/t, x == Sqrt[1-3t]}, Dt[y,x]]  (* incorrect *)
$\endgroup$
1
$\begingroup$

Well, I think your approach is already quite straightforward, but if you want a solution free of $t$, the following should be better:

Dt[Solve[{y == 3/t, x == Sqrt[1 - 3 t]}, y, {t}], x]

Here I've used a hidden syntax of Solve, the 3rd argument is the variable(s) to be eliminated. To know more about this syntax, check the following post: How to eliminate variables when using Solve[]


Response to the edit:

I'm not sure if it's general enough, but the following works on your specific example and the syntax is quite close to what you're expecting:

Solve[Dt[{y == 3/t, x == Sqrt[1 - 3 t]}, x], Dt[y, x], {Dt[t, x]}]

The following solution should be more general:

Solve[Flatten@{#, Dt[#, x]} &@{y == 3/t, x == Sqrt[1 - 3 t]}, Dt[y, x], {Dt[t, x], x, y}]
|improve this answer|||||
$\endgroup$
  • $\begingroup$ Thanks! Actually, I am looking for something in terms of $t$. In this case, there is a straightforward way to do this. However, I'm hoping to understand how to use Mathematica to do more general solutions. In this case, I had to deduce the identity $dy/dx=\frac{dy/dt}{dx/dt}$ myself. It seems like Mathematica should be able to rearrange my system of equations to find that out itself. In other words (and I've edited my question to reflect this), I'd like to find something roughly like Solve[{y == 3/t, x == Sqrt[1-3t]}, Dt[y,x]] (but something that works). $\endgroup$ – Piquan Sep 17 '16 at 3:10
  • $\begingroup$ @Piquan See my edit. $\endgroup$ – xzczd Sep 17 '16 at 3:18
  • $\begingroup$ Yes, that's terrific, thank you! But... what am I looking at? My understanding is that the third argument of Solve is the domain, typically something like Reals or Integers. What does it mean here? $\endgroup$ – Piquan Sep 17 '16 at 3:48
  • $\begingroup$ @Piquan See the first answer (including those comments under it) in the linked reference :) $\endgroup$ – xzczd Sep 17 '16 at 3:51
1
$\begingroup$

Not sure if it's easier, but another way to do this is by solving simultaneously.

y = 3/t and x = sqrt(1 - 3t)

y = 3/t <-- (1 - x^2)/3 = t

y = 9(1 - x^2)^(-1)

Therefore dy/dx = 18x(1 - x^2)^(-2)

|improve this answer|||||
$\endgroup$
  • $\begingroup$ Thanks! I certainly can find several ways to solve this particular system of equations with pen and paper. I was using a simple example to try to figure out how to ask Mathematica to do the work for me, so that I can use those ideas in complex situations where I can't so easily find the right solutions myself. $\endgroup$ – Piquan Sep 17 '16 at 3:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.