Home Profile Projects Articles

Question: Heat Distribution in a Rod

Monday, 17 of March , 2008 at 9:17 pm

Question: A 1D rod of length L has an initial heat distribution of

u(x,0) = - cos(\frac{8 \pi x}{L})

If the rod has insulated ends (\frac{\partial u}{\partial x}(0,t) = \frac{\partial u}{\partial x}(L,t) = 0) and obeys the heat equation

\frac{\partial u(x,t)}{\partial t} = k \frac{\partial^2 u(x,t)}{\partial x^2},

What is the heat distribution of the rod as a function of time?

Leave a comment

Category: Differential Equations, Questions

Answer: Solve Laplace’s Equation

Monday, 17 of March , 2008 at 9:10 pm

Question: Find the solutions to Laplace’s Equation:

\frac{\partial^2 u(x,y)}{\partial x^2} + \frac{\partial^2 u(x,y)}{\partial y^2} = 0

Answer:
First assume that the solution to the PDE

\frac{\partial^2 u(x,y)}{\partial x^2} + \frac{\partial^2 u(x,y)}{\partial y^2} = 0

has the form

u(x,y) = \phi(x) \xi (y)

Therefore, we can reduce the equation to the following:

\xi (y) \frac{\partial^2 \phi(x)}{\partial x^2} + \phi(x) \frac{\partial^2 \xi (y)}{\partial y^2} = 0
\frac{1}{\phi (x)} \frac{\partial^2 \phi(x)}{\partial x^2} = \frac{-1}{\xi (y)}\frac{\partial^2 \xi (y)}{\partial y^2}

Since this equation is true for all x and y, therefore both sides of the equation must equal a constant.

\frac{1}{\phi (x)} \frac{\partial^2 \phi(x)}{\partial x^2} = \frac{-1}{\xi (y)}\frac{\partial^2 \xi (y)}{\partial y^2} = \lambda

This implies that we need to solve two ODEs.

 \frac{\partial^2 \phi(x)}{\partial x^2} =\lambda\phi (x)~~~~~~\frac{\partial^2 \xi (y)}{\partial y^2} = -\lambda\xi (y)

Since the solutions to the two ODEs will be very similar, I will solve the ODE

 \frac{\partial^2 \Psi}{\partial r^2} =\kappa \Psi(r)

and apply the results to the two ODEs.

There are 3 cases which we need to solve (\kappa > 0, \kappa = 0, and \kappa < 0).

Case \kappa = 0
The ODE for this case would be

 \frac{\partial^2 \Psi}{\partial r^2} =0

which has the solution

\Psi = C_1 r + C_2

Case \kappa < 0 and \kappa > 0
The ODE

 \frac{\partial^2 \Psi}{\partial r^2} =\kappa \Psi(r)

which will have the solution

\Psi = B_1 e^{\sqrt{\kappa}r} + B_2 e^{-\sqrt{\kappa}r}

Please note that \sqrt{\kappa} will be an imaginary number when \kappa < 0.


Therefore, if we apply the above solution, we can find the functions that solve the ODEs

 \frac{\partial^2 \phi(x)}{\partial x^2} =\lambda\phi (x)~~~~~~\frac{\partial^2 \xi (y)}{\partial y^2} = -\lambda\xi (y)

which would be

\phi (x)= A_1 e^{i\sqrt{\lambda}x} + A_2 e^{-i\sqrt{\lambda}x}
\xi  (y)= B_1 e^{\sqrt{\lambda}y} + B_2 e^{-\sqrt{\lambda}y} when \lambda < 0

\phi (x)= A_1 e^{\sqrt{\lambda}x} + A_2 e^{-\sqrt{\lambda}x}
\xi  (y)= B_1 e^{i\sqrt{\lambda}y} + B_2 e^{-i\sqrt{\lambda}y} when \lambda > 0

\phi (x)= C_1 x + C_2
\xi  (y)= D_1 y + D_2 when \lambda = 0

Therefore, the solution would have the form

u(x,y) = \begin{cases}(A_1 e^{i\sqrt{\lambda}x} + A_2 e^{-i\sqrt{\lambda}x})(B_1 e^{\sqrt{\lambda}y} + B_2 e^{-\sqrt{\lambda}y}) & for~\lambda < 0 \\ (A_1 e^{\sqrt{\lambda}x} + A_2 e^{-\sqrt{\lambda}x})(B_1 e^{i\sqrt{\lambda}y} + B_2 e^{-i\sqrt{\lambda}y}) & for~\lambda > 0 \\ (C_1 x + C_2)(D_1 y + D_2) & for~\lambda = 0\end{cases}

Any superposition of the above equation will satisfy Laplace’s equation. In order to reduce this solution more, we would need to be given Boundary and Initial Conditions.

Leave a comment

Category: Answers, Differential Equations

Physics Simulations

Tuesday, 11 of March , 2008 at 1:48 pm

Recently, I started studying ODEs and PDEs over again. I have always found this subject interesting, but I haven’t done much with it since University (besides the odd Classical Mechanics ODE). You should expect a lot more questions about Differential Equations in the near future.

Besides solving Differential Equations analytically, I have been looking at numerical approaches to solving these problems. If you use Maple or Matlab, it is fairly straightforward to solve Differential Equations numerically. However, these approaches are not really optimal for larger problems (especially problems that require parallelization). In order to solve these larger problems, it usually requires using a “real” language.

Initially, I started looking for numerical libraries for Perl. The only library that looked decent was Cephes which seems a bit incomplete. The Python library called NumPy seems a lot better, but this would require me to learn Python.

Anyways, while searching the web, I came across a cool little site called “My Physics Lab”. It contains a bunch applets that have physics simulations. The coolest one, I think, is the double pendulum. It is a simple example of chaotic motion.

Also, if you know of any good numerical libraries, please leave a comment (unless it is in C/C++ or Fortran).

Leave a comment

Category: Announcement

Question: Solve Laplace’s Equation

Sunday, 9 of March , 2008 at 1:10 pm

Question: Find the solutions to Laplace’s Equation:

\frac{\partial^2 u(x,y)}{\partial x^2} + \frac{\partial^2 u(x,y)}{\partial y^2} = 0

Note: Since there are no boundary conditions, there won’t be an exact solution.

Leave a comment

Category: Differential Equations, Questions

Answer: Falling Infinite Rope

Friday, 7 of March , 2008 at 8:21 pm

Question: An infinite rope with a linear density of \lambda is placed on a frictionless table. If the end of the rope is placed at the end of the table and starts falling, what is the velocity of the rope as a function of distance?

Answer: According to Newton’s 2nd Law of Motion, we know that

F_{net} = \frac{\partial p}{\partial t}

If we create a force diagram, we can easily see that F_{net} = mg.

where m = \lambda x.

Therefore, we can create the equation of motion as follows:

\frac{\partial p}{\partial t} = \frac{\partial (m \dot{x})}{\partial t} = \dot{x}\dot{m} + m\ddot{x} = mg
\dot{x}\frac{\partial (\lambda x)}{\partial t} + \lambda x \ddot{x} = \lambda x g
\lambda\dot{x}^2 + \lambda x \ddot{x} = \lambda x g
\dot{x}^2 + x \ddot{x} =  x g

In order to solve this differential equation, let y = \frac{1}{2} \dot{x}^2.

This means:

\dot{y} = \dot{x} \ddot{x} ~~~\Longrightarrow ~~~ \ddot{x} = \frac{\dot{y}}{\dot{x}} = \frac{\frac{\partial y}{\partial t}}{\frac{\partial x}{\partial t}} = \frac{\partial y}{\partial x}

Therefore, the differential equation becomes

2y + x \frac{dy}{dx} = gx ~~~\Longrightarrow ~~~ \frac{dy}{dx} + \frac{2}{x}y = g

We can solve this using the integrating factor method. According to our differential equation, our integrating factor will be e^{\int \frac{2 dx}{x}}= x^2. If we multiple our integrating factor to our ODE, we get

x^2 \frac{dy}{dx} + 2xy = g x^2
\frac{d(x^2 y)}{dx} = gx^2
x^2 y = \int g x^2 dx = \frac{gx^2}{3} + C
\therefore y = \frac{g}{3}x + \frac{C}{x^2}

However, since y = \frac{1}{2} \dot{x}^2, we know that

\frac{1}{2}\dot{x}^2 = \frac{g}{3}x + \frac{C}{x^2}
\dot{x} = \sqrt{\frac{2}{3}gx + \frac{2C}{x^2}}

If we add the boundary condition, \dot{x}(0) =0, the equation reduces to

\dot{x} = \sqrt{\frac{2}{3}gx}

Leave a comment

Category: Answers, Classical Mechanics