# Tag Info

26

The problem with equispaced points is that the interpolation error polynomial, i.e. $$f(x) - P_n(x) = \frac{f^{(n+1)}(\xi)}{(n+1)!} \prod_{i=0}^n (x - x_i),\quad \xi\in[x_0,x_n]$$ behaves differently for different sets of nodes $x_i$. In the case of equispaced points, this polynomial blows up at the edges. If you use Gauss-Legendre points, the error ...

22

This is a really interesting question, and there are a lot of possible explanations. If we are attempting to use a polynomial interpolation, then note that polynomial satisfy the following annoying inequality Given a polynomial $P$ of degree not exceeding $N$ we have $$|P^{\prime}(x)| \leq \frac{N}{\sqrt{1-x^2}}\max _x |P(x) |$$ for every $x \in (-1,1)$...

17

For the first part of my question, I found this very useful comparison for performance of different linear interpolation methods using python libraries: http://nbviewer.ipython.org/github/pierre-haessig/stodynprog/blob/master/stodynprog/linear_interp_benchmark.ipynb Below is list of methods collected so far. Standart interpolation, structured grid: http:/...

14

Why not simply show the absolute value function? Approximation with e.g. Legendre-polynomial expansion works, but pretty badly: Taylor expansion is of course completely useless here, always giving only a linear function, either always decreasing or always increasing (depending on whether the point you expand around is negative or positive).

11

Reducing the kernel width $\sigma_m$ will usually reduce the condition number. However, kernel matrices can become singular, or close to singular, for any basis function or point distribution, provided the basis functions overlap. The reason for this is actually quite simple: The kernel matrix $K$ is singular when its determinant $\det(K)$ is zero. ...

10

Given interpolation $I_H^h$ and restriction $I_h^H$ (where restriction is typically $(I_H^h)^T$ for symmetric problems), with fine grid discretized operator $A^h$, there are two common approaches for constructing the coarse grid operator $A^H$. (Petrov-)Galerkin coarse operators This explicitly computes the matrix triple product $$A^H = I_h^H A^h I_H^h .$$...

10

This is the classic colorization using optimization problem. Optimization and Linear Algebra To see how this can be expressed as a linear system, it's helpful to use a slightly different notation (and a slightly different objective function). Think of your image as graph $G$ with a node for each pixel in the image. There is an edge $(i,j)$ between two ...

10

It's a pathological case, but you can always resort to the Weierstrass monster function. It illustrates a broader point, namely that functions that are not smooth -- e.g., that have a kink -- are difficult to approximate because the interpolation error estimates require the function being interpolated to be differentiable a number of times. In other words, ...

9

Short answer You are missing the Jacobian of the transformation for the derivatives. Long answer The conditions that you propose for your interpolator translate into the following system of equations $$\begin{bmatrix} 1 &x_1 &x_1^2 &x_1^3\\ 1 &x_2 &x_2^2 &x_2^3\\ 0 &1 &2x_1 &3x_1^2\\ 0 &1 &2x_2 &3x_2^2 \... 8 You're asking how to produce dense output from your Runge-Kutta method. There are a number of ways to do this (see e.g. Hairer/Nørsett/Wanner). As noted in that reference, if you don't want to do more function evaluations aside from those already done by your fourth-order Runge-Kutta method, the best you can hope for is a third-order interpolant. This is ... 8 There are standard methods for these types of quadrature in Python, in NumPy and SciPy: Gauss-Laguerre quadrature Gauss-Legendre quadrature Gauss-Hermite quadrature (as noted in your post) Gauss-Chebyshev quadrature QUADPACK adaptive quadrature adaptive Gaussian quadrature and other routines. Given a degree of quadrature (essentially, the degree of the ... 8 There is no built-in Fortran functionality to do linear interpolation. You could either use a library or write your own routine. I haven't tried compiling or testing and my fortran may be a bit rusty, but something like the following should work. subroutine interp1( xData, yData, xVal, yVal ) ! Inputs: xData = a vector of the x-values of the data to be ... 8 This problem is generally called the Minimax Problem. Unfortunately the step function is not continuous and therefore the Weierstrass approximation theorem does not apply. Any continuous approximation will have \epsilon \ge 0.5 since there is a jump of size 1 so the best you can do at that point is split the difference. In fact, y = 1/2 is as good as you ... 8 That depends on how well you know the coordinates and velocities. If you have exact values, you can get a reasonable answer using Hermite interpolation. This will give you a degree-3 polynomial in each window that matches the coordinates and velocities at all the endpoints. Alternatively, if you do not know the coordinates and velocities exactly, but you do ... 7 The RK4 method implicitly constructs a degree 3 polynomial interpolant, using the data f(x_i), f(x_{i+1}), f'(x_i), and f'(x_{i+1}) in each interval. This interpolant can be constructed rather easily and efficiently using a linear combination of shifted Hermite basis functions in each interval. 7 Bernstein polynomials and Lagrange polynomials both span the same spaces. So in terms of the possible functions one can represent, using one or the other makes no difference. However, if you are thinking of using these as basis functions in either a finite element method or an interpolation problem, the spectral properties of the linear operator you create ... 7 I use Bernstein polynomials in a collocation method to solve boundary value problems for ODEs and PDEs. They are quite interesting. Convergence was exponential for some linear BVPs, but little slower compared to Chebyshev collocation, Legendre Galerkin, and Tau. Here's the figure comparing convergence rates with some Chebyshev spectral methods. The example ... 7 For a polynomial interpolant we have the formula for the pointwise error$$ E_n(x) = f(x) - p_n(x) = \frac{f^{(n+1)}}{(n+1)!}\prod_{i=0}^n(x-x_i),$$where the x_i are the interpolation knots. In general, we want to work with the right hand side of the error formula (a derivation appears in the book by Quarteroni et. al.) as the function we interpolate is ... 7 The frequency content of the interpolated signal is significantly influenced by the interpolation basis. If you have a band-limited function that you have adequately sampled (i.e. satisfying Nyquist criterion), interpolating with any function that is not band-limited to the same frequency will indeed introduce high-frequency noise. Unfortunately, exact band-... 7 Your choice of parameterization is creating problems. Instead of spanning one in t between points, span an amount proportional to the line segment between the two points in (x,y) space. I've created a Python example that demonstrates the issue. It compares a uniform parameterization (x_t(t),y_t(t)) (like yours, but mine is scaled so that t \in [0,1]... 6 The paper below shows that representing polynomials in Bernstein form leads to numerically stable algorithms in many cases: R.T. Farouki, V.T. Rajan, On the numerical condition of polynomials in Bernstein form, Computer Aided Geometric Design, Volume 4, Issue 3, November 1987, Pages 191-216, DOI: 10.1016/0167-8396(87)90012-4 6 This is an important and challenging issue. Yes, using quadratic interpolation means that your solution values may lie outside the interval in which the initial data lie. This is not what we usually mean when we refer to numerical instability, but it is a potentially undesirable feature. Yes, forcing the interpolated values to lie in an interval destroys ... 6 I hope I understood the question correctly. They try to compute exactly the same thing, so they really are equivalent. I'll use Chebyshev polynomials because they are easy to analyze. Given a function f(x) on [-1,1], the spectral interpolant is the truncation of$$ \begin{aligned} f(x) &= \sum_{n\geq0} \bar a_n T_n(x), \\ \bar a_n &= \frac{1+[n&...

6

The point of @WolfgangBangerth is exactly what I mentionend in my comment, so I'd always try this first. In the best case, with millions of partitions $[a_{i},a_{i+1}]_{i\in \{0,\ldots,N-1\}}$ (where $a_{i} < a_{i+1}$), the length of these is quite small such that some low-order method could be appropriate. This will require roughly $N \times (s-1)$ ...

6

Approximation is not only made hard by the function to be approximated but by the interval in which the approximation should be a "good fit". And you should define the measure for a "good fit", i.e. what is the maximum (absolute or relative) error you wish to tolerate? For example, you will need a huge number of terms in the Taylor series of $\exp(x)$ to ...

6

Polynomials are surprisingly effective at function approximation [1]. If you have at least Lipschitz continuity, then Chebyshev approximations will converge. Of course, convergence may be slow, and that is the price we pay for dealing with a non-smooth function. Today, computers are much faster than the days in which many numerical analysis books were ...

6

The interpolated polynomial does not have roots. Considering that the behavior outside the interpolation region holds is termed extrapolation. You can explicitly use the polynomial, given by (as I explained in this post) $$f(x) \approx N_1(x) u_1 + N_2(x) u_2 + |J|(N_3(x) u'_1 + N_4(x) u'_2)\quad \forall x\in [a, b]$$ with $|J| = (b - a)/2$ the Jacobian ...

5

Running the command edit interp2 allows you to see the source code of this particular function and then you can read the piece of code that deals with bicubic interpolation. In MATLAB R2011, there is even a paper being cited: "Cubic Convolution Interpolation for Digital Image Processing", Robert G. Keys, IEEE Trans. on Acoustics, Speech, and Signal ...

5

Any polynomial interpolation method will include a 0th-order term and thus interpolate a constant exactly. Further, some methods have the nice property that they can interpolate polynomials up to some degree $N$ exactly, where $N$ is also the max. interpolation degree. Lagrange polynomials are an example of this.

5

A hexahedron with straight edges is the image of the unit cube under a trilinear mapping. So, if you have values on the eight vertices of a hexahedron, and you are asking to interpolate between them to a point $x$ somewhere inside the hexahedron, then the correct approach is as follows: Invert the trilinear mapping to find the corresponding point \$\hat x = \...

Only top voted, non community-wiki answers of a minimum length are eligible