Questions tagged [polynomial-approximations]

A polynomial approximation is an approximation of a real or complex function by a polynomial.

A polynomial approximation is an approximation of a real or complex by a polynomial.

Methods of polynomial approximation include the Taylor expansion, Chebyshev Polynomial approximation, and Lagrange polynomials.

82 questions
5
votes
3 answers

Remove mixed-variable terms in SymPy series expansion

Consider two functions of SymPy symbols e and i: from sympy import Symbol, expand, Order i = Symbol('i') e = Symbol('e') f = (i**3 + i**2 + i + 1) g = (e**3 + e**2 + e + 1) z = expand(f*g) This will produce z = e**3*i**3 + e**3*i**2 + e**3*i + e**3…
Oniow
  • 307
  • 1
  • 12
4
votes
0 answers

Why is there a discrepancy in Chebyshev coefficients?

I am trying to calculate Chebyshev nodes to approximate the cos function in the interval [-1,1] with a polynomial of degree 4. In Python3, I used chebyfit from mpmath and chebyshev from numpy. While I am getting accurate…
4
votes
2 answers

PTAS implementation for Euclidian TSP?

I'm willing to implement an algorithm to solve the 2-dimensional Euclidian version of the Traveling Salesman Problem in the most efficient way (i.e. most accurate result + least time). While doing my research I found plenty of algorithms but Arora's…
3
votes
2 answers

Approximate value of sin by Taylor series

I have some code that should find approximate value of sin(15°) by Taylor series definition and compare it to the built-in function sin. I have different results. X - radian value R - current value of series sum Eps - accuracy value S - sign F -…
3
votes
2 answers

Determine which subset of points follows a polynomial most closely

I am currently trying to classify a bunch of rivers in regard to their behavior. Many of the rivers have a behavior that is very similar to a second degree polynom. However, some of the rivers have some areas where they diverge from this…
3
votes
1 answer

Find the appropriate polynomial fit for data in Python

Is there a function or library in Python to automatically compute the best polynomial fit for a set of data points? I am not really interested in the ML use case of generalizing to a set of new data, I am just focusing on the data I have. I realize…
Jane Sully
  • 3,137
  • 10
  • 48
  • 87
3
votes
1 answer

How do I 'fit a line' to a cluster of pixels?

I would like to generate a polynomial 'fit' to the cluster of colored pixels in the image here (The point being that I would like to measure how much that cluster approximates an horizontal line). I thought of using grabit or something similar and…
3
votes
1 answer

2D Interpolation using nth

Let's say I have 2 arrays x = [1,2,3,4,5,6] y = [4,53,234,43,12,2] Polynomial of degree n to fit y = F(x). How to interpolate y from x
user5863017
3
votes
1 answer

Error in R: non-conformable arrays

I looked at several posts about this error. However, I am finding that my matrices are the appropriate sizes and I'm still getting this error. I next thought the issue was class, but they are matrix objects. I'm not sure what's going on. Here is…
user1723196
  • 125
  • 1
  • 10
2
votes
2 answers

How to find a polynomial as an approximate solution to a nonlinear equation?

For my small FLOSS project, I want to approximate the Green et al. equation for maximum shear stress for point contact: that should looks like this when plotted the same equation in Maxima: A: (3 / 2 / (1 +…
Foad S. Farimani
  • 12,396
  • 15
  • 78
  • 193
2
votes
0 answers

Multivariate Chebyshev nodes

The Chebyshev nodes prevent Runge's phenomen when determining polynomials. For the interval [0, 1] the Chebyshev nodes of second type can be determined by (1 + math.cos(math.pi * (1 + (i-1) / (n-1)))) / 2 with i=1..n. Is there a multidimensonal…
Christian
  • 372
  • 3
  • 13
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

How to realize a polynomial regression in Pytorch / Python

I want my neural network to solve a polynomial regression problem like y=(x*x) + 2x -3. So right now I created a network with 1 input node, 100 hidden nodes and 1 output node and gave it a lot of epochs to train with a high test data size. The…
2
votes
2 answers

What is the simplest, easiest algorithm for finding EMST of a complete graph of order 10^5

I just want to be clear that EMST stands for Euclidean Minimum Spanning Tree. Essentially, I have been given a file with 100k 4D vertices (one vertex on each line). The goal is to visit every vertex in the file while minimizing the total distance…
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,…
1
2 3 4 5 6