Try to find the solution for
n
= 10
. Is the solution reasonable?
T
′
(
x
l
)
≈
T
1
−
T
0
∆
x
,
T
′
(
x
r
)
≈
T
n
−
T
n
−
1
∆
x
Insulating boundary conditions at
x
=
x
l
and
x
=
x
r
imply that
T
′
(
x
l
) =
T
′
(
x
r
) = 0 and so
T
0
=
T
1
and
T
n
=
T
n
−
1
or
T
0
−
T
1
= 0
and
T
n
−
T
n
−
1
= 0
.
The equations for the interior points do not change. Only the equations for the boundary conditions
(
i
= 0 and
i
=
n
) need to be altered.
Combining these equations with the equations derived in class for the interior points, we obtain the
matrix equation
⎡
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎣
1
−
1
0
0
. . .
0
0
0
0
1
−
2
1
0
. . .
0
0
0
0
0
1
−
2
1
. . .
0
0
0
0
0
0
1
−
2
. . .
0
0
0
0
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
0
0
0
0
. . .
−
2
1
0
0
0
0
0
0
. . .
1
−
2
1
0
0
0
0
0
. . .
0
1
−
2
1
0
0
0
0
. . .
0
0
1
−
1
⎤
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎦
⎡
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎣
T
0
T
1
T
2
T
3
.
.
.
T
n
−
3
T
n
−
2
T
n
−
1
T
n
⎤
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎦
=
∆
x
2
⎡
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎣
0
−
1
−
1
−
1
.
.
.
−
1
−
1
−
1
0
⎤
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎦
The modified commands to solve this equation using MATLAB/Octave are:
n = 10;
X = linspace(0,1,n+1);
dx = 1/n;
L = ( diag(-2*ones(1,n+1)) + diag(ones(1,n),-1) + diag(ones(1,n),1));
L(1,1) = 1;
L(1,2) = -1;
L(n+1,n+1) = -1;
L(n+1,n) = 1;
r = -ones(n+1,1)*dx^2;
r(1) = 0;
r(n+1) = 0;
T = L\r;
Trying these commands with MATLAB/Octave we find that the matrix
P
is singular to machine
precision. This suggests that there may be something wrong with the physics of the problem. If check
the reduced row echelon form of the augmented matrix (
rref([L r])
) we get
⎡
⎢
⎢
⎢
⎢
⎢
⎣
1
0
. . .
0
−
1
0
0
1
. . .
0
−
1
0
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
0
0
. . .
1
−
1
0
0
0
. . .
0
0
1
⎤
⎥
⎥
⎥
⎥
⎥
⎦

6

From the last line we can see that the system of equations has no solution in this case.
This is
because, physically, we cannot have a steady (time-independent) temperature profile in the rod if we
are continually supplying heat but not allowing any to escape.
7.
In this problem we will use finite di
ff
erences to solve Laplace’s equation on a square. We
want to approximate the solution
f
(
x, y
)
to the partial di
ff
erential equation (Laplace’s
equation)
f
xx
(
x, y
) +
f
yy
(
x, y
) = 0
0
≤
x
≤
1
,
0
≤
y
≤
1
subject to the boundary conditions
f
(
x,
0) =
a
1
(
x
)
0
≤
x
≤
1
f
(0
, y
) =
a
2
(
y
)
0
≤
y
≤
1
f
(
x,
1) =
a
3
(
x
)
0
≤
x
≤
1
f
(1
, y
) =
a
4
(
y
)
0
≤
y
≤
1
You can think of
f
(
x, y
)
as the shape (i.e., the height) of a streched rubber membrane
attached along the edges of a square to a wire described by the four known functions
a
1
, . . . , a
4
.