6
You can use Derivative[0, 1][int] to get the first derivative of int with respect to your second variable $y$.
To illustrate, let's create some data and interpolate:
data = Table[{x, y, Sin[x] + 2 y}, {x, 0., 10.}, {y, 0., 10.}] ~ Flatten ~ 1;
int = Interpolation[data];
Plot3D[int[x, y], {x, 0, 10}, {y, 0, 10}]
Then obtain the first derivative with respect ...
6
We can draw y=f[x] by
ParametricPlot[{x, f[x]}, {x, 0, 2}]
and draw its inverse x=f[y] by
ParametricPlot[{f[y], y}, {y, 0, 2}]
f[x_] := 2 A ArcTanh[(# A)/Sqrt[-1 + #^2 B]] +
A Log[1 + #^2 (A^2 - B)] - 2 Log[# B + Sqrt[-1 + #^2 B]] &[
x] /. {A -> 0.2, B -> 0.3} // Abs;
ParametricPlot[{{x, f[x]}, {f[x], x}}, {x, 0, 2}]
We can also ...
4
You can use Integrate to accumulate an InterpolatingFunction:
Integrate[FunctionInt[x, y], x, y] /. {x -> 100, y -> 100}
(* 0.601376 *)
Addendum:
If the interpolation grid is regular as in the example (spacing = 0.05), here's a quick way using a manual trapezoidal rule:
With[{fvals = Head[FunctionInt[x, y]]["ValuesOnGrid"]},
Nest[Total[...
3
Removing linear trend, as suggested in comments, is almost a one-liner (check out, Fit, FindFit, LinearModelFit):
data=Import["https://pastebin.com/raw/aWYk1Jba"];
lm=LinearModelFit[data,x,x];
ListLinePlot[Transpose[{data[[All,1]],lm["FitResiduals"]}],
PlotLabel->lm["BestFit"],PlotTheme->"Detailed"]
answered Dec 23 '20 at 5:07
Vitaliy Kaurov
66.4k77 gold badges179179 silver badges314314 bronze badges
3
Find the domain over which the values are not zero:
minmaxes = MinMax /@ Transpose@Select[DataInt, #[[3]] != 0 &]
(* Out: {{0., 2.1}, {0., 1.5}, {0.0121552, 8.67114}} *)
Select a square region that includes that domain and interpolate over that:
squareint =
Interpolation[
Select[DataInt, 0 <= #[[1]] <= 2.1 && 0 <= #[[2]] <= ...
3
A Sinc interpolation can be done along the same same idea as a Lagrange interpolation:
Assuming we have equally spaced data points, we seek a function ipol that is 1 at x==0 and zero at every other data argument. The sum of ipol[x-x[[i]]] dat[[i]] over i gives then an interpolation function. By this the highest frequency is given by half the sample rate.
To ...
3
With the data:
Function1[x_, y_] = If[4 < x^3 + y^4 - x^2 < 5, Exp[-x^2 + y^2], 0];
DataInt =
Flatten[ParallelTable[{x, y, Function1[x, y]},
{x, 0, 100, 0.05}, {y, 0, 100, 0.05}], {2, 1}];
FunctionInt[x_, y_] = Interpolation[DataInt, InterpolationOrder -> 1][x, y];
You could try:
ir = ImplicitRegion[{4 < x^3 + y^4 - x^2 < 5, 0 < x ...
2
If we want to use FFT to get an expansion in circular functions we can proceed as follows:
FFT can be look at as a base change with the new base functions: Exp[2Pi I x f]. This is not too simple, because the FFT returns the coefficients like: First DC component, then coefficients of functions with increasing frequencies and pos. exponents. Up to the highest ...
2
$Version
(* "12.2.0 for Mac OS X x86 (64-bit) (December 12, 2020)" *)
Clear["Global`*"]
Use Piecewise rather than If for numeric functions
Function1[x_, y_] = Piecewise[{{Exp[-x^2 + y^2], 4 < x^3 + y^4 - x^2 < 5}}];
int1 = NIntegrate[Function1[x, y], {x, 0, 100}, {y, 0, 100}]
(* 0.597656 *)
reg = ImplicitRegion[
4 < x^3 +...
1
I different version of the workflow from Vitaliy's answer using both Quantile Regression and Least Squares fits. Note that the de-trending results are slightly different.
Get the QRMon package:
Import["https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MonadicProgramming/MonadicQuantileRegression.m"]
Get data:
data = ...
1
You can find the two inverses by generating a differential equation of foo and solve with NDSolve applied to two initial conditions. Even derivatives of inverse function can be produced.
pts = Table[{i, i^2}, {i, -10, 10}];
foo = Interpolation[pts];
dinv = D[foo[x[y]] == y, y]
xsol[y_] =
x[y] /. NDSolve[{dinv, #}, x, {y, 100, 0}] & /@ {x[100] == -...
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
interpolation × 847plotting × 151
differential-equations × 115
numerical-integration × 100
fitting × 54
list-manipulation × 53
equation-solving × 45
calculus-and-analysis × 42
numerics × 39
finite-element-method × 39
splines × 39
data × 36
functions × 34
graphics × 26
performance-tuning × 26
bugs × 23
function-construction × 22
mathematical-optimization × 22
warning-messages × 21
polynomials × 19
table × 16
mesh × 16
graphics3d × 13
piecewise × 12
smoothing × 10