A quadratic equation is a polynomial equation of degree 2, commonly written in the form p(x)...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A quadratic equation is a polynomial equation of degree 2, commonly written in the form p(x) = ax2 + bx + c, where x is a variable and a, b, c are called the coefficients of the equation. A homogeneous quadratic equation is one that is set equal to 0, e.g., p(x) =3.1x2 + 2x ? 5 = 0. Note that the coefficients in this problem are positive or negative real numbers (they could be complex numbers, but we will assume they are real numbers). If x is a real number and p(x) is 0 then x is called a root of the equation. In general, a polynomial of degree n (the degree of a polynomial equation is the value of the largest exponent) will have n roots, so a quadratic equation will have two roots. However, depending on the values of the coefficients, some or all of these roots may be complex (i.e.,not real numbers). The well-known quadratic formula can be used to determine the two real roots of a quadratic equation-if they exist,The b2? 4ac term under the radical is called the discriminant, and if the discriminant is greater than or equal to zero, then both roots are real. A sample run is shown below. Your program should be similar (user input is shown in bold). Enter coefficient a: 2.5 Enter coefficient b: 6.7 Enter coefficient c: -3 2.5x^2 + 6.7x + -3 = 0 Root1 = 0.39078 Root2 = -3.07078 Implement the following pseudocode. Include necessary header files Function discriminant (Input: a is Double, b is Double, c is Double) Returns Double Return b2 - 4ac End Function discriminant Function root1 (Input: a is Double, b is Double, c is Double) Returns Double disc ? discriminant (a, b, c) Return [ -b+sqrt (disc)]/(2a) End Function root1 Function root2 (Input: a is Double, b is Double, c is Double) Returns Double disc ? discriminant (a, b, c) Return [ -b - sqrt (disc)]/(2a) End Function root2 Function display_eqn (Input: a is Double, b is Double, c is Double) Returns Nothing Display a "x^2 + "b"x + "c" =0" End Function display_eqn Function main (Input: Nothing) Define necessary variables Display prompt "Enter coefficient for a: " a ? Read real number Display prompt "Enter coefficient for b: " b? Read real number Display prompt "Enter coefficient for c: " c? Read real number r1 ? root1 (a, b, c) r2? root2 (a, b, c) Call display_eqn (a, b, c) Display "Root1 = " r1 Display "Root2 = "r2 End Function main A quadratic equation is a polynomial equation of degree 2, commonly written in the form p(x) = ax2 + bx + c, where x is a variable and a, b, c are called the coefficients of the equation. A homogeneous quadratic equation is one that is set equal to 0, e.g., p(x) =3.1x2 + 2x ? 5 = 0. Note that the coefficients in this problem are positive or negative real numbers (they could be complex numbers, but we will assume they are real numbers). If x is a real number and p(x) is 0 then x is called a root of the equation. In general, a polynomial of degree n (the degree of a polynomial equation is the value of the largest exponent) will have n roots, so a quadratic equation will have two roots. However, depending on the values of the coefficients, some or all of these roots may be complex (i.e.,not real numbers). The well-known quadratic formula can be used to determine the two real roots of a quadratic equation-if they exist,The b2? 4ac term under the radical is called the discriminant, and if the discriminant is greater than or equal to zero, then both roots are real. A sample run is shown below. Your program should be similar (user input is shown in bold). Enter coefficient a: 2.5 Enter coefficient b: 6.7 Enter coefficient c: -3 2.5x^2 + 6.7x + -3 = 0 Root1 = 0.39078 Root2 = -3.07078 Implement the following pseudocode. Include necessary header files Function discriminant (Input: a is Double, b is Double, c is Double) Returns Double Return b2 - 4ac End Function discriminant Function root1 (Input: a is Double, b is Double, c is Double) Returns Double disc ? discriminant (a, b, c) Return [ -b+sqrt (disc)]/(2a) End Function root1 Function root2 (Input: a is Double, b is Double, c is Double) Returns Double disc ? discriminant (a, b, c) Return [ -b - sqrt (disc)]/(2a) End Function root2 Function display_eqn (Input: a is Double, b is Double, c is Double) Returns Nothing Display a "x^2 + "b"x + "c" =0" End Function display_eqn Function main (Input: Nothing) Define necessary variables Display prompt "Enter coefficient for a: " a ? Read real number Display prompt "Enter coefficient for b: " b? Read real number Display prompt "Enter coefficient for c: " c? Read real number r1 ? root1 (a, b, c) r2? root2 (a, b, c) Call display_eqn (a, b, c) Display "Root1 = " r1 Display "Root2 = "r2 End Function main
Expert Answer:
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Posted Date:
Students also viewed these programming questions
-
Find the least squares polynomial approximation of degree 2 on the interval [1, 1] for the functions in Exercise 3. In Exercise 3 a. f (x) = x2 + 3x + 2, [0, 1]; b. f (x) = x3, [0, 2]; c. f (x) =...
-
Determine the trigonometric interpolating polynomial S2(x) of degree 2 on [Ï, Ï] for the following functions, and graph f (x) S2(x): a. f (x) = Ï(x Ï) b. f (x) = x(Ï x) c. f...
-
Recall that an exponential function is any equation written in the form f(x) = a . b x such that a and b are positive numbers and b 1. Any positive number b can be written as b = e n for some value...
-
The management of Mecca Copy, a photocopying centre located on University Avenue, has compiled the following data to use in preparing its budgeted balance sheet for next year: Ending Balances...
-
Ultra-Home Corporation provides the following information related to its defined-benefit pension plan for 2014. Pension liability (January 1) .............$ 500,000 Accumulated benefit obligation...
-
The population density r miles from the center of a certain city is D(r) = 25,000e 0.05r2 people per square mile. How many people live between 1 and 2 miles from the city center?
-
Dairymaids yogurt goes through two sequential processes in two departments: Fermenting and Packaging. Assume that in the Packaging Department, Step 4 of the process costing procedure indicated the...
-
Review Problem for Chapters 1 and 2 Lift It, Inc., manufactures chain hoists. The raw materials inventories on hand on October 1 were as follows: Chain . . . . . . . . . . . . . . . . . . . . . . . ....
-
16. Let a1, a2, 17. a <0 is: (a) 22 be in H.P. with a = 5 and a20 = 25. The least positive integer n for which " (b) 23 Sum of the series rlog. r=1 (c) 24 (d) 25 r+1 + is: r
-
Chillco Corporation produces containers of frozen food. During April, Chillco produced 750 cases of food and incurred the following actual costs. Variable overhead Fixed overhead Actual labor cost...
-
Hoops Incorporated sells basketballs. Each basketball requires direct materials $10.00 direct labor of $3.50, variable overhead of $4.50, and variable selling general and administrative costs of...
-
Find the time constant, T, of the output current, i,(t), given the circuit in Fig. P7.7. Given R1 = 11 kQ, R2 = 13 kq, R3 = 5 k0, R4 = 14 k0, and C = 245 F. CF 6 V R1 ww Figure P7.7 Notes on...
-
Use the stack based algorithm to convert the following postfix expression into a Binary Expression Tree. Show your work step by step. abc-e+ d f*g-/
-
Use the transition matrix P shown to find S and S for the initial-state matrix S = [0.35 0.65 ]. 1 P= = [ A 0.7 0.6 S (Type an integer or decimal for each matrix element.) = B 0.3 0.4 S2 (Type an...
-
What is the present value of $1,500 per year, at a discount rate of 7 percent, if the first payment is received 7 years from now and the last payment is received 25 years from now?
-
Given the network in Fig. P8.52, determine the magnitude of the V, phasor if Vs = 36V, R1 = 40, and R2-10 0. Vs +1 R1 ww -j1Q + V j2 R2 + Provide your answer in Volts to the nearest tenth of a Volt...
-
to dopad 100 Ma clusts (1) The Brayden Corporation is disposing of a piece of equipment on May 1, 2025. The equipment had an original cost of $360,000 when purchased on January 1, 2021. Accumulated...
-
Outline a general process applicable to most control situations. Using this, explain how you would develop a system to control home delivery staff at a local pizza shop.
-
Identify the various assertions in the following code as being always true, never true, or sometimes true and sometimes false at various points in program execution. The comments indicate the points...
-
What elements does the array numbers contain after the following code is executed? int[] [] numbers = new int[3] [4]; for (int r = 0; r < numbers.length; r++) { for (int c = 0; c < numbers...
-
What is the difference between a linked node and a linked list? How are they related and connected?
-
Explain why some employees are not comfortable being team players.
-
It is important to learn how to develop a comprehensive, clearly articulated team charter. Assume that you and your fellow students are a team in an organization (you choose the kind and size of...
-
What is responsive listening?
Study smarter with the SolutionInn App