-1
$\begingroup$

I have the given dataset

dat1 = {{0, 0, 1, 10}, {0, 0, 2, 5}, {0, 1, 1, 4}, {0, 1, 2, 3.5}, {1,
0, 1, 0.8}, {1, 0, 2, 0.6}, {1, 1, 1, 0.4}, {1, 1, 2, 0.2}}

In the data set 1st element is 'r', second element is 'z', third element is 'E' and the fourth element is value of the function at r, z and E ie. F(r, z, E).

I want to do the interpolation such that I can get the value of F(r, z E) at any r,z and E.

I have tried the following :

    intdat = Flatten[dat1]
    f[z_, r_, e_] := Interpolation[intdat]

But I do not get my desired interpolated value.

$\endgroup$
2
  • 1
    $\begingroup$ What have you tried so far? There's an example exactly like this in the documentation for Interpolation. If we can see the code you tried, it might be easier for us to point out any issues in the code. $\endgroup$
    – MassDefect
    Commented Dec 14, 2018 at 7:13
  • $\begingroup$ I have tried this : dat1 = {{0, 0, 1, 10}, {0, 0, 2, 5}, {0, 1, 1, 4}, {0, 1, 2, 3.5}, {1, 0, 1, 0.8}, {1, 0, 2, 0.6}, {1, 1, 1, 0.4}, {1, 1, 2, 0.2}}, f = Table[dat1],dintp[z_, r_, e_] := Interpolation[Flatten[f]]. But I did not get the result $\endgroup$ Commented Dec 15, 2018 at 19:31

1 Answer 1

2
$\begingroup$

The documentation for Interpolation suggests the following format for multidimensional interpolations:

f = Interpolation[{Most@#, Last@#} & /@ dat1]
f[0.5, 0.5, 1.5] (* 3.0625 *)

It is unclear why you are Flattening the dataset. Evaluating f with three arguments that lie within the provided ranges should work.

$\endgroup$
2
  • $\begingroup$ In fact f = Interpolation[dat1] does work, but gives a Interpolation::inhr: "Requested order is too high; order has been reduced to {1,1,1}" error. So, simply f = Interpolation[dat1, InterpolationOrder -> {1, 1, 1}]. $\endgroup$
    – corey979
    Commented Dec 15, 2018 at 22:24
  • $\begingroup$ Thanks a lot bobthechemist. The method is working for me $\endgroup$ Commented Dec 16, 2018 at 6:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.