8
$\begingroup$

I want Mathematica to solve for the function $f$.

$f$ satisfies the following constraints.

$\frac{\partial}{\partial x} f(x,y) = y$

$\frac{\partial}{\partial y} f(x,y) = x$

$f(0,0)=0$

It would seem obvious that $f(x,y) = x y$

Yet I cannot coax Mathematica into returning this result.

Here is my attempt. Mathematica just returns it unevaluated. What am I missing?

DSolve[
    {
       x == D[f[x, y] , y]
     , y == D[f[x, y] , x]
     , f[0, 0] == 0
    }

, {f[x, y], f[x, y]}
, {x, y}
]
$\endgroup$
  • 1
    $\begingroup$ A partial differential equations needs more than a pointwise condition f[0,0]==0 I think. But Mathematica can't solve with modified conditions f[x,0]==0,f[0,y]==0either. $\endgroup$ – Ulrich Neumann Aug 19 at 8:58
  • 2
    $\begingroup$ The following does the trick: DSolve[Grad[f[x, y], {x, y}] == {y, x}, f[x, y], {x, y}] - It seems that DSolve wants a single differential equation instead of separate ones, even if that "single" differential equation is just one with several components $\endgroup$ – Lukas Lang Aug 19 at 9:18
  • 1
    $\begingroup$ Alternative DSolve[{1 == Derivative[1, 1][f][x, y] }, f[x, y], {x, y}] $\endgroup$ – Ulrich Neumann Aug 19 at 9:21
9
$\begingroup$

Strangely the solver works when the derivative is on the left hand side of the equals sign.

DSolve[
    {
       D[f[x, y] , y] == x
     , D[f[x, y] , x] == y
    }        

, {f[x, y], f[x, y]}
, {x, y}
]

Although I am rather partial to @Lukas Lang's gradient form which I am also pasting here for my future self's convenience.

DSolve[

     Grad[f[x, y], {x, y}] == {y, x}

    ,f[x, y]
    , {x, y}
]
$\endgroup$
  • 1
    $\begingroup$ Interestingly, DSolve[{y, x} == Grad[f[x, y], {x, y}], f[x, y], {x, y}] also returns unevaluated. DSolve seems particularly fickle, when attempting to solve pairs of linear, inhomogeneous PDEs. $\endgroup$ – bbgodfrey Aug 19 at 18:01

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.