# Composition Functions Mathematica

1. Oct 13, 2009

### Nusc

I need to write a loop that iterates several times to find the limit of this function

f(x) = 5x(-x+1) lim f^n(0.75) n->

For[n = 0, n < 5, n++,
x=0.75;
f[x_] := 5x(-x+1)
];
]

what am i doing wrong?

2. Oct 13, 2009

### Staff: Mentor

You probably want to put the definition of f[x_] outside the for loop, but that said I don't understand what you are trying to do. I don't understand how a for loop is going to help you find a limit. You can just use the Limit function.

3. Oct 13, 2009

### Nusc

It's going to keep iterating and eventually converge to a number.

4. Oct 14, 2009

### Hepth

Try to explain what exactly you're trying to do. What does:
f(x) = 5x(-x+1) lim f^n(0.75) n->

mean?
are you trying to do the Limit of f[x]^n (to the nth power?)

5. Oct 14, 2009

### Staff: Mentor

And are you taking the limit as x approaches something or as n approaches something?

Also, how are you iterating? In other words, in an iterative method one estimate is based on the previous estimate. It is not clear at all from your description how you are planning on obtaining one estimate from the previous.

Finally, usually when you are doing an iterative method, you will not iterate a fixed number of times using a For loop. Instead you usually have some convergence criteria that you evaluate at the end of each pass through a While loop. You then exit the While loop when the convergence criteria is met or return an error if it is not met after a certain maximum number of iterations.

Last edited: Oct 14, 2009