Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to solve a PDE in the first order with specific boundary conditions. When I solve use DSolve without the boundary conditions, Mathematica gives me an answer in an arbitrary function. When I put the boundary conditions, it doesn't solve it. Could someone please help me with this issue (word of caution: I am new to Mathematica). Thank you advance in time.


 pde = D[S[x, y, z], x] + D[S[x, y, z], y] + D[S[x, y, z], z] - A*S[x, y, z] - B == 0

Here A and B are known constants and S[x,y,z] is the solution I am looking for.

Then I simply use

DSolve[{pde, S[0,y,z] ==0, S[x,y,0] ==0, S[x,0,z] ==0}, S[x,y,z] , {x,y,z}]

This returns me the output equivalent to the input! Thank you.

share|improve this question
up vote 0 down vote accepted

You can simply plug the general solution into the boundary condition:

pde = D[S[x, y, z], x] + D[S[x, y, z], y] + D[S[x, y, z], z] - A*S[x, y, z] - B == 0
sol = DSolve[pde, S, {x, y, z}];
bc = {S[0, y, z] == 0, S[x, y, 0] == 0, S[x, 0, z] == 0};
bc /. sol
{{(-B + A C[1][y, z])/A == 0, 
  (-B + A E^(A x) C[1][-x + y, -x])/A == 0, 
  (-B + A E^(A x) C[1][-x, -x + z])/A == 0}}

Apparently, all 3 boundary conditions point to a trivial solution, by the way, in fact you only need one b.c. for there's only one constant in the general solution.

Here's a example for a b.c. leading to a non-trivial solution:

Clear[a, b]
bc2 = S[x, y, 0] == 1;
eqn = bc2 /. sol[[1]];
rule = Solve[Cases[eqn, C[_][a__] -> a, Infinity] == {a, b}, {x, y}];
Solve[eqn /. rule, C[1][a, b]] /. C[1][a, b] -> C[1][a_, b_];
sol /. %
{{{S -> Function[{x, y, z}, (-B + (A E^(A x) ((A + B) E^(A (-x + z))))/A)/A]}}}
share|improve this answer
Thank you. That makes sense now. – Soham Mar 9 '14 at 0:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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