I had a variable defined as expression("2{b}cos(x)").
When b = -2, this produced expression("2-2cos(x)") - the unary negation sign is instead interpreted as a binary minus.
This is because string interpolation uses content subvars instead of JME subvars.
I think the best way to make this work how you expect is to add a special case to jme.substituteTree so that expression(str) is treated differently to just str.
I had a variable defined as
expression("2{b}cos(x)")
.When
b = -2
, this producedexpression("2-2cos(x)")
- the unary negation sign is instead interpreted as a binary minus.This is because string interpolation uses content
subvars
instead of JMEsubvars
.I think the best way to make this work how you expect is to add a special case to
jme.substituteTree
so thatexpression(str)
is treated differently to juststr
.