Hey there! Sign in to join this conversationNew here? Join for free
    • Thread Starter
    Offline

    2
    ReputationRep:
    I need perform the following iteration using R. Can anyone shed some light on this please?
    x(n)=cos(x(n-1)) going from x(0)=0 to x(20)
    Thank you in advance!
    Offline

    18
    ReputationRep:
    Try using an array and a for loop, set the first index of the array to 0, then run the for loop 19 times (1-20) and set the index of the current loop counter in the array equal to cos(previous array element here)

    Hope this sheds some light!
    Posted on the TSR App. Download from Apple or Google Play
 
 
 
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • Poll
    Will you be richer or poorer than your parents?
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

    Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

    Quick reply
    Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.