1页(10条)
Inline division - 消息
WroteIs there any way to present division on the same line and not as a fraction ?
Maths Infix DIVIDE.sm (4.18 KiB)已下载 1281 次。
1位用户喜欢此帖子
sergio 2021/12/16 09:19:00
Greetings!
It is possible to combine Davide's and Jean's solutions, but you need to pull off a few tricks:
1) Create a custom function with (1) parameter
2) Use the special inline division character 「÷」
3) Declare your custom function as a 'unit' (this suppress the multiplication operation from displaying)
To create the custom function with the inline division character, copy and paste the following into your SMath Worksheet:
To utilize it, type in your numerator and multiply it by the custom function, where you pass the denominator into the function as the parameter.
EXAMPLE: solving for 6/2; copy and paste the following (NOTE: since I am declaring the custom function as a unit; you must include ' when calling the custom function):
-Kenny Lemens, P.E.
Wrote...division on the same line...
It is possible to combine Davide's and Jean's solutions, but you need to pull off a few tricks:
1) Create a custom function with (1) parameter
2) Use the special inline division character 「÷」
3) Declare your custom function as a 'unit' (this suppress the multiplication operation from displaying)
To create the custom function with the inline division character, copy and paste the following into your SMath Worksheet:
'÷(_denom):1/_denom
To utilize it, type in your numerator and multiply it by the custom function, where you pass the denominator into the function as the parameter.
EXAMPLE: solving for 6/2; copy and paste the following (NOTE: since I am declaring the custom function as a unit; you must include ' when calling the custom function):
6*'÷(2)=#@#
-Kenny Lemens, P.E.
"No matter where you go, there you are." -Buckaroo BanzaiHotkeys: https://en.smath.com/forum/resource.ashx?a=45771&b=2
3位用户喜欢此帖子
Greetings,
If you just need the statement to be on the same line and you want to avoid the use of exponents and custom functions, there is a native solution:
Use the function str2num(▮) and type your statement as a string:

You do have the ability to reference variables, but the use of whitespace (tab, space, newline, etc.) will corrupt the string and str2num(▮) will throw an error.
Thus this statement will work:
str2num("(2+22)/4")=6
But this statement will throw a 'not defined' error:
str2num("(2 + 22) / 4")=▮
Its a good day to be alive;
-Kenny Lemens, P.E.
If you just need the statement to be on the same line and you want to avoid the use of exponents and custom functions, there is a native solution:
Use the function str2num(▮) and type your statement as a string:

You do have the ability to reference variables, but the use of whitespace (tab, space, newline, etc.) will corrupt the string and str2num(▮) will throw an error.
Thus this statement will work:
str2num("(2+22)/4")=6
But this statement will throw a 'not defined' error:
str2num("(2 + 22) / 4")=▮
Its a good day to be alive;
-Kenny Lemens, P.E.
"No matter where you go, there you are." -Buckaroo BanzaiHotkeys: https://en.smath.com/forum/resource.ashx?a=45771&b=2
In addition to Kenny you can remove white spaces.
Furthermore, you can define a nameless function with Ctrl+Shift+K.
It won't show a function before it, though it is a function.
By that your statement shall look as a "normal" calculation.
Regards
str2num.sm (2.62 KiB)已下载 1295 次。

Furthermore, you can define a nameless function with Ctrl+Shift+K.
It won't show a function before it, though it is a function.
By that your statement shall look as a "normal" calculation.
Regards
str2num.sm (2.62 KiB)已下载 1295 次。

WroteIs there any way to present division on the same line and not as a fraction ?
Answer is NO, Smath does not have native ÷ operator
More productive from infix algo style utilities,
for infinite in-situ command line.
infix Divide.sm (3.5 KiB)已下载 1319 次。
Answer is YES, there are multiple ways demonstrated above. Choose what suits you most.
1位用户喜欢此帖子
⚜ Kenny Lemens, P.E. ᵂᴵ 2024/6/6 03:24:00
1页(10条)
- 有新帖
- 无新帖

![2021-12-16 15_10_51-SMath Solver - [Worksheet1_].png](/zh-Hans-CN/files/Download/hkwKcN/2021-12-16-15_10_51-SMath-Solver---[Worksheet1_].png)