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

Tell WolframAlpha to show data field?

I'm trying to find an approximation for a function that's near y = x^(1/5). Unfortunately, polynomial approximations for functions below degree 1 don't work. These work if I specify the form manually, but are off by about 5% in the ranges I care…
0
votes
0 answers

A scheme’s running time is: O((1/E)^2*n^2). Is this a fully polynomial-time approximation scheme? Explain why?

A scheme’s running time is: O((1/E)^2*n^2). Is this a fully polynomial-time approximation scheme? Explain why? I am looking for an answer to this question: A scheme’s running time is: O((1/E)^2*n^2). Is this a fully polynomial-time approximation…
Majid
  • 11
0
votes
1 answer

y = b0 + b1x + b2x^2 Equation from Polynomial Regression Code?

I have some code that generates a polynomial regression model based on some experimental data in Python3. I need to find the equation of this model so I can use it a different program for predictions based on the model. Do any of you know how to get…
0
votes
1 answer

Finding the parameters of a function via curve fit

I'm trying to estimate the parameters (v, n, k) defined in fit_func. I tried the default least squares fit but I couldn't find the parameters successfully. def fit_func(x, v, n, k): return v * x ** n / (k ** n + x ** n) x = [2.5, …
0
votes
1 answer

Python: Fitting a piecewise polynomial

I am trying to fit a piecewise polynomial function Code: import numpy as np import scipy from scipy.interpolate import UnivariateSpline, splrep from scipy.optimize import curve_fit from matplotlib import pyplot as plt def piecewise_func(x, X, Y): …
0
votes
1 answer

Display expression defined using lambda function

I am using the following code to find piecewise polynomial functions import scipy from scipy.interpolate import UnivariateSpline, splrep x = np.array([0., 0.75, 1.8, 2.25, 3.75, 4.5, 6.45, 6.75, 7.5, 8.325, 10.875, 11.25, 12.525, 12.75,…
Natasha
  • 1,111
  • 5
  • 28
  • 66
0
votes
0 answers

Find the polynomial function of a dataset approximated by Bezier method

I'm using the answer posted here to fit a curve through a set of datapoints import numpy as np import matplotlib.pyplot as plt from scipy.special import binom def Bernstein(n, k): """Bernstein polynomial. """ coeff = binom(n, k) …
0
votes
1 answer

Fitting a monotonically increasing spline function using Scipy

I want to fit a monotonically increasing smooth spline function for a dataset Code: from scipy.interpolate import interp1d import matplotlib.pyplot as plt x = [0., 0.75, 1.8, 2.25, 3.75, 4.5, 6.45, 6.75, 7.5, 8.325, 10.875, 11.25, 12.525, 12.75,…
0
votes
1 answer

An error while trying to implement a polynomial regression with Pytorch - Gradients are None after loss.backward()

I am trying to implement a custom polynomial regression using PyTorch but during the training procedure my implementation fails to calculate the gradients; i.e. the weights are always None even after the loss.backward() command. Below I give all the…
ChrisNick92
  • 123
  • 4
0
votes
3 answers

How to interpret the coefficients returned from a multivariate cubic regression (polynomial degree 3) when using linearRegression().coef_?

I am trying to fit a hyperplane to a dataset which includes 2 features and 1 target variable. I processed the features using PolynomialFeatures.fit_transform() and PolynomialFeature(degree = 3), and then fitted those features and target variable…
0
votes
1 answer

Fitting using Chebyshev polynomials in python

I am trying to fit 2d data using polynomial fit and find that after a certain degree of polynomials, numpy gives "Rank Warning". On the other hand, fitting using Chebyshev polynomials do not give such warnings. I could able to fit the same data…
0
votes
0 answers

How to use linalg.net library to compute the third order polynomial fit with C#

I have a data set that I intend to perform a Linear Least Square Optimization Third Order Polynomial fit using the linalg.net library. I have already installed the library from Nuget packages and my problem is using the method polynomialfit(double[]…
Son of Man
  • 1,213
  • 2
  • 7
  • 27
0
votes
0 answers

Why is my machine learning polynomial regression program not working?

I am writing a program that will produce a polynomial model of given temperature data. You can see my program, as well as my data, in the screenshots below: from google.colab import drive import os as os # for moving around the operating…
0
votes
0 answers

Weird behaviour when using polynomial interpolation methods

I'm trying to implement a program which uses interpolation via the divided difference method and Newton polynomials. However I get the following graph for a polynomial of degree 24 when interpolating a function. Code to reproduce this is: the…
Olof R
  • 113
  • 4
0
votes
1 answer

Fit a given function

I have a basic question. I want to use scikit-learn to fit a polynomial model to my data. I could do that by PolynomialFeatures but I want to fit a polynomial with some specific form. For example, if I have 2 features I want to create a model such…