Hi
Is it possible to overcome this problem wo indexing?
Thanks in advanced
Hi,
Works for me if B and v are not defined with brackets.
With matrices (B) and vectors (v) there's a difference between v*B and B*v:
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.
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.
Mathcad 15 file attached.
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.