Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

1
  • $\begingroup$ I gave the solution that you referenced at mathematica.stackexchange.com/questions/16063/… (12 years ago), which ended with the comment "Generalisations of this sort of trick should solve your problem.". You would need prod[u___, x_?(FreeQ[#, prod] &) w_, v___] := x prod[u, w, v] to expand out nested prod expressions such as yours that contain non-numeric coefficients. Actually, to control expression evaluation better, I prefer to use <rule> <pattern> :> <replacement> rather than <pattern> := <replacement>. $\endgroup$ Commented Apr 22, 2024 at 20:01