SlideShare a Scribd company logo
Programming
linear algebra
things in python
-How to comprehend in it
-Why should this matter
Linear algebra is integral to most calculations
• This field is where one would study a
line, a plane, a subspace, a point, and
somehow figure out the correlation of
one image to another
• An intense change in intensity between
pixels would be considered an edge and
this observation is key in image recognition
software today
• No calculus required!
• But if you did learn Calculus(basic
differentiation), you could solve such
problems as the Schrodinger equation
What could I possibly use Python for?
• Easy to learn language, extendable, no semicolons!
• Visualize data with one of Python’s various modules(
Scipy, Numpy, Matplotlib etc)
• Numpy’s built-in ndarray allows for powerful, fast matrix
processing for multi-dimensional homogenous data types
• http://numpy.scipy.org/
• (Nd-array) N-dimensional array of square-like data
• UFUNC(Universal functions)- Allow for broadcasting,
processing matrices
• Among other things like typecasting
What is vector?
• Essential to linear algebra, the vector describes point
and direction of data, this is usually finitary in linear
algebra, usually described as 𝑖 𝑙𝑖𝑘𝑒 𝑥 , 𝑗(𝑙𝑖𝑘𝑒 𝑦)
•
𝑖
𝑗
are known as the basis vectors in 2d space, like the origin
• The Tail the vector’s point of origin, the head when it ends
• Magnitude of |a| is (𝑎1∗ 𝑎2)/2.
•
𝑖
𝑗
2
1
would be the vector sum, 2,1 is scalar
Head
Tail
What about matrix?
• A set of numerical data, expressions, or
symbols arranged in rows(m) and
columns(n)
• Can be described as an array of data
• Can be built off of vectors
The array information is stored in a
cache and these commands extract
commands from the header of the data
Numpy
>>> a = array([0,1,2,3])
>>> a
array([0, 1, 2, 3])
>>> type(a)
<type 'array'>
>>> a.dtype
dtype(‘int32’)
Describing a 1x4 array
Since python knows previously
described array, it prints it out
Ex: Assigning a float to into # an
int32 array will truncate decimal part.
>>> a[0] = 10.6
>>> a
[10, 1, 2, 3]
Coercion in code
Matplotlib- Fast, on-the-go data visualization
• import matplotlib.pyplot as plt
• X= ([1,2,3,4])
• plt.plot(x)
• plt.ylabel(' numbers')
• plt.show()
Why learn this?
Physics: If you don't watch a moving car from the outside but sit in the car, you are
changing your frame of reference. This corresponds to a change of basis in linear
algebra, which naturally pops out the centrifugal force (and the Coriolis force) from your
force expression.
Economics: Price (ex. function f) depends on supply and demand (the two components of
the two-dimensional vector x). If you do economics, linear algebra is a good idea.
Politics: If more roads are built, capacity goes up (good for business) but quality of life
goes down. People move away, which results in more traffic, which results in less excess
capacity, which is bad for business. Many variables and complex connections could lead
to multivariate calculus. This instead could be described in linear algebra and people in
politics or poly sci ought to know this to think about problems like these.
What is broadcast in python?
• Broadcasting describes how we treat
arrays with
different shapes during arithmetic
operations.
• The smaller array is “broadcast” across the
larger array so that they have compatible
shapes, subject to broadcasting
• Rules:
• NumPy compares their shapes element-
wise.
• It starts with the trailing dimensions, and
works its way forward.
• Two dimensions are compatible when
they are equal, or one of them is 1.
+
30 30 30
20 20 20
10 10 10
0 0 0 0 1 2
=
3
Why should I use python for my mathematical
hijinks?
• Python provides a platform for easy extensibility
• Large swath of extensible libraries and plenty of online support.
• This effectively and efficiently makes Python something like Matlab but better
• Allows for fast algorithms on machine data types on rectangular data ex. Array([0, 2, 4, 6, 8 ,10])
• Syntax is kept simple through not having to reference everything and therefore
follows the KISS principle
• Keeping the syntax simple (not like java) allows for faster compiling as you have less code to
compile, runtime lag tends to be less.
Data abstraction
• In OOP, you can have several classes which can implement a single interface
• A client of that interface doesn’t require the specifics used in the implementation of
interface
• In linear algebra, we have a field representing the data abstraction (it’s best to think of
fields like a class which implements pure functions such as +,-,*,%
• As long as the implantation of the fields in a class follows the rules of linear algebra, we
can utilize linear algebra in whatever application we choose to follow. This generality via
fields provides versatility in programming whatever.
• I.e the field of real numbers, cardinality, can aid in computing computer graphics
through its ties to geometry
• Binary and other base numbers can be used in cryptography
• Signal processing and other processes dynamic in nature such as load balancing a
network or polymorphic engines which change/time require complex numbers
• Python features many of these data structures making the barrier to entry into linear
algebra implementation lower
Comprehensions p1
Ex. (Math)
S = {x² : x in {0 ... 9}}
V = (1, 2, 4, 8, ..., 2¹²)
M = {x | x in S and x even}
1. Comprehension is an excellent example of this as it
allows the engineer to produce a list, set, array, or
dictionary through an expression
 Concise and readable, it utilizes functional
programming and is universally accessible. Allows
to write a procedure with very little code, usually
within one line, also resembles the notation
mathematicians use to describes sets
>>> S = [x**2 for x in range(10)]
>>> V = [2**i for i in range(13)]
>>> M = [x for x in S if x % 2 == 0]
>>> print S; print V; print M
Comprehensions p2
• Take for example {x∈R:x≥0} ”The set of consisting of all elements x of the set
of all real numbers such that x is less than or equal to 0(or the set of
negative numbers)”. Usually one removes the bold R as it is typically
assumed where the number is coming from (the field of all real numbers)
• The part before the colon produces a variable(s) and indicates the origin of
the elements and the part after provides the rule(s) which filter out which
elements then get allowed into the subsequent set. We would then write
this set comprehension in python as:
• (N = {-4, -2, -1, 0, 4, 6} ) ({x for x in N if x >=0})
• Whose answer in python would be {-4, -2}
Comprehensions p3
• For non-infinite numbers, |N| would describe the number of elements in a
set (Cardinality) whose Cardinality above would be 2
• One could make a lemma proving a hypothesis or array of hypotheses to be
true or not
• This could make sure that when coding a procedure, it follows a structure or
proof without future problems IN THAT FIELD
Other set notation things
• The cartesian product of A x B would be the set of all pairs (a,b) where “a” belongs to(∈) A
and “b” belongs to B and if A was {x, y} and B was {2, 3, 4}, A x B (the domain) would be
{(x,2), (y, 2), (x, 3), (y, 3), (x, 4), (y, 4)} (or the image of the function)
• In this one, the cardinality would be 6 because |A x B| is equal to |A| x |B|
• The Co-domain, however holistically, is the output of where the elements lie in a certain
domain and in this case, they lie between (x,y, and all real numbers) given input.
• So the image(Im) of A and B under the product function would be that list given above. Or A
and B map to the set above under the product function is not synonymous to (x, y, all real
numbers) the co-domain
• Now if you have a set x and a set y, the x^y lists all functions from y to x, so basically
everything from y gets jotted down as x gets introduced so basically you have to throw in
every possible function, not output, of set y into set x. For finite sets, |x^y| = |x|^|y|
Procedural abstraction
• This is to generalize and classify in a field i.e set of real numbers
• Programmers learn very quickly when writing code to call api’s (application
programming interfaces)
• What this means is they eventually learn what an array of different procedure calls
do and utilize them in concert with one another to build meaningful code
• Programmers thus aren’t required to understand how each procedure is then
implemented as the interaction of different modules from a global scope is
understood and what the end result yields.
• Such as coordinate visualization, basis, dimension, rank, and the relationships
between one another and how even that relationship could become its own field
Linear transformations
• If your vector or matrix changed up on you,
how do you describe it?
• A linear transformation is where the origin is
a fixed point and all lines remain lines, not
anything curved.
• Also, matrix multiplication is associative, no
matter the order the end result is the same
• [abcd][efgh]=[(ae+bg)(af+bh)(ce+gd)(cf+dh)]
• This does not mean when you apply a rotation
and shear transformation to a matrix that this is
matrix multiplication, it's addition and changing
up its transformation order results in a different
result.
Some of the hard problems linear algebra can
solve
• What is the energy state of my Hydrogen? My transistor??
• H^|ψ⟩=E|ψ⟩
• Note the braket notation are the quantum equivalent to parentheses and besides this, have
no other mathematical importance
• ψ is a vector, H is an operator, and E is a scalar
• Scalar multiplication is commutative and once wave vectors are normalized(by
getting rid of unnecessary inifinities), one can get the eigenstate energy by left
multiplying by ψ
• ⟨ψ|H^|ψ⟩=⟨ψ|E|ψ⟩=E
• Which means, without differential calculus, I know precisely what energy state
something like my transistor is in, so that pesky electrons stay where they are.
• No quantum tunneling!
What this builds on?
• Full abstraction, abstract algebra, vector spaces, semantics, quantum physics,
A.I, etc
END!
Ad

More Related Content

What's hot (20)

Algorithm & data structures lec1
Algorithm & data structures lec1Algorithm & data structures lec1
Algorithm & data structures lec1
Abdul Khan
 
Introduction to data_structure
Introduction to data_structureIntroduction to data_structure
Introduction to data_structure
Ashim Lamichhane
 
Interpolation and its applications
Interpolation and its applicationsInterpolation and its applications
Interpolation and its applications
RinkuMonani
 
Polymath For Chemical Engineers
Polymath For Chemical EngineersPolymath For Chemical Engineers
Polymath For Chemical Engineers
Hashim Khan
 
Search algorithms master
Search algorithms masterSearch algorithms master
Search algorithms master
Hossam Hassan
 
Parallel searching
Parallel searchingParallel searching
Parallel searching
Md. Mahedi Mahfuj
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
Gayathri Gaayu
 
Big o notation
Big o notationBig o notation
Big o notation
hamza mushtaq
 
DATA STRUCTURE AND ALGORITHM FULL NOTES
DATA STRUCTURE AND ALGORITHM FULL NOTESDATA STRUCTURE AND ALGORITHM FULL NOTES
DATA STRUCTURE AND ALGORITHM FULL NOTES
Aniruddha Paul
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
Venkatesh Iyer
 
CS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsCS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of Algorithms
Krishnan MuthuManickam
 
Interpolation and-its-application
Interpolation and-its-applicationInterpolation and-its-application
Interpolation and-its-application
Apurbo Datta
 
Chapter 4 ds
Chapter 4 dsChapter 4 ds
Chapter 4 ds
Hanif Durad
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of Algorithms
Swapnil Agrawal
 
Data Structures- Hashing
Data Structures- Hashing Data Structures- Hashing
Data Structures- Hashing
hemalatha athinarayanan
 
MATLAB
MATLABMATLAB
MATLAB
svati sharma
 
Slide1
Slide1Slide1
Slide1
Thiti Sununta
 
Unit 5
Unit 5Unit 5
Unit 5
Gunasundari Selvaraj
 
Design and analysis of algorithms - Abstract View
Design and analysis of algorithms - Abstract ViewDesign and analysis of algorithms - Abstract View
Design and analysis of algorithms - Abstract View
Waqas Nawaz
 
Computer algebra-system-maple
Computer algebra-system-mapleComputer algebra-system-maple
Computer algebra-system-maple
Азат Ажибеков
 
Algorithm & data structures lec1
Algorithm & data structures lec1Algorithm & data structures lec1
Algorithm & data structures lec1
Abdul Khan
 
Introduction to data_structure
Introduction to data_structureIntroduction to data_structure
Introduction to data_structure
Ashim Lamichhane
 
Interpolation and its applications
Interpolation and its applicationsInterpolation and its applications
Interpolation and its applications
RinkuMonani
 
Polymath For Chemical Engineers
Polymath For Chemical EngineersPolymath For Chemical Engineers
Polymath For Chemical Engineers
Hashim Khan
 
Search algorithms master
Search algorithms masterSearch algorithms master
Search algorithms master
Hossam Hassan
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
Gayathri Gaayu
 
DATA STRUCTURE AND ALGORITHM FULL NOTES
DATA STRUCTURE AND ALGORITHM FULL NOTESDATA STRUCTURE AND ALGORITHM FULL NOTES
DATA STRUCTURE AND ALGORITHM FULL NOTES
Aniruddha Paul
 
Introduction to Algorithms
Introduction to AlgorithmsIntroduction to Algorithms
Introduction to Algorithms
Venkatesh Iyer
 
CS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsCS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of Algorithms
Krishnan MuthuManickam
 
Interpolation and-its-application
Interpolation and-its-applicationInterpolation and-its-application
Interpolation and-its-application
Apurbo Datta
 
Design and Analysis of Algorithms
Design and Analysis of AlgorithmsDesign and Analysis of Algorithms
Design and Analysis of Algorithms
Swapnil Agrawal
 
Design and analysis of algorithms - Abstract View
Design and analysis of algorithms - Abstract ViewDesign and analysis of algorithms - Abstract View
Design and analysis of algorithms - Abstract View
Waqas Nawaz
 

Similar to Programming in python (20)

Engineering Numerical Analysis-Introduction.pdf
Engineering Numerical Analysis-Introduction.pdfEngineering Numerical Analysis-Introduction.pdf
Engineering Numerical Analysis-Introduction.pdf
ssuseraae901
 
Lecture1_computer vision-2023.pdf
Lecture1_computer vision-2023.pdfLecture1_computer vision-2023.pdf
Lecture1_computer vision-2023.pdf
ssuserff72e4
 
Introduction to Matlab
Introduction to MatlabIntroduction to Matlab
Introduction to Matlab
Amr Rashed
 
Automatic Task-based Code Generation for High Performance DSEL
Automatic Task-based Code Generation for High Performance DSELAutomatic Task-based Code Generation for High Performance DSEL
Automatic Task-based Code Generation for High Performance DSEL
Joel Falcou
 
MATLAB Workshop for project and research
MATLAB Workshop for project and researchMATLAB Workshop for project and research
MATLAB Workshop for project and research
Nuthal Srinivasan
 
Mbd dd
Mbd ddMbd dd
Mbd dd
Aditya Choudhury
 
MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
محمدعبد الحى
 
Matlab lec1
Matlab lec1Matlab lec1
Matlab lec1
Amba Research
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
Ravikiran A
 
MATLAB-tutorial for Image Processing with Lecture 3.ppt
MATLAB-tutorial for Image Processing with Lecture 3.pptMATLAB-tutorial for Image Processing with Lecture 3.ppt
MATLAB-tutorial for Image Processing with Lecture 3.ppt
ssuser5fb79d
 
MatlabIntro (1).ppt
MatlabIntro (1).pptMatlabIntro (1).ppt
MatlabIntro (1).ppt
AkashSingh728626
 
Data structure and algorithm using java
Data structure and algorithm using javaData structure and algorithm using java
Data structure and algorithm using java
Narayan Sau
 
Graph Algorithms, Sparse Algebra, and the GraphBLAS with Janice McMahon
Graph Algorithms, Sparse Algebra, and the GraphBLAS with Janice McMahonGraph Algorithms, Sparse Algebra, and the GraphBLAS with Janice McMahon
Graph Algorithms, Sparse Algebra, and the GraphBLAS with Janice McMahon
Christopher Conlan
 
Options and trade offs for parallelism and concurrency in Modern C++
Options and trade offs for parallelism and concurrency in Modern C++Options and trade offs for parallelism and concurrency in Modern C++
Options and trade offs for parallelism and concurrency in Modern C++
Satalia
 
DSJ_Unit I & II.pdf
DSJ_Unit I & II.pdfDSJ_Unit I & II.pdf
DSJ_Unit I & II.pdf
Arumugam90
 
MATLAB & Image Processing
MATLAB & Image ProcessingMATLAB & Image Processing
MATLAB & Image Processing
Techbuddy Consulting Pvt. Ltd.
 
in computer data structures and algorithms
in computer data structures and algorithmsin computer data structures and algorithms
in computer data structures and algorithms
FIONACHATOLA
 
R programmingmilano
R programmingmilanoR programmingmilano
R programmingmilano
Ismail Seyrik
 
Matlab ppt
Matlab pptMatlab ppt
Matlab ppt
chestialtaff
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
Dun Automation Academy
 
Engineering Numerical Analysis-Introduction.pdf
Engineering Numerical Analysis-Introduction.pdfEngineering Numerical Analysis-Introduction.pdf
Engineering Numerical Analysis-Introduction.pdf
ssuseraae901
 
Lecture1_computer vision-2023.pdf
Lecture1_computer vision-2023.pdfLecture1_computer vision-2023.pdf
Lecture1_computer vision-2023.pdf
ssuserff72e4
 
Introduction to Matlab
Introduction to MatlabIntroduction to Matlab
Introduction to Matlab
Amr Rashed
 
Automatic Task-based Code Generation for High Performance DSEL
Automatic Task-based Code Generation for High Performance DSELAutomatic Task-based Code Generation for High Performance DSEL
Automatic Task-based Code Generation for High Performance DSEL
Joel Falcou
 
MATLAB Workshop for project and research
MATLAB Workshop for project and researchMATLAB Workshop for project and research
MATLAB Workshop for project and research
Nuthal Srinivasan
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
Ravikiran A
 
MATLAB-tutorial for Image Processing with Lecture 3.ppt
MATLAB-tutorial for Image Processing with Lecture 3.pptMATLAB-tutorial for Image Processing with Lecture 3.ppt
MATLAB-tutorial for Image Processing with Lecture 3.ppt
ssuser5fb79d
 
Data structure and algorithm using java
Data structure and algorithm using javaData structure and algorithm using java
Data structure and algorithm using java
Narayan Sau
 
Graph Algorithms, Sparse Algebra, and the GraphBLAS with Janice McMahon
Graph Algorithms, Sparse Algebra, and the GraphBLAS with Janice McMahonGraph Algorithms, Sparse Algebra, and the GraphBLAS with Janice McMahon
Graph Algorithms, Sparse Algebra, and the GraphBLAS with Janice McMahon
Christopher Conlan
 
Options and trade offs for parallelism and concurrency in Modern C++
Options and trade offs for parallelism and concurrency in Modern C++Options and trade offs for parallelism and concurrency in Modern C++
Options and trade offs for parallelism and concurrency in Modern C++
Satalia
 
DSJ_Unit I & II.pdf
DSJ_Unit I & II.pdfDSJ_Unit I & II.pdf
DSJ_Unit I & II.pdf
Arumugam90
 
in computer data structures and algorithms
in computer data structures and algorithmsin computer data structures and algorithms
in computer data structures and algorithms
FIONACHATOLA
 
Ad

Recently uploaded (19)

Perguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolhaPerguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolha
socaslev
 
Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 SupportReliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
steve198109
 
highend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptxhighend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptx
elhadjcheikhdiop
 
5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx
andani26
 
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry SweetserAPNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC
 
OSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description fOSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description f
cbr49917
 
project_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptxproject_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptx
redzuriel13
 
Best web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you businessBest web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you business
steve198109
 
White and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptxWhite and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptx
canumatown
 
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHostingTop Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
steve198109
 
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation TemplateSmart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
yojeari421237
 
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
DataProvider1
 
IT Services Workflow From Request to Resolution
IT Services Workflow From Request to ResolutionIT Services Workflow From Request to Resolution
IT Services Workflow From Request to Resolution
mzmziiskd
 
Understanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep WebUnderstanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep Web
nabilajabin35
 
Determining Glass is mechanical textile
Determining  Glass is mechanical textileDetermining  Glass is mechanical textile
Determining Glass is mechanical textile
Azizul Hakim
 
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)
APNIC
 
(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security
aluacharya169
 
Perguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolhaPerguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolha
socaslev
 
Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 SupportReliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
steve198109
 
highend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptxhighend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptx
elhadjcheikhdiop
 
5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx
andani26
 
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry SweetserAPNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC Update, presented at NZNOG 2025 by Terry Sweetser
APNIC
 
OSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description fOSI TCP IP Protocol Layers description f
OSI TCP IP Protocol Layers description f
cbr49917
 
project_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptxproject_based_laaaaaaaaaaearning,kelompok 10.pptx
project_based_laaaaaaaaaaearning,kelompok 10.pptx
redzuriel13
 
Best web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you businessBest web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you business
steve198109
 
White and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptxWhite and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptx
canumatown
 
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHostingTop Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
steve198109
 
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation TemplateSmart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
yojeari421237
 
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
DataProvider1
 
IT Services Workflow From Request to Resolution
IT Services Workflow From Request to ResolutionIT Services Workflow From Request to Resolution
IT Services Workflow From Request to Resolution
mzmziiskd
 
Understanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep WebUnderstanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep Web
nabilajabin35
 
Determining Glass is mechanical textile
Determining  Glass is mechanical textileDetermining  Glass is mechanical textile
Determining Glass is mechanical textile
Azizul Hakim
 
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)DNS Resolvers and Nameservers (in New Zealand)
DNS Resolvers and Nameservers (in New Zealand)
APNIC
 
(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security
aluacharya169
 
Ad

Programming in python

  • 1. Programming linear algebra things in python -How to comprehend in it -Why should this matter
  • 2. Linear algebra is integral to most calculations • This field is where one would study a line, a plane, a subspace, a point, and somehow figure out the correlation of one image to another • An intense change in intensity between pixels would be considered an edge and this observation is key in image recognition software today • No calculus required! • But if you did learn Calculus(basic differentiation), you could solve such problems as the Schrodinger equation
  • 3. What could I possibly use Python for? • Easy to learn language, extendable, no semicolons! • Visualize data with one of Python’s various modules( Scipy, Numpy, Matplotlib etc) • Numpy’s built-in ndarray allows for powerful, fast matrix processing for multi-dimensional homogenous data types • http://numpy.scipy.org/ • (Nd-array) N-dimensional array of square-like data • UFUNC(Universal functions)- Allow for broadcasting, processing matrices • Among other things like typecasting
  • 4. What is vector? • Essential to linear algebra, the vector describes point and direction of data, this is usually finitary in linear algebra, usually described as 𝑖 𝑙𝑖𝑘𝑒 𝑥 , 𝑗(𝑙𝑖𝑘𝑒 𝑦) • 𝑖 𝑗 are known as the basis vectors in 2d space, like the origin • The Tail the vector’s point of origin, the head when it ends • Magnitude of |a| is (𝑎1∗ 𝑎2)/2. • 𝑖 𝑗 2 1 would be the vector sum, 2,1 is scalar Head Tail What about matrix? • A set of numerical data, expressions, or symbols arranged in rows(m) and columns(n) • Can be described as an array of data • Can be built off of vectors
  • 5. The array information is stored in a cache and these commands extract commands from the header of the data Numpy >>> a = array([0,1,2,3]) >>> a array([0, 1, 2, 3]) >>> type(a) <type 'array'> >>> a.dtype dtype(‘int32’) Describing a 1x4 array Since python knows previously described array, it prints it out Ex: Assigning a float to into # an int32 array will truncate decimal part. >>> a[0] = 10.6 >>> a [10, 1, 2, 3] Coercion in code
  • 6. Matplotlib- Fast, on-the-go data visualization • import matplotlib.pyplot as plt • X= ([1,2,3,4]) • plt.plot(x) • plt.ylabel(' numbers') • plt.show()
  • 7. Why learn this? Physics: If you don't watch a moving car from the outside but sit in the car, you are changing your frame of reference. This corresponds to a change of basis in linear algebra, which naturally pops out the centrifugal force (and the Coriolis force) from your force expression. Economics: Price (ex. function f) depends on supply and demand (the two components of the two-dimensional vector x). If you do economics, linear algebra is a good idea. Politics: If more roads are built, capacity goes up (good for business) but quality of life goes down. People move away, which results in more traffic, which results in less excess capacity, which is bad for business. Many variables and complex connections could lead to multivariate calculus. This instead could be described in linear algebra and people in politics or poly sci ought to know this to think about problems like these.
  • 8. What is broadcast in python? • Broadcasting describes how we treat arrays with different shapes during arithmetic operations. • The smaller array is “broadcast” across the larger array so that they have compatible shapes, subject to broadcasting • Rules: • NumPy compares their shapes element- wise. • It starts with the trailing dimensions, and works its way forward. • Two dimensions are compatible when they are equal, or one of them is 1. + 30 30 30 20 20 20 10 10 10 0 0 0 0 1 2 = 3
  • 9. Why should I use python for my mathematical hijinks? • Python provides a platform for easy extensibility • Large swath of extensible libraries and plenty of online support. • This effectively and efficiently makes Python something like Matlab but better • Allows for fast algorithms on machine data types on rectangular data ex. Array([0, 2, 4, 6, 8 ,10]) • Syntax is kept simple through not having to reference everything and therefore follows the KISS principle • Keeping the syntax simple (not like java) allows for faster compiling as you have less code to compile, runtime lag tends to be less.
  • 10. Data abstraction • In OOP, you can have several classes which can implement a single interface • A client of that interface doesn’t require the specifics used in the implementation of interface • In linear algebra, we have a field representing the data abstraction (it’s best to think of fields like a class which implements pure functions such as +,-,*,% • As long as the implantation of the fields in a class follows the rules of linear algebra, we can utilize linear algebra in whatever application we choose to follow. This generality via fields provides versatility in programming whatever. • I.e the field of real numbers, cardinality, can aid in computing computer graphics through its ties to geometry • Binary and other base numbers can be used in cryptography • Signal processing and other processes dynamic in nature such as load balancing a network or polymorphic engines which change/time require complex numbers • Python features many of these data structures making the barrier to entry into linear algebra implementation lower
  • 11. Comprehensions p1 Ex. (Math) S = {x² : x in {0 ... 9}} V = (1, 2, 4, 8, ..., 2¹²) M = {x | x in S and x even} 1. Comprehension is an excellent example of this as it allows the engineer to produce a list, set, array, or dictionary through an expression  Concise and readable, it utilizes functional programming and is universally accessible. Allows to write a procedure with very little code, usually within one line, also resembles the notation mathematicians use to describes sets >>> S = [x**2 for x in range(10)] >>> V = [2**i for i in range(13)] >>> M = [x for x in S if x % 2 == 0] >>> print S; print V; print M
  • 12. Comprehensions p2 • Take for example {x∈R:x≥0} ”The set of consisting of all elements x of the set of all real numbers such that x is less than or equal to 0(or the set of negative numbers)”. Usually one removes the bold R as it is typically assumed where the number is coming from (the field of all real numbers) • The part before the colon produces a variable(s) and indicates the origin of the elements and the part after provides the rule(s) which filter out which elements then get allowed into the subsequent set. We would then write this set comprehension in python as: • (N = {-4, -2, -1, 0, 4, 6} ) ({x for x in N if x >=0}) • Whose answer in python would be {-4, -2}
  • 13. Comprehensions p3 • For non-infinite numbers, |N| would describe the number of elements in a set (Cardinality) whose Cardinality above would be 2 • One could make a lemma proving a hypothesis or array of hypotheses to be true or not • This could make sure that when coding a procedure, it follows a structure or proof without future problems IN THAT FIELD
  • 14. Other set notation things • The cartesian product of A x B would be the set of all pairs (a,b) where “a” belongs to(∈) A and “b” belongs to B and if A was {x, y} and B was {2, 3, 4}, A x B (the domain) would be {(x,2), (y, 2), (x, 3), (y, 3), (x, 4), (y, 4)} (or the image of the function) • In this one, the cardinality would be 6 because |A x B| is equal to |A| x |B| • The Co-domain, however holistically, is the output of where the elements lie in a certain domain and in this case, they lie between (x,y, and all real numbers) given input. • So the image(Im) of A and B under the product function would be that list given above. Or A and B map to the set above under the product function is not synonymous to (x, y, all real numbers) the co-domain • Now if you have a set x and a set y, the x^y lists all functions from y to x, so basically everything from y gets jotted down as x gets introduced so basically you have to throw in every possible function, not output, of set y into set x. For finite sets, |x^y| = |x|^|y|
  • 15. Procedural abstraction • This is to generalize and classify in a field i.e set of real numbers • Programmers learn very quickly when writing code to call api’s (application programming interfaces) • What this means is they eventually learn what an array of different procedure calls do and utilize them in concert with one another to build meaningful code • Programmers thus aren’t required to understand how each procedure is then implemented as the interaction of different modules from a global scope is understood and what the end result yields. • Such as coordinate visualization, basis, dimension, rank, and the relationships between one another and how even that relationship could become its own field
  • 16. Linear transformations • If your vector or matrix changed up on you, how do you describe it? • A linear transformation is where the origin is a fixed point and all lines remain lines, not anything curved. • Also, matrix multiplication is associative, no matter the order the end result is the same • [abcd][efgh]=[(ae+bg)(af+bh)(ce+gd)(cf+dh)] • This does not mean when you apply a rotation and shear transformation to a matrix that this is matrix multiplication, it's addition and changing up its transformation order results in a different result.
  • 17. Some of the hard problems linear algebra can solve • What is the energy state of my Hydrogen? My transistor?? • H^|ψ⟩=E|ψ⟩ • Note the braket notation are the quantum equivalent to parentheses and besides this, have no other mathematical importance • ψ is a vector, H is an operator, and E is a scalar • Scalar multiplication is commutative and once wave vectors are normalized(by getting rid of unnecessary inifinities), one can get the eigenstate energy by left multiplying by ψ • ⟨ψ|H^|ψ⟩=⟨ψ|E|ψ⟩=E • Which means, without differential calculus, I know precisely what energy state something like my transistor is in, so that pesky electrons stay where they are. • No quantum tunneling!
  • 18. What this builds on? • Full abstraction, abstract algebra, vector spaces, semantics, quantum physics, A.I, etc END!