Home / Expert Answers / Computer Science / beginner-programming-language-c-nbsp-p2-series-and-functions-a-write-a-function-with-the-header-pa455

(Solved): beginner programming language c++  P2-series and functions (a) Write a function with the header ...



beginner programming language c++ 


P2-series and functions
(a) Write a function with the header:
factoria1Func( const unsigned long \( \mathrm{n} \) )
that gets
P2-series and functions (a) Write a function with the header: factoria1Func( const unsigned long \( \mathrm{n} \) ) that gets the positive integer \( n \) and calculates \( n ! \) [5pts]. \[ n !=n^{*}(n-1)^{*}(n-2)^{*}(n-3) \ldots * 3 * 2 * 1 \text {; } \] (b) The trigonometric function \( \sin (x) \) can be approximately calculated using the following formula, where \( n ! \) is factorial( \( n) \) - for example \( 3 !=3^{*} 2^{*} 1=6 \) (the function in previous problem). \[ \sin x=\sum_{n=0}^{\infty} \frac{(-1)^{n}}{(2 n+1) !} x^{2 n+1}=x-\frac{x^{3}}{3 !}+\frac{x^{5}}{5 !}-\cdots \text { for all } x \] The more terms we use in the series, the higher will be accuracy of the calculations. By using infinite terms in the series we will have the exact value. Write a program that gets \( x \) and calculates \( \sin (x) \) using \( 5,10,20 \) terms. [20pts]


We have an Answer from Expert

View Expert Answer

Expert Answer


Need to create 2 functions One to find out factorial another is to find out sin function
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe