Sie sind auf Seite 1von 5

Solution of Heat Equation

p = D@u@x, tD, tD
q = D@u@x, tD, 8x, 2<D
uH0,1L @x, tD

uH2,0L @x, tD
uH2,0L @x, tD

Problem 1 .ut - 2 ux x = 0,
u@0, tD = 0,
u@5, tD = 0,
u[x,0]= sin[x],

heqn = D@u@x, tD, tD - 2 * D@u@x, tD, 8x, 2<D Š 0


NDSolve@8heqn, u@x, 0D Š Sin@xD, u@0, tD Š 3, u@5, tD Š 0<, u@x, tD, 8x, 0, 1<, 8t, 0, 4<D
uH0,1L @x, tD - 2 uH2,0L @x, tD Š 0

88u@x, tD ® InterpolatingFunction@880., 5.<, 80., 4.<<, <>D@x, tD<<

Plot3D@Evaluate@u@x, tD . First@%DD, 8x, 0, 10<, 8t, 0, 4<, PlotRange ® AllD

-10 4

-20
3
-30

0 2

5 1

0
10

Problem-:2 ut - uxx = 0, 0 < x < 5, t > 0,


u Hx, 0L = 0, 0 b x £ 5,
u H0, tL = Sin HtL t³0
u H5, tL = 0, t ³ 0.
2 Practical-6.nb

eqn1a = p - q Š 0
NDSolve@8eqn1a, u@x, 0D Š 0, u@0, tD Š Sin@tD, u@5, tD Š 0<,
u, 8x, 0, 5<, 8t, 0, 10<D
Plot3D@Evaluate @u@x, tD . First@%DD, 8x, 0, 5<,
8t, 0, 4<, AxesLabel ® 8"x", "t", "u"<D
uH0,1L @x, tD - uH2,0L @x, tD Š 0

88u ® InterpolatingFunction@880., 5.<, 80., 10.<<, <>D<<

1.0

0.5 4
u
0.0
3
-0.5

0 2
t

2
1
x
4
0

Problem-:3 ut - uxx = 0, 0 < x < 20, t > 0,


u Hx, 0L = 0, 0 b x £ 20,
u H0, tL = t2 t³0
u H20, tL = 0, t ³ 0.
Practical-6.nb 3

eqn1c = p - q Š 0
NDSolveA9eqn1c, u@x, 0D Š 0, u@0, tD Š t2, u@20, tD Š 0=,
u, 8x, 0, 20<, 8t, 0, 10<E
Plot3D@Evaluate @u@x, tD . First@%DD, 8x, 0, 20<,
8t, 0, 10<, AxesLabel ® 8"x", "t", "u"<D
uH0,1L @x, tD - uH2,0L @x, tD Š 0

88u ® InterpolatingFunction@880., 20.<, 80., 10.<<, <>D<<

3
10
u 2

0
0 5
t
5

10
x
15
0
20

Problem-:4 ut - 4 uxx = 0, 0 < x < 1, t > 0,


u Hx, 0L = x2 H1 - xL, 0 b x £ 1,
u H0, tL = 0, t³0
u H1, tL = 0, t ³ 0.
4 Practical-6.nb

eqn2c = p - 4 q Š 0
NDSolve@8eqn2c, u@x, 0D Š x ^ 2 * H1 - xL,
u@0, tD Š 0, u@1, tD Š 0<, u, 8x, 0, 1<, 8t, 0, 10<D
Plot3D@Evaluate@u@x, tD . First@%DD, 8x, 0, 1<,
8t, 0, 10<, AxesLabel ® 8"x", "t", "u"<D
uH0,1L @x, tD - 4 uH2,0L @x, tD Š 0

88u ® InterpolatingFunction@880., 1.<, 80., 10.<<, <>D<<

1. ´ 10-9
u
5. ´ 10-10 10

-5. ´ 10-10

0.0 5
t

0.5
x

0
1.0

Problem-:5 ut - uxx = 2 x2 t, 0 < x < 1, t > 0,


u Hx, 0L = cos H3 Πx  2L, 0 b x £ 1,
u H0, tL = 1, t³0
ux H1, tL = 3 Π  2, t ³ 0.
Practical-6.nb 5

eqn3b = p - q Š 2 * x ^ 2 * t
NDSolve@8eqn3b, u@x, 0D Š Cos@3 * Pi * x  2D, u@0, tD Š 1,
Derivative @1, 0D@uD@1, tD Š 3 * Pi  2<, u, 8x, 0, 1<, 8t, 0, 10<D
Plot3D@Evaluate @u@x, tD . First@%DD, 8x, 0, 1<, 8t, 0, 10<D
uH0,1L @x, tD - uH2,0L @x, tD Š 2 t x2

88u ® InterpolatingFunction@880., 1.<, 80., 10.<<, <>D<<

10

10
5

0.0 5

0.5

0
1.0

Das könnte Ihnen auch gefallen