# Already solved DE, now I need to rearrange and plot

I have solved for $z(w,x,y)$ in a differential equation:

$$3\frac{\partial z}{\partial y} = 2(z-1) + (1-wy^2 )x$$

And I obtained the general solution: $z = f(w,x,y)$

Now putting in $x=0$, we have $z_0 = f(w,0,y) = g(w,y)$

Then I am trying to solve for $x^*(w,y)$ this final equation and contour plot it:

$$f(w,x^*,y) = 2.7 \times g(w,y)$$

I've managed to obtain $f(w,x,y)$ and $g(w,y)$, which should be the hardest part. Then I'm not sure why the last part of the code is not working, as the last part should be rather straightforward.

pde1 = 3*D[z[w, x, y], y]  == 2 (z[w, x, y] - 1)  + (1 - y^2 w) x
soln1 = DSolve[pde1, z[w, x, y], {w, x, y}]
soln5 = soln1 /. {x -> 0}
eqn1 = soln5  == 2.7*soln1
ContourPlot[
x /. Solve[eqn1, x, Method -> Reduce], {w, 1, 5}, {y, 1, 5},
PlotRange -> All]

• Your diff eq lacks initial conditions, so you surely are getting an undefined constant in there – Dr. belisarius Aug 15 '14 at 11:38
• I tried putting in initial condition: soln1 = DSolve[{pde1, z[0, 0, 0] == 0}, z[w, x, y], {w, x, y}] but it still doesn't work – user44840 Aug 15 '14 at 11:41
• DSolve[] doesn't return solutions with that init cond.! – Dr. belisarius Aug 15 '14 at 11:45
• I tried many different init condt. but it all don't work.. soln1 = DSolve[{pde1, z[1, 2, 3] == 4}, z[w, x, y], {w, x, y}] – user44840 Aug 15 '14 at 11:47

With the slightly modified input

pde1 = 3*D[z[w, x, y], y] == 2 (z[w, x, y] - 1) + (1 - y^2 w) x
soln1 = z[w, x, y] /. First@DSolve[pde1, z[w, x, y], {w, x, y}]
soln5 = soln1 /. {x -> 0}
eqn1 = soln5 == 2.7*soln1


and a replacement of the integration constant

ContourPlot[
x /. Solve[eqn1 /. {C[w, 0] -> 1, C[w, x] -> 1}, x, Method -> Reduce],
{w, 1, 5}, {y, 1, 5}, PlotRange -> All] However, you have to choose an integration constant suitable for your problem or provite a proper initial condition.

• What if the solution to the DE is very complicated, and you don't know what the integration constant is - but you know the initial condition. Tried it with this code but didn't work: soln1 = z[w, x, y] /. First@DSolve[{pde1, z[1,0,1]==1,z[2,1,1]==2}, z[w, x, y], {w, x, y}] – user44840 Aug 15 '14 at 12:54
• @user44840 The boundary condition has to be sufficient to completely determine the function and can't be in contradiction to your pde. – Karsten 7. Aug 15 '14 at 13:00
• Are you saying that they can only take certain boundary conditions that work? – user44840 Aug 15 '14 at 13:52
• @user44840 I meant, that they have to make sense. You need to use something along the lines of, e.g. DSolve[{pde1, z[w, x, 10] == 100}, z[w, x, y], {w, x, y}] – Karsten 7. Aug 15 '14 at 14:57