Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline flyback  
#1 Posted : 25 October 2010 11:55:02(UTC)
flyback

Rank: Newbie

Groups: Registered
Joined: 25/10/2010(UTC)
Posts: 5

If I try to square a row-function-element I get an error:

Open in SMath Cloud

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline omorr  
#2 Posted : 25 October 2010 12:39:19(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello,

SMath uses column matrix as a vector. Therefore:
mat(4,5,6,3,1)^2=77
mat(4,5,6,3,1)*mat(4,5,6,3,1)=77
4*4+5*5+6*6=77
represents scalar products of two vectors, resulting in scalar.
However, row matrix can not be used this way
mat(4,5,6,1,3)^2=#@#
It is regarded as matrix product of two matrices, resulting in matrix.
mat(4,5,6,1,3)*mat(4,5,6,1,3)=#@#
Of course, it is not possible - wrong numbers of rows/columns. You can do only this:
mat(4,5,6,1,3)*mat(4,5,6,3,1)=mat(77,1,1)
mat(4,5,6,3,1)*mat(4,5,6,1,3)=mat(16,20,24,20,25,30,24,30,36,3,3)

Regards,
Radovan


When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline flyback  
#3 Posted : 25 October 2010 13:14:43(UTC)
flyback

Rank: Newbie

Groups: Registered
Joined: 25/10/2010(UTC)
Posts: 5

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?
Offline omorr  
#4 Posted : 25 October 2010 13:31:26(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
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:
A←5
B←4
C←mat(4,5,6,1,3)
for(i,range(1,length(C)),el(E2,1,i)←{(A-el(C,1,i))^2}/Cool
E2=mat(0.25,0,0.25,1,3)

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!"
Offline flyback  
#5 Posted : 25 October 2010 13:54:47(UTC)
flyback

Rank: Newbie

Groups: Registered
Joined: 25/10/2010(UTC)
Posts: 5

Well done, I'm happy...
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.