These are chat archives for symengine/symengine

16th
Mar 2018
Gary Tan
@tgn3000
Mar 16 2018 08:23
I was going down recursively for a Basic object P. I managed to modify those "leafs" that are Numbers or RealDoubles. After modifications, how can I force SymEngine to rebuild P so that I get the re-evaluated P? For example, P = (0.4+x)(0.8+y)(i1+z), and I wish to double those Numbers and get (0.8+x)(1.6+y)(i2+z). Thanks!
Isuru Fernando
@isuruf
Mar 16 2018 13:07
class MyVisitor: : public BaseVisitor<MyVisitor, TransformVisitor>
{
using TransformVisitor::bvisit;
using TransformVisitor::result_;
void bvisit (const Number &x){
    result_ = mul(integer(2), x);
}
}
Gary Tan
@tgn3000
Mar 16 2018 13:09
thanks, will study how to use it
Isuru Fernando
@isuruf
Mar 16 2018 13:09
v = MyVisitor();
result = v.apply(expr);
Changed the code above
Gary Tan
@tgn3000
Mar 16 2018 13:23
cool, thx