1 Pages (11 items)
Strange problem with units and range variables/implicit loops - Messages
#1 Posted: 2/25/2019 3:30:20 PM
if x is 1m, the loop fails, if x=1, it succeeds. Any idea, what is going on? How to explain?

unit-range.sm (4 KiB) downloaded 38 time(s).
unit-range.sm (4 KiB) downloaded 38 time(s).
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#2 Posted: 2/25/2019 4:07:55 PM
#3 Posted: 2/25/2019 4:17:36 PM
vectorize also works independently of previous values of x. It is just the above example of implicit loops. I am not searching for alternatives but want to have robust implicit loops. They contribute to readable documents. Closer to pencil and paper handcalc than to algorithmic pseudocode.
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 users liked this post
frapuano 2/25/2019 4:35:00 PM
#5 Posted: 2/25/2019 4:46:43 PM
Wrotewhen you assign 1m to x, it doesn't accept to be vectorized with range function afterwards.
making x a vector firstly, the problem is gone.
my diagnosis is; data type error. similar to C++, Basic, etc
regards
Sorry, but the problem is that the presence or absence of the unit in the existing value of x should not matter regardless what you are going to assign to x afterwards.
The failing implicit loop doesn't have any units involved, I would expect the loop to cleanly overwrite whatever pre-existing scalar value. I am well aware that pre-existing matrix values may proagate to the result if the dimensions are bigger than what is adressed in the loop.
Also, if there is some problem which can't be fixed, I'd vote for a better error message. In the given case, "Cannot calculate" will leave most users in frustration and dispair.
BTW, the first statement in your example just crushes the vectorize() function. It doesn't affect the actual value of y.
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#7 Posted: 2/25/2019 6:59:58 PM
#8 Posted: 2/25/2019 8:04:02 PM
#9 Posted: 2/26/2019 7:27:45 AM
Thank you we'll check it. I agree that the behavior should be the same regardless if there is an unit.
There's no indexing in your LHS; the syntax you were looking for is the following:

This is because implicit assignment loops by vectors are available since SMath Studio 0.99.6638, in previous versions it's invalid syntax.
WroteHi. THis also fails too.
There's no indexing in your LHS; the syntax you were looking for is the following:
Wrote"can not calculate" because "syntax error"
"can not calculate" also appears in 6179 and 5346 resulting from more than a single "syntax error"
This is because implicit assignment loops by vectors are available since SMath Studio 0.99.6638, in previous versions it's invalid syntax.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
3 users liked this post
sergio 2/26/2019 8:35:00 AM, Radovan Omorjan 2/26/2019 9:11:00 AM, Alvaro Diaz Falconi 2/26/2019 5:33:00 PM
#10 Posted: 2/26/2019 10:17:03 AM
WroteThis is because implicit assignment loops by vectors are available since SMath Studio 0.99.6638, in previous versions it's invalid syntax.
Yes Davide, missing for local implicit previous 6638.
It turns red some of Ber7 & Alvaro stuff.
For the essentials, I don't miss local implicit loop.
Cheers ... Jean
#11 Posted: 2/26/2019 5:35:38 PM
Wrote
WroteHi. THis also fails too.
There's no indexing in your LHS; the syntax you were looking for is the following:
...
Oh, yes, thanks. That's correct.
Best regards.
Alvaro.
1 Pages (11 items)
-
New Posts
-
No New Posts