Summation for a Python function

In summary, the conversation involves a discussion on understanding the values in a given summation and how they are derived. The formula being discussed is Cn+1 = Ʃ Ck Cn-k from k = 0 to n, with C0 being defined as 1. The conversation also touches on the concept of recursive processes and the importance of avoiding double counting when iterating through cases.
  • #1
BK124
1
0

Homework Statement



For formatting sake I've copied a picture of the problem and attached it here: http://i.imgur.com/kOjTy.png

Im not worried about the coding part right now I feel I can handle that, my main issue is trying to understand how the values in the summation are derived. It seems simple enough, but I can't seem to grasp how they got the 10 values in the example there. Once I understand the summation, the coding should be easy. I just need a bit of guidance in how it all's working.

Homework Equations



Cn+1 = Ʃ Ck Cn-k from k = 0 to n

The Attempt at a Solution


Obviously
C0 = 1

Beyond that, here's what my understanding of it seems to be:
For C1
k starts at 0
C1 = C0 * C1-0 + C1 * C1-1

but this is where I get confused.
 

Attachments

  • gfhdfghfgh.PNG
    gfhdfghfgh.PNG
    27.8 KB · Views: 728
Technology news on Phys.org
  • #2
I suspect one defines the process recursively. How many ways can you draw a line segment between vertices? Each way divides the polygon into two smaller polygons.

You may then have to be careful iterating cases in a way that avoids double counting.
 
  • #3
BK124 said:
Cn+1 = Ʃ Ck Cn-k from k = 0 to n

The Attempt at a Solution


Obviously
C0 = 1

Beyond that, here's what my understanding of it seems to be:
For C1
k starts at 0
C1 = C0 * C1-0 + C1 * C1-1

but this is where I get confused.

hmm, i think you are reading the summation notation wrong, Cn+1 doesn't come into the equation, only Cn, the previous term.
C1 = C0*C0 = 1
C2 = C0*C1 + C1*C0 = 2
C3 = C0*C2 + C1*C1 + C2*C0 = 5
C4 = C0*C3 + C1*C2 + C2*C1 + C3*C0 = 14
and so on...
 

Related to Summation for a Python function

1. What is summation for a Python function?

Summation for a Python function is a process of adding up all the values returned by the function for different inputs. It is used to calculate the total output of a function over a range of inputs.

2. How is summation for a Python function different from a regular summation?

The main difference between summation for a Python function and a regular summation is that the former involves using a function to calculate the values to be added, while the latter simply involves adding a set of given numbers.

3. What is the syntax for summation in Python?

In Python, the syntax for summation using a function is: sum(function(x) for x in range(start, end+1)). This will return the total sum of the outputs of the function for all values of x from start to end.

4. Can I use any function for summation in Python?

Yes, you can use any function for summation in Python as long as the function takes in a numerical input and returns a numerical output. This includes built-in functions, user-defined functions, and lambda functions.

5. What are the benefits of using summation for a Python function?

Using summation for a Python function allows for a more efficient and concise way of calculating the total output of a function over a range of inputs. It also allows for greater flexibility in terms of the type of function that can be used for summation.

Similar threads

  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
10
Views
2K
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
2
Replies
55
Views
4K
  • Programming and Computer Science
Replies
5
Views
2K
  • Programming and Computer Science
Replies
3
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
7
Views
618
  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
Replies
2
Views
947
Back
Top