pde file
pde file
DSolve[x ^ 2 * D[u[x, y], x] + y ^ 2 * D[u[x, y], y] ⩵ (x + y) * u[x, y], u[x, y], {x, y}]
-x + y
u[x, y] → x y C[1]
xy
∂u ∂u
Ques. Solve the 1 st Order PDE : x +y =u
∂x ∂y
2 pde file.nb
DSolve[x * D[u[x, y], x] + y * D[u[x, y], y] ⩵ u[x, y], u[x, y], {x, y}]
y
u[x, y] → x C[1]
x
∂u ∂u
Ques. Solve the 1 st Order PDE : x +y = nu
∂x ∂y
DSolve[x * D[u[x, y], x] + y * D[u[x, y], y] ⩵ n * u[x, y], u[x, y], {x, y}]
y
u[x, y] → xn C[1]
x
sol = DSolve[{D[u[x, y], x] - D[u[x, y], y] ⩵ 1, u[x, 0] == x ^ 2}, u[x, y], {x, y}]
u[x, y] → x2 - y + 2 x y + y2
sol1 = DSolve[
{x * D[u[x, y], x] + y * D[u[x, y], y] ⩵ x * Exp[- u[x, y]], u[x, x ^ 2] ⩵ 0}, u[x, y], {x, y}]
y
u[x, y] → Log1 + x -
x
pde file.nb 3
sol2 = DSolve[{y * D[u[x, y], x] + x * D[u[x, y], y] ⩵ 0, u[0, y] ⩵ Exp[- y ^ 2]}, u[x, y], {x, y}]
2
-y2
u[x, y] → ⅇx
sol3 = DSolve[{x * D[u[x, y], x] + y * D[u[x, y], y] ⩵ 2 * x * y, u[x, x ^ 2] ⩵ 2}, u[x, y], {x, y}]
2 x 3 + x4 y - y 3
u[x, y] →
x3
sol4 = DSolve[{D[u[x, y], x] + x * D[u[x, y], y] ⩵ 0, u[0, y] ⩵ Sin[y]}, u[x, y], {x, y}]
1
u[x, y] → Sin - x2 + 2 y
2
1.0
0.5
-4 -2 2 4
-0.5
-1.0
1.0
0.5
-4 -2 2 4
-0.5
-1.0
1 2
Ques. Solve the PDE ux + xuy = y - , x2
2
u (0, y) = ey and plot the solution over the domain [-2, 2] x[-2, 2]
sol5 = DSolve
D[u[x, y], x] + x * D[u[x, y], y] ⩵ y - x ^ 2 2 ^ 2, u[0, y] ⩵ Exp[y], u[x, y], {x, y}
1 -
x2 x2 x2 x2
u[x, y] → ⅇ 2 4 ⅇy + ⅇ 2 x5 - 4 ⅇ 2 x3 y + 4 ⅇ 2 x y2
4
6 pde file.nb
u[x, y] → - ⅇ-2 y 1 + x2 - ⅇ2 y x2 + 2 x y - 2 ⅇ2 y x y + y2 - ⅇ2 y y2 ,
u x, x2 = x2 and plot the solution over the domain [-2, 2] x[1, 5]
sol7 =
DSolve[{D[u[x, y], x] + x * D[u[x, y], y] ⩵ u[x, y] + 1, u[x, x ^ 2] ⩵ x ^ 2}, u[x, y], {x, y}]
-x2 +2 y -x2 +2 y -x2 +2 y
u[x, y] → - 1 + ⅇx+ - ⅇx+ x2 + 2 ⅇx+ y
Practical - 2
Problem : -2
Obtain the solution of the linear equation : yu x - 2 xyuy = 2 xu,
with the Cauchy data u (0, y) =
y3 .Plot the integral surface with in the range {x, -7, 7} & {y, -5, 5}.
Problem : -3
Determine the integral surfaces of the equation : u x + uy = u2 ,
(a) with the data x + y = 0, u = 1.
(b) with the data u (x, 0) =
tanh (x). Plot the integral surface with in the range {x, -10, 10} &
{y, -10, 10}.
(a)
b
Problem : -4
Obtain the solution of the linear equation : u x + uy = 1,
with the Cauchy data u (x, 2 x) =
x3 .Plot the integral surface with in the range {x, -4, 4} & {y, -5, 5}.
sol = DSolveD[u[x, y], x] + D[u[x, y], y] ⩵ 1, u[x, 2 x] ⩵ x3 , u[x, y], {x, y}
u[x, y] → 2 x - x3 - y + 3 x2 y - 3 x y2 + y3
Problem : -5
Obtain the solution of the linear equation : u (x + y) u x + u (x - y) uy = x2 + y2 ,
with the Cauchy data u (x, 2 x) =
0. Plot the integral surface with in the range {x, -4, 4} & {y, -5, 5}.
2 2
u[x, y] → - 2 x2 + 3 x y - 2 y2 , u[x, y] → 2 x2 + 3 x y - 2 y2 ,
7 7
2 2
u[x, y] → - 2 x2 + 3 x y - 2 y2 , u[x, y] → 2 x2 + 3 x y - 2 y2
7 7
12 pde file.nb
Problem : -6
Obtain the solution of the pde : ux + uuy = 1, with the Cauchy data u (0, y) =
4 y. Plot the integral surface with in the range {x, -4, 4} & {y, -5, 5}.
Problem : -7
Obtain the solution of the pde : ux + yuy = 0, with the Cauchy data u (0, y) =
4 y. Plot the integral surface with in the range {x, -4, 4} & {y, -5, 5}.
Problem : -8
Find the solution of the equation : ux + uy = 0, with the Cauchy data u (0, y) =
2
e-y . Plot the integral surface with in the range {x, -4, 4} & {y, -5, 5}.
Problem : -9
Determine the integral surface of the equation : u x + uy = u2 ,
with the data u (x, 0) =
tanh (x). Plot the integral surface with in the range {x, -10, 10} &
{y, -10, 10}.
Practical - 3
10
5 y=x
y=2x
x
-4 -2 2 4 y=3x
-5
-10
10
5 u=x
u=2x
x
-4 -2 2 4 u=3x
-5
-10
pde file.nb 17
Plot3D[{x, 2 x, 3 x}, {x, - 4, 4}, {u, - 4, 4}, PlotLegends → {"y=x", "y=2x", "y=3x"},
Axes → True, AxesLabel → {"x", "u", "y"}, PlotLabel → "Characteristic Curves"]
y=x
y=2x
y=3x
ParametricPlot3D[{{t, t, u}, {t, 2 t, u}, {t, 3 t, u}}, {t, - 5, 5}, {u, - 4, 4}]
18 pde file.nb
ParametricPlot3D[{{t, y, u}, {t, y, 2 t}, {t, y, 3 t}}, {t, - 5, 5}, {y, - 4, 4}]
Plot[{1 - x, 2 - x, 3 - x}, {x, 0, 3}, PlotLegends → {"x+y=1", "x+y=2", "x+y=3"}, Axes → True,
AxesLabel → {"x", "y"}, PlotLabel → "Characteristic Curves", PlotRange → {0, 3}]
Characteristic Curves
y
3.0
2.5
2.0 x+y=1
x+y=2
1.5
x+y=3
1.0
0.5
x
0.0 0.5 1.0 1.5 2.0 2.5 3.0
4 u-x=1
u-x=2
2
u-x=3
x
-4 -2 2 4
-2
20 pde file.nb
Plot3D[{1 - x, 2 - x, 3 - x}, {x, - 4, 4}, {u, - 4, 4}, PlotLegends → {"x+y=1", "x+y=2", "x+y=3"},
Axes → True, AxesLabel → {"x", "u", "y"}, PlotLabel → "Characteristic Curves"]
x+y=1
x+y=2
x+y=3
Plot3D[{1 + x, 2 + x, 3 + x}, {x, - 4, 4}, {y, - 4, 4}, PlotLegends → {"u-x=1", "u-x=2", "u-x=3"},
Axes → True, AxesLabel → {"x", "y", "u"}, PlotLabel → "Characteristic Curves"]
u-x=1
u-x=2
u-x=3
pde file.nb 21
ParametricPlot3D[{{t, 1 - t, u}, {t, 2 - t, u}, {t, 3 - t, u}}, {t, - 5, 5}, {u, - 4, 4}]
ParametricPlot3D[{{t, y, 1 + t}, {t, y, 2 + t}, {t, y, 3 + t}}, {t, - 5, 5}, {y, - 4, 4}]
ⅆx ⅆy ⅆu
Solution : The characteristic equations are = = .
2 2 (x + y) u
x y
Using (i) = (ii) and integrating we have,
y-x
ϕ= = C1, is the first integral.
xy
Using (i) = (iii) and integrating we have,
u
Ψ= = C2, is the second integral.
x-y
Characteristic Curves
y
0.5
y-x
x =1
-3 -2 -1 1 2 3
xy
y-x
=2
xy
-0.5
y-x
=3
xy
-1.0
-1.5
pde file.nb 23
u
=1
x-y
u
=2
x-y
u
=3
x-y
Practical - 4
c := 1;
-π π -π π
f[x_] := PiecewiseCos[x]3 , ≤x≤ , 0, x < , 0, x > ;
2 2 2 2
g[x_] := 0;
u[x_, t_] :=
1 1
f[x + c * t] + f[x - c * t] + * Integrate[g[τ], {τ, x - c * t, x + c * t}];
2 2 * c
h0 = Plot[Evaluate[u[x, 0]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=0"]
h1 = Plot[Evaluate[u[x, 1]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=1"]
h2 = Plot[Evaluate[u[x, 2]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=2"]
h3 = Plot[Evaluate[u[x, 3]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=3"]
h4 = Plot[Evaluate[u[x, 4]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=4"]
h5 = Plot[Evaluate[u[x, 5]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=5"]
Show[GraphicsArray[{h0, h1}, {h2, h3}, {h4, h5}]]
Plot3D[u[x, t], {x, - 8, 8}, {t, 0, 5}]
1.0
0.8
0.6
Wave at t=0
0.4
0.2
-5 5
0.5
0.4
0.3
Wave at t=1
0.2
0.1
-5 5
pde file.nb 25
0.5
0.4
0.3
Wave at t=2
0.2
0.1
-5 5
0.5
0.4
0.3
Wave at t=3
0.2
0.1
-5 5
0.5
0.4
0.3
Wave at t=4
0.2
0.1
-5 5
26 pde file.nb
0.5
0.4
0.3
Wave at t=5
0.2
0.1
-5 5
1.0 0.5
0.8 0.4
0.6 0.3
ShowGraphicsGrid 0.4 Wave at t=0 , 0.2 Wave at t=1 ,
0.2 0.1
-5 5 -5 5
0.5 0.5
0.4 0.4
0.3 0.3
0.2 Wave at t=2 , 0.2 Wave at t=3 ,
0.1 0.1
-5 5 -5 5
0.5 0.5
0.4 0.4
0.3 0.3
0.2 Wave at t=4 , 0.2 Wave at t=5
0.1 0.1
-5 5 -5 5
c := 1;
f[x_] := Sin[x];
g[x_] := Cos[x];
u[x_, t_] :=
1 1
f[x + c * t] + f[x - c * t] + * Integrate[g[τ], {τ, x - c * t, x + c * t}];
2 2 * c
h0 = Plot[Evaluate[u[x, 0]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=0"]
h1 = Plot[Evaluate[u[x, 1]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=1"]
h2 = Plot[Evaluate[u[x, 2]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=2"]
h3 = Plot[Evaluate[u[x, 3]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=3"]
h4 = Plot[Evaluate[u[x, 4]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=4"]
h5 = Plot[Evaluate[u[x, 5]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=5"]
Show[GraphicsArray[{h0, h1}, {h2, h3}, {h4, h5}]]
Plot3D[u[x, t], {x, - 8, 8}, {t, 0, 5}]
1.0
0.5
-5 5
Wave at t=0
-0.5
-1.0
1.0
0.5
-5 5
Wave at t=1
-0.5
-1.0
28 pde file.nb
1.0
0.5
-5 5
Wave at t=2
-0.5
-1.0
1.0
0.5
-5 5
Wave at t=3
-0.5
-1.0
1.0
0.5
-5 5
Wave at t=4
-0.5
-1.0
pde file.nb 29
1.0
0.5
-5 5
Wave at t=5
-0.5
-1.0
1.0 1.0
0.5 0.5
ShowGraphicsGrid Wave at t=0 , Wave at t=1 ,
-5 5 -5 5
-0.5 -0.5
-1.0 -1.0
1.0 1.0
0.5 0.5
-5 5
Wave at t=2 , -5 5
Wave at t=3 ,
-0.5 -0.5
-1.0 -1.0
1.0 1.0
0.5 0.5
-5 5
Wave at t=4 , -5 5
Wave at t=5
-0.5 -0.5
-1.0 -1.0
c := Sqrt[N[π]];
f[x_] := 0;
g[x_] := Exp- x2 ;
u[x_, t_] :=
1 1
f[x + c * t] + f[x - c * t] + * Integrate[g[τ], {τ, x - c * t, x + c * t}];
2 2 * c
h0 = Plot[Evaluate[u[x, 0]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=0"]
h1 = Plot[Evaluate[u[x, 1]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=1"]
h2 = Plot[Evaluate[u[x, 2]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=2"]
h3 = Plot[Evaluate[u[x, 3]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=3"]
h4 = Plot[Evaluate[u[x, 4]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=4"]
h5 = Plot[Evaluate[u[x, 5]], {x, - 8, 8}, PlotRange → All, PlotLegends → "Wave at t=5"]
Show[GraphicsArray[{h0, h1}, {h2, h3}, {h4, h5}]]
Plot3D[u[x, t], {x, - 8, 8}, {t, 0, 5}]
1.0
0.5
-5 5
Wave at t=0
-0.5
-1.0
0.5
0.4
0.3
Wave at t=1
0.2
0.1
-5 5
pde file.nb 31
0.5
0.4
0.3
Wave at t=2
0.2
0.1
-5 5
0.5
0.4
0.3
Wave at t=3
0.2
0.1
-5 5
0.5
0.4
0.3
Wave at t=4
0.2
0.1
-5 5
32 pde file.nb
0.50
0.49
0.48
Wave at t=5
0.47
0.46
0.45
-5 5
1.0 0.5
0.4
0.5 0.3
ShowGraphicsGrid Wave at t=0 , 0.2 Wave at t=1 ,
-5 5
-0.5 0.1
-1.0 -5 5
0.5 0.5
0.4 0.4
0.3 0.3
0.2 Wave at t=2 , 0.2 Wave at t=3 ,
0.1 0.1
-5 5 -5 5
0.5 0.50
0.4 0.49
0.3 0.48
0.2 Wave at t=4 , 0.47 Wave at t=5
0.46
-5 5 -5 5
Ques 1
utt = uxx , 0 < x < ∞, t > 0
ut (x, 0) = 0 , 0 < x < ∞
ux (0, t) = 0 , ∀ t > 0
c := 1;
π
f[x_] := Cos x;
2
g[x_] := 0;
u[x_, t_] := Piecewise
1 1
f[x + c * t] + f[x - c * t] + * Integrate[g[τ], {τ, x - c * t, x + c * t}], x > c * t,
2 2 * c
1
f[x + c * t] + f[x - c * t] +
2
1
* Integrate[g[τ], {τ, 0, c * t - x}], x < c * t;;
2 * c
h0 = Plot[Evaluate[u[x, 0]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=0"]
h1 = Plot[Evaluate[u[x, 1]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=1"]
h2 = Plot[Evaluate[u[x, 2]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=2"]
h3 = Plot[Evaluate[u[x, 3]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=3"]
h4 = Plot[Evaluate[u[x, 4]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=4"]
h5 = Plot[Evaluate[u[x, 5]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=5"]
Show[GraphicsArray[{h0, h1}, {h2, h3}, {h4, h5}]]
Plot3D[u[x, t], {x, 0, 8}, {t, 0, 5}]
1.0
0.5
2 4 6 8
Wave at t=0
-0.5
-1.0
34 pde file.nb
1. × 10-15
5. × 10-16
Wave at t=1
1 2 3 4 5 6 7 8
-5. × 10-16
1.0
0.5
3 4 5 6 7 8
Wave at t=2
-0.5
-1.0
1.5 × 10-15
1. × 10-15
5. × 10-16
Wave at t=3
1 2 3 4 5 6 7 8
-5. × 10-16
-1. × 10-15
-1.5 × 10-15
1.0
0.5
5 6 7 8
Wave at t=4
-0.5
-1.0
pde file.nb 35
1.5 × 10-15
1. × 10-15
5. × 10-16
1 2 3 4 5 6 7 8 Wave at t=5
-16
-5. × 10
-1. × 10-15
-1.5 × 10-15
1.0
0.5 1. × 10-15
ShowGraphicsGrid Wave at t=0 , Wave at t=1 ,
-0.5 2 4 6 8 2345678
-1.0
1.0
0.5
3 4 5 6 7 8
Wave at t=2 , 2345678
Wave at t=3 ,
-0.5
-1.0
1.0
0.5
5 6 7 8
Wave at t=4 , 2345678
Wave at t=5
-0.5
-1.0
Ques 2
utt = uxx , 0 < x < ∞, t > 0
π
u (x, 0) = Cos x , 0 < x < ∞
2
ut (x, 0) = Sin (x) , 0 < x < ∞
ux (0, t) = 0 , ∀ t > 0
36 pde file.nb
c := 1;
π
f[x_] := Cos x;
2
g[x_] := Sin[x];
u[x_, t_] := Piecewise
1 1
f[x + c * t] + f[x - c * t] + * Integrate[g[τ], {τ, x - c * t, x + c * t}], x > c * t,
2 2 * c
1
f[x + c * t] + f[x - c * t] +
2
1
* Integrate[g[τ], {τ, 0, c * t - x}], x < c * t;;
2 * c
h0 = Plot[Evaluate[u[x, 0]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=0"]
h1 = Plot[Evaluate[u[x, 1]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=1"]
h2 = Plot[Evaluate[u[x, 2]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=2"]
h3 = Plot[Evaluate[u[x, 3]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=3"]
h4 = Plot[Evaluate[u[x, 4]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=4"]
h5 = Plot[Evaluate[u[x, 5]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=5"]
Show[GraphicsArray[{h0, h1}, {h2, h3}, {h4, h5}]]
Plot3D[u[x, t], {x, 0, 8}, {t, 0, 5}]
1.0
0.5
2 4 6 8
Wave at t=0
-0.5
-1.0
0.5
2 3 4 5 6 7 8
Wave at t=1
-0.5
pde file.nb 37
2.0
1.5
1.0
0.5
Wave at t=2
3 4 5 6 7 8
-0.5
-1.0
-1.5
0.15
0.10
0.05
4 5 6 7 8
Wave at t=3
-0.05
-0.10
-0.15
1.5
1.0
0.5
Wave at t=4
5 6 7 8
-0.5
-1.0
38 pde file.nb
1.0
0.5
-0.5
-1.0
1.0
0.5 0.5
ShowGraphicsGrid Wave at t=0 , Wave at t=1 ,
-0.5 2 4 6 8 2 3 4 5 6 7 8
-0.5
-1.0
2.0 0.15
1.5 0.10
1.0
Wave at t=2 , 4 5 6 7 8
Wave at t=3 ,
-1.0 3 4 5 6 7 8 -0.10
-1.5 -0.15
1.5 1.0
1.0 0.5
0.5
Wave at t=4 , Wave at t=5
5 6 7 8 -0.5 5.56.06.57.07.58.0
-1.0 -1.0
Ques 3
utt = uxx , 0 < x < ∞, t > 0
π
u (x, 0) = Cos x , 0 < x < ∞
2
-x
ut (x, 0) = e , 0 < x < ∞
ux (0, t) = 0 , ∀ t > 0
pde file.nb 39
c := 1;
π
f[x_] := Cos x;
2
g[x_] := Exp[- x];
u[x_, t_] := Piecewise
1 1
f[x + c * t] + f[x - c * t] + * Integrate[g[τ], {τ, x - c * t, x + c * t}], x > c * t,
2 2 * c
1
f[x + c * t] + f[x - c * t] +
2
1
* Integrate[g[τ], {τ, 0, c * t - x}], x < c * t;;
2 * c
h0 = Plot[Evaluate[u[x, 0]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=0"]
h1 = Plot[Evaluate[u[x, 1]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=1"]
h2 = Plot[Evaluate[u[x, 2]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=2"]
h3 = Plot[Evaluate[u[x, 3]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=3"]
h4 = Plot[Evaluate[u[x, 4]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=4"]
h5 = Plot[Evaluate[u[x, 5]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=5"]
Show[GraphicsArray[{h0, h1}, {h2, h3}, {h4, h5}]]
Plot3D[u[x, t], {x, 0, 8}, {t, 0, 5}]
1.0
0.5
2 4 6 8
Wave at t=0
-0.5
-1.0
0.4
0.3
0.2
Wave at t=1
0.1
2 3 4 5 6 7 8
40 pde file.nb
1.5
1.0
0.5
Wave at t=2
3 4 5 6 7 8
-0.5
-1.0
0.5
0.4
0.3
Wave at t=3
0.2
0.1
4 5 6 7 8
1.5
1.0
0.5
Wave at t=4
5 6 7 8
-0.5
-1.0
pde file.nb 41
0.5
0.4
0.3
Wave at t=5
0.2
0.1
1.0 0.4
0.5 0.3
ShowGraphicsGrid Wave at t=0 , 0.2 Wave at t=1 ,
-0.5 2 4 6 8 0.1
-1.0 2 3 4 5 6 7 8
0.5
1.5 0.4
1.0 0.3
0.5
Wave at t=2 , 0.2 Wave at t=3 ,
3 4 5 6 7 8 0.1
-1.0
4 5 6 7 8
1.5 0.5
1.0 0.4
0.5 0.3
Wave at t=4 , 0.2 Wave at t=5
-0.5 5 6 7 8
-1.0 5.56.06.57.07.58.0
Ques 4
utt = uxx , 0 < x < ∞, t > 0
π
u (x, 0) = Cos x , 0 < x < ∞
2
-x2
ut (x, 0) = e , 0 < x < ∞
42 pde file.nb
ux (0, t) = 0 , ∀ t > 0
c := 1;
π
f[x_] := Cos x;
2
g[x_] := Exp- x2 ;
u[x_, t_] := Piecewise
1 1
f[x + c * t] + f[x - c * t] + * Integrate[g[τ], {τ, x - c * t, x + c * t}], x > c * t,
2 2 * c
1
f[x + c * t] + f[x - c * t] +
2
1
* Integrate[g[τ], {τ, 0, c * t - x}], x < c * t;;
2 * c
h0 = Plot[Evaluate[u[x, 0]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=0"]
h1 = Plot[Evaluate[u[x, 1]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=1"]
h2 = Plot[Evaluate[u[x, 2]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=2"]
h3 = Plot[Evaluate[u[x, 3]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=3"]
h4 = Plot[Evaluate[u[x, 4]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=4"]
h5 = Plot[Evaluate[u[x, 5]], {x, 0, 8}, PlotRange → All, PlotLegends → "Wave at t=5"]
Show[GraphicsArray[{h0, h1}, {h2, h3}, {h4, h5}]]
Plot3D[u[x, t], {x, 0, 8}, {t, 0, 5}]
1.0
0.5
2 4 6 8
Wave at t=0
-0.5
-1.0
0.4
0.3
Wave at t=1
0.2
0.1
2 3 4 5 6 7 8
pde file.nb 43
1.5
1.0
0.5
Wave at t=2
3 4 5 6 7 8
-0.5
-1.0
0.4
0.3
Wave at t=3
0.2
0.1
4 5 6 7 8
1.5
1.0
0.5
Wave at t=4
5 6 7 8
-0.5
-1.0
44 pde file.nb
0.4
0.3
Wave at t=5
0.2
0.1
1.0 0.4
0.5 0.3
ShowGraphicsGrid Wave at t=0 , 0.2 Wave at t=1 ,
-0.5 2 4 6 8 0.1
-1.0 2 3 4 5 6 7 8
1.5 0.4
1.0 0.3
0.5
Wave at t=2 , 0.2
0.1
Wave at t=3 ,
-0.5 3 4 5 6 7 8
-1.0 4 5 6 7 8
1.5 0.4
1.0 0.3
0.5
Wave at t=4 , 0.2
0.1
Wave at t=5
-0.5 5 6 7 8
-1.0 5.56.06.57.07.58.0
u (0, t) = 0, ∀ t ≥ 0
u (l, t) = 0, ∀ t ≥ 0
Solution :
∞
nπct nπct nπct
u (x, t) = an Cos + bn Sin Sin
n=1 l l l
2 1 nπx
where an = f (x) Sin
ⅆx
l 0 l
2 1 nπx
bn = g (x) Sin ⅆx
nπc 0 l
Ques 1
utt = uxx , 0 < x < 1, t ≥ 0
u (x, 0) = Sin (πx) , 0 ≤ x ≤ l
ut (x, 0) = 3 x + 1 , 0 ≤ x ≤ l
u (0, t) = 0 , ∀ t ≥ 0
u (l, t) = 0 , ∀ t ≥ 0
l := 1;
c := 1;
f[x_] := Sin[π x];
g[x_] := 3 x + 1;
2 nπx
a[n_] := * Integratef[x] * Sin , {x, 0, l};
l l
2 nπx
b[n_] := * Integrateg[x] * Sin , {x, 0, l};
nπc l
nπc nπc n πx
v[x_, t_, n_] := a[n] * Cos t + b[n] * Sin t * Sin ;
l l l
u[x_, t_] := Sum[v[x, t, k], {k, 1, 10}];
h0 = Plot[Evaluate[u[x, 0]], {x, 0, 1}, PlotRange → All, PlotLegends → "Wave at t=0"]
h1 = Plot[Evaluate[u[x, 1]], {x, 0, 1}, PlotRange → All, PlotLegends → "Wave at t=1"]
h2 = Plot[Evaluate[u[x, 2]], {x, 0, 1}, PlotRange → All, PlotLegends → "Wave at t=2"]
h3 = Plot[Evaluate[u[x, 3]], {x, 0, 1}, PlotRange → All, PlotLegends → "Wave at t=3"]
h4 = Plot[Evaluate[u[x, 4]], {x, 0, 1}, PlotRange → All, PlotLegends → "Wave at t=4"]
h5 = Plot[Evaluate[u[x, 5]], {x, 0, 1}, PlotRange → All, PlotLegends → "Wave at t=5"]
Show[GraphicsArray[{h0, h1}, {h2, h3}, {h4, h5}]]
Plot3D[Evaluate[u[x, t], {x, 0, 1}, {t, 0, 5}]]
46 pde file.nb
1.0
0.8
0.6
Wave at t=0
0.4
0.2
-0.2
-0.4
Wave at t=1
-0.6
-0.8
-1.0
1.0
0.8
0.6
Wave at t=2
0.4
0.2
-0.2
-0.4
Wave at t=3
-0.6
-0.8
-1.0
1.0
0.8
0.6
Wave at t=4
0.4
0.2
-0.2
-0.4
Wave at t=5
-0.6
-0.8
-1.0
48 pde file.nb
1.0
0.8 -0.2 0.20.40.60.81.0
0.6
ShowGraphicsGrid 0.4 Wave at t=0 , -0.4
-0.6 Wave at t=1 ,
0.2 -0.8
-1.0
0.2 0.4 0.6 0.8 1.0
1.0
0.8 -0.2 0.20.40.60.81.0
0.6
0.4 Wave at t=2 , -0.4
-0.6 Wave at t=3 ,
0.2 -0.8
-1.0
0.2 0.4 0.6 0.8 1.0
1.0
0.8 -0.2 0.20.40.60.81.0
0.6
0.4 Wave at t=4 , -0.4
-0.6 Wave at t=5
0.2 -0.8
-1.0
0.2 0.4 0.6 0.8 1.0
Ques 2
utt = 4 uxx , 0 ≤ x ≤ 3, t ≥ 0
π
u (x, 0) = Sin x , 0 ≤ x ≤ 3
2
ut (x, 0) = Cos (3 x) , 0 ≤ x ≤ 3
u (0, t) = 0 , ∀ t ≥ 0
u (l, t) = 0 , ∀ t ≥ 0
pde file.nb 49
l := 3;
c := 2;
π
f[x_] := Sin x;
2
g[x_] := Cos[3 x];
2 nπx
a[n_] := * Integratef[x] * Sin , {x, 0, l};
l l
2 nπx
b[n_] := * Integrateg[x] * Sin , {x, 0, l};
nπc l
nπc nπc n πx
v[x_, t_, n_] := a[n] * Cos t + b[n] * Sin t * Sin ;
l l l
u[x_, t_] := Sum[v[x, t, k], {k, 1, 10}];
h0 = Plot[Evaluate[u[x, 0]], {x, 0, 3}, PlotRange → All, PlotLegends → "Wave at t=0"]
h1 = Plot[Evaluate[u[x, 1]], {x, 0, 3}, PlotRange → All, PlotLegends → "Wave at t=1"]
h2 = Plot[Evaluate[u[x, 2]], {x, 0, 3}, PlotRange → All, PlotLegends → "Wave at t=2"]
h3 = Plot[Evaluate[u[x, 3]], {x, 0, 3}, PlotRange → All, PlotLegends → "Wave at t=3"]
h4 = Plot[Evaluate[u[x, 4]], {x, 0, 3}, PlotRange → All, PlotLegends → "Wave at t=4"]
h5 = Plot[Evaluate[u[x, 5]], {x, 0, 3}, PlotRange → All, PlotLegends → "Wave at t=5"]
Show[GraphicsArray[{h0, h1}, {h2, h3}, {h4, h5}]]
Plot3D[Evaluate[u[x, t], {x, 0, 1}, {t, 0, 5}]]
1.0
0.5
-0.5
-1.0
-0.2
-0.6
-0.8
50 pde file.nb
0.2
-0.2
-0.4
Wave at t=2
-0.6
-0.8
-1.0
-1.2
1.0
0.5
-0.5
-1.0
-0.2
-0.6
-0.8
pde file.nb 51
0.2
-0.2
-0.4
Wave at t=5
-0.6
-0.8
-1.0
-1.2
1.0
0.5 0.51.01.52.02.53.0
ShowGraphicsGrid Wave at t=0 , -0.4 Wave at t=1 ,
-0.5 0.51.01.52.02.53.0 -0.6
-1.0 -0.8
1.0
0.51.01.52.02.53.0 0.5
-0.4
-0.6 Wave at t=2 , Wave at t=3 ,
-0.8 -0.5 0.51.01.52.02.53.0
-1.0 -1.0
-1.2
0.51.01.52.02.53.0
-0.4 Wave at t=4 , -0.4 0.51.01.52.02.53.0 Wave at t=5
-0.6 -0.6
-0.8
-0.8 -1.0
-1.2
Practical - 5
u (0, t) = u (l, t) = 0, ∀ t ≥ 0
u (l, t) = 0, ∀ t ≥ 0
Its Solution -
∞ nπ 2
t nπx
u (x, t) = an ⅇ-k l Sin
n=l
l
2 1 nπx
where an = f (x) Sin ⅆx
l 0 l
Ques 1
ut = uxx , 0 < x < l, t ≥ 0
u (x, 0) = 50 , 0 ≤ x ≤ l
u (0, t) = u (l, t) = 0 , ∀ t ≥ 0
l := 1;
k := 1;
f[x_] := 50;
2 nπx
a[n_] := * Integratef[x] * Sin , {x, 0, l};
l l
nπ 2 n πx
v[x_, t_, n_] := a[n] * Exp- k * * t * Sin ;
l l
u[x_, t_] := Sum[v[x, t, n], {n, 1, 10}];
h0 = Plot[Evaluate[u[x, 0]], {x, 0, 1},
PlotRange → All, PlotLegends → "Heat Equation at t=0"]
h1 = Plot[Evaluate[u[x, 1]], {x, 0, 1}, PlotRange → All,
PlotLegends → "Heat Equation at t=1"]
h2 = Plot[Evaluate[u[x, 2]], {x, 0, 1}, PlotRange → All,
PlotLegends → "Heat Equation at t=2"]
h3 = Plot[Evaluate[u[x, 3]], {x, 0, 1}, PlotRange → All,
PlotLegends → "Heat Equation at t=3"]
h4 = Plot[Evaluate[u[x, 4]], {x, 0, 1}, PlotRange → All,
PlotLegends → "Heat Equation at t=4"]
h5 = Plot[Evaluate[u[x, 5]], {x, 0, 1}, PlotRange → All,
PlotLegends → "Heat Equation at t=5"]
Show[GraphicsArray[{{h0, h1}, {h2, h3}, {h4, h5}}]]
Plot3D[Evaluate[u[x, t], {x, 0, 1}, {t, 0, 5}]]
pde file.nb 53
60
50
40
20
10
0.0030
0.0025
0.0020
0.0010
0.0005
1.5 × 10-7
1. × 10-7
Heat Equation at t=2
5. × 10-8
8. × 10-12
6. × 10-12
2. × 10-12
4. × 10-16
3. × 10-16
1. × 10-16
2. × 10-20
1.5 × 10-20
5. × 10-21
0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0
20
20
Heat Equation
20 Heat Equation
21
0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0
pde file.nb 55
Ques 2
ut = πuxx , 0 ≤ x ≤ l, t ≥ 0
u (x, 0) = Sin (2 x), 0 ≤ x ≤ l
u (0, t) = u (l, t) = 0 , ∀ t ≥ 0
l := 1;
k := π;
f[x_] := Sin[2 x];
2 nπx
a[n_] := * Integratef[x] * Sin , {x, 0, l};
l l
nπ 2 n πx
v[x_, t_, n_] := a[n] * Exp- k * * t * Sin ;
l l
u[x_, t_] := Sum[v[x, t, n], {n, 1, 10}];
h0 = Plot[Evaluate[u[x, 0]], {x, 0, 1},
PlotRange → All, PlotLegends → "Heat Equation at t=0"]
h1 = Plot[Evaluate[u[x, 1]], {x, 0, 1}, PlotRange → All,
PlotLegends → "Heat Equation at t=1"]
h2 = Plot[Evaluate[u[x, 2]], {x, 0, 1}, PlotRange → All,
PlotLegends → "Heat Equation at t=2"]
h3 = Plot[Evaluate[u[x, 3]], {x, 0, 1}, PlotRange → All,
PlotLegends → "Heat Equation at t=3"]
h4 = Plot[Evaluate[u[x, 4]], {x, 0, 1}, PlotRange → All,
PlotLegends → "Heat Equation at t=4"]
h5 = Plot[Evaluate[u[x, 5]], {x, 0, 1}, PlotRange → All,
PlotLegends → "Heat Equation at t=5"]
Show[GraphicsArray[{{h0, h1}, {h2, h3}, {h4, h5}}]]
Plot3D[Evaluate[u[x, t], {x, 0, 1}, {t, 0, 5}]]
56 pde file.nb
1.2
1.0
0.8
0.4
0.2
3.5 × 10-14
3. × 10-14
2.5 × 10-14
2. × 10-14
Heat Equation at t=1
1.5 × 10-14
1. × 10-14
5. × 10-15
1.2 × 10-27
1. × 10-27
8. × 10-28
4. × 10-28
2. × 10-28
4. × 10-41
3. × 10-41
1. × 10-41
1.4 × 10-54
1.2 × 10-54
1. × 10-54
8. × 10-55
Heat Equation at t=4
6. × 10-55
4. × 10-55
2. × 10-55
4. × 10-68
3. × 10-68
1. × 10-68
14
14
14
14
Heat Equation
14 Heat Equation
14
0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0
0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0
58 pde file.nb
Problem - : 1 (b)
ut - uxx = 0, 0 < x < 20, t > 0,
u (x, 0) = 0, 0 ≤ x ≤ 20,
u (0, t) = t2 * Sin (t) , t ≥ 0
u (20, t) = 0 , t ≥ 0
60 pde file.nb
Problem - : 1 (c)
ut - uxx = 0, 0 < x < 20, t > 0
u (x, 0) = 0, 0 ≤ x ≤ 20,
u (0, t) = t2 , t ≥ 0
u (20, t) = 0 , t ≥ 0
pde file.nb 61
Problem - : 2 (a)
ut - uxx = 0, 0 < x < 5, t > 0,
u (x, 0) = Sin (x), 0 ≤ x ≤ 5,
u (0, t) = 1, t ≥ 0
u (5, t) = 0 , t ≥ 0
62 pde file.nb
Problem - : 2 (b)
ut - uxx = 0, 0 < x < 10, t > 0,
u (x, 0) = Tanh (x), 0 ≤ x ≤ 10,
u (0, t) = t, t ≥ 0
u (10, t) = 0 , t ≥ 0
pde file.nb 63
Problem - : 2 (c)
ut - 4 uxx = 0, 0 < x < 1, t > 0,
u (x, 0) = x2 (1 - x), 0 ≤ x ≤ 1,
u (0, t) = t, t ≥ 0
u (1, t) = 0 , t ≥ 0
64 pde file.nb
Problem - : 3 (a)
ut - 4 uxx = xt, 0 < x < 1, t > 0,
u (x, 0) = Sin (πx), 0 ≤ x ≤ 1,
u (0, t) = t, t ≥ 0
u (1, t) = t2 , t ≥ 0
pde file.nb 65
eqn3a = ∂t u[x, t] - 4 * ∂x,x u[x, t] ⩵ x * t, u[x, 0] ⩵ Sin[π x], u[0, t] ⩵ t, u[1, t] ⩵ t2
sol3a = u[x, t] /. NDSolve[eqn3a, u[x, t], {x, 0, 1}, {t, 0, 5}, PrecisionGoal → 3][[1]]
Plot3D[sol3a, {x, 0, 1}, {t, 0, 5},
AxesLabel → {"x", "t", "u"}, Ticks → {{0, 1, 2, 3, 4}, {0, 1}, {- 3, 0}}]
Practical - 6
sol1a = u[x, t] /. NDSolve[eqn1a, u[x, t], {x, 0, 1}, {t, 0, 4}, PrecisionGoal → 3][[1]]
Problem - : 1 (b)
utt - uxx = 0, 0 < x < a, t > 0,
u (x, 0) = Sin (x), 0 ≤ x ≤ a,
ut (x, 0) = Cos (x), 0 ≤ x ≤ a
pde file.nb 67
eqn1b = {∂t,t u[x, t] - ∂x,x u[x, t] ⩵ 0, u[x, 0] ⩵ Sin[x], Derivative[0, 1][u][x, 0] ⩵ Cos[x]}
sol1b = u[x, t] /. NDSolve[eqn1b, u[x, t], {x, 0, 1}, {t, 0, 4}, PrecisionGoal → 3][[1]]
Plot3D[sol1b, {x, 0, 1}, {t, 0, 4},
AxesLabel → {"x", "" t, "u"}, Ticks → {{0, 1, 2, 3, 4}, {0, 1}, {- 3, 0}}]
Problem - : 1 (c)
utt - 9 uxx = 0, 0 < x < a, t > 0,
u (x, 0) = e-5 x , 0 ≤ x ≤ a,
ut (x, 0) = xCos (x), 0 ≤ x ≤ a
68 pde file.nb
Problem - : 2 (a)
utt - 4 uxx = 0, 0 < x < a, t > 0,
u (x, 0) = 10 * x4 , 0 ≤ x ≤ a,
ut (x, 0) = 0, 0 ≤ x ≤ a
u (0, t) = 0, t ≥ 0
pde file.nb 69
Problem - : 2 (b)
utt - 4 uxx = 0, 0 < x < a, t > 0,
u (x, 0) = x4 , 0 ≤ x ≤ a,
ut (x, 0) = 0, 0 ≤ x ≤ a
u (0, t) = 0, t ≥ 0
70 pde file.nb
Problem - : 3 (a)
utt - 9 uxx = 0, 0 < x < a, t > 0,
u (x, 0) = 0, 0 ≤ x ≤ a,
ut (x, 0) = x3 , 0 ≤ x ≤ a
ux (0, t) = 0, t ≥ 0
pde file.nb 71
Problem - : 3 (b)
utt - 4 uxx = 0, 0 < x < a, t > 0,
u (x, 0) = x4 , 0 ≤ x ≤ a,
ut (x, 0) = x3 , 0 ≤ x ≤ a
ux (0, t) = 0, t ≥ 0
72 pde file.nb
Problem - : 4 (a)
utt - 4 uxx = -9.80665, 0 < x < a, t > 0,
u (x, 0) = 10 x2 (1 - x)2 , 0 ≤ x ≤ a,
ut (x, 0) = 0, 0 ≤ x ≤ a
u (0, t) = u (1, t) = 0, t ≥ 0
pde file.nb 73
Problem - : 4 (b)
utt - uxx = 0, 0 < x < a, t > 0,
πx
u (x, 0) = Sin , 0 ≤ x ≤ a,
2
ut (x, 0) = 0, 0 ≤ x ≤ a
u (0, t) = u (2, t) = 0, t ≥ 0
74 pde file.nb
πx
u(0,2) [x, t] - u(2,0) [x, t] ⩵ 0, u[x, 0] ⩵ Sin , u(0,1) [x, 0] ⩵ 0, u[0, t] ⩵ 0, u[2, t] ⩵ 0
2
Problem - : 4 (c)
utt - uxx = 0, 0 < x < a, t > 0,
u (x, 0) = 0, 0 ≤ x ≤ a,
ut (x, 0) = 8 Sin2 (x), 0 ≤ x ≤ a
u (0, t) = u (π, t) = 0, t ≥ 0
pde file.nb 75
u(0,2) [x, t] - u(2,0) [x, t] ⩵ 0, u[x, 0] ⩵ 0, u(0,1) [x, 0] ⩵ x Sin[π x], u[0, t] ⩵ 0, u[1, t] ⩵ 0
Practical - 7
In[ ]:= charBaseCurves1 = DSolve[{x '[t] == x[t] * Sin[t], x[0] == x0}, x[t], t]
Out[ ]= x[t] → ⅇ1-Cos[t] x0
In[ ]:= tab = Table[x[t] /. charBaseCurves1[[1]] /. {x0 -> k}, {k, 5, 20, 5}]
Plot[Evaluate[tab], {t, - 10, 10}, PlotStyle -> Thickness[0.01],
PlotLegends -> Table[tab[[i]], {i, 1, 4}], PlotLabel -> "characteristic Base Curves"]
Out[ ]= 5 ⅇ1-Cos[t] , 10 ⅇ1-Cos[t] , 15 ⅇ1-Cos[t] , 20 ⅇ1-Cos[t]
100
5 ⅇ1-cos(t)
10 ⅇ1-cos(t)
Out[ ]=
15 ⅇ1-cos(t)
50
20 ⅇ1-cos(t)
-10 -5 5 10
1
DSolve: Equation or list of equations expected instead of 1 + in the first argument
1 + x2
1
ρ0,1 [x, t] + x Sin[t] ρ1,0 [x, t] ⩵ 0, 1 + .
1 + x2
1
DSolve: Equation or list of equations expected instead of 1 + in the first argument
1 + x2
1
ρ0,1 [x, t] + x Sin[t] ρ1,0 [x, t] ⩵ 0, 1 + .
1 + x2
In[ ]:= tab = Table[x[t] /. charBaseCurves2[[1]] /. {x0 -> k}, {k, 4, 20, 4}]
Plot[Evaluate[tab], {t, - 4, 4}, PlotStyle -> Thickness[0.01],
PlotLegends -> Table[tab[[i]], {i, 1, 5}], PlotLabel -> "characteristic Base Curves"]
Out[ ]= 3 + ⅇt , 7 + ⅇt , 11 + ⅇt , 15 + ⅇt , 19 + ⅇt
50
40 ⅇt + 3
ⅇt + 7
30
Out[ ]= ⅇt + 11
ⅇt + 15
20
ⅇt + 19
10
-4 -2 2 4
In[ ]:= tab = Table[x[t] /. charBaseCurves3[[1]] /. {x0 -> k}, {k, 1, 5, 1}]
Plot[Evaluate[tab], {t, - 2, 2}, PlotStyle -> Thickness[0.01],
PlotLegends -> Table[tab[[i]], {i, 1, 5}], PlotLabel -> "characteristic Base Curves"]
Out[ ]= {1 + 2 t, 2 + 2 t, 3 + 2 t, 4 + 2 t, 5 + 2 t}
6 2t +1
2t +2
4
Out[ ]= 2t +3
2 2t +4
2t +5
-2 -1 1 2
-2