Suppose I have two functions $f,g$ given by
f[path1_] := Drop[FoldList[fr[#1, #2] &, 1, path1], 1]
g[path1_] := Drop[FoldList[fr[#1, #2] &, -1, path1], 1]
with
fr[z1_, z2_] := z /. FindRoot[f0[z] == z2, {z, z1}]
and f0[z_] := z^2 + c0
with c0=-1
taking as input a list list1 = Table[4E^(j*I*Pi/256), {j, 0, 512}]
.
Is there a way to write a function say x[n_]
which gives all possible n-fold compositions of these two functions?
So x[2]
would give the list {f[f[list1]], f[g[list1]], g[f[list1]], g[g[list1]]}
Could I then build some labeling of these? Suppose I wanted each composition to be labelled by the string of functions that built it e.g. for the f[g[g[list1]]]
it would be labelled by $ggf$. Could I somehow also have a function that takes as input x[2]
and gives the list {ff,fg,gf,gg}
so as to keep track of the order of the output of x[n]
?
I have been thinking about this for a while but it seems like a difficult code to write, although I do not have strong programming skills.
#[list1] & /@ Composition @@@ Tuples[{f, g}, 2]
$\endgroup$FindRoot
. What is the definition of yourfr
? $\endgroup$f0
? $\endgroup$