# [✓] Solve the following PDE?

Posted 10 months ago
817 Views
|
5 Replies
|
5 Total Likes
|
 Hi I want to solve the following PDE heqn = D[u[x, t], t] == c*D[u[x, t], {x, 2}] -A* u[x, t]- B; // A, B and c are constants ic = u[x, 0] == 2*A/b; // b is a constant bc = u[0,t] ==0, u[500,t]==0; sol = DSolveValue[{heqn, ic,bc}, u[x, t], {x, t}] The solver is not working, can you please let me know where I am doing a mistake. Thanks, Vishal
5 Replies
Sort By:
Posted 10 months ago
 Hello, heqn = D[u[x, t], t] == c*D[u[x, t], {x, 2}] - A*u[x, t] - B; ic = u[x, 0] == 2*A/b; bc = {u[0, t] == 0, u[500, t] == 0}; sol = DSolve[{heqn, ic, bc}, u[x, t], {x, t}] (* returns unevaluated *) If a symbolic solver returns unevaluated, then Mathematica can't solve the problem. DSolve[]'s symbolic support for PDE's is still somewhat limited, so don't be surprised if some things don't work yet.Numeric solution:NDSolve[] needs numeric values for constans.  A = 1; B = 2; c = 1/10; b = 3; heqn = D[u[x, t], t] == c*D[u[x, t], {x, 2}] - A*u[x, t] - B; ic = u[x, 0] == 2*A/b; bc = {u[0, t] == 0, u[500, t] == 0}; sol = NDSolve[{heqn, ic, bc}, u, {x, 0, 1}, {t, 0, 1}] Plot3D[u[x, t] /. sol, {x, 0, 1}, {t, 0, 1}, AxesLabel -> Automatic] Comparison with Maple 2017.3 symbolic pdsolve solver: Regards,Mariusz.
Posted 10 months ago
 Thanks, Mariusz for solving the equation. Can you tell me what is the solution when I have initial conditions which are as follows, u(x,0) = exp(-Ax) + a*exp(Ax) -dI tried using NDSolve, but it did not fetch me any results again.I used  A = 0.005; B = 2; c = 0.002; b = 3; a = 0.003; d = 0.004; heqn = D[u[x, t], t] == c*D[u[x, t], {x, 2}] - A*u[x, t] - B; ic = u[x, 0] ==exp(-Ax) + a*exp(Ax)-d; bc = {u[0, t] == 0, u[500, t] == 0}; sol = NDSolve[{heqn, ic, bc}, u, {x, 0, 1}, {t, 0, 1}] Plot3D[u[x, t] /. sol, {x, 0, 1}, {t, 0, 1}, AxesLabel -> Automatic] Thanks, Vishal
Posted 10 months ago
 Hello.You make syntax mistakes:  u[x, 0] ==exp(-Ax) + a*exp(Ax)-d;(*its Wrong - Check Documentation Center or Help *) (* it should be:*) u[x, 0] == Exp[-A x] + a*Exp[A x] - d; Corrected code:  A = 0.005; B = 2; c = 0.002; b = 3; a = 0.003; d = 0.004; heqn = D[u[x, t], t] == c*D[u[x, t], {x, 2}] - A*u[x, t] - B; ic = u[x, 0] == Exp[-A x] + a*Exp[A x] - d; bc = {u[0, t] == 0, u[500, t] == 0}; sol = NDSolve[{heqn, ic, bc}, u, {x, 0, 1}, {t, 0, 1}] Plot3D[u[x, t] /. sol, {x, 0, 1}, {t, 0, 1}, AxesLabel -> Automatic] Regards,Mariusz
 Hi Maple code:  u(x, t) = Sum((1/250)*(Int((exp(-A*tau1)+a*exp(A*tau1)-d)*sin((1/500)*n*Pi*tau1), tau1 = 0 .. 500))*sin((1/500)*n*Pi*x)*exp(- (1/250000)*Pi^2*n^2*c*t-A*t), n = 1 .. infinity)+Int(Sum(-(1/250)*B*(Int(sin((1/500)*n*Pi*x), x = 0 .. 500))*sin((1/500)*n*Pi*x)*exp(-(1/250000)*(t-tau1)*(Pi^2*c*n^2+250000*A)), n = 1 .. infinity), tau1 = 0 .. t) Mathematica code:  Sum[(1/250)*(Integrate[(Exp[-A*tau1] + a*Exp[A*tau1] - d)* Sin[(1/500)*n*Pi*tau1], {tau1, 0, 500}])*Sin[(1/500)*n*Pi*x]* Exp[-(1/250000)*Pi^2*n^2*c*t - A*t], {n, Infinity}] + Integrate[ Sum[-(1/250)*B*(Integrate[Sin[(1/500)*n*Pi*x], {x, 0, 500}])* Sin[(1/500)*n*Pi*x]* Exp[-(1/250000)*(t - tau1)*(Pi^2*c*n^2 + 250000*A)], {n, 1, Infinity}], {tau1, 0, t}]