I have a function that I as a programmer would express like this in pseudo-code:
myFunc(int[x0, x1, ... xn]){
return 1/((1/x0)+(1/x1)+...+(1/xn));
}
How is this expression written in a mathematical form?
I have a function that I as a programmer would express like this in pseudo-code:
myFunc(int[x0, x1, ... xn]){
return 1/((1/x0)+(1/x1)+...+(1/xn));
}
How is this expression written in a mathematical form?
AD's answer is slightly incorrect... your function would be written as $$f(x_0,\ldots,x_n) = \frac{1}{\sum_{k=0}^n \frac{1}{x_k}}$$ or perhaps $$f(x_0,\ldots,x_n) =\left(\sum_{k=0}^n x_k^{-1}\right)^{-1}.$$
Notice also that it is very closely related to the harmonic mean.
Let $A\subset(\mathbb{Z}\setminus\{0\})^{n+1}$ be defined as $$A=\left\{(x_0,\ldots,x_n)\in(\mathbb{Z}\setminus\{0\})^{n+1}\mid \sum_{i=0}^n x_i^{-1}\neq 0\right\}$$ and let $f\colon A\to\mathbb{R}$ be given by $$f(x_0,\ldots,x_n)=\left(\sum_{i=0}^n x_i^{-1}\right)^{-1}.$$
This takes in to account that one of the above questions isn't defined on its assumed domain (either the $(n+1)$-fold cartesian product of the integers, or the product of the integers without zero. The above function is actually well defined - that is, every element in its domain is mapped, by $f$, to a unique, well-defined element in the codomain.