Showing Substitutions - Optimized Manual Method - Сообщения
The goal is to show the values of the variables in an equation as they are shown in their last definition.
Only a display as a means to simplify the checking and review of "hand calculations". (We all know how annoying it is to dig back and find the values for all the variables used in an equation...)
What I have done is create a simple snippet (SubstitutionTemplate) that can be saved in the snippet manager folder (user/AppData/Local/Programs/SMath Studio/snippets) or wherever you have your snippet folder...
When working on a calculation, you define variables as you normally do.
Then you go to the snippet manager and select the snippet you added (Substitution Template) and insert it (uncheck inset inside area).
This snippet is just a few formula regions inside a text region, so everything looks nice.
Highlight v# and replace it with the variable you wish to define.
Highlight eq# and write the formula that defines the variable.
Highlight eqs# and write the formula again, but this time manually input the values of the variables with units, so it looks nice and neat.
Lastly, highlight vr# and type the variable you are defining, and press "=", then right click over the variable and deselect "Display Input Data"
The final result looks like this:
The variable is assigned the value the same way as a standard calculation (because it is just a regular calculation inside a text region), you can change the display unit if you want.
The only thing snippet does is optimize the manual work.
Yes, it is annoying to manually type in the values and units you want to display as substitutions, but this is not more work than any other solution.
It would be amazing if someone could come up with a way to automate this substitution on the basis of the equation and the defined variables used in that equation.
As far as I can see, this sort of thing requires coding changes within SMath and will not be possible with the tools available now.
So, in the meantime, this is the best we have.
Substitution Example.sm (7 КиБ) скачан 90 раз(а).
SubstitutionTemplate.sm (3 КиБ) скачан 97 раз(а).
We can do so
c:=a+b=4
where
a=1
b=3
etc
No woman or colored!
For engineers, this feature is the most requested of SMath and MathCAD.
As good as SMath is, or even MathCAD, people still check calculations, not only for arithmetic error, but for logical mistakes.
The Mathcad block seems to be able to pave the way. In the screenshot below, the variable eq contains all information which is required to display the expression for c as expression and with substituted values.
Plus, it shows a proof of concept, how to build a string for display in a table region (a formatted label also works).
All the definitions are actually active and can be used as usual, without restrictions and without typing anything twice.
- Create a function, which takes the name of the variable whose calculation is to be documented for manual check, possibly in string form if the verbatime name is spoiled by preprocessing.
- The function borrows the sheet scanning capability from Mathcad region (this is a possible show stopper, I am not sure if this works)
- This function creates a string for display in a formatted label, containing everything wb.c was asking for
- Put the function call in the formatted label and switch off border and input data.
That should be pretty close to your dreams.
Here is a version with a table region.
WroteSo the essential feature for displaying substituted values in definitions is the access to the verbatim definition of that values without simplification before storage.
The Mathcad block seems to be able to pave the way. In the screenshot below, the variable eq contains all information which is required to display the expression for c as expression and with substituted values.
Plus, it shows a proof of concept, how to build a string for display in a table region (a formatted label also works).
All the definitions are actually active and can be used as usual, without restrictions and without typing anything twice.
This seems to only work with nice round numbers. num2str(1) seems to force the output in exact form.
WroteSo I think it is quite obvious you don’t work in the engineering world...
I have been involved in similar disputes many times. My last argument was this: show me an example where the use of this technique allowed us to identify an error.
It is enough to write like this
a:=b+c=5
where
b=1 and c=4
But not for some verification - for some illustration
Wrote
This seems to only work with nice round numbers. num2str(1) seems to force the output in exact form.
The information on the original units and the original precision is still there and can be extracted from the string. It is not as easy as in the integer case but it is possible to implement in a display function.
There is another problem: num2str() fails to convert expressions like K:3*l=0.0096*'m@# (a definition with integrated display and default unit).
Note that this doesn't happen if the display unit has been specified explicitly.
Possible mitigation:
- fix num2str() to handle this case.
- if a variable to be substituted isn't found in the list of successfully converted expressions from eq, then use it's value from the context. This doesn't harm as using the default unit will be just right.
I don't say that writing the display function is trivial. Yet the fundamental problem of loosing input information upon storage in the context isn't a show stopper any more.
WroteWroteSo I think it is quite obvious you don’t work in the engineering world...
I have been involved in similar disputes many times. My last argument was this: show me an example where the use of this technique allowed us to identify an error.
It is enough to write like this
a:=b+c=5
where
b=1 and c=4
But not for some verification - for some illustration
In the case of unitless integer quantities this is straightforward. Yet if you want or have to document the substituted values using their original precision and unit, you have to specify unit and display precision manually
BTW I wonder what the check reader expects for intermediate result. Does he expect to substitute such values as displayed (possibly with rounding) in subsequent calculations?
That would enforce accumulation of round-off errors. Displaying rounded values in the substitution and actually using the full mantissa would be sort of inconsistent though, because the proof reader might come to a different result if evaluating the equation with the displayed substitutions.
WroteNo woman or colored!
Funny part is, routine repetitive figuring was mostly done by women.
Not just for defense, it is known civilian companies accounts were calculated by women also.
I speak for American part of course, don't know Soviet aspect.
https://www.history.com/news/human-computers-women-at-nasa
Wrote
BTW I wonder what the check reader expects for intermediate result. Does he expect to substitute such values as displayed (possibly with rounding) in subsequent calculations?
I honestly don’t think rounding errors are typically an issue with most engineering calculations. This is for engineering calcs, not a math PhD proving a theorem.
-
Новые сообщения
-
Нет новых сообщений