4
$\begingroup$

I'm not very good at mathematics, so please bear with me.

How can you determine / define a function based on sets of values of its input and output parameters.

You have: $f(x_{1_1}, x_{1_2}, \ldots , x_{1_n}) = y_1$

$f(x_{2_1}, x_{2_2}, \ldots , x_{2_n}) = y_2$

...

$f(x_{n_1}, x_{n_2}, \ldots , x_{n_n}) = y_n$

You want: $$f(x_1, x_2, \ldots , x_n) = a_1(x_1)^{b_1} + a_2(x_2)^{b_2} + \cdots + a_n(x_n)^{b_n}$$

Let's assume that you have enough (how much is enough?) sets of input and output parameters.

What software could do this and how (excel, mathematica, r, ... ?). I'm looking for the simplest solution.

p.s. I need it only to define $f(x_1,x_2)=y$ function, but at the same time I'd like to learn more about all of this. Thank you for your time and answers.

$\endgroup$
5
  • $\begingroup$ The answer won't always necessarily be unique, so you need to make a decision on how you want to "fill in the gaps". Read this for starters: en.wikipedia.org/wiki/Interpolation $\endgroup$
    – tomcuchta
    Commented Dec 28, 2011 at 20:07
  • $\begingroup$ How sure are you about the exact form of the "you want" function? It would be a much more approachable problem if you were looking for a polynomial solution -- that is, if you allowed more than one term containing each variable, and required the exponents to be integers. $\endgroup$ Commented Dec 28, 2011 at 20:34
  • $\begingroup$ Well I assume (99%) that it is polynomial, I could also assume (80%) that exponents are integers. $\endgroup$
    – Ben
    Commented Dec 28, 2011 at 21:16
  • $\begingroup$ How about having more terms for each variable, and/or cross terms? Do you have an upper bound for the exponents? Are you free to choose the sample points? $\endgroup$ Commented Dec 28, 2011 at 23:17
  • $\begingroup$ I am free to choose the sample points. Well there definitely is an upper bound for exponents, I guess it should be 3 or 4. $\endgroup$
    – Ben
    Commented Dec 28, 2011 at 23:48

2 Answers 2

5
$\begingroup$

You are solving a set of nonlinear simultaneous equations. As you have $2n$ values to evaluate (all the $a_n$'s and all the $b_n$'s) you need $2n$ pieces of data. In general there will be many solutions because of the $b_n$ exponents-do you really mean that? If all the $b_n$ are $1$ the problem is linear and much easier. For the linear problem the solutions are not hard and Excel's matrix tools will find the solution. For the nonlinear problem you will probably find too much of a mess without using a multidimensional function minimizer, found in many numerical analysis texts (and Excel's Goal Seek) but that gives a numeric answer, not an algebraic one.

$\endgroup$
1
  • $\begingroup$ I have no idea what kind of a function f(x,y) could be. What I mean was that I would want to get something like this: f(x,y) = 5*x^3 *y^2 + 7*x^2*y^4 + 3xy + 5y^2 $\endgroup$
    – Ben
    Commented Dec 28, 2011 at 20:19
1
$\begingroup$

Each data point $f(x_{i,1},\ldots,x_{i,n}) = y_i$ corresponds to one equation in the $2n$ variables $a_1, b_1, \ldots, a_n, b_n$. "Typically" you'd want the same number of equations as variables. Unfortunately these are nasty transcendental equations. It's hard to predict whether real solutions will exist or be unique, and finding them will almost certainly require numerical methods. Maple, Mathematica, Matlab, maybe even Excel will probably be able to solve the equations. For example, here's Maple on a randomly-chosen case with $n=3$.

eqs:= {a1*5^b1+a2*2^b2+a3*5^b3 = 6, a1*2^b1+a2*3^b2+a3*4^b3 = 4, a1*6^b1+a2*5^b2+a3*3^b3 = 1, a1*5^b1+a2*2^b2+a3*3^b3 = 2, a1*2^b1+a2*4^b2+a3*3^b3 = 3, a1*1^b1+a2*2^b2+a3*5^b3 = 4};

fsolve(eqs);

${a1 = -3.575581132, a2 = 6.279366686, a3 = -30.92905576, b1 = 66.19615719, b2 = -2.879205097, b3 = 11.74564989}$

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .