I'm new to Mathematica and want to try it after MATLAB.
I want to solve two different PDEs using the same initial condition and boundary conditions.
(want to verify that the solution I got using separation of variables is the same).
The PDEs I want to solve are:
$$ \frac{\partial u}{\partial t} = \frac{1}{x}\frac{\partial}{\partial x} \bigg( x \frac{\partial u}{\partial x} \bigg)$$
$$ \frac{\partial u}{\partial t} = \frac{1}{x^2}\frac{\partial}{\partial x} \bigg( x^2 \frac{\partial u}{\partial x} \bigg)$$
The initial condition is:
$\qquad u(x,0) = 0$
The boundary conditions are:
$\qquad \lim_{x\rightarrow 0 } \frac{\partial u}{\partial x} = 0$ $\qquad u(1,t) = 1$$
Here's what I attempted:
heqn1 = D[u[x, t], t] == (1/x)*D[[x,t],x]*(x*D[u[x, t], x]);
heqn2 = D[u[x, t], t] == (1/x^2)*D[[x,t],x]*D[u[x, t], x];
ic = u(x,0) == 0;
bc = {D[u[0, t], x] == 0, u[1, t] == 1};
sol1 = DSolve[{heqn1, bc, ic}, u, {x, t}] /. {K[1] -> m}
sol2 = DSolve[{heqn2, bc, ic}, u, {x, t}] /. {K[1] -> m}
Could someone help me fix this?
heqn1
should be defined asheqn1 = D[u[x, t], t] == (1/x)*D[x*D[u[x, t], x], x];
$\endgroup$ic = u[x, 0] == 0
$\endgroup$