I got a strange problem when using NDSolve
to solve a matrix value function
σ[t] = {{σx[t], σxy[t]}, {σyx[t], σy[t]}}
when I try to solve it in a compact form.
Here is the initialization code:
Clear[t]
F = {{1, t}, {0, 1}};
LL = D[F, t].Inverse[F];
DD = 1/2 (LL + Transpose[LL]);
WW = 1/2 (LL - Transpose[LL]);
U = MatrixPower[Transpose[F].F, 1/2];
R = F.Inverse[U];
Ω = Simplify[D[R, t].Transpose[R]];
λ = 1;
μ = 1;
Now Ω is a 2 x 2 matrix with variable t. When I directly specify the form of σ, and I can get the problem solved:
σ = ({{σx[t], σxy[t]},{σyx[t], σy[t]}});
sol = NDSolve[{
D[σ, t] == (λ*Tr[DD])*IdentityMatrix[2] + 2 μ*DD + Ω.σ + σ.Transpose[Ω],
(σ /. t -> 0) == ({{0, 0}, {0, 0}})
},
{σx, σy, σxy, σyx},
{t, 0, 5}]
However, if I try to define {σx[t], σxy[t]},{σyx[t], σy[t]}}
as a single σ[t]
, which is more elegant, there will be problem:
Clear[σ];
func[X_?ArrayQ] := (λ*Tr[DD])*IdentityMatrix[2] + 2 μ*DD + Ω.X + X.Transpose[Ω];
sol = NDSolve[{
D[σ[t], t] == func[σ][t]],
σ[0] == ({{0, 0},{0, 0}})
}, σ, {t, 0, 5}]
The problem lays in the fact that the variable t in matrix Ω is not treated as the same as the t inside the NDSolve
. Can you help me fix this?