1 Pages (6 items)
Is it my or SMath error? - Messages
#1 Posted: 4/28/2023 2:09:26 AM
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 KiB) downloaded 32 time(s).
Thanks!
See please the attach (with WaterSteamPro - but no problem - you can use CoolProp here too)
5-18-DeltaP-Error.sm (27 KiB) downloaded 32 time(s).
Thanks!
#2 Posted: 4/28/2023 9:57:46 AM
Sorry Valery, I don't understand your formulation.
Cheers ... Jean.
Lamda.sm (147 KiB) downloaded 24 time(s).
Cheers ... Jean.
Lamda.sm (147 KiB) downloaded 24 time(s).
#3 Posted: 4/28/2023 1:47:33 PM
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 Posted: 4/28/2023 2:22:58 PM
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 Posted: 4/28/2023 3:06:24 PM
#6 Posted: 4/28/2023 3:50:53 PM
WroteHowever,some Smath project(s) accept only 'if/else'
Here is an example.
Cheers ... Jean.
if_else_otherwise.sm (37 KiB) downloaded 24 time(s).
1 Pages (6 items)
-
New Posts
-
No New Posts