2021-10-28 02:27:46 +0200 received badge ● Popular Question (source) 2020-05-10 21:20:08 +0200 commented answer Self composition of a function with symbolic variable Ahh, my mistake was that I was also declaring z as a variable. Why don't I need to do this? Does sage "know" that this is over the complex field? 2020-05-10 21:16:30 +0200 received badge ● Student (source) 2020-05-10 21:16:07 +0200 received badge ● Editor (source) 2020-05-10 21:14:19 +0200 asked a question Self composition of a function with symbolic variable I have a function in one variable with a placeholder variable, and would like to find the nth iterate. For example, using: $f(z) = z^3 + a z^2$, a function in variable $z$ with placeholder coefficient $a$. then I would like to see $f(f(z)) = (z^3 + az^2)^3 + a(z^3 + az^2)^2$ However I am struggling to perform this in Sage. f(f) returns (a*z^2 + z^3)*z^2 + z^3, so it substitutes for $a$ instead of $z$, and declaring f(f(z)) returns the function only in terms of $z$. How can we self compose functions with a placeholder variable for a coefficient?