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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

This value must be a vector

JR_11905405
3-Newcomer

This value must be a vector

Hi I am new to Mathcad Prime and I'm trying to solve a kinematics problem, and I really need help. I want to multiply 3 nested arrays, but in step 4 I encountered the error "These arrays elements must be scalars. They cannot be vectors or matrices." I suspected it was because they are nested arrays, so I tried to convert the nested array H1 into a matrix with a code I found online and now I encountered the error "This value must be a vector,"

Any help is appreciated

Thank you

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:JR_11905405)

Chances are that @StuartBruff  has a recursive utility function 'unnest' in his toolbox which can convert your nested matrices to regular 3x3 matrices,

But maybe its better to create H1,2,3 right from the start as 3x3 matrices:

 

Werner_E_0-1729770204013.png

 

View solution in original post

2 REPLIES 2
Werner_E
25-Diamond I
(To:JR_11905405)

Chances are that @StuartBruff  has a recursive utility function 'unnest' in his toolbox which can convert your nested matrices to regular 3x3 matrices,

But maybe its better to create H1,2,3 right from the start as 3x3 matrices:

 

Werner_E_0-1729770204013.png

 

StuartBruff
23-Emerald III
(To:Werner_E)


@Werner_E wrote:

Chances are that @StuartBruff  has a recursive utility function 'unnest' in his toolbox which can convert your nested matrices to regular 3x3 matrices,

But maybe its better to create H1,2,3 right from the start as 3x3 matrices:


You rang?

 

Yes, I'm sure I do have a unnest function lying around, possibly several.  Although the problem looks specifically like it would be suited to one my block/unblock matrix functions. I shall add it to my list of things to look for.   It would be nice to have some means of looking inside an .mcdx worksheet and searching for terms in Windows Explorer or some such.

 

However, this case suggests that a tailored function that allows the best of both worlds.

 

2024 10 24 C.png

 

The replacement submatrix defined below is one that I find more generally useful than the built-in version.  After a decently short time, the brain gets used to the negative indices and it save a lot of typing and thinking when doing standard operations such as extracting complete rows or columns.  I believe that every matrix or vector function should have a vector/matrix counterpart, hence subvector.

 

2024 10 24 D.png

 

2024 10 24 E.png

 

Stuart

 

Announcements

Top Tags