ebook img

Essentials of Programming in Mathematica PDF

563 Pages·2016·8.045 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Essentials of Programming in Mathematica

® Essentials of Programming in Mathematica Essentials of Programming in Mathematica provides an introduction suitable for readers with little or no background in the Mathematica language, as well as for those with some experience using languages such as C, JAVA, or PERL. The author, an established authority on Mathematica programming, has written an example-driven text that covers the language from first principles, as well as including material from natural language processing, bioinformatics, graphs and networks, signal analysis, geometry, computer science, and many other applied areas. The book is appropriate for self-study or as a text for a course in programming in computational science. Readers will benefit from the author’s tips, which provide insight and suggestions on small and large points. He also provides more than 350 exercises from novice through to advanced level, with all of the solutions available online. • Assumes no formal knowledge of programming • More than 350 exercises from basic to advanced make the book ideal for teaching or for self-study • Appeals to a broad readership by using examples derived from a wide variety of fields • Solutions to exercises are available from www.cambridge.org/wellin_essentials Paul Wellin worked for Wolfram Research from the mid-1990s through 2011, directing the Mathematica training efforts with the Wolfram Education Group. He has taught mathematics both at public schools and at university level for over 12 years. He has given talks, workshops, and seminars around the world on the integration of technical computing and education, and he has served on numerous government advisory panels on these issues. He is the author and co- author of several books on Mathematica. ® Essentials of Programming in Mathematica PAUL WELLIN University Printing House, Cambridge CB2 8BS, United Kingdom Cambridge University Press is part of the University of Cambridge. It furthers the University’s mission by disseminating knowledge in the pursuit of education, learning and research at the highest international levels of excellence. www.cambridge.org Information on this title: www.cambridge.org/9780521864886 © Paul Wellin 2016 This publication is in copyright. Subject to statutory exception nd to the provisions of relevant collective licensing agreements, no reproduction of any part may take place without the written permission of Cambridge University Press. First published 2016 Printed in the United Kingdom by Bell & Bain Ltd Page 267. Quotation from “The Library of Babel” by Jorge Luis Borges. Translated by James E. Irby, from LABYRINTHS, copyright © 1962, 1964 by New Directions Publishing Corp. Reprinted by permission of New Directions Publishing Corp. Page 296. Marcel Duchamp, “Roue de bicyclette” © 2012 Artists Rights Society (ARS), New York/ADAGP, Paris/Succession Marcel Duchamp. ® Wolfram Mathematica is a registered trademark of Wolfram Research, Inc. A catalogue record for this publication is available from the British Library Library of Congress Cataloguing in Publication data ISBN 978-1-107-11666-5 Hardback Text set in DTL Albertina 11/13; code set in Inconsolata; captions set in Syntax LT Std; ® System Mathematica , Version 10.2. Designed and typeset by the author Additional resources for this publication at www.cambridge.org/wellin_essentials Cambridge University Press has no responsibility for the persistence or accuracy of URLs for external or third-party internet websites referred to in this publication, and does not guarantee that any content on such websites is, or will remain, accurate or appropriate. To the memory of my father whose love of books curiously led to this Contents Preface 1 Programming with Mathematica 1.1 Introduction to programming Your first Mathematica program · Programming paradigms · Creating programs 1.2 Getting started Starting and running Mathematica · Mathematical expressions · Functions · Lists · Semicolons · Alternative input syntax · Comments · Exercises 1.3 Getting help Errors · Getting out of trouble · Function information · Documentation 1.4 Notes and further reading 2 The Mathematica language 2.1 Expressions Atoms · Normal expressions · Display of expressions · Evaluation of expressions · Compound expressions · Nesting expressions · Exercises 2.2 Numbers Types of numbers · Digits and number bases · Random numbers · Exercises 2.3 Definitions Defining variables and functions · Immediate vs. delayed assignments · Compound functions · Functions with multiple definitions · Exercises 2.4 Predicates and Boolean operations Predicates · Relational and logical operators · Exercises 2.5 Attributes Listable · Hold attributes · Protected · Exercises 2.6 Notes and further reading 3 Lists and associations 3.1 Creating and displaying lists List structure and syntax · List construction · Displaying lists · Arrays · Exercises 3.2 Testing and measuring lists Testing a list · Measuring lists · Exercises 3.3 Operations on lists Extracting elements · Applying functions to lists · Rearranging lists · List component assignment · Multiple lists · Exercises 3.4 Associations Creating and displaying associations · Operations on associations · Creating a bibliography · Exercises 3.5 Differences from other languages 3.6 Notes and further reading 4 Patterns and rules 4.1 Patterns Blanks · Pattern matching by type · Explicit pattern matching · Structured patterns · Sequence pattern matching · Conditional pattern matching · Shorthand notation · Alternatives · Repeated patterns · Functions that use patterns · Exercises 4.2 Transformation rules Creating and using replacement rules · Applying transformation rules · Exercises 4.3 Examples Counting coins · Filtering and extracting data · Perimeter · Triangle area · Finding parts of expressions · Sorting a list · Sunspot activity · Exercises 4.4 Notes and further reading 5 Functions 5.1 Functions for manipulating expressions Map · Apply · Thread and MapThread · Listability · Inner and Outer · Select and Pick · Exercises 5.2 Iterating functions Nest · FixedPoint · NestWhile · Fold · Exercises 5.3 Recursive functions Fibonacci numbers · Thinking recursively · Dynamic programming · Exercises 5.4 Loops and flow control Conditional functions · Piecewise-defined functions · Which and Switch · Argument checking · Do and For loops · While loops · Exercises 5.5 Pure functions Syntax of pure functions · Multiple arguments · Pure predicate functions · Indexing with pure functions · Newton revisited · Example: searching for attributes · Exercises 5.6 Examples Hamming distance · The Josephus problem · Protein interaction networks · Operating on arrays · Enumerating binary matrices · Clustering data · Exercises 5.7 Notes and further reading 6 Programs 6.1 Scoping constructs Localizing names: Module · Localizing values: Block · Localizing constants: With · Matrix manipulation · Exercises 6.2 Options and messages Options · Messages · Exercises 6.3 Examples Sieve of Eratosthenes · Radius of gyration · Lag plots · Random walks · Exercises 6.4 Notes and further reading 7 Strings 7.1 Structure and syntax Display of strings · Testing strings · Measuring strings · Character codes · Exercises 7.2 Operations on strings Basic string operations · Strings vs. lists · Encoding text · Anagrams · Exercises 7.3 String patterns Finding subsequences with strings · Alternatives · Exercises

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.