0
$\begingroup$

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

$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$
    – MarcoB
    May 5, 2020 at 15:47
  • $\begingroup$ @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. $\endgroup$
    – math
    May 5, 2020 at 15:57

1 Answer 1

3
$\begingroup$

I'm sorry i don't have enough reputation to add a comment. One things you may look at:

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.

$\endgroup$
2
  • $\begingroup$ Thank you for this, I managed to get it working, I need to use {n==0} and that seemed to work! Thanks! $\endgroup$
    – math
    May 5, 2020 at 19:14
  • $\begingroup$ 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. $\endgroup$
    – youyou
    May 6, 2020 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.