# Help with the mathematical representation of operations on a matrix

I need to know how to represent the following as a mathematical formula using proper math notation:

I have a $1\times n$-matrix of $3$-tuples $[a, r, x]$. I need to represent the following logic mathematically:

for each element in the matrix set $x = a r-a+1$ then $$X = x_0 \cdot x_1\cdot\ldots\cdot x_n$$ $$A = \operatorname{average}(a_0,\ldots,a_n)$$ $$Z = X \cdot A$$

In C#:

struct Element
{
public double a;
public double r;
public double x;
}

private void button15_Click(object sender, EventArgs e)
{
// define the matrix
Element[] matrix = new Element[3];
Element elem;

// populate the matrix with something
matrix[0] = new Element { a = 1, r = 0.9 };
matrix[1] = new Element { a = 0.75, r = 0.2 };
matrix[2] = new Element { a = 1, r = 1 };

// for each element, calculate x
for (int i = 0; i < matrix.Length; i++)
{
elem = matrix[i];
elem.x = elem.a * elem.r - elem.a + 1;
}

// determine X and A
elem = matrix[0];
double X = elem.x;
double A = elem.a;

// calculate for each element, starting at 1
for (int i = 1; i < matrix.Length; i++)
{
elem = matrix[i];
X *= elem.x;
A += elem.a;
}

A /= matrix.Length;
// X is equal to matrix[0].x * matrix[1].x * matrix[2].x
// A is equal to Average(matrix[0].a, matrix[1].r, matrix[2].r)
double Z = X * A;
}

-
I don't get it. Please be more specific! – draks ... Feb 3 '12 at 20:14
I'm sorry @draks, I thought that was extremely specific. I'll write the algorithm out in C#. – IamIC Feb 4 '12 at 8:09
But what is the question? – Henning Makholm Feb 4 '12 at 13:40
How do I represent this as a math formula. – IamIC Feb 4 '12 at 16:06

Here are they $$X=\prod\limits_{i=0}^nx_i=\prod\limits_{i=0}^n(a_i r_i-a_i+1)\qquad\qquad A=\frac{1}{n+1}\sum\limits_{i=0}^n a_i$$ $$Z=X\cdot A=\left(\prod\limits_{i=0}^n(a_i r_i-a_i+1)\right)\left(\frac{1}{n+1}\sum\limits_{i=0}^n a_i\right)$$
$\prod\limits_{i=1}^n x_i$ stands for $x_1\cdot x_2\cdot\ldots\cdot x_n$ – Norbert Feb 4 '12 at 17:50
Oh, finally I got what you meant! The meaning of $\prod\limits_{i=1}^n$ and $\prod\limits_{k=1}^n$ is the same. The letter used under symbol $\prod$ is called index. We can use any letter to denote index. Distinguishing product of numbers and cartesian product relies on the context of mathematical text. You must have some math background to easly determine meaning from context. – Norbert Feb 4 '12 at 18:14