# Question:How do I algebraicly expand an expression without manually adding multiplication signs?

## Question:How do I algebraicly expand an expression without manually adding multiplication signs?

Maple 2020

The original question (crossed through below) was too vague, so I tried to clarified it:

I have the following expression
Q(h);
1 /  2                    1                 2    / 3\   1
- |- - f(x) - D(f)(x) h + - @@(D, 2)(f)(x) h  + O\h / + - f(x)
h \  3                    2                             2

1                                        2    / 3\\
+ - f(x) + 2 D(f)(x) h + 2 @@(D, 2)(f)(x) h  + O\h /|
6                                                 /

It doesn't expand this following way...
expand(Q(h));
/                   1                 2    / 3\\
2 |f(x) - D(f)(x) h + - @@(D, 2)(f)(x) h  + O\h /|
\                   2                          /   f(x)
- -------------------------------------------------- + ----
3 h                           2 h

2    / 3\
f(x) + 2 D(f)(x) h + 2 @@(D, 2)(f)(x) h  + O\h /
+ ------------------------------------------------
6 h

But it does expand when I add the multiplication symbols manually:
expand(2*(f(x) - D(f)(x)*h + 1/2*(D@@2)(f)(x)*h^2 + O(h^3))/(3*h) + f(x)/(2*h) + (f(x) + 2*D(f)(x)*h + 2*(D@@2)(f)(x)*h^2 + O(h^3))/(6*h));
/ 3\
4 f(x)   1           2                    5 O\h /
------ - - D(f)(x) + - h @@(D, 2)(f)(x) + -------
3 h     3           3                      6 h

How can I expand my output without having to add the multiplication symbols?

How can I expand the 2D-output without having to manually add multiplication signs? screenshot below for readability.

restart;
a)
Change to correct values:
a := -2;
a := -2

b := 0;
b := 0

c := 3;
c := 3

Q := h -> (alpha[a]*f(x + a*h) + alpha[b]*f(x + b*h) + alpha[c]*f(x + c*h))/h;
Q := proc (h) options operator, arrow, function_assign;

(alpha[a]*f(x+a*h)+alpha[b]*f(x+b*h)+alpha[c]*f(x+c*h))/h

end proc

myfun := (aa, bb, cc) -> subs(alpha[a] = aa, alpha[b] = bb, alpha[c] = cc, Q(h)*h);
myfun := proc (aa, bb, cc) options operator, arrow, function_ass\

ign; subs(alpha[a] = aa, alpha[b] = bb, alpha[c] = cc,

Q(h)*h) end proc

myfun(1, 0, 0);
f(x - 2 h)

f(x - 2*h) := taylor(myfun(1, 0, 0), h = 0, 3);
2    / 3\
f(x - 2 h) := f(x) - 2 D(f)(x) h + 2 @@(D, 2)(f)(x) h  + O\h /

myfun(0, 0, 1);
f(x + 3 h)

f(x + 3*h) := taylor(myfun(0, 0, 1), h = 0, 3);
9                 2    / 3\
f(x + 3 h) := f(x) + 3 D(f)(x) h + - @@(D, 2)(f)(x) h  + O\h /
2

expand(Q(h));
/                                       2    / 3\\
alpha[-2] \f(x) - 2 D(f)(x) h + 2 @@(D, 2)(f)(x) h  + O\h //
------------------------------------------------------------
h

alpha[0] f(x)
+ -------------
h

/                     9                 2    / 3\\
alpha[3] |f(x) + 3 D(f)(x) h + - @@(D, 2)(f)(x) h  + O\h /|
\                     2                          /
+ -----------------------------------------------------------
h

Parse:-ConvertTo1D, "_Inert_PROD structures must have 2 args inside SERIES";
/                                       2    / 3\\
alpha[-2] \f(x) - 2 D(f)(x) h + 2 @@(D, 2)(f)(x) h  + O\h //
------------------------------------------------------------
h

alpha[0] f(x)
+ -------------
h

/                     9                 2    / 3\\
alpha[3] |f(x) + 3 D(f)(x) h + - @@(D, 2)(f)(x) h  + O\h /|
\                     2                          /
+ -----------------------------------------------------------
h

NULL;
#! Add multiplication signs since maple won't:
expand(alpha[-2]*(f(x) - 2*D(f)(x)*h + 2*(D@@2)(f)(x)*h^2 + O(h^3))/h + alpha[0]*f(x)/h + alpha[3]*(f(x) + 3*D(f)(x)*h + 9/2*(D@@2)(f)(x)*h^2 + O(h^3))/h);

﻿