Questions tagged [polynomial-math]

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.

630 questions
6
votes
3 answers

Solving simultaneous multivariate polynomial equations with python

edit: the reference I got my equations from contained a couple of errors. I've fixed it here. Solutions might actually make sense now! When a two layer fluid flows over topography, there exist a number of different solutions depending on the…
aaren
  • 5,325
  • 6
  • 29
  • 24
6
votes
2 answers

maximum of a polynomial

I have a polynomial of order N (where N is even). This polynomial is equal to minus infinity for x minus/plus infinity (thus it has a maximum). What I am doing right now is taking the derivative of the polynomial by using polyder then finding the…
jkt
  • 2,538
  • 3
  • 26
  • 28
6
votes
1 answer

Intersection of Zero-Suppressed BDD -- Implementing polynomials using ZDDs

I'm trying to implement univariate polynomials using ZDDs, as suggested in a comment in an other question. I've read the paper of S. Minato(you may download it here), but I don't understand how to implement the operations on these ZDDs. The idea in…
Bakuriu
  • 98,325
  • 22
  • 197
  • 231
6
votes
3 answers

How can I solve a fifth degree polynomial in C++

I have a quintic function (5th degree polynomial) and I would like to solve it in C++. Is there an implementation or a math library I can use in order to proceed?
topless
  • 8,069
  • 11
  • 57
  • 86
6
votes
1 answer

Calculate trendline and predict future results

I'm writing some analytics modules for the site I'm working on and I need to estimate the total views after the current hour. I have data for every minute up to the current minute, so if the time is 12:28, I will have an array that looks something…
Nick Brunt
  • 9,533
  • 10
  • 54
  • 83
5
votes
2 answers

Sum of products taking k elements from a set of n elements

Given a set S with n elements, and an integer k. I need to find the sum of products of all n choose k pairs. That is, if S = {1,2,3,4} and k = 2, then I am looking for P = 1*2 + 1*3 + 1*4 + 2*3 + 2*4 +3*4. Note that product-pairs constitute the set…
5
votes
2 answers

Message parity check

Can someone help me out with implementing this sequence of calculations in C#?
redfrogsbinary
  • 619
  • 5
  • 13
  • 26
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
  • 493
  • 3
  • 10
5
votes
3 answers

Polynomial multiplication complexity reduction

I have been trying to figure tis ou for 3 days and have not gotten anywhere. I have to implement polynomial multiplication (multiply 2 quadratic equations). They look like: ( a1 x^2 + b1 x + c1 ) * ( a2 x^2 + b2 x + c2 ); But the trickier part is…
Brahadeesh
  • 2,245
  • 8
  • 40
  • 58
5
votes
2 answers

Interpolate polynomial over a finite field

I want to use python interpolate polynomial on points from a finite-field and get a polynomial with coefficients in that field. Currently I'm trying to use SymPy and specifically interpolate (from sympy.polys.polyfuncs), but I don't know how to…
Avihu28
  • 177
  • 2
  • 8
5
votes
2 answers

How to calculate error in Polynomial Linear Regression?

I am trying to calculate the error rate of the training data I'm using. I believe I'm calculating the error incorrectly. The formula is as shown: y is calculated as shown: I am calculating this in the function fitPoly(M) at line 49. I believe I…
Andrew Raleigh
  • 311
  • 3
  • 13
5
votes
2 answers

Horner's rule for two-variable polynomial

Horner's rule is used to simplify the process of evaluating a polynomial at specific variable values. https://rosettacode.org/wiki/Horner%27s_rule_for_polynomial_evaluation#Standard_ML I've easily applied the method using SML, to a one variable…
5
votes
1 answer

Find a root of a polynomial modulo 2^r

I have a polynomial P and I would like to find y such that P(y) = 0 modulo 2^r. I have tried something along the lines of Hensel lifting, but I don't know if this could even work, because of the usual condition f'(y mod 2) != 0 mod 2 which is not…
Monica
  • 53
  • 2
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