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
2
votes
2 answers

What is wrong with this P argument

My teacher made this argument and asked us what could be wrong with it. for an array A of n distinct numbers. Since there are n! permutations of A, we cannot check for each permutation whether it is sorted, in a total time which is polynomial in n.…
2
votes
2 answers

How to use fzero() to solve polynomial equation in MATLAB?

I would like to solve the following polynomial numerically for r: I am trying to use fzero() as follows: r = (5/(r^2*9))- ((2)/(9*(6-r)^2)) x0 = 10; % some initial point x = fzero(r,x0) How can this be done with fzero()?
2
votes
1 answer

Polynomially larger - confusion

I am studying for my algorithms class. I have a question in context to the Masters theorem: How is n.log2(n) polynomially larger than n^(log4(3)) (log2(x) = log to the base 2 of x  log4(x) = log to the base 4 of x) (Note: This is a solved problem…
rgamber
  • 5,749
  • 10
  • 55
  • 99
2
votes
2 answers

How to print string representation of a nth degree polynomial whose co-efficients are known in Python?

Suppose i have the coefficients of a polynomial.How to write it in the usual form we write in pen and paper?E.g. if i have coefficients=1,-2,5 and the polynomial is a quadratic one then the program should print x**2-2*x+5. 1*x**2-2*x**1+5*x**0 will…
2
votes
2 answers

How to fit a polynomial (using np.polyfit or something else) under conditions on intercept?

I want to write a generic function that takes as input two 1-D arrays and an integer N and return the most likelihood polynomial of degree N that fits my data. I want this polynomial to be of zero intercept. I already wrote this: def…
T. Ciffréo
  • 126
  • 10
2
votes
1 answer

MATLAB - Trying to do polynomial interpolation but I get a matrix full of zeros (almost)

I am trying to write some code that does polynomial interpolation but I can't get it to work. I am a student and I am following the logic from this video https://www.youtube.com/watch?v=VpI-wC94RKw in order to recreate it it in code-form in Matlab,…
2
votes
3 answers

Performance improvement for multiple uses of polyval function

I have a simple performance question on using polyval function with Matlab. Currently, I have a vector of x that can be quite long (>1000 scalars). I want to apply a different polynomial form to each of the x. The polynomial forms are stored in a…
blouvard
  • 33
  • 2
2
votes
1 answer

How to generate a symbolic multivariate polynomial of a given dimension in SymPy?

I want to use power series to approximate some PDEs. The first step I need to generate symbolic multivariate polynomials, given a numpy ndarray. Consider the polynomial below: I want to take a m dimensional ndarray of D=[d1,...,dm] where djs are…
Foad S. Farimani
  • 12,396
  • 15
  • 78
  • 193
2
votes
1 answer

Why I() "AsIs" is necessary when making a linear polynomial model in R?

I'm trying to understand what is the role of I() base function in R when using a linear polynomial model or the function poly. When I calculate the model using q + q^2 q + I(q^2) poly(q, 2) I have different answers. Here is an example:…
M. Beausoleil
  • 3,141
  • 6
  • 29
  • 61
2
votes
1 answer

Galois field computations on Linux

Is there any software available on Linux for Galois field calculus?
JCLL
  • 5,379
  • 5
  • 44
  • 64
2
votes
1 answer

How to solve polynomial equations fast in Julia?

I'm working on evolution simulations in biological systems. I have to solve polynomial equations, finding the root(u*X^3 - N*p*r*X^2 - N*p*X^2 + K^2*u*X - N*K^2*p), where u and K are constants, N is an constant array, and p, r are evolving…
Yifei
  • 93
  • 1
  • 5
2
votes
1 answer

Can someone explain the behavior of the functions mkpp and ppval?

If I do the following in MATLAB: ppval(mkpp(1:2, [1 0 0 0]),1.5) ans = 0.12500 This should construct a polynomial f(x) = x^3 and evaluate it at x = 1.5. So why does it give me the result 1.5^3 = .125? Now, if I change the domain defined in the…
Xodarap
  • 11,581
  • 11
  • 56
  • 94
2
votes
1 answer

Newtons Method In JS Being Inaccurate

So, I am trying to write a js function that takes 3 inputs (polynomial, guess and limit) and make them return the approximate root of the polynomial. The problem is that, even with a limit of 1000, the result is still very inaccurate. Does anybody…
user7182386
2
votes
2 answers

C# application solving for quadratic imaginary roots

I have constructed an extremely simple, yet fully-functioning and quite helpful, WinForms C# application that solves for the real roots of a quadratic equation. Here is my current programming logic: string noDivideByZero = "Enter an a value that…
Qcom
  • 18,263
  • 29
  • 87
  • 113
2
votes
1 answer

Coding Polynomial Division

I'm trying to code the four basic operators for polynomials for a school assignment. I am currently stuck on the division portion. Wikipedia has a mock-up of the pseudo code but I can't really implement it into my code properly. Part of the…
Kylie Stamey
  • 23
  • 1
  • 3