12
$\begingroup$

Consider a simple equation with a one-form on both sides (mathworld.wolfram is also aware of this):

$$ y\mathrm{d}x = \mathrm{d}y $$

This is a perfectly valid abuse of notation. We can carry the $y$ over to the right, then integrate both sides:

$$\int \mathrm{d}x = \int \frac{\mathrm{d}y}{y} $$

to get

$$ x = \log y + C $$

or we can carry the differential of $x$ and get a normal differential equation:

$$y = \frac{\mathrm{d}y}{\mathrm{d}x}=y'(x)$$

which we can plug into DSolve and find y[x]->C[1]Exp[x]

The question is, can we get Mathematica to accept this abuse of notation like so

DSolve[y \[DifferentialD]x == \[DifferentialD]y, y, x]

and solve equations involving infinitesimal values on both sides?

Unfortunately, searching the documentation or this site for "k-form", "one-form", "differential form" did not yield helpful results.

$\endgroup$
3
  • $\begingroup$ This is essentially a division by $dx$, which is, of course, all, that is needed in this simple example. I'll try to find something more interesting. $\endgroup$
    – LLlAMnYP
    May 5, 2015 at 13:19
  • $\begingroup$ Well, my first thought was to put a differrential into a function. \[DifferentialD]y == Log[1 + \[DifferentialD]x]. Then naively you'd expect y==C+x, but your code returns y==C+x Log[2]. But this feels like cheating. I'm exploring options with functions of multiple arguments or higher order equations for the moment. $\endgroup$
    – LLlAMnYP
    May 5, 2015 at 13:40
  • $\begingroup$ Well, the feeling of cheatiness was perfectly valid then. I'm certainly not insisting on a solution to automate such irregular and often simply invalid constructs, I'd just like to find a more or less general approach to putting equations from the OP into Mathematica. I slightly generalized your suggestion with this snippet (-dif[(y/x)] == 2 x Tan[y/x] dif[x]) /. {y -> y[x]} /. {dif[g_] -> Dt[g, x]*dif[x]} which should properly handle differentials of arbitrary things, not just x and y $\endgroup$
    – LLlAMnYP
    May 5, 2015 at 14:00

2 Answers 2

18
$\begingroup$

Ok, now I'm feeling stupid.

First I asked Wolfram Alpha and it interpreted my query correctly. Then I did

WolframAlpha["solve y dx=dy", {{"Input", 1}, "Input"}]
(* HoldComplete[y Dt[x] == Dt[y]] *)

That gave me a clue for the proper notation.

DSolve[y[x] Dt[x] == Dt[y[x]], y, x]
(* {{y -> Function[{x}, E^x C[1]]}} *)

Mathematica handles differentials out of the box just fine.

$\endgroup$
3
  • 2
    $\begingroup$ I think you really uncovered a blind spot! Now the procedure seems to be evident: Dt[y[x]] evaluates to y'[x] Dt[x] and for any correct DE Dt[x] will be eliminated finally. But these thoughts never came to me! $\endgroup$
    – xzczd
    May 6, 2015 at 3:21
  • $\begingroup$ When searching for y one would be looking to eliminate Dt[y[x]] and integrate whatever it is expressed as. But I see what's happening, you are indeed correct. $\endgroup$
    – LLlAMnYP
    May 6, 2015 at 4:47
  • 2
    $\begingroup$ Maybe it's also worth pointing out that Mathematica "knows" what you're thinking if you enter TraditionalForm[Dt[x]]. The output is $\mathbb{d}x$. $\endgroup$
    – Jens
    Jul 31, 2016 at 4:30
3
$\begingroup$

I wonder if the following is a recent enhancement of DSolve (V12.2 or earlier). If it is, I don't know when it happened. My past experience led me to think it would give an error. The first line is applied below to the OP's original code. We don't need to rewrite y as a function of x; it is done for us. DSolve returns an implicit solution with an inactivated Solve. (I don't know why, but that is, roughly speaking, the typical method in a differential equations course.)

Activate@Block[{DifferentialD = Dt}, 
  DSolve[y \[DifferentialD]x == \[DifferentialD]y, y, x]]

(*  {{y[x] -> -E^x C[1]}}  *)

Unfortunately, the original DSolve[y \[DifferentialD]x == \[DifferentialD]y, y, x] still gives an error.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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