TransWikia.com

Entering complicated differential equation in mathematica

Mathematica Asked on July 22, 2021

I am trying to enter a differential equation in mathematica. Example of such an equation is
$$bigg[bigg(frac{partial{}}{partial{t}}+omega_etabigg)left(frac{partial{}}{partial{t}}+omega_nuright)+omega_M^2bigg]^2left(frac{partial}{partial{t}}+omega_kapparight)hat{u}_y=-4omega_C^2left(frac{partial{}}{partial{t}}+omega_etaright)^2left(frac{partial}{partial{t}}+omega_kapparight)hat{u}_y-omega_A^2 bigg[left(frac{partial{}}{partial{t}}+omega_nuright)left(frac{partial{}}{partial{t}}+omega_etaright)+omega_M^2bigg]left(frac{partial{}}{partial{t}}+omega_etaright)hat{u}_y,$$
where the unknown $hat{u}_y$ is a function of time and space. How can it be entered into mathematica without expanding it completely on a paper and then writing the whole thing in mathematica? This is what I did

Le[f_] := !(
*SubscriptBox[([PartialD]), (t)]f) + [Omega]e f;
Ln[f_] := !(
*SubscriptBox[([PartialD]), (t)]f) + [Omega]n f;
Lk[f_] := !(
*SubscriptBox[([PartialD]), (t)]f) + [Omega]k f;
Lg[f_] := Le[Ln[f]] + [Omega]M^2 f;
Lgg[f_] := Lg[Lg[Lk[f]]];
Lek[f_] := Le[Le[Lk[f]]];
Lge[f_] := Lg[Le[f]];

and then

Collect[Simplify[
  Lgg[u[t]] + 4 [Omega]o^2 Lek[u[t]] + [Omega]A^2 Lge[u[t]]], {
!(*SuperscriptBox[(u), 
TagBox[
RowBox[{"(", "5", ")"}],
Derivative],
MultilineFunction->None])[t], 
!(*SuperscriptBox[(u), 
TagBox[
RowBox[{"(", "4", ")"}],
Derivative],
MultilineFunction->None])[t], 
!(*SuperscriptBox[(u), 
TagBox[
RowBox[{"(", "3", ")"}],
Derivative],
MultilineFunction->None])[t], 
!(*SuperscriptBox[(u), 
TagBox[
RowBox[{"(", "2", ")"}],
Derivative],
MultilineFunction->None])[t], 
!(*SuperscriptBox[(u), 
TagBox[
RowBox[{"(", "1", ")"}],
Derivative],
MultilineFunction->None])[t], 
!(*SuperscriptBox[(u), 
TagBox[
RowBox[{"(", "0", ")"}],
Derivative],
MultilineFunction->None])[t]}]

One Answer

One possibility is to first replace the derivative by a dummy (e.g. "der"). Then do the expand. And finally replace the dummy by the derivative. Here, as an example, the first line of your equation:

(((der + w1) (der + w2) + w3^2)^2 (der + w4) // Expand ) /. 
 der^(n_ : 1) -> Derivative[n][u[t]]

unfortunately, this results in an ugly unformatted expression if pasted directly. I therefore paste a picture of the formatted expression: enter image description here

Answered by Daniel Huber on July 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP