I want to get the real part of the function n3[t]
(see below) which is the solution to a differential equation.
Solve the differential equation. (Suppose m
, k
, f
, and t
are real)
Clear["Global`*"]
eqns = {m*n1''[t] + k*n1[t] - k*n2[t] == f*E^(I*w*t),
m*n2''[t] - k*n1[t] + 2*k*n2[t] - k*n3[t] == 0,
m*n3''[t] - k*n2[t] + k*n3[t] == 0, n1[0] == 0, n2[0] == 0,
n3[0] == 0, n1'[0] == 0, n2'[0] == 0, n3'[0] == 0};
(sol = DSolve[eqns, {n1, n2, n3}, t]) // Short[#, 5] &
Simplify the solution
solt = {n1[t], n2[t], n3[t]} /. sol // FullSimplify
Then I tried to get the real part of n3[t] with ComplexExpand[]
, but I failed. It seems that m and k are also regarded as complex numbers. (The output is actually very long, I omit the rest of it)
I failed to get the real part of n3[t] directly with Re[]
either.