Hi, I started this program who resolve a heat equation, after 5 hours of compilation, I stopped it. I don't understand why it takes all this time? Normally the calculations are not complicated at this point, please help me find a solution to this problem:
T = 2 \[Pi];
l = \[Pi];
a = 1/100;
w1 = Sin;
y0 = Identity;
(*Définit la fonction indicatrice*)
indicator[x_] := Piecewise[{{1, 0 < x < \[Pi]/2}}, 0];
S[t_, f_, x_] := Sum[ Exp[- t n^2] Integrate[f[s] Sin[s n], {s, 0, \[Pi]}] Sin[x n], {n, 5}];
v1[x_] := w1[x] - S[T, y0, x];
L[t_, x_] := S[T - t, v1, x];
Q[x_] := indicator[x] Integrate[L[s, x]^2, {s, T - l, T}];
g1[x_] := a v1[x] + Q[x];
g2[t_, x_] := indicator[x] v1[x] L[t, x];
(*control*)
u[t_, x_] := g2[t, x]/g1[x];
****************************************************************************
homogen =
D[f[x, t], t] - D[f[x, t], {x, 2}] - indicator[x] u[x, t] == 0;
(*données initiales propres *)
ic = {f[x, T - l] == y0[x]};
(* Condition aux bord de Dirichlet*)
bc = {f[0, t] == 0, f[\[Pi], t] == 0};
(*résolution analytique de l'équation *)
sol1 = DSolveValue[{homogen, ic, bc}, f[x, t], {x, 0, \[Pi]}, {t, 0, T}]