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
3 answers

efficiently approximate real solution for polynomial function

I want to efficiently solve a degree-7 polynomial in k. For example, with the following set of 7 unconditional probabilities, p <- c(0.0496772, 0.04584501, 0.04210299, 0.04026439, 0.03844668, 0.03487194, 0.03137491) the overall event probability is…
jayb
  • 555
  • 3
  • 15
4
votes
3 answers

I would like to print superscript and subscript with printf, like x¹?

I want to print out a polynomial expression in c but i don't know print x to the power of a number with printf
4
votes
2 answers

Numerically calculate combinations of factorials and polynomials

I am trying to write a short C++ routine to calculate the following function F(i,j,z) for given integers j > i (typically they lie between 0 and 100) and complex number z (bounded by |z| < 100), where L are the associated Laguerre Polynomials: The…
fromGiants
  • 474
  • 1
  • 7
  • 16
4
votes
2 answers

Finding roots of 4th degree polynomial using tensorflow by Halley's method

I've just started learning tensorflow, and basically I'm learning to do various numerical computations using tensorflow rather than directly jumping into its use in ML. I'm doing this on the Google Cloud Platform, where I came across this problem…
4
votes
2 answers

Fast polynomial shift

I'm trying to implement "F. The convolution method" (section 2.2): from Fast algorithms for Taylor shifts and certain difference equations (at the bottom, or here): from math import factorial def convolve(f, h): g = [0] * (len(f) + len(h) -…
Ecir Hana
  • 10,864
  • 13
  • 67
  • 117
4
votes
2 answers

Finding the roots of a polynomial

Given a polynomial of degree n, how can I reliably find all values of x where y = 0. I'm currently using the Math.Polynomial library, which doesn't seem to have this function built in. However, I could be missing something here, it seems like this…
user1890615
4
votes
2 answers

How does one organize the coefficients of PolynomialFeatures in Lexicographical order so that they match sympy for a multivariate polynomial?

I had a set of parameters that I manually (I want it manual) fitted with the pseudo-inverse using PolynomialFeatures: poly_feat = PolynomialFeatures(degree=Degree_mdl) Kern_train = poly_feat.fit_transform(X_train) c_pinv = np.dot(np.linalg.pinv(…
Charlie Parker
  • 5,884
  • 57
  • 198
  • 323
4
votes
4 answers

Polynomials as input in Python

How can you make Python take a polynomial as an input while maintaining the ability to substitute x for a real value? Here is what I tried: fx=input("Enter a Polynomial: ") x=float(input("At wich position should the polynomial be evaluated:…
Christian Singer
  • 295
  • 3
  • 5
  • 15
4
votes
3 answers

polynomial evaluation time complexity

I was going through this link : http://www.geeksforgeeks.org/horners-method-polynomial-evaluation/ Here it says that the time complexity using normal method is O(n^2).But I wonder how?Here is my analysis about this: Suppose we have an equation…
Reckoner
  • 1,041
  • 2
  • 13
  • 29
4
votes
1 answer

Multivariate polynomial division in sage

I try to do a simple division of polynomials in two variables using sage. Unfortunately, I get an unexpected result, as is illustrated in the code below. I tried several different ways to instantiate the ring and its variables, but the result stays…
Jesper Freesbug
  • 415
  • 4
  • 11
4
votes
1 answer

Error when using `D` to get derivative of my regression polynomial

I have points on a 2D graph. I want to find the best 3rd polynomial that fits this model and get its first derivative. But I can't get D function working. Here is simple example: a <- 0:10 b <- c(2, 4, 5, 8, 9, 12, 15, 16, 18, 19, 20) plot(a, b) m1…
Bobesh
  • 1,157
  • 2
  • 15
  • 30
4
votes
2 answers

Find the coefficients of the polynomial given its roots

I am trying to write an algorithm which will find a(0),..., a(n-1), given the values of n, x_1, ..., x_n, a(n), such that: a(n)*p^n + a(n-1)*p^(n-1) + ... + a(1)*p + a(0) = a(n)(p-x_1)(p-x_2)...(p-x_n) for all real p. After multiplying…
Don
  • 143
  • 1
  • 5
4
votes
2 answers

What's the best way to compute the coefficients of a polynomial from its roots?

The poly function takes the roots of a polynomial as the input and returns the polynomial's coefficients. What is the underlying algorithm? Is there a better way to compute the coefficients of a polynomial from its roots?
swap96
  • 75
  • 1
  • 1
  • 11
4
votes
1 answer

Creating a python lmfit Model with arbitrary number of parameters

Is there a way to construct a an lmfit Model based on a function with an arbitrary number of dependent variables? For example: from lmfit import Model def my_poly(x, *params): func = 0 for i in range(len(params)): func+= params[i]*z**i …
Brian Pollack
  • 198
  • 3
  • 12
4
votes
1 answer

Why does sympy.diff not differentiate sympy polynomials as expected?

I am trying to figure out why sympy.diff does not differentiate sympy polynomials as expected. Normally, sympy.diff works just fine if a symbolic variable is defined and the polynomial is NOT defined using sympy.Poly. However, if the function is…