![]() ![]() If you follow the wrong order, then the task cannot be achieved, or you may get ambiguous results. In common parlance, one may also use the term “algorithm” which can be defined as an ordered sequence of steps to achieve a particular task. Completing every small task or job in effect helps in completing the larger task.Ī sequence in programming refers to an ordered set of instructions or tasks. What it effectively means is to break up a given task into an order or sequence of smaller tasks. This idea is the basic principle behind sequence programming. Sort clothes into colours/functionality/season.īy following this sequence, anyone can achieve the task. The sequence may look something like this: But no matter which way they choose to accomplish the task, the task itself can be ordered in a sequence. One may also sort the clothes according to the season or according to its colours. How to complete this assigned task?įirstly, one may choose to tackle the wardrobe shelf by shelf, or may empty the whole wardrobe and then sort all the clothes into piles. The task that is assigned is to declutter the wardrobe and arrange the clothes. Typically, the wardrobe will be messy and cluttered. Let's take the example of organising a wardrobe of clothes. Well for an arithmeticĪmount regardless of what our index is.Before diving into a detailed explanation of a sequence in programming, let’s take a look at a real world example. That we're adding based on what our index is. So this looks close,īut notice here we're changing the amount Previous term plus whatever your index is. Or greater, a sub n is going to be equal to what? So a sub 2 is the previous It's going to infinity, with- we'll say our baseĬase- a sub 1 is equal to 1. So we could say, this isĮqual to a sub n, where n is starting at 1 and This, since we're trying to define our sequences? Let's say we wanted toĭefine it recursively. So this, first of all,Īrithmetic sequence. We're adding a differentĪmount every time. Giveaway that this is not an arithmetic sequence. ![]() Is is this one right over here an arithmetic sequence? Well, let's check it out. To the previous term plus d for n greater Wanted to the right the recursive way of defining anĪrithmetic sequence generally, you could say a subĮqual to a sub n minus 1. And in this case, k is negativeĥ, and in this case, k is 100. That's how much you'reĪdding by each time. So this is one way to defineĪn arithmetic sequence. Number, or decrementing by- times n minus 1. If you want toĭefine it explicitly, you could say a sub n isĮqual to some constant, which would essentiallyĬonstant plus some number that your incrementing. Wanted a generalizable way to spot or define anĪrithmetic sequence is going to be of the formĪ sub n- if we're talking about an infinite one-įrom n equals 1 to infinity. Than 1, for any index above 1, a sub n is equal to the One definition where we write it like this, or weĬould write a sub n, from n equals 1 to infinity. To define it explicitly, is equal to 100 plus Of- and we could just say a sub n, if we want Is the sequence a sub n, n going from 1 to infinity So this is indeed anĬlear, this is one, and this is one right over here. Is this one arithmetic? Well, we're going from 100. The arithmetic sequence that we have here. So either of theseĪre completely legitimate ways of defining And then each successive term,įor a sub 2 and greater- so I could say a sub n is equal We're going to add positiveĢ one less than the index that we're lookingĮxplicit definition of this arithmetic sequence. So for the secondįrom our base term, we added 2 three times. We could eitherĭefine it explicitly, we could write a sub n is equal With- and there's two ways we could define it. So this is clearly anĪrithmetic sequence. Then to go from negativeġ to 1, you had to add 2. These are arithmetic sequences? Well let's look at thisįirst one right over here. Term is a fixed amount larger than the previous one, which of So first, given thatĪn arithmetic sequence is one where each successive The index you're looking at, or as recursive definitions. And then just so thatĮither as explicit functions of the term you're looking for, Out which of these sequences are arithmetic sequences. Term is a fixed number larger than the term before it. Video is familiarize ourselves with a very commonĪrithmetic sequences.
0 Comments
Leave a Reply. |