Skip to main content
1-Visitor
March 28, 2019
Solved

Matrix of scalar elements and Matrix returns {1,1}

  • March 28, 2019
  • 2 replies
  • 2652 views

Hi everyone,

 

I am experiencing two problems:

 

1. The classic "this value must be a matrix of scalar elements" when trying to multiply matrices. I have multiplied matrices which had complex elements before, so I am unsure why now the elements must be scalar.

Capture.PNG 

2. Every matrix element below shows as {1,1}. How to show the actual values of each element instead?

Capture2.PNG

 

Thank you.

Best answer by Werner_E

ad 1)

Mathcad is not complaining that the values are non-real. A non-real complex number is of course considered a scalar, too. But by using "submatrix" you created not scalars but 1x1 matrices. That seems to be the problem.

Use the vector/matrix indices to access the elements of a vector/matrix and use "submatrix" if you want to create a matrix consisting of part of another one.

So instead of writing "submatrix(zp_self,1,1,2,2)" simply use "zp_self[1,2". The shortcut "[" creates a matrix index.

For more help you would have to post the worksheet as its hard to debug a picture.

 

ad 2)

{1,1} represents a 1x1 matrix, not a scalar. The reason why  you had created that kind of structure is explained above. A matrix consisting of matrices is called nested matrix or nested array and there is an option to show them all. Assuming you are using real Mathcad 15 you either double click the resulting matrix or highlight it and chose "Format"-"Result" from the menu, go to the tab "Display Options" and  check "Expand nested arrays".

2 replies

Werner_E25-Diamond IAnswer
25-Diamond I
March 28, 2019

ad 1)

Mathcad is not complaining that the values are non-real. A non-real complex number is of course considered a scalar, too. But by using "submatrix" you created not scalars but 1x1 matrices. That seems to be the problem.

Use the vector/matrix indices to access the elements of a vector/matrix and use "submatrix" if you want to create a matrix consisting of part of another one.

So instead of writing "submatrix(zp_self,1,1,2,2)" simply use "zp_self[1,2". The shortcut "[" creates a matrix index.

For more help you would have to post the worksheet as its hard to debug a picture.

 

ad 2)

{1,1} represents a 1x1 matrix, not a scalar. The reason why  you had created that kind of structure is explained above. A matrix consisting of matrices is called nested matrix or nested array and there is an option to show them all. Assuming you are using real Mathcad 15 you either double click the resulting matrix or highlight it and chose "Format"-"Result" from the menu, go to the tab "Display Options" and  check "Expand nested arrays".

23-Emerald IV
March 28, 2019

2. Double-click the nested matrix and from the 'result format' pop-up menu, on the 'Display' tab, select "Expand nested matrix".

 

 

Success!
Luc