Here is given a struct to store the binomial expansion. void main(){ struct Binomial{ int bsize...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Here is given a struct to store the binomial expansion. void main(){ struct Binomial{ int bsize = 5; Binomial ** blist = new Binomial* [bsize]; for (int i = 0; i < bsize; i++) { blist[i] = new Binomial (); bList[i]->n = i+1; calculate_Coefficients (bList[i]); calculate Exponents (bList[i]); } 1/ add code to print bList !/ add code to deallocate blist. int * explist[2]; //to store exponents of a binomial expansion, there are always two terms in each binomial expression (x+y)" so expList[0] is for exponent of "x" and explist[1] is for exponent of "y" int Size; // to store size of exponents & coef Arrays int * coef; // to store binomial coefficients int n; // to Store the value of n Sample Output: x +y x^2 + 2xy + y^2 x^3 + 3x^2y + 3xy^2 + y^3 x^4 + 4x^3y + 6x^2y^2 + 4xy^3 + y^4 x^5 +5x^4y + 1ex 3y^2 + 1ex^2y^3 + 5xy^4 + y^5 storage and calculations only. Press any key to continue. . Note: There should be no memory leaks and dangling pointers in your code. Allocate and use only that much memory which is required for In elementary algebra binomial theorem is the algebraic expansion of powers of a binomial. In this theorem the polynomial (x + y)" is expanded into a sum involving terms of the form ax" y, where the exponents b and c are nonnegative integers with b+c= n. For example for n 2 (x+y)? =x + 2xy + y for n = 3 (x+y)° = x° + 3x°y + 3xy° +y° + 3x*y+ 3xy° + y° The coefficient a of each term is a positive integer depending on n and b is called a binomial coefficient. They are total number of combinations of n objects taken k at a time for all k such that 00 jsi sksnand computed as given in the formula. n! ) = l(n – k)! There are many ways to calculate binomial coefficients. Pascal's triangle method is 1 one of them and it is used for quick calculation of binomial coefficients. In each row of 2 this triangle provides the binomial coefficients of expansion to the power row number for 3 Example: 1 1 1 2 1 1 3 3 1 4 1 4 6 4 1 The row 2 of triangle contains values 1, 2, 1, which are binomial coefficients of 5 1 5 10 10 5 1 expansion for n = 2. 0 1 2 3 4 0 1 1 1 1 2 1 2 1 3 1 33 1 4146 4 1 Pascal's triangle is constructed in the following manner: • In first 0" row, there is a unique nonzero entry 1. • First and last values of all other rows are 1. • Remaining entries of each subsequent row are constructed by adding the number in above row to the left number of above row. Here is given a struct to store the binomial expansion. Here is given a struct to store the binomial expansion. void main(){ struct Binomial{ int bsize = 5; Binomial ** blist = new Binomial* [bsize]; for (int i = 0; i < bsize; i++) { blist[i] = new Binomial (); bList[i]->n = i+1; calculate_Coefficients (bList[i]); calculate Exponents (bList[i]); } 1/ add code to print bList !/ add code to deallocate blist. int * explist[2]; //to store exponents of a binomial expansion, there are always two terms in each binomial expression (x+y)" so expList[0] is for exponent of "x" and explist[1] is for exponent of "y" int Size; // to store size of exponents & coef Arrays int * coef; // to store binomial coefficients int n; // to Store the value of n Sample Output: x +y x^2 + 2xy + y^2 x^3 + 3x^2y + 3xy^2 + y^3 x^4 + 4x^3y + 6x^2y^2 + 4xy^3 + y^4 x^5 +5x^4y + 1ex 3y^2 + 1ex^2y^3 + 5xy^4 + y^5 storage and calculations only. Press any key to continue. . Note: There should be no memory leaks and dangling pointers in your code. Allocate and use only that much memory which is required for In elementary algebra binomial theorem is the algebraic expansion of powers of a binomial. In this theorem the polynomial (x + y)" is expanded into a sum involving terms of the form ax" y, where the exponents b and c are nonnegative integers with b+c= n. For example for n 2 (x+y)? =x + 2xy + y for n = 3 (x+y)° = x° + 3x°y + 3xy° +y° + 3x*y+ 3xy° + y° The coefficient a of each term is a positive integer depending on n and b is called a binomial coefficient. They are total number of combinations of n objects taken k at a time for all k such that 00 jsi sksnand computed as given in the formula. n! ) = l(n – k)! There are many ways to calculate binomial coefficients. Pascal's triangle method is 1 one of them and it is used for quick calculation of binomial coefficients. In each row of 2 this triangle provides the binomial coefficients of expansion to the power row number for 3 Example: 1 1 1 2 1 1 3 3 1 4 1 4 6 4 1 The row 2 of triangle contains values 1, 2, 1, which are binomial coefficients of 5 1 5 10 10 5 1 expansion for n = 2. 0 1 2 3 4 0 1 1 1 1 2 1 2 1 3 1 33 1 4146 4 1 Pascal's triangle is constructed in the following manner: • In first 0" row, there is a unique nonzero entry 1. • First and last values of all other rows are 1. • Remaining entries of each subsequent row are constructed by adding the number in above row to the left number of above row. Here is given a struct to store the binomial expansion.
Expert Answer:
Answer rating: 100% (QA)
include using namespace std struct Binomial int expList2 int Size int ... View the full answer
Related Book For
Microsoft Visual C# An Introduction to Object-Oriented Programming
ISBN: 978-1337102100
7th edition
Authors: Joyce Farrell
Posted Date:
Students also viewed these programming questions
-
Explain why there are always two photons created in pair annihilation. Why cannot the process create just one photon?
-
Calculate each binomial probability: a. X = 5, n = 9, = .90 b. X = 0, n = 6, = .20 c. X = 9, n = 9, = .80
-
Calculate each binomial probability: a. X = 2, n = 8, = .10 b. X = 1, n = 10, = .40 c. X = 3, n = 12, = .70
-
In thinking about the appropriate balance between the market and the government in achieving sustainability, do you think the government needs to take a stronger role or would you favor reducing...
-
Identify the tax issue or issues suggested by the following situations and state each issue in the form of a question. Every December, Maxo Inc., an accrual basis, calendar year Corporation,...
-
The time taken by a traditional nuclear reactor to generate one nuclear chain reaction with fast neutrons, \(X_{1}\), has mean 10 nanoseconds and variance 4 , while the time taken by an improved...
-
Titan Offroad Equipment uses the LIFO inventory method and values its inventory using the lower-of-cost-or-market^LCM) rule. Titan Offroad Equipment has the following account balances at December 31,...
-
Consider the drug treatment system shown in the figure below. A hemispherical cluster of unhealthy cells is surrounded by a larger hemisphere of stagnant dead tissue (species B), which is turn...
-
Superior Company provided the following data for the year ended December 31 (all raw materials are used in production as direct materials): Selling expenses Purchases of raw materials Direct labor...
-
You have estimated spot rates as follows: r1 = 5.00%, r2 = 5.40%, r3 = 5.70%, r4 = 5.90%, r5 = 6.00%. a. What are the discount factors for each date (that is, the present value of $1 paid in year t)?...
-
Fifteen thousand pounds of concrete are poured to form a concrete patio. The concrete weighs 135 pounds per cubic foot. Approximately how many cubic feet of concrete is poured to form the patio?...
-
Evaluate the following statement: The demand for U.S. oranges has increased because the quantity of U.S. oranges demanded in Japan has risen.
-
Many restaurants dont take reservations. You simply arrive and wait your turn. If you arrive at 7:30 in the evening, you have at least an hour wait. Notwithstanding that fact, a few people arrive,...
-
Explain how the government can run budget deficitsthat is, spend more than it receives in tax revenue.
-
Is wavelike motion an example of conservative or diffusive motion?
-
Using the interconnection between sectors of the economy, illustrate the effects of imposing an increase in taxes on the household sector.
-
George and Wanda received $30,200 of Social Security benefits this year ($12,000 for George; $18,200 for Wanda). They also received $5,000 of interest from jointly owned City of Ranburne Bonds and...
-
An annual report of The Campbell Soup Company reported on its income statement $2.4 million as equity in earnings of affiliates. Journalize the entry that Campbell would have made to record this...
-
Follow the instructions for starting C++ and viewing the Intermediate23.cpp file, which is contained in either the Cpp8\Chap11\Intermediate23 Project folder or the Cpp8\Chap11 folder. (Depending on...
-
Write a C++ statement to change the contents of the word variable from mend to amend
-
Figure 5-35 shows the MifflinSt Jeor formulas for calculating a persons basal metabolic rate (BMR), which is the minimum number of calories needed to keep his or her body functioning while resting...
-
Considerations that affect the selection of an inventory costing method include: (a) nature of the inventory (e.g. perishable or non-perishable). (b) statement of financial position effects. (c)...
-
Which of these would cause inventory turnover to increase the most? (a) Increasing the amount of inventory on hand. (b) Keeping the amount of inventory on hand constant but increasing sales. (c)...
-
In periods of rising prices, LIFO will produce: (a) higher profit than FIFO. (b) the same profit as FIFO. (c) lower profit than FIFO. (d) higher profit than average costing.
Study smarter with the SolutionInn App