Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline Razonar  
#1 Posted : 22 February 2023 12:24:11(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
This function can be used to show the intermediate steps in the evaluation of simple formulas.

Evals.png

Evals.pdf (112kb) downloaded 63 time(s).

Evals.sm (48kb) downloaded 68 time(s).

Best regards
Alvaro.
thanks 3 users thanked Razonar for this useful post.
on 22/02/2023(UTC),  on 22/02/2023(UTC),  on 23/02/2023(UTC)

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Kenny Lemens  
#2 Posted : 23 February 2023 00:14:35(UTC)
Kenny Lemens


Rank: Advanced Member

Groups: Registered
Joined: 11/01/2018(UTC)
Posts: 132
Man
United States
Location: Wisconsin

Was thanked: 58 time(s) in 37 post(s)
Greetings,

I just wanted to let people know that the Alvaro's 「Evals()」 function does not work numerically; it only works as a symbolic evaluation (ie., Optimization = ☑ Symbolic). As such, it cannot be used for numerical evaluations down the line.

Regardless of the limitations, I am quite impressed by this bit of handiwork.

- Kenny Lemens, P.E. ᵂᴵ
"No matter where you go, there you are." -Buckaroo Banzai

Hotkeys: https://en.smath.com/for...rce.ashx?a=45771&b=2
thanks 1 user thanked Kenny Lemens for this useful post.
on 23/02/2023(UTC)
Offline Razonar  
#3 Posted : 23 February 2023 01:14:48(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Hi Kenny, thanks. It is absolutely true, I completely forgot that the purpose is necessarily not only to show the calculation, but to use it later. Well, though, at least it's not a 3-order-of-magnitude error, like the one I recently had.

This version saves in the first argument the numerical value of the evaluated formula. The rest of the code and the behavior stays the same.

Evals.png

Evals v2.sm (66kb) downloaded 39 time(s).

Evals v2.pdf (148kb) downloaded 18 time(s).

Best regards.
Alvaro.

Edited by user 23 February 2023 01:19:42(UTC)  | Reason: Not specified

thanks 2 users thanked Razonar for this useful post.
on 23/02/2023(UTC),  on 27/02/2023(UTC)
Offline Razonar  
#4 Posted : 30 March 2023 02:33:24(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Version with uncertainties calculations added.

unc.png

EvalsWithErr.sm (91kb) downloaded 34 time(s).

EvalsWithErr.pdf (216kb) downloaded 13 time(s).

Best regards.
Alvaro.
thanks 2 users thanked Razonar for this useful post.
on 30/03/2023(UTC),  on 05/04/2023(UTC)
Offline wb.c  
#5 Posted : 03 July 2023 21:40:06(UTC)
wb.c


Rank: Advanced Member

Groups: Registered
Joined: 02/04/2018(UTC)
Posts: 135
United States

Was thanked: 22 time(s) in 19 post(s)
Hi Alvaro,

Great work with this.
From an engineering calculation point of view, I think the additional intermediate steps are a little much. When checking a traditional SMath calculation, the biggest complaint is that the reviewer has to always flip back, or look back at the definitions of variables to see what values are being used in the given formula. Makes the checking process a bit tedious.
What has always been missing from SMath was simply showing the substituted values as defined before the final result. (Only one step)
As others have already posted, there are some tricks with optimization, but these quickly fall apart with units other than default units, and decimal values.

Any way to modify your function to do something like this?:
2023-07-03 14_26_52-SMath Solver 1.0.8348 - [Evals v2.sm_].png

The function can of course be hidden in a table for a cleaner look. I also only showed the variable defined as an example. There would be no need to show this result again.
I honestly think the black units in the calculations is great, as it helps separate defined units from calculated units.

Would also be great to use definitions that are outside of the "Evals" function. This way variables can still be defined in one place, and values don't need to be re-entered.
Let me know what you think.
Offline Razonar  
#6 Posted : 04 July 2023 03:17:42(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Hi. This could be a first approach.

Clipboard01.png

EvalsWithErr with modifications.sm (101kb) downloaded 32 time(s).
EvalsWithErr with modifications.pdf (284kb) downloaded 22 time(s).

Best regards.
Alvaro
thanks 1 user thanked Razonar for this useful post.
on 04/07/2023(UTC)
Offline churichuro  
#7 Posted : 04 July 2023 20:56:54(UTC)
churichuro


Rank: Advanced Member

Groups: Registered
Joined: 27/03/2019(UTC)
Posts: 75
Mexico
Location: coah

Was thanked: 27 time(s) in 22 post(s)
awesome!
thanks 1 user thanked churichuro for this useful post.
on 05/07/2023(UTC)
Offline wb.c  
#8 Posted : 06 July 2023 18:37:08(UTC)
wb.c


Rank: Advanced Member

Groups: Registered
Joined: 02/04/2018(UTC)
Posts: 135
United States

Was thanked: 22 time(s) in 19 post(s)
So I honestly think the original input was fine. Defining variables in a mathcad window is a bit annoying.
The only change I think is needed, but seems to be very hard or impossible, it to define the variables, used in the formula, outside of the evals function.
The best I can come up with requires you to define a second time what units are used for each variable used.
2023-07-06 11_25_25-SMath Solver 1.0.8348 - [Evals v2-N.sm_].png
As you can see the variables are defined as any other variable in a calculation sheet and can be used in other formulas.
There is a vector that lists the units for each variable again. This is used to remove the unit when used in the Evals() function.
It seems like there is no way to do this without manually specifying the unit because there is no way to convert the variable exactly as defined into a string, you need to divide out the unit to keep the same numerical value. So there is no way to take the b:=17.3 lb and convert that definition into a string exactly as I show it. It would be nice if this was automatic, but I don't this is possible with how SMath is programed.

A note is that the first step in the substitution seems to reduce the units automatically. It would be nice to just show the initial substitution without any simplification or elimination of units in this first step.

I also changed the way the final unit is shown, so that it matches the blue color of other units.
2023-07-05 19_06_54-SMath Solver 1.0.8348 - [Evals v2-N.sm].png
Since in a table region you can display units in blue using "S:'" before the unit text.

Evals v2-N.sm (29kb) downloaded 9 time(s).
Offline Razonar  
#9 Posted : 06 July 2023 20:39:15(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Originally Posted by: wb.c Go to Quoted Post
... Defining variables in a mathcad window is a bit annoying....


Hi. Yes, it is. But is the only way that I know to 'hold' an expression. Like in Mathematica Hold[x] or maple 'x'. I ask for that function here.

Best regards.
Alvaro.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.