1 страниц (6 вхождений)
Is it my or SMath error? - Сообщения
#1 Опубликовано: 28.04.2023 02:09:26
x:= 20 y(x):= x^2= Is it my or SMath error?
See please the attach (with WaterSteamPro - but no problem - you can use CoolProp here too)
5-18-DeltaP-Error.sm (27 КиБ) скачан 33 раз(а).
Thanks!
See please the attach (with WaterSteamPro - but no problem - you can use CoolProp here too)
5-18-DeltaP-Error.sm (27 КиБ) скачан 33 раз(а).
Thanks!
#2 Опубликовано: 28.04.2023 09:57:46
Sorry Valery, I don't understand your formulation.
Cheers ... Jean.
Lamda.sm (147 КиБ) скачан 25 раз(а).
Cheers ... Jean.
Lamda.sm (147 КиБ) скачан 25 раз(а).
#3 Опубликовано: 28.04.2023 13:47:33
Having all of the math in one line makes this difficult to read. I think you have:
x:=20
y(x):=x^2=
The problem with the second line is that you can't do an in-line evaluation of a function. This is because the x in the function is local to the function and thus the function doesn't know about the previous definition of x. (BTW, I don't have SM on my work computer, so I tested this using Mathcad Prime 5.0. I am pretty sure both programs handle this the same way.)
The way to handle your math as written is this way:
x:=20
y(x):=x^2
y(x)=400
However, I think it's far better to use generic variables in a function (e.g., x) and specific variables for the definition (e.g. x1). So, I would rewrite your formulation this way:
x1:=20
y(x):=x^2
y(x1)=400
This approach makes is much easier to read and debug worksheets.
x:=20
y(x):=x^2=
The problem with the second line is that you can't do an in-line evaluation of a function. This is because the x in the function is local to the function and thus the function doesn't know about the previous definition of x. (BTW, I don't have SM on my work computer, so I tested this using Mathcad Prime 5.0. I am pretty sure both programs handle this the same way.)
The way to handle your math as written is this way:
x:=20
y(x):=x^2
y(x)=400
However, I think it's far better to use generic variables in a function (e.g., x) and specific variables for the definition (e.g. x1). So, I would rewrite your formulation this way:
x1:=20
y(x):=x^2
y(x1)=400
This approach makes is much easier to read and debug worksheets.
#4 Опубликовано: 28.04.2023 14:22:58
WroteHaving all of the math in one line makes this difficult to read.
Agreed. MCD line 'if' was largely used as convenient single 'if'
Two pages Smath 'if' is lot more difficult than two cols 'if'.
#5 Опубликовано: 28.04.2023 15:06:24
#6 Опубликовано: 28.04.2023 15:50:53
WroteHowever,some Smath project(s) accept only 'if/else'
Here is an example.
Cheers ... Jean.
if_else_otherwise.sm (37 КиБ) скачан 26 раз(а).
1 страниц (6 вхождений)
-
Новые сообщения
-
Нет новых сообщений