work out poly

Thread Starter

chandimajaya85

Joined Sep 27, 2023
41
Need a help to work out the formula. I cant get my head around with this to work out. its polynomial with numerator and denominator. what is the formula for this. Thank you

work out Poly:
FLOAT_TYPE num_coeff[] = {-2.42580348918581e2l, 4.43575581447635e2l, -8.6570608699616e2l, 7.34933695653457e2l, -7.02396810482965e1l};

FLOAT_TYPE den_coeff[] = {1.e0l, -8.87493143817912e-1l, 2.75291524634514e0l, -3.88521936154463e-1l, 9.08722079164108e-3l};

FLOAT_TYPE num_poly = num_coeff[sizeof(num_coeff) / sizeof(num_coeff[0]) - 1];

FLOAT_TYPE den_poly = den_coeff[sizeof(den_coeff) / sizeof(den_coeff[0]) - 1];

for (int i = (sizeof(num_coeff) / sizeof(num_coeff[0]) - 2); i >= 0; --i)

   {

   num_poly = num_poly * r + num_coeff[i];

}

for (int i = (sizeof(den_coeff) / sizeof(den_coeff[0]) - 2); i >= 0; --i)

  {

  den_poly = den_poly * r + den_coeff[i]; } return (num_poly / den_poly);

  }
 

WBahn

Joined Mar 31, 2012
32,832
You need to provide a lot more detail about what the information you have represents. For instance, just indicating that they are the coefficients of the numerator isn't enough, since the constant coefficient could be the first item or the last item in the array.

Where are these coefficient values coming from? Do you really know them to 15 sig figs?

Work out a toy problem by hand and make sure that your approach is correct before you start throwing code at it.
 

Thread Starter

chandimajaya85

Joined Sep 27, 2023
41
You need to provide a lot more detail about what the information you have represents. For instance, just indicating that they are the coefficients of the numerator isn't enough, since the constant coefficient could be the first item or the last item in the array.

Where are these coefficient values coming from? Do you really know them to 15 sig figs?

Work out a toy problem by hand and make sure that your approach is correct before you start throwing code at it.

Thank you for the reply. I worked out the formula, is it like this.


num_poly(x) = -2.42580348918581e2 + 4.43575581447635e2 * x - 8.6570608699616e2l * x^2 + 7.34933695653457e2 * x^3 - 7.02396810482965e1 * x^4

And den_poly(x) = 1.e0 - 8.87493143817912e-1 * x + 2.75291524634514e0 * x^2 - 3.88521936154463e-1 * x^3 + 9.08722079164108e-3l * x^4
 

Thread Starter

chandimajaya85

Joined Sep 27, 2023
41
Welcome to AAC.

Is this related to school work?
Thank you for the reply. I worked out the formula, is it like this.

num_poly(x) = -2.42580348918581e2 + 4.43575581447635e2 * x - 8.6570608699616e2l * x^2 + 7.34933695653457e2 * x^3 - 7.02396810482965e1 * x^4

And den_poly(x) = 1.e0 - 8.87493143817912e-1 * x + 2.75291524634514e0 * x^2 - 3.88521936154463e-1 * x^3 + 9.08722079164108e-3l * x^4
 

Ya’akov

Joined Jan 27, 2019
10,235
Thank you for the reply. I worked out the formula, is it like this.

num_poly(x) = -2.42580348918581e2 + 4.43575581447635e2 * x - 8.6570608699616e2l * x^2 + 7.34933695653457e2 * x^3 - 7.02396810482965e1 * x^4

And den_poly(x) = 1.e0 - 8.87493143817912e-1 * x + 2.75291524634514e0 * x^2 - 3.88521936154463e-1 * x^3 + 9.08722079164108e-3l * x^4
Is this related to school work?
 
Top