Smath Equivalent to MathCAD min() and max()

Smath Equivalent to MathCAD min() and max() - Сообщения

#1 Опубликовано: 13.05.2020 13:14:29
Mike Fuller

Mike Fuller

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

Группа: User

Hello,

Does smath have a built-in function that performs the Mathcad min() and max() ? I see in smath, these function names exist but they are being using for matrix / vector functions. The code in Mathcad is this:

Annotation 2020-05-13 120729.png

Seismic, TL, and Ls, are all numeric variables with units elsewhere in the calculation sheet. min() function description from Mathcad:

Annotation 2020-05-13 122808.png

I could solve this programmatically a couple of different ways, but I wanted to check with the community before writing a work around. Several engineering codes require minimums / maximum values if the calculated requirement falls below the minimum / maximum respectively. This is an example of two such a cases.

Another option is to write my own function and re-use it, I am just not exactly sure how to achieve that.

Thanks for this wonderful product!

Mike
#2 Опубликовано: 13.05.2020 13:33:48
sergio

sergio

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

Группа: User

It seems to me that you answered yourself. min and max can easily be used by organizing elements in vectors. With the Custom Function plugin you can use the shape most similar to the one you want

SMathStudio_Desktop_wdSuuDNBqZ.png

sergio
#3 Опубликовано: 13.05.2020 14:02:56
Mike Fuller

Mike Fuller

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

Группа: User

Hi Sergio,

I appreciate your quick reply. I had developed my workaround before I read your guidance:

Annotation 2020-05-13 125123.png

Cumbersome, but it works. Then I did what you suggested which was just to define my varibles in simple vector form:

Annotation 2020-05-13 125909.png

Much cleaner! I tried pressing the "Thanks" button, but it keeps giving me an error message (using Firefox 76). So, thank you

Mike
#4 Опубликовано: 13.05.2020 19:11:10
Jean Giraud

Jean Giraud

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

Группа: User

advanced feature of Smath min(,)

2D Plot Discontinuous [min(,)].sm (44 КиБ) скачан 86 раз(а).
#5 Опубликовано: 24.11.2020 12:05:29
Apuokas

Apuokas

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

Группа: User

Wrote

It seems to me that you answered yourself. min and max can easily be used by organizing elements in vectors. With the Custom Function plugin you can use the shape most similar to the one you want

SMathStudio_Desktop_wdSuuDNBqZ.png

sergio



Doesn't work for me. Where is a problem?
max.JPG
#6 Опубликовано: 24.11.2020 12:39:32
fedeghi

fedeghi

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

Группа: User

Wrote

Wrote

It seems to me that you answered yourself. min and max can easily be used by organizing elements in vectors. With the Custom Function plugin you can use the shape most similar to the one you want

SMathStudio_Desktop_wdSuuDNBqZ.png

sergio



Doesn't work for me. Where is a problem?
max.JPG



Capital letter on "Max" (not "max").
Of course, you need to install Custom Function plugin first.
#7 Опубликовано: 24.11.2020 12:45:04
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

Wrote

Wrote

It seems to me that you answered yourself. min and max can easily be used by organizing elements in vectors. With the Custom Function plugin you can use the shape most similar to the one you want

SMathStudio_Desktop_wdSuuDNBqZ.png

sergio



Doesn't work for me. Where is a problem?
max.JPG



Hi. Try with eval(max[ ... ]). max() and min(), and some other requires eval for work as usually others in SMath. For numerical procedures, always call them with eval. In any case, for symbolics max and min are not implemented, and probably can't be.

Best regards.
Alvaro.
#8 Опубликовано: 24.11.2020 14:15:17
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

Doesn't work for me. Where is a problem?


For vectors: min or Min ... max or Max.
For scalar function, Golden Ratio.
You have no vector, no function ... therefore no min/max, Min/Max
#9 Опубликовано: 24.11.2020 14:17:48
Jean Giraud

Jean Giraud

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

Группа: User

...
Min-Max.PNG
#10 Опубликовано: 24.11.2020 14:59:25
Jean Giraud

Jean Giraud

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

Группа: User

Min-Max Either.PNG
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений