Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Dec 30, 2018
08:55 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Dec 30, 2018
08:55 AM

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.

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

Jan 02, 2019
09:51 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 02, 2019
09:51 AM

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:-

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.

10 REPLIES 10

Jan 02, 2019
03:23 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 02, 2019
03:23 AM

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

Kind regards

Jan 02, 2019
10:58 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 02, 2019
10:58 AM

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 😉

Jan 02, 2019
11:10 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 02, 2019
11:10 AM

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

the future. Your point about units is noted – thanks.

Kind Regards

Jan 02, 2019
01:33 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 02, 2019
01:33 PM

@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.

Jan 02, 2019
08:49 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 02, 2019
08:49 AM

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

Jan 02, 2019
09:52 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 02, 2019
09:52 AM

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

Jan 02, 2019
09:51 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 02, 2019
09:51 AM

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:-

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.

Jan 02, 2019
10:02 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 02, 2019
10:02 AM

Hi a postscript.

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

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

Jan 02, 2019
10:43 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 02, 2019
10:43 AM

Got it! Thanks again. Most helpful.

Jan 02, 2019
10:06 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 02, 2019
10:06 AM

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