1
$\begingroup$

I realize this may have been asked before, however I have no idea what to search for specifically, since the topic is so generic it returns so many results that I cannot find what I am looking for.

eqn3:=3.9024*x+3.9024*y;

How can I get Maple to output as (3.9024)(x+y) instead of (3.9024)(x)+(3.9024)(y)?

I have tried factor, collect, simplify, etc. I am using Maple 16

$\endgroup$
1
  • $\begingroup$ Having no experience in Maple, all I can guess is that 3.9024 is a float and therefore it may not be equal to itself. $\endgroup$ Jun 16, 2015 at 19:53

1 Answer 1

2
$\begingroup$

Note that automatic simplification distributes numeric coefficients, e.g. if you enter

> expr:= 3.9024*(x+y);

the result will be

$$ expr := 3.9024 x + 3.9024 y $$

To defeat this, one way is to use the `` function.

> E:= map(t -> (t = ``(t)), indets(expr,float)):
> collect(subs(E, expr),``);

$$ (x + y) (3.9024) $$

Unfortunately I don't see how to put the $(3.9024)$ before the $(x+y)$. It thought it would be possible with sort, but I can't seem to find the right options. Well, here's a rather kludgy work-around.

> restart;
  expr:= 3.9024*(x+y);
  E:= map(t -> t = ``(t), indets(expr,float));
  subs(x=w-y,E,expr);
  sort(%,w);
  subs(w=x+y,%);

$$ (3.9024)(x+y) $$

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .