Computer Science, asked by ravisoren5808, 3 months ago

Write a program in java to compute the cosine of x . The user should supply x and a positive integer n. We compute the cosine of x using the series and the computation should use all terms involving x^n. cos^x=1-x^2/2!+x^4/4!-x^6/6!​

Answers

Answered by katukurimeeravali786
0

Explanation:

Program for sum of cos(x) series

Given n and b, where n is the number of terms in the series and b is the value of the angle in degree.

Program to calculate the sum of cosine series of x and compare the value with the library function’s output.

Formula Used :

cos x = 1 – (x2 / 2 !) + (x4 / 4 !) – (x6 / 6 !) +…

Examples :

Input : n = 3 x = 90 Output : Sum of the cosine series is = -0.23 The value using library function is = -0.000204 Input : n = 4 x = 45 Output : Sum of the cosine series is = 0.71 The value using library function is = 0.707035

Similar questions