If this is my matrix a as follows:
a00 a01
a10 a11
Element a00 would be comprised of a matrix b as follows:
b00 b01
b10 b11
And so on …
I want to solve my A matrix using Mathematica algorithm.
Thanks for your help.
Stan
If this is my matrix a as follows:
a00 a01
a10 a11
Element a00 would be comprised of a matrix b as follows:
b00 b01
b10 b11
And so on …
I want to solve my A matrix using Mathematica algorithm.
Thanks for your help.
Stan
There appears to be a problem with this approach. If my simple understanding of matrices is correct, you cannot invert a matrix if there is a matrix inside of it because the inverse of a matrix and the original matrix multiply (A A^-1 or A^-1 A) to produce the identity matrix, perhaps there is something else you are wanting? Although I do find the idea of matries within matrices tedious and entertaining.
Assume your matrix is
{
{A, B},
{C, D}
}
and A, B, C, D are “wellbehaved” 2x2 matrices (meaning inverses and so do exist.
Then look what happens if multiplying your matrix from the right with
{
{U, V},
{X, Y}
}
where
X = ( B - A C^(-1) D )^(-1)
Y = ( D - C A^(-1) B )^(-1)
U = - C^(-1) D X
V = - A^(-1) B Y
I think you’ll have to be more specific to be able to get an answer. Are you familiar with tensor algebra? If so, can you be more explicit about what you’re asking for?
You’re asking how to get an inverse of an order 3 tensor and I don’t know that I’ve ever seen that before or would know what that is.
Hans,
Thank you for responding to my question. I too am retired 6 years ago. Here is my matrix.
A={{I.-I],{T,R}} where I={{1,0},{0,1}};T={{-Zout2},{m}},{{m,-Yout2}};R={{Zin1,{m}},{m,Yin1}};
As you can readily see that matrix elements in my matrix are 2x2 matrices themselves.
I want to establish that the inverse of my matrix times the original matrix is a unit matrix with 2x2 elements. Thereafter I want to multiply my inverse matrix with a second matrix with elements that are also 2x2 matrices. In particular, B={{1,1} I do not know how to edits anything that I am saying, so I am attaching a file that specifies the matrix and another operation dealing with the matrix.
Stan
Matrix Inverses.nb (3.16 KB)
Hello Stan,
I am not quite sure whether I understand what you really want to do. I attach a notebook, perhaps this is useful for you.
Greetings, Hans
wcom20190409.nb (30.2 KB)
Multiplication of (2,2)matrices of (2,2)matrices
matmul2[a_, b_] := Module[{},
res = Table[
Sum[a[[i, k]].b[[k, j]], {k, 1, 2}], {i, 1, 2}, {j, 1, 2}];
FullSimplify[res]
]
A-matrix
ma = {
{1, 0},
{0, 1}
} ;
mb = {
{-1, 0},
{0, -1}
} ;
mc = {
{-Zout2, m},
{m, -Yout2}
} ;
md = {
{Zin1, m},
{m, Yin1}
} ;
mA = {
{ma, mb},
{mc, md}
} ;
% // MatrixForm
Its (Left)inverse
mp = Inverse[mc - md.Inverse[mb].ma];
mr = Inverse[md - mc.Inverse[ma].mb];
mo = -mp.md.Inverse[mb];
mq = -mr.mc.Inverse[ma];
LinvA = {
{mo, mp},
{mq, mr}
} ;
check this
matmul2[LinvA, mA];
% // MatrixForm
The B-matrix
mB = {{{{Zin, 0}, {0, Zin}}, {{-Zin, 0}, {0, -Zin}}},
{{{-Zin Zout1, m Zin},{m Zin, -Yout1 Zin}}, {{Zin Zin2, m Zin}, {m Zin, Yin2 Zin}}}};
% // MatrixForm
and the result
matmul2[LinvA, mB];
% // MatrixForm
Hans,
Since the matrix was so large Mathematica was unable to print it a matrix. So, I simplified the results for the m=0 case and tested the inverse and the product of the inverse and the original matrix was NOT a unit matrix. I have more send you, but I will do this at a later date.
See my attachment.
Stan
Wolfram_3.nb (20 KB)
Hello Stan,
frankly spoken I thought your problem is solved. What do you mean by “the matrix was so large”?
And note: in general there is no simple inverse of your A-Matrix. But there are in general two, a right- and a left-inverse. Your equations should show which is needed.
I wrote about this in the notebook you sent and attach the modified version to this post. Please let me know if it is helpful.
Wolfram_3.nb (81.2 KB)
Hans,
What I meant by the matrix being so large is that MatrixForm could not be executed so I cannot even read the results. So, if your take a simple case, m=0, your could display the MatrixForm and your inverse either Left or Right does not yield a unit matrix when multiplied by the original matrix. I am sure that I am not understanding your results. This is not your fault but just mine. Please take a look at my attachment. Thanks!
Stan
Inverse_using_scalars.nb (394 KB)
Hans,
What I meant by the matrix being so large is that MatrixForm could not be executed so I cannot even read the results. So, if your take a simple case, m=0, your could display the MatrixForm and your inverse either Left or Right does not yield a unit matrix when multiplied by the original matrix. I am sure that I am not understanding your results. This is not your fault but just mine. Please take a look at my attachment. Thanks!
Stan
Inverse_using_scalars.nb (394 KB)
Hello Stan,
I looked at your file, but I am afraid I do not understand what you are doing there. I think using scalars is absolutely not appropriate.
As multiplication of matrices is associative left- and right-inverse should be equal, and indeed they are.
your inverse either Left or Right does not yield a unit matrix when multiplied by the original matrix.
Yes, it does. Look at the notebook. Are you sure that you used the multiplication for matrices whose elements are matrices themselves (matmul2) ?
I attach another notebook in which the inverse of your matrix is given and also the product you asked for. The m = 0 - case is included. I hope this is helpful.
wcom20190424.nb (53.3 KB)
Hello Stan,
in the meantime I could show that despite the elements of your matrix being matrices which products might not commute the left- and right - inverse of your matrix are equal. So once again:
If your matrix is
A = { { a, b }, { c, d } }
and a, b, c and d are (invertible) matrices themselves, then
A^(-1) = { { Inverse[ a - b . Inverse[d] . c], Inverse[ c - d . Inverse[b] . a] },
{ Inverse[ b - a . Inverse[c] . d], Inverse[ d - c . Inverse[a] . b ] } }
and
A^(-1) . A = A . A^(-1) = Identity = { { 1 , 0 }, { 1, 0 } }
with 1 and 0 the appropriate Identity- and Zero-Matrix respectively.
Hans,
My idea in finding an inverse was to build upon a scalar solution and mimic the steps with the proper matrix algebra. That did not work!
Now, if you do not mind let us return to your first letter. i called it Hans_Example.nb.
I simply did not know what you were showing me.
Next when you addressed my specific matrix and showed what you must do, I could not understand the results because Mathematica could not show me the results in matrix form. That is what I meant when saying the matrix was too large. Finally, I looked up under Help what matmult2 meant and could not find an answer. I would appreciate any help you can give.
Stan
Hans_Example.nb (8.7 KB)
Hans_Leftinverse.nb (42.3 KB)
Hans,
My idea in finding an inverse was to build upon a scalar solution and mimic the steps with the proper matrix algebra. That did not work!
Now, if you do not mind let us return to your first letter. i called it Hans_Example.nb.
I simply did not know what you were showing me.
Next when you addressed my specific matrix and showed what you must do, I could not understand the results because Mathematica could not show me the results in matrix form. That is what I meant when saying the matrix was too large. Finally, I looked up under Help what matmult2 meant and could not find an answer. I would appreciate any help you can give.
Stan
Hans_Example.nb (8.7 KB)
Hans_Leftinverse.nb (42.3 KB)
Hans,
My idea in finding an inverse was to build upon a scalar solution and mimic the steps with the proper matrix algebra. That did not work!
Now, if you do not mind let us return to your first letter. i called it Hans_Example.nb.
I simply did not know what you were showing me.
Next when you addressed my specific matrix and showed what you must do, I could not understand the results because Mathematica could not show me the results in matrix form. That is what I meant when saying the matrix was too large. Finally, I looked up under Help what matmult2 meant and could not find an answer. I would appreciate any help you can give.
Stan
Hans_Example.nb (8.7 KB)
Hans_Leftinverse.nb (42.3 KB)
Hans,
My idea in finding an inverse was to build upon a scalar solution and mimic the steps with the proper matrix algebra. That did not work!
Now, if you do not mind let us return to your first letter. i called it Hans_Example.nb.
I simply did not know what you were showing me.
Next when you addressed my specific matrix and showed what you must do, I could not understand the results because Mathematica could not show me the results in matrix form. That is what I meant when saying the matrix was too large. Finally, I looked up under Help what matmult2 meant and could not find an answer. I would appreciate any help you can give.
Stan
Hans_Example.nb (8.7 KB)
Hans_Leftinverse.nb (42.3 KB)
Hi Stan,
please have a close look at the notebook I posted at last ( wcom20190424.nb - see above)
Everything is explained in the notebook. Go through it step by step, and if you have questions, please feel free to write me an email for further details ( h.dolhaine@gmx.de).
(I suggest you load the notebook and execute it: Evaluation - Evaluate Notebook) and see what happens.
You can’t find anything about matmult2 in Help, because it is a self-written procedure to do a matrixmultiplication (I assume, you know the rules how to multiply two matrices with numbers as elements. matmult2 is written to cope with matrices which have matrices as elements. It is a function (see the := sign) with two parameters which are supposed to be matrices. See above:
matmul2[a_, b_] := Module[{},
res = Table[
Sum[a[[i, k]].b[[k, j]], {k, 1, 2}], {i, 1, 2}, {j, 1, 2}];
FullSimplify[res]
]
You have to execute this statement prior to any use of matmult2. Obviously it is missing in one or both of the notebooks you sent, and without it all the rest will not work. That is the reason you get a lengthy result when using it: it is simply not available and nothing is done.
So again, have a close (!) look at wcom20190424.nb and see if that helps.
Kind regards, Hans
And there is a typo. You speak of matmult2, but its name in the notebook is matmul2.
Hans,
My humblest apologies. First of all, I have never used a chat room before so I was unable to reply immediately. Let’s start from the beginning. You sent me an example in our first discussion and I was unable to find how this was connected to finding an inverse. I did not answer since I was unsure how to do this so I continued with my approach by using a scalar representation hoping that this would lead me to a matrix solution. Obviously, I could not do this successfully. After communicating with me again you sent me a solution that I claimed was too large such that Mathematica could not express it in matrix form. I guess It did not work because I had not used matmul2. I simply saw what you have done and type matmul2 and it did not apply this procedure since I did not have access to the self-written procedure.
At this stage, what would be most helpful for me is to have the solution that you obtained in a separate file that I can see. I will them be able to the proof of it the inverse and also see the multiplication by the B matrix that lead to the so-called Fresnel equations in electromagnetics.
Finally, I need to understand how you arrived at your solution.
I would like you to understand the exercise in inverting a matrix was a small part of a large problem that I solved a long time ago. I was simply looking at this problem to keep my mind alert. Presently, I am 81 years old and I am asking that you be patient with the elderly. Thank you very much.
Stan
P.S. My computer crashed and I was unable to respond earlier.