[GiNaC-list] arithmetic error on concat two expressions

Alexei Sheplyakov alexei.sheplyakov at gmail.com
Fri Aug 6 17:53:25 CEST 2010


On Fri, Aug 06, 2010 at 01:26:29PM +0200, Kraus Philipp wrote:

> That's nice, but not my thinking, because the expressions are
> std::string data, that can be set by a user, so I can't use your
> example.

Correct. But you don't need to parse "(t - formula)^2/2", instead you
can construct the expression directly:

symbol t("t");
ex l_full = pow(t - m_expression, 2)/2;

> The Problem is, that my formula a*x^3 + b*y^4 (*) not correct
> substitute into the other formula:

What makes you think so? As far as I understand (t - a*x^3 - b*y^4)^2
is the same as (a*x^3 + b*y^4 - t)^2

Best regards,

More information about the GiNaC-list mailing list