Question
The purpose of this lab is to extend some of the concepts on recursion, series, and irrational numbers discussed in class and the text. To
The purpose of this lab is to extend some of the concepts on recursion, series, and irrational numbers discussed in class and the text. To that end, students will implement, in Rust, a program which can calculate: n!, demonstrate for the Fibonacci sequence that fn > (3/2)n-1 for any arbitrary n, and calculate an arbitrary number of digits of . For extra credit, students can add the capability to display any specific digit, or sequence of digits, of . (Example: digit 101, or digits 110 120). Process: Factorial The algorithm for factorial is given in the text. A sample implementation of the function in Rust is provided at https://programming-idioms.org/idiom/31/recursive-factorial-simple/450/rust Links to an external site.. There are also other Rust implementations available. Students may use these or implement their own version. With the algorithm implemented, the student will add the capacity for the user to select a value of n and display the result. Fibonacci sequence The algorithm for the Fibonacci sequence is given in the text. A sample implementation of the function in Rust is provided at https://benjaminbrandt.com/fibonacci-in-rust/ Links to an external site.. There are also other Rust implementations available. Students may use these or implement their own version. With the algorithm implemented, the student will add the capacity for the user to select a value of n and display fn and the value of (3/2)n-1 for that n. Digits of Pi Algorithms for calculating the digits of are available at: https://iq.opengenus.org/different-ways-to-calculate-pi/ Links to an external site., https://en.wikipedia.org/wiki/Gauss%E2%80%93Legendre_algorithm Links to an external site., . In addition, there are implementations available at: https://github.com/Alexnortung/pi-digits Links to an external site.and https://users.rust-lang.org/t/calculating-pi-to-1000-digit/30515 Links to an external site.. There are also other formulas and implementations available. Students may use these or implement their own algorithms. Algorithms may be checked against known values at: https://www.piday.org/million/ Links to an external site., https://www.dcode.fr/pi-digits Links to an external site., or http://www.numberworld.org/digits/Pi/ Links to an external site.. With the algorithm implemented, the student will add the capacity for the user to select the number of digits to calculate. Extra credit The student can alter the program to calculate a specific digit or sequence of digits of pi. A formula is available at: https://math.hmc.edu/funfacts/finding-the-n-th-digit-of-pi/Links to an external site. For all parts The user should be able to repeatedly try different values of n without restarting the program. The user should be able to try the different parts without restarting the program. Note that the biggest challenge with some algorithms will be managing the limitations of the size in which a number is stored. When encountering that issue, document it, and stick to n small enough to avoid the limit. Be sure to be very descriptive in the process section of your report. Submit the code, and the report using the standard format. Note: In this lab, we are permitting the use of code and algorithms developed by others. That is a common industry practice and expectation. There are two challenges to keep in mind. The first is that you need to acknowledge the use of code from others. The second is that you need to study and understand the code sufficiently to apply it correctly in context and circumstances.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started