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.
Select list items by rule - Mathematica Tutorial
From the course: Mathematica 11 Essential Training
Select list items by rule
- When you gather data, you might be interested in analyzing just a subset of that data. For example, you might want to see total sales from days with at least $5000 in revenue. To limit the values included in a calculation, you can use the select keyword. I have opened a blank Mathematica notebook, so I need to enter in a list of values. I'll type in a variable list1 = then, because I'm defining a list, a { followed by 1, 2, 3.8, 4, 5, 6. Then, a } to close the list, and Shift + Enter, and there I see my values. Suppose I want to, create a separate list that only has the odd values from list one. To do that, I would create my new variable, I'll call it list2 =, now I want to select values, so I will use the Select command. So I've Select, [, then the name of my list, which is list1, followed by the operator that I want to use for the keyboard, and that is OddQ. So I'm looking for the odd values, and the Q indicates that it's a query. Followed by a ], Shift + Enter, and I see 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)
-
-
-
-
-
-