Introduction to Programming with Mathematica, Third Edition

Chapter 3: Lists

The list is the fundamental data structure used in Mathematica to group objects together. A very extensive set of built-in functions is provided by Mathematica to manipulate lists in a variety of ways, ranging from simple operations, such as moving list elements around, to more sophisticated operations, such as applying a function to a list. We also discuss working with strings, as their structure and manipulation is so similar to lists.

3.1 Introduction

Many computations involve working with a collection of objects. For example, abstract mathematics deals with operations on arbitrary sets, represented notationally, but also conceptually, as lists.

    <i class="emphasis">In[1]:=</i> <b class="bold">{a, b, c} <span class="unicode">?</span> {c, d, e}</b>    <i class="emphasis">Out[1]=</i> {a, b, c, d, e}    <i class="emphasis">In[2]:=</i> <b class="bold">{a, b, c} <span class="unicode">?</span> {c, d, e}</b>    <i class="emphasis">Out[2]=</i> {c}

Data, in Mathematica, is represented using lists. A large collection of functions is available for manipulating and analyzing lists of data. For example, you can sort any set of data.

    <i class="emphasis">In[3]:=</i> <b class="bold">Sort[{4, 16, 1, 77, 23}]</b>    <i class="emphasis">Out[3]=</i> {1, 4, 16, 23, 77}

You can extract elements of a dataset based on some criteria. Here we select those numbers from a list that are greater than 0.

    <i class="emphasis">In[4]:=</i> <b class="bold">Select[{4.9239, -1.24441, -0.80388, 3.27761}, Positive]</b>    <i class="emphasis">Out[4]=</i> {4.9239, 3.27761}

Working with such collections of objects requires that...

UNLIMITED FREE ACCESS TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: DC-DC Converter Chips
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.