1 Pages (7 items)
Index vectors in assignments - Messages
#1 Posted: 3/1/2018 7:29:06 AM
Why is using a vector instead of a vector-valued variable a syntax error?

indexvec.sm (5 KiB) downloaded 35 time(s).
indexvec.sm (5 KiB) downloaded 35 time(s).
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 users liked this post
Radovan Omorjan 3/1/2018 11:08:00 AM
#2 Posted: 3/1/2018 12:00:35 PM
WroteWhy 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 !
Utilities Matrix Creator_Exploder.sm (32 KiB) downloaded 38 time(s).
#3 Posted: 3/1/2018 3:30:35 PM
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.sm (9 KiB) downloaded 27 time(s).
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#4 Posted: 3/1/2018 8:38:07 PM
#5 Posted: 3/2/2018 7:58:33 AM
WroteWhy is using a vector instead of a vector-valued variable a syntax error?
indexvec.sm (5 KiB) downloaded 35 time(s).
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
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#6 Posted: 3/4/2018 12:08:38 AM
WroteI 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 KiB) downloaded 43 time(s).
#7 Posted: 3/22/2018 11:54:01 AM
1 Pages (7 items)
-
New Posts
-
No New Posts