SOLUTION: I am working with recursive functions. I do not understand the examples given in the book.
Example 1 is evaluating a recursive function. Use the following defintion to find the
Algebra ->
Sequences-and-series
-> SOLUTION: I am working with recursive functions. I do not understand the examples given in the book.
Example 1 is evaluating a recursive function. Use the following defintion to find the
Log On
Question 67665This question is from textbook
: I am working with recursive functions. I do not understand the examples given in the book.
Example 1 is evaluating a recursive function. Use the following defintion to find the value of f(4).
f(1)=3 and f(n)= f(n-1) + n
solution:
f(1)=3
f(2)= f(1)+2=3+2=5 This is where I get lost.
f(3)=f(2)+3=5+3=8
f(4)=f(3)+4=8+4=12
I understand factorals but this I do not understand. Also is there a website that would guide me slower through the recursive functions?
Thank you
Kate This question is from textbook
You can put this solution on YOUR website! Use the following defintion to find the value of f(4).
f(1)=3 and
f(n)= f(n-1) + n
You are given a starting point f(1)=3
You are given a rule for generating the next number in the sequence:
f(n) means any number of the sequence.
f(n-1) means the number just before the one you are generating
or the last one you generated.
n is the number of the sequence you are generating.
solution:
f(1)=3
-------------
f(2)= f(1)+2 because f(1) comes just before f(2)
then you add 2 because that is the number of sequence element.
Since you were told f(1)=3, that is the 1st term below.
=3+2
=5
---------------
Now you go through the same process to generate f(3)
f(3)=f(2)+3
=5+3
=8
---------------
f(4)=f(3)+4
=8+4
=12
---------
Do you see that f(5)would be f(4)+5
=12+5
=17
---------
Do you see that this process could go on forever?
That's what makes it recursive.
-----------
Cheers,
Stan H.