I want to demonstrate FourierTransform
in a lecture. However if you give FourierTransform
a differential equation it does not know about linearity and just returns the answer.
e = x''[t] + 2 z w0 x'[t] + w0^2 x[t] == g[t];
FourierTransform[e, t, w]
Which is not much help. Fortunately, @xzczd has developed this shell to provide standard rules. This is implemented by
ClearAll[FT];
FT[(h : List | Plus | Equal)[a__], t_, w_] := FT[#, t, w] & /@ h[a]
FT[a_ b_, t_, w_] /; FreeQ[b, Alternatives @@ t] := b FT[a, t, w]
FT[a_, t_, w_] := FourierTransform[a, t, w]
This now works on the differential equation thus
FT[e, t, w]
However I would like to take this one step further by using the convention that lower case letters in the time domain give rise to capital letters in the frequency domain. I can do this for specific cases using replacement rules as follows.
ClearAll[FT];
FT[(h : List | Plus | Equal)[a__], t_, w_] := FT[#, t, w] & /@ h[a]
FT[a_ b_, t_, w_] /; FreeQ[b, Alternatives @@ t] := b FT[a, t, w]
FT[a_, t_, w_] :=
FourierTransform[a, t, w] /. {FourierTransform[x[t], t, w] -> X[w],
FourierTransform[g[t], t, w] -> G[w]}
This gives the form I want
sol = FT[e, t, w]
(* -w^2 X[w] + w0^2 X[w] - 2 I w w0 z X[w] == G[w] *)
One can now do further operations such as
Solve[sol, X[w]]
(* {{X[w] -> -(G[w]/(w^2 - w0^2 + 2 I w w0 z))}}*)
However, it is specific to the symbols of x[t]
and g[t]
I have implimented. Can this be done so that any lower case letter, e.g. a in the form FourierTransform[a[t], t, w]
goes to A[w]
?
FourierTransform[op_[t_], t_, w_] :> Symbol@*Capitalize@*ToString@*op@w
, in place of{FourierTransform[x[t], t, w] -> X[w], FourierTransform[g[t], t, w] -> G[w]}
? If so, I'll write an answer. $\endgroup$Format
statement work? $\endgroup${FourierTransform[op_[t_], t_, w_] :> Symbol[Capitalize[ToString[op]]][w]}
then it gives a warning but works. Please post your answer. $\endgroup$e = x''[t] + 2 z w0 x'[t] + w0^2 x[t] == g[t]; LaplaceTransform[e, t, w]
results inw^2 LaplaceTransform[x[t], t, w] + w0^2 LaplaceTransform[x[t], t, w] + 2 w0 z (w LaplaceTransform[x[t], t, w] - x[0]) - w x[0] - Derivative[1][x][0] == LaplaceTransform[g[t], t, w]
. As far as I know it,LaplaceTransfom
is more often used for solving linear ODEs. $\endgroup$