Hey there! Sign in to join this conversationNew here? Join for free
Turn on thread page Beta
    • 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
 
 
 
Poll
“Yanny” or “Laurel”

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

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