Question 1: Implement a C++ program that determines the root of the following mathematical function: f(x)...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Question 1: Implement a C++ program that determines the root of the following mathematical function: f(x) = 4x³ + 3x²-5 The function asks the user to provide an initial value xo (e.g., 4) for the root and a tolerance value (e.g., 0.00001). It then uses the Newton-Raphson method to iteratively find the root of the function. The program should provide the root value at the end along with the number of iterations it took the program to reach to the particular root. In case the number of iterations becomes more than 10,000, the program should exit by printing the message "number of iterations exceeded". Note: root is found by taking the derivative f'(x) of the function f(x) and then subtracting value of f(x) from x, x = f'(x) f(x) x- , iteratively until the result of the subtraction becomes less than the tolerance value provided by the user. f'(x) Set initial value of x as xo, as provided by the user. Question 2: Write a C++ program to determine the harmonic motion of a set of particles enter by the user. The harmonic motion is calculated by the following equation: h(t) = A cos(2лfə) where A is the amplitude of the particle motion, f'is the frequency, is the phase of the particle motion and is the time. 2 | Page Note: The user should provide the input about the total number of particles for which h(t) needs to be calculated. Then, the program should ask about 4, f, and a for each particle. The program should then ask about the start time, end time and the time interval to calculate h(t) for each particle and for each timeslot. (Hint: Consider solving the problem with a 2-D array). Question 1: Implement a C++ program that determines the root of the following mathematical function: f(x) = 4x³ + 3x²-5 The function asks the user to provide an initial value xo (e.g., 4) for the root and a tolerance value (e.g., 0.00001). It then uses the Newton-Raphson method to iteratively find the root of the function. The program should provide the root value at the end along with the number of iterations it took the program to reach to the particular root. In case the number of iterations becomes more than 10,000, the program should exit by printing the message "number of iterations exceeded". Note: root is found by taking the derivative f'(x) of the function f(x) and then subtracting value of f(x) from x, x = f'(x) f(x) x- , iteratively until the result of the subtraction becomes less than the tolerance value provided by the user. f'(x) Set initial value of x as xo, as provided by the user. Question 2: Write a C++ program to determine the harmonic motion of a set of particles enter by the user. The harmonic motion is calculated by the following equation: h(t) = A cos(2лfə) where A is the amplitude of the particle motion, f'is the frequency, is the phase of the particle motion and is the time. 2 | Page Note: The user should provide the input about the total number of particles for which h(t) needs to be calculated. Then, the program should ask about 4, f, and a for each particle. The program should then ask about the start time, end time and the time interval to calculate h(t) for each particle and for each timeslot. (Hint: Consider solving the problem with a 2-D array).
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
What hurdles is InBev going to face to complete its acquisition of AB? What can InBev do to overcome these hurdles? 4) What options does AB have if it wants to continue as an independent player? 5)...
-
Goodwill impairment tests are carried out annually. During 2014, goodwill impairment was determined to be $26,000 on the parents share of goodwill and $5,000 on the NCI share. In 2016, impairment in...
-
+3 NE + .. 4 b) A Spade or Club? .. +4 As shown above, a classic deck of cards is made up of 52 cards, 26 are black, 26 are red. Each color is split into two sults of 13 cards each (clubs and...
-
Jen and Barry's Ice Milk Company used cash to purchase a new ice milk mixer on January 1, 2013. The new mixer is estimated to have a 20,000 - hour service life. Jen and Barry's depreciates equipment...
-
Determine the moment of inertia for the beams cross-sectional area about the x' axis passing through the centroid C of the cross section. Given: a = 100 mm b = 25 mm c = 200 mm = 45 deg a
-
Suzy owns a 30% interest in the JSD LLC. In liquidation of the entity, Suzy receives a proportionate distribution of $30,000 cash, inventory (basis of $16,000, fair market value of $18,000), and land...
-
There are two propositions: (a) I flip a coin. If it is heads, you are paid \$3; if it is tails, you are paid \(\$ 0\). It costs you \(\$ 1\) to participate in this proposition. You may do so at any...
-
Reconsider Hugh Liedtkes decision as diagrammed in Figure 4.2. Note that three strategies are possible: (1) accept $2 billion, (2) counteroffer$5 billion and then accept $3 billion if Texaco...
-
Selected transactions for Carla Vista Corporation during its first month in business are presented below. Sept. 1 Issued common stock in exchange for $ 2 1 , 8 0 0 cash received from investors. 5...
-
The proposed rates were not in the range the CEO expected given the pricing analysis. The CEO has asked the pricing actuary to verify the total projected loss cost excluding potential large storm...
-
Write an essay on Cloud computing: insecure convince
-
A professor wants to test the impact of a training session attended by 20 students. He assessed the performance before the session based on the given learning objectives as well as after the session...
-
Sticking with team sports, what examples can you think of in which high or low cohesiveness affected performance? And how much more or less do you think cohesiveness matters depending on the sport:...
-
In Problem 13.5, you used the GPA to predict the overall satisfaction of university students (stored in UPFBE ). Evaluate whether the assumptions of regression have been seriously violated. Problem...
-
It is 22 April 2015 and you are completing your taxes, albeit late, for 2014. You purchased your house for $600,000 on 1 January 2010 and financed 80% at 5.0% for 30 years using a constant payment...
-
Find the frequency response of the given system. \(\frac{1}{3} \dot{x}+2 x=2.6 \sin 2 t\)
-
Evaluate 101 x 99 without actual multiplication.
-
You are maintaining a subsidiary ledger account for Police-Training Expenditures for 2013. The following columns are used: Inventory purchases are initially recorded as expenditures. Record the...
-
Suppose you put your younger brother in charge of backing up your work. Write a set of detailed instructions for carrying out his task. Explain how often he should do it, and what files he needs to...
-
Insert all words from a large file (such as the novel War and Peace, which is available on the Internet) into a hash set and a tree set. Time the results. Which data structure is more efficient?
-
Read all words from a list of words and add them to a map whose keys are the phone keypad spellings of the word, and whose values are sets of words with the same code. For example, 26337 is mapped to...
-
What are the differences between the light stall and the deep stall. Comment on the differences as regards the sectional lift and the moment coefficients.
-
Comment on the effect of the (i) separation, (ii) Mach number on the negative drag for a plunging airfoil.
-
Obtain the relation between the stream function and the vorticity as the kinematic relation of the 2-D flow. Apply SOR (Successive Overrelaxation) technique to solve the elliptic equation.
Study smarter with the SolutionInn App