Questions tagged [polynomials]

In mathematics, a polynomial is an expression consisting of variables (or indeterminates) and coefficients, that involves only the operations of addition, subtraction, multiplication, and non-negative integer exponents.

In mathematics, a polynomial is an expression consisting of variables (or indeterminates) and coefficients, that involves only the operations of addition, subtraction, multiplication, and non-negative integer exponents.

An example of a polynomial of a single indeterminate (or variable), x, is x2 − 4x + 7, which is a quadratic polynomial.

Polynomials appear in a wide variety of areas of mathematics and science. For example, they are used to form polynomial equations, which encode a wide range of problems, from elementary word problems to complicated problems in the sciences; they are used to define polynomial functions, which appear in settings ranging from basic chemistry and physics to economics and social science; they are used in calculus and numerical analysis to approximate other functions. In advanced mathematics, polynomials are used to construct polynomial rings and algebraic varieties, central concepts in algebra and algebraic geometry.

Wikipedia: http://en.wikipedia.org/wiki/Polynomial

978 questions
8
votes
3 answers

Collecting like term of an expression in Sympy

I am currently dealing with functions of more than one variable and need to collect like terms in an attempt to simplify an expression. Say the expression is written as follows: x = sympy.Symbol('x') y = sympy.Symbol('y') k = sympy.Symbol('k') a =…
hkh
  • 350
  • 1
  • 5
  • 13
8
votes
1 answer

Bairstow's method initial quadratic approximations

Bairstow's root finding method needs very good initial approximations for the quadratic factors in order to converge. I tried various constants, random numbers, fractions out of the trailing coefficient (-a1/a2, -a0/a2; by Lin?) to no avail. Please,…
Ecir Hana
  • 10,864
  • 13
  • 67
  • 117
8
votes
3 answers

efficient way to take powers of a vector

I wrote a code that numerically uses Legendre polynomials up to some high n-th order. For example: .... case 8 p = (6435*x.^8-12012*x.^6+6930*x.^4-1260*x.^2+35)/128; return case 9 ... If the vectorx is long this can become slow. I saw that there…
user2041376
7
votes
1 answer

Get the coefficients of a polynomial with Numpy

I'm trying to get the coefficients of a numpy.polynomial.polynomial.Polynomial obtained via the fit method: import numpy.polynomial as poly x = [1, 2, 3, 4, 5] y = [16, 42.25, 81, 132.25, 196] c = poly.Polynomial.fit(x, y, deg =…
Javier Garcia
  • 539
  • 1
  • 4
  • 15
7
votes
1 answer

Should I use numpy.polyfit or numpy.polynomial.polyfit or numpy.polynomial.polynomial.Polynomial?

What is the difference between https://docs.scipy.org/doc/numpy/reference/generated/numpy.polyfit.html and https://docs.scipy.org/doc/numpy/reference/generated/numpy.polynomial.polynomial.polyfit.html and which one should I use when? I checked the…
Make42
  • 12,236
  • 24
  • 79
  • 155
7
votes
3 answers

Get the inverse function of a polyfit in numpy

I have fit a second order polynomial to a number of x/y points in the following way: poly = np.polyfit(x, y, 2) How can I invert this function in python, to get the two x-values corresponding to a specific y-value?
Oblomov
  • 8,953
  • 22
  • 60
  • 106
7
votes
1 answer

Confidence interval of polynomial regression

I have a little issue with R and statistics. I fitted a model with the Maximum Likelihood method, who gave me the following coefficients with their respective Standard Errors (among other parameters estimates): ParamIndex Estimate SE …
trantsyx
  • 149
  • 1
  • 12
7
votes
2 answers

Fit 3D Polynomial Surface with Python

I have a python code that calculates z values dependent on x and y values. Overall, I have 7 x-values and 7 y-values as well as 49 z-values that are arranged in a grid (x and y correspond each to one axis, z is the height). Now, I would like to fit…
lux7
  • 1,600
  • 2
  • 18
  • 34
7
votes
3 answers

How to find polynomial roots correctly?

Consider a polynomial such as: p = [1 -9 27 -27]; obviously the real root is 3: polyval(p,3) 0 While using the roots function q = roots([1 -9 27 -27]); with format short: q = 3.0000 + 0.0000i 3.0000 + 0.0000i 3.0000 - 0.0000i and to…
NKN
  • 6,482
  • 6
  • 36
  • 55
7
votes
1 answer

Coefficients of polynomials maxima

Is there a built-in function in maxima to get from a polynomial function a list with its coefficients? And to get the degree of the polynomial? The most similar function I found is args, but it also returns the variable together with the…
Maximator
  • 83
  • 1
  • 5
7
votes
1 answer

Fitting a polynomial with a known intercept

I am using lm(y~poly(x,2)) to fit a second-order polynomial to my data. But I just couldn't find a way to specify a known intercept value. How can I fit a polynomial model with a known intercept value (say 'k') using lm?
rm167
  • 1,185
  • 2
  • 10
  • 26
7
votes
1 answer

How is naive evaluation of polynomials bad for accuracy?

In this Code Review answer: https://codereview.stackexchange.com/a/59405/11633 I found the following (nested quote ahead!): Let me quote the wonderful book Numerical Recipes in C++ (but also applicable) We assume that you know enough never to…
Emilio M Bumachar
  • 2,532
  • 3
  • 26
  • 30
6
votes
1 answer

How to create Polynomial Ring which has Float coefficients Julia

I want to create a polynomial ring which has float Coefficients like this. I can create with integers but, Floats does not work. using Oscar S, (a,b,c,d) = PolynomialRing(QQ,["a","b","c","d"]) RR = AbstractAlgebra.RealField s1 = S( 8*a -…
6
votes
2 answers

numpy polynomial.Polynomial.fit() gives different coefficients than polynomial.polyfit()

I do not understand why polynomial.Polynomial.fit() gives coefficients very different from the expected coefficients : import numpy as np x = np.linspace(0, 10, 50) y = x**2 + 5 * x + 10 print(np.polyfit(x, y,…
manu190466
  • 1,557
  • 1
  • 9
  • 17
6
votes
1 answer

Scikit Learn PolynomialFeatures - what is the use of the include_bias option?

In scikit-learn's PolynomialFeatures preprocessor, there is an option to include_bias. This essentially just adds a column of ones to the dataframe. I was wondering what the point of having this was. Of course, you can set it to False. But…
1
2
3
65 66