Consider the equation f(x) = 2*sin(pi*x) + 3*cos(pi*x)
Write a c program that computes the values of f(x) for the following values of x: 0.25, 0.5, 1, 2. Your program should allow the user to enter the value from the standard input and the results will be displayed as follows:
/*****************************************************************/
Value of x Value of f(x)
0.25 3.5355
0.5
1
2
C CODE:
OUTPUT:
FOR ANY HELP JUST DROP A COMMENT
Consider the equation f(x) = 2*sin(pi*x) + 3*cos(pi*x) Write a c program that computes the values...
a.) Write a C++ program that calculates the value of the series sin x and cos x, sin 2x or cos 2x where the user enters the value of x (in degrees) and n the number of terms in the series. For example, if n= 5, the program should calculate the sum of 5 terms in the series for a given values of x. The program should use switch statements to determine the choice sin x AND cos x, sin...
8.2 (2). Consider the linear equation Y'(x) = XY (2) + (1 - 1) cos(x) - (1+) sin(x), quady (0) = 1 The true solution is Y (1) = sin(1) + cos(r). Solve this problem using Euler's method with several values of and h, for 0 <<<10. Comment on the results. (a) X = -1; h=0.5, 0.25, 0.125 (b) X = 1; h = 0.5, 0.25, 0.125 (c) = -5; h=0.5, 0.25, 0.125, 0.0625 (d) = 5; h= 0.0625
8.2 (2). Consider the linear equation Y'(x) = XY (2) + (1 - 1) cos(x) - (1+) sin(x), quady (0) = 1 The true solution is Y (1) = sin(1) + cos(r). Solve this problem using Euler's method with several values of and h, for 0 <<<10. Comment on the results. (a) X = -1; h=0.5, 0.25, 0.125 (b) X = 1; h = 0.5, 0.25, 0.125 (c) = -5; h=0.5, 0.25, 0.125, 0.0625 (d) = 5; h= 0.0625
Consider the linear equation Y ′(x) = λY (x) + (1 − λ) cos(x) − (1 + λ) sin(x), quadY (0) = 1 . The true solution is Y (x) = sin(x) + cos(x). Solve this problem using Euler’s method with several values of λ and h, for 0 ≤ x ≤ 10. Comment on the results. (a) λ = −1; h = 0.5, 0.25, 0.125 (b) λ = 1; h = 0.5,0.25,0.125 (c) λ = −5; h = 0.5,...
USING C LANGUAGE Write a program that computes the total weight of a cargo. Ask the user to enter multiple inputs. For each input, the user indicate the weight and quantity of the boxes. The program computes and prints the total cargo weight The output should match the sample below. Make sure you print the input number (Input #1, Input #2,) 3 - Input # 1. Weight of the box (lbs): 4 Enter quantity: 2 Input #2. Weight of the...
Results for this submission Entered Answer Preview Result (3/2)+(6/pi)*cos(x) e + cos(2) correct (3/2)+(6/pi)*cos(x)-(2/pi)*cos(3*x) 3 6 st-ce 2 s(3x) correct (3/2)+(6/pi)*cos(x)-(2/pi)*cos(3*x)+(6/5)*pi*cos(5*x) it coule) = _ cou(30) + * cos(52) incorrect A correct f(x) f(x) correct At least one of the answers above is NOT correct. 1 (1 point) (a) Suppose you're given the following Fourier coefficients for a function on the interval (-1,7): a 3 6 6 6 = , ai = –, az = -2,25 = = and 22,...
The equation f(x) = (1 ‐ x) cos x ‐ sin x = 0 has at least one root between a = 0 and b = 1 since f(a)f(b) < 0. The bisection method of finding the root proceeds as follows: a. It finds the midpoint r = (a + b)/2. b. If f(r) = 0, then r is the root. If |b ‐ a| is very small less than ∈ then also we can take r as the root....
Write a program that computes the average of a set of grades. The user is prompted the following: 1-Number of grades to be entered. 2-The value of the minimum grade. 3-The value of the maximum grade. Make sure to write input validation for the following: 1-The number of grades cannot be negative! In case it is 0, it means that user has no grades to enter. 2-Each entered grade should be a valid grade between the minimum and maximum values...
Write a c++ program to calculate the approximate value of pi using this series. The program takes an input n that determines the number of values we are going to use in this series. Then output the approximation of the value of pi. The more values in the series, the more accurate the data. Note 5 terms isn’t nearly enough. You will try it with numbers read in from a file. to see the accuracy increase. Use a for loop...
What to do Write a C program that computes Pi with the approximation algorithm that I introduced in class. I want you to write the program in two different ways: The first version will add up the first 28284277 elements of the approximation series in a simple for loop. I ask you to put the code into a function with this signature: float get_pi_for(void); The second version will break out of a while loop depending on whether a pair of...