We study the one-dimensional heat conduction equation on the finite interval, subject to Dirichlet boundary conditions
u
t

u
xx
, 0<x<1, t>0​​u(x,0)
u
0
(x), 0<x<1\[NewLine]u(0,t)
g
0
(t),u(1,t)
h
0
(t)t>0
Applying the Fourier transform of both sides of the heat equation and integrating by parts twice yields the following first-order ODE in
t
.
∂

u
∂t
+
2
λ

u
(λ,t)(
u
x
(1,t)+iλu(1,t))
-iλ
e
-(
u
x
(0,t)+iλu(0,t))
We use the integrating factor method and Integrating both sides with respect to
t
we obtain
2
λ
t
e

u
(λ,t)-

u
0
(λ)-

g
1
(
2
λ
,t)-iλ

g
0
(
2
λ
,t)+
-λi
e


h
1
(
2
λ
,t)+iλ

h
0
(
2
λ
,t)
This is called the Global Relation (G.R). This equation is valid for all
λ∈C
and t>0. Inverting the Fourier transform formally gives:
u(x,t)
1
2π
∞
∫
-∞
iλx-
2
λ
t
e

u
0
(λ)λ-
1
2π
∞
∫
-∞
iλx-
2
λ
t
e


g
1
(
2
λ
,t)+iλ

g
0
(
2
λ
,t)λ​​+
1
2π
∞
∫
-∞
-iλ(1-x)-
2
λ
t
e


h
1
(
2
λ
,t)+iλ

h
0
(
2
λ
,t)λ
For the first two integrals, that is the formula for the heat equation on the half-line, where the contour
∂
+
D
is the boundary of the domain
+
D
defined by
-
D
{λ∈C:Im(λ)≤0, Re(
2
λ
)<0}.
We now specialise the general representation to the explicit choice of data
u
0
(x)
-x
e
,
g
0
(t)cos(t),
h
0
(t)
-1
e
cos(t)
The transforms that correspond to these conditions are :

u
0
(λ)
-i(1-
-(1+iλ)
e
)
λ-i
,

g
0
(λ,t)
λt
e
(λcost+sint)-λ
2
λ
+1
and

h
0
(t)

g
0
(λ,t)
e
The contour
+
C
is taken to be the trapezoidal path defined by
z
1
(r)-l+
3
4
i+r
i
5π
6
e
,r∈(-∞,-ℓ),​​
z
2
(s)s+hi,s∈[-ℓ, ℓ],\[NewLine]
z
3
(r)l+
3
4
i+r
i
π
6
e
,r∈(ℓ,+∞)
with
ℓ
3
4
.
The solution reduces to a single integral:
u(x,t)
1
2π
∫
+
C
-
2
λ
t
e
iλ
e
-
-iλ
e
Q(λ,x)·(
2
λ
-1)
(
2
λ
+1)·(
4
λ
+1)
dλ
where
Q(λ,x)-4λ
sin(λx)
e
+sin(λ(1-x))
Define the complex-valued function V(k,x,t)
v[k_,x_,t_]:=
1
2*Pi
*
Exp[-k^2t]
Exp[I*k]-Exp[-I*k]
*
-4*k
Sin[k*x]

+Sin[k*(1-x)](k^2-1)
(k^2+1)*(k^4+1)
Set L value
l=3/4;
Define the three contours k1,k2,k3
k1[r_]:=l+(3/4)*I+r*Exp[I*Pi/6];​​k2[r_]:=-l+(3/4)*I+r*Exp[I*5*Pi/6];​​k3[s_]:=s+(3/4)*I;
Derivatives of the contours
dk1[r_]:=D[k1[r],r];​​dk2[r_]:=D[k2[r],r];​​dk3[s_]:=D[k3[s],s];
Define the approxU function with NumericQ guards
approxU[x_?NumericQ,t_?NumericQ]:=Module[{temp1,temp2},temp1=NIntegrate[Re[v[k1[r],x,t]*dk1[r]-v[k2[r],x,t]*dk2[r]],{r,0,Infinity},AccuracyGoal->6,PrecisionGoal->6,MaxRecursion->20];​​temp2=NIntegrate[Re[v[k3[s],x,t]*dk3[s]],{s,-l,l},AccuracyGoal->6,PrecisionGoal->6,MaxRecursion->20];​​temp1+temp2]
Example: Evaluate at a point
approxU[0.5,0.1]
Out[]=
0.653637
Step 4: Plot the 3D surface
Plot3D[approxU[x,t],{x,0,1},{t,0,2Pi},AxesLabel->{"x","t","u(x,t)"},PlotLabel->"Fokas Method Solution of Half-Line Heat Equation",Mesh->None]​​
Out[]=
With{times={0.1,0.2,0.3,0.4,0.5,0.6},styles=ColorData[97,"ColorList"]},PlotEvaluate[Join[Table[approxU[x,t],{t,times}],{u[x,0]}]],{x,0,1},

Out[]=
Short-Time Behavior
t = 0.1
t = 0.2
t = 0.3
t = 0.4
t = 0.5
t = 0.6
t = 0
In[]:=
With[{times={0.5,1,1.5,2,2.5,3},styles=ColorData[97,"ColorList"]},Plot[Evaluate[Join[Table[approxU[x,t],{t,times}],{u[x,0]}(*Thisisu(x,0)*)]],{x,0,1},PlotStyle->Join[styles[[;;Length[times]]],(*applydistinctcolorpert*){{Black,Dashed}}(*styleforu(x,0)*)],PlotLegends->LineLegend[Join[Table["t = "<>ToString[t],{t,times}],{"u(x,0)"}],LegendLabel->"Long-Time Behavior"],AxesLabel->{"x","u(x,t)"},PlotLabel->"Long-Time Behavior of u(x,t)",Frame->True,Axes->False]]
Out[]=
Long-Time Behavior
t = 0.5
t = 1
t = 1.5
t = 2
t = 2.5
t = 3
u(x,0)

CITE THIS NOTEBOOK

An introduction to the U.T.M: the heat equation on a finite interval​
by Athanasios Paraskevopoulos​
Wolfram Community, STAFF PICKS, August 2, 2026
https://community.wolfram.com/groups/-/m/t/3771904