# Question:why this difference in evaluation when using named variables?

## Question:why this difference in evaluation when using named variables?

Maple 2021

Without trying it or looking down more, should these two code fragments give same output or not

# CASE 1

restart;
A   :=   2;
B   :=   x+2*y;
t^2 * ( A * B );

#CASE 2
restart;
t^2*( 2 * (x+2*y)  );


One would expect both to give same output, right? CASE 1 just uses variables and CASE 2 just uses the values of these variables. I mean the semantics of CASE 1 and 2 are the same, given that Maple replaces each variable with its value when evaluating.

But Maple does not give same result.

One way to force same result when using variables is to use t^2*(eval(A*B));

My question is why CASE 1 gives different result from CASE 2?  I would have expected same output.

Maple 2021.2 on windows 10. Worksheet.

 > interface(version);

 > restart;
 > A:=2; B:=x+2*y; t^2*(A*B);

 > restart;
 > t^2*(2*(x+2*y));

 > restart;
 > A:=2; B:=x+2*y; t^2*(eval(A*B));

 >