Plotting continues field's properties by having some points information

Having information of a vector field in some discrete points in 2D space(points and vectors are both in 2D), how can one plots (approximate) divergence of the vector-field in the total space(not in discrete points)? Is there any function in Mathematica which take information of vector field in some discrete points and do that? Any example provided answer is highly appreciated.

I have found this useful link through searching which is relevant: Discrete vector_field

field[{x_, y_}] := {Sin[x y], Cos[x + y]};
randomPoints = RandomReal[{-1, 1}, {100, 2}];
discreteField = randomPoints /. p_List?(Length[#] == 2 &) :> {p, field[p]};

Graphics[discreteField /. {pt_List, v_List} :> Arrow[{pt, pt + 0.2 v}]]
VxInt = Interpolation[
discreteField /. {pt_List, {vx_, vy_}} :> {pt, vx},
InterpolationOrder -> All];
VyInt = Interpolation[
discreteField /. {pt_List, {vx_, vy_}} :> {pt, vy},
InterpolationOrder -> All];

VectorPlot[{VxInt[x, y], VyInt[x, y]}, {x, -1, 2}, {y, -1, 2}]

curl[x_, y_] = -Derivative[0, 1][VxInt][x, y] +
Derivative[1, 0][VyInt][x, y]

DensityPlot[
curl[x, y] - Curl[field[{x, y}], {x, y}] // Evaluate, {x, -1,
2}, {y, -1, 2}, PlotLegends -> Automatic, PlotRange -> All]


As it is clear from the first and the second picture, there is a rotation in point (1.5 ,0). But the last output doesn't show a high value of the curl at this point.

• It's unwise to calculate curl at point (1.5, 0) when interpolation was done on points in region [−1,1]×[−1,1]. InterpolationFunction is not ExtrapolationFunction. Dec 4, 2017 at 10:20

You probably want an interpolation on the (un)structured grid.

Suppose you have a vector field in discrete points:

field[{x_, y_}] := {Sin[x y], Cos[x + y]};
randomPoints = RandomReal[{-1, 1}, {100, 2}];
discreteField = randomPoints /. p_List?(Length[#] == 2 &) :> {p, field[p]};

Graphics[discreteField /. {pt_List, v_List} :> Arrow[{pt, pt + 0.2 v}]]


You interpolate each component separately:

VxInt = Interpolation[discreteField /. {pt_List, {vx_, vy_}} :> {pt, vx},
InterpolationOrder -> All];
VyInt = Interpolation[discreteField /. {pt_List, {vx_, vy_}} :> {pt, vy},
InterpolationOrder -> All];

VectorPlot[{VxInt[x, y], VyInt[x, y]}, {x, -1, 1}, {y, -1, 1}]


Then you can treat it like a continuous function. For example, you can calculate the divergence and compare to the divergence of the initial field.

DensityPlot[
Div[{VxInt[x, y], VyInt[x, y]}, {x, y}] - Div[field[{x, y}], {x, y}]
// Evaluate, {x, -1, 1}, {y, -1, 1}, PlotLegends -> Automatic]


• What are white wholes in final graph? Dec 3, 2017 at 20:03
• When I change your final code to the below, It plots nothing!: DensityPlot[ Curl[{VxInt[x, y], VyInt[x, y]}, {x, y}] - Curl[field[{x, y}], {x, y}] // Evaluate, {x, -1, 1}, {y, -1, 1}, PlotLegends -> Automatic] Dec 3, 2017 at 20:10
• White regions show where values are out of range, try PlotRange->All to see all values. Unfortunately, Curl works strangely with InterpolatingFunction. Try curl[x_, y_] = -Derivative[0,1][VxInt][x,y]+Derivative[1,0][VyInt][x,y] and then DensityPlot[curl[x,y]-Curl[field[{x,y}], {x, y}]//Evaluate,{x,-1,1},{y,-1,1}] Dec 4, 2017 at 1:31
• I think there is a problem in the curl. Please see my edit to the question Dec 4, 2017 at 6:15