Index vectors in assignments

Index vectors in assignments - 消息

#1 已发布: 2018/3/1 07:29:06
Martin Kraska

Martin Kraska

1,362个赞,共2,276个帖子。

组: Moderator

Why is using a vector instead of a vector-valued variable a syntax error?

indexvec.png
indexvec.sm (5.16 KiB)已下载 1250 次。
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
1位用户喜欢此帖子
Radovan Omorjan 2018/3/1 11:08:00
#2 已发布: 2018/3/1 12:00:35
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: User

Wrote

Why is using a vector instead of a vector-valued variable a syntax error?



In Mathcad [7 <= 11] ... N[i,j is a matrix creator,
In Smath N[i,j ... is NOT a matrix creator.

Besides this distinction, Smath handles all related stuff much easier/naturally
A good example is "Utilities Matrix Locate Array1 Array2.sm" posted yesterday.
Smath spits out this project in two pages compared to Mathcad 5 pages
5 pages very hard to follow for the non-familiar user.

On the other hand, Smath can't render Mandelbrot as nicely as Mathcad.
The cannon that shoots flies is too small for shooting elephant ... never shoot elephants !

MatrixUser.PNG

Utilities Matrix Creator_Exploder.sm (32 KiB)已下载 1267 次。

#3 已发布: 2018/3/1 15:30:35
Martin Kraska

Martin Kraska

1,362个赞,共2,276个帖子。

组: Moderator

Wrote



In Mathcad [7 <= 11] ... N[i,j is a matrix creator,
In Smath N[i,j ... is NOT a matrix creator.



What do you mean by "matrix creator"?

I can easily use M[i;j to define (create?) a matrix. This just doesn't work with anonymous vector constants.

indexvec1.png
indexvec1.sm (9.36 KiB)已下载 1248 次。
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
#4 已发布: 2018/3/1 20:38:07
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: User

Wrote

I can easily use M[i;j to define (create?) a matrix. This just doesn't work with anonymous vector constants.


That feature is not coded Smath 6179

NOTcoded.PNG

#5 已发布: 2018/3/2 07:58:33
Martin Kraska

Martin Kraska

1,362个赞,共2,276个帖子。

组: Moderator

Wrote

Why is using a vector instead of a vector-valued variable a syntax error?

indexvec.png
indexvec.sm (5.16 KiB)已下载 1250 次。



For now we have to distinguish between read access to submatrices and implicit loops.

ranged indices, be it an expression or a variable, work work on the right hand side for access to existing vector or matrix elements.
This concept can be used for any expression except assignment targets.

If assignemts to vector or matrix elements have to be executed for multiple index values, then you can use explicit for-loops (programming) or implicit loops. These are generated by just using vector-valued variables (general vector-valued expressions aren't allowed) as indices in the assignment target.

I don't know why implicit loops don't work for general index expressions, given that scalar expressions can be used for indexing assignment targets. It would be natural to use implicit loops as long as the index object is vector-valued.

Feature request filed as SS-3513
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
#6 已发布: 2018/3/4 00:08:38
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: User

Wrote

I don't know why implicit loops don't work for general index expressions


Smath is essentially an algorithmic CAS. Reconciliation with local "implicit loops"
does not have much interest or very limited interest except for classroom to
demonstrate the limit of simple thinking vs real productive end use.

Utilities Matrix Creator_Exploder.sm (48.25 KiB)已下载 1269 次。
#7 已发布: 2018/3/22 11:54:01
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: User

More generalized/applied recursive.

AppliedRecursive.PNG
  • 有新帖
  • 无新帖