Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

We are a group of students who are struggling with transforming this formula to run in mathematica. In fact there are many formulas that we are struggling with, but if we are able to see how this is solved we should be able to see how it is done and apply it to the other formulas ourself.

We tried using spares Array but was not able to compute it.

enter image description here

Subscript[x, 1]={{1,2}}
Subscript[x, 2]={{1,3}}\[Transpose]
Subscript[x, 3]={{1,4}}\[Transpose]
e={{2,4,5}}\[Transpose]

T is set to 3. and Subscript[w, j]= 1-j/H


1/T\!\(
\*UnderoverscriptBox[\(\[Sum]\), \(t = 1\), \(T\)]
\*SuperscriptBox[
SubscriptBox[\(e\), \(t\)], \(2\)]\)Subscript[x, t]Subscript[x, t]\[Transpose]+1/TUnderoverscript[\[Sum], j=1, H-1]Subscript[w, j]Underoverscript[\[Sum], s=j+1, T]Subscript[e, s]Subscript[e, s-j](Subscript[x, s]Subscript[x, s-j]\[Transpose]+Subscript[x, s-j]Subscript[x, s]\[Transpose])
share|improve this question
2  
Alexander, explain please a bit more, what are the objects you operate with (vectors? matrices? other objects, what then?), and what are you going to achieve with them: calculate the result of operations, or display them in some text? In the latter case please specify, where in the text: e.g. in a separate line, a numbered equation and so on. –  Alexei Boulbitch Jan 28 at 8:18
1  
Alexander, while the fancy 2D typesetting looks good in the Mathematica front end, as you can see it doesn't translate to text very nicely. May I suggest you write your expression in one-dimensional InputForm, e.g. instead of $\sum _{i=1}^n x_i$ use Sum[Subscript[x, i], {i, 1, n}]. Personally I would also use downvalues instead of subscripts, e.g. instead of Subscript[x,i] use x[i]. –  Simon Woods Jan 28 at 9:02
    
Write your vectors as one dimensional, multiply them with Dot (or infix .), and don't do all the transposing of matrices. This is the gist of @belisarius' response, and it's a good one (note to self: upvote it). –  Daniel Lichtblau Feb 27 at 14:49

1 Answer 1

Perhaps:

x = {{1, 2}, {1, 3}, {1, 4}}
e = {2, 4, 5};
T = 3;
H = 4(*I guess ??*);
w[j_] := 1 - j/H
res = 1/T Sum[e[[t]]^2 (x[[t]].x[[t]]), {t, T}] +
      1/T Sum[ w[j] Sum[2 e[[s]] e[[s-j]] (x[[s]].x[[s-j]]), {s, j+1, T}], {j, H-1}]
(*
 1169/3
*)
share|improve this answer
    
The left hand side of the + sign is right if you take into account that the x1 is suppose to be a column vector. so for the dimensions and the formula to be correctly calculated we need to take the {x[[t]]}transpose.{x[[t]]}, the reason for this is that in the formula the first is a column while the second is a row. In your x that you have defined x[[1]] comes out as a row and not a column you therefor need to transpose it. –  ALEXANDER Jan 30 at 17:16
    
the calculations on the right hand side of the + sign I am not sure of, there is a problem there with the transpose as well, but I do not get how the SUM[Sum] work, in which order does mathematica do the summation? –  ALEXANDER Jan 30 at 17:18

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.