You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,13 +110,13 @@ A = [f(x) for x in xs]
110
110
111
111
# linear interpolation
112
112
interp_linear =LinearInterpolation(xs, A)
113
-
interp_linear[3]# exactly log(3)
114
-
interp_linear[3.1]# approximately log(3.1)
113
+
interp_linear(3)# exactly log(3)
114
+
interp_linear(3.1)# approximately log(3.1)
115
115
116
116
# cubic spline interpolation
117
117
interp_cubic =CubicSplineInterpolation(xs, A)
118
-
interp_cubic[3]# exactly log(3)
119
-
interp_cubic[3.1]# approximately log(3.1)
118
+
interp_cubic(3)# exactly log(3)
119
+
interp_cubic(3.1)# approximately log(3.1)
120
120
```
121
121
which support multidimensional data as well:
122
122
```jl
@@ -127,13 +127,13 @@ A = [f(x+y) for x in xs, y in ys]
127
127
128
128
# linear interpolation
129
129
interp_linear =LinearInterpolation((xs, ys), A)
130
-
interp_linear[3, 2]# exactly log(3 + 2)
131
-
interp_linear[3.1, 2.1]# approximately log(3.1 + 2.1)
130
+
interp_linear(3, 2)# exactly log(3 + 2)
131
+
interp_linear(3.1, 2.1)# approximately log(3.1 + 2.1)
132
132
133
133
# cubic spline interpolation
134
134
interp_cubic =CubicSplineInterpolation((xs, ys), A)
135
-
interp_cubic[3, 2]# exactly log(3 + 2)
136
-
interp_cubic[3.1, 2.1]# approximately log(3.1 + 2.1)
135
+
interp_cubic(3, 2)# exactly log(3 + 2)
136
+
interp_cubic(3.1, 2.1)# approximately log(3.1 + 2.1)
137
137
```
138
138
For extrapolation, i.e., when interpolation objects are evaluated in coordinates outside of range provided in constructors, the default option for a boundary condition is `Throw` so that they will return an error.
139
139
Interested users can specify boundary conditions by providing an extra parameter for `extrapolation_bc`:
@@ -145,8 +145,8 @@ A = [f(x) for x in xs]
145
145
# extrapolation with linear boundary conditions
146
146
extrap =LinearInterpolation(xs, A, extrapolation_bc = Interpolations.Linear())
147
147
148
-
@test extrap[1-0.2]# ≈ f(1) - (f(1.2) - f(1))
149
-
@test extrap[5+0.2]# ≈ f(5) + (f(5) - f(4.8))
148
+
@testextrap(1-0.2)# ≈ f(1) - (f(1.2) - f(1))
149
+
@testextrap(5+0.2)# ≈ f(5) + (f(5) - f(4.8))
150
150
```
151
151
Irregular grids are supported as well; note that presently only `LinearInterpolation` supports irregular grids.
0 commit comments