From the course: Mathematica 11 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Identify the first or last item in a list - Mathematica Tutorial
From the course: Mathematica 11 Essential Training
Identify the first or last item in a list
- [Instructor] When you store data in a Mathematica list, you might just care about the collection as a whole and not the individual items. On the other hand, you might want to find the first and last item of the list. Those elements could represent your first or last measurement of an experiment, which might provide insights into your results. I'm working in a blank Mathematica notebook. So I will start by creating a list. I'll call it mlist = and then a left curly bracket, and let's just say that I have the values, one, five, eight, nine and 14, all separated by commas. Then a right curly bracket, shift + enter, and there's my list. This is a very simple list and it will be easy to verify what the first and last values are, but you can imagine that if you had a list of thousands of values that the first and last keywords would be much easier to use than trying to find length, or even referring to a specific position. With that in mind, I will use the first keyword to display the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Create a list2m 42s
-
(Locked)
Refer to and edit list items5m 29s
-
(Locked)
Add and delete list items4m 27s
-
(Locked)
Count and summarize list items5m 14s
-
(Locked)
Sort and reorder lists4m 36s
-
(Locked)
Identify the first or last item in a list1m 44s
-
(Locked)
Select list items by rule4m 20s
-
(Locked)
Delete duplicate list items2m 15s
-
(Locked)
Join multiple lists into a single list4m
-
(Locked)
-
-
-
-
-
-