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
5
votes
1 answer

Java library for estimating a polynomial based on a set of points

The polynomial's degree should be # of points - 1 e.g. if there are 2 points given it should be a line. I know I can solve this using a matrix e.g. if there are 4 points: the polynomial would be y = ax^3 + bx^2 + cx + d and the matrix would be |…
user3669539
  • 139
  • 1
  • 9
5
votes
1 answer

How to implement Horner's scheme for multivariate polynomials?

Background I need to solve polynomials in multiple variables using Horner's scheme in Fortran90/95. The main reason for doing this is the increased efficiency and accuracy that occurs when using Horner's scheme to evaluate polynomials. I currently…
gsreynolds
  • 151
  • 1
  • 4
5
votes
2 answers

How to properly set contrasts in R

I have been asked to see if there is a linear trend in 3 groups of data (5 points each) by using ANOVA and linear contrasts. The 3 groups represent data collected in 2010, 2011 and 2012. I want to use R for this procedure and I have tried both of…
Jimj
  • 153
  • 1
  • 4
5
votes
1 answer

Efficient calculation of polynomial coefficients from its roots

I have the roots of a monic polynomial, i.e. p(x) = (x-x_1)*...*(x-x_n) and I need the coefficients a_n, ..., a_0 from p(x) = x^n + a_{n-1}x^{n-1} + ... + a_0. Does anybody know a computationally efficient way of doing this? If anybody knows a…
user2690527
  • 1,729
  • 1
  • 22
  • 38
5
votes
6 answers

Evaluate Polynomial String without using regex and API

Given a polynomial with a single variable x, and the value of x as input, compute its value. Examples: eval("-2x^3+10x-4x^2","3")=-60 eval("x^3+x^2+x","6")=258 Description of issue: In this code I break the string into a substring whenever a +/-…
abhishek14d
  • 89
  • 2
  • 12
5
votes
1 answer

Determining asymptotic complexity of program

I am trying to determine the asymptotic complexity of my program which takes in an input and determines if it's a polynomial or not. "If the length of the input expression is m chars, what is the big-Oh complexity of your program with respect to…
ryank
  • 395
  • 2
  • 6
  • 19
5
votes
1 answer

Mathematical function where slow increase at start and fast increase at end

I have number x=[0,n], where n>0. I want to construct a function y=f(x) such that the value increase slowly from 0 and increase very fast when approaching n, and when reach n, y is infinity. What is a good function to model this?
william007
  • 17,375
  • 25
  • 118
  • 194
5
votes
2 answers

Polynomials with negative exponents in Python

Is there a library to work with polynomial arithmetic when polynomials can have negative exponents? I found the poly1d class in numpy, but I cannot figure out how I could represent a polynomial like x**-3 + x**-2 + x**2 + x**3.
Charles Brunet
  • 21,797
  • 24
  • 83
  • 124
4
votes
1 answer

Reduce results in an error for a polynomial with real (non-integer) coefficients

In Mathematica, I tried to check some condition for a polynomial, whose parameters change in a range. My calculations are 5th order but I made a simple one to show my needs. When I create a polynomial, which has integers as parameter, I use Reduce…
trante
  • 33,518
  • 47
  • 192
  • 272
4
votes
5 answers

Where can I get a Delphi/Pascal implementation of Excel-style polynomial regression curve fitting?

I have a set of X-Y values (i.e. a scatter plot) and I want a Pascal routine to generate the coefficients of a Nth order polynomial that fits those points, in the same way that Excel does.
rossmcm
  • 5,493
  • 10
  • 55
  • 118
4
votes
1 answer

How do I break a non-straight line into even segments?

I have a non-straight line defined by a series of x, y coordinate points. I could draw a straight line on-screen directly between these points with no problem. Unfortunately, I have to draw the line in segments of equal length. Here is an…
4
votes
2 answers

Factor out GCD that is raised to a power

Using Mathematica (v.7) basically I want to bring an expression like this (x + x^2 + x^3)^4 to x^4 (1 + x + x^2)^4 What would be the best way to take a term like the GCD out of an expression that is raised to a power and is in factored form; then…
4
votes
2 answers

Display polynomials in reverse order in SageMath

So I would like to print polynomials in one variable (s) with one parameter (a), say a·s^3 − s^2 - a^2·s − a + 1. Sage always displays it with decreasing degree, and I would like to get something like 1 - a - a^2·s - s^2 + a·s^3 to export it to…
iipr
  • 1,190
  • 12
  • 17
4
votes
0 answers

Do any of the standard Python packages implement the closed form cubic and quartic formulas?

There are exact (closed-form) solutions to polynomial equations of degree up to and including 4. I.e. there's a quadratic formula, a cubic formula and even a quartic formula. Do any of the standard python packages (or even some non-standard ones)…
8one6
  • 13,078
  • 12
  • 62
  • 84
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