Message Boards Message Boards

0
|
392 Views
|
1 Reply
|
2 Total Likes
View groups...
Share
Share this post:

What is the substitution or replacement method for multiple functions and their derivatives?

Posted 2 months ago

I want to substitute functions and their derivatives in this:

{LXi = x*D[Xi[2][t], t] + Sqrt[x] h[t], 
     Xi[2][t]};   LPhi = { (p[t] + f[x, t]) u + g[x, t]};             
    f[x, t] = 
     C[1][t] + ((-((4 k \[Theta] h[t])/Sqrt[x]) + 
       6 Sqrt[x] (k h[t] + 2 Derivative[1][h][t]) + 
       6 x (k Derivative[1][Xi[2]][t] + (Xi[2]^\[Prime]\[Prime])[t]))/(
      8 k \[Theta]))

Is this correct?

{LXi, LPhi} = 
 ReplaceAll[{LXi = {x*D[Xi[2][t], t] + Sqrt[x] h[t], Xi[2][t]},
   LPhi = { (p[t] + 
         1/(8 k \[Theta]) (-(1/Sqrt[x]) 4 k \[Theta] h[t] + 
            6  Sqrt[x]  (k (*h[t]*)+ 2 D[h[t], t]) + 
            6 x (k D[Xi[2][t], t] + D[Xi[2][t], {t, 2}]))) u + 
      g[x, t]}}, {h[t] -> 
    E^((Sqrt[k] t Sqrt[3 k + 8 \[Theta]])/(2 Sqrt[3]))  C[1] + 
     E^(-((Sqrt[k] t Sqrt[3 k + 8 \[Theta]])/(2 Sqrt[3])))  C[2], 
   p[t] -> C[3] - (
     3  E^(-((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
       3]))  (-1 + E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
        3]))  (-3 k + 
        3 E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[3]) k - 8 \[Theta] + 
        8 E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[3]) \[Theta] + 
        Sqrt[3] Sqrt[k (3 k + 8 \[Theta])] + 
        Sqrt[3] E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[3]) Sqrt[
         k (3 k + 8 \[Theta])])  C[5])/(8 (3 k + 8 \[Theta])) - (
     3  E^(-((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
       3]))  (-1 + E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
        3]))  (3 Sqrt[3] k + 
        3 Sqrt[3] E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[3]) k + 
        8 Sqrt[3] \[Theta] + 
        8 Sqrt[3] E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
         3]) \[Theta] - 3 Sqrt[k (3 k + 8 \[Theta])] + 
        3 E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[3]) Sqrt[
         k (3 k + 8 \[Theta])])  C[6])/(
     8 (3 k + 8 \[Theta]) Sqrt[k (3 k + 8 \[Theta])]), 
   Xi[2][t] -> 
    C[4] + (Sqrt[3]
        E^(-((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
       3]))  (-1 + E^((2 t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[3]))  C[
      5])/(2 Sqrt[k (3 k + 8 \[Theta])]) + (
     3  E^(-((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
       3]))  (-1 + E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[3]))^2  C[
      6])/(2 k (3 k + 8 \[Theta])), 
   D[h[t], t] -> (
     E^((Sqrt[k] t Sqrt[3 k + 8 \[Theta]])/(2 Sqrt[3]))  Sqrt[k]
        Sqrt[3 k + 8 \[Theta]]  C[1])/(2 Sqrt[3]) - (
     E^(-((Sqrt[k] t Sqrt[3 k + 8 \[Theta]])/(2 Sqrt[3])))  Sqrt[k]
        Sqrt[3 k + 8 \[Theta]]  C[2])/(2 Sqrt[3]) , 
   D[Xi[2][t], t] -> 
    E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[3])  C[5] - 
     1/2  E^(-((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
       3]))  (-1 + E^((2 t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[3]))  C[
      5] + (
     Sqrt[3]  (-1 + E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[3]))  Sqrt[
      k (3 k + 8 \[Theta])]  C[6])/(k (3 k + 8 \[Theta])) - (
     Sqrt[3]  E^(-((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
       3]))  (-1 + E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
        3]))^2  Sqrt[k (3 k + 8 \[Theta])]  C[6])/(
     2 k (3 k + 8 \[Theta])), 
   D[Xi[2][t], {t, 2}] -> (
     2  E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[3])
        k  (3 k + 8 \[Theta])  C[5])/(
     Sqrt[3] Sqrt[k (3 k + 8 \[Theta])]) + (
     E^(-((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
       3]))  (-1 + E^((2 t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
        3]))  k  (3 k + 8 \[Theta])  C[5])/(
     2 Sqrt[3] Sqrt[k (3 k + 8 \[Theta])]) - (
     2  E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[3])  Sqrt[
      k (3 k + 8 \[Theta])]  C[5])/Sqrt[
     3] + ((-2 (-1 + E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
           3])) k (3 k + 8 \[Theta]) + 
        1/2 E^(-((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
          3])) (-1 + E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
           3]))^2 k (3 k + 8 \[Theta]) + 
        3/2 E^(-((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
          3])) (2/3 E^((2 t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[3])
             k (3 k + 8 \[Theta]) + 
           2/3 E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
            3]) (-1 + E^((t Sqrt[k (3 k + 8 \[Theta])])/Sqrt[
              3])) k (3 k + 8 \[Theta])))  C[6])/(
     k (3 k + 8 \[Theta]))

Please show a generic way of substitution if possible, without having to manually find their derivatives first before substitution.

POSTED BY: Nomsa Ledwaba

I'm not sure I understand, and the expression is so complicated, I'm not tempted to dig deeply. But I hope I've guessed what you're after, which I will illustrate with a much simpler example.

Suppose I want to substitute y[x] = Exp[x] Sin[x] into y''[x] - 2 y'[x] + 2 y[x] == 0. First of all, I wouldn't execute y[x] = Exp[x] Sin[x]. But if I had done so, I would Clear it. The trick is to substitute a Function for y and not to substitute a formula for y[x].

Clear[y]
y''[x] - 2 y'[x] + 2 y[x] == 0 /. 
  y -> Function[x, Exp[x] Sin[x]] // Simplify

(*  True  *)

Or:

Clear[y]
sol = Exp[x] Sin[x];
y''[x] - 2 y'[x] + 2 y[x] == 0 /. 
  y -> Function[x, Evaluate[sol]] // Simplify

(*  True  *)
POSTED BY: Michael Rogers
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract