Questions tagged [interpolation]

Questions on the interpolation functions in Mathematica (InterpolatingFunction[], Interpolation[], ListInterpolation[], FunctionInterpolation[], InterpolatingPolynomial[], etc.)

Filter by
Sorted by
Tagged with
8
votes
3answers
4k views

Is it possible to compute with the trapezoidal rule by numerical integration?

Is it possible to compute trapezoidal rule numerical integration? I know that Mathematica has Interpolation, and that a list of points can be interpolated and then ...
8
votes
3answers
779 views

Linear interpolation of elements in a list to generate new list

For a list of any given length, I want to generate another list from it adding elements which are mean of the consecutive elements, in between the elements, of the original list. For example: ...
8
votes
4answers
2k views

Transform an InterpolatingFunction

I'd like to transform an InterpolatingFunction from NDSolve but can't figure out how. Here's an example. The equation I want to solve is ...
8
votes
2answers
661 views

Problem when defining function through NIntegrate and NDSolve and Interpolation - Bug?

More than a single question, I have some doubts about the output of certain functions when defined through the result of other calculations. I am an active user of Mathematica, but maybe I haven't ...
8
votes
1answer
602 views

How do you interpolate outside the range of data?

I've got a simple interpolation function using data from an external program. For values above 3,000, the function reaches a limit. ...
8
votes
3answers
114 views

Make an InterpolatingFunction periodic

Interpolation can make an InterpolatingFunction periodic with the option ...
8
votes
2answers
334 views

Interpolating four-dimensional data

In this case it is not easy to work with a MWE, so I shall use the actual data which contain initial conditions $(x,y,p_x,p_y)$. Let's see how the data look on the $(x,y)$ plane ...
8
votes
1answer
525 views

Produce a spline from a set of {{x, y}, z} points and get its parameters/expression

I have produced a set of points in a variable of the type {{x1, y1}, z1},{{x2, y2}, z2}, ,... }, where {x, y} should be the ...
8
votes
3answers
174 views

Indexed and array-valued interpolations

Bug introduced in 10.1 or earlier and fixed in 10.4.0 Using Indexed on an InterpolatingFunction leads to an ...
8
votes
1answer
2k views

Hermite interpolation

The well known Hermite interpolation uses piecewise cubic polynomials and fits the knot values and derivatives. In contrast the Mathematica piecewise Interpolation ...
8
votes
2answers
3k views

Interpolation won't give smooth output

I have a data, for example ...
8
votes
1answer
196 views

How to get `FindCurvePath` to return only one list

As you can see below, FindCurvePath returns only a part of the list, resulting in a partial interpolation. I would like to interpolate all the points. Complete ...
8
votes
2answers
673 views

Using ListInterpolation to get a vector-valued function

I wanted to construct a ColorFunction from an image, so I tried ...
8
votes
1answer
3k views

Smoothing/Averaging 2D Vector Fields

I have a list of 2D vectors defined by {{x,y},{u,v}} and would like to smooth or average the vectors. For example here are 2 vector fields, the second has noise ...
8
votes
1answer
418 views

Bug? Problem with derivative of interpolating function from FEM

Bug introduced in 10 or earlier and fixed in version 10.4 I am really not sure if this is a bug or I am missing something very trivial. QUESTION: What I am missing in order to obtain the partial ...
7
votes
4answers
809 views

FindMaximum of Interpolated data set

Probably a fairly easy one; but I'm drawing a blank I would like to find the maximum of an interpolated data set. I've tried using ...
7
votes
5answers
1k views

How can I get a discrete result from NDSolve?

When I use NDsolve to solve a differential equations, it returns an interpolation function of the discrete result. Because I haven't found another way to do Fourier ...
7
votes
2answers
788 views

How do you calculate the 2d area between list points?

I have a 2D surface in 3D (it's a cut) given in data points of the form (x,y,z): data = ToExpression@Import["http://pastebin.com/raw/6ufm8bx3", "String"]; What ...
7
votes
2answers
3k views

Exporting interpolating functions to excel

I have a question about exporting an InterpolatingFunction to Excel. I checked the forum, but I still couldn't completely understand how to solve my problem. Could ...
7
votes
3answers
3k views

How to get the coordinates of the intersection of two lines from a ListLinePlot?

Suppose I have two curves intersect at some point, how can I read the coordinates from the graph, not read by eye, but find it with more precision by computer. For example, here are two lists created ...
7
votes
4answers
2k views

Finding intersection points of two graphics [duplicate]

I am drawing a curve from a list using: ...
7
votes
3answers
688 views

Interpolation steeply drops to 0 beyond data

I use Interpolation on unstructured 3-D-Data to visualize different regions via RegionPlot. A problem I run into is that the interpolating function steeply drops to zero beyond my set of data. This is ...
7
votes
2answers
2k views

ListContourPlot interpolation screws up on concave set of data

I want to create ListContourPlots for sets of Data (from a physics simulation) given as Triplets {x, y, f(x, y)}. Certain parameter regions in the x-y-plane are ...
7
votes
1answer
144 views

Plotting a directed contour with self-intersections

I have an ordered sequence of points along a closed directed planar contour with self-intersections. I need to find a continuous curve interpolating those points and plot it, with small arrowheads ...
7
votes
2answers
135 views

PeriodicInterpolation does not work in ElementMeshInterpolation

I want to use ElementMeshInterpolation to generate interpolation function with periodic boundary condition. I use below data as an example ...
7
votes
3answers
3k views

Piecewise Polynomial Interpolation

Given some data pairs $(x_i,y_i)$, with $i=0,...,m$, and a degree $r$, I wish to build a piecewise polynomial function to interpolate these data. That interpolation should be continuous, and, on every ...
7
votes
2answers
713 views

How to find Matano plane

I have discrete collection of data points (10 to 10^4). I want to describe them by a continuous function and find a x value z, ...
7
votes
2answers
155 views

Bug in VectorFieldPlot[] with InterpolatingFunction[]?

Bug introduced in 11.3 or earlier and persisting through 12.0.0 or later While looking at https://mathematica.stackexchange.com/questions/192081/how-do-i-plot-a-divergence, I thought to suggest the ...
7
votes
1answer
862 views

StreamPlot with interpolating functions

While working my way through the Wolfram Blog post on simulating fluid flow I started playing with StreamPlot because I preferred quick and ugly visualizations over ...
7
votes
2answers
666 views

Why Interpolation makes ListPlot3D slow?

I'm trying to use ListPlot3D to plot some data, and I'm using the InterpolationOrder option to make the plot smoother. But the ...
7
votes
1answer
889 views

BSplineCurve Interpolation

Can I get interpolated values from this B-spline, (shown in red)? ...
7
votes
2answers
583 views

Getting an explicit representation of the function returned from Interpolation [duplicate]

I am using Interpolation to get an InterpolatingFunction that fits a set of points. For example, ...
7
votes
1answer
510 views

How do I reverse the X-axis on a ListDensityPlot?

I want to use ListDensityPlot on a dataset containing a few (~600) triplets and I would like to reverse one of the axes. Sadly, the workaround involving the ...
7
votes
1answer
233 views
7
votes
1answer
662 views

How can I get the interpolation line from Listplot?

My discrete data is: data={{1., 5827.}, {3., 6242.}, {15., 6066.}, {60., 5972.}} I want to get the interpolation line from ListPlot: ...
7
votes
1answer
2k views

How to avoid creating negative values when using Interpolation?

I'm having some problems with Interpolation. I'm trying to interpolating some measurements data into mathematica. But using Interpolation will create some negative data, which is actually not possible ...
7
votes
1answer
109 views

Weird behaviour for a vector InterpolatingFunction inside an NDSolve

I have run into some weird behaviour on the part of NDSolve which I find pretty bizarre and which I would like to understand better. Suppose, for the sake of ...
7
votes
1answer
317 views

Multidimensional arbitrary precision spline interpolation on the grid

This question is a generalization of the previous one for multiple dimensions. In the answer to that question an implementation for the clamped spline interpolation for 1D case and arbitrary degree of ...
7
votes
0answers
186 views

InterpolationOrder has no effect on ListContourPlot when the data is of the form {x,y,f[x,y]}

This is related to the issue brought up here, if you want to mark it as duplicate feel free to do so, but it is slightly separate. Take two sets of data, identical except for the form, ...
6
votes
2answers
830 views

Integration of Interpolated function take an unacceptable amount of time

I have a simple integration which, when using an interpolation function, is taking too long to calculate: ...
6
votes
3answers
459 views

Finding a set of line segments to fit noisy data

Looking for a methodology to choose line segments that are a rough fit to a given set of data. In this example, the data are {x,y} pairs. For example, if the data looked like what is shown on the ...
6
votes
2answers
449 views

An interpolation problem

Let $f:[0,2]\to\Bbb{R}^+$ be the function give by $$f(x)=\sqrt{x(2-x)}.$$ I need to find (the exact values of) constants $a_1, a_2,a_3,a_4$ in $$g(x)=\sum_{k=1}^4a_kx^k(2-x)^k$$ such that $f(x)=g(x)$...
6
votes
2answers
444 views

Function that is a good fit to the plot made with SmoothHistogram

How can I find a function that fits the plot from the SmoothHistogram function? For instance if I have data like this and plot a ...
6
votes
2answers
375 views

Funky behaviour of derivative

I'm solving a set of differential equations for the variables H(t), x(t) and a(t). Then I construct a function z(t) from these, and another function w(t) from z(t). w(t) contains terms such as the ...
6
votes
2answers
295 views

FunctionInterpolation and Which combine badly

Update 2: Got two solid answers, but had trouble implementing one, and found the other could only save me computation time by sacrificing accuracy. So I chose neither as an official answer, but they'...
6
votes
2answers
682 views

How can I force points in a list to have distinct x values?

I have a list of points that may be used for linear interpolation using Interpolation and need to ensure that no two points have the same $x$ value, since, if they ...
6
votes
1answer
193 views

How can I accelerate repeated interpolation of a very large dataset?

I am solving a 4D time-dependent PDE using a discretization method. My query is not about solving this; because I am doing it in the following code. The code is OK and it works fine. My main problem ...
6
votes
4answers
7k views

Retrieve values of InterpolatingFunction

While analyzing a large system of ODE's, I defined a particular ratio p, which contains some variables that are represented by ...
6
votes
2answers
333 views

How to restrict InterpolatingFunction to a smaller domain?

How can I reduce the domain of an InterpolatingFunction? For example, consider if = FunctionInterpolation[x^2, {x, 0, 3}]. Is ...
6
votes
1answer
156 views

What does it mean by order -1 of InterpolatingFunction?

Bug introduced in 12.1 or earlier, fixed in 12.2. In the above code, the InterpolatingFunction object has order -1. In the documentation https://reference.wolfram.com/language/ref/InterpolationOrder....

1 2
3
4 5
18