Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Composition Functions Mathematica

  1. Oct 13, 2009 #1
    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++,
    f[x_] := 5x(-x+1)

    what am i doing wrong?
  2. jcsd
  3. Oct 13, 2009 #2


    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.
  4. Oct 13, 2009 #3
    It's going to keep iterating and eventually converge to a number.
  5. Oct 14, 2009 #4


    User Avatar
    Gold Member

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

    are you trying to do the Limit of f[x]^n (to the nth power?)
  6. Oct 14, 2009 #5


    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
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook