From: Suvabrata on 18 Nov 2009 11:09 Dear all, I'm having problems in getting MuPAD to perform multiple summations. For example, the following is a sum over four indices (m,n,k and q): sum(b_m * sum(c_n * (-1/2)^(2*N - m - n) * sum(a_m_k * sum((-1)^-(k+q) * a_n_q * kroneckerDelta(m+2*k, n+2*q), q=0..N-n), k=0..N-m), n=0..N), m=0..N) where, a_m_k:=((m+2*k)!*(2*(N-k)-m)!)^(1/2)/((m)!*(k)!*(N-m-k)!) etc. The output given is: b_m*c_n*sum(sum((-1/2)^(2*N - m - n)*sum(piecewise([2*k + m + n <= 2*N and 1/2*m - 1/2*n in Z_ and 1/2*n <= 2*k + m, ((-1)^(n/2 - m/2 - 2*k)*a_n_q*((2*N - 2*k - m)!*(2*k + m)!)^(1/2))/((N - k - m)!*k!*m!)], [not 2*k + m + n <= 2*N or not 1/2*m - 1/2*n in Z_ or not 1/2*n <= 2*k + m, 0]), k = 0..N - m), n = 0..N), m = 0..N) This output is strange; e.g. why have b_m and c_n (which are functions of m and n respectively) been taken outside the sum? Maybe this is not the way to calculate multiple summations (looked in the help guide but found nothing) or maybe I've made some other mistakes? I'd be really grateful for any help/responses. Thanks, SD
From: Steven Lord on 18 Nov 2009 11:39 "Suvabrata " <suavaderoy(a)hotmail.com> wrote in message news:he1672$410$1(a)fred.mathworks.com... > Dear all, > > I'm having problems in getting MuPAD to perform multiple summations. For > example, the following is a sum over four indices (m,n,k and q): > > sum(b_m * sum(c_n * (-1/2)^(2*N - m - n) * sum(a_m_k * sum((-1)^-(k+q) * > a_n_q * kroneckerDelta(m+2*k, n+2*q), q=0..N-n), k=0..N-m), n=0..N), > m=0..N) > > where, > > a_m_k:=((m+2*k)!*(2*(N-k)-m)!)^(1/2)/((m)!*(k)!*(N-m-k)!) > > etc. > > The output given is: > > b_m*c_n*sum(sum((-1/2)^(2*N - m - n)*sum(piecewise([2*k + m + n <= 2*N and > 1/2*m - 1/2*n in Z_ and 1/2*n <= 2*k + m, ((-1)^(n/2 - m/2 - > 2*k)*a_n_q*((2*N - 2*k - m)!*(2*k + m)!)^(1/2))/((N - k - m)!*k!*m!)], > [not 2*k + m + n <= 2*N or not 1/2*m - 1/2*n in Z_ or not 1/2*n <= 2*k + > m, 0]), k = 0..N - m), n = 0..N), m = 0..N) > > This output is strange; e.g. why have b_m and c_n (which are functions of > m and n respectively) been taken outside the sum? Because you haven't told MuPAD that b_m and c_n are functions of m and n. It sees b_m and c_n and says "Hey, these are constants, I can move them through the summation operator." If you're using the Symbolic Math Toolbox interface to MuPAD, you could try something like: BM = sym('b(m)') that should alert MuPAD to the fact that b is a function of m. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
From: Suvabrata on 19 Nov 2009 07:50 "Steven Lord" <slord(a)mathworks.com> wrote in message <he17t0$l2q$1(a)fred.mathworks.com>... > > "Suvabrata " <suavaderoy(a)hotmail.com> wrote in message > news:he1672$410$1(a)fred.mathworks.com... > > Dear all, > > > > I'm having problems in getting MuPAD to perform multiple summations. For > > example, the following is a sum over four indices (m,n,k and q): > > > > sum(b_m * sum(c_n * (-1/2)^(2*N - m - n) * sum(a_m_k * sum((-1)^-(k+q) * > > a_n_q * kroneckerDelta(m+2*k, n+2*q), q=0..N-n), k=0..N-m), n=0..N), > > m=0..N) > > > > where, > > > > a_m_k:=((m+2*k)!*(2*(N-k)-m)!)^(1/2)/((m)!*(k)!*(N-m-k)!) > > > > etc. > > > > The output given is: > > > > b_m*c_n*sum(sum((-1/2)^(2*N - m - n)*sum(piecewise([2*k + m + n <= 2*N and > > 1/2*m - 1/2*n in Z_ and 1/2*n <= 2*k + m, ((-1)^(n/2 - m/2 - > > 2*k)*a_n_q*((2*N - 2*k - m)!*(2*k + m)!)^(1/2))/((N - k - m)!*k!*m!)], > > [not 2*k + m + n <= 2*N or not 1/2*m - 1/2*n in Z_ or not 1/2*n <= 2*k + > > m, 0]), k = 0..N - m), n = 0..N), m = 0..N) > > > > This output is strange; e.g. why have b_m and c_n (which are functions of > > m and n respectively) been taken outside the sum? > > Because you haven't told MuPAD that b_m and c_n are functions of m and n. > It sees b_m and c_n and says "Hey, these are constants, I can move them > through the summation operator." > > If you're using the Symbolic Math Toolbox interface to MuPAD, you could try > something like: > > BM = sym('b(m)') > > that should alert MuPAD to the fact that b is a function of m. > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ > Thanks for pointing that out.
|
Pages: 1 Prev: Transfer function (tf) with sqrt function. Next: How to use mxCreateCharArray? |