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