Thread: what are the methods to evaluate the coefficients of a polynomial ??

  1. #1
    Registered User
    Join Date
    Oct 2015
    Posts
    39

    what are the methods to evaluate the coefficients of a polynomial ??

    what are the methods to evaluate the coefficients of a polynomial ??-evaluate-png


    how do i start this process ??

  2. #2
    Registered User
    Join Date
    Sep 2010
    Location
    Europe
    Posts
    87
    Your question is too much wide to answer.

    In general a polynomial can have any coefficients (if you meet the condition a_n is not 0).

    It would help to know what is given. Do you know points on the graph of the polynomial? How many? Do you know the degree of the polynomial?

    If you know points, you can estimate the degree and then put the values into the polynomial and build a system of equations (also called simultaneous equations) and by solving that you get the coefficients.

    I thought that this is a programming forum, not a math forum.

    wiki link: https://en.wikipedia.org/wiki/Polynomial
    Last edited by nerio; 01-22-2016 at 12:29 PM.

  3. #3
    Registered User
    Join Date
    Oct 2015
    Posts
    39
    ok ...
    no i am not much familiar with polynomial graphs or its points in the graph ...

    i googled it and ended up with a lot of equation classified as linear equations and non linear equation ...

    as far as my understanding goes ...



    When we know the degree we can also give the polynomial a name:
    Degree Name Example
    0 Constant 7
    1 Linear 4x+3
    2 Quadratic x2−3x+2
    3 Cubic 2x3−5x2
    4 Quartic x4+3x−2

    degree 1 polynomial equations are linear .. and degree 2 and above polynomial equations are non linear ...

    http://oi66.tinypic.com/syw1so.jpg

    http://oi63.tinypic.com/2pydxkw.jpg

    this is with respect to a graph i think ??


    and there are many methods of numerical methods depending on the equation whether its linear or a non linear equation ??


    some general things i had to keep in my mind when dealing with polynomial equations ...

    the c program for a power function
    Code:
        #include <stdio.h>
    
         int power(int m, int n);
    
          /* test power function */
    
          main()
    
          {
    
              int i;
    
              for (i = 0; i < 10; ++i)
    
                  printf("%d %d %d\n", i, power(2,i), power(-3,i));
    
              return 0;
    
          }
    
          /* power:  raise base to n-th power; n >= 0 */
    
          int power(int base, int n)
    
          {
    
              int i,  p;
    
              p = 1;
    
              for (i = 1; i <= n; ++i)
    
                  p = p * base;
    
              return p;
    
          }

    c program for solving quadratic equation ...
    Code:
    #include<stdio.h>
    
          #include<math.h>
    
           
    
         
    
          int main(){
    
          float a,b,c;
    
          float d,root1,root2;  
    
           
    
         
           
    
            printf("Enter a, b and c of quadratic equation: ");
    
            scanf("%f%f%f",&a,&b,&c);
    
           
    
            d = b * b - 4 * a * c;
    
           
    
          if(d < 0){
    
              printf("Roots are complex number.\n");
    
           
         
    
              printf("Roots of quadratic equation are: ");
    
              printf("%.3f%+.3fi",-b/(2*a),sqrt(-d)/(2*a));
    
              printf(", %.3f%+.3fi",-b/(2*a),-sqrt(-d)/(2*a));
    
           
    
          return 0; 
    
            }
          elseif(d==0){
    
             printf("Both roots are equal.\n");
    
           
         
    
             root1 = -b /(2* a);
    
             printf("Root of quadratic equation is: %.3f ",root1);
    
           
         
    
          return 0;
    
            }
    
          else{
    
             printf("Roots are real numbers.\n");
    
           
    
             root1 = ( -b + sqrt(d)) / (2* a);
    
             root2 = ( -b - sqrt(d)) / (2* a);
             printf("Roots of quadratic equation are: %.3f , %.3f",root1,root2);
    
            }
    
           
    
         
    
          return 0;
    
          }
    i also find it easier if i think of initializing an array ,like this ...

    Counting is the action of finding the number of elements of a finite set of objects. The traditional ... Computers use base 2 counting (0's and 1's). Counting can ...
    Code:
    $newfinitesetofobjects float c = 10;
    
        $newfinitesetofobjects float m = 3;
    
        for ( $newfinitesetofobjects int x = 0 ; x < 10 ; x++ ) {
    
          
    
          $newfinitesetofobjects float y = m * x + c;
    
          
    
        }

    well i sort of understand how a polynomial of degree 2 can be factored with a quadratic equation ...

    but there are many methods of numerical methods , depending on the degree of the polynomial equation and is classified as linear or non linear equation , depending on the degree of the polynomial equation ...

    not sure at this point which methods to apply to which types of equations ...

    a little bit clueless and lost ...
    Last edited by delta; 01-22-2016 at 10:38 PM.

  4. #4
    Registered User
    Join Date
    Sep 2010
    Location
    Europe
    Posts
    87
    Quote Originally Posted by delta View Post
    what are the methods to evaluate the coefficients of a polynomial ??-evaluate-png


    how do i start this process ??
    Do you have a specific example in mind?

    Like you are given points and possibly also degree and you want to know the coefficients?

    You could use linear regression, or in general polynomial regression:

    https://en.wikipedia.org/wiki/Linear_regression
    https://en.wikipedia.org/wiki/Polynomial_regression


    Here is the system of equation I was talking about in my first posts here:

    https://en.wikipedia.org/wiki/Polyno...n_of_estimates

  5. #5
    Registered User
    Join Date
    Oct 2015
    Posts
    39
    its mostly the amount of numerical methods that's confusing me right now .. i don't know which method to apply to what sort of equation ...

    the matrix form is used to calculate what is known as a system of simultaneous equation ... that is a bit easy compared to the rest of the numerical methods ...

    i have only understood solving a degree 2 polynomial with quadratic equation and this matrix method for simultaneous equations ...










    then there are methods like these ...

    Solution of Linear Equations 1. Direct Methods

    http://www.ce.utexas.edu/prof/mckinney/ce311k/Overheads/12-LinEqs_Direct.pdf

    Solution of Linear Equations 2. Indirect Methods

    http://www.ce.utexas.edu/prof/mckinney/ce311k/Overheads/13-LinEqs_Indirect.pdf

    Solving Non linear equations

    http://www.ce.utexas.edu/prof/mckinney/ce311k/Overheads/14-NonlinearEquations_1_FixedPoint.pdf

    Solving Non linear equations

    http://www.ce.utexas.edu/prof/mckinney/ce311k/Overheads/14-NonlinearEquations_2_Bisection.pdf

    Solving Non linear equations

    http://www.ce.utexas.edu/prof/mckinn...s_3_Newton.pdf


    its like you need to have a good understanding of all those mathematics to begin looking at C programs ...

    let me try to deal with solving a quadratic equation to begin with .. and i will try to move to the more advanced programs ....






    Counting is the action of finding the number of elements of a finite set of objects. The traditional ... Computers use base 2 counting (0's and 1's). Counting can ...
    i am just using these so that i can have a better understanding of the term array and code ...



    Code:
    $newfinitesetofobjects float c = 10;
     
        $newfinitesetofobjects float m = 3;
     
        for ( $newfinitesetofobjects int x = 0 ; x < 10 ; x++ ) {
     
           
     
          $newfinitesetofobjects float y = m * x + c;
     
           
     
        }


    Code:
    #include<stdio.h>
     
    #include<math.h>
    
     
            
     
          
     
          $newfinitesetofobjects int main(){
    
     
          $newfinitesetofobjects float a,b,c;
    
     
          $newfinitesetofobjects float d,root1,root2;  
    
     
            
     
          
            
     
            printf("Enter a, b and c of quadratic equation: ");
     
            scanf("%f%f%f",&a,&b,&c);
     
            
     
            d = b * b - 4 * a * c;
     
            
     
          if(d < 0){
     
              printf("Roots are complex number.\n");
     
            
          
     
              printf("Roots of quadratic equation are: ");
     
              printf("%.3f%+.3fi",-b/(2*a),sqrt(-d)/(2*a));
     
              printf(", %.3f%+.3fi",-b/(2*a),-sqrt(-d)/(2*a));
     
            
     
          return 0; 
     
            }
          elseif(d==0){
     
             printf("Both roots are equal.\n");
     
            
          
     
             root1 = -b /(2* a);
     
             printf("Root of quadratic equation is: %.3f ",root1);
     
            
          
     
          return 0;
     
            }
     
          else{
     
             printf("Roots are real numbers.\n");
     
            
     
             root1 = ( -b + sqrt(d)) / (2* a);
     
             root2 = ( -b - sqrt(d)) / (2* a);
             printf("Roots of quadratic equation are: %.3f , %.3f",root1,root2);
     
            }
     
            
     
          
     
          return 0;
     
          }
    i guess this is where the simplicity ends ...

    i havent even seen much example programs dealing with c program and numerical methods ...

    dont know where to from here ...

  6. #6
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,616
    Is this a programming problem? It's not really clear what you want.

    My understanding is that the coefficient of a variable was a multiplier. They are plain to see in certain forms.

    For quadratic equations you can see them in this form: f(x) = ax^2 + bx + c ; the coefficients of this equation are a, b, and 1 respectively. For higher degrees of polynomials, you simply have more coefficients. Linear equations have a variable number of coefficients, depending on how many variables there are.
    Last edited by whiteflags; 01-23-2016 at 07:23 AM.

  7. #7
    Registered User
    Join Date
    Oct 2015
    Posts
    39
    yes ,i was trying to arrange few problems that i came across .. while trying to deal with computer oriented numerical methods ...

    first i was looking for a program to evaluate and display the coefficients of a polynomial ...

    then i realised that was not exactly what i wanted ...

    mostly i want to understand few c programs involving polynomial calculations ....

    unfortunately the only c program i have come across with a bit of clarity was the quadratic equation program ...

    the rest seems a bit complicated ...

    this numerical methods seems like a vast subject ....

    and i was trying to narrow it down , to the simpler ones ....

    like ...


    When we know the degree we can also give the polynomial a name:
    Degree Name Example
    0 Constant 7
    1 Linear 4x+3
    2 Quadratic x2−3x+2
    3 Cubic 2x3−5x2
    4 Quartic x4+3x−2
    problems involving a polynomial of degree 2 where you can use quadratic equation ...


    problems involving systems of linear equations where you use methods like ... Gaussian Elimination


    Solution of Linear Equations 1. Direct Methods

    http://www.ce.utexas.edu/prof/mckinney/ce311k/Overheads/12-LinEqs_Direct.pdf

    Solution of Linear Equations 2. Indirect Methods

    http://www.ce.utexas.edu/prof/mckinney/ce311k/Overheads/13-LinEqs_Indirect.pdf




    i think i would like to focus on these few methods ... instead of trying to evaluate the coefficients of a polynomial ??


    thanks for the explanations ....

  8. #8
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,616
    i think i would like to focus on these few methods instead of trying to evaluate the coefficients of a polynomial ??
    I agree, I think that is best.

    When we know the degree we can also give the polynomial a name:
    0 Constant 7
    1 Linear 4x+3
    2 Quadratic x^2−3x+2
    3 Cubic 2x^3−5x^2
    4 Quartic x^4+3x−2
    The degree of a polynomial is determined by the highest power when the expression is written in simplest (canonical) form. It has nothing to do with coefficients, necessarily, or even the number of terms. For example, f(x) = x^2(x^2 + x + 1) is quartic.

    unfortunately the only c program i have come across with a bit of clarity was the quadratic equation program ...
    Well, it's important to understand the goal of the application that you are analyzing. For instance, plotters don't necessarily do anything complex with the equations that they get. They can do their work with the shunting yard algorithm for parsing equations, and then mostly straight math.

    If they receive "x^2 + x - 1" as input they would just solve for y.
    Code:
    y = x^2 + x - 1
    
    y   | x
    _ _ _ ___
     89 | -10
     71 | -9
     55 | -8
      : | :
     1  | 1
     5  | 2
     11 | 3
    
    // It's going to be embarrassing if I made a calculation error...

    So yes, applying maths to the computer is a broad topic. I would dare say that it is too broad for general understanding. In effect, it is harder to make something like wolfram-alpha than a specific application of mathematics.

  9. #9
    Registered User
    Join Date
    Oct 2015
    Posts
    39
    thanks for the detailed replies ...



    this computer oriented numerical methods were very difficult in the beginning ...

    thank god i have narrowed it down to some important parts ...

    the first parts where about solving linear equations ...

    When we know the degree we can also give the polynomial a name:
    0 Constant 7
    1 Linear 4x+3
    2 Quadratic x^2−3x+2
    3 Cubic 2x^3−5x^2
    4 Quartic x^4+3x−2
    this is a simple linear equation ... Linear 4x+3 ... because the degree of the polynomial is 1 ...
    then we have many linear equations ... where the degree of the polynomials is still 1 ...

    when we have many linear equations where the degree of the polynomial is 1 .. we have the following methods ...

    http://www.ce.utexas.edu/prof/mckinn...Eqs_Direct.pdf

    http://www.ce.utexas.edu/prof/mckinn...s_Indirect.pdf


    the methods in it are not that hard to implement with a computer program in c i guess ....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 01-16-2012, 12:34 PM
  2. Replies: 5
    Last Post: 01-15-2012, 11:02 AM
  3. Read coefficients of linear equations from file into 2d array
    By omaralqady in forum C++ Programming
    Replies: 6
    Last Post: 06-20-2009, 07:39 AM
  4. Can you inherit Methods into other methods?
    By bobbelPoP in forum C++ Programming
    Replies: 5
    Last Post: 08-02-2008, 08:32 AM
  5. Evaluate !(1 && !(0 || 1)).
    By Grumpy_Old_Man in forum C++ Programming
    Replies: 7
    Last Post: 08-18-2003, 01:28 PM