From the course: Mathematica 14 Essential Training
Unlock this course with a free trial
Join today to access over 26,700 courses taught by industry experts.
Sort and reorder lists - Mathematica Tutorial
From the course: Mathematica 14 Essential Training
Sort and reorder lists
Lists of values store important information. You can gain further information by sorting lists, either in ascending or descending order, or reversing a list that you've already created. In this movie, I will show you how to sort your list, how to reverse its order, and also how to pad a list. So it is an exact length that might be required for some calculations. I have created a blank Mathematica notebook, and I will increase the zoom level from 100% to 150 to make things easier to read. So, at the bottom right corner, go from 100 to 150. I'll start by entering in my list data. So, that's hlist —that's the variable I'll use— equal (=). Then, in curly brackets, I'll type 1, 8, 7, 1, 2, 6, 3, 5 and 4 with each value separated by a comma. So, everything is good. Shift + Enter. And there we go. If I want to sort the list into descending order with the largest values at the start, I use the 'Sort' keyword. So, capital S, o, r, t, left square bracket. Oh excuse me, I need to assign it to a…
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 list3m 32s
-
Refer to and edit list items5m 57s
-
(Locked)
Add and delete list items4m 53s
-
(Locked)
Count and summarize list items6m 31s
-
(Locked)
Sort and reorder lists5m 15s
-
Identify the first or last item in a list2m 4s
-
(Locked)
Select list items by rule5m 24s
-
(Locked)
Delete duplicate list items1m 56s
-
Join multiple lists into a single list4m 43s
-
(Locked)
-
-
-
-
-
-
-
-
-