Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

7 Pages«<567
Options
Go to last post Go to first unread
Offline Davide Carpi  
#121 Posted : 24 May 2021 22:18:17(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,392
Man
Italy
Location: Italy

Was thanked: 1195 time(s) in 787 post(s)
Fixed, plugin updated.
If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
thanks 2 users thanked Davide Carpi for this useful post.
on 24/05/2021(UTC),  on 25/05/2021(UTC)
Offline MarB  
#122 Posted : 31 May 2021 10:17:38(UTC)
MarB


Rank: Advanced Member

Groups: Registered
Joined: 21/10/2016(UTC)
Posts: 71

Was thanked: 14 time(s) in 13 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?

mat2sys1.png

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).

mat2sys1a.png

Maybe the better question is: Is this behaviour of str2num intended?

Edited by user 31 May 2021 11:11:55(UTC)  | Reason: correction

Offline Jean Giraud  
#123 Posted : 31 May 2021 17:02:37(UTC)
Jean Giraud


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 5,494
Canada

Was thanked: 846 time(s) in 676 post(s)
Originally Posted by: MarB Go to Quoted Post
Is that really the intended behaviour?

There are miscellaneous applications, mostly Fourier stuff.

Fourier Geometric Coplanar COMPLEX.sm (18kb) downloaded 9 time(s).

Offline Jean Giraud  
#124 Posted : 31 May 2021 17:20:27(UTC)
Jean Giraud


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 5,494
Canada

Was thanked: 846 time(s) in 676 post(s)
... I don't understand the remaining of the demand.

mat2sys.PNG
Offline Jean Giraud  
#125 Posted : 31 May 2021 17:24:14(UTC)
Jean Giraud


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 5,494
Canada

Was thanked: 846 time(s) in 676 post(s)
mat2sys Otherwise.PNG
Offline Davide Carpi  
#126 Posted : 31 May 2021 18:13:07(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,392
Man
Italy
Location: Italy

Was thanked: 1195 time(s) in 787 post(s)
The behaviour is driven by the evaluation of the outer sys(); on numerical evaluation, the "first level" of 1x1 matrices is suppressed.

2021-05-31 17_10_48-SMath Studio - [Documento1_].png

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 please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
thanks 2 users thanked Davide Carpi for this useful post.
on 31/05/2021(UTC),  on 31/05/2021(UTC)
Offline MarB  
#127 Posted : 31 May 2021 19:02:53(UTC)
MarB


Rank: Advanced Member

Groups: Registered
Joined: 21/10/2016(UTC)
Posts: 71

Was thanked: 14 time(s) in 13 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.

matrix.png
Offline MarB  
#128 Posted : 09 June 2021 15:49:05(UTC)
MarB


Rank: Advanced Member

Groups: Registered
Joined: 21/10/2016(UTC)
Posts: 71

Was thanked: 14 time(s) in 13 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"
cases_continue.png

Edited by user 09 June 2021 16:08:25(UTC)  | Reason: screenshot replaced

Offline MarB  
#129 Posted : 15 June 2021 08:40:15(UTC)
MarB


Rank: Advanced Member

Groups: Registered
Joined: 21/10/2016(UTC)
Posts: 71

Was thanked: 14 time(s) in 13 post(s)
Originally Posted by: MarB Go to Quoted Post



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.
Offline overlord  
#130 Posted : 15 June 2021 09:19:03(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 406
Turkey

Was thanked: 109 time(s) in 81 post(s)
Originally Posted by: MarB Go to Quoted Post
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.

2021-06-15_09-18.png
Offline Davide Carpi  
#131 Posted : 15 June 2021 09:46:04(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,392
Man
Italy
Location: Italy

Was thanked: 1195 time(s) in 787 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 please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
Offline Davide Carpi  
#132 Posted : 15 June 2021 09:55:31(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,392
Man
Italy
Location: Italy

Was thanked: 1195 time(s) in 787 post(s)
Originally Posted by: MarB Go to Quoted Post

Sorry for pulling this to the surface.

Nothing to be afraid, is in the best interests of anyone having things to work flawlessly Good

Originally Posted by: overlord Go to Quoted Post
Confirmed, with a strange behavior.
Reversing the cases makes it correct.

Interesting, nice catch .

If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
Offline Jean Giraud  
#133 Posted : 15 June 2021 13:56:43(UTC)
Jean Giraud


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 5,494
Canada

Was thanked: 846 time(s) in 676 post(s)
AlgoSum.PNG
Offline Davide Carpi  
#134 Posted : 19 June 2021 14:12:37(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,392
Man
Italy
Location: Italy

Was thanked: 1195 time(s) in 787 post(s)
PLUGIN UPDATED SMath Studio 0.99.7822 and later Beta

  • image2rgb/image2rgba: implemented different algorithm for linux users;
  • image2rgb/image2rgba fixed exception on failed disposal of temporary files;



If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
Offline overlord  
#135 Posted : 19 July 2021 21:38:47(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 406
Turkey

Was thanked: 109 time(s) in 81 post(s)
cases() refuse to be vectorized if it is a function.

2021-07-19_21-36.png
Offline MarB  
#136 Posted : 19 July 2021 22:13:54(UTC)
MarB


Rank: Advanced Member

Groups: Registered
Joined: 21/10/2016(UTC)
Posts: 71

Was thanked: 14 time(s) in 13 post(s)
Sometimes a line at the right place helps a lot.

And hovering the mouse over an expression helps finding the glitch.
if.png
Offline overlord  
#137 Posted : 20 July 2021 00:02:45(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 406
Turkey

Was thanked: 109 time(s) in 81 post(s)
Originally Posted by: MarB Go to Quoted Post
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
Users browsing this topic
Similar Topics
[Custom Functions plugin] cases SS6179 (Bugs & Problems)
by PompelmoTell 07/02/2017 19:14:23(UTC)
7 Pages«<567
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.