I am struggling to create a vector in Mathematica to compute an inner product. The first vector whose elements are generated over the sum over $m$ is

$$a = \sum_{m=0}^n\sum_{r=0}^m C_r a_m + \sum_{m=n+1}^\infty\sum_{r=0}^n C_r a_m \\= \sum_{m=0}^n\sum_{r=0}^m\binom{n}{r}\frac{\lambda^{n-2r+m}}{(m-r)!}\sqrt{m!}a_m+\sum_{m=n+1}^\infty\sum_{r=0}^n \binom{n}{r}\frac{\lambda^{n-2r+m}}{(m-r)!}\sqrt{m!}a_m$$

I think that this means that when $m=0$ corresponds to the $0$ entrance of the vector and so on until the vector is filled. And the second vector is

$$ l=\sum_{n0=0}^\infty n0$$

and I need to compute the inner product $\langle l, a\rangle $.

The thing is that I do not know how to compute the double sums of the first vector. Right now I've used

veca[n_, inf_] := (Sum[Binomial[n, r](lambda^(n - (2*r) + m)*
      Sqrt[(m!)])/((m - r)!)), {m, 0, n}, {r, 0, m}] + ((Binomial[n, r](lambda)^(n - (2*r) + m)*
      Sqrt[(m!)])/((m - r)!)), {m, n + 1, inf}, {r, 0, n}])

The problem is that until now I am not sure how to understand this, and I think the way I defined the functions it is incorrect. Does anyone has a clue how to define this type of functions properly?. Thaks in advance.

  • $\begingroup$ There are quite a few syntax problems in your code. For instance, different kinds of brackets mean different things in MMA; only use () to indicate operator precedence. Also note that your Latex and MMA formulae are not the same. Should it be Sqrt[m!] as in the MMA code, or Sqrt[m] as in the formula? Also, what do you mean by your bra and ket notations? We need so much more information! $\endgroup$ – MarcoB May 30 '18 at 1:33
  • $\begingroup$ @MarcoB Thanks for your reply, I've changed the notation. I hope now is better. I did not notice the mathematica syntax problems. $\endgroup$ – mors May 30 '18 at 14:57
  • $\begingroup$ Why can you factor $a_m$ out of the summation, when $m$ is not a free variable but bound by the outer summations of the two initial terms? $\endgroup$ – Michael E2 May 30 '18 at 16:45
  • $\begingroup$ Sorry, that was an error while I was editing. $\endgroup$ – mors May 30 '18 at 17:19

The following translates your Latex sum-of-two-double-sums expression into valid Mathematica syntax. It is not an answer to your question, but you need to have valid syntax before you can go further in solving it.

veca[n_, inf_] := 
  Sum[Binomial[n, r] λ^(n - 2 r + m) Sqrt[m]/(m - r)!, {m, 0, n}, {r, 0, m}] + 
  Sum[Binomial[n, r] λ^(n - 2 r + m) Sqrt[m]/(m - r)!, {m, n + 1, inf}, {r, 0, n}]
  • $\begingroup$ thanks for the correction of the syntax, I was able to get rid of some errors $\endgroup$ – mors May 30 '18 at 15:51

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