O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting Started with Julia

Book Description

Enter the exciting world of Julia, a high-performance language for technical computing

In Detail

Julia is a new open source programming language that is used in the field of data science computing. It was created to solve the dilemma between high-level slow code and fast but low-level code, and the necessity to use both to achieve high performance. This book will give you a head start to tackle your numerical and data problems with Julia. Your journey will begin by learning how to set up a running Julia platform before exploring its various built-in types. You will then move on to cover the different functions and constructs in Julia. The book will then walk you through the two important collection types–arrays and matrices. Over the course of the book, you will also be introduced to homoiconicity, the meta-programming concept in Julia.

Towards the concluding part of the book, you will also learn how to run external programs. This book will cover all you need to know about Julia to leverage its high speed and efficiency.

What You Will Learn

  • Set up your Julia environment to achieve the highest productivity
  • Solve your tasks in a high-level dynamic language and use types for your data only when needed
  • Create your own types to extend the built-in type system
  • Visualize your data in IJulia with plotting packages
  • Explore the use of built-in macros for testing, debugging, benchmarking, and more
  • Apply Julia to tackle problems concurrently and in a distributed environment
  • Integrate with other languages such as C, Python, and MATLAB

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Getting Started with Julia Programming
    1. Table of Contents
    2. Getting Started with Julia Programming
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. The Rationale for Julia
      1. The scope of Julia
      2. Julia's place among the other programming languages
      3. A comparison with other languages for the data scientist
        1. MATLAB
        2. R
        3. Python
      4. Useful links
      5. Summary
    9. 1. Installing the Julia Platform
      1. Installing Julia
        1. Windows version – usable from Windows XP SP2 onwards
        2. Ubuntu version
        3. OS X
        4. Building from source
      2. Working with Julia's shell
      3. Startup options and Julia scripts
      4. Packages
        1. Adding a new package
      5. Installing and working with Julia Studio
      6. Installing and working with IJulia
      7. Installing Sublime-IJulia
      8. Installing Juno
      9. Other editors and IDEs
      10. How Julia works
      11. Summary
    10. 2. Variables, Types, and Operations
      1. Variables, naming conventions, and comments
      2. Types
      3. Integers
      4. Floating point numbers
      5. Elementary mathematical functions and operations
      6. Rational and complex numbers
      7. Characters
      8. Strings
        1. Formatting numbers and strings
      9. Regular expressions
      10. Ranges and arrays
        1. Other ways to create arrays
        2. Some common functions for arrays
        3. How to convert an array of chars to a string
      11. Dates and times
      12. Scope and constants
      13. Summary
    11. 3. Functions
      1. Defining functions
      2. Optional and keyword arguments
      3. Anonymous functions
      4. First-class functions and closures
      5. Recursive functions
      6. Map, filter, and list comprehensions
      7. Generic functions and multiple dispatch
      8. Summary
    12. 4. Control Flow
      1. Conditional evaluation
      2. Repeated evaluation
        1. The for loop
        2. The while loop
        3. The break statement
        4. The continue statement
      3. Exception handling
      4. Scope revisited
      5. Tasks
      6. Summary
    13. 5. Collection Types
      1. Matrices
      2. Tuples
      3. Dictionaries
        1. Keys and values – looping
      4. Sets
        1. Making a set of tuples
      5. Example project – word frequency
      6. Summary
    14. 6. More on Types, Methods, and Modules
      1. Type annotations and conversions
        1. Type conversions and promotions
      2. The type hierarchy – subtypes and supertypes
        1. Concrete and abstract types
      3. User-defined and composite types
        1. When are two values or objects equal or identical?
        2. Multiple dispatch example
      4. Types and collections – inner constructors
      5. Type unions
      6. Parametric types and methods
      7. Standard modules and paths
      8. Summary
    15. 7. Metaprogramming in Julia
      1. Expressions and symbols
      2. Eval and interpolation
      3. Defining macros
      4. Built-in macros
        1. Testing
        2. Debugging
        3. Benchmarking
        4. Starting a task
      5. Reflection capabilities
      6. Summary
    16. 8. I/O, Networking, and Parallel Computing
      1. Basic input and output
      2. Working with files
        1. Reading and writing CSV files
      3. Using DataFrames
        1. Other file formats
      4. Working with TCP sockets and servers
      5. Interacting with databases
      6. Parallel operations and computing
        1. Creating processes
        2. Using low-level communications
        3. Parallel loops and maps
        4. Distributed arrays
      7. Summary
    17. 9. Running External Programs
      1. Running shell commands
        1. Interpolation
        2. Pipelining
      2. Calling C and FORTRAN
      3. Calling Python
      4. Performance tips
        1. Tools to use
      5. Summary
    18. 10. The Standard Library and Packages
      1. Digging deeper into the standard library
      2. Julia's package manager
        1. Installing and updating packages
      3. Publishing a package
      4. Graphics in Julia
      5. Using Gadfly on data
      6. Summary
    19. A. List of Macros and Packages
      1. Macros
      2. List of packages
    20. Index