# Defining a function which takes recursively a list as input

I have a function which takes as an input a list. I would like to iterate this but I have been having trouble getting it to work. In particular, I don't think Nest has issues on the second iterate. I have worked out some examples by iterating by hand in the following way:

• Beginning with an initial list, I apply two functions to the list to find all the points I need.

• Applying Join to this I obtain another list of points. I can then repeat the above with this new list.

I would like to avoid doing this by hand so that I can compute things efficiently.

I would therefore like something like the following

x[n_] := list1 /; n = 0
x[n_] := Join[ liftp[x[n - 1]], liftm[x[n - 1]]] /; n > 0


where

c0=-1;
f0[z_] := z^2 + c0;
fr[z1_, z2_] := z /. FindRoot[f0[z] == z2, {z, z1}];
liftp[path1_] := Drop[FoldList[fr[#1, #2] &, 1, path1], 1];
liftm[path1_] := Drop[FoldList[fr[#1, #2] &, -1, path1], 1];


Is there a way to obtain such a closed form in this recursive way?

Thanks

• This question suffers from the same problem as the last one: it is unclear what you are trying to achieve. Could you please tell us about the problem you are trying to solve, rather than your current solution? We may be able to help better. May 5, 2020 at 15:47
• @MarcoB, the problem I am trying to solve is given the Julia set of a quadratic polynomial, starting with some equipotential of large radius (approximated by a circle) I would like to be able to draw to preimages of this under our map. I'm not sure if this is too enlightening, however. This is just finding lifts of the initial circle.
– math
May 5, 2020 at 15:57

I think you should write x[0] = list1 instead of x[n_] := list1 /; n = 0
Another detail about Condition: When using a Condition /;, you must use a test. In your statement you write n = 0 which is an assignment. Use n == 0 instead.
• Also for the second line of the definition of x, write x[n_Integer/;n>0] := Join[ liftp[x[n - 1]], liftm[x[n - 1]]] instead. May 6, 2020 at 6:07