Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Getting started with Julia Programming Language
Getting started with Julia Programming Language

Getting started with Julia Programming Language: Enter the exciting world of Julia, a high-performance language for technical computing

Arrow left icon
Profile Icon Ivo Balbaert
Arrow right icon
Mex$648.99 Mex$721.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.1 (17 Ratings)
eBook Feb 2015 214 pages 1st Edition
eBook
Mex$648.99 Mex$721.99
Paperback
Mex$902.99
Subscription
Free Trial
Arrow left icon
Profile Icon Ivo Balbaert
Arrow right icon
Mex$648.99 Mex$721.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.1 (17 Ratings)
eBook Feb 2015 214 pages 1st Edition
eBook
Mex$648.99 Mex$721.99
Paperback
Mex$902.99
Subscription
Free Trial
eBook
Mex$648.99 Mex$721.99
Paperback
Mex$902.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Getting started with Julia Programming Language

The Rationale for Julia

This introduction will present you with the reasons why Julia is quickly growing in popularity in the technical, data scientist, and high-performance computing arena. We will cover the following topics:

  • The scope of Julia
  • Julia's place among other programming languages
  • A comparison with other languages for the data scientist
  • Useful links

The scope of Julia

The core designers and developers of Julia (Jeff Bezanson, Stefan Karpinski, and Viral Shah) have made it clear that Julia was born out of a deep frustration with the existing software toolset in the technical computing disciplines. Basically, it boils down to the following dilemma:

  • Prototyping is a problem in this domain that needs a high-level, easy-to-use, and flexible language that lets the developer concentrate on the problem itself instead of on low-level details of the language and computation.
  • The actual computation of a problem needs maximum performance; a factor of 10 in computation time makes a world of difference (think of one day versus ten days), so the production version often has to be (re)written in C or FORTRAN.
  • Before Julia, practitioners had to be satisfied with a "speed for convenience" trade-off, use developer-friendly and expressive, but decades-old interpreted languages such as MATLAB, R, or Python to express the problem at a high level. To program the performance-sensitive parts and speed up the actual computation, people had to resort to statically compiled languages such as C or FORTRAN, or even the assembly code. Mastery on both the levels is not evident: writing high-level code in MATLAB, R, or Python for prototyping on the one hand, and writing code that does the same thing in C, which is used for the actual execution.

    Julia was explicitly designed to bridge this gap. It gives you the possibility of writing high-performance code that uses CPU and memory resources as effectively as can be done in C, but working in pure Julia all the way down, reduces the need for a low-level language. This way, you can rapidly iterate using a simple programming model from the problem prototype to near-C performance. The Julia developers have proven that working in one environment that has the expressive capabilities as well as the pure speed is possible using the recent advances in Low Level Virtual Machine Just in Time (LLVM JIT) compiler technologies (for more information, see http://en.wikipedia.org/wiki/LLVM).

In summary, they designed Julia to have the following specifications:

  • Julia is open source and free with a liberal (MIT) license.
  • It is designed to be an easy-to-use and learn, elegant, clear and dynamic, interactive language by reducing the development time. To that end, Julia almost looks like the pseudo code with an obvious and familiar mathematical notation; for example, here is the definition for a polynomial function, straight from the code:
    x -> 7x^3 + 30x^2 + 5x + 42

    Notice that there is no need to indicate the multiplications.

  • It provides the computational power and speed without having to leave the Julia environment.
  • Metaprogramming and macro capabilities (due to its homoiconicity (refer to Chapter 7, Metaprogramming in Julia), inherited from Lisp), to increase its abstraction power.
  • Also, it is usable for general programming purposes, not only in pure computing disciplines.
  • It has built-in and simple to use concurrent and parallel capabilities to thrive in the multicore world of today and tomorrow.

Julia unites this all in one environment, something which was thought impossible until now by most researchers and language designers.

The scope of Julia

The Julia logo

Julia's place among the other programming languages

Julia reconciles and brings together the technologies that before were considered separate, namely:

  • The dynamic, untyped, and interpreted languages on the one hand (Python, Ruby, Perl, MATLAB/Octave, R, and so on)
  • The statically typed and compiled languages on the other (C, C++, Fortran, and Fortress)

How can Julia have the flexibility of the first and the speed of the second category?

Julia has no static compilation step. The machine code is generated just-in-time by an LLVM-based JIT compiler. This compiler, together with the design of the language, helps Julia to achieve maximal performance for numerical, technical, and scientific computing. The key for the performance is the type information, which is gathered by a fully automatic and intelligent type inference engine, that deduces the type from the data contained in the variables. Indeed, because Julia has a dynamic type system, declaring the type of variables in the code is optional. Indicating types is not necessary, but it can be done to document the code, improve tooling possibilities, or in some cases, to give hints to the compiler to choose a more optimized execution path. This optional typing discipline is an aspect it shares with Dart. Typeless Julia is a valid and useful subset of the language, similar to traditional dynamic languages, but it nevertheless runs at statically compiled speeds. Julia applies generic programming and polymorphic functions to the limit, writing an algorithm just once and applying it to a broad range of types. This provides common functionality across drastically different types, for example: size is a generic function with 50 concrete method implementations. A system called dynamic multiple dispatch efficiently picks the optimal method for all of a function's arguments from tens of method definitions. Depending on the actual types very specific and efficient native code implementations of the function are chosen or generated, so its type system lets it align closer with primitive machine operations.

Note

In summary, data flow-based type inference implies multiple dispatch choosing specialized execution code.

However, do keep in mind that types are not statically checked. Exceptions due to type errors can occur at runtime, so thorough testing is mandatory. As to categorizing Julia in the programming language universe, it embodies multiple paradigms, such as procedural, functional, metaprogramming, and also (but not fully) object oriented. It is by no means an exclusively class-based language such as Java, Ruby, or C#. Nevertheless, its type system offers a kind of inheritance and is very powerful. Conversions and promotions for numeric and other types are elegant, friendly, and swift, and user-defined types are as fast and compact as built-in types. As for functional programming, Julia makes it very easy to design programs with pure functions and has no side effects; functions are first-class objects, as in mathematics.

Julia also supports a multiprocessing environment based on a message passing model to allow programs to run via multiple processes (local or remote) using distributed arrays, enabling distributed programs based on any of the models for parallel programming.

Julia is equally suited for general programming as is Python. It has as good and modern (Unicode capable) string processing and regular expressions as Perl or other languages. Moreover, it can also be used at the shell level, as a glue language to synchronize the execution of other programs or to manage other processes.

Julia has a standard library written in Julia itself, and a built-in package manager based on GitHub, which is called Metadata, to work with a steadily growing collection of external libraries called packages. It is cross platform, supporting GNU/Linux, Darwin/OS X, Windows, and FreeBSD for both x86/64 (64-bit) and x86 (32-bit) architectures.

A comparison with other languages for the data scientist

Because speed is one of the ultimate targets of Julia, a benchmark comparison with other languages is displayed prominently on the Julia website (http://julialang.org/). It shows that Julia's rivals C and Fortran, often stay within a factor of two of fully optimized C code, and leave the traditional dynamic language category far behind. One of Julia's explicit goals is to have sufficiently good performance that you never have to drop down into C. This is in contrast to the following environments, where (even for NumPy) you often have to work with C to get enough performance when moving to production. So, a new era of technical computing can be envisioned, where libraries can be developed in a high-level language instead of in C or FORTRAN. Julia is especially good at running MATLAB and R-style programs. Let's compare them somewhat more in detail.

MATLAB

Julia is instantly familiar to MATLAB users; its syntax strongly resembles that of MATLAB, but Julia aims to be a much more general purpose language than MATLAB. The names of most functions in Julia correspond to the MATLAB/Octave names, and not the R names. Under the covers, however, the way the computations are done, things are extremely different. Julia also has equally powerful capabilities in linear algebra, the field where MATLAB is traditionally applied. However, using Julia won't give you the same license fee headaches. Moreover, the benchmarks show that it is from 10 to 1,000 times faster depending on the type of operation, also when compared to Octave (the open source version of MATLAB). Julia provides an interface to the MATLAB language with the package MATLAB.jl (https://github.com/lindahua/MATLAB.jl).

R

R was until now the chosen development language in the statistics domain. Julia proves to be as usable as R in this domain, but again with a performance increase of a factor of 10 to 1,000. Doing statistics in MATLAB is frustrating, as is doing linear algebra in R, but Julia fits both the purposes. Julia has a much richer type system than the vector-based types of R. Some statistics experts such as Douglas Bates heavily support and promote Julia as well. Julia provides an interface to the R language with the package Rif.jl (https://github.com/lgautier/Rif.jl).

Python

Again, Julia has a performance head start of a factor of 10 to 30 times as compared to Python. However, Julia compiles the code that reads like Python into machine code that performs like C. Furthermore, if necessary you can call Python functions from within Julia using the PyCall package (https://github.com/stevengj/PyCall.jl).

Because of the huge number of existing libraries in all these languages, any practical data scientist can and will need to mix the Julia code with R or Python when the problem at hand demands it.

Julia can also be applied to data analysis and big data, because these often involve predictive analysis, modeling problems that can often be reduced to linear algebra algorithms, or graph analysis techniques, all things Julia is good at tackling.

In the field of High Performance Computing (HPC), a language such as Julia has long been lacking. With Julia, domain experts can experiment and quickly and easily express a problem in such a way that they can use modern HPC hardware as easily as a desktop PC. In other words, a language that gets users started quickly without the need to understand the details of the underlying machine architecture is very welcome in this area.

Useful links

The following are the links that can be useful while using Julia:

Summary

In this introduction, we gave an overview of Julia's characteristics and compared them to the existing languages in its field. Julia's main advantage is its ability to generate specialized code for different input types. When coupled with the compiler's ability to infer these types, this makes it possible to write the Julia code at an abstract level while achieving the efficiency associated with the low-level code. Julia is already quite stable and production ready. The learning curve for Julia is very gentle; the idea being that people who don't care about fancy language features should be able to use it productively too and learn about new features only when they become useful or needed.

Left arrow icon Right arrow icon

Description

This book is for you if you are a data scientist or working on any technical or scientific computation projects. The book assumes you have a basic working knowledge of high-level dynamic languages such as MATLAB, R, Python, or Ruby.

Who is this book for?

This book is for you if you are a data scientist or working on any technical or scientific computation projects. The book assumes you have a basic working knowledge of high-level dynamic languages such as MATLAB, R, Python, or Ruby.

What you will learn

  • Set up your Julia environment to achieve the highest productivity
  • Solve your tasks in a highlevel dynamic language and use types for your data only when needed
  • Create your own types to extend the builtin type system
  • Visualize your data in IJulia with plotting packages
  • Explore the use of builtin 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

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 26, 2015
Length: 214 pages
Edition : 1st
Language : English
ISBN-13 : 9781783284801
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Feb 26, 2015
Length: 214 pages
Edition : 1st
Language : English
ISBN-13 : 9781783284801
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Mex$ 2,954.97
Julia High Performance
Mex$799.99
Getting started with Julia Programming Language
Mex$902.99
Mastering Julia
Mex$1251.99
Total Mex$ 2,954.97 Stars icon

Table of Contents

13 Chapters
The Rationale for Julia Chevron down icon Chevron up icon
1. Installing the Julia Platform Chevron down icon Chevron up icon
2. Variables, Types, and Operations Chevron down icon Chevron up icon
3. Functions Chevron down icon Chevron up icon
4. Control Flow Chevron down icon Chevron up icon
5. Collection Types Chevron down icon Chevron up icon
6. More on Types, Methods, and Modules Chevron down icon Chevron up icon
7. Metaprogramming in Julia Chevron down icon Chevron up icon
8. I/O, Networking, and Parallel Computing Chevron down icon Chevron up icon
9. Running External Programs Chevron down icon Chevron up icon
10. The Standard Library and Packages Chevron down icon Chevron up icon
A. List of Macros and Packages Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.1
(17 Ratings)
5 star 41.2%
4 star 47.1%
3 star 0%
2 star 0%
1 star 11.8%
Filter icon Filter
Top Reviews

Filter reviews by




adnan baloch Mar 26, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Scientists and students dealing with technical computing problems have a real conundrum at their hands when it comes to solving their problems using programming. If they use a specialized language, they have to give up speed. If they turn to C or C++ for their programming needs, they have to look at a significant time investment most of which might be spent not solving their problem but wrestling with the quirky language design decisions of C/C++. The best of both these worlds was conceived at MIT in the form of the Julia programming language. Striving to keep the performance at most twice as slow as C/C++, the author shows how easy it is to use Julia as a one-stop solution for all our technical computing needs. Installation, Julia shell, Julia studio and Ijulia are introduced in the first chapter thus making the readers confident that they can get to work as soon as possible no matter their preference of development environment. The next chapter introduces the variables and types in Julia. The author dedicates an entire chapter to functions in Julia and shows why Julia deserves to be called a functional language. Control flow, exception handling and tasks (coroutines) form the subject of the next chapter. The author moves onto complex types consisting of many elements which are dubbed collection types in Julia. The author uses the example of a word frequency program in just a little over a dozen lines of code to demonstrate the power of Julia. Multiple dispatch and metaprogramming are strengths that set Julia apart and the author makes sure that the readers understand them thoroughly. Working with CSV files and the concept of dataframes is explained clearly. The fact that a dataframe is kind of an array with different types in its columns provides the user a lot of versatility in attacking common data problems. Connecting with databases, networking and parallel computation using Julia are also given ample explanation for the benefit of the readers. Interfacing with the command line, C, Fortran and Python are touched upon in a chapter that ends with valuable performance tips to get the most out of Julia. The final chapter leaves the readers with the opportunity to explore Julia's rich standard library and shows a plotting example using Gadfly. Julia's excellent package manager and almost 400 packages mean that the readers will find themselves busy with Julia long after they have finished this comprehensive introduction to one of the rising stars of the technical computing scene.
Amazon Verified review Amazon
Dirk Harms-Merbtiz Nov 25, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Quick read and to the point. Took a couple hours to go through. Amazon, don't require so many words in reviews.
Amazon Verified review Amazon
Jordi C May 10, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great introduction to Julia. In the past I tried to learn Julia several times, using online documentation and tutorials, but I never found the right help that caught my attention, so I never learnt. On the other hand, this book guided me smoothly and easily through the Julia language, so I really recommend it.The book is well structured, from the syntax basics to useful features as error handling, tasks, running shell commands and python libraries, parallel computing and metaprogramming, features that also seem easy to use with Julia.I found the level of the book adequate to start with the language (I am already fluent in Python and Fortran, which I use for scientific computing).
Amazon Verified review Amazon
ruben Apr 11, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I would like to thank the author because I have seen this book as a great opportunity area where we have to work.I want to say that I am teacher in engineering like mechatronics, electromechanic, industrial and we have been working with this new technologies to solve practical problems in the industry I could say that the problems that we have to teach we apply the content of the book to solve themThanks.
Amazon Verified review Amazon
Oleg Okun Apr 19, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
What is Julia? Julia is a fairly new programming language (borne in 2012) that aims at reaching two objectives: 1) quick solution prototyping like in MATLAB, R or Python and 2) fast computational time and efficient memory management like in FORTRAN, C or C++. Thus, one could say that Julia tries to bridge the gap between programming languages of two types - high-level but slow and fast but low-level.As such, Julia is a primal competitor to MATLAB, R, and Python. However, competition does not completely exclude collaboration; this is the case for Julia that has packages for calling code written in these and some other languages like Java. Needless to say, Julia is open source and free with a liberal MIT license, which is important for wide adoption. To date, there are 549 external packages that can be found at http://pkg.julialang.org/ .Chapter 1 explains how to install Julia for Windows, Ubuntu and OS X, shows example of work in Julia shell, and lists IDEs like Juno that can be used. Chapter 2 describes Julia's types of variables (numbers, characters, strings, ranges, arrays) that are the key for its performance, while Chapter 3 discusses functions (their definition and types). Control flow operators (if, for, while, break, continue) and exception handling are introduced in Chapter 3. As the extensions of Chapter 2, Chapter 5 talks about matrices (multidimensional arrays), tuples, sets and dictionaries, while Chapter 6 goes into detail of type annotation and conversion, type hierarchy, abstract, parametric, and user-defined types. The concept of metaprogramming (which can even generate code) is explained in Chapter 7. Chapter 8 explores I/O (file reading from and writing to several formats such as CSV, JSON, XML, HDF5, DataFrames for tabular data representation), networking, interacting with databases, and parallel computing. How to call from within Julia the code written in another programming language like C, FORTRAN and Python as well as performance recommendations are explained in Chapter 9. Chapter 10 looks at the standard library of functions and packages and provides guidelines how to use a package manager and visualize data.One may say that everything abovementioned can be found in Julia's documentation, but to have these topics in one place such as this book is certainly a must for new converts and seasonable experts alike.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.

Modal Close icon
Modal Close icon