Skip to content
Snippets Groups Projects
Commit 15da3437 authored by Tobias Winkler's avatar Tobias Winkler
Browse files

cancel common factors in mass(), fix invariante in trivialIID test

parent 83488363
No related branches found
No related tags found
No related merge requests found
......@@ -123,6 +123,11 @@ namespace prodigy {
ex Dist::mass() const {
ex res{_gf};
/* TODO
* normal() cancels common factors, this is needed since we are going to substitute stuff to avoid div by 0
* encapsulate this somehow because substitution occurs elsewhere too
*/
res = res.normal();
for (const auto &v : _vars) {
res = res.subs(v.second == 1);
}
......@@ -310,7 +315,7 @@ namespace prodigy {
registerAsVar(symbol(x));
}
// first marginalize x away in *this
ex res = _gf.subs(_vars[x] == 1);
ex res = _gf.normal().subs(_vars[x] == 1);
// ySubs will be gf of y with (single) var replaced by x
// do this by simply substituting all known vars for x
// currently, gathering the symbols that actually occur in y is not implemented
......
......@@ -223,7 +223,7 @@ TEST(EquivalenceCheck, trivialIID){
cout << "l0:\t" << l0 << endl;
l1 = l0.filterGreater("n", "0");
cout << "l1:\t" << l1 << endl;
l2 = l1.updateIid("tmp", Dist {"1/6 * T * (T^5 - 1) / (T - 1)"}, "n");
l2 = l1.updateIid("tmp", Dist {"1/6 * T * (T^6 - 1) / (T - 1)"}, "n");
cout << "l2:\t" << l2 << endl;
l3 = l2.update("m", "m+tmp");
cout << "l3:\t" << l3 << endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment