Get Help

Turn on suggestions

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

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Inverting a matrix

Options

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

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

Showing results for

Highlighted

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

12-30-2018
08:55 AM

12-30-2018
08:55 AM

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

Highlighted

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

01-02-2019
09:51 AM

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

Highlighted
##

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

01-02-2019
03:23 AM

01-02-2019
03:23 AM

Re: Inverting a matrix

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

Kind regards

Highlighted
##

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

01-02-2019
10:58 AM

01-02-2019
10:58 AM

Re: Inverting a matrix

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 😉

Highlighted
##

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

01-02-2019
11:10 AM

01-02-2019
11:10 AM

Re: Inverting a matrix

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

Highlighted
##

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

01-02-2019
01:33 PM

01-02-2019
01:33 PM

Re: Inverting a matrix

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

Highlighted
##

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

01-02-2019
08:49 AM

01-02-2019
08:49 AM

Re: Inverting a matrix

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

Highlighted
##

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

01-02-2019
09:52 AM

01-02-2019
09:52 AM

Re: Inverting a matrix

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

Highlighted

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

01-02-2019
09:51 AM

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

Highlighted
##

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

01-02-2019
10:02 AM

01-02-2019
10:02 AM

Re: Inverting a matrix

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

Highlighted
##

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

01-02-2019
10:43 AM

01-02-2019
10:43 AM

Re: Inverting a matrix

Got it! Thanks again. Most helpful.

Highlighted
##

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

01-02-2019
10:06 AM

01-02-2019
10:06 AM

Re: Inverting a matrix

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