Showing substitutions in a formula

Showing substitutions in a formula - Messages

#21 Posted: 5/30/2024 1:54:34 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote

I’m confused because on your original Evals() function everything was input into the Evals() function. ...



With some cheats: all variables must to be undefined and units are input as undefined global variables ~N instead true SMath units 'N. For that units appear in bold black but not in bold blue. Also, decimal numbers are converted into symbolic global variables.

Mathcad block gives the chance to use only standard SMath expressions.

Best regards.
Alvaro.

#22 Posted: 5/31/2024 9:28:17 PM
⚜ Kenny Lemens, P.E. ᵂᴵ

⚜ Kenny Lemens, P.E. ᵂᴵ

74 likes in 164 posts.

Group: User

Greetings!

For what it is worth, here is my attempt at the problem at hand:
SMath_2024-05-31.jpg


These equations only require the use of Davide's "Custom Functions"; you can download the sheet here:
EquationsWithSymbolicSubstitution.sm (84 KiB) downloaded 56 time(s).


In order for this to work:
  • Customized units: the symbolic results are not true units; else there were issues with simplifying to base units
  • Abuse of unique 'units' properties: Units will cheat numbers tighter together, and will not use the multiplication symbol: giving a cleaner look. However, they will display as blue...
  • Reliance on Strings: Without passing certain units/variables through as a string, I would have no control to reference the numbers/units/variables at hand. SMath likes to simplify to base units, and substitute variables for contents. This creates a hassle for input, but once configured: should be hassle free.
  • Assumption that nobody really uses Absolute Variables (the ~ Bold Black Variables): I use these variables as alias: being assumed undefined, I can work with them as math, and then just substitute the actual variable at the proper time (use of 「~a」 to be replaced with 「a」 as/if desired. This could have been accomplished through a 'string', but the benefit of working with math objects was too great to ignore.
  • Grouping Hack: At the end of the day, Symbolic will attempt to group terms together and report numbers as fractions. Thus, I utilize the "function" feature, thus having math in an undefined function that cannot evaluate: thus remains ungrouped in what appears to be parenthesis. I use a "UNIT of NONBRACKING-SPACE CHARACTER as the UNDEFINED function name (ie., '\FEFF\() )
  • Heavy use of special Unicode characters: Terms like "=" and ":" have special meaning that cannot be avoided. My only recourse was to use characters that look like "=" in order to produce aesthetically appealing results (e.g.,"꞊꞊"; "꞉"; "⚌" ). It is through the trick of a period like character that the numbers can appear to be a decimal within the Symbolic Evaluation environment.


I will admit, this will not be perfect as error handling is lacking, you will notice some multiplication symbols bleed through (as the 'result' is just a GIANT multiplication statement of variables, Functions, units, and numbers). The absolute variables must be undefined to work as expected, and some terms like lele() will unravel to its core SMath definition (e.g., lele(~1,~2,~3) =-> (~2≤~1)&(~1≤~3) ). I will also note that it does not like multiple units (like 'ft*'in); it really can only handle (1) unit: thus you may need to create a custom unit to serve the desired effect.


May this be of Good Help;
⚜ 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
1 users liked this post
Alvaro Diaz Falconi 6/1/2024 12:06:00 AM
#23 Posted: 5/31/2024 10:43:02 PM
Wesly Centerwall

Wesly Centerwall

26 likes in 156 posts.

Group: User

Wrote



With some cheats: all variables must to be undefined and units are input as undefined global variables ~N instead true SMath units 'N. For that units appear in bold black but not in bold blue. Also, decimal numbers are converted into symbolic global variables.

Mathcad block gives the chance to use only standard SMath expressions.

Best regards.
Alvaro.



So, there is no feasible way to produce something like this?

2024-05-31 11_34_35-SMath Solver - [Evals v3.sm_].png

If that is the case, at the very least we should be able to do this:
Maybe we just have the formula and "unit" part in a separate MathCAD block so that it can be hidden?

2024-05-31 11_42_51-SMath Solver - [Evals v3.sm_].png
#24 Posted: 5/31/2024 10:45:19 PM
Wesly Centerwall

Wesly Centerwall

26 likes in 156 posts.

Group: User

Wrote

Greetings!

For what it is worth, here is my attempt at the problem at hand:

May this be of Good Help;
⚜ Kenny Lemens, P.E. ᵂᴵ



Well, this is definitely a unique approach, thanks for the input.
#25 Posted: 6/1/2024 12:06:00 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote

One more thing that I noticed when testing. Seems like the MathCAD blocks don't like subscripts on variables. ...



Hi. Mathcad block must to cover all the equations regions. The subscript enlarge the region. Just enlarge the Mathcad block a little bit.

pa.png

Best regards.
Alvaro.
#26 Posted: 6/1/2024 12:08:34 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote

Greetings! For what it is worth, here is my attempt at the problem at hand ...



Hi Great approach.

Best regards.
Alvaro.
#27 Posted: 6/6/2024 12:25:39 AM
Wesly Centerwall

Wesly Centerwall

26 likes in 156 posts.

Group: User

Alvaro,

What did you think about the idea of variables in one region and the formula and output unit in another?
Seems like an easy way to hide the second region and have a cleaner end result. Do you think that’s feasible?

Thanks,
#28 Posted: 6/6/2024 11:04:33 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote

Alvaro,

What did you think about the idea of variables in one region and the formula and output unit in another?
Seems like an easy way to hide the second region and have a cleaner end result. Do you think that’s feasible?
Thanks,



Hi. Yes, it's a very good idea. This is a way about how to implement that.

eval.png

eval2.png

EvalSF.sm (185 KiB) downloaded 51 time(s).

Best regards.
Alvaro.
#29 Posted: 6/27/2024 10:08:18 AM
Wesly Centerwall

Wesly Centerwall

26 likes in 156 posts.

Group: User

Hey Alvaro, any way to do this like you did with V3 only showing the initial substitution without showing extra steps?
#30 Posted: 6/30/2024 5:32:41 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote

Hey Alvaro, any way to do this like you did with V3 only showing the initial substitution without showing extra steps?



Hi. Yes. You can delete the undesirable elements at the end of the function:

ans1.png

Editing:

ans2.png

Result:

ans3.png

Best regards.
Alvaro.
#31 Posted: 9/2/2024 10:43:01 PM
Wesly Centerwall

Wesly Centerwall

26 likes in 156 posts.

Group: User

Hey Alvaro,

Is there any way to replace the "≈" symbols in the results to be other symbols?
I think a regular equals sign or U2550 "═" could be used for the first one since it is just showing the formula. Then perhaps arrows (→) to the substitution part and the result part.
Was trying to replace these within the function, but it messes it all up. Seems like it can't be done as in some earlier versions of the function.
Thanks,
#32 Posted: 9/3/2024 7:56:44 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote

Hey Alvaro,

Is there any way to replace the "≈" symbols in the results to be other symbols?
I think a regular equals sign or U2550 "═" could be used for the first one since it is just showing the formula. Then perhaps arrows (→) to the substitution part and the result part.
Was trying to replace these within the function, but it messes it all up. Seems like it can't be done as in some earlier versions of the function.
Thanks,



Hi. Yes, but it's not trivial replacing ≈ by SMath equals ≡ because it returns zero after evaluation. This is a workaround.

EvalSF with arrow.sm (188 KiB) downloaded 42 time(s).

fig.png

fig.png

Best regards.
Alvaro.
  • New Posts New Posts
  • No New Posts No New Posts