3
$\begingroup$

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]
$\endgroup$
  • 1
    $\begingroup$ Your diff eq lacks initial conditions, so you surely are getting an undefined constant in there $\endgroup$ – Dr. belisarius Aug 15 '14 at 11:38
  • $\begingroup$ 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 $\endgroup$ – user44840 Aug 15 '14 at 11:41
  • $\begingroup$ DSolve[] doesn't return solutions with that init cond.! $\endgroup$ – Dr. belisarius Aug 15 '14 at 11:45
  • $\begingroup$ 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}] $\endgroup$ – user44840 Aug 15 '14 at 11:47
3
$\begingroup$

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[1][w, 0] -> 1, C[1][w, x] -> 1}, x, Method -> Reduce], 
 {w, 1, 5}, {y, 1, 5}, PlotRange -> All]

enter image description here

However, you have to choose an integration constant suitable for your problem or provite a proper initial condition.

$\endgroup$
  • $\begingroup$ 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}] $\endgroup$ – user44840 Aug 15 '14 at 12:54
  • $\begingroup$ @user44840 The boundary condition has to be sufficient to completely determine the function and can't be in contradiction to your pde. $\endgroup$ – Karsten 7. Aug 15 '14 at 13:00
  • $\begingroup$ Are you saying that they can only take certain boundary conditions that work? $\endgroup$ – user44840 Aug 15 '14 at 13:52
  • 1
    $\begingroup$ @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}] $\endgroup$ – Karsten 7. Aug 15 '14 at 14:57

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.