Heat Equation Solver
Enter parameters and a function.

The Heat Diffusion Model

The one-dimensional heat equation u/t=\alpha^2u/x2 governs how temperature u evolves along a thin rod. The parameter \alpha represents thermal diffusivity. With fixed temperatures at both ends of the rod, the solution illustrates diffusion and smoothing phenomena that appear across physics and engineering.

Analytic solutions exist for simple boundary conditions, often using Fourier series expansions. However, many real-world scenarios require numerical methods. This calculator employs an explicit finite difference scheme, updating the temperature at each interior point using ui,n=ui,n-1+\lambdaui+1,n-1-2ui,n-1+ui-1,n-1 where \lambda=\alpha\Delta t\Delta x2. Stability demands \lambda<0.5. By discretizing space and time, we approximate how heat diffuses from the initial temperature profile.

Finite Difference Procedure

We divide the interval 0<x<L into N segments with spacing \Delta x=LN. Time advances in steps of \Delta t chosen so that \lambda satisfies the stability condition. The algorithm starts by sampling the initial temperature u(x,0) at each grid point. At each time step, boundary values remain zero (or more generally, fixed), while interior points are updated via the explicit formula above. After n steps, the resulting array approximates u(x,t).

Because \lambda depends on both \Delta t and \Delta x, finer spatial grids require smaller time steps for stability. The explicit scheme is conceptually simple but not the most efficient for stiff problems; still, it provides an excellent introduction to numerical PDEs and is adequate for moderate resolutions, as implemented here.

Example: Sinusoidal Initial Data

If the rod starts with temperature distribution u(x,0)=\sin(\pi x/L) and zero boundary conditions, the analytic solution separates into exponentially decaying Fourier modes. Our calculator can reproduce this behavior numerically. You will see that the sinusoidal shape flattens over time as energy dissipates through the boundaries. By experimenting with different initial functions, you can explore how diffusion smooths sharp features and transports heat from hotter regions to cooler ones.

Beyond Heat Flow

The same equation also models other processes, from pollutant diffusion in soil to the pricing of certain financial derivatives. As such, learning to approximate solutions has wide-reaching applications. Understanding stability conditions and discretization error builds foundational skills for computational science. This calculator aims to make the subject approachable by providing instant numerical results alongside a concise explanation of the underlying method.

Related Calculators

Gravitational Time Dilation Calculator - Clocks in Curved Spacetime

Estimate how gravity slows the passage of time near massive objects using general relativity.

gravitational time dilation calculator general relativity clock rate

Molar Mass Calculator - Chemical Formula Parsing

Determine the molar mass of a compound by entering its chemical formula. Useful for stoichiometry and laboratory preparations.

molar mass calculator molecular weight chemistry

Telescope Angular Resolution Calculator - Rayleigh Criterion

Calculate the diffraction-limited angular resolution of a telescope using wavelength and aperture diameter. Learn how aperture size influences your ability to separate close celestial objects.

telescope angular resolution calculator rayleigh criterion astronomy optics