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
4
votes
1 answer

A numpy/scipy function to calculate the "polynomial coefficient"

Is there any python function (perhaps from numpy or scipy) that calculates the coefficient of x**r in the expansion of (1+x+x**2+x**3+...+x**(k-1))**n, where k>=1, n>=0 and 0<=r<=n(k-1)? This is sometimes called polynomial coefficient (PC) (see, for…
Bach
  • 6,145
  • 7
  • 36
  • 61
3
votes
3 answers

Get Polynomial X at Y? (Python 3.10, NumPy)

I'm attempting to calculate all possible real X-values at a certain Y-value from a polynomial given in descending coefficent order, in Python 3.10. I want the resulting X-values to be provided to me in a list. I've tried using the roots() function…
Runsva
  • 365
  • 1
  • 7
3
votes
0 answers

How to change The Ring of the polynomial in Julia

Main using AbstractAlgebra include("./lib.jl"); S, (a,b,c) = PolynomialRing(QQ,["a","b","c"]) RR = AbstractAlgebra.RealField s1 = S(b^2*a + c*a - 1) s2 = S(c*a^2 + -b*a - c^4*a) s3 = S(b*a + a + b) poly_list =…
3
votes
0 answers

Efficiently evaluate large polynomials using SIMD

I have quite large (20-40 degree) slowly-converging (sometimes) floating-point polynomials. I'd like to optimize their evaluation using SIMD (SSE2, AVX1, AVX-512). I need both float-32 and double-64 solutions. Value of coefficients are constants…
Arty
  • 14,883
  • 6
  • 36
  • 69
3
votes
1 answer

Doesn't introduction of polynomial features lead to increased collinearity?

I was going through Linear and Logistic regression from ISLR and in both cases I found that one of the approaches adopted to increase the flexibility of the model was to use polynomial features - X and X^2 both as features and then apply the…
3
votes
2 answers

Fitting a polynomial with numpy changes with dtype, even though actual data values remain the same

I have a dataset comprised of xdata and ydata that I want to fit a polynomial to, but for some reason, the fitting results depend on the dtype of the dataset, even though the actual values of the data remain unchanged. I understand that if you…
mapf
  • 1,906
  • 1
  • 14
  • 40
3
votes
1 answer

Evaluating numpy polynomial returns the wrong values

I have a linear numpy polynomial with coefficients c=2.44717404e-03 and m=1.88697661e+01, but when I try to evaluate it, it gives the wrong output. f=np.polynomial.polynomial.Polynomial([2.44717404e-03,…
Rational Function
  • 425
  • 1
  • 3
  • 10
3
votes
3 answers

Finding a derivative of a polynomial in Python

I have a problem with this task. I have to print a polynomial, which is an input from a user. (I have problem with this too because it can be polynomial of any degree and I'm not so sure how to print it). The second part of the task is to find a…
3
votes
1 answer

R: How can I use R's formula notation to compactly produce all but a selected subset of quadratic terms?

I'd like a way to compactly use R's formula notation -- or some other formalism --to include all the quadratic terms between a set of variables A through E, excluding the D:E interaction. (My real problem has a longer list of A - C type variables…
andrewH
  • 2,281
  • 2
  • 22
  • 32
3
votes
1 answer

MATLAB Curve Fitting in 3D, with additional boundaries

Introduction Let's say I have a set of experimental data, and need to find a polynomial approximation, which describe selected series. The experiment result depends on two variables - time and concentration. Let the exemplary data looks as…
3
votes
1 answer

FFT polynomial multiplication in Python using inbuilt Numpy.fft

I want to multiply two polynomials fast in python. As my polynomials are rather large (> 100000) elements and I have to multiply lots of them. Below, you will find my approach, from numpy.random import seed, randint from numpy import polymul, pad…
Rick
  • 361
  • 5
  • 17
3
votes
1 answer

NTL library GF2X

I am experimenting with the Galois Field using the NTL library. GF2 are the integers mod 2, GF2X are polynomials over GF2 and GF2E is the ring/field extension over GF2. The problem that I am facing is that I initialize the irreducible polynomial as…
m0ur
  • 97
  • 2
  • 11
3
votes
2 answers

For a polynomial, get all its extrema and plot it by highlighting all monotonic pieces

Someone asked me this interesting question and I think it worthwhile posting it here, as there has not been any relevant thread on Stack Overflow. Suppose I have polynomial coefficients in a length-n vector pc, where a polynomial of degree n - 1 for…
Zheyuan Li
  • 71,365
  • 17
  • 180
  • 248
3
votes
0 answers

How to avoid the error thrown by the maxima function polynomialp?

Look at the following two sequences of two commands. They are the same up to the choice of variable a or z, but the version with a produces an error whereas the function with z does not. First run (after a restart of maxima): declare(a,constant);…
3
votes
1 answer

np.polyfit plot with uncertainty on the y in python

I have the following dataframe: x y error_on_y 1 1.2 0.1 2 0.87 0.23 4 1.12 0.11 5 0.75 0.06 5 0.66 0.15 6 0.98 0.08 7 1.34 0.05 7 2.86 …
Jonas
  • 67
  • 9