1 страниц (5 вхождений)
matrix row function - Сообщения
#1 Опубликовано: 25.10.2010 04:55:02
If I try to square a row-function-element I get an error:
[LIVE width=322 height=265]http://smath.info/live/?file=1734[/LIVE]
[LIVE width=322 height=265]http://smath.info/live/?file=1734[/LIVE]
#2 Опубликовано: 25.10.2010 05:39:19
Hello,
SMath uses column matrix as a vector. Therefore:
[MATH=eng]mat(4,5,6,3,1)^2=77[/MATH]
[MATH=eng]mat(4,5,6,3,1)*mat(4,5,6,3,1)=77[/MATH]
[MATH=eng]4*4+5*5+6*6=77[/MATH]
represents scalar products of two vectors, resulting in scalar.
However, row matrix can not be used this way
[MATH=eng]mat(4,5,6,1,3)^2=#@#[/MATH]
It is regarded as matrix product of two matrices, resulting in matrix.
[MATH=eng]mat(4,5,6,1,3)*mat(4,5,6,1,3)=#@#[/MATH]
Of course, it is not possible - wrong numbers of rows/columns. You can do only this:
[MATH=eng]mat(4,5,6,1,3)*mat(4,5,6,3,1)=mat(77,1,1)[/MATH]
[MATH=eng]mat(4,5,6,3,1)*mat(4,5,6,1,3)=mat(16,20,24,20,25,30,24,30,36,3,3)[/MATH]
Regards,
Radovan
SMath uses column matrix as a vector. Therefore:
[MATH=eng]mat(4,5,6,3,1)^2=77[/MATH]
[MATH=eng]mat(4,5,6,3,1)*mat(4,5,6,3,1)=77[/MATH]
[MATH=eng]4*4+5*5+6*6=77[/MATH]
represents scalar products of two vectors, resulting in scalar.
However, row matrix can not be used this way
[MATH=eng]mat(4,5,6,1,3)^2=#@#[/MATH]
It is regarded as matrix product of two matrices, resulting in matrix.
[MATH=eng]mat(4,5,6,1,3)*mat(4,5,6,1,3)=#@#[/MATH]
Of course, it is not possible - wrong numbers of rows/columns. You can do only this:
[MATH=eng]mat(4,5,6,1,3)*mat(4,5,6,3,1)=mat(77,1,1)[/MATH]
[MATH=eng]mat(4,5,6,3,1)*mat(4,5,6,1,3)=mat(16,20,24,20,25,30,24,30,36,3,3)[/MATH]
Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#3 Опубликовано: 25.10.2010 06:14:43
Thanks a lot for the fast response.
In my case the matix is used as a table. Every column is a dataset.
With one row I can calculate the results for every dataset. Is there any other option to solve my problem?
In my case the matix is used as a table. Every column is a dataset.
With one row I can calculate the results for every dataset. Is there any other option to solve my problem?
#4 Опубликовано: 25.10.2010 06:31:26
You are welcome,
If I understood you well, you need the element-wise matrix operations.
These operations need to be done with loops and specific matrix elements.
For instance:
[MATH=eng]A←5[/MATH]
[MATH=eng]B←4[/MATH]
[MATH=eng]C←mat(4,5,6,1,3)[/MATH]
[MATH=eng]for(i,range(1,length(C)),el(E2,1,i)←{(A-el(C,1,i))^2}/
[/MATH]
[MATH=eng]E2=mat(0.25,0,0.25,1,3)[/MATH]
I hope this helped. If not, just be more specific please.
Regards,
Radovan
If I understood you well, you need the element-wise matrix operations.
These operations need to be done with loops and specific matrix elements.
For instance:
[MATH=eng]A←5[/MATH]
[MATH=eng]B←4[/MATH]
[MATH=eng]C←mat(4,5,6,1,3)[/MATH]
[MATH=eng]for(i,range(1,length(C)),el(E2,1,i)←{(A-el(C,1,i))^2}/

[MATH=eng]E2=mat(0.25,0,0.25,1,3)[/MATH]
I hope this helped. If not, just be more specific please.
Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
1 страниц (5 вхождений)
-
Новые сообщения
-
Нет новых сообщений