I'm having some trouble using Dsolve to solve a partial differential equation.

This is my code:

pde = d*cp*D[T[t, z], t] == k*D[T[t, z], {z, 2}] + Q;

sol = 
    {pde, T[0, z] == Tamb, (D[T[t, z], z] /. z -> 0) == 0, 
     (-k*D[T[t, z], z] /. z -> a) == h*(T[t, a] - Tamb)}, 
    T[t, z], {t, z}]

The output is the differential equation, but it's not evaluated

I'm assuming that there is a mistake in what I wrote because even when I use Dsolve with the partial differential equation that is given as example in the Dsolve article in the Documentation Center, I don't get a solution.

For example, I dont get a solution from this code either:

pd = D[y[x, t] t] + 2 D[y[, t], x] == 0;

sol1 = DSolve[{pd, y[0, t] == Sin[t]}, y[x, t], {x, t}]

I am using Wolfram Mathematica 7.0.

  • 1
    $\begingroup$ There are several things. First, version 7 had no DSolve functionality applied for PDE, as much as I remember. Second, I tried your code in Mma 11.3 and it still returns it unevaluated. This means, that Mma "does not know" the answer. A minor note: this: \a is incorrect. Put simply a. $\endgroup$ – Alexei Boulbitch Nov 11 '18 at 14:01
  • $\begingroup$ Thank you so much, so i can only use NDsolve then to solve a partial differential equation? or there is any other function that you know of? I ask you this because i would prefer to obtain not a numerical solutions $\endgroup$ – Sofia Nov 11 '18 at 14:06
  • 1
    $\begingroup$ There's a missing x in the partial derivative of y with respect to x (in the second example). Fix it, and it works in V11.3: i.stack.imgur.com/xPxT6.png -- Like @Alexei, I'm not sure this will work in V7. You can look in the V7 documentation to see if there are PDE examples for DSolve. You can also try Wolfram Development Platform for free. $\endgroup$ – Michael E2 Nov 11 '18 at 14:21
  • 1
    $\begingroup$ Maple 2018.2 can solve first example analytically. $\endgroup$ – Mariusz Iwaniuk Nov 11 '18 at 14:28
  • $\begingroup$ Mariusz how do you solve it analitically? i just tried in the Wolfram Development Platform but it didnt work $\endgroup$ – Sofia Nov 11 '18 at 15:12

I tried it using the LaplaceTransform, but I haven't get the final analytical answer. These are my codes:

pde = d*cp*D[T[t, z], t] == k*D[T[t, z], {z, 2}] + Q;
ic = T[0, z] == Tamb;
bc1 = D[T[t, z], z] == 0(*z\[Rule]0*);
bc2 = -k*D[T[t, z], z] == h*(T[t, z] - Tamb)(*z->a*);
solbc1 = DSolve[{bc1}, T, {t, z}][[1]]
solc1 = DSolve[{pde /. solbc1, ic /. solbc1}, C[1][t], t][[1, 1]]     (*C[1][t] -> (Q t + cp d Tamb)/(cp d)*)
bc1new = T[t, 0] == (Q t + cp d Tamb)/(cp d);
solbc2 = DSolve[{bc2}, T, {t, z}][[1]]
solc1 = DSolve[{pde /. solbc2, ic /. solbc2}, C[1][t], t][[1, 1]]
T[t, z] /. solbc2[[1]] /. solc1 /. z -> a
bc2new = T[t, a] == ((-1 + E^((h^2 t)/(cp d k))) k Q)/h^2 + Tamb;
teqn = Simplify[
LaplaceTransform[{pde, bc1new, bc2new}, t, s] /. 
HoldPattern[LaplaceTransform[a_, t, s]] :> a]
tsolmid = FullSimplify[DSolve[teqn, T[t, z], z]][[1, 1, -1]]

The InverseLaplaceTransform seems difficult to get the results for this question...

| improve this answer | |
  • $\begingroup$ and I hope someone can teach me how to solve it~ $\endgroup$ – helloworldzcp Nov 11 '18 at 15:49

Anohter method:

    solc1=DSolve[{pde/.solbc1,ic/.solbc1},C[1][t],t][[1,1]];     (*C[1][t](Q t+cp d Tamb)/(cp d)*)
    bc1new=T[t,0]==(Q t+cp d Tamb)/(cp d)
    solc1=DSolve[{pde/.solbc2,ic/.solbc2},C[1][t],t][[1,1]] ;           (*C[1][t](^((h z)/k) (-1+^((h^2 t)/(cp d k))) k Q)/h^2*)
    bc2new=T[t,a]==((-1+E^((h^2 t)/(cp d k))) k Q)/h^2+Tamb

    (*First let’s deal with the complex boundary condition*)
     T[t_,z_]=c[t,z]+(t Q)/(d*cp);
    eqnx[z_]=d*cp*D[c[(k*t)/(d*cp*z^2)],t]-k*D[c[(k*t)/(d*cp*z^2)],{z,2}](*x=(k t)/(cp d z^2)*);
    eqn'=FullSimplify[eqnx[Sqrt[(k t)/(d*cp*x)]]]==0
    solx=DSolve[eqn',c[x],{x}][[1,1]]/.x->(k*t)/(d*cp*z^2);(*c[(k t)/(cp d z^2)]C[2]-2 Sqrt[π] C[1] Erf[1/(2 Sqrt[(k t)/(cp d z^2)])]*)
    T[t_,z_]=C[2]-2 Sqrt[π] C[1] Erf[1/(2 Sqrt[(k t)/(cp d z^2)])]+(t Q)/(d*cp);
    solc2=Solve[Limit[T[t,z],z->0]==(Q t+cp d Tamb)/(cp d),C[2]][[1,1]]  (*use bc1new*)
    solc1=Solve[Limit[T[t,z],z->a]==((-1+E^((h^2 t)/(cp d k))) k Q)/h^2+Tamb,C[1]][[1,1]] (*use bc2new*)

Well, actually I don't know if my result is right.I hope so ^_^

| improve this answer | |
  • 3
    $\begingroup$ Hi, it does not seem that the result satisfies the pde. Also, a little syntax issue: You might want to consider FullForm[eqn'] and whether that's what you meant to do. $\endgroup$ – Michael E2 Nov 11 '18 at 16:41
  • $\begingroup$ @ Michael E2 ,Thanks for your reminding , I missed the existence of 'Q',so the transform didn't satisfy the equation any more.I have corrected the mistake $\endgroup$ – helloworldzcp Nov 12 '18 at 5:32

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.