New Features in Maple 2018 - Interpolation - Maplesoft

What's New in Maple 2018

Interpolation




Maple 2018 contains a new package for interpolating structured and unstructured data in any dimension. The supported methods include Kriging, inverse distance weighted, natural neighbor, and more. 

The Interpolate command provides an interface to all interpolation methods. It returns objects that behave like normal mathematical functions. 

with(Interpolation) 

[CubicInterpolation, HighestNeighborInterpolation, Interpolate, InverseDistanceWeightedInterpolation, Kriging, LinearInterpolation, LinearTriangularInterpolation, LowestNeighborInterpolation, NaturalN...
[CubicInterpolation, HighestNeighborInterpolation, Interpolate, InverseDistanceWeightedInterpolation, Kriging, LinearInterpolation, LinearTriangularInterpolation, LowestNeighborInterpolation, NaturalN...
[CubicInterpolation, HighestNeighborInterpolation, Interpolate, InverseDistanceWeightedInterpolation, Kriging, LinearInterpolation, LinearTriangularInterpolation, LowestNeighborInterpolation, NaturalN...

points := [[0, 0], [1, 0], [2, 0], [0, 1], [1, 1], [2, 1], [0, 2], [1, 2], [2, 2]]; -1 

data := [0, 0, 0, 0, 1, 0, 0, 0, 0]; -1 

g := Interpolate(points, data, method = radialbasisfunction, gaussian, 1.5) 

Typesetting:-mprintslash([g := Typesetting:-mfenced(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn(

g(1, .5) 

.520634529490956455

p1 := plots:-pointplot3d([seq([points[i, 1], points[i, 2], data[i]], i = 1 .. 9)], symbol = solidsphere, symbolsize = 40, color = black); -1 

p2 := plot3d(g, 0 .. 2, 0 .. 2, color =  

plots:-display(p1, p2) 

Plot_2d

Previous versions of Maple already included interpolation methods for 1-dimensional data and data given for a grid of points, like in the previous example. But Maple 2018 is the first version where you can interpolate data given for points in arbitrary, unstructured locations. 

The kriging interpolation method supports some extra functionality backed by statistical theory. In particular, it allows one to generate random data that is spatially correlated according to a so-called variogram. Here is an example: 

n := 50; -1 

points, data := Kriging[GenerateSpatialData](RationalQuadratic(0, 10, 1), n); -1 

p1 := plots:-pointplot3d([seq([points[i, 1], points[i, 2], data[i]], i = 1 .. n)], symbol = solidsphere, symbolsize = 20, color = black); -1; p1 

Plot_2d

We can now define an interpolating object using the Kriging method, and tell it the variogram used for its input. 

g := Kriging(points, data); -1

SetVariogram(g, RationalQuadratic(0, 10, 1)); 1

Typesetting:-mprintslash([Typesetting:-mfenced(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn(

The interpolating object can return function values as if it were a regular mathematical function: 

g(.3, .8) 

-.143204039288054363

p2 := plot3d(g(x, y), x = 0 .. 1, y = 0 .. 1); -1; plots:-display(p1, p2); 1 

Plot_2d

It can also compute the variance associated with such function values - which gives a sense of the confidence in this value. 

g(.3, .8, output = variance) 

.361603843473117470

We can visualize this variance by colouring the interpolated surface according to it. 

p3 := plot3d(g(x, y), x = 0 .. 1, y = 0 .. 1, color = [`+`(`*`(`/`(1, 10), `*`(g(x, y, output = variance)))), 1, 1, colortype = HSV], style = patchnogrid); -1; plots:-display(p1, p3); 1 

Plot_2d

In this visualization, red areas have high confidence and yellow, green, and blue areas have less confidence. 



Bereit für den nächsten Schritt?
Sprechen Sie mit unseren Produktspezialisten über eine kostenlose Demoversion von Maple

*Die Maple-Evaluation ist für Schüler und Studenten bzw. die private Nutzung zurzeit nicht verfügbar.