Polynomial Class with rational coefficients Programming Software Development by DamienCurr … to use both classes in order to handle the rational coefficients. The related files: [code] // Polynomial.h //#include "Rational…int numTerms; int exp[maxTerms]; // exponent array int coeff[maxTerms]; // coefficients array static void polyCombine(Polynomial &); // combine commn terms }; // end… Re: Polynomial Class with rational coefficients Programming Software Development by StuXYZ … array [This is ugly as an array] T coeff[maxTerms]; // coefficients array [This is a lot easier as vector etc.] // Why… Polynomial with Rational Coefficients Problem Programming Software Development by Climber Ty … it to add, sub, & multi polynomials (RationalNum being the coefficients i.e. 1/4x^3 + 1/2x^2 + 1/3x… amount of terms I want and then input the rational coefficients and then the exponets.... the rest will be automatically calculated… Re: Polynomial with Rational Coefficients Problem Programming Software Development by StuXYZ … the term in the first polynomial, if so add the coefficients, but if you don't just append that term to… T in B: if (A contains exponent of T): add coefficients else: append T to A // After loop: Sort A [helps… Re: Polynomial with Rational Coefficients Problem Programming Software Development by Climber Ty Ah I think my failure here lies in the fact that I don't have a strong grasp on Polynomials with Rational Coefficients... and some websites are horrible at explaining it. Anyone have a "Polynomials with Rational Coefficients for Dummies" book handy? Re: newton's method with complex coefficients Programming Software Development by ICTGUY … Method works exactly the same for an equation with complex coefficients as it does for an equation with only real… coefficients. The only difference is the extra bit of algebra involved … im just summating the series and (trying to) store the coefficients in a septerate array so they can be passed into… Re: newton's method with complex coefficients Programming Software Development by DavidB … Method works exactly the same for an equation with complex coefficients as it does for an equation with only real… coefficients. The only difference is the extra bit of algebra involved … how to let the user select and change the coefficients of a cubic Programming Software Development by matt768 … have to ask the user to read in the four coefficients of the cubic, Ask the user for start and finish… Finding Coefficients of a polynomial, roots are provided from command line Programming Software Development by jits_aps90 … number of roots > , i was trying to find the coefficients of the constructed polynomial, i was using the concept of… newton's method with complex coefficients Programming Software Development by ICTGUY …(z) is a linear polynomial of order n with complex coefficients F(z) = A(n)Z^n + A(n-1)Z… How do you extract coefficients from a linear expression? Programming by awk18 Lines=["1x+1y+0","1x-1y+0","1x+0y-3","0x+1y-0.5"] So, How do we extract coefficients of each equation in the list? Re: Polynomial with rational coefficients Programming Software Development by RayRay1 …, I am implementing a polynomial class with rational coefficients. [QUOTE=Lerner;1207732]Yes, you will need need … numerator and denominator, or, use rational numbers for coefficients in polynomials. If it's the former, then … Rational numbers to add two Polynomials with Rational coefficients and you will should probably find the lowest … Re: Polynomial with rational coefficients Programming Software Development by Lerner …for numerator and denominator, or, use rational numbers for coefficients in polynomials. If it's the former, then you…two Rational numbers to add two Polynomials with Rational coefficients and you will should probably find the lowest common…input representing the polynomial and parse it for the coefficients and exponents. I'd also let the user … Re: Polynomial with rational coefficients Programming Software Development by VernonDozier … int array {6,3,1}. If you include the zero coefficients, this would be a array of 7 Rational Numbers: {8… was assuming the first form (don't store the 0 coefficients), but perhaps the second form might be easier to implement… Re: Polynomial with rational coefficients Programming Software Development by RayRay1 … need to do is implement a polynomial that has rational coefficients. I have created two separate codes; one with rational… coefficients and another just with a polynomial. Now, how to bring … Re: Polynomial with rational coefficients Programming Software Development by VernonDozier … need to do is implement a polynomial that has rational coefficients. I have created two separate codes; one with rational… coefficients and another just with a polynomial. Now, how to bring … Re: Polynomial with rational coefficients Programming Software Development by Lerner …] class Rational { int num; int denom; etc }; class Polynomial { Rational coefficients*; };[/code] Your version creates a rational number using 2 polynomials… is legal, but it isn't creating polynomials with rational coefficients. I think you want to be able to do something… Re: Polynomial with rational coefficients Programming Software Development by Lerner … was assuming the first form (don't store the 0 coefficients), but perhaps the second form might be easier to implement… (store the 0 coefficients). And I was assuming the latter implementation, but your explanation… Re: Polynomial with rational coefficients Programming Software Development by VernonDozier … and stuff, including operators. }; class Polynomial { // code and stuff RationalNumber* coefficients; int* degrees; int numTerms; // code and stuff void printPolynomial (); }; [/code… Re: Polynomial with Rational Coefficients Problem Programming Software Development by StuXYZ The issue isn't really the coefficient value that you have with the polynomial, it is that you have to realize, that the size of your polynomial will change dramatically, on addition, subtraction etc. Once you have figured out how to handle that, [in particular to remove zeros e.g. (x^2+3x) + (3x^4-3x) should give (3x^4+x^2).] Note that in … Re: Polynomial with Rational Coefficients Problem Programming Software Development by Climber Ty [QUOTE=StuXYZ;1531003] Finally, you obviously know about std::vector, so either use a list / vector for the polynomial terms, and don't bother with the max coefficient part [your maxTerm]. The polynomial will change as required. Then it is easy.[/QUOTE] So would it be wise to write this as an array for problem solving first... or just dig into… Re: Polynomial with Rational Coefficients Problem Programming Software Development by Climber Ty Okay that makes sense... because overall in the structure is goes: [CODE] --->Term (Term = n+1) | -->Poly A | | | -->Coeff A n1, n2, n3, etc. | -->Poly B | -->Coeff B n1, n2, n3, etc. [/CODE] I'll see about fixing that up and posting what I have … Re: Polynomial with Rational Coefficients Problem Programming Software Development by Climber Ty Okay maybe my head still foggy on this... tell me if I am wrong some where. [CODE] class Polynomial { vector<int>Poly; public: Polynomial(); Polynomial operator+(const Polynomial &rhs) const; private: int exponet; int coeff; }; Polynomial() //constructor exponet = 0; coeff = 0; Polynomial … Re: Polynomial with Rational Coefficients Problem Programming Software Development by Climber Ty Okay I realized I've been going about this all wrong... it's not the math... it's the vector/array. Once I get things together again I'll repost. Re: how to let the user select and change the coefficients of a cubic Programming Software Development by Dave Sinkula [QUOTE=matt768]I don't know much about c programming at all, as I have only been doing it for about five hours, any help would be much appreciated[/QUOTE]Post your attempt with any error messages and the specific questions you have. Or read [url="http://www.daniweb.com/techtalkforums/announcement.php?f=8&announcementid=2"]this[/url]. Re: how to let the user select and change the coefficients of a cubic Programming Software Development by Chainsaw This is a beginning programming class or something? And this is the first assignment? Phew. Re: Finding Coefficients of a polynomial, roots are provided from command line Programming Software Development by Parv_boy Hi! If two roots are provided a,b then the equation will be : x^2 - (a + b)x + (ab) = 0 If three roots are provided a,b,c then the equation will be (not sure) : x^3 - (a+b+c)x^2 + (ab+bc+ca)x - (abc) = 0 Re: Finding Coefficients of a polynomial, roots are provided from command line Programming Software Development by grumpier 1) First, represent a polynomial (of the form c_0 + c_1*x + c_2*x^2 + .... c_n*x^n) is represented by an array with elements (c_0, c_1, c_2, c_3, .... c_n). 2) Work out how to multiply two arbitrary polynomials together. ie. given a polynomial A (a_0, a_1, a_2, a_3, .... a_n) and a polynomial B (b_0, b_1, b_2, b_3, .... b_m) work out … Re: Finding Coefficients of a polynomial, roots are provided from command line Programming Software Development by jits_aps90 ya thnks dear... actually, thats a solution when you have known number of roots... But i am taking some number random number of roots from command line.... thats why i am facing a problem in coding it.... bye tc Re: Finding Coefficients of a polynomial, roots are provided from command line Programming Software Development by jits_aps90 hi thanks a lot! in fact i had just worked out the same problem with the same logic. u r too good! bye tc