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

Why is the lm function giving absurdly high results?

First off, I'll give you some reproducible code: library(ggplot2) y = c(0, 0, 1, 2, 0, 0, 1, 3, 0, 0, 3, 0, 6, 2, 8, 16, 21, 39, 48, 113, 92, 93 ,127, 159, 137, 46, 238, 132 ,124, 185 ,171, 250, 250 ,187, 119 ,151, 292, 94, 281, 146, 163…
WhipStreak23
  • 79
  • 2
  • 9
0
votes
1 answer

How to create the polynom for function of two variables using python?

I have two variables - T1 and T2 - and their values. For example: T1=[300,400,500,600,650,700] T2=[300,400,500,600,700,800] And i know the values of Z variable for each T1,T2 from example above (i obtained Z values from experiment). So i have a 6x6…
0
votes
1 answer

How to use Gauss-Lobatto and Gauss-Laguerre quadrature code

I'm using MATLAB and this function: function [x,w,P]=lglnodes(N) % Truncation + 1 N1=N+1; x=cos(pi*(0:N)/N)'; % Legendre Vandermonde Matrix P=zeros(N1,N1); xold=2; while max(abs(x-xold))>eps xold=x; P(:,1)=1; P(:,2)=x; for…
Lisa Ann
  • 3,345
  • 6
  • 31
  • 42
0
votes
0 answers

How to fit a smooth curve to my data in R using Bernstein polynomials?

I know there are plenty of similar questions but I need to solve the problem specifically with Bernstein polynomials I tried something like this: library(pracma) train <- rnorm(100) test <- rnorm(50) eCDF <- ecdf(train) # squeeze eCDF support…
0
votes
1 answer

Polynomial regression using quadprog

I am trying to run a polynomial regression using limSolve based on the example here. My code is the following. hr <- c(9.0, 9.5, 10.0, 10.5, 11.0, 11.5, 12.0, 12.5, 13.0, 13.5, 14.0, 14.5, 15.0, 15.5, 16.0, 16.5, 17.0, 17.5, 18.0, 18.5,…
Stata_user
  • 562
  • 3
  • 14
0
votes
1 answer

Neukum production function

I am trying to plot a function which looks like that: . Where, D range from 0.01 to 300km, N is number of craters with dia > D per sq.km per giga year, coefficients values are in code. I get empty plot and obviously I am doing something very wrong…
0
votes
1 answer

Obtaining a 2D interpolation polynomial in Matlab

I have three vectors, one of X locations, another of Y locations and the third is a f(x, y). I want to find the algebraic expression interpolation polynomial (using matlab) since I will later on use the result in an optimization problem in AMPL. As…
slow_learner
  • 337
  • 1
  • 2
  • 15
0
votes
0 answers

6 order polynomial regression no result

I just learnt about tensorflow. To be more familiar with the syntax, I build a toy model to perform polynomial regression. The toy dataset that I created is x_data = np.linspace(-1, 1, 300) + np.random.uniform(-0.05, 0.05, 300) y_data =…
meTchaikovsky
  • 7,478
  • 2
  • 15
  • 34
0
votes
0 answers

Interpolate based on polynomial from another column Pandas

I have a pandas data frame where I know the start value is the same for all columns and the end value is 90% and 80% of the 100% end value. I need to interpolate between the starting and end values and follow the trend of the 100% value (which…
0
votes
0 answers

about Clamped cubic spline code in Matlab

I did the program, but for some reason it marks a mistake (c = tridiagonal ( hi(1:n-1), dd, hi(1:n-1), ri ); ) and I don't know why, I'm sure it's correct so please somebody help. Here is the code: function csc = cubic_clamped ( xi, fi,…
0
votes
2 answers

Cross Validating step functions in R

I am trying to get errors from step functions but I get an error : library(boot) library(ISLR) attach(Wage) set.seed(5082) cv.error <- rep (0,12) for (i in 2:13){ step.fit = glm(wage~cut(age,i), data = Wage) cv.error[i] <- cv.glm(Wage…
0
votes
1 answer

Solving Least square using MATLAB

Assume we want to determine the coefficients of a polynomial equation that is approximating the tangent function between 0 to 1, as follow: -A is m×n vandermonde matrix. The entries are populated using m value between 0 to 11(given as input). -The…
0
votes
1 answer

Custom polyfit model in Matlab

I've got two arrays; R = [r0, r1, r2, ..., r999] Z = [z0, z1, z2, ..., z999] I want to apply polyfit to the above, where the function is R(z). I need the polynomial to be x^2+x^4+x^6+x^8 In excel, the trend function does not allow for only even…
0
votes
1 answer

scikit learn: polynomial interpolation of higher dimensions

In this link of the scikit-learn project: http://scikit-learn.org/stable/auto_examples/linear_model/plot_polynomial_interpolation.html, it is shown how to apply polynomial interpolation to approximate a certain function for example. This example is…
Daniyal
  • 885
  • 3
  • 16
  • 28
0
votes
0 answers

SCIPY - UnivariateSpline Approximation

I am trying to make an approximation of a noisy data with scipy, but it seems it doesn't work at this specific function. Applying the smoothing factor "s" does not change anything. I end up with interpolation instead of approximation. Oddly it…