Problem 197. Recurrence relation
A recurrence relation is given by
P(1) := 1 P(n+1) := exp(1) - (n+1)*P(n)
Write a function that, given an integer n, returns P(n). The n will be smaller than 100 in all test-suite problems and an absolute precision of 10*eps (~2e-15, i.e. almost machine precision) is required.
Solution Stats
Problem Comments
-
2 Comments
Franck Dernoncourt
on 31 Jan 2012
Maybe you should specify the required precision in the problem description.
Tomasz
on 31 Jan 2012
OK, I added a sentence, thanks.
Solution Comments
Show commentsProblem Recent Solvers29
Suggested Problems
-
Select every other element of a vector
35898 Solvers
-
11897 Solvers
-
Determine if a Given Number is a Triangle Number
393 Solvers
-
Find the "ordinary" or Euclidean distance between A and Z
176 Solvers
-
Create a vector whose elements depend on the previous element
773 Solvers
More from this Author7
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!