Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica:Matrix Multiplication of five 6x6 matrices

  1. Jul 23, 2012 #1
    Hi,
    I have five 6x6 matrices defined on mathematica with some unknowns and I need the final matrix lets say, mf.

    When I tried to find out mf with Dot[] command, it works but the result won't be so logic. On the other hand, when I tried to do this multiplication with . symbol, there exists a result but when I asked the program lets say mf[[1,1]] it prints the entire row.

    Lets say my matrices are m1,m2,m3,m4 and m5.( Notation is just for assumption)

    What should I do to calculate if mf is written like following on the paper;
    mf=m1.m2.m3.m4.m5

    I tried a way like this also,

    aa=m5.m4;
    bb=aa.m3;
    cc=bb.m2;
    mf=cc.m1;

    However, this is not logic. There sould be some way to define more than 2 matrices multiplication in one time.

    If you need or request, I can upload my studies too.

    Best.
     
  2. jcsd
  3. Jul 23, 2012 #2

    Hepth

    User Avatar
    Gold Member

    What do you mean by so logic? Can you attach an example mathematica file?

    for me m1.m2.m3 works fine. Or try m1.(m2.m3) to force order of operations.
     
  4. Jul 23, 2012 #3
    I mean the result is not so useful for further calculations.

    I am trying to calculate the sf value that shown on the Dsf matrix. To do that I need to multiply that five 6x6 matrice and than use the Ts[[1,2]]=0 and Ts[[3,4]]=0 statements to find βex. After that, I can calculate sf. βex also sf must be some meanfull result compared to the reference values.

    For example, If I take βin=βex=0 than ψin=ψex=0.001939 rad and than alpha will be 90 degree which is also 1.57 rad. From there,ρ will be 0.075 m. The other variables will not change. Than when I made the calculations I got sf as positive and negative two values however it should have a single, small, positive value.

    I am so so confused even this is just a simple problem...
     

    Attached Files:

  5. Jul 23, 2012 #4
    Ts = Dsi.Medgein.Mbody.Medgeex.Dsf // MatrixForm

    is not doing a matrix multiply
    then assigning that matrix to TS
    THEN changing the result into MatrixForm to display it.

    Instead it
    is doing a matrix multiply
    then changing the result into MatrixFormwhich is different from a matrix
    THEN assigning that to to Ts and finally displaying that.

    Instead of this
    Ts = Dsi.Medgein.Mbody.Medgeex.Dsf // MatrixForm
    Ts[[1, 2]]
    Ts[[3, 4]]
    do this
    Ts = Dsi.Medgein.Mbody.Medgeex.Dsf;
    Ts // MatrixForm
    Ts[[1, 2]]
    Ts[[3, 4]]

    See if your results are meaningful after this change
     
  6. Jul 23, 2012 #5
    Thank you Bill Simpson, it worked for the matrix multiplication.

    Then I tried to solve the rest that I mentioned. If you don't mind please share the results if it's possible. I would like to compare them with mine and try to find a way.

    Thank you.
     
  7. Jul 24, 2012 #6
    Using your multiplication.nb notebook that you posted with this small change:
    ...
    Ts = Dsi.Medgein.Mbody.Medgeex.Dsf
    Ts // MatrixForm
    Ts[[1, 2]]
    Ts[[3, 4]]
    FindRoot[{Ts[[1, 2]] == 0, Ts[[3, 4]] == 0}, {{βex, 0}, {sf, 1}}]

    returns

    {βex -> 0.135322, sf -> -0.258422}

    Since you have trig functions there will be many solutions for βex.

    For example, this shows the repeating solutions for both equations for repeating values of βex given a fixed value for sf:

    Plot[Evaluate[{Ts[[1, 2]], Ts[[3, 4]]} /. sf -> -0.2584215664919408], {βex, -2 Pi, 2 Pi}]

    I have not explored whether there are other values of sf which yield solutions, but I would not be surprised if there were whole parametric curves for values of {βex, sf} that are solutions to your pair of equations.

    Note: It is dangerous and error prone to not use a semicolon between each expression in a notebook. Sometimes you can do this and still have it work. But this has been a source of difficult to track down errors for many years. I suggest ending each expression in your notebook with a semicolon and using Print[] if you need to have an expression displayed when evaluating a notebook.
     
    Last edited: Jul 24, 2012
  8. Jul 25, 2012 #7
    Bill Simpson,
    Thank you so much for your advise and help. I know that the function is periodic but actually expect a small value for βex and also a small value for sf since the final result which I have to reach is multiplication of Ts[[1,1]] and 0.01 must be a positive and really really small number.

    I will check the whole code today and rewrite it in a form that you mentioned. Also I will add some notes that indicates the meaning of each value.

    Thank you so much for your kind and helpfull messages.

    Best,
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Mathematica:Matrix Multiplication of five 6x6 matrices
Loading...