Nested Summation Computation for M_K with MATLAB

In summary, the conversation discusses an attempt to compute a summation using MATLAB. The summation involves a formula for M_K and the size of h_i, and the codes provided are for a specific case of K=4 and L=4. The speaker is unsure if the codes are correct and asks for help in fixing them.
  • #1
omer21
25
0
[itex]
M_{K}=\frac{1}{2^{k+1}-2}\sum_{i=0}^{L-1}\sum_{l=1}^{K}\binom{K}{l}h_{i}i^{l}M_{K-l}
[/itex]

[itex]M_0=1[/itex] and the size of [itex]h_i[/itex] is [itex]L[/itex].

I tried to compute this summation in matlab, my attempt is as following:
Code:
clear
h=[ (1+sqrt(3))/4 (3+sqrt(3))/4 (3-sqrt(3))/4 (1-sqrt(3))/4]'; 
% for simplicity i take K=4 and L=4 
K=4;
L=4;
k=1;
M=zeros(1,K+1);
M(1)=1;

for l=1:K
    for i=1:L
        for j=1:k
            M(l+1)=M(l+1)+nchoosek(k,j)*h(i)*((i-1)^l)*M(l);
        end
    end
    k=k+1;
    M(l+1)=(1/(2^(K+1)-2))*M(l+1);
end

But I'm not sure whether the codes are correct or not. If the codes are not correct how can i fix them?
 
Physics news on Phys.org
  • #2
problem is solved.
 

1. What is a nested summation in computing?

A nested summation in computing is a mathematical operation where one summation is performed within another summation. This means that the inner summation is evaluated for each value of the outer summation.

2. How is nested summation used in data analysis?

Nested summation is commonly used in data analysis to calculate the sum of multiple variables that are grouped or nested within each other. For example, in a dataset with multiple categories and subcategories, nested summation can be used to calculate the total for each category and the overall total.

3. What are some common applications of nested summation?

Nested summation has various applications in computer science, including algorithm analysis, probability calculations, and image processing. It is also commonly used in physics, engineering, and other fields that involve complex mathematical calculations.

4. How is nested summation different from regular summation?

The main difference between nested summation and regular summation is that nested summation involves multiple summations within each other, while regular summation involves a single summation over a set of values. Nested summation is also more complex and requires careful consideration of the order of operations.

5. What are some challenges in computing nested summation?

One of the main challenges in computing nested summation is determining the correct order of operations to avoid errors. Another challenge is dealing with large datasets, as the computation time and memory usage can significantly increase with nested summation. Additionally, understanding the problem and setting up the correct equations can be challenging for beginners.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
566
Replies
0
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • Introductory Physics Homework Help
Replies
10
Views
899
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Back
Top