With Ryacas, one has:
> yac_str("Simplify(2*x^2*4 + x^2*5)")
[1] "13*x^2"
Now, instead of 4 and 5, I would like to give two letters treated as constants. That is, Ryacas does:
> yac_str("Simplify(2*x^2*a + x^2*b)")
[1] "2*x^2*a+x^2*b"
but I would like that it treats x as an unknown variable and a and b as constants, i.e. I would like to get the result:
(2*a+b)*x^2
I spent one hour to try with no luck. Is it possible? Otherwise, with another package?