3
$\begingroup$

Disclaimer: Please excuse me if this question seems trivial; I'm new to Mathematica.

As a simple example, consider the stationary Boltzmann equation $$\frac{\vec{p}}{m} \cdot \vec{\nabla}_x \, f(\vec{x},\vec{p}) = \vec{F}(\vec{x}) \cdot \vec{\nabla}_p \, f(\vec{x},\vec{p}),$$ where $\vec{x}$ and $\vec{p}$ are independent three-vectors representing position and momentum, $\vec{F}(\vec{x})$ is a position-dependent force, and $f(\vec{x},\vec{p})$ is a scalar quantity denoting a particle distribution which I would like to solve for. (If possible, I would like to visualize the result and later extend this calculation to an non-stationary integro-differential equation.)

My naive approach was to implement this as follows:

xvec = {x1, x2, x3};
pvec = {p1, p2, p3};
Fvec = {F1[xvec], F2[xvec], F3[xvec]};
DSolve[pvec/m.Grad[f[xvec, pvec], xvec] == 
  Fvec.Grad[f[xvec, pvec], pvec], f[xvec, pvec], {xvec, pvec}]

Evaluating this cell yields the error message:

DSolve::litarg: To avoid possible ambiguity, the arguments of the dependent variable in f[{x1,x2,x3},{p1,p2,p3}] should literally match the independent variables.

The problem is, I don't know how to 'unpack' a list so that it can act as multiple function arguments. Also, I'm guessing that this is not the only issue with the above code snippet. Any advice would be much appreciated.

$\endgroup$
  • 1
    $\begingroup$ Using Apply and Flatten seems to set it up properly, but DSolve doesn't solve it: Fvec = {F1 @@ xvec, F2 @@ xvec, F3 @@ xvec}; DSolve[(pvec/m).Grad[f @@ Flatten[{xvec, pvec}], xvec] == Fvec.Grad[f @@ Flatten[{xvec, pvec}], pvec], f, Flatten@{xvec, pvec}] $\endgroup$ – Michael E2 Nov 29 '16 at 16:39
1
$\begingroup$

DSolve wants a flat list of variables, so you need to combine x and p into a flat list. Similarly, you can use Apply to create a function form a list of variables:

In[38]:= vars = Flatten[{xvec, pvec}]
Fvec = {F1 @@ xvec, F2 @@ xvec, F3 @@ xvec}
fScal = f @@ Flatten[{xvec, pvec}]

Out[38]= {x1, x2, x3, p1, p2, p3}
Out[39]= {F1[x1, x2, x3], F2[x1, x2, x3], F3[x1, x2, x3]}
Out[40]= f[x1, x2, x3, p1, p2, p3]

Now you could just call DSolve with what you have, but it will return unevaluated.

DSolve[(pvec/m).Grad[fScal, xvec] == Fvec.Grad[fScal, pvec], f, vars]

The failure is not at all surprising. You have a very undertermined system, with 3 arbitrary fuctions (Fvec) and no boundary conditions. You'll need to specify at least some of these to get a solution. And whether the system can be solved with the methods available to DSolve is not at all clear. You may need to do this numerically.

$\endgroup$

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.