2
$\begingroup$

I want to solve the following system of equations:

E1 = 1/4 (3 Subscript[a, 1][
       t] (4 Sqrt[
         2] + (-1 + 
           t) (-(-1 + t) ((1 + 2 t) Subscript[a, 1][t] + 
              t Subscript[a, 2][t]) - t^2 Subscript[a, 3][t]) + 
        t^2 (-3 + 2 t) Subscript[a, 4][t]) + 
     4 Derivative[1][Subscript[a, 1]][t]);
E2 = Subscript[a, 2][
     t] (3 Sqrt[2] + 
      1/8 (1 + 
         2 Sqrt[2]) ((-1 + 
            t) ((-1 + t) ((1 + 2 t) Subscript[a, 1][t] + 
               t Subscript[a, 2][t]) + t^2 Subscript[a, 3][t]) + (3 - 
            2 t) t^2 Subscript[a, 4][t])) + 
   Derivative[1][Subscript[a, 2]][t];
E3 = Subscript[a, 3][
     t] (3 Sqrt[2] - 
      1/8 (-1 + 
         2 Sqrt[2]) ((-1 + 
            t) ((-1 + t) ((1 + 2 t) Subscript[a, 1][t] + 
               t Subscript[a, 2][t]) + t^2 Subscript[a, 3][t]) + (3 - 
            2 t) t^2 Subscript[a, 4][t])) + 
   Derivative[1][Subscript[a, 3]][t];
E4 = 3/4 Subscript[a, 4][
     t] (4 Sqrt[
       2] + (-1 + 
         t) ((-1 + t) ((1 + 2 t) Subscript[a, 1][t] + 
            t Subscript[a, 2][t]) + t^2 Subscript[a, 3][t]) + (3 - 
         2 t) t^2 Subscript[a, 4][t]) + 
   Derivative[1][Subscript[a, 4]][t];

I tried

DSolve[{E1 == 0, E2 == 0, E3 == 0, E4 == 0}, {Subscript[a, 1], 
  Subscript[a, 2], Subscript[a, 3], Subscript[a, 4]}, t]

I also tried with Solve and NSolve, but the evaluation exhausted my patience. Any suggestion?

$\endgroup$
  • $\begingroup$ Nothing to do with this problem but in general I recommend avoiding the use of subscripts with symbols in computational code. $\endgroup$ – Jack LaVigne Dec 29 '15 at 0:37
4
$\begingroup$

Provide some initial conditions and use NDSolve

Format[a[n_]] := Subscript[a, n]

eqns = Join[{(1/4)*(3*a[1][t]*
                (4*Sqrt[2] + (-1 + t)*
                     ((1 - t)*((1 + 2*t)*
                               a[1][t] + t*a[2][t]) - 
                        t^2*a[3][t]) + 
                   t^2*(-3 + 2*t)*a[4][t]) + 
              4*Derivative[1][a[1]][t]), 
         a[2][t]*(3*Sqrt[2] + 
                (1/8)*(1 + 2*Sqrt[2])*
                  ((-1 + t)*((-1 + t)*
                            ((1 + 2*t)*a[1][t] + 
                               t*a[2][t]) + 
                          t^2*a[3][t]) + (3 - 2*t)*
                       t^2*a[4][t])) + 
           Derivative[1][a[2]][t], 
         a[3][t]*(3*Sqrt[2] - 
                (1/8)*(-1 + 2*Sqrt[2])*
                  ((-1 + t)*((-1 + t)*
                            ((1 + 2*t)*a[1][t] + 
                               t*a[2][t]) + 
                          t^2*a[3][t]) + (3 - 2*t)*
                       t^2*a[4][t])) + 
           Derivative[1][a[3]][t], 
         (3/4)*a[4][t]*(4*Sqrt[2] + 
                (-1 + t)*((-1 + t)*
                       ((1 + 2*t)*a[1][t] + 
                          t*a[2][t]) + 
                     t^2*a[3][t]) + (3 - 2*t)*
                  t^2*a[4][t]) + 
           Derivative[1][a[4]][t]} == 0 // Thread,
   Array[a[#][0] &, 4] == Range[4] // Thread];

soln = NDSolve[eqns, Array[a[#][t] &, 4], {t, 0, 1}][[1]];

Plot[
 Evaluate[Array[a[#][t] &, 4] /. soln],
 {t, 0, 1},
 Frame -> True,
 Axes -> False,
 PlotLegends -> Array[a[#][t] &, 4],
 PlotRange -> All]

enter image description here

$\endgroup$
  • $\begingroup$ How did you convert "Subscript[a, 2][t]" to "a[2][t]"? and are there any method that with your reply I have approximate "a1[t]" without figure? $\endgroup$ – Bahram Agheli Dec 29 '15 at 7:44
  • $\begingroup$ @BahramAgheli - {E1, E2, E3, E4} /. Subscript[a,n_] :> a[n] I do not know what you mean by "approximate 'a1[t]' without figure" $\endgroup$ – Bob Hanlon Dec 30 '15 at 3:32
  • $\begingroup$ I want to use a1, a2, a3 and a4 for another system, but in your reply I I do not have function of a1, a2 and .... $\endgroup$ – Bahram Agheli Dec 30 '15 at 9:45
  • $\begingroup$ @BahramAgheli - a[1][t] is an [indexed function] (reference.wolfram.com/language/tutorial/…) of t defined on the interval 0 <= t <= 1 (domain constrained by NDSolve) similarly with a[2][t], a[3][t], and a[4][t]. They are used like any other function; e.g., they were plotted in my answer. The Format command causes them to be displayed in subscripted form in any output. $\endgroup$ – Bob Hanlon Dec 30 '15 at 12:56
  • $\begingroup$ Dear Hanlon, Many thanks . $\endgroup$ – Bahram Agheli Dec 30 '15 at 15:50

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.