0
$\begingroup$

I have a nonlinear differential equation having a parameter u and the following terms: {w, w', w'', phi, phi', phi'', beta, beta', beta'', rw, rw', rw'', rp, rp', rp'', rb, rb', rb'',phi^2}. I would like to obtain an array having the coefficients of these terms as functions of the parameter u, and an extra term containing the remaning. This is the differential equation:

    1.00933*10^8 w[t] - 
 0.397654 u^2 Sin[366.095/
   u^2] (2.05863*10^7/u^4 + (659791. phi[t])/u^2 + 5679.79 phi[t]^2 + 
    2. (-(2.08696*10^7/u^4) - (169470. Cot[366.095/u^2])/u^2 - (
       1.23229*10^8 Csc[366.095/u^2])/u^4 + (1/(u^6))
       7.01408*10^-39 Csc[366.095/
         u^2] \[Sqrt]((1.75688*10^46 u^2 + 
             2.41614*10^43 u^4 Cos[366.095/u^2] + 
             2.97539*10^45 u^2 Sin[366.095/u^2])^2 - 
           9.40666*10^43 u^4 Sin[366.095/
             u^2] (2.03638*10^45 u^2 + 
              9.16129*10^44 u^2 Cos[366.095/u^2] + 
              1.02791*10^47 Sin[366.095/u^2] + 
              1.17984*10^40 u^4 Sin[366.095/u^2]))) + 
    2. phi[t] (-(359311./u^2) - 2917.75 Cot[366.095/u^2] - (
       2.12162*10^6 Csc[366.095/u^2])/u^2 + (1/(u^4))
       1.20761*10^-40 Csc[366.095/
         u^2] \[Sqrt]((1.75688*10^46 u^2 + 
             2.41614*10^43 u^4 Cos[366.095/u^2] + 
             2.97539*10^45 u^2 Sin[366.095/u^2])^2 - 
           9.40666*10^43 u^4 Sin[366.095/
             u^2] (2.03638*10^45 u^2 + 
              9.16129*10^44 u^2 Cos[366.095/u^2] + 
              1.02791*10^47 Sin[366.095/u^2] + 
              1.17984*10^40 u^4 Sin[366.095/u^2]))) + (1/(u^8))
    2.56756*10^-84 (-2.97539*10^45 u^2 - 
       2.41614*10^43 u^4 Cot[366.095/u^2] - 
       1.75688*10^46 u^2 Csc[366.095/u^2] + 
       Csc[366.095/
         u^2] \[Sqrt](u^4 ((1.75688*10^46 + 
               2.41614*10^43 u^2 Cos[366.095/u^2] + 
               2.97539*10^45 Sin[366.095/u^2])^2 - 
             9.40666*10^43 Sin[366.095/
               u^2] (2.03638*10^45 u^2 + 
                9.16129*10^44 u^2 Cos[366.095/
                  u^2] + (1.02791*10^47 + 1.17984*10^40 u^4) Sin[
                  366.095/u^2]))))^2 + (
    437861. Derivative[1][phi][t])/u^3 + 
    1.5 (-(312719./u^3) - (2539.41 Cot[366.095/u^2])/u - (
       1.84651*10^6 Csc[366.095/u^2])/u^3 + (1/(u^5))
       1.05102*10^-40 Csc[366.095/
         u^2] \[Sqrt](u^4 ((1.75688*10^46 + 
               2.41614*10^43 u^2 Cos[366.095/u^2] + 
               2.97539*10^45 Sin[366.095/u^2])^2 - 
             9.40666*10^43 Sin[366.095/
               u^2] (2.03638*10^45 u^2 + 
                9.16129*10^44 u^2 Cos[366.095/
                  u^2] + (1.02791*10^47 + 1.17984*10^40 u^4) Sin[
                  366.095/u^2])))) Derivative[1][phi][t]) + 
 1021.49 (beta^\[Prime]\[Prime])[t] - 
 81644.8 (phi^\[Prime]\[Prime])[t] + 
 1.52994*10^6 (w^\[Prime]\[Prime])[t] - 
 1. Cos[366.095/
   u^2] (2.59496 u (4.39439 u^2 rb[t] + 79.1949 u^2 rp[t] + 
       499.168 u^2 rw[t] + 46.33 u Derivative[1][rb][t] + 
       804.864 u Derivative[1][rp][t] + 
       5151.13 u Derivative[1][rw][t] + 
       50.0016 (rb^\[Prime]\[Prime])[t] + 
       901.12 (rp^\[Prime]\[Prime])[t] + 
       5679.79 (rw^\[Prime]\[Prime])[t]) + 
    1.29748 (3.58313 u Derivative[1][beta][t] + 
       797.355 u Derivative[1][phi][t] + 
       0.34362 (beta^\[Prime]\[Prime])[t] + 
       354.831 (phi^\[Prime]\[Prime])[t] + 
       4943.29 (w^\[Prime]\[Prime])[t]))

Any suggestions? My final goal would be to write a set of differential equations in matrix form.

UPDATE

I have taken the coefficients in a row form, but still can't find a way to get the remaining terms.

coefficients = -CoefficientArrays[equation==0, {w[t], w'[t], w''[t], phi[t], 
 phi'[t], phi''[t], beta[t], beta'[t], beta''[t], rw[t], rw'[t], 
 rw''[t], rp[t], rp'[t], rp''[t], rb[t], rb'[t], rb''[t], 
 phi[t]^2,}][[2]]
$\endgroup$
1
$\begingroup$

Actually the solution was right under my nose (after my last update).

This would return the coefficients of the terms:

 coefficients = -CoefficientArrays[equation==0, {w[t], w'[t], w''[t], phi[t], 
 phi'[t], phi''[t], beta[t], beta'[t], beta''[t], rw[t], rw'[t], 
 rw''[t], rp[t], rp'[t], rp''[t], rb[t], rb'[t], rb''[t], 
 phi[t]^2,}][[2]]

As for the remaining terms, it is only about changing one character:

coefficients = -CoefficientArrays[equation==0, {w[t], w'[t], w''[t], phi[t], 
     phi'[t], phi''[t], beta[t], beta'[t], beta''[t], rw[t], rw'[t], 
     rw''[t], rp[t], rp'[t], rp''[t], rb[t], rb'[t], rb''[t], 
     phi[t]^2,}][[1]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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