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
5
votes
2 answers

Extract coefficients and corresponding monomials from a given polynomial in SymPy

Given a symbolic multivariate polynomial P, I need to extract both its coefficients and corresponding monomials as lists: def poly_decomp(P): .... return coeffs, monoms such that P is the dot product of coefficients and monomials, e.g., if…
Hyperplane
  • 1,422
  • 1
  • 14
  • 28
5
votes
3 answers

How to find the best degree of polynomials?

I'm new to Machine Learning and currently got stuck with this. First I use linear regression to fit the training set but get very large RMSE. Then I tried using polynomial regression to reduce the bias. import numpy as np from sklearn.linear_model…
5
votes
1 answer

Reading a text file and converting them into polynomials

I currently have a text file as follows: 3 5 6 9 3 4 6 7 2 3 5 7 2 5 3 The file when read into java should be displayed as 3x^5 + 6x^9. The second line would be read as 4x^4 + 6x^7 + 2. The cannot get my program to display this as I dont know how…
Dangerous Game
  • 103
  • 1
  • 1
  • 6
5
votes
1 answer

Solving polynomials with complex coefficients using sympy

I'm very new to python so forgive me if this has a simple fix. I'm trying to solve polynomials with complex coefficients using sympy. I find that I get a blank output if k is 'too complicated'... I'm not quite sure how to define what that means just…
ben_afobe
  • 95
  • 4
5
votes
3 answers

Checking the error detection capabilities of CRC polynomials

I tried to find out how to calculate the error detection capabilities of arbitrary CRC polynomials. I know that there are various error detection capabilities that may (or may not) apply to an arbitrary polynomial: Detection of a single bit…
Silicomancer
  • 8,604
  • 10
  • 63
  • 130
5
votes
1 answer

Why is Numpy inconsistent in ordering polynomial coefficients by degree?

numpy.polynomial.polynomial.Polynomial stores polynomial coefficients in order of increasing degree, while numpy.poly1d stores polynomial coefficients in order of decreasing degree. Is there a reason for this difference? Is there an advantage to…
rlchqrd
  • 519
  • 4
  • 11
5
votes
3 answers

Polynomial function cannot be solved by Python sympy

I have problems by solving a polynomial function with sympy. The following example shows a case which gives an error message that I cannot manage. If the polynomial gets simpler the solver works properly. Please copy and paste the code to check the…
Aloex
  • 103
  • 8
5
votes
2 answers

Implementation of Poincaré–Miranda theorem

To test whether a continuous function has a root one simple root in a given interval [x0, x1] is relatively easy: according to Intermediate value theorem when the sign of function value at x0 is opposite to the sign at x1, there is (at least) one…
Ecir Hana
  • 10,864
  • 13
  • 67
  • 117
5
votes
2 answers

NameError when using Sage polynomials

I read here how to work with polynomials. But when I try this R = QQ['t'] poly = (t+1) * (t+2); poly Sage gives me the following error: NameError: name 't' is not defined What can I do about it?
principal-ideal-domain
  • 3,998
  • 8
  • 36
  • 73
5
votes
1 answer

Java library for estimating a polynomial based on a set of points

The polynomial's degree should be # of points - 1 e.g. if there are 2 points given it should be a line. I know I can solve this using a matrix e.g. if there are 4 points: the polynomial would be y = ax^3 + bx^2 + cx + d and the matrix would be |…
user3669539
  • 139
  • 1
  • 9
5
votes
2 answers

How do you make R poly() evaluate (or "predict") multivariate new data (orthogonal or raw)?

With the poly function in R, how do I evaluate a multivariate polynomial? This post has 4 questions total, highlighted below. I'm seeking to evaluate the output of a poly()-output object (orthogonal or raw polynomials). Such would give me the…
blake
  • 119
  • 1
  • 5
5
votes
1 answer

Why does Sympy cut off polynomial terms with small coefficients?

I am trying to convert an expression containing terms with various degrees of a symbolic variable z_s into a polynomial in python using sympy.Poly() so that I can then extract the coefficients using .coeffs(). The expression I have is a high-order…
5
votes
1 answer

Optimizing a set of polynomials for computation speed

I have a set of polynomial expressions produced by a computer algebra system (CAS). For example, this is one element of this…
4
votes
2 answers

When and how to use Polynomial.fit() as opposed to polyfit()?

Using Python 3.10.0 and NumPy 1.21.4. I'm trying to understand why Polynomial.fit() calculates wildly different coefficient values from polyfit(). In the following code: import numpy as np def main(): x = np.array([3000, 3200, 3400, 3600, 3800,…
JYPerez
  • 60
  • 4
4
votes
0 answers

In Sympy is there a way to get a representation of Groebner basis in terms of defining polynomials?

In Sympy one can obtain the representation of a polynomial's reduction by a Grobner basis: from sympy import groebner, expand from sympy.abc import x, y f = 2*x**4 - x**2 + y**3 + y**2 G = groebner([x**3 - x, y**3 - y]) Q, r = G.reduce(f) assert f…