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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Symbolic failure

ifomenko
15-Moonstone

Symbolic failure

Hi

Is it possible to overcome this problem wo indexing?

Symbolic failed.PNG

Thanks in advanced

 

4 REPLIES 4

Hi,

 

Works for me if B and v are not defined with brackets.

Capture.PNG

LucMeekes
23-Emerald III
(To:ifomenko)

With matrices (B) and vectors (v) there's a difference between v*B and B*v:

LM_20190617_Multiplication.png

 

Success!
Luc

Obviously the symbolics sees that both are 1-column matrices, calls them vectors and tries to calculate the vector dot product which must fail because of the different lengths.

 

Nevertheless I would call it a bug because we have no way to distinguish between matrix multiplication and vector dot product, so the expression should at least be interpreted correctly as matrix multiplication by the symbolics.

 

What Terry showed is wrong, too (even worse). In Prime the behavior is different whether we use the explicit multiplication dot or the implicit one (created e.g. by deleting the typed in multiplication dot). The behavior with the implicit multiplication is somewhat strange, to say the least. Each elements of the first matrix is multiplied by the second factor, no matter what that is.

B0.PNG

 

Ifomenko is using real Mathcad, so one workaround (not in the least satisfactory) could be writing a function for matrix multiplication, give it the name * or maybe even some kind of dot and use it with inline notation. Clumsy and awkward, I know.

 

Another "fix" (no, I wouldn't really call it a fix) is to add a dummy row made up of zeros to both matrices/vectors B and v to force the symbolics to do matrix multiplication. Doesn't look good, though.

The trick with the dummy rows could also be used in the self written matrix-multiplication routine instead of the nested for-loops.

B.PNG

Mathcad 15 file attached.

ifomenko
15-Moonstone
(To:Werner_E)

Many thanks, Werner,

I prefer to use index way Bj,i*vj. Moreover, it is only one way in the case of higher-order tensors.

Top Tags