Introduction to Julia Programming: For Scientists and Engineers (Open Source Computing Book 5) by Sandeep Nagar
Author:Sandeep Nagar [Nagar, Sandeep]
Language: eng
Format: epub, pdf
Published: 2017-06-07T07:00:00+00:00
0.571905
0.991414
0.0
7.14.1 Other mathematical operators
A separate chapter (number 8) has been dedicated to explain how mathemati-
cal functions can be operated on arrays and its elements. This chapter is critical
for numerical experimentation as most of the data is converted into a matrix
(stored in computer memory) and mathematical functions are used to define a
transformation equation. This transformation equation operated on input ma-
trix and results into a new matrix (called transformed matrix). Simulating a real
system involved defining transformation equations. These transformed matrices
are converted back to original form of data for visualization and interpretation.
For this reason abilities of julia around speedy matrix transformation in a flexi-
ble manner, must be understood in an elaborate manner so that user can judge
correctly about choosing and then defining particular mathematical functions
in a right manner.
7.15 Set theory and arrays
The Array data types can be treated to equivalent to a mathematical set
too. The set operations like [ (Union) given by in-built function union(), \
(Intersection) given by in-built function intersect() and set difference can
be calculated. Union operation collects the unique occurrence of an element
of both sets. Intersection collects common elements from both sets and set-
difference (setdiff(A-B)) collects those elements which are present in A but
not in B.
julia> A = [1,2,3,4,-1,-3]
6-element Array{Int64,1}:
1
2
3
4
-1
-3
julia> B = [2,4,1,3,1,10]
6-element Array{Int64,1}:
2
4
137
1
3
1
10
julia> union(A,B)
7-element Array{Int64,1}:
1
2
3
4
-1
-3
10
julia> intersect(A,B)
4-element Array{Int64,1}:
1
2
3
4
julia> setdiff(A,B)
2-element Array{Int64,1}:
-1
-3
7.16 Summary
Arrays make the backbone of matrix computations which has enabled usage
of computers in area of mathematics. Vectorizing a problems lets computers
deal with complex tasks within a computing machine and this in-turn lets one
approximate a solution faster than achieving exact analytical solutions. Dy-
namically defining and manipulating arrays within variety of data types, makes
julia a good option for numerical computing. Fast operation is the key to julia’s
preference in this area. Ease of defining vectorization of operations lets julia
work on arrays as matrices in a flexible manner. Effectively managing copying,
sorting and generating arrays using comprehensions makes julia a good choice
for matrix based mathematical methods to solve physical problems.
138
8
Arrays for matrix operations
8.1 Defining an array
A julia array is equivalent to a mathematical matrix because just like a julia
array, a matrix is also a ordered collection of numbers. The simplest case for
matrix is the one storing components of a 3D vector. Foe example, a vector
~a = 2î + 3ˆj
4ˆ
k can also be represented as either a row matrix as:
⇥
⇤
2
3
4
or a column matrix as:
2
3
2
4 3 5
4
In both cases, the numbers 2, 3, 4 are ordered in a fashion. Now this matrix
can be represented by an array in julia as:
julia> A = [2,3,-4]
3-element Array{Int64,1}:
2
3
-4
julia> size(A)
(3,)
julia> A'
1x3 Array{Int64,2}:
2
3
-4
139
julia> size(A')
(1,3)
julia> (A')'
3x1 Array{Int64,2}:
2
3
-4
julia> size((A')')
(3,1)
• A creates a 1D array object (having only one index).
– This is not equivalent to a mathematical matrix as a matrix element
necessarily must have atleast 2 indices.
– For some practical purpose, this can be used to a vector.
– This object is mostly used to represent a sequence or series of num-
bers.
• A' creates a 1 ⇥ 3 2D array object.
– This is equivalent to a column matrix.
– Each element has two indices, one depicting row and other depicting
column.
• (A')' creates a 3 ⇥ 1 2D array object.
– This is equivalent to a row matrix.
Download
Introduction to Julia Programming: For Scientists and Engineers (Open Source Computing Book 5) by Sandeep Nagar.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Mikado Method by Ola Ellnestam Daniel Brolund(26455)
Hello! Python by Anthony Briggs(25367)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(24612)
Kotlin in Action by Dmitry Jemerov(23692)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(23024)
Dependency Injection in .NET by Mark Seemann(22800)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(21549)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(20406)
Grails in Action by Glen Smith Peter Ledbrook(19460)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(17056)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(16452)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(14130)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(12316)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(11588)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(10645)
Hit Refresh by Satya Nadella(9223)
The Kubernetes Operator Framework Book by Michael Dame(8579)
Exploring Deepfakes by Bryan Lyon and Matt Tora(8432)
Robo-Advisor with Python by Aki Ranin(8376)