Julia 1.0 Programming Cookbook

Book Description

Discover the new features and widely used packages in Julia to solve complex computational problems in your statistical applications.

Key Features

  • Address the core problems of programming in Julia with the most popular packages for common tasks
  • Tackle issues while working with Databases and Parallel data processing with Julia
  • Explore advanced features such as metaprogramming, functional programming, and user defined types

Book Description

Julia, with its dynamic nature and high-performance, provides comparatively minimal time for the development of computational models with easy-to-maintain computational code. This book will be your solution-based guide as it will take you through different programming aspects with Julia.

Starting with the new features of Julia 1.0, each recipe addresses a specific problem, providing a solution and explaining how it works. You will work with the powerful Julia tools and data structures along with the most popular Julia packages. You will learn to create vectors, handle variables, and work with functions. You will be introduced to various recipes for numerical computing, distributed computing, and achieving high performance. You will see how to optimize data science programs with parallel computing and memory allocation. We will look into more advanced concepts such as metaprogramming and functional programming. Finally, you will learn how to tackle issues while working with databases and data processing, and will learn about on data science problems, data modeling, data analysis, data manipulation, parallel processing, and cloud computing with Julia.

By the end of the book, you will have acquired the skills to work more effectively with your data

What you will learn

  • Boost your code's performance using Julia's unique features
  • Organize data in to fundamental types of collections: arrays and dictionaries
  • Organize data science processes within Julia and solve related problems
  • Scale Julia computations with cloud computing
  • Write data to IO streams with Julia and handle web transfer
  • Define your own immutable and mutable types
  • Speed up the development process using metaprogramming

Who this book is for

This book is for developers who would like to enhance their Julia programming skills and would like to get some quick solutions to their common programming problems. Basic Julia programming knowledge is assumed.

Publisher Resources

Download Example Code

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Julia 1.0 Programming Cookbook
  3. Dedication
  4. About Packt
    1. Why subscribe?
    2. Packt.com
  5. Contributors
    1. About the authors
    2. About the reviewer
    3. Packt is searching for authors like you
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Sections
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Get in touch
      1. Reviews
  7. Installing and Setting Up Julia
    1. Introduction
    2. Installing Julia from binaries
      1. Getting ready
      2. How to do it...
        1. Installing Julia on Linux Ubuntu
        2. Installing Julia on Windows
      3. There's more...
      4. See also
    3. Julia IDEs
      1. Getting ready
      2. How to do it...
        1. Juno
        2. Microsoft Visual Studio Code
        3. Sublime Text
      3. See also
    4. Julia support for text editors
      1. Getting ready
      2. How to do it...
        1. Configuring Julia with Nano
        2. Configuring Julia with Vim
        3. Configuring Julia with Emacs
      3. See also
    5. Building Julia from sources on Linux
      1. Getting ready
      2. How to do it...
        1. Option 1 - build Julia without Intel's MKL
        2. Option 2 - build Julia with Intel MKL (without Intel LIBM)
        3. Option 3 - build Julia with Intel MKL and with Intel LIBM
      3. How it works...
      4. There's more...
      5. See also
    6. Running Julia inside the Cloud9 IDE in the AWS cloud
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
    7. How to customize Julia on startup
      1. Getting ready
      2. How to do it...
        1. Running a script on Julia startup
        2. Running a single Julia command on startup
        3. Running a script every time Julia starts
      3. How it works...
      4. There's more...
      5. See also
    8. Setting up Julia to use multiple cores
      1. Getting ready
      2. How to do it...
        1. Multiple processes
        2. Multiple threads
      3. How it works...
      4. There's more...
      5. See also
    9. Useful options for interaction with Julia
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    10. Displaying computation results in Julia
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    11. Managing packages
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    12. Configuring Julia in Jupyter Notebook
      1. Getting ready
      2. How to do it...
        1. Running Jupyter Notebook from within the Julia environment
        2. Running Jupyter Notebook outside of the Julia environment
      3. How it works...
      4. There's more...
      5. See also
    13. Configuring Julia to work with JupyterLab
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
        1. Running JupyterLab with Anaconda on Linux
        2. Running JupyterLab with Anaconda on Windows
      5. See also
    14. Configuring Julia with Jupyter Notebook in Terminal-only cloud environments
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  8. Data Structures and Algorithms
    1. Introduction
    2. Finding the index of a random minimum element in an array
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Fast matrix multiplication
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Implementing a custom pseudo-random number generator
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Parsing Git logs with regular expressions
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    6. Non-standard ways to sort your data
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    7. Creating a function preimage - understanding how dictionaries and sets work
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    8. Working with UTF-8 strings
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  9. Data Engineering in Julia
    1. Introduction
    2. Managing streams, and reading and writing files
      1. Getting ready
      2. How to do it...
        1. Built-in system streams (stdin, stdout, stderr)
        2. Reading and writing files
      3. How it works...
      4. There's more...
      5. See also
    3. Using IOBuffer to efficiently work with in-memory streams
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Fetching data from the internet
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Writing a simple RESTful service
      1. Getting ready
      2. How to do it...
        1. Building a web service from scratch
        2. Building a high-performance web service integrating ZeroMQ and JuliaWebAPI.jl
      3. How it works...
      4. There's more...
      5. See also
    6. Working with JSON data
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    7. Working with date and time
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    8. Using object serialization in Julia
      1. Getting ready
      2. How to do it...
        1. Serializing Julia objects with Julia Base.Serialization
        2. Serializing Julia objects with JLD2.jl
        3. Serializing Julia objects with BSON.jl
      3. How it works...
      4. There's more...
      5. See also
    9. Running Julia as a background process
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    10. Reading and writing Microsoft Excel files
      1. Getting ready
      2. How to do it...
        1. Manipulating Excel files with PyCall.jl and openpyxl
        2. Manipulating Excel files with XLSX.jl
      3. How it works...
      4. There's more...
      5. See also
    11. Handling Feather data
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    12. Reading CSV and FWF files
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  10. Numerical Computing with Julia
    1. Introduction
    2. Traversing matrices efficiently
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
    3. Executing loops efficiently with conditional statements
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Generating full factorial designs
      1. How to do it...
      2. How it works...
      3. See also
    5. Approximating pi using partial series sums
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    6. Running Monte Carlo simulations
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    7. Analyzing a queuing system
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    8. Working with complex numbers
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    9. Writing a simple optimization routine
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    10. Estimating a linear regression
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    11. Understanding broadcasting in Julia
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    12. Improving code performance using @inbounds
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    13. Creating a matrix from a set of vectors as rows
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    14. Using array views to avoid memory allocation
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  11. Variables, Types, and Functions
    1. Introduction
    2. Understanding subtyping in Julia
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Using multiple dispatch to handle branching behavior
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Using functions as variables in Julia
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Functional programming in Julia
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    6. Scope of variables in Julia
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    7. Handling exceptions in Julia
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    8. Working with NamedTuples
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  12. Metaprogramming and Advanced Typing
    1. Introduction
    2. Metaprogramming
      1. Getting ready
      2. How to do it...
        1. Working with the eval function
        2. Abstract Syntax Tree (AST)
      3. How it works...
      4. There's more...
      5. See also
    3. Macros and generated functions
      1. Getting ready
      2. How to do it...
        1. Using macros to cache function results
        2. Loop unrolling with the @generated macro
      3. How it works...
      4. There's more...
      5. See also
    4. Defining your own types - linked list
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Defining primitive types
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    6. Understanding the structure of Julia numeric types with introspection
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    7. Using static arrays
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    8. The efficiency of mutable versus immutable types
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    9. Ensuring type stability of your code
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. See also
  13. Handling Analytical Data
    1. Introduction
    2. Converting data between DataFrame and Matrix
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Investigating the contents of a data frame
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Reading CSV data from the internet
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Working with categorical data
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    6. Handling missing data
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    7. Split-apply-combine in DataFrames
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    8. Converting a data frame between wide and narrow formats
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    9. Comparing data frames for identity
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    10. Transforming rows of DataFrame
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    11. Creating pivot tables by chaining transformations of data frames
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  14. Julia Workflow
    1. Introduction
    2. Julia development workflow with Revise.jl
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Benchmarking code
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Profiling Julia code
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Setting up logging in your code
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    6. Calling Python from Julia
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    7. Calling R from Julia
      1. Getting ready
      2. How to do it...
        1. Option 1 - calling R libraries from Julia
        2. Option 2 - directly calling R from Julia with variable interpolation
        3. Option 3 - using the R command line available inside Julia with variable interpolation
        4. Option 4 - sending variables with their values to R
      3. How it works...
      4. There's more...
      5. See also
    8. Managing project dependencies
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  15. Data Science
    1. Introduction
    2. Working with databases in Julia
      1. Getting ready
        1. Getting ready for MySQL
        2. Getting ready for PostgreSQL
        3. Getting ready for JDBC and Oracle
          1. Configuring JDBC in Julia
          2. Getting Oracle JDBC drivers
      2. How to do it...
        1. Connecting to MySQL Server with MySQL.jl
        2. Connecting to PostgreSQL with LibPQ.jl
        3. Connecting to Oracle with JDBC.jl
      3. How it works...
      4. There's more...
      5. See also
    3. Optimization using JuMP
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Estimation using maximum likelihood
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Complex plotting with Plots.jl
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    6. Building machine learning models with ScikitLearn.jl
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  16. Distributed Computing
    1. Introduction
    2. Multiprocessing in Julia
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    3. Sending parameters to remote Julia processes
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    4. Multithreading in Julia
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
    5. Distributed computing with Julia
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
      5. See also
  17. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product Information

  • Title: Julia 1.0 Programming Cookbook
  • Author(s): Bogumil Kaminski, Przemyslaw Szufel
  • Release date: November 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781788998369