Polynomial Math is a subset of mathematics dealing with mathematical expressions constructed from variables and constants using only the operations of addition, subtraction, multiplication, and non-negative integer exponents. Any polynomial math question should be programming related.
Questions tagged [polynomial-math]
630 questions
3
votes
2 answers
polynomial transformation in python
I'm trying to shift a polynomial. I'm currently using numpy.poly1d() to make a quadratic equation.
example: 2x^2 + 3x +4
but I need to shift the function by tau, such that
2(x-tau)^2 + 3(x-tau) + 4
Tau is a value that will change base on some…

hndl_w_cr17
- 31
- 1
3
votes
1 answer
Accuracy and polynomial evaluation in Fortran and Python
I'll give a quick description here and the context below. I'm evaluating bivariate polynomials (polynomials of 2 variables) in both Python and Fortran and getting different results. The relative error for my test case - 4.23e-3 - is large enough to…

Jareth Holt
- 321
- 1
- 10
3
votes
0 answers
Closed form cubic root finder implementation
I'm looking for a non-iterative function that finds the real roots of cubic polynomials. So, an implementation of something like this.
I could write it myself of course, but if someone already has an implementation and doesn't mind sharing it, that…

CromTheDestroyer
- 3,616
- 3
- 20
- 26
3
votes
0 answers
Order of coefficients in polynomial linear regression
I'm building a simple polynomial model in Python using sklearn. My training set consists of 3-feature vectors (i.e. RGB triplets). I'm fitting a model using the following code:
degree = 1
model = make_pipeline(PolynomialFeatures(degree),…

karl71
- 1,082
- 2
- 18
- 29
3
votes
1 answer
How to perform polynomial addition and multiplication using python 3.x?
For instance, 3x^4 - 17x^2 - 3x + 5. Each term of the polynomial can be represented as a pair of integers (coefficient, exponent). i.e. [(3,4),(-17,2), (-3,1), (5,0)]
We have the following constraints to guarantee that each polynomial has a unique…

Sandeep Kumar Kushwaha
- 167
- 7
3
votes
1 answer
std::regex to identify coefficient of polynomial equation
I am new to C++ and I am asked to create a solver of a second degree polynomial function. To do this, I first need to parse the equation and reduce it to show it in the reduced form, i.e:
8 * X^0 - 6 * X^1 + 5.6 * X^2 = 3 * X^0
becomes
5 * X^0 - 6…

ziKmouT
- 175
- 2
- 2
- 13
3
votes
1 answer
Is this a bug in NSolve in mathematica?
One would expect and hope that if you ask Mathematica to find the roots of a polynomial, it should give the same (approximate) answers whether you do this symbolically, then find numerical approximations to these exact answers, or whether you do it…

Scott Morrison
- 3,100
- 24
- 39
3
votes
1 answer
3D Polynomial Regression
I need some pointers for writing a polynomial regression routine for 3-dimensional points (i.e. find the coefficients of an X order polynomial that is fitted to a certain number of 3D points).
I've found code for 2D polynomial regression, however, I…

Installer
- 116
- 1
- 5
3
votes
1 answer
Binary XGCD for polynomials
There exists a binary GCD algorithm for finding the greatest common divisor of a number. In general, the GCD can be extended to the XGCD, which can help find a multiplicative inverse in a field.
I am working with binary numbers that represent a…

Sebastian
- 313
- 1
- 15
3
votes
2 answers
How can I use gsl to calculate polynomial regression data points?
(Disclaimer: I am terrible with math and am coming from JavaScript, so I apologize for any inaccuracies and will do my best to correct them.)
The example on Rosetta Code shows how to calculate coefficients using gsl. Here is the…

Chad Johnson
- 21,215
- 34
- 109
- 207
3
votes
2 answers
Can't figure out how to calculate 4th degree polynomials
I'm attempting to create a function that calculates the 4 roots of a 4th degree polynomial with included complex numbers. In my search for a formula, I came across a rather simple one contained in this discussion, described by Tito Piezas III…

daedsidog
- 1,732
- 2
- 17
- 36
3
votes
4 answers
How do you compute the XOR Remainder used in CRC?
I'm trying to remember how the math is worked out to compute the remainder of an XOR algorithm in Cyclical Redundancy Checks to verify the remainder bits of a network message.
I shouldn't have tossed that text book.
This is easily done in code, but…

Jeremiah
- 5,386
- 9
- 38
- 45
3
votes
2 answers
A faster numpy.polynomial?
I have a very simple problem: in my python toolbox, I have to compute the values of polynomials (usually degree 3 or 2, seldom others, always integer degree) from a large vector (size >> 10^6). Storing the result in a buffer is not an option because…
user3498123
3
votes
2 answers
Generating the coefficients of a Chebyshev polynomial in Python
I am trying to compute the coefficients of the kth Chebyshev polynomial. Let's just set k to 5 for this. So far, I have the following:
a = (0,0,0,0,0,1) #selects the 5th Chebyshev polynomial
p = numpy.polynomial.chebyshev.Chebyshev(a) #type here is…

N. Mao
- 499
- 1
- 10
- 19
3
votes
2 answers
Binomial expansion with fractional powers in Python
Is there a quick method of expanding and solving binomials raised to fractional powers in Scypy/numpy?
For example, I wish to solve the following equation
y * (1 + x)^4.8 = x^4.5
where y is known (e.g. 1.03).
This requires the binomial expansion of…

smashbro
- 1,094
- 1
- 9
- 19