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

Select list items by rule - Mathematica Tutorial

From the course: Mathematica 11 Essential Training

Start my 1-month free trial

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…

Contents