# Compute inner product of using a double sum vector [closed]

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.

• 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! – MarcoB May 30 '18 at 1:33
• @MarcoB Thanks for your reply, I've changed the notation. I hope now is better. I did not notice the mathematica syntax problems. – mors May 30 '18 at 14:57
• 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? – Michael E2 May 30 '18 at 16:45
• Sorry, that was an error while I was editing. – mors May 30 '18 at 17:19

veca[n_, inf_] :=