Maclaurin series are a type of Mathematic series expansion in which all terms are nonnegative real powers of the variable. The Maclaurin series expansion for sin(x) is given by the following formula that is valid for all real values of x such that x is in radians (Note that: radians(x) = xx n/180): sin(x) : = x - 3! 5! Implement a Java program to compute the value of Maclaurin series expansion for sin(x) where x is a nonnegative real value according to the following:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question

introduction to java

Maclaurin series are a type of Mathematic series expansion in which all terms are nonnegative real
powers of the variable. The Maclaurin series expansion for sin(x) is given by the following formula
that is valid for all real values ofx such that x is in radians (Note that: radians(x) = x x 7/180):
sin(x)
...
3!
5!
Implement a Java program to compute the value of Maclaurin series expansion for sin(x) where x is a
nonnegative real value according to the following:
a. Write a java method named Factorial that takes as an argument an integer valuen and
returns the mathematical factorial n! of n as a long value such that:
n! = n x (n – 1) x (n – 2) x ... x 2 x 1
b. In the main method:
Ask the user to enter the value of the angle x to be calculate in the Maclaurin series
expansion for sin(x) as given above. x Should be entered in degrees, i.e., 0° < x <
360° and then converted into radians using the formula: (radians(x) = x x T/180).
ii.
i.
Ask the user to enter the number of terms to be calculated in the Maclaurin series
expansion for sin(x).
ii.
Print the calculated sum of the first n number of terms to be calculated in the Maclaurin
series expansion for sin(x) rounded to 6 decimal places.
iv.
calculated in the Maclaurin series expansion for sin(x) and the value using
Math. sin(x) rounded to 6 decimal places.
Print the difference between the calculated sum of the first n number of terms to be
Sample run:
Enter an angle in degrees: 30
Enter number of terms of maclaurin series: 5
Sum of first 5 terms
of Maclaurin sries of sin (30) is 0.500000.
Math.sin (5) is 0.500000.
Math.sin (30) - Maclaurin
series = 0.000000.
Transcribed Image Text:Maclaurin series are a type of Mathematic series expansion in which all terms are nonnegative real powers of the variable. The Maclaurin series expansion for sin(x) is given by the following formula that is valid for all real values ofx such that x is in radians (Note that: radians(x) = x x 7/180): sin(x) ... 3! 5! Implement a Java program to compute the value of Maclaurin series expansion for sin(x) where x is a nonnegative real value according to the following: a. Write a java method named Factorial that takes as an argument an integer valuen and returns the mathematical factorial n! of n as a long value such that: n! = n x (n – 1) x (n – 2) x ... x 2 x 1 b. In the main method: Ask the user to enter the value of the angle x to be calculate in the Maclaurin series expansion for sin(x) as given above. x Should be entered in degrees, i.e., 0° < x < 360° and then converted into radians using the formula: (radians(x) = x x T/180). ii. i. Ask the user to enter the number of terms to be calculated in the Maclaurin series expansion for sin(x). ii. Print the calculated sum of the first n number of terms to be calculated in the Maclaurin series expansion for sin(x) rounded to 6 decimal places. iv. calculated in the Maclaurin series expansion for sin(x) and the value using Math. sin(x) rounded to 6 decimal places. Print the difference between the calculated sum of the first n number of terms to be Sample run: Enter an angle in degrees: 30 Enter number of terms of maclaurin series: 5 Sum of first 5 terms of Maclaurin sries of sin (30) is 0.500000. Math.sin (5) is 0.500000. Math.sin (30) - Maclaurin series = 0.000000.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education