Identify and correct all the mistakes in the following code snippet which calculates the summation of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Identify and correct all the mistakes in the following code snippet which calculates the summation of the following series for a given number x, where k ranges from 1 to N (N is again given by the user). Submit the correct program with the comment next to the line you change, for example: % for ii=1:1:n changed to ii=1:1:100000 (this is just an example!) N 1 Σ (² + √²-₁) Σ(!+ k! xk k=1 You cannot add whole new lines of code. 1. clc; clear 2. 3. x = input('Enter the value of x: '); 4. N = input('Enter the value of N: '); 5. sum = 1; 6. 7. for k = 1:1: N 8. fact = 0; 9. for ii 1:2:k 10. 11. 12. 13. 14. end 15. 16. fprintf ('The sum of series is %g ', sum); fact fact * ii; end newterm = fact +1/x^k-1; sum = newterm; Sample Output Test Case: Enter the value of x: 5 Enter the value of N: 5 The sum of series is 153.302 Identify and correct all the mistakes in the following code snippet which calculates the summation of the following series for a given number x, where k ranges from 1 to N (N is again given by the user). Submit the correct program with the comment next to the line you change, for example: % for ii=1:1:n changed to ii=1:1:100000 (this is just an example!) N 1 Σ (² + √²-₁) Σ(!+ k! xk k=1 You cannot add whole new lines of code. 1. clc; clear 2. 3. x = input('Enter the value of x: '); 4. N = input('Enter the value of N: '); 5. sum = 1; 6. 7. for k = 1:1: N 8. fact = 0; 9. for ii 1:2:k 10. 11. 12. 13. 14. end 15. 16. fprintf ('The sum of series is %g ', sum); fact fact * ii; end newterm = fact +1/x^k-1; sum = newterm; Sample Output Test Case: Enter the value of x: 5 Enter the value of N: 5 The sum of series is 153.302
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
What is the Policing act in the State of Georgia? What is the second chance act in the State of Georgia? What is the police Reform in Georiga? References
-
Carol Harris, Ph.D, CPA, is a single taxpayer and she lives at 674 Yankee Street, Durham, NC 27409. Her Social Security number is 793-52-4335. Carol is an Associate Professor of Accounting at a local...
-
What is the spring cloud API Gateway and how do you set it up to make a call to the product service via eureka service discovery server? Give me the complete code in detailed steps.
-
In Problems 1158, perform the indicated operation, and write each expression in the standard form a + bi. 2 + i i
-
Use phasors to find the resultant (magnitude and phase angle) of two fields represented by E1 = 12 sin wt and E2 = 18 sin (wt + 60). (Note that in this case the amplitudes of the two fields are...
-
Let's suppose you conducted an experiment involving genetic crosses and calculated a chi square value of 1.005. There were four categories of offspring (i.e., the degrees of freedom equaled 3)....
-
Construct a relative frequency histogram using the frequency distribution in Exercise 17. Then determine which class has the greatest relative frequency and which has the least relative frequency....
-
The Bishop's Falls Lumber Corporation harvests lumber and prepares it for sale to wholesalers of lumber and wood products. The main product is finished lumber, which is sold to wholesale construction...
-
Factor ( 3 t ^ 2 - 5 t - 1 2 )
-
For the data from Speciatronics, Ltd. (Prob04-09 in Ch04Data.xlsx on the Student Companion Site), the upper specification limit was USL = 5.25, and the lower specification limit was LSL = 1.75....
-
3. Solve the Laplace equation on the rectangle in the x-y plane, 0xL, 0 y W. F, W/4
-
Managing Linux users - Some of the topics in this week's material were around managing Linux user accounts. What are some of the concerns around this and some techniques to support managing Linux...
-
Using the brand "Naked Juice.", share the the following: How does your brand create brand awareness and how recognizable is the brand? Share a digital ad or social media post. Who is the target...
-
bonds that have an option giving the issuer the right to retire them at a stated dollar amount?
-
5. Assume the simple floating point model used in the slides (i.e., 14-bits of storage) a. How would we represent the numbers 67.25 and 47.98? b. Add the two numbers together. Show the calculation...
-
MINIX is very similar to Linux in terms of commands so if you are familiar with Linux, you will just use MINIX with no problem. If you don't know Linux, it will be actually very good idea to learn...
-
Christa estimates that her revised annual living expenses, including a new studio and apartment, will average 132,500 (excluding Jurgens educational costs). If necessary, she could combine her...
-
Suppose that fraction used = / 1.0 + 0.1Mt. for some parameter 1. Write the discrete-time dynamical system and solve for the equilibrium. Sketch a graph of the equilibrium as a function of ....
-
Indicate, in each of the following situations, the number of exemptions the taxpayers are entitled to claim on their 2012 income tax returns. Number of Exemptions a. Donna, a 20-year-old single...
-
Calculate the amount of the child and dependent care credit allowed for 2012 in each of the following cases, assuming the taxpayers had no income other than the stated amounts. a. William and Carla...
-
How are qualified dividends taxed in 2012? Please give the two rates of tax which apply to qualified dividends, and specify when each of these rates applies._________________________...
-
Referring to Example 13, conduct a test to show that the mean change \(\mu_{D}\) is different from 0 . Take \(\alpha=0.05\). Data From Example 13 EXAMPLE 13 The chi square test of independence To...
-
A shoe manufacturer wants potential customers to compare two types of shoes, one made of the current PVC material \(X\) and one made of a new PVC material \(Y\). Shoes made of both are available....
-
In a study of the effectiveness of physical exercise in weight reduction, a group of 16 persons engaged in a prescribed program of physical exercise for one month showed the following results: Use...
Study smarter with the SolutionInn App