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

Roots of a Quartic Function

I came across a situation doing some advanced collision detection, where I needed to calculate the roots of a quartic function. I wrote a function that seems to work fine using Ferrari's general solution as seen here:…
Scott Langendyk
  • 311
  • 5
  • 14
4
votes
2 answers

Finding real roots of quartic equation using ferrari's method

I am currently trying to solve a quartic equation using Ferrari's method from Wikipedia. I want to retrieve only the real roots, discarding the imaginary one. My implementation does not return the good value for real roots. I can't find the mistakes…
MiniW
  • 193
  • 13
4
votes
3 answers

Best way to store multi variable polynomials in Lisp

I need to store polynomials in my lisp program for adding, subtracting and multiplying. But cannot find an easy way of storing one. I've considered the following way (2x^3 + 2x + 4y^3 - 2z) in a list of lists where each list is a list of the amount…
sam
  • 123
  • 2
  • 8
4
votes
1 answer

Modular Reduction of Polynomials in NTRUEncrypt

I'm implementing the NTRUEncrypt algorithm, according to an NTRU tutorial, a polynomial f has an inverse g such that f*g=1 mod x, basically the polynomial multiplied by its inverse reduced modulo x gives 1. I get the concept but in an example they…
Mohammad Sepahvand
  • 17,364
  • 22
  • 81
  • 122
4
votes
1 answer

NTRU Pseudo-code for computing Polynomial Inverses

I was wondering if anyone could tell me how to implement line 45 of the following pseudo-code. Require: the polynomial to invert a(x), N, and q. 1: k = 0 2: b = 1 3: c = 0 4: f = a 5: g = 0 {Steps 5-7 set g(x) = x^N - 1.} 6: g[0] = -1 7: g[N] = 1 8:…
Mohammad Sepahvand
  • 17,364
  • 22
  • 81
  • 122
4
votes
2 answers

Implementing Recursion from pseudo-code (NTRUEncrypt)

I am required to implement the NTRU Public Key Cyptosystem as part of my final year University project. I'm trying to implement an algorithm that multiplies long polynomials via recursion, however I'm quite bogged down in trying to understand the…
Mohammad Sepahvand
  • 17,364
  • 22
  • 81
  • 122
4
votes
5 answers

Calculating the area underneath a mathematical function

I have a range of data that I have approximated using a polynomial of degree 2 in Python. I want to calculate the area underneath this polynomial between 0 and 1. Is there a calculus, or similar package from numpy that I can use, or should I just…
djq
  • 14,810
  • 45
  • 122
  • 157
4
votes
3 answers

Solving a system of cubic polynomials (to find intersection of Bezier curves)

Can anyone suggest a fix or an alternate route to find the solutions to this system? In particular I only care about solutions (s,t) in [0,1]x[0,1] Note: I'm looking for the intersection of two cubic Bezier curves here. I need the method to be…
4
votes
2 answers

numpy.polyfit with adapted parameters

Regarding to this: polynomial equation parameters where I get 3 parameters for a squared function y = a*x² + b*x + c now I want only to get the first parameter for a squared function which describes my function y = a*x². With other words: I want to…
Munchkin
  • 4,528
  • 7
  • 45
  • 93
4
votes
2 answers

Get coefficients of symbolic polynomial in Matlab

I have a Matlab function that returns a polynomial of the form: poly = ax^2 + bx*y + cy^2 where a, b, and c are constants, and x and y are symbolic (class sym). I want to get the coefficients of the polynomial in the form [a b c], but I'm running…
4
votes
3 answers

Calculate roots of multiple polynomials

Given a matrix A that represents polynomials in each column. How can the roots of each polynomial be calculated efficiently without loops?
Razer
  • 7,843
  • 16
  • 55
  • 103
4
votes
2 answers

Is there a library for HUGE integers

I am looking for a Java library that can handle truly huge numbers or suggestions as to how to implement this myself. We are talking way beyond BigInteger. How about 2^39614081257132168796771974655+1 for example. Clearly I could, theoretically, make…
OldCurmudgeon
  • 64,482
  • 16
  • 119
  • 213
4
votes
2 answers

matlab functions works wrong

I trying to make such function in matlab It must be an array of l_k wheres k from 1 to n but however. In code: x - some vector(array), z - scalar; in code w is upper part of frac and g is lower. function out_l = l_k(z, x) %вычисления массива l_k…
DanilGholtsman
  • 2,354
  • 4
  • 38
  • 69
4
votes
3 answers

Finding roots of polynomial in Java

I need to find a (approximate, numerical) solution to a Legendre polynomial. I tried several Java libraries, but none have what I am looking for (the closest is commons-math which even has code for finding the solutions in the Laguerre solver, but…
Maciej Piechotka
  • 7,028
  • 6
  • 39
  • 61
4
votes
2 answers

Need Python polynomial fit function that returns covariance

I want to do least-squares polynomial fits on data sets (X,Y,Yerr) and obtain the covariance matrices of the fit parameters. Also, since I have many data sets, CPU-time is an issue, so I'm seeking an analytical (=fast) solution. I found the…
Rolf Bartstra
  • 1,643
  • 1
  • 16
  • 19