Custom Functions plugin

Custom Functions plugin - functions: extended Max and Min, Unit of Measurement, Order of Magnitude - Сообщения

#121 Опубликовано: 24.05.2021 16:18:17
Davide Carpi

Davide Carpi

1 434 сообщений из 2 908 понравились пользователям.

Группа: Moderator

Fixed, plugin updated.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
2 пользователям понравился этот пост
Andrey Ivashov 24.05.2021 16:58:00, sergio 25.05.2021 04:06:00
#122 Опубликовано: 31.05.2021 04:17:38
Martin_B

Martin_B

22 сообщений из 84 понравились пользователям.

Группа: User

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?
#123 Опубликовано: 31.05.2021 11:02:37
Jean Giraud

Jean Giraud

983 сообщений из 6 866 понравились пользователям.

Группа: User

Wrote

Is that really the intended behaviour?


There are miscellaneous applications, mostly Fourier stuff.

Fourier Geometric Coplanar COMPLEX.sm (17,78 КиБ) скачан 473 раз(а).

#124 Опубликовано: 31.05.2021 11:20:27
Jean Giraud

Jean Giraud

983 сообщений из 6 866 понравились пользователям.

Группа: User

... I don't understand the remaining of the demand.

mat2sys.PNG
#125 Опубликовано: 31.05.2021 11:24:14
Jean Giraud

Jean Giraud

983 сообщений из 6 866 понравились пользователям.

Группа: User

mat2sys Otherwise.PNG
#126 Опубликовано: 31.05.2021 12:13:07
Davide Carpi

Davide Carpi

1 434 сообщений из 2 908 понравились пользователям.

Группа: Moderator

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).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
2 пользователям понравился этот пост
NDTM Amarasekera 31.05.2021 12:29:00, Martin_B 31.05.2021 12:37:00
#127 Опубликовано: 31.05.2021 13:02:53
Martin_B

Martin_B

22 сообщений из 84 понравились пользователям.

Группа: User

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
#128 Опубликовано: 09.06.2021 09:49:05
Martin_B

Martin_B

22 сообщений из 84 понравились пользователям.

Группа: User

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
#129 Опубликовано: 15.06.2021 02:40:15
Martin_B

Martin_B

22 сообщений из 84 понравились пользователям.

Группа: User

Wrote




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.
#130 Опубликовано: 15.06.2021 03:19:03
overlord

overlord

566 сообщений из 1 343 понравились пользователям.

Группа: Moderator

Wrote

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
#131 Опубликовано: 15.06.2021 03:46:04
Davide Carpi

Davide Carpi

1 434 сообщений из 2 908 понравились пользователям.

Группа: Moderator

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 to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#132 Опубликовано: 15.06.2021 03:55:31
Davide Carpi

Davide Carpi

1 434 сообщений из 2 908 понравились пользователям.

Группа: Moderator

Wrote


Sorry for pulling this to the surface.


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

Wrote

Confirmed, with a strange behavior.
Reversing the cases makes it correct.


Interesting, nice catch .

If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#133 Опубликовано: 15.06.2021 07:56:43
Jean Giraud

Jean Giraud

983 сообщений из 6 866 понравились пользователям.

Группа: User

AlgoSum.PNG
#134 Опубликовано: 19.06.2021 08:12:37
Davide Carpi

Davide Carpi

1 434 сообщений из 2 908 понравились пользователям.

Группа: Moderator

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 please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#135 Опубликовано: 19.07.2021 15:38:47
overlord

overlord

566 сообщений из 1 343 понравились пользователям.

Группа: Moderator

cases() refuse to be vectorized if it is a function.

2021-07-19_21-36.png
#136 Опубликовано: 19.07.2021 16:13:54
Martin_B

Martin_B

22 сообщений из 84 понравились пользователям.

Группа: User

Sometimes a line at the right place helps a lot.

And hovering the mouse over an expression helps finding the glitch.
if.png
1 пользователям понравился этот пост
Oscar Campo 29.08.2025 10:03:24
#137 Опубликовано: 19.07.2021 18:02:45
overlord

overlord

566 сообщений из 1 343 понравились пользователям.

Группа: Moderator

Wrote

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
#138 Опубликовано: 29.08.2025 09:50:08
Martin Kraska

Martin Kraska

1 277 сообщений из 2 201 понравились пользователям.

Группа: Moderator

ClearAll() affects the built-in variable lasterror, depending on the argument provided. Yet, the description doesn't mention any significance of the argument and also promises not to touch pre-defined objects.

image.png
Martin KraskaPre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 пользователям понравился этот пост
Oscar Campo 29.08.2025 10:03:44
#139 Опубликовано: 29.08.2025 12:38:36
Davide Carpi

Davide Carpi

1 434 сообщений из 2 908 понравились пользователям.

Группа: Moderator

Seems lastError is stored in the context, unlike other predefined variables. I'll add an exception.

edit: plugin updated
Отредактировано 29.08.2025 13:56:40
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
2 пользователям понравился этот пост
Martin Kraska 29.08.2025 21:36:21, Oscar Campo 29.08.2025 22:06:18
#140 Опубликовано: 11.09.2025 09:51:54
Martin Kraska

Martin Kraska

1 277 сообщений из 2 201 понравились пользователям.

Группа: Moderator

I think that we would need more brackets here in order to make the scope of the at() or the corresponding operator function visible.

image.png
Отредактировано 11.09.2025 09:55:05
Martin KraskaPre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
  • Новые сообщения
  • Нет новых сообщений