# Iteration of multiple functions that feed into each other

I'm trying to figure out how to iterate through several functions that all "feed" into one-another but am having some trouble. Here are the variables:

r={1,2,3}
r={3,4,5}
G=1
M=2
dt=20
r1 = N[Sqrt[r.r]];
r2 = N[Sqrt[r.r]];
TA = N[ArcCos[r.r/(r1 r2)]]
A = Sqrt[r1 r2 (1 + Cos[TA])]


And here are the functions:

S[z_] := N[(Sqrt[z] - Sin[Sqrt[z]])/Sqrt[z^3]]
c[z_] := N[(1 - Cos[Sqrt[z]])/z]
y[z_] := r1 + r2 - (A (1 - S[z] z))/Sqrt[c[z]]
x[z_] := Sqrt[y[z]/c[z]]
t[z_] := (x[z]^3 S[z] + A Sqrt[y[z]])/Sqrt[G M]
F[z_] := (y[z]/c[z])^(3/2) S[z] + A Sqrt[y[z]] - Sqrt[G M] t[z]
dF[z_] := (y[z]/c[z])^(3/2) (1/(2 z) (c[z] - 3/2 S[z]/c[z]) + 3/4 S[z]^2/c[z]) + (A/8) ((3 S[z] Sqrt[y[z]])/c[z] + A Sqrt[c[z]/y[z]])


and I'm trying to iteratively do the following

z[i + 1] := z[i] - F[z[i]]/dF[z[i]]


I tried using FixedPointList, but the Mathematica help files confused me more than anything once they got past the most basic examples (my knowledge of Mathematica's syntax is quite limited). I'd love it if someone would be able to help. I was extremely tempted to just do it in excel as it would be a lot simpler for me, but I feel like it should be done in Mathematica.

EDIT: I've since given up trying to use FixedPointList and have decided to switch to a more intuitive While loop (I know using Whiles are frowned upon, but I like them as they allow one to break the logic down step-by-step). I've also switched from using Newton's method to a bisection method. Here is my code so far, but currently it isn't giving me any output at all (a reference to the loop algorithm is given by http://ccar.colorado.edu/~rla/documents/lambert.pdf near the end of the document):

G = 6.672*10^-11
m = 1.988544*10^30
dt = 254*86400
R = {6.6072*10^10, 1.31631*10^11, -3.64831*10^6}
R = {-1.30112*10^11, -1.90008*10^11, -7.90975*10^8}
R1 = 1.47283*10^11
R2 = 2.30289*10^11
TA = 2 Pi - N[ArcCos[R.R/(R1 R2)]];
A = Sqrt[R1 R2 (1 + Cos[TA])];
z = 0
zhi = 4 Pi^2
zlow = -4 Pi
c[z_] := 1/2
S[z_] := 1/6
While[Norm[t[z] - dt] > 1*10^-6,
y[z_] := R1 + R2 + (A (S[z] z - 1))/Sqrt[c[z]];
Print[y[z]];
While[A > 0 && y[z] < 0, zlow = zlow + 1];
X[z_] := Sqrt[y[z]/c[z]];
t[z_] := (X[z]^3 S[z] + A Sqrt[y[z]])/Sqrt[G m];
If[t[z] <= dt, zlow = z, zhi = z];
z = (zhi + zlow)/2;
If[z > 1*10^-6, c[z_] := (1 - Cos[Sqrt[z]])/z;
S[z_] := (Sqrt[z] - Sin[Sqrt[z]])/Sqrt[z^3],
If[z < -1*10^-6, c[z_] := (1 - Cosh[Sqrt[-z]])/z;
S[z_] := (Sinh[Sqrt[-z]] - Sqrt[z])/Sqrt[(-z)^3], c[z_] := 1/2;
S[z_] := 1/6]];
Print[Norm[t[z] - dt]];]


Any help would be greatly appreciated. Thank you guys.

• I suggest you include a short sample of your desired output to make sure we answer the right question. Also, have you seen Fold? It may be applicable. – Mr.Wizard Jan 29 '14 at 16:43
• You seem to have some errors in this code. I suspect x[z_] := Sqrt[y/c] should have been x[z_] := Sqrt[y[z]/c[z]] for example; please correct those. – Mr.Wizard Jan 29 '14 at 16:48
• What happened when You tried using FixedPointList? To use FixedPoint and FixedPointList You need a starting expression, so what would it be for Your function z? – Wojciech Jan 29 '14 at 16:50
• @Mr.Wizard after correcting those errors and stating a start point for the recursion I get a constant function :( – Dr. belisarius Jan 29 '14 at 16:54
• I recommend you write a single function T[{S_, c_, y_, x_, t_, F_}]] and iterate a few times starting from a list of length 6 using NestList first. As others have observed, there are some questionable points in your function definitions, so I'm hesitant to jump in myself. – Mark McClure Jan 29 '14 at 16:57