case function order

case function order - Mensajes

#1 Publicado: 12/12/2019 9:41:20
paul lecornu

paul lecornu

0 me gusta en 2 mensajes.

Grupo: User

Hello,

Will the case function evaluate all the potentially true cases in it? There seams to be a feature where as soon as one case is evaluated as true then the output from that case is returned independent on weather following cases rule the first out.

im trying to construct a piecewise flow characteristic for a number of different applications where cases will be true dependant on the input. In certain situations the lower of the possibilities needs to be returned.
Smath case behave example.sm (18,28 KiB) descargado 1237 vez(es).

any thoughts?
#2 Publicado: 12/12/2019 12:37:46
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Wrote

Will the case function evaluate all the potentially true cases in it ?


Just by inspection of your document: answer is NO ... Why ?
1. define completely #≤# ... #≥# piecewise elements.
Smath does not forgive/forget.
2. If not plot ... zap units.
Come back as needed ... Jean.

Smath case behave example.sm (19,24 KiB) descargado 1217 vez(es).

#3 Publicado: 12/12/2019 13:13:00
paul lecornu

paul lecornu

0 me gusta en 2 mensajes.

Grupo: User

Wrote

Smath does not forgive/forget.



Thanks Jean, this I am discovering!

The plots seam to work fine with the units - and its a good sense check for me.
Coming from MCD I was hoping that the case structure would work in the same way as a line form with ifs in (but no elses) and check each case in turn. I'll just have to be more careful about the relative importance / order of the cases.
#4 Publicado: 12/12/2019 16:12:33
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Wrote

Thanks Jean, this I am discovering!

The plots seam to work fine with the units - and its a good sense check for me.
Coming from MCD I was hoping that the case structure would work in the same way as a line form with ifs in (but no elses) and check each case in turn. I'll just have to be more careful about the relative importance / order of the cases.


Smath does not have the single line if MCD ... not yet coded.
Good it works with units.
Bolean is often a good candidate.
In some instances Smath will not complain incomplete <, >.
In other instances [I only know 1 in years], must be incomplete.
Cheers, welcome ... Jean.
#5 Publicado: 12/12/2019 16:53:49
Alvaro

Alvaro

1.139 me gusta en 1.805 mensajes.

Grupo: User

Wrote



The plots seam to work fine with the units - and its a good sense check for me.



Hi. This is a better way for use units, function and plots.

Smath case behave example.sm (20,39 KiB) descargado 1255 vez(es).

Best regards.
Alvaro.
A 1 usuarios les gustó este mensaje
frapuano 12/12/2019 20:29:00
  • Nuevos mensajes
  • Sin mensajes nuevos