Problem 42647. Recursion - Fun
Generate the first k terms in the sequence a(n) define recursively by
a(n+1)=p*a(n)+(1+a(n)) with p=0.9 and a(1)=0.5
Test Case
n = 2;
a = [a(1) a(2)] = [0.5000 1.9500]
Solution Stats
Problem Comments
-
6 Comments
Show
3 older comments
goc3
on 29 Sep 2020
Tolerance has been added to the test suite, in addition to removing a problematic case.
Ramon Villamangca
on 7 Mar 2023
Unrecognized function or variable 'tolerance'.
Dyuman Joshi
on 7 Mar 2023
I have updated the test suite to manually check the tolerance.
I find it weird that the way Grant defined tolerance as a variable and
used it for individual test cases works fine for some solutions but doesn't for other solutions. And this particular error has occurred on other problems as well.
Solution Comments
Show commentsProblem Recent Solvers40
Suggested Problems
-
Swap the first and last columns
21015 Solvers
-
423 Solvers
-
Given a window, how many subsets of a vector sum positive
857 Solvers
-
474 Solvers
-
7342 Solvers
More from this Author3
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!