Question

Define a function named sumsin that accepts double precision variable theta, double precision variable alpha, and...

Define a function named sumsin that accepts double precision variable theta, double precision variable alpha, and unsigned integer n, and returns the solution of

∑ k = 0 n sin ⁡ ( θ + k α )

as a double precision value using an iterative structure (i.e. a loop). Note the symbol for theta is θ, and the symbol for alpha is α. Only show the function definition. Do not write an entire program with a main function. Just write the definition for function sumsin.

in C

Homework Answers

Answer #1

Ans

code:-

double sumsin(double theta,double alpha,unsigned int n){

double sum=0.0;//to store result

//sum from k=0 to n

for(unsigned int k=0;k<=n;k++){

sum=sum + sin(theta+k*alpha);

}

return sum;

}

If any doubt ask in the comments.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Given the existence of two-dimensional array double A[M][N], where M and N are #defined as the...
Given the existence of two-dimensional array double A[M][N], where M and N are #defined as the number of rows and columns, respectively, define a function named sqabsmax that accepts array A as an argument (i.e. input parameter) and returns the square of the maximum absolute value element in A. Use the const qualifier if appropriate. Only show the function definition. Do not write an entire program with a main function. Just write the definition for function sqabsmax.
Logic and Design Programming In Syntax Pseudocode Algorithm Workbench 1. Design a simple function named timesDozen...
Logic and Design Programming In Syntax Pseudocode Algorithm Workbench 1. Design a simple function named timesDozen that accepts an Integer argument into a parameter named nbr. When the function is called, it should return the value of its argument multiplied times 12. 2. Assume that a program has two String variables named alpha and bravo. Write - a pseudocode statement that assigns an all uppercase version of alpha to the bravo variable. Book name is Starting Out with Programming Logic...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's algorithm to ensure mutual exclusion in the respective critical sections of the two processes, and thereby eliminate the race condition. In order to implement Peterson's Algorithm, the two processes should share a boolean array calledflagwith two components and an integer variable called turn, all initialized suitably. We will create and access these shared variables using UNIX system calls relating to shared memory – shmget,...