Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
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
Mastering Julia
Mastering Julia

Mastering Julia: Enhance your analytical and programming skills for data modeling and processing with Julia , Second Edition

Arrow left icon
Profile Icon Malcolm Sherrington
Arrow right icon
$24.99 $36.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3 (3 Ratings)
eBook Jan 2024 506 pages 2nd Edition
eBook
$24.99 $36.99
Paperback
$45.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Malcolm Sherrington
Arrow right icon
$24.99 $36.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3 (3 Ratings)
eBook Jan 2024 506 pages 2nd Edition
eBook
$24.99 $36.99
Paperback
$45.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$24.99 $36.99
Paperback
$45.99
Subscription
Free Trial
Renews at $19.99p/m

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
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

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

Mastering Julia

The Julia Environment

In this chapter, we will explore all you need to get started on Julia. Julia is a high-level, high-performance, dynamic programming language that focuses mainly on technical computing. Its primary feature is that, although it’s a scripting language, the code is compiled using low-level virtual machine (LLVM). This compilation creates code that corresponds to the underlying hardware/operating system and runs at similar speeds to other compiled languages, such as C/C++ and Fortran.

The chapter will cover the following main topics:

  • Acquiring and installing Julia
  • The philosophy behind Julia and comparison with other programming languages
  • Developing code using the REPL, code editors, and IDEs
  • Use of the package management system
  • Some simple coding in Julia
  • A quick look at some graphics

By the end of this chapter, you should have a grasp of the basics of Julia. All the topics introduced are covered in more detail in the later...

Julia 101

Julia can be downloaded from the main website (https://julialang.org) via the Download menu option. It is available for Windows, macOS, Linux, and FreeBSD, and the appropriate download bundles are provided for a current stable version, a long-term support (LTS) version, and the next release. At the time of writing, the stable release is 1.8.5, the LTS is 1.6.7, and the new beta release is 1.9.0. I will briefly cover installing and uninstalling later, although the Julia website is the best source of information.

It can be run using the Julia REPL, the VS Code editor, and a couple of web-based IDEs, Jupyter and Pluto, which we will discuss later in this chapter.

The previous edition used Julia v0.4, which was the stable version at the time, so a large amount has changed since then. When we hosted JuliaCon 2018, v1.0 was announced, promising fewer breaking changes, although these are not insignificant, and so far, a number of breaking changes have been introduced on each...

Overview of Julia

Julia was first released to the world in February 2012 after a couple of years of development at the Massachusetts Institute of Technology (MIT). This was followed by a couple of years of development at MIT. Later, in 2015, a commercial arm called Julia Computing was set up to acquire funding and provide consultancy and (some) enterprise packages; this was later renamed to JuliaHub to reflect the inclusion of a cloud computing platform facility, at present, hosted on Amazon Web Services (AWS). The use of the JuliaHub cloud is discussed in the last chapter of this book.

Most of Julia remains freely available and we will be concentrating on that here. As mentioned previously, version 1.0 was released in 2018 and, at present, is approaching v1.9.0, although there seem to be no plans for a main release to mark crossing the v2 barrier.

All the original developers – Jeff Bezanson, Stefan Karpinski, and Viral Shah – still maintain roles in the evolution...

Philosophy

Julia was designed with scientific computing in mind. The developers tell us that they came with a wide array of programming skills – Lisp, Python, Ruby, R, and MATLAB.

All needed a “fast” compiled language in the armory such, as C or Fortran as the current languages listed previously are pitifully slow. Here is a quote from the development team:

We want a language that’s open source, with a liberal license. We want the speed of C with the dynamism of Ruby. We want a language that’s homoiconic, with true macros like Lisp, but with obvious, familiar mathematical notation like MATLAB. We want something as usable for general programming as Python, as easy for statistics as R, as natural for string processing as Perl, as powerful for linear algebra as MATLAB, as good at gluing programs together as the shell. Something that is dirt simple to learn yet keeps the most serious hackers happy. We want it to be interactive and we want it compiled...

Not only, but also…

Julia was initially designed with scientific computing in mind and has made considerable strides in recent years in the fields of machine learning, optimization, solution of differential systems, and so on, all of which will be dealt with topics in the latter portion of this book.

However, Julia was originally seen as a vehicle for the emerging discipline of data science, possibly as an alternative or adjunct to more popular approaches, and it is worth remarking that practitioners in data science would be advised to see what Julia has to offer here as well.

Although the term data science was coined as early as the 1970s, it was only given prominence in 2001 by William S. Cleveland in his article, Data Science: An Action Plan for Expanding the Technical Areas of the Field of Statistics.

Almost in parallel with the development of Julia has been the growth in data science and the demand for data science practitioners.

What is data science?

People...

Why is Julia fast?

Julia’s “big” idea was to compile the program right down to the machine code level.

This was by incorporating the LLVM technology developed at Urbana-Champaign in the early 2000s. LLVM was originally termed as the low-level virtual machine but is now seen as a mnemonic. Conceptually, Julia Core is parsed via an internal Lisp (Femtolisp) translator and then compiled into an intermediate representation (IR), and then a machine-dependent LLVM compiler is invoked to produce the actual executable.

Although this represents an overhead, the code is cached (i.e., only compiled once), and much effort has gone into creating system images of the basic Julia system and caching individual packages. This makes execution times of the same “order” as C code, perhaps about (x2). C compilers are often better optimized, but LLVM is getting there quickly. So, Julia provides the holy grail of compact code as well as fast execution times. The downside...

Why use Julia?

Programming in Julia sometimes seems too good to be true. As it has been implemented in the last few years, many of the recent ideas in computer science design have been incorporated into the language and the developers have not been afraid to modify Julia’s structure and syntax on the run-up to version 1.0, even though this has led to deprecations and breaking changes.

We have pointed out previously that Julia creates executable code from scripts without a separate compilation step and this results in runtimes in the same order as those of C, Fortran, Java, and so on; however, in my opinion, that is not the main reason to use Julia. In this section, we will look at the other factors that make it a must-see for any programmer, analyst, and data scientist.

Julia is easy to learn

Writing simple code in Julia will be almost immediate for anyone with a grounding in Python, R, C, and so on, as this book will show.

As mentioned previously, the syntax is...

Getting started with Julia

Starting to program in Julia is very easy. Naturally, the first task you will need to do is to install Julia on your computer. Thankfully, this has been made very simple. In the early versions of Julia, it was necessary to build from source but was largely made redundant with binaries for the major operating systems.

We differentiate between several different sets of sources:

  • Windows
  • Apple macOS
  • Generic Linux (x86)
  • Generic Linux (ARM)
  • Free BSD
  • Source (necessary for other OSs)

As noted previously, the best place to look is the main Julia website (http://julialang.org), and navigate to the Downloads tab on the menu.

Windows and macOS are serviced by exe and dmg binaries, respectively. In these cases, installation is as simple as downloading the binary and clicking on it, and everything else is handled by the installer. As of v1.9, a source on Apple macOS is now available for the new M-series processors, in addition to...

Package management

We have noted that Julia uses GitHub as a repository for the language source and a large number of Julia packages are hosted there.

Note

Other sources for Julia packages may be found on Bitbucket, GitLab, and so on; see stackshare.io for a full discussion: https://stackshare.io/stackups/bitbucket-vs-github-vs-gitlab.

As a full discussion of the package system is given on the Julia website, here, we will cover some of the main commands to use.

In v1.0, a new package manager has been introduced. Given the increase in registered packages, now approaching 2,000, the previous version (which relied on separate invocations of Git) became very slow, especially when using Windows.

Earlier, a method using the Pkg interface for package management was discussed. An alternate approach is to use one of the subset systems from the REPL. This is one of three such subsystems:

Online Help: Triggered by typing ?

  • Command Shell: Triggered by typing ;
...

Final thoughts

All the material covered in this chapter will be looked at in more detail in the rest of the book. The aim was to indicate what a simple, straightforward, yet powerful language Julia is.

Julia has been maturing for nearly 12 years, and with the advent of the v1.0+ releases, the formation of the commercial company, JuliaHub (previously named Julia Computing), and the growth of modules (approaching 10,000 in number at the time of writing), it has never been a better time to study and perhaps adopt Julia as a programming language of choice.

The fact that all three of the original developers are still actively involved with the evolution of the language as well as playing major roles within JuliaHub is a testament to the faith that they and many others are putting in it

Summary

This chapter introduced you to Julia, and how to download it, install it, and build it from the source. We saw that the language is elegant, concise, and powerful, and introduced some simple Julia coding examples.

The next four chapters will discuss the features of Julia in more depth.

We looked at interacting with Julia via the command line (REPL) in order to use a random walk method to evaluate the price of an Asian option. Also, we discussed the use of the VS Code editor and two IDEs, IJulia and Pluto, as an alternative to the REPL.

Additionally, we reviewed the built-in package manager, how to add, update and remove modules, and then demonstrated the use of two graphics packages to display typical trajectories of the Asian option calculation. In later chapters, we will look at various other approaches in order to create display graphics and quality visualizations.

In the next chapter, we will begin our detailed look at coding in Julia by discussing its primitive...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Augment your basic computing skills with an in-depth introduction to Julia
  • Focus on topic-based approaches to scientific problems and visualisation
  • Build on prior knowledge of programming languages such as Python, R, or C/C++
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

Julia is a well-constructed programming language which was designed for fast execution speed by using just-in-time LLVM compilation techniques, thus eliminating the classic problem of performing analysis in one language and translating it for performance in a second. This book is a primer on Julia’s approach to a wide variety of topics such as scientific computing, statistics, machine learning, simulation, graphics, and distributed computing. Starting off with a refresher on installing and running Julia on different platforms, you’ll quickly get to grips with the core concepts and delve into a discussion on how to use Julia with various code editors and interactive development environments (IDEs). As you progress, you’ll see how data works through simple statistics and analytics and discover Julia's speed, its real strength, which makes it particularly useful in highly intensive computing tasks. You’ll also and observe how Julia can cooperate with external processes to enhance graphics and data visualization. Finally, you will explore metaprogramming and learn how it adds great power to the language and establish networking and distributed computing with Julia. By the end of this book, you’ll be confident in using Julia as part of your existing skill set.

Who is this book for?

This book is not an introduction to computer programming, but a practical guide for developers who want to enhance their basic knowledge of Julia, or those wishing to augment their skill set by adding Julia to their existing roster of programming languages. Familiarity with a scripting language such as Python or R, or a compiled language such as C/C++, C# or Java, is a prerequisite.

What you will learn

  • Develop simple scripts in Julia using the REPL, code editors, and web-based IDEs
  • Get to grips with Julia's type system, multiple dispatch, metaprogramming, and macro development
  • Interact with data files, tables, data frames, SQL, and NoSQL databases
  • Delve into statistical analytics, linear programming, and optimization problems
  • Create graphics and visualizations to enhance modeling and simulation in Julia
  • Understand Julia's main approaches to machine learning, Bayesian analysis, and AI

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jan 19, 2024
Length: 506 pages
Edition : 2nd
Language : English
ISBN-13 : 9781805128236
Category :

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
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jan 19, 2024
Length: 506 pages
Edition : 2nd
Language : English
ISBN-13 : 9781805128236
Category :

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 $5 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 $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 137.97
Unlocking the Secrets of Prompt Engineering
$44.99
Interactive Visualization and Plotting with Julia
$46.99
Mastering Julia
$45.99
Total $ 137.97 Stars icon

Table of Contents

13 Chapters
Chapter 1: The Julia Environment Chevron down icon Chevron up icon
Chapter 2: Developing in Julia Chevron down icon Chevron up icon
Chapter 3: The Julia Type System Chevron down icon Chevron up icon
Chapter 4: The Three Ms Chevron down icon Chevron up icon
Chapter 5: Interoperability Chevron down icon Chevron up icon
Chapter 6: Working with Data Chevron down icon Chevron up icon
Chapter 7: Scientific Programming Chevron down icon Chevron up icon
Chapter 8: Visualization Chevron down icon Chevron up icon
Chapter 9: Database Access Chevron down icon Chevron up icon
Chapter 10: Networks and Multitasking Chevron down icon Chevron up icon
Chapter 11: Julia’s Back Pages Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(3 Ratings)
5 star 66.7%
4 star 0%
3 star 33.3%
2 star 0%
1 star 0%
Balaji Kothandaraman Feb 25, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Mastering Julia - Second Edition” is a comprehensive guide that empowers readers to enhance their analytical and programming skills using the Julia language. With updated insights and practical examples, this book covers a wide range of topics, from data modeling to high-performance computing. Whether you’re a beginner or an experienced user, this resource offers valuable insights and techniques for leveraging Julia effectively in data analysis and processing tasks.
Amazon Verified review Amazon
Stergios Papadimitriou May 31, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book "Mastering Julia" is well written and it covers comprehensively the fundamentals of the Julia language. Julia is a relatively new language for technical computing that introducing a lot of novel features and it is extremely fast producing code competent with optimized C/C++. And it achieves this even being very high level with a fluent convenient syntax. I strongly recommend the book to all Amazon readers that want to either learn or to further improve their skills on the superb Julia language.
Amazon Verified review Amazon
Bookworm Oct 11, 2024
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
The book is riddled with errors and typos, which is surprising for a second edition. The author’s writing style is convoluted and difficult to follow. Additionally, the organization of topics and overall flow are poorly structured. Coverage of some of the topics is superficial at best. For new or novice coders, this book will likely cause significant frustration due to the time wasted trying to decipher confusing sentences and mismatched code examples and outputs.
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.