1 страниц (5 вхождений)
Division between elements of matrices - Сообщения
#1 Опубликовано: 26.05.2013 07:08:29
#2 Опубликовано: 26.05.2013 08:25:00
1. You should not use i's and j's as indices, because they also designate imaginary part of complex numbers. In some versions some of them, or both, cause errors when used otherwise.
2. You could use I and j as indices of k, not of C[k] or A[k].
It would be better if you attach the file.
Edit: Oh, it looks like you cannot assign anything to nested matrices...
Seems like you only can assign the whole new matrix to C[k].
2. You could use I and j as indices of k, not of C[k] or A[k].
It would be better if you attach the file.
Edit: Oh, it looks like you cannot assign anything to nested matrices...
Seems like you only can assign the whole new matrix to C[k].
С уважением,
Михаил Каганский
#3 Опубликовано: 26.05.2013 08:30:38
Hello,
Try this
[MATH=eng]for(k,range(1,rows(A)),line(for(i,range(1,rows(
),for(j,range(1,cols(
),el(c,i,j):el(B,i,j)/el(el(A,k),i,j))),el(C,k):c,2,1))[/MATH]
[MATH=eng]C=mat(mat(4,2.5,2,1.75,1.6,1.5,3,2),mat(0.571,0.625,0.667,7,4,3,3,2),2,1)[/MATH]
It seems that direct assignment of a matrix element in a nested matrix is not allowed. Try to avoid such constructions - it will give trouble.
Regards,
Try this
[MATH=eng]for(k,range(1,rows(A)),line(for(i,range(1,rows(


[MATH=eng]C=mat(mat(4,2.5,2,1.75,1.6,1.5,3,2),mat(0.571,0.625,0.667,7,4,3,3,2),2,1)[/MATH]
It seems that direct assignment of a matrix element in a nested matrix is not allowed. Try to avoid such constructions - it will give trouble.
Regards,
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#4 Опубликовано: 26.05.2013 08:30:52
The problem is in using nested indices on the left hand side. That does not work just as linear indexing of pre-allocated matrices does not work (would save a loop in the example).

Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#5 Опубликовано: 26.05.2013 13:58:08
I thank you all!
Learning by doing
1 страниц (5 вхождений)
-
Новые сообщения
-
Нет новых сообщений