Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [polynomials]

For challenges involving polynomials, mathematical expressions that consist of variables and coefficients.

Filter by
Sorted by
Tagged with
16 votes
7 answers
2k views

Is this polynomial a square?

Given an integral polynomial \$p\$, determine if \$p\$ is a square of another integral polynomial. An integral polynomial is a polynomial with only integers as coefficients. For example, \$x^2+2x+1\$ ...
user avatar
  • 32.9k
13 votes
8 answers
676 views

Chromatic polynomial of a graph

Given a undirected graph \$G\$ and a integer \$k\$, how many \$k\$-coloring does the graph have? Here by a \$k\$-coloring, we mean assigning one of the \$k\$ colors to each vertex of the graph, such ...
user avatar
  • 32.9k
4 votes
2 answers
140 views

Order of an algebraic number

Consider some arbitrary polynomial with integer coefficients, $$a_n x^n + a_{n-1}x^{n-1} + \cdots + a_1x + a_0 = 0$$ We'll assume that \$a_n \ne 0\$ and \$a_0 \ne 0\$. The solutions to this polynomial ...
user avatar
17 votes
5 answers
1k views

Are you a probabilist or a physicist?

Hermite polynomials refer to two sequences of polynomials: The "probabilist's Hermite polynomials", given by $${He}_n(x) = (-1)^n e ^ \frac {x^2} 2 \frac {d^n} {dx^n} e ^ {-\frac {x^2} 2}$$ ...
user avatar
9 votes
14 answers
1k views

ASCII-Plot the equation

You are given a polynomial function, in the following format: \$x = (c_0 * y^0) + (c_1 * y^1) + (c_2 * y^2) + ... + (c_n * y^n)\$ where \$c_n\$ stands for the coefficient of the \$n^{th}\$ power of \$...
user avatar
19 votes
3 answers
374 views

A multiple of n in every base!

In November 2019, Alon Ran published a particularly lovely sequence in the OEIS, A329126: \$a(n)\$ is the lexicographically earliest string of digits which yields a multiple of \$n\$ when read in any ...
user avatar
  • 8,097
26 votes
7 answers
908 views

Recover polynomial \$f(x)\$ from \$f^2(x)\$

Related: Calculate \$f^n(x)\$, Polynomialception Challenge Given a polynomial \$f(x) = a_0 + a_1 x + a_2 x^2 + \cdots + a_k x^k\$ of order \$k\$, we can compute its composition with itself \$f\left(f(...
user avatar
  • 62.2k
17 votes
1 answer
532 views

Golfing Expressions

We can write mathematical expressions using the standard math operators (,),+,...
user avatar
  • 271
18 votes
18 answers
2k views

Determine the degree of a polynomial

Background: For this challenge, a polynomial looks like this: $$P(x)=a_nx^n+a_{n-1}x^{n-1}+\dots+a_2x^2+a_1x+a_0$$ The degree, \$n\$, is the highest power \$x\$ is raised to. An example of a degree 7 ...
user avatar
13 votes
12 answers
953 views

Definite integral of polynomial functions

You will need to evaluate the definite integral (bounded by \$a\$ and \$b\$) of a certain polynomial function that takes the form of: $$\int_a^b \left( k_n x^n + k_{n-1} x^{n-1} + \cdots + k_2x^2 + ...
user avatar
  • 447
12 votes
18 answers
1k views

Polynomial Laplace transform

This is a repost of this challenge, intended to revamp it for looser I/O formats and updated rules You are to write a program which takes an integer polynomial in \$t\$ as input and outputs the ...
user avatar
23 votes
28 answers
3k views

"Factorise" a quadratic [duplicate]

When learning to factorise quadratics in the form \$x^2 + ax + b\$, a common technique is to find two numbers, \$p, q\$ such that $$pq = b \\ p + q = a$$ as, for such numbers, \$x^2 + ax + b = (x + p)(...
user avatar
-2 votes
1 answer
140 views

The Perfect Polynomial [closed]

The coefficients of a perfect square polynomial can be calculated by the formula \$(ax)^2 + 2abx + b^2\$, where both a and b are integers. The objective of this challenge is to create a program that ...
user avatar
  • 417
24 votes
16 answers
3k views

Laguerre Polynomials

Laguerre polynomials are solutions to Laguerre's equation, a second-order linear differential equation: \$xy''+(1-x)y'+ny=0\$. For a given value of n, the solution, y, is named \$L_n(x)\$. The ...
user avatar
  • 1,979
15 votes
14 answers
1k views

Generating generating expressions for sequences

(yes, "generating generating" in the title is correct :) ) Context In middle (?) school we are taught about sequences and, in particular, we are taught about linear sequences where the ...
user avatar
  • 13.8k
20 votes
8 answers
1k views

Counting Distinct Real Roots of Low-Degree Polynomials

Challenge: I want to know about the real roots of polynomials. As a pure mathematician, I care about the existence of such roots, rather than their numeric values. The challenge is to write the ...
user avatar
9 votes
5 answers
533 views

Computing a specific coefficient in a quotient of polynomials

Context After "Computing a specific coefficient in a product of polynomials", asking you to compute a specific coefficient of polynomial multiplication, I wish to create a "mirror" challenge, asking ...
user avatar
  • 13.8k
17 votes
7 answers
1k views

Define the finite field GF(9)

\$GF(9)\$ or \$GF(3^2)\$ is the smallest finite field whose order isn't a prime or a power of two. Finite fields of prime order aren't particurlarly interesting and there are already challenges for \$...
user avatar
  • 10.5k
10 votes
2 answers
918 views

Find the largest root of a polynomial with a neural network

The challenge Find the smallest feedforward neural network such that, given any 3-dimensional input vector \$(a,b,c)\$ with integer entries in \$[-10,10]\$, the network outputs the largest (i.e., "...
user avatar
29 votes
20 answers
3k views

Calculate the Ultraradical

What is the Ultraradical? The ultraradical, or the Bring radical, of a real number \$a\$ is defined as the only real root of the quintic equation \$x^5+x+a=0\$. Here we use \$\text{UR}(\cdot)\$ to ...
user avatar
11 votes
2 answers
447 views

​Plane​ ​Blow​up​

The Blow-up is a powerful tool in algebraic geometry. It allows the removal of singularities from algebraic sets while preserving the rest of their structure. If you're not familiar with any of that ...
user avatar
  • 43k
21 votes
4 answers
497 views

Compute height of Bowl Pile

Bowl Pile Height The goal of this puzzle is to compute the height of a stack of bowls. A bowl is defined to be a radially symmetric device without thickness. Its silhouette shape is an even ...
user avatar
  • 441
5 votes
2 answers
1k views

Point-free madness

This challenge is about Haskell point-free style polynomial functions. Although you don't need to know Haskell language to do this challenge, Haskellers might have an advantage here. Point-free ...
user avatar
  • 2,417
29 votes
26 answers
3k views

Fundamental Solution of the Pell Equation

Given some positive integer \$n\$ that is not a square, find the fundamental solution \$(x,y)\$ of the associated Pell equation $$x^2 - n\cdot y^2 = 1$$ Details The fundamental \$(x,y)\$ is a pair of ...
user avatar
  • 43k
15 votes
14 answers
2k views

Multiply Two Integer Polynomials

Your task is to take two single-variable integer polynomial expressions and multiply them into their unsimplified first-term-major left-to-right expansion (A.K.A. FOIL in the case of binomials). Do ...
user avatar
  • 9,791
13 votes
6 answers
1k views

Ryley's Theorem

S. Ryley proved following theorem in 1825: Every rational number can be expressed as a sum of three rational cubes. Challenge Given some rational number \$r \in \mathbb Q \$ find three rational ...
user avatar
  • 43k
12 votes
6 answers
548 views

Multiply numerical polynomials

A numerical polynomial is a polynomial \$p\$ in one variable with rational coefficients such that for every integer \$i\$, \$p(i)\$ is also an integer. The numerical polynomials have a basis given by ...
user avatar
  • 2,075
18 votes
19 answers
4k views

Evaluate polynomial expression string

Create a function which takes a polynomial equation, a value for x and returns the result of the operation. Example: given ...
user avatar
11 votes
3 answers
482 views

Polynomial -> Integrate

Given a polynomial in one variable with rational coefficients, output an equivalent expression containing only 1, variables, and definite integrals. For example, -...
user avatar
  • 12.7k
3 votes
2 answers
86 views

Generate lowest degree polynomial from sequence [duplicate]

Introduction A sequence of numbers is passed in as the input. The program has to generate the lowest degree polynomial possible. This was my first programming project in college and it would be ...
user avatar
38 votes
23 answers
3k views

Pretty Print Polynomials

Introduction Humans are a remarkable species, but we can be very awkward to understand sometimes—especially for computers. In particular, we seem to like writing polynomials in a very ...
user avatar
15 votes
14 answers
832 views

Euler-Poincaré-Characteristic of Polyhedra

Given a triangulation of the surface of a polyhedron p, calculate its Euler-Poincaré-Characteristic χ(p) = V-E+F, where ...
user avatar
  • 43k
12 votes
2 answers
376 views

Decompose Polynomials

Given an integral polynomial of degree strictly greater than one, completely decompose it into a composition of integral polynomials of degree strictly greater than one. Details An integral ...
user avatar
  • 43k
8 votes
6 answers
334 views

Simplify and Take Partial Derivative to a Polynomial String

Introduction Write a program to calculate the partial derivative of a polynomial (possibly multivariate) with respect to a variable. Challenge Derivatives are very important mathematical tools that ...
user avatar
  • 3,566
14 votes
11 answers
3k views

Find The Local Maxima And Minima

Definition The maxima and minima of a given function are the largest and smallest values of the function either within a given range or otherwise within the entire domain of the function. Challenge ...
user avatar
  • 4,920
19 votes
17 answers
2k views

Find Integral Roots of A Polynomial

Challenge The challenge is to write a program that takes the coefficients of any n-degree polynomial equation as input and returns the integral values of x for which the equation holds true. The ...
user avatar
  • 4,920
7 votes
2 answers
319 views

Rational Polynomial Interpolation

Explanation In this task you'll be given a set of N points (x1,y1),…,(xN,yN) with distinct xi values and your task is to interpolate a polynomial through these points. If you know what Lagrange ...
user avatar
  • 16.4k
13 votes
9 answers
2k views

Characteristic polynomial

The characteristic polynomial of a square matrix \$A\$ is defined as the polynomial \$p_A(x) = \det(Ix-A)\$ where \$I\$ is the identity matrix and \$\det\$ the determinant. Note that this definition ...
user avatar
  • 16.4k
17 votes
12 answers
2k views

Cyclotomic polynomial

Background (skip to definitions) Euler proved a beautiful theorem about the complex numbers: \$e^{ix} = \cos(x) + i \sin(x)\$. This makes de Moivre's theorem easy to prove: $$ (e^{ix})^n = e^{i(nx)} \\...
user avatar
  • 48.2k
28 votes
16 answers
3k views

Многочлены Чебышёва (Chebyshev Polynomials)

Chebyshev Polynomials are a family of orthogonal polynomials that pop up in all kinds of places in math, and they have a lot of quite interesting properties. One characterization of them is that they ...
user avatar
  • 43k
20 votes
25 answers
1k views

Calculate the n-th iterate of a polynomial for a specific value; fⁿ(x)

Given a polynomial function f (e.g. as a list p of real coefficients in ascending or descending order), a non-negative integer n, and a real value x, return:    f n(x) i.e. the value of f (f (f (…f (x)...
user avatar
  • 27.2k
12 votes
6 answers
416 views

Find the coefficients of a rational generating function

If we write a sequence of numbers as the coefficients of a power series, then that power series is called the (ordinary) generating function (or G.f.) of that sequence. That is, if for some function <...
user avatar
  • 38.7k
7 votes
4 answers
441 views

Add up two algebraic numbers

Definitions An algebraic number is a number that is a zero of a non-zero polynomial with integer coefficients. For example, the square root of 2 is algebraic, ...
user avatar
  • 48.2k
11 votes
10 answers
948 views

Rotate the Roots

Given a nonzero polynomial with integer coefficients and roots that are on the imaginary and on the real line such that if a is a root then so is ...
user avatar
  • 43k
24 votes
7 answers
1k views

Find the binarray!

We define a binarray as an array satisfying the following properties: it's non-empty the first value is a 1 the last value is a ...
user avatar
  • 166k
22 votes
8 answers
1k views

Find the polynomial

We know that f is a polynomial with non-negative integer coefficients. Given f(1) and f(1+f(1)) return f. You may output f as a list of coefficients, an ASCII formatted polynomial, or similar. ...
user avatar
  • 38.7k
8 votes
3 answers
342 views

Detect a Symmetric polynomial [closed]

A symmetric polynomial is a polynomial which is unchanged under permutation of its variables. In other words, a polynomial f(x,y) is symmetric if and only if ...
user avatar
  • 5,271
24 votes
9 answers
1k views

Calculate Power Series Coefficients

Given a polynomial \$p(x)\$ with integral coefficients and a constant term of \$p(0) = \pm 1\$, and a non-negative integer \$N\$, return the \$N\$-th coefficient of the power series (sometimes called &...
user avatar
  • 43k
30 votes
13 answers
4k views

Absolute Sums of Sidi Polynomial Coefficients

Background The Sidi polynomial of degree \$n\$ – or the \$(n + 1)\$th Sidi polynomial – is defined as follows. $$S_n(x) = \sum^n_{k=0}s_{n;k}x^n \text{ where } s_{n;k} = (-1)^k\binom n k (k+1)^n$$ The ...
user avatar
  • 206k
20 votes
4 answers
479 views

Locally invert a Polynomial

Challenge Given a polynomial p with real coefficients of order 1 and degree n, find another ...
user avatar
  • 43k