Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Here is given a struct to store the binomial expansion. void main(){ struct Binomial{ int bsize = 5; Binomial ** blist = new Binomial*
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 + 3xy + 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.
Step by Step Solution
★★★★★
3.39 Rating (158 Votes )
There are 3 Steps involved in it
Step: 1
include using namespace std struct Binomial int expList2 int Size int ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started