Julia 1.0 Programming
Second Edition
Dynamic and high-performance programming to build fast scientific applications
Ivo Balbaert
BIRMINGHAM - MUMBAI
Julia 1.0 ProgrammingSecond Edition
Copyright 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author(s), nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Richa Tripathi
Acquisition Editor: Denim Pinto
Content Development Editor: Pooja Parvatkar
Technical Editor: Romy Dias
Copy Editor: Safis Editing
Project Coordinator: Ulhas Kambali
Proofreader: Safis Editing
Indexer: Tejal Daruwale Soni
Graphics: Tom Scaria
Production Coordinator: Shraddha Falebhai
First published: February 2015
Second edition: September 2018
Production reference: 1200918
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78899-909-0
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Packt.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.
At www.packt.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Ivo Balbaert has been a lecturer in web programming and databases at CVO Antwerpen (www.cvoantwerpen.be), a community college in Belgium. He received a Ph.D. in Applied Physics from the University of Antwerp in 1986. He worked for 20 years in the software industry as a developer and consultant in several companies, and for 10 years as project manager at the University Hospital of Antwerp. From 2000 onwards, he switched to partly teaching and partly developing software (at KHM Mechelen, CVO Antwerpen). He also wrote an introductory book in Dutch about developing in Ruby and Rails, Programmeren met Ruby en Rails, by Van Duuren Media. In 2012, he authored a book on the Go programming language, The Way To Go, by IUniverse. He wrote a number of introductory books for new programming languages, notably Dart, Julia, Rust, and Red, all published by Packt.
I would like to thank the technical reviewer, Malcolm Sherrington, for the many useful remarks that improved the text.
About the reviewer
Malcolm Sherrington has been working in computing for over 35 years. He holds degrees in mathematics, chemistry, and engineering. He is running his own company, focusing on the aerospace, healthcare, and finance sectors, with specific interests in High-Performance Computing and applications of GPUs and parallelism. Always hands-on, Malcolm started programming scientific problems in Fortran and C, progressing through Ada and Common Lisp, and recently became involved with data processing and analytics in Perl, Python, and R. Malcolm is the organizer of the London Julia User Group
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
Julia is a now a well-established programming language. It was developed at MIT in the Applied Computing Group under the supervision of Prof. Alan Edelman. Its development started in 2009, and it was first presented publicly in February 2012. It has now reached its first production version: Julia v1.0 (published Aug 8, 2018), which means that stability is guaranteed for the complete duration of version 1. It is based on clear and solid principles, and its popularity is steadily increasing in the technical, data scientist, and high-performance computing arena.
Who this book is for
This book is intended for data scientists and all those who work on technical and scientific computation projects. It will get you up and running quickly with Julia to start simplifying your projects' applications. The book assumes you already have some basic working knowledge of a high-level dynamic language such as MATLAB, R, Python, or Ruby.
What this book covers
, Installing the Julia Platform, explains how to install all the necessary components for a Julia environment. It teaches you how to work with Julia's console (the REPL) and discusses some of the more elaborate development editors you can use.
, Variables, Types, and Operations, discusses the elementary built-in types in Julia and the operations that can be performed on them so that you are prepared to start writing code with them.
, Functions, teaches you why functions are the basic building blocks of Julia, and how to effectively use them.
, Control Flow, shows Julia's elegant control constructs, how to perform error handling, and how to use coroutines (called Tasks in Julia) to structure the execution of your code.
, Collection Types, explores the different types that group individual values, such as arrays and matrices, tuples, dictionaries, and sets.
Next page