> |
restart;
with(inttrans): # Load the integral transforms package
with(PDEtools): # Load the partial differential equations tools
with(LinearAlgebra): # Load the linear algebra package
# Define the Maple procedure to compute truncated series solutions for u, v, and w
TruncatedSolutions := proc(x, y, t, truncOrder)
local su, sv, sw, u_sol_s, v_sol_s, w_sol_s, u_sol, v_sol, w_sol;
local u_n, u_n1, v_n, v_n1, w_n, w_n1;
local Cuvw, Cuv, Cu, Dvw, Eu, Du, Ev, Ew, Euv;
local u_n_series, v_n_series, w_n_series;
local u_final, v_final, w_final;
local PDE1, PDE2, PDE3, IC1, IC2, IC3;
local L_uv1, L_uw5, L_uv5, eq_su, eq_sv, eq_sw;
local u_x_y_t, v_x_y_t, w_x_y_t;
local X, Y, T; # Symbolic placeholders for x, y, t
# Use placeholders X, Y, T instead of x, y, t within the procedure
# Step (3.22) - (3.24): Define the system of nonlinear PDEs
printf("Step (3.22): Define PDE for u(X,Y,T)\n");
PDE1 := diff(u(X, Y, T), T) - v(X, Y) * w(Y, T) = 1;
printf("Step (3.23): Define PDE for v(X,Y,T)\n");
PDE2 := diff(v(X, Y, T), T) - w(X, Y) * u(X, T) = 5;
printf("Step (3.24): Define PDE for w(X,Y,T)\n");
PDE3 := diff(w(X, Y, T), T) - u(X, Y) * v(X, T) = 5;
# Step (3.25) - (3.27): Initial conditions for each function at T=0
printf("Step (3.25): Initial condition for u\n");
IC1 := u(X, Y, 0) = X + 2 * Y;
printf("Step (3.26): Initial condition for v\n");
IC2 := v(X, Y, 0) = -2 * Y;
printf("Step (3.27): Initial condition for w\n");
IC3 := w(X, Y, 0) = -X + 2 * Y;
# Step (3.28) - Laplace transforms for each function
printf("Step (3.28): Laplace transform of u(X, Y, T)\n");
su := laplace(u(X, Y, T), T, s);
printf("Step (3.29): Laplace transform of v(X, Y, T)\n");
sv := laplace(v(X, Y, T), T, s);
printf("Step (3.30): Laplace transform of w(X, Y, T)\n");
sw := laplace(w(X, Y, T), T, s);
# Define placeholders for the transforms of nonlinear terms
L_uv1 := L[1 + u*v];
L_uw5 := L[5 + w*u];
L_uv5 := L[5 + u*v];
# Step (3.31) - Applying initial conditions in the Laplace domain with placeholders
printf("Step (3.31): Equation for su with initial conditions applied\n");
eq_su := su - (X + 2 * Y) = 1 / s * L_uv1;
printf("Step (3.32): Equation for sv with initial conditions applied\n");
eq_sv := sv + 2 * Y = 5 / s * L_uw5;
printf("Step (3.33): Equation for sw with initial conditions applied\n");
eq_sw := sw - (X - 2 * Y) = 5 / s * L_uv5;
# Step (3.34) - Express solutions in Laplace domain
printf("Step (3.34): Solution for u in Laplace domain\n");
u_sol_s := 1 / s^2 + (X + 2 * Y) / s + 1 / s * L[v * w];
printf("Step (3.35): Solution for v in Laplace domain\n");
v_sol_s := 5 / s^2 + (X - 2 * Y) / s + 1 / s * L[u * w];
printf("Step (3.36): Solution for w in Laplace domain\n");
w_sol_s := 5 / s^2 + (-X + 2 * Y) / s + 1 / s * L[u * v];
# Step (3.37) - Applying the inverse Laplace transform to return to time domain
printf("Step (3.37): Time domain solution for u\n");
u_sol := invlaplace(u_sol_s, s, T);
printf("Step (3.38): Time domain solution for v\n");
v_sol := invlaplace(v_sol_s, s, T);
printf("Step (3.39): Time domain solution for w\n");
w_sol := invlaplace(w_sol_s, s, T);
# Define recursive relations for each function
printf("Step (3.40): Define recursive term u_n\n");
u_n := (T -> u_sol);
printf("Step (3.41): Define next recursive term u_n1\n");
u_n1 := (T -> invlaplace(L[v * w], s, T));
printf("Step (3.42): Define recursive term v_n\n");
v_n := (T -> v_sol);
printf("Step (3.43): Define next recursive term v_n1\n");
v_n1 := (T -> invlaplace(L[w * u], s, T));
printf("Step (3.44): Define recursive term w_n\n");
w_n := (T -> w_sol);
printf("Step (3.45): Define next recursive term w_n1\n");
w_n1 := (T -> invlaplace(L[u * v], s, T));
# Adomian polynomials for nonlinear terms
printf("Step (3.46): Polynomial for u*v*w\n");
Cuvw := u * v * w;
printf("Step (3.47): Polynomial involving derivatives\n");
Cuv := w * vx + v * wx;
# Additional recursive definitions
printf("Step (3.48): Sum of products for Du\n");
Du := sum(u[k] * v[k] * w[k], k = 0 .. truncOrder);
printf("Step (3.49): Initial term for v\n");
Ev := v0;
printf("Step (3.50): Sum involving initial terms of u and v\n");
Ew := v0 + u0 + u1;
printf("Step (3.51): Double sum for Euv\n");
Euv := sum(u[m] * v[truncOrder-m], m = 0 .. truncOrder);
# Steps (3.52) - (3.54) Evaluation of u, v, w in recursive form
printf("Step (3.52): Evaluation of u in recursive form\n");
u_x_y_t := diff(u(X, Y, T), T) - v(X, Y) * w(Y, T);
printf("Step (3.53): Evaluation of v in recursive form\n");
v_x_y_t := diff(v(X, Y, T), T) - w(X, Y) * u(X, T);
printf("Step (3.54): Evaluation of w in recursive form\n");
w_x_y_t := diff(w(X, Y, T), T) - u(X, Y) * v(X, T);
# Summing recursive terms for final series solutions up to truncOrder
printf("Step (3.55): Infinite series sum for u\n");
u_n_series := sum(u_n(X, Y, T), n = 0 .. truncOrder);
printf("Step (3.56): Infinite series sum for v\n");
v_n_series := sum(v_n(X, Y, T), n = 0 .. truncOrder);
printf("Step (3.57): Infinite series sum for w\n");
w_n_series := sum(w_n(X, Y, T), n = 0 .. truncOrder);
# Explicit truncated series solutions
printf("Step (3.58): Truncated series for u\n");
u_final := sum(u[n](X, Y, T), n = 0 .. truncOrder);
printf("Step (3.59): Truncated series for v\n");
v_final := sum(v[n](X, Y, T), n = 0 .. truncOrder);
printf("Step (3.60): Truncated series for w\n");
w_final := sum(w[n](X, Y, T), n = 0 .. truncOrder);
# Substitute the actual values of x, y, and t into the final solutions
u_final := subs({X = x, Y = y, T = t}, eval(u_final));
v_final := subs({X = x, Y = y, T = t}, eval(v_final));
w_final := subs({X = x, Y = y, T = t}, eval(w_final));
# Output final truncated solutions for u, v, and w, converting expressions to strings to prevent formatting issues
printf("Final truncated solutions for u, v, and w up to order %d:\n", truncOrder);
printf("u_final: %a\n", u_final);
printf("v_final: %a\n", v_final);
printf("w_final: %a\n", w_final);
# Return results as a list
return [u_final, v_final, w_final];
|