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

782 questions
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
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,246
  • 6
  • 31
  • 53
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?
MaMu
  • 1,076
  • 2
  • 7
  • 24
6
votes
3 answers

How to fit a polynomial with some of the coefficients constrained?

Using NumPy's polyfit (or something similar) is there an easy way to get a solution where one or more of the coefficients are constrained to a specific value? For example, we could find the ordinary polynomial fitting using: x = np.array([0.0, 1.0,…
Jenny Shoars
  • 814
  • 1
  • 14
  • 34
6
votes
4 answers

How to detect in real time a "knee/elbow" (maximal curvature) in a curve

In the following curve (blue line) I'm trying to detect the "knee/elbow" which should be located around x = 2.5 This is the set of values I'm using: x = {-10, -9, -8, -7, -6, -5, -4, -3, -2 , -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} y = {0, 10, 20,…
Marco
  • 261
  • 4
  • 14
6
votes
3 answers

Function for polynomials of arbitrary order (symbolic method preferred)

I've found polynomial coefficients from my data: R <- c(0.256,0.512,0.768,1.024,1.28,1.437,1.594,1.72,1.846,1.972,2.098,2.4029) Ic <- c(1.78,1.71,1.57,1.44,1.25,1.02,0.87,0.68,0.54,0.38,0.26,0.17) NN <- 3 ft <- lm(Ic ~ poly(R, NN, raw = TRUE)) pc <-…
user4489658
6
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
  • 73
  • 1
  • 5
6
votes
1 answer

When can the Master Theorem actually be applied?

I am quite frustrated over this. In CLRS 3rd edition, page 95 (chapter 4.5), it mentions that recurrences like T(n) = 2T(n/2) + n lg n cannot be solved with the Master Theorem because the difference f(n)/n^(log_b(a)) = (n lg n)/n^1 = lg n is not…
AJJ
  • 1,794
  • 3
  • 22
  • 34
6
votes
1 answer

How to analyse a sparse adjacency matrix?

I am researching sparse adjacency matrices where most cells are zeros and some ones here-and-there, each relationship between two cells has a polynomial description that can be very long and their analysis manually time-consuming. My instructor is…
hhh
  • 44,388
  • 56
  • 154
  • 251
6
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,352
  • 2
  • 24
  • 29
6
votes
2 answers

numpy calculate polynom efficiently

I'm trying to evaluate polynomial (3'd degree) using numpy. I found that doing it by simpler python code will be much more efficient. import numpy as np import timeit m = [3,7,1,2] f = lambda m,x: m[0]*x**3 + m[1]*x**2 + m[2]*x + m[3] np_poly =…
mclafee
  • 1,206
  • 3
  • 14
  • 23
5
votes
1 answer

Plotly: How to add polynomial fit line to plotly go.scatter figure using a DASH callback?

I'd like to add a polynomial curve to a scatter plot that is rendered using a callback. Following is my callback function which returns the scatter plot. @app.callback(Output('price-graph', 'figure'), [ Input('select',…
kms
  • 741
  • 7
  • 22
5
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
  • 9,528
  • 15
  • 60
  • 125
5
votes
2 answers

Naive Recursive Algorithm for Polynomial Multiplication in Python

I am trying to implement the divide-and-conquer algorithm for polynomial multiplication. Here is the pseudocode given in the lecture notes: where A, B are lists of coefficients of each polynomial, n is the size of the problem (degree - 1) and a_l,…
5
votes
1 answer

Yun's algorithm

I would like to try to implement Yun's algorithm for square-free factorization of polynomials. From Wikipedia (f is the polynomial): a0 = gcd(f, f'); b1 = f/a0; c1 = f'/a0; d1 = c1 - b1'; i = 1 repeat ai = gcd(bi, di); bi+1 = bi/ai; ci+1 = di/ai; i…
minmax
  • 465
  • 2
  • 9
1
2
3
52 53