opensim-core
opensim-core copied to clipboard
Setting exponent to 1 in MocoOutputGoal can return negative values
https://github.com/opensim-org/opensim-core/blob/c6dc2a5913df2cb7e7a72da1ebb162fda9eaa022/OpenSim/Moco/MocoGoal/MocoOutputGoal.cpp#L84
If the exponent is set to 1, the integrand can return negative values. Looks like all other values for the exponent will return positive values.
We can't use the abs()
function here since it is non-smooth (it's fine to use abs()
in the third branch of the if-statement since the resulting value is raised some a power > 1, making it smooth).
We should improve the documentation for setExponent()
to make it clear what happens in each branch of the if-statement.