Book Image

Learning Julia

By : Anshul Joshi, Rahul Lakhanpal
Book Image

Learning Julia

By: Anshul Joshi, Rahul Lakhanpal

Overview of this book

Julia is a highly appropriate language for scientific computing, but it comes with all the required capabilities of a general-purpose language. It allows us to achieve C/Fortran-like performance while maintaining the concise syntax of a scripting language such as Python. It is perfect for building high-performance and concurrent applications. From the basics of its syntax to learning built-in object types, this book covers it all. This book shows you how to write effective functions, reduce code redundancies, and improve code reuse. It will be helpful for new programmers who are starting out with Julia to explore its wide and ever-growing package ecosystem and also for experienced developers/statisticians/data scientists who want to add Julia to their skill-set. The book presents the fundamentals of programming in Julia and in-depth informative examples, using a step-by-step approach. You will be taken through concepts and examples such as doing simple mathematical operations, creating loops, metaprogramming, functions, collections, multiple dispatch, and so on. By the end of the book, you will be able to apply your skills in Julia to create and explore applications of any domain.
Table of Contents (17 chapters)
Title Page
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
8
Data Visualization and Graphics

Linear algebra and differential calculus


Julia is targeted toward the scientific community. Starting with this topic, we will see how Julia greatly eases mathematical calculations in the real world. We will start off by explaining how Julia proves to be a great resource for solving problems in linear algebra.

Linear algebra

The syntax used in Julia closely resembles that of MATLAB, but there are some important differences. To begin with, look at the matrix of some randomly generated numbers:

julia> A = rand(3,3)
3×3 Array{Float64,2}:
 0.821807   0.828687  0.974031
 0.996824   0.805663  0.274284
 0.0341033  0.224237  0.39982

The rand function takes in parameters asking for the dimensions of the array, and as we have passed here a (3,3), we get an array of size 3x3 of type Float64, containing random Gaussian numbers.

Similarly, we have another function named ones, which takes in a single parameter and reproduces an array containing 1.0:

julia> ones(5)
5-element Array{Float64,1}:
 1.0
 1.0...