cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Inverting a matrix

klax
9-Granite

Inverting a matrix

I am trying to invert a matrix using the variable names already declared.  I can invert the matrix if I manually enter the values of the variables, but not using the variable names.

 

I am obviously missing something and would be grateful for any guidance towards resolving the issue.

 

I attach the entire worksheet but I am only interested in comments on step 5 where the matrix manipulation appears.  I have left notes on the draft section of the page to show what the variable values are and what the problem is.

 

Kind regards and New Year's greetings to all.

ACCEPTED SOLUTION

Accepted Solutions

Hi,

This was subtle.

Back in sections 3, the results for the Y's are actually a matrix with one element not a single numeric result.

The same occurs for the Node values in step 4.  The answer is a 1 x 1 matrix.  

For instance:-

Capture.JPG

One is a 1x1 matrix as indicated by the square brackets.  The other is a single numeric result.

Your file Admittance was a matrix made up of nested 1x1 matrices and could not be inverted.  But your B matrix that had just the values not the nested form works.

 

Correct file enclosed.

View solution in original post

10 REPLIES 10
klax
9-Granite
(To:klax)

I should have added that I am using Mathcad prime version 5.0.0.0

 

Kind regards

Werner_E
25-Diamond I
(To:klax)

The reason for you problem is that the elements you put in your Admittance matrix (A[0,4, etc) are not scalars but 1x1 matrices.

The reason for this is that you use the row operator to access the elements of the vector "length" instead of the vector index like "length[0".

If you fix this the inverse matrix calculates without problems. See attached.

 

BTW, in Prime its a good idea to assign units to zero values, too.

 

EDIT: Just saw that Terry was faster 😉

 

 

klax
9-Granite
(To:Werner_E)

Thank you Fred. I will change the way I format the prior calculations in
the future. Your point about units is noted – thanks.



Kind Regards
Werner_E
25-Diamond I
(To:klax)


@klax wrote:
Thank you Fred.

Werner 😉

Fred unfortunately can't read P5 worksheets

 


I will change the way I format the prior calculations in
the future.

The point is, that Primes column- or row-selectors (ctr-shift-c, ctrl-shift-r) always return a matrix, a column resp. a row vector. Thats true even when its just a 1x1 vector/matrix.

To access the element of a vector or matrix you have to use indices, either v[i or M[i,j


Your point about units is noted – thanks.

Mathcad 15 uses SUC (static unit checking) and there is no need to assign a unit to a zero value.

Prime had done away with SUC (fortunately) and so in some circumstances it can't decide which unit to assign a zero value to and may fail. In Prime we also have to new "units", zero and Zero, to cope with problems which may arise because of this behaviour.
Assigning a unit to a zero value may look unnecessary work, but sometimes its simply necessary in Prime and furthermore I think doing so may increase the readability of worksheet sometimes.

 

Fred_Kohlhepp
23-Emerald I
(To:klax)

I can't open your version 5 (only have 4), but the simple example attached should demonstrate that you can.

Thanks Fred.  I can do the same but when I try as shown on the attached word document, I cannot do it.

 

On the draft side of the document you will see some text and some tests I have been trying.  If I add the values for the variables, then it works OK.

 

I cannot quickly see how to save the file as a Prime 4 version.

 

Kind Regards

 

Hi,

This was subtle.

Back in sections 3, the results for the Y's are actually a matrix with one element not a single numeric result.

The same occurs for the Node values in step 4.  The answer is a 1 x 1 matrix.  

For instance:-

Capture.JPG

One is a 1x1 matrix as indicated by the square brackets.  The other is a single numeric result.

Your file Admittance was a matrix made up of nested 1x1 matrices and could not be inverted.  But your B matrix that had just the values not the nested form works.

 

Correct file enclosed.

Hi a postscript.

I should show you how to correct the equations to make it simpler.

 

Capture.JPG

The first equation takes the first row of Length as a matrix and returns a matrix,

The second equation takes a value from the first element of Length and returns it as a value

 

Cheers

Terry

Got it!  Thanks again.  Most helpful.

Thank you very much Terry.  That is an excellent explanation. 

Announcements

Top Tags