# Why does Series give two different results for given function?

I want to do Series of this function x^12 Cos[y x]^2 Sin[y x]^6 Sin[(-1 + Sqrt[3]) y x]^2 around {z, 0, 2} where x -> (((1 + Sqrt[3]) m π)/(2 y) + z). When I do it in general, Mathematica gives the following result which is Indeterminate.

Series[(x^12 Cos[y x]^2 Sin[y x]^6 Sin[(-1 + Sqrt[3]) y x]^2 ) /.
x -> (((1 + Sqrt[3]) m π)/(2 y) + z), {z, 0, 2}] //
FullSimplify[#, Assumptions -> m ∈ Integers] &

(* FullSimplify::infd: Expression 2 (-1+Sqrt[3]) y Cos[1/2 (-1+Sqrt[3]) (1+Sqrt[3]) m π] ((3 (1+Sqrt[3])^12 m^12 π^12 Cos[1/2 Plus[<<2>>] m π]^3 Sin[1/2 Plus[<<2>>] m π]^5)/(2048 y^11)+Sin[1/2 Plus[<<2>>] m π]^6 ((3 Plus[<<2>>]^11 m^11 π^11 Cos[<<1>>]^2)/(512 y^11)-(Plus[<<2>>]^12 m^12 π^12 Cos[Times[<<4>>]] Sin[Times[<<4>>]])/(2048 y^11))) Sin[1/2 (-1+Sqrt[3]) (1+Sqrt[3]) m π]+<<1>>+((-1+Sqrt[3])^2 (<<1>>)^12 <<3>> <<1>>^6 (Cos[1/2 <<3>> π]^2-Sin[<<1>>]^2))/(4096 y^10)
simplified to Indeterminate. *)
(* Indeterminate z^2+O[z]^3 *)


But when I write my function as a product of two functions x^12 and  Cos[y x]^2 Sin[y x]^6 Sin[(-1 + Sqrt[3]) y x]^2 and then do the Series separately for each of them, I see that the result is not Indeterminate.

{Series[(x^12) /. x -> (((1 + Sqrt[3]) m π)/(2 y) + z), {z, 0, 2}] //
FullSimplify[#, Assumptions -> m ∈ Integers] & ,
Series[(Cos[y x]^2 Sin[y x]^6 Sin[(-1 + Sqrt[3]) y x]^2 ) /.
x -> (((1 + Sqrt[3]) m π)/(2 y) + z), {z, 0, 2}] //
FullSimplify[#, Assumptions -> m ∈ Integers] &}

(* {((1+Sqrt[3])^12 m^12 π^12)/(4096 y^12)+(3 (1+Sqrt[3])^11 m^11 π^11 z)/(512 y^11)+(33 (1+Sqrt[3])^10 m^10 π^10 z^2)/(512 y^10)+O[z]^3,-1/2 ((-2+Sqrt[3]) y^2 Sin[Sqrt[3] m π]^2 Sin[1/2 (1+Sqrt[3]) m π]^4) z^2+O[z]^3} *)


Where am I going wrong and why are the two results different?

## 1 Answer

\$Version

(* "13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)" *)

Clear["Global*"]

expr = x^12 Cos[y x]^2 Sin[y x]^6 Sin[(-1 + Sqrt[3]) y x]^2;

repl = x -> (((1 + Sqrt[3]) m π)/(2 y) + z);


Since Series also accepts the option Assumptions, use an Assuming construct so that the assumptions are available to Series as well as to FullSimplify

method1 = Assuming[m ∈ Integers, Series[expr /. repl, {z, 0, 2}] //
FullSimplify]


method2 = Assuming[m ∈ Integers, Series[expr[[1]] /. repl, {z, 0, 2}]*
Series[Rest[expr] /. repl, {z, 0, 2}] // FullSimplify]


The two methods produce identical results

method1 === method2

(* True *)
`