That's just because Gianluca didn't add replacement rules for r3
and r4
. You could easily add those.
You might actually get more flexibility with a template:
equationTemplate =
TemplateExpression[((TemplateSlot[
"valke"]) ((TemplateSlot["convertC"])*2*
TemplateSlot[
"r5"]/((TemplateSlot["r3"]) + (TemplateSlot["r4"]))))*((1/
Sqrt[(TemplateSlot["r3"]) + (TemplateSlot["r4"])])) ==
TemplateSlot["answer"]]
Then you apply the template:
TemplateApply[equationTemplate, <|"valke" -> valke, "r3" -> r3,
"r4" -> r4, "r5" -> r5, "convertC" -> convertC,
"answer" -> answerP21|>, InsertionFunction -> HoldForm]
With this approach, you decouple your values from your format. For example, if you don't like the look of 0.25 m^2 + 0.25 m^2
and would like those to automatically combine, you could change your template thus:
equationTemplate =
TemplateExpression[((TemplateSlot[
"valke"]) ((TemplateSlot["convertC"])*2*
TemplateSlot["r5"]/(TemplateSlot["r3+r4"])))*((1/
Sqrt[TemplateSlot["r3+r4"]])) == TemplateSlot["answer"]]
and then add another rule in your application:
TemplateApply[equationTemplate, <|"valke" -> valke, "r3" -> r3,
"r4" -> r4, "r5" -> r5, "convertC" -> convertC,
"answer" -> answerP21, "r3+r4" -> r3 + r4|>,
InsertionFunction -> HoldForm]