# find $f(a,b,c,d,e,f)$ definition based on input and output

I wonder if it will be possible to find an approximated function based on a simulation result.

I have a specific input and I would like it to produce a specific output. Is it possible to construct something like that and if yes so how?

• $f(28.78, 15.38, 6.58, 1.94, 0.29, 0.02) = 47$
• $f(22.05, 23.26, 20.20, 12.94, 4.06, 0.48) = 17$
• $f(20.89, 23.11, 20.83, 14.04, 4.56, 0.57) = 16$
• $f(13.88, 18.00, 22.72, 22.99, 10.54, 1.89) = 10$
• $f(9.92, 13.72, 19.24, 28.67, 17.35, 4.07) = 7$
• $f(2.99, 4.33, 6.86, 12.72, 41.03, 30.08) = 2$
• $f(1.48, 2.20, 3.56, 6.69, 22.18, 62.88) = 1$

Those numbers were found in a simulation done here.

• 6-dimensional function approximation based only on 7 points is going to be insanely inaccurate. – lisyarus Jul 28 '18 at 13:41
• @lisyarus I can produce more points. But I would like to understand the process, with an example so I can code it. This is a simulation result – Ilya Gazman Jul 28 '18 at 13:44

## 1 Answer

Calling

$$A_{m\times 7} = \left( \begin{array}{ccccccc} 28.78 & 15.38 & 6.58 & 1.94 & 0.29 & 0.02 & 1 \\ 22.05 & 23.26 & 20.2 & 12.94 & 4.06 & 0.48 & 1 \\ 20.89 & 23.11 & 20.83 & 14.04 & 4.56 & 0.57 & 1 \\ 13.88 & 18. & 22.72 & 22.99 & 10.54 & 1.89 & 1 \\ 9.92 & 13.72 & 19.24 & 28.67 & 17.35 & 4.07 & 1 \\ 2.99 & 4.33 & 6.86 & 12.72 & 41.03 & 30.08 & 1 \\ 1.48 & 2.2 & 3.56 & 6.69 & 22.18 & 62.88 & 1 \\ \cdots & \cdots &\cdots & \cdots &\cdots & \cdots & 1 \\ \end{array} \right)\;\; b_{7\times m} = \left( \begin{array}{c} 47 \\ 17 \\ 16 \\ 10 \\ 7 \\ 2 \\ 1 \\ \cdots \end{array} \right) X_{7\times 1} = \left( \begin{array}{c} x_1 \\ x_2 \\ x_3 \\ x_4 \\ x_5 \\ x_6 \\ x_7 \\ \end{array} \right)$$

we can adjust a hyper-plane with coefficients $X$ such that the error

$$E(X) = ||A\cdot X-b||^2$$

is minimum

This can be obtained by solving

$$X^* = \left((A^{\top}\cdot A)^{-1}\cdot A\right)\cdot b$$

NOTE

There are many ways to obtain this kind of data adjusting.

• Can you please provide more details with a full example. It is still hard for me to code. – Ilya Gazman Jul 28 '18 at 16:54