Correct Coefficient of Variables - mkraska/meclib GitHub Wiki
text: checksign(expr, var, refsign, text)
This procedure is meant for analytical expressions expr
where you want to check if the coefficient for some variable var
is correct. An example is the sign of forces in an equllibrium condition. The method consists in testing the derivative of expr
with respect to var
. If it is zero, then the variable probably is missing. Then the response is
Are you sure that var
doesn't matter here?
If the derivative times the expected sign refsign
(1 or -1) is negative, then the response is
Are you sure that var
text
If nothing is wrong, then all result items are empty and no text is displayed.
Question variables
checksign(%_expr, %_var, %_refsign, %_text):=block(
if is(diff(%_expr, %_var)=0) then return (sconcat("<br>Sind Sie sicher, dass \\( ", string(%_var), " \\) hier keine Rolle spielt?")),
if is(diff(%_refsign*%_expr, %_var)<0) then return (sconcat("<br>Sind Sie sicher, dass \\( ", string(%_var), "\\)",%_text)) ,
"" /* The default return value if nothing is wrong. */
);
PRT
Feedback variable:
text: checksign(S_SumDx, F_3, -1, " nach rechts zieht?");
any branch of the tree where you want to place the feedback (use the first test by default):
{@text@}