Question
USING JAVA and Java.util.scanner, and one main class only In calculus, Taylor's theorem gives an approximation a function around a specific value. For example: the
USING JAVA and Java.util.scanner, and one main class only
In calculus, Taylor's theorem gives an approximation a function around a specific value. For example: the Taylors approximation of the function 1 1+x for very small values of x (x close to zero) is given by the following summation:
1/(1+x) is approx. 1 - x + x^2 -x^3 + x^4 ... ... + (-1)^n *x^n
Write a program that will ask the user to enter the value of n and displays the correct answer of 1/1+x and the corresponding Taylors approximation for x=0.05 and x=5. (note how the Taylor approximation is not correct for x=5 because x is not small)
Sample run1: Enter the value of n: 1 For x=0.05: the correct value of 1/(1+x) is :0.9523809523809523, and Taylor approximation is :0.95 For x=5.0: the correct value of 1/(1+x) is :0.16666666666666666, and Taylor approximation is :-4.0 Sample run2: Enter the value of n: 6 For x=0.05: the correct value of 1/(1+x) is :0.9523809523809523, and Taylor approximation is :0.9523809531249998 For x=5.0: the correct value of 1/(1+x) is :0.16666666666666666, and Taylor approximation is :13021.0
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