Open jcschaff opened 2 years ago
@moraru I've written up an approach for making ExpressionUtil.functionallyEquivalent() smarter ... and added the VCell-7.5.0 label ... but it will likely be put in place after the release (didn't want this issue to get lost).
Also, recently Ion added code to discriminate between 0.0 and very small expressions (to fix some problems when the expressions are very small). This should be carefully revisited in the future by augmenting our existing testing in ExpressionFlattenTest
, MathMLTester
, or ExpressionTest
by scaling the randomly generated expressions by large and small factors and compare with 0.0 or adding epsilon ... to probe the strength/weakness of this algorithm
@jcschaff can we close this?
@moraru @ACowan0105 @CodeByDrescher this is not immediately critical, but this issue was created to document a known weakness of one of the algorithms which is used to compare for mathematical equivalence of simulations (for invalidating simulation results in vcell), and also used in symbolically validating sbml/sedml export/import operations.
I'll move it to the next release for now.
Background
Expressions with discontinuities pose a difficult problem for numerical testing of expression equivalence.
for example exp1 = 3 a^2/(b-c) ((t >200)(t<200.01)) + ab exp2 = 2 a^2/(b-c) ((t >200)(t<200.01)) + ab will appear to be identical numerically unless exercised near t=200.0.
current behavior is to:
Thoughts toward a better solution (not completely worked out)
to make sure for each term f1(), f2(), g() in expressions like f1(a,b,c,t)*(g(a,b,c,t)<0)+f2(a,b,c,t) are well tested.
replace each equivalent inequality in both expressions with a well scaled variable and test as usual (f1(a,b,c,t)*(A<0)+f2(a,b,c,t)) and scan over a,b,c,t,A.
so for: exp1 = 3 a^2/(b-c) ((t >200)(t<300.01)) + ab exp2 = 2 a^2/(b-c) ((200 < t)(t<200.01)) + ab
we replace original discontinuities with those that will sample very well (t >200) and (200<t) with (A>0) (t<300.01) with (B>0) (t<200.01) with (C>0)
This approach may be incomplete, or even incorrect ... more time to think.