find shared constant in two expressions



On 2012-09-07, nijso beishuizen <nijso at hotmail.com> wrote:

> so even though xlog(x)*g(y) is separated correctly into xlog(x) and
> g(y), it introduces the constant 4*log^2(2).
> Is there a simple way to find out if two expressions have a shared
> constant factor so I can eliminate the constant C?

I don't know a general solution, but maybe the function 'optimize' can
help.

  e:4*log(2)^2;
  L:[f(x)/e, e*g(y)];
  optimize (L);
   => block([%1],%1:log(2)^2,[f(x)/(4*%1),4*%1*g(y)])

In this example, optimize found log(2)^2 as a common factor, but not
4*log(2)^2. I don't know if that's enough.

best

Robert Dodier