Questions tagged [polynomials]

In mathematics, a polynomial is an expression consisting of variables (or indeterminates) and coefficients, that involves only the operations of addition, subtraction, multiplication, and non-negative integer exponents.

In mathematics, a polynomial is an expression consisting of variables (or indeterminates) and coefficients, that involves only the operations of addition, subtraction, multiplication, and non-negative integer exponents.

An example of a polynomial of a single indeterminate (or variable), x, is x2 − 4x + 7, which is a quadratic polynomial.

Polynomials appear in a wide variety of areas of mathematics and science. For example, they are used to form polynomial equations, which encode a wide range of problems, from elementary word problems to complicated problems in the sciences; they are used to define polynomial functions, which appear in settings ranging from basic chemistry and physics to economics and social science; they are used in calculus and numerical analysis to approximate other functions. In advanced mathematics, polynomials are used to construct polynomial rings and algebraic varieties, central concepts in algebra and algebraic geometry.

Wikipedia: http://en.wikipedia.org/wiki/Polynomial

978 questions
3
votes
0 answers

Fit curve in spaghetti plot

For descriptive plots in R studio, I would like to fit a regression curve in my spaghetti plot. To create the spaghetti plot I used: library(lattice) GCIP <- data_head$GCIP time_since_on <- data_head$time_since_on Patient <-…
Lili
  • 547
  • 6
  • 19
3
votes
3 answers

How to make polynomial features using sparse matrix in Scikit-learn

I am using Scikit-learn for converting my train data to polynomials features and then fit it to a linear model. model = Pipeline([('poly', PolynomialFeatures(degree=3)), ('linear', LinearRegression(fit_intercept=False))]) model.fit(X,…
3
votes
2 answers

Simplify algorithm with Horner Scheme

I have a problem to solve the following excercise: *Be given the special polynomial: and the input: coefficients a[n], a[n-1], ..., a[0], argument x Create an algorithm in C# or Pseudocode which will use Horner's method to solve the special…
user5636721
3
votes
2 answers

GridsearchCV for Polynomial Regression

I was new to Machine Learning and stuck with this. When I was trying to implement polynomial regression in Linear model, like using several degree of polynomials range(1,10) and get different MSE. I actually use GridsearchCV method to find the best…
3
votes
2 answers

poly1d gives erroneous coefficients when they are very large integers

I am working with python 3.5.2 in ubuntu 16.04.2 LTS, and NumPy 1.12.1. When I use poly1d function to get the coeffs, there is a mistake with the computation: >>> from numpy import poly1d >>> from math import fabs >>> pol =…
Alexis
  • 120
  • 1
  • 9
3
votes
1 answer

How to model polynomial regression in R?

I've a dataset with 70 variables, and I want to try polynomial regression on it. If the number of columns were three/four I could just hand code something like this -- model <- lm(y ~ poly(var1,3) + poly(var2,3) + poly(var4,4) How would we go…
3
votes
0 answers

Number Theoretic Transform

I am having tough time while implementing NTT. After reading lot of tutorials on FFT and NTT from http://www.apfloat.org/ntt.html, http://codeforces.com/blog/entry/43499 and some others, I have implemented NTT taking advantage of Fermats theory…
3
votes
2 answers

Why predicted polynomial changes drastically when only the resolution of prediction grid changes?

Why I have the exact same model, but run predictions on different grid size (by 0.001 vs by 0.01) getting different…
hxd1011
  • 885
  • 2
  • 11
  • 23
3
votes
1 answer

C++ Polynomial Tokenizer

I am currently working on creating a tokenizer that takes in a polynomial as a string and outputs an array of monomials (individual terms) within the polynomial. ex: input: 4x^2+3x^-2+2 output: { "4x^2", "3x^-2", "2" } I am not exactly sure where to…
star
  • 179
  • 1
  • 1
  • 6
3
votes
1 answer

Orthogonality issue in scipy's legendre polynomials

I recently stumbled upon a curious issue concerning the scipy.special.legendre() (scipy documentation). The legendre polynomials should be pairwise orthogonal. However, when I calculate them over a range x=[-1,1] and build the scalar product of two…
Markus
  • 165
  • 11
3
votes
1 answer

JULIA: What's Erro! Lagrange Polynomials function

function lg(X,Y,Xint) n = length(X) L = ones(1:n) for k = collect(1:n) L[k] = 1 for c = collect(1:n) if c!=k L[k] = (L[k]*( Xint - X[c] ))/( X[k] - X[c] ) end end end …
3
votes
0 answers

What's a floating-point operation and how to count them (in MATLAB)?

I have an assignment where I basically need to count the number of floating point operations in a simple program, which involves a loop, a matrix, and operations such as *, + and ^. From my understanding, a floating-point operation is an operation…
nbro
  • 15,395
  • 32
  • 113
  • 196
3
votes
1 answer

Polynomial Division

I am making a program to calculate operations over polynomials and I already finished other operation (+ - *) but stucked with the division, I am getting this error always as it shown in the code static int[] DividePolnomials(int[] pol1, int[]…
Omar
  • 98
  • 2
  • 12
3
votes
1 answer

Sum of products of all subsets,

I want to calculate sum of product of every subset of given $N$ element set. For example, given set {1, 2, 3}, the answer is 1 + 2 + 3 + 1 * 2 + 1 * 3 + 2 * 3 + 1 * 2 * 3. I also would like to give the answer modulo $M$. What I know is that I could…
user128409235
  • 239
  • 1
  • 11
3
votes
4 answers

Building a Func Polynomial using Expression Trees

TL;DR How can I build up the expression using an array of coefficients and turn it into a Func? Is there a better way than expression trees? I have an immutable Sequence type that is constructed using a Func formula that…
D. Ben Knoble
  • 4,273
  • 1
  • 20
  • 38