(no subject)

2013-11-29
2014-05-23

  • jvallejo
    2014-05-19

    (%i1): X:matrix([2,1],[1,2]);
    (%i2) X^^5

     
    • arielCo
      arielCo
      2014-05-19

      Daviodan means to solve X^^5 = matrix([2,1],[1,2]). Since Maxima does not
      compare compound variables element-by-element, you have to extract its
      elements into a flat list and construct the four equations.

      This takes forever:

      X : matrix([a11,a12],[a21,a22]); X5 : X^^5, fullratsimp; x5 :
      flatten(args(X5));
      A : matrix([2,1],[1,2]); a:flatten(args(A));
      eqn : makelist(x5[i]=a[i], i, 1, length(x5));
      algsys(eqn, flatten(args(X)));

      Ariel Cornejo
      +58·412·8083546

      On Mon, May 19, 2014 at 3:40 AM, jvallejo <None> wrote:

      (%i1): X:matrix([2,1],[1,2]);
      (%i2) X^^5


      (no subject)https://sourceforge.net/p/wxmaxima/discussion/435775/thread/02bfacf8/?limit=25#481d

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/wxmaxima/discussion/435775/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
      • Aleksas
        Aleksas
        2014-05-23

        (%i1) X:matrix([x,z],[z,y])$
        Problem: solve matrix equation
        (%i2) X^^5 = matrix([2,1],[1,2])$

        Solution:
        (%i3) s:expand(lhs(%)-rhs(%))$
        (%i4) sist: list_matrix_entries(s)$
        (%i5) algebraic:true$
        (%i6) fpprintprec:5;
        (%o6) 5
        (%i7) sol:solve(sist,[x,y,z]);
        (%o7) [[x=-0.366%i-0.00391,y=-0.366%i-0.00391,z=-0.366*%i-1.0039],[x=0.366%i-0.00391,y=0.366%i-0.00391,z=0.366*%i-1.0039],[x=0.692-0.592%i,y=0.692-0.592%i,z=-0.592*%i-0.308],[x=0.592%i+0.692,y=0.592%i+0.692,z=0.592*%i-0.308],[x=1.1229,y=1.1229,z=0.123],[x=0.294%i+0.218,y=0.294%i+0.218,z=1.0274-0.294*%i],[x=0.218-0.294%i,y=0.218-0.294%i,z=0.294*%i+1.0274],[x=-0.298%i-0.212,y=-0.298%i-0.212,z=0.597-0.886*%i],[x=0.298%i-0.212,y=0.298%i-0.212,z=0.886*%i+0.597],[x=0.347-0.117%i,y=0.347-0.117%i,z=0.038-1.0679*%i],[x=0.117%i+0.347,y=0.117%i+0.347,z=1.0679*%i+0.038],[x=0.109%i-0.349,y=0.109%i-0.349,z=-0.842*%i-0.658],[x=-0.109%i-0.349,y=-0.109%i-0.349,z=0.842*%i-0.658],[x=0.842%i-0.349,y=0.842%i-0.349,z=-0.109*%i-0.658],[x=-0.842%i-0.349,y=-0.842%i-0.349,z=0.109*%i-0.658],[x=-0.886%i-0.212,y=-0.886%i-0.212,z=0.597-0.298*%i],[x=0.886%i-0.212,y=0.886%i-0.212,z=0.298*%i+0.597],[x=0.476%i+0.777,y=0.476%i+0.777,z=0.468-0.476*%i],[x=0.777-0.476%i,y=0.777-0.476%i,z=0.476*%i+0.468],[x=-0.0722%i-0.908,y=-0.0722%i-0.908,z=-0.66*%i-0.0994],[x=0.0722%i-0.908,y=0.0722%i-0.908,z=0.66*%i-0.0994],[x=-0.66%i-0.908,y=-0.66%i-0.908,z=-0.0722*%i-0.0994],[x=0.66%i-0.908,y=0.66%i-0.908,z=0.0722*%i-0.0994],[x=0.347-1.0679%i,y=0.347-1.0679%i,z=0.038-0.117*%i],[x=1.0679%i+0.347,y=1.0679%i+0.347,z=0.117*%i+0.038]]
        (%i8) length(sol);
        (%o8) 25
        We get one real and 24 complex solutions:
        (%i9) sublist(sol,lambda([x],freeof(%i,x)));
        (%o9) [[x=1.1229,y=1.1229,z=0.123]]
        (%i10) subst(%[1],X);
        (%o10) matrix([1.1229,0.123],[0.123,1.1229])
        (%i11) %^^5,expand;
        (%o11) matrix([2.0,1.0],[1.0,2.0])
        (%i12) subst(sol[2],X);
        (%o12) matrix([0.366%i-0.00391,0.366%i-1.0039],[0.366%i-1.0039,0.366%i-0.00391])
        (%i13) %^^5,expand;
        (%o13) matrix([2.0-1.759710^-14%i,1.0-2.6201310^-14%i],[1.0-2.6312310^-14%i,1.6653310^-16%i+2.0])
        (%i14) subst(sol[3],X);
        (%o14) matrix([0.692-0.592%i,-0.592%i-0.308],[-0.592%i-0.308,0.692-0.592%i])
        (%i15) %^^5,expand;
        (%o15) matrix([6.1062310^-15%i+2.0,1.0-5.5511210^-16%i],[1.0-6.6613410^-16%i,2.0-1.1102210^-16%i])
        etc

        best
        Aleksas D

         
  • Ago77
    Ago77
    2014-05-20

    Gets faster if you impose symmetry at the outset, just replace the first command by
    X : matrix([x, y], [y, x]);