Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,652 Location: Italy Was thanked: 1339 time(s) in 878 post(s)
|
|
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
2 users thanked Davide Carpi for this useful post.
|
on 24/05/2021(UTC), on 25/05/2021(UTC)
|
|
Rank: Advanced Member Groups: Registered
Joined: 21/10/2016(UTC) Posts: 84
Was thanked: 21 time(s) in 17 post(s)
|
The function mat2sys.1 affects also the inner matrix, if evaluated numerically AND if this inner matrix contains only element. Is that really the intended behaviour? I wanted to build my own mat2sys.1 using num2str, ... replace mat with sys... str2num Looks like str2num is the "culprit", at least in my own function (only while evaluating numerically). Maybe the better question is: Is this behaviour of str2num intended? Edited by user 31 May 2021 11:11:55(UTC)
| Reason: correction
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: MarB Is that really the intended behaviour?
There are miscellaneous applications, mostly Fourier stuff. Fourier Geometric Coplanar COMPLEX.sm (18kb) downloaded 13 time(s).
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
... I don't understand the remaining of the demand.
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,652 Location: Italy Was thanked: 1339 time(s) in 878 post(s)
|
The behaviour is driven by the evaluation of the outer sys(); on numerical evaluation, the "first level" of 1x1 matrices is suppressed. I'm not sure if it is really intended, but it might be part of the special behaviours of sys() (have to check the code/ask Andrey). Edited by user 31 May 2021 18:14:50(UTC)
| Reason: Not specified |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
2 users thanked Davide Carpi for this useful post.
|
on 31/05/2021(UTC), on 31/05/2021(UTC)
|
|
Rank: Advanced Member Groups: Registered
Joined: 21/10/2016(UTC) Posts: 84
Was thanked: 21 time(s) in 17 post(s)
|
By now I think it's the general behaviour (intended or not), that 1×1 matrices are evaluated to its element (numeric). That's why I use Gettype() to check if an element was found.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 21/10/2016(UTC) Posts: 84
Was thanked: 21 time(s) in 17 post(s)
|
Found a bug in cases in combination with for loops and continue: Two identical loops. If if(,,) is used, continue causes the rest to be skipped (as expected). If cases(,,) is used, continue has no effect appVersion(4)="0.99.7822.147" Edited by user 09 June 2021 16:08:25(UTC)
| Reason: screenshot replaced
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 21/10/2016(UTC) Posts: 84
Was thanked: 21 time(s) in 17 post(s)
|
Originally Posted by: MarB
Sorry for pulling this to the surface. I am wondering if I am the only one, who's using continue/break in a similar way. At the moment I replace every cases with if(s), when used in combination with for loops and continue/break.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,129 Was thanked: 509 time(s) in 339 post(s)
|
Originally Posted by: MarB Found a bug in cases in combination with for loops and continue:
Two identical loops. If if(,,) is used, continue causes the rest to be skipped (as expected). If cases(,,) is used, continue has no effect
appVersion(4)="0.99.7822.147"
Confirmed, with a strange behavior. Reversing the cases makes it correct.
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,652 Location: Italy Was thanked: 1339 time(s) in 878 post(s)
|
At first glance I'm not sure about the cause, I'll check it.
However looking at the screenshot I have to point out once again that in general you shouldn't put definitions inside cases(). Unlike if(), when a condition or a case fails instead of throwing an error the whole function is returned like if doesn't exists. The consequence is that every argument is exposed and preprocessed, with potential unwanted behaviors respect to the expected logic. This is on the edge of SMath possibilities, but is what makes possible to use cases() whereas if() usually fails. |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,652 Location: Italy Was thanked: 1339 time(s) in 878 post(s)
|
Originally Posted by: MarB Sorry for pulling this to the surface.
Nothing to be afraid, is in the best interests of anyone having things to work flawlessly Originally Posted by: overlord Confirmed, with a strange behavior. Reversing the cases makes it correct. Interesting, nice catch . |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,652 Location: Italy Was thanked: 1339 time(s) in 878 post(s)
|
PLUGIN UPDATED SMath Studio 0.99.7822 and later - image2rgb/image2rgba: implemented different algorithm for linux users;
- image2rgb/image2rgba fixed exception on failed disposal of temporary files;
|
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,129 Was thanked: 509 time(s) in 339 post(s)
|
cases() refuse to be vectorized if it is a function.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 21/10/2016(UTC) Posts: 84
Was thanked: 21 time(s) in 17 post(s)
|
Sometimes a line at the right place helps a lot. And hovering the mouse over an expression helps finding the glitch.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,129 Was thanked: 509 time(s) in 339 post(s)
|
Originally Posted by: MarB Sometimes a line at the right place helps a lot.
And hovering the mouse over an expression helps finding the glitch.
Hah, I get it. Mysterious (but necessary according to this) line again. Even though I use smath several years, I still forgot some of its tricks. No need to hover the mouse, lasterror() has the same behavior. Regards
|
|
|
|
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.