Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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;
}
share|improve this question
1  
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#. –  IanC 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. –  IanC Feb 4 '12 at 16:06

1 Answer 1

up vote 2 down vote accepted

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) $$

share|improve this answer
    
Thanks much @Norbert! –  IanC Feb 4 '12 at 17:27
    
Just one question... is cartesian product correct? Isn't this simply product (k=1)? –  IanC Feb 4 '12 at 17:28
    
$\prod\limits_{i=1}^n x_i$ stands for $x_1\cdot x_2\cdot\ldots\cdot x_n$ –  userNaN Feb 4 '12 at 17:50
    
Oh, I was going off Wikipedia's page en.wikipedia.org/wiki/Math_symbols which states i= is cartesian product and k= is product... unless I am misreading it? –  IanC Feb 4 '12 at 17:56
1  
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. –  userNaN Feb 4 '12 at 18:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.