# Computing inverse functions of functions of two variables

There are several functions of two or three variables that I am working with. For this question I have made a small set showing the resistivity, $\rho$, in n$\Omega$m, of copper as a function of its purity ($RRR$ value) and its temperature, $T$, in Kelvin.

RRR\Temp [K]    20    90    160    230    300
60    0.27  3.1   8.15   12.9   17.5
300    0.06  2.81  7.84   12.6   17.2
500    0.04  2.78  7.81   12.5   17.2
1000    0.02  2.76  7.79   12.5   17.2


So this 'function' has the form

$\rho (T, RRR)$

Now, I do know how to make an interpolating function for two variables in my language of choice but I don't know how to change the variables, say to

$RRR (T, \rho)$

This would be very beneficial as the purity of the sample is only known approximately while the temperature and resistivity are known to great accuracy.

I have seen how to do this where an analytic representation is know by using a transform of independent variables. But when I thought about how I apply that to this to this problem I ran into a wall.

EDIT: To clarify what I mean when I say that the purity is known approximately: a particular sample may claim that its RRR is 100. If I check a sample of 6 AWG (1.33e-5 $m^2$), length 0.1 m at 293 K the calculation says I should see a resistance of 127.07 $\mu\Omega$. There will be a difference from the measured value but I should be able to distinguish the source of error, i.e. incorrect purity, instrumentation error, etc... Taking a data point at several temperatures and converting resistance back in to resistivity will be a good plan but this would necessitate the use of a function of the form:

$RRR(T, \rho)$

As to whether it is invertible, I think it is. I will always know the temperature. See contour plot below.

In principle, you should find another table, similar to the one you posted, this time with independent variables $T$, $\rho$, and dependent variable $RRR$. Then, you will find the $RRR$ function by interpolation.

In order to populate this table, for each point in the $(T, \rho)$-grid, say $(T_k, \rho_k)$, the corresponding value of $RRR$, say, $RRR_k$, will be numerically obtained as the root $RRR_k$ of the equation $$\rho_k = \rho(T_k, RRR_k),$$ where $\rho(\cdot)$ is the interpolating function you obtained above.

The above procedure works if the map $\rho(T, RRR)$ is invertible, i.e., the above equation has a unique solution.

• I edited the post to show some of the interpolated data (using a much larger set to create the interpolating function). There infinitely many places where $\rho$ has constant value with both independents free, but only one when you set constant a single independent variable. Does this meet the criteria for invertibility? – Chris Feb 22 '17 at 12:29
• @Chris The contours suggest that $\rho(\cdot, \cdot)$ is indeed an invertible function w.r.t. $RRR$ (for the range of values depicted), i.e., for a given tuple ($T$, $\rho$) there corresponds a single $RRR$ value. However, this is only a "visual conclusion", it may happen that the function is such that the numerical root-finding function you will employ gives a different $RRR$ value with a different estimate of the value. Try to populate the table as described above and see what happens. – Stelios Feb 22 '17 at 12:44
• I will work on constructing the table as you suggested. I imagine that it will work fine and should be easy to code in a loop using the original interpolating function. – Chris Feb 22 '17 at 16:19

The idea is to reverse your table so the variable $RRR$ will dependent by $T, \rho$, until here is similar to Stelios's answer.

Now with this new table you can find $RRR(T, \rho)$, and you have different way. I suggest to use some different methods respect to the interpolation for a couple of reasons:

1. according with your question the values of $RRR$ are affect by error, so forcing the interpolation have got not much meaning
2. This reason depending to the type of interpolation use but generally: good result of interpolation is depending by the nodes distribution, it is involved the Lebesgue's constant. By the table you have got a fixed set of nodes that you can not change, i.e. you have not much choice. Furthermore find good distribution of nodes for the multivariate case (your case id $2D$) that you can make of use it is not a trivial fact.

For this reason maybe you can think about an approximation approach (to clarify for example Least square). Always in the approximation environment there is RBF, this method can works on scattered data (no problem about nodes distribution)

• I have an interpolating function that I can map to a regular grid, so I have the ability to choose my nodes. Could you give more detail on how I could proceed when I can choose my nodes? – Chris Feb 22 '17 at 12:24
• @Chris my english is not so good (sorry in advance): when you say I have an interpolating function that I can map to a regular grid I understand that you have got the interpolation (already built) and you use it to calculate the value in a generic point. You need a particular distribution of nodes to built the interpolation (before). Unfortunately in general uniform grids are bad (think to the 1D case where uniform points are bad and Chebyshev nodes are good). – Mauro Vanzetto Feb 22 '17 at 12:54
• @Chris An example can be Padua Points. NOTE: I know it because I studied in Padova, but I don't work on it or use it. – Mauro Vanzetto Feb 22 '17 at 12:54
• thank you for the explanation. I am trying for best accuracy so I will read up on how best to distribute the nodes. – Chris Feb 22 '17 at 16:12