Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
Yes Andrey, that's it - very clever and interesting realization It would be nice to have a built-in function like you described. It crossed my mind just to extend the matrix() function to matrix(3) in order to have such and similar functionality in filling a matrix, but did not come to my mind your solution. It seems that this function might be quite useful in matrix calculations. On the other hand, I will definitely put this function as a "snippet". Thank you. BTW, in order to make vectors we could make correction in above matrix(3) function or make a vector(2). vector(n,f(1))←line(for(j←1,j≤n,j←j+1,el(result,j)←f(j)),result,2,1) f(j)←el(x,j)vector(3,f(j))—mat(el(x,1),el(x,2),el(x,3),3,1)Rather useful for matrix elementwise operation (like vectorization in Mathcad) f(j,k)←el(x,j,k)*e^el(y,j,k)matrix(2,2,f(j,k))—mat(e^el(y,1,1)*el(x,1,1),e^el(y,1,2)*el(x,1,2),e^el(y,2,1)*el(x,2,1),e^el(y,2,2)*el(x,2,2),2,2)f(j)←el(x,j)/el(y,j)vector(3,f(j))—mat(el(x,1)/el(y,1),el(x,2)/el(y,2),el(x,3)/el(y,3),3,1)x←mat(1,-1,6,3,1) y←mat(3,5,4,3,1)vector(length(x),f(j))—mat(1/3,-1/5,3/2,3,1)Actually, we have to pay attention on the function and varible names (f(2) and f(1) are functions with row, column indexes - x and y are global variables) but it is good enough Regards, Radovan Edited by user 18 January 2012 01:30:37(UTC)
| Reason: Not specified |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |