I want to write the following expression to maple
g:=1/16*(5*x^4-28*x^3+36*x^2)
unfortunately, the output from maple is
g := 5/16*x^4-7/4*x^3+9/4*x^2
so maple has the factor 1/16 multiplicated with the others.
But now, I don’t want maple to do that step automatically, I just want
g:=1/16*(5*x^4-28*x^3+36*x^2).
Question: How can I avoid this?
This is a "feature" in Maple, any pure numerical factors are merged into the expression and cannot be extracted using the factor command. However in your case your expression has algebraic factors and can be written (and saved) as
1/16*x^2*(x2)*(5*x18);
A more general trick is to multiply by a dummy algebraic variable, say K, then put K=1 at some later stage.
If you’re looking for actual functionality, you cannot change this behaviour.
If you’re looking for display only:
> 1/16*``(5*x^428*x^3+36*x^2); 4 3 2 1/16 (5 x 28 x + 36 x )
or
> 1/16 &* (5*x^428*x^3+36*x^2); 4 3 2 1/16 &* (5 x - 28 x + 36 x )
work. In the first case you’re multiplying 1/16 by a function, the name of which is ``
(which
is not printed when displayed) and whose argument is 5*x^4
... .
Otherwise, you can also use ’Standard Math’ or ’Standard Math Input’. For example,
highlight your input and select Format>Convert to>Standard Math
. though this is only
useful for input, not output.
Try this:
> g:=``/16*(5*x^428*x^3+36*x^2); 4 3 2 g := 1/16 (5 x 28 x + 36 x )
To get rid of the invisible name ``
, you can substitute ``=1
.
Automatic distributing `*`
over expressions of type `+`
is a feature of Maple. The only way
out is using the ``()
procedure:
> g:=``(1/16)*(5*x^428*x^3+36*x^2); 4 3 2 g := (1/16) (5 x 28 x + 36 x ) > expand(%); 4 3 2 5/16 x 7/4 x + 9/4 x
However, note that only `expand/`()
is defined. Thus other procedures may not know how
to handle ``()
. You have to first expand expressions containing ``()
I have used the empty name. Thus in your example input
> g:=1/16*``(5*x^428*x^3+36*x^2);
this prints as you want since it contains a function call to ``
in effect. However, to evaluate
it you need to define ``
as the identity function
> ``:=x>x;
Another way is to use
>g:=``/16*(5*x^428*x^3+36*x^2);
which doesn’t evaluate but prints correctly. Evaluation is performed by using
subs(``=1,g) or by ``:=1
However, both I admit are a "cludge".