How do I algorithmically generate the nth term of this sequence?

  • Thread starter FrankDrebon
  • Start date
  • Tags
    Sequence
In summary, The conversation discusses a term in an equation that grows in an intuitive manner as the number of variables increases. The term is a sum of products of all coefficients except one, and there are methods for generating the nth term algorithmically. One method involves two independent loops, while another involves nested loops. Additionally, an explicit formula can be used if all original components are non-zero.
  • #1
FrankDrebon
9
0
Hi all,

I have a term in an equation that grows in an intuitive manner each time I increase the number of variables.

Basically, for an input vector of size n, this term is a sum of n terms, each of which is a product of n-1 components in the vector. Put simply, it is the sum of each unique way that the components of the vector can be multiplied together as a product of n-1 components.

I've probably explained that badly, so the first few terms can be found in the image below:

http://img52.imageshack.us/img52/1779/cvalues.jpg

It is fairly easy to compute the next term myself. However, I'd like to be able to find an algorithm for generating the nth term for inclusion in a MATLAB script.

Essentially the problem boils down to "how do I generate the nth term algorithmically?" I've run out of ideas, but can't help but think there would be some (relatively) simple matrix operation that could generate this. Maybe the pattern-hunters amongst you will notice something I haven't.

Any thoughts or suggestions welcome!
 
Last edited by a moderator:
Mathematics news on Phys.org
  • #2
FrankDrebon said:
Hi all,

I have a term in an equation that grows in an intuitive manner each time I increase the number of variables.

Basically, for an input vector of size n, this term is a sum of n terms, each of which is a product of n-1 components in the vector. Put simply, it is the sum of each unique way that the components of the vector can be multiplied together as a product of n-1 components.

I've probably explained that badly, so the first few terms can be found in the image below:

http://img52.imageshack.us/img52/1779/cvalues.jpg

It is fairly easy to compute the next term myself. However, I'd like to be able to find an algorithm for generating the nth term for inclusion in a MATLAB script.

Essentially the problem boils down to "how do I generate the nth term algorithmically?" I've run out of ideas, but can't help but think there would be some (relatively) simple matrix operation that could generate this. Maybe the pattern-hunters amongst you will notice something I haven't.

Any thoughts or suggestions welcome!

There is a trivially simple way to approach this. Notice that any term in your equation is the product of all coefficients (c(i), for i=1 ... n) with the exception of one. So, you can generate the total product of all coefficients (call it T), and then just do a summation over the terms, i.e. T/c(i).

In equation form this looks as follows:

T= product of all coefficients c(i) for i=1 ... n

[tex] A=\sum_{i=1}^n {{T}\over{c(i)}} [/tex]

So bascially you have two independent (i.e. not nested) loops. The first loop does the total product, and the second does the summation you are interested in. The only thing you have to worry about is cases where a coefficient is zero, but this is easily handled with some if statements.

If you expect no zero coefficients, then the above method is easy. If you expect cases with zeros, then you may prefer another approach as follows.

[tex] A=\sum_{i=1}^n \prod_{k \ne i} c(k)[/tex]

This is also easy, but now your two loops are nested. The outer loop does a summation and the inner loop does a product calculation, but always excludes one of the coefficients.
 
Last edited by a moderator:
  • #3
Nice one! None of the coefficients should be zero, so I won't have to worry about that. Thanks a lot mate.
 
  • #4
Hi, you can also find an explicit formula. If f is your function, T your product to begin with, and [tex]x_i[/tex] the components, you will have [tex]f^k(x_i)=T^{\frac{(n-1)^k-(-1)^k}{n}}x_i^{(-1)^k}[/tex] which can be proven inductively.

This will however only work when you originally have non-zero components. If you have more than one zero to begin with, [tex]f(x_i) = 0[/tex] for all i, and if you exactly one zero, say [tex]x_j[/tex], then [tex]f(x_i)=0[/tex] for all [tex]i \not = j[/tex], and [tex]f(f(x_i)) = 0[/tex] for all i, which is not a particulary interesting case.
 
Last edited:
  • #5


I would approach this problem by first looking for patterns in the sequence. The first few terms already show a clear pattern, with each term being the sum of the previous term and a new term that is a product of the current number of variables. This suggests that the next term can be generated by simply multiplying the current term by the number of variables and adding it to the previous term.

To confirm this pattern, I would test it with a few more terms and see if it holds true. If it does, then I would write a simple algorithm in MATLAB to generate the nth term based on this pattern. This algorithm could be easily incorporated into a larger script for further analysis.

Additionally, I would also explore if there are any existing mathematical concepts or operations that could be applied to this sequence. For example, the sequence may be related to binomial coefficients or other combinatorial concepts. By researching and understanding these concepts, I may be able to find a more efficient or elegant way to generate the nth term.

Overall, as a scientist, I would use a combination of pattern recognition, testing, and research to generate an algorithm for this sequence and continue to refine it for optimal efficiency and accuracy.
 

Related to How do I algorithmically generate the nth term of this sequence?

1. What is a sequence and why is it important?

A sequence is a series of ordered elements or events. In science, sequences are important because they allow us to understand patterns and relationships between different elements, and can provide valuable information about the underlying processes and mechanisms at work.

2. How do scientists make sense of a sequence?

Scientists use a variety of methods and tools to analyze a sequence. This may include statistical analysis, bioinformatics, and computer algorithms. By comparing the sequence to known patterns and databases, scientists can determine the function and significance of the sequence.

3. Can a sequence have multiple interpretations?

Yes, a sequence can have multiple interpretations depending on the context. For example, a DNA sequence can have different meanings depending on the location and surrounding genes. This is why it is important for scientists to consider all possibilities and use multiple methods to analyze a sequence.

4. What is the role of sequencing in genetic research?

Sequencing plays a crucial role in genetic research as it allows scientists to determine the exact sequence of DNA or RNA molecules. This information can be used to identify genetic variations, mutations, and potential disease-causing genes. It can also help in understanding the evolutionary relationships between different species.

5. How do sequencing technologies continue to advance scientific research?

Advancements in sequencing technologies have greatly expanded our understanding of the natural world. These technologies have made it faster, cheaper, and more accurate to sequence DNA, RNA, and proteins. This has enabled scientists to study complex biological processes and diseases in greater detail and has opened up new possibilities for personalized medicine and genetic engineering.

Similar threads

  • General Math
Replies
5
Views
2K
Replies
41
Views
9K
Replies
4
Views
1K
Replies
1
Views
1K
Replies
9
Views
4K
  • Calculus and Beyond Homework Help
Replies
11
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
2
Views
911
  • Calculus and Beyond Homework Help
Replies
1
Views
2K
  • Precalculus Mathematics Homework Help
Replies
24
Views
5K
Back
Top