Problem 897. Finite Continued Fraction
Given an input real number x and a natural number n, output the row vector with the n first terms of the continued fraction. For more details, you could find help here: http://en.wikipedia.org/wiki/Continued_fraction
Example:
Inputs: x=pi; n = 10;
Output: y = [3 7 15 1 292 1 1 1 2 1];
Solution Stats
Problem Comments
-
1 Comment
The result for pi is not really correct after the 13th term--we do not have enough decimal places to go that far. If we use the same method, though, we will generate the same noise.
Solution Comments
Show commentsProblem Recent Solvers35
Suggested Problems
-
Maximum running product for a string of numbers
2142 Solvers
-
Find perfect placement of non-rotating dominoes (easier)
350 Solvers
-
"Low : High - Low : High - Turn around " -- Create a subindices vector
531 Solvers
-
Put two time series onto the same time basis
321 Solvers
-
Volume of a sphere given its surface area
144 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!