# How can I parametrically fit a surface to another surface?

I begin with a function of two variables. A highly simplified version of that function is:

F1->E^-E^- ϕ1 + E^-E^- ϕ2


$$e^{-e^{-\text{\phi 1}}}+e^{-e^{-\text{\phi 2}}}$$

I have generated a coarse-grained approximation to this function, a simplified version of which is:

F2->E^(T (E^g((1/(1 + E^-ϕ1) + 1/(1 + E^-ϕ2)) )))


$$e^{T \left(e^g \left(\frac{1}{e^{-\text{\phi 1}}+1}+\frac{1}{e^{-\text{\phi 2}}+1}\right)\right)}$$

I need to find the values of T and g which give the best geometric fit of the approximation to the original function. Any advice would be great; thanks!

• Is there a particular range of $\phi_1$ and $\phi_2$ values that are of interest? But why completely knowing $F_1$ would one need a more complex function $F_2$ that has parameters to be estimated? – JimB Jan 31 at 14:03
• Yes, both variable domains are {0,1}. – dr_strangeloop Jan 31 at 14:20
• Thanks. But your approximation requires more information than the original function. How does that make any sense? What am I missing? – JimB Jan 31 at 14:32
• I agree that it looks artificial. This is part of a much larger procedure using renormalization group methods. The basic idea is to start with a detailed model, guess at an approximate, coarse-grained model that preserves the essential features of the full model, and formulate a transformation between the two models. Here, I've coarse grained from the two phi coordinates to an effective single phi coordinate. I then assume that the renormalised model has the same form as the full model (one of the two terms), and then substitute in the transformation for the coarse grained phi to get the aprx – dr_strangeloop Jan 31 at 17:33

I solved it in the following way, which gives a satisfactory answer for my purposes.

First, I generate a list of 3D coordinates from the original function, at grid size 'fitres':

fitres = 0.01;
F1list =
Flatten[Table[{\[Phi]1, \[Phi]2,E^-E^- ϕ1 + E^-E^- ϕ2}, {\[Phi]1, 0, 1, fitres}, {\[Phi]2, 0, 1,
fitres}], 1];


Now, use this as 'data' for FindFit:

fitparams =
FindFit[F1list, E^(T (E^g((1/(1 + E^-ϕ1) + 1/(1 + E^-ϕ2)) ))), {g, T}, {\[Phi]1, \[Phi]2}]


The result gives values for g and T which produce what looks like a good fit when plotted.

If someone else knows a better way, would be great to hear it!