# Question:How do I Solve PDE Equation using Finite Difference Method in Maple?

## Question:How do I Solve PDE Equation using Finite Difference Method in Maple?

Maple

Hi, I have problem at this coding. Can you help me?

restart;
eq1 := diff(u(u, t), t) = A[0] + A[1]*cos*omega*t + Beta[1]*[diff(u(u, r), r \$ 2) + diff(u(u, r), r)/r];
d
eq1 := --- u(u, t) = A[0] + A[1] cos omega t
dt

[                  d         ]
[/  2         \   --- u(u, r)]
[| d          |    dr        ]
+ Beta[1] [|---- u(u, r)| + -----------]
[|   2        |        r     ]
[\ dr         /              ]

The*number*of*node*points;
N := 4;
N := 4

The*length*of*domain;
L := 1;
L := 1

BC1 := u(1, t) = 0;
BC1 := u(1, t) = 0

IC1 := u(r, 0) = 0;
IC1 := u(r, 0) = 0

dudt := (u[m + 1] - u[m])/(delta*t);
u[m + 1] - u[m]
dudt := ---------------
delta t

dudr := (u[m + 1, j] - u[m - 1, j])/(2*delta*r);
u[m + 1, j] - u[m - 1, j]
dudr := -------------------------
2 delta r

d2udr2 := (u[m + 1, j] - 2*u[m] + u[m - 1, j])/(delta*r^2);
u[m + 1, j] - 2 u[m] + u[m - 1, j]
d2udr2 := ----------------------------------
2
delta r

Three point forward and backward difference expressions for the derivative are:
Error, unable to parse
Typesetting:-mambiguous(Typesetting:-mambiguous(

Three point forward and backward difference expressions for,

Typesetting:-merror("unable to parse")) the derivative arecolon)

dudrf := (-u[2] + 4*u[1] - 3*u[0])/(2*delta*r);
-u[2] + 4 u[1] - 3 u[0]
dudrf := -----------------------
2 delta r

dudrb := (u[N - 1] - 4*u[N] + 3*u[N + 1])/(2*delta*r);
u[3] - 4 u[4] + 3 u[5]
dudrb := ----------------------
2 delta r

The*governing*equation in finite*difference*form*is;
Eq[m] := subs(diff(u(u, t), t) = dudt, diff(u(u, r), r) = dudr, diff*(u(u, r), r \$ 2) = d2udr2, eq1);
u[m + 1] - u[m]                                     [
Eq[m] := --------------- = A[0] + A[1] cos omega t + Beta[1] [
delta t                                         [
[

/ d  /u[m + 1, j] - u[m - 1, j]\\   u[m + 1, j] - u[m - 1, j]]
|--- |-------------------------|| + -------------------------]
\ dr \        2 delta r        //             2              ]
2 r  delta        ]

The*boundary*condition in finite*difference*form*are;
Eq[0] := subs(diff(u(r), r) = dudrf, u(r) = u[0], BC1);
Eq[0] := u(1, t) = 0

The*initial*condition in finite*difference*form*are;
Eq[N + 1] := subs(diff(u(r), r) = dudrb, u(r) = u[0], IC1);
Eq[5] := u(r, 0) = 0

for i to N do
Eq[m] := subs(m = i, Eq[m]);
end do;
u[2] - u[1]
Eq[m] := ----------- = A[0] + A[1] cos omega t + Beta[1] [0]
delta t

u[2] - u[1]
Eq[m] := ----------- = A[0] + A[1] cos omega t + Beta[1] [0]
delta t

u[2] - u[1]
Eq[m] := ----------- = A[0] + A[1] cos omega t + Beta[1] [0]
delta t

u[2] - u[1]
Eq[m] := ----------- = A[0] + A[1] cos omega t + Beta[1] [0]
delta t

The node spacing is given by:
Error, unable to parse
Typesetting:-mambiguous(Typesetting:-mambiguous(

The node spacing is given by,

Typesetting:-merror("unable to parse"))colon)

h := L/(N + 1);
1
h := -
5

eqs := seq(evalm(subs(Beta = 0.25, Eq[i])), i = 0 .. N + 1);
eqs := u(r, 0) = 0, Eq[1], Eq[2], Eq[3], Eq[4], u(r, 0) = 0

vars := seq(u[i], i = 0 .. N + 1);
vars := u[0], u[1], u[2], u[3], u[4], u[5]

soll := fsolve({eqs}, {vars});
Error, (in fsolve) {r, Eq[1], Eq[2], Eq[3], Eq[4]} are in the equation, and are not solved for

﻿