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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

15-Moonstone

## Symbolic failure

Hi

Is it possible to overcome this problem wo indexing?

4 REPLIES 4
21-Topaz I
(To:ifomenko)

Hi,

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

23-Emerald III
(To:ifomenko)

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

Success!
Luc

24-Ruby V
(To:ifomenko)

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.

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.