Question: Isolating a minus sign

I've got a very complicated integral, generated by Maple (15), of the form:

Z:=a*Int(f(x),x=0..1);

I need to do some manipulations on the integrand.  So, I perform the following:

f(x)=GetIntegrand(Z);

f1:=perform operations on f(x)...etc

Z1:=a*Int(f1,x=0..1);

The trouble arises because sometimes Maple writes Z as shown above, and sometimes it writes it as:

Z:=-a*Int(-f(x),x=0..1);

and you can run the program twice in a row and you will get either form, randomly. So, sometimes Z1 will be wrong by a minus sign because you can't predict whether the minus sign is going to be embedded or not.

I've been complaining about this Maple property for years, to deaf ears within MapleSoft who insist it is not an issue, and it has been the subject of long discussions on this site that go nowhere.

So, the question becomes - how do I reliably extract the expression "a" from the expression for "Z" and how do I test whether it has a minus sign embedded within it, or explicitly showing.

This can drive you crazy if you are trying to do a calculation or write a program that always works.

Please Wait...