Write a recursive method to compute the following series: f(n)=1-1/2+1/3-1/4+…+(
ID: 3635202 • Letter: W
Question
Write a recursive method to compute the following series:f(n)=1-1/2+1/3-1/4+…+(-1)^(n+1) *1/n
The recursive formula is: f(n)= f(n-1) + (-1)^(n+1) *1/n
Use the class BigDecimal for representing these elements of the series.
Write a test main method for this series that enumerates all the elements of the series up to the 100th element.
Remember the elements of the series in an array, so that elements are not recomputed.
Note: Remember the elements of the series in an array, so that elements are not recomputed.
Explanation / Answer
This link will help you in solving your question.
http://www.danzig.us/java_class/recursion.html
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.