4
$\begingroup$

I was wondering if one could define an operator such that, when I give a certain number of (differential) equations as an output, and an "equilibrium" value for each of the variables, it returns the linear part in the perturbative expansion of the above-mentioned equations about the reference

For example, given:

$$\partial_t X + \partial_x Y+X\partial_xY+XY=0$$

and equilibrium values: $X=X_0+\delta X, Y=0+\delta Y$

Output would be, the linearized:

$$\partial_t (\delta X) + \partial_x (\delta Y)+X_0\partial_x(\delta Y)+X_0\ \delta Y=0$$

$\endgroup$

2 Answers 2

6
$\begingroup$

How about this:

Clear[x, t, X, Y, X0, δ, ϵ];
With[
  {functions = {X, Y},
   equilibrium = {X0, 0}
   },
  Normal@Series[
     D[X[t, x], t] +
        D[Y[t, x], x] +
        X[t, x] D[Y[t, x], x] +
        X[t, x] Y[t, x] == 0 /. 
      Thread[functions -> 
        Map[Function[{t, x}, #] &, 
         equilibrium + ϵ Through[
            Thread[δ[functions]][t, x]]]
       ], {ϵ, 0, 1}] /. ϵ -> 1
  ] // TraditionalForm

$$\delta (X)^{(1,0)}(t,x)+\text{X0}\, \delta (Y)(t,x)+\text{X0} \,\delta (Y)^{(0,1)}(t,x)+\delta (Y)^{(0,1)}(t,x)=0$$

In the differential equations, X and Y are functions, so that a replacement must substitute a Function in their place. I do the linearization by the common trick of expanding linearly with respect to a dummy parameter $\epsilon$ and setting $\epsilon = 1$ at the end.

Here I used $\delta(X)$, $\delta(Y)$ for the linear terms. They are functions of x and t, whereas X0 is a constant. Since these two objects appear in a sum, I have to wrap that sum by Function in the replacement that is applied to the differential equation.

Here is a function that does the same as above:

op[eqn_, functions_, equilibrium_] := 
 Module[{ϵ}, 
  Normal@Series[
     eqn /. Thread[
       functions -> 
        Map[Function[{t, x}, #] &, 
         equilibrium + ϵ Through[
            Thread[δ[functions]][t, x]]]], {ϵ, 0, 
      1}] /. ϵ -> 1
  ]

With[{
  eqn = D[X[t, x], t] + D[Y[t, x], x] + X[t, x] D[Y[t, x], x] + 
     X[t, x] Y[t, x] == 0,
  functions = {X, Y},
  equilibrium = {X0, 0}
  },
 op[eqn, functions, equilibrium]
 ]//TraditionalForm

$$\delta (X)^{(1,0)}(t,x)+\text{X0}\, \delta (Y)(t,x)+\text{X0} \,\delta (Y)^{(0,1)}(t,x)+\delta (Y)^{(0,1)}(t,x)=0$$

$\endgroup$
4
  • $\begingroup$ Great! Thanks. Two more questions: 1) Can this be generalized also to the case where X, and T are constants? Because doesn't work in this specific case as I see; 2) Is there a way to define this as an operator, i.e., such that I can assign my equation to the variable EQ1, and then call OP[EQ1,X0,Y0,etc]? $\endgroup$ Commented Mar 3, 2015 at 10:40
  • $\begingroup$ I don't understand exactly what you mean by X and T are constants. What is T? Do you mean that you add some constant to the differential equation? By "doesn't work," do you mean you want such constants to be dropped? $\endgroup$
    – Jens
    Commented Mar 3, 2015 at 19:05
  • $\begingroup$ I meant X and Y, sorry, anyway I think I fixed it. I just define X[t_,x_]:=constant; after the calculation $\endgroup$ Commented Mar 3, 2015 at 20:34
  • $\begingroup$ OK - I added a version where I wrap everything in a function called op. $\endgroup$
    – Jens
    Commented Mar 3, 2015 at 20:42
3
$\begingroup$

Beginning with

D[X[t, x], t] + D[Y[t, x], t] + X D[Y[t, x], x] + X Y == 0

First replace the derivative by some other function to simplify manipulations.

%[[1]] /. Derivative[z1__][z2__][z3__] -> W[{z1}, z2, {z3}]

Make the first order substitution.

%/. {X -> X0 + d X1, Y -> Y0 + d Y1}

Expand the second argument of W. (Depending on the complexity of the second argument, more transformations may be needed.)

%/. W[z__] :> Thread[W[z], Plus] /. W[z1__, d z2__, z3__] :> d W[z1, z2, z3]

Perform Series and extract the Coefficient of d.

Coefficient[Normal[Series[%, {d, 0, 1}]], d]

Finally, replace W by Derivative

(% /. W[{z1__}, z2_, {z3__}] :> Derivative[z1][z2][z3]) == 0
(* X1*Y0 + X0*Y1 + X1*Derivative[0, 1][Y0][t, x] + X0*Derivative[0, 1][Y1][t, x] 
   + Derivative[1, 0][X1][t, x] + Derivative[1, 0][Y1][t, x] == 0 *)

This process is laborious because such functions as Expand do not work with Derivative. Perhaps, in a future release of Mathematica.

Addendum

Note that a much simpler approach is available, if the equation to be linearized exists in an Unevaluated form.

Unevaluated[(D[X[t, x], t] + D[Y[t, x], t] + X[t, x] D[Y[t, x], x] + X[t, x] Y[t, x] == 0)] /. 
  {X[t, x] -> X0[t, x] + d X1[t, x], Y[t, x] -> Y0[t, x] + d Y1[t, x]};
Coefficient[Normal[Series[%[[1]], {d, 0, 1}]], d] == 0

yields the desired result.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.