isuruf on master
Adding a Correct Path to the St… Update CONTRIBUTING.md Co-auth… Merge pull request #1947 from D… (compare)
r1 = add(add(real_double(0.), x), y);
std::cout << *r1 << std::endl;
r1 = expand(add(add(real_double(0.), x), y));
std::cout << *r1 << std::endl;
r1 = expand(add(x, mul(real_double(4.), y)));
std::cout << *r1 << std::endl;
r1 = expand(add(x, mul(real_double(4.), add(y, z))));
std::cout << *r1 << std::endl;
r1 = expand(add(x, mul(integer(4), add(y, z))));
std::cout << *r1 << std::endl;
r1 = expand(mul(real_double(4.), add(y, z)));
std::cout << *r1 << std::endl;
r1 = expand(mul(integer(4), add(y, z)));
std::cout << *r1 << std::endl;
x + y
x + y
x + 4.0*y
0.0 + x + 4.0*y + 4.0*z
x + 4*y + 4*z
0.0 + 4.0*y + 4.0*z
4*y + 4*z
Add
and if the coefficient is 0.0
, remove it
0
for expand(4.0*(x + y - (x+y)))
is totally fine
@isuruf Hi Isuru, long time no see! Was wondering if the following behavior is expected. Thanks!! (master
, ed7479baf59a36636061acc35b676bcf9073a932
)
int main() {
RCP<const Basic> a = symbol("a"), b = symbol("b"), c = symbol("c");
map_basic_basic d {{mul(a,b), c}};
RCP<const Basic> r1 = mul(SymEngine::integer(2), mul(a, b)),
r2 = add(SymEngine::integer(1), r1);
std::cout << *r1 << " -> " << *r1->subs(d) << std::endl;
std::cout << *r2 << " -> " << *r2->subs(d) << std::endl;
return 0;
}
produces
2*a*b -> 2*a*b
1 + 2*a*b -> 1 + 2*c
2*a*b*c -> 2*a*b*c
1 + 2*a*b*c -> 1+2*a*b*c
The new as_ctypes API enables some really nice solver accuracy improvements for us downstream
What's the difference between this and the cython one?