SlideShare a Scribd company logo
1 of 42
Fahad Mansoor
Introduction to Python
A readable, dynamic,pleasant,
flexible, fast andpowerful language
History Of Python
• Python was conceived in the late 1980s, and its
implementation began in December 1989 by Guido van
Rossum at Centrum Wiskunde & Informatica (CWI) in the
Netherlands as a successor to theABC language (itself
inspired by SETL) capable of exception handling and
interfacing with theAmoeba operating system. Van
Rossum remains Python's principal author. His continuing
central role in Python's development is reflected in the title
given to him by the Python community: Benevolent
Dictator For Life
Guido Van Rossum
On the origins of Python, Van Rossum
wrote in 1996:
...In December 1989, I was looking for a
"hobby" programming project that would
keep me occupied during the week
around Christmas. My office ... would be
closed, but I had a home computer, and
not much else on my hands. I decided to
write an interpreter for the new scripting
language I had been thinking about
lately: a descendant of ABC that would
appeal to Unix/Chackers. I chose Python
as a working title for the project, being in
a slightly irreverent mood (and a big fan
of Monty Python's Flying Circus).
Releases
• Created in 1989 by Guido Van Rossum
• Python 1.0 released in 1994
• Python 2.0 released in 2000
• Python 3.0 released in 2008
• Python 2.7 is the recommended version
• 3.0 adoption will take afew years
What is Python
• Multi-purpose (Web, GUI, Scripting, etc.)
• Object Oriented
• Interpreted
• Strongly typed andDynamically typed
• Focuson readability andproductivity
Features
• Everything is anObject
• Interactive Shell
• Strong Introspection
• Cross Platform
• CPython, Jython, IronPython, PyPy
•CPython, Jython, IronPython, PyPy :-
PyPy, Cpython, Jython, IronPython are the
implementation of the python program language in
Rpython ,C, Java, C# respectively. Implementation
means what language was used to implement Python
and not how python code would be implemented. All
the implementations pretty much do the same thing.
Based on which implementation you use
Who Uses Python
• Google
• PBS
• NASA
• Library of Congress
• the ONION
• ...the list goes on...
DataTypesInPython
• Numbers
• Strings
• Lists
• Tuple
• Dictionary
Hello World
hello_world
Indentation
• Most languagesdon’t care about
indentation
• Most humans do
• We tend to group similar things together
Indentation
The elsehere actually belongs to the 2nd if statement
Arithmetic Operators
Arithmetic Comparison
How to Declare The Variable In Python
Conditionals
Null
Numbers
Strings
Strings
Lists
Dictionaries
Dictionary
Solving Linear Equations
with
The Help OF Python
Fibonacci
Fibonacci Generator
Python’s Way
• No interfaces
• No real private attributes/functions
• Private attributes start (but do not end)
with double underscores.
• Specialclassmethods start andend with
double underscores.
• init , doc , cmp , str
Imports
• Allows code isolation and re-use
• Adds references to
variables/classes/functions/etc. into current
namespace
Uses of Python
•Youtube
•Instagram
•Mozila Firefox
•Google
•Droopbox
Application of Python
•WebApplications (Django)
•Game Development (Pygame)
•Web Scraping
•Data Science
•Robotics
For Simple Matrix from Python
1- Import numpy as np,
2- A is = np.mat(0,1,2,1,0,3,4,5,6)
3-Print(“Value of matrix A”A)
Inverse Of Matrix From Python
1- Import numpy as np,
2- A is = np.mat(0,1,2,1,0,3,4,5,6)
3-Print(“Value of matrix A”A)
4- Inverse = np.linalg.inv (A)
5- Print (“inverse of matrix a” inverse)
Example :-
>>>A=[[3,4],[2,3]]
Sol:-
Import numpy as np,
>>>A=[[3,4],[2,3]]
>>>B=linalg.inv(A)
Arry([[3,-4].[-2,3]])
Dot(A.B)
Matrix Inverse of 3 x 3
>>>import numpy as np
>>>from scipy import linalg,
A=np.mat([1,3,5
2,5,1
2,3,8])
Linalg inv (A)
Array ([[0.48 0.36 0.88],
[0,56 o.o8 -0.36],
[0.15 0.12 0.04]]
Linalg det (A)
-25
1- Import matplotlib.pyplot as plt
2-Plt.plot(np.random.randn(100))
3-plt.show()
Ploting of Matrix by Python
3x + y =9
X+ 2y =8
C:/>python
>>>import numpy as np
a = np.array(((3,1),(1,2))),
b = np.array((9,8))
X = np.linalg (a,b)
Array ([2,3]) # solution x=2 ,y=3
>>>true
Linear Equation to Matrix
Thanks!

More Related Content

What's hot

Neural networks
Neural networksNeural networks
Neural networks
Slideshare
 
Measuring instruments
Measuring instrumentsMeasuring instruments
Measuring instruments
Sayyed Raza
 
C++ Pointers And References
C++ Pointers And ReferencesC++ Pointers And References
C++ Pointers And References
verisan
 

What's hot (20)

Relational operators
Relational operatorsRelational operators
Relational operators
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
 
RECURSION IN C
RECURSION IN C RECURSION IN C
RECURSION IN C
 
Introduction to Mechanical Measurement
Introduction to Mechanical MeasurementIntroduction to Mechanical Measurement
Introduction to Mechanical Measurement
 
Neural networks
Neural networksNeural networks
Neural networks
 
Principal component analysis, Code and Time Complexity
Principal component analysis, Code and Time ComplexityPrincipal component analysis, Code and Time Complexity
Principal component analysis, Code and Time Complexity
 
Measuring instruments
Measuring instrumentsMeasuring instruments
Measuring instruments
 
Normalisation
NormalisationNormalisation
Normalisation
 
13. Pointer and 2D array
13. Pointer  and  2D array13. Pointer  and  2D array
13. Pointer and 2D array
 
Data Structures Chapter-2
Data Structures Chapter-2Data Structures Chapter-2
Data Structures Chapter-2
 
CS8391 Data Structures Part B Questions Anna University
CS8391 Data Structures Part B Questions Anna UniversityCS8391 Data Structures Part B Questions Anna University
CS8391 Data Structures Part B Questions Anna University
 
C++ Pointers And References
C++ Pointers And ReferencesC++ Pointers And References
C++ Pointers And References
 
Modern Control - Lec 02 - Mathematical Modeling of Systems
Modern Control - Lec 02 - Mathematical Modeling of SystemsModern Control - Lec 02 - Mathematical Modeling of Systems
Modern Control - Lec 02 - Mathematical Modeling of Systems
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
 
Computer notes - Expression Tree
Computer notes - Expression TreeComputer notes - Expression Tree
Computer notes - Expression Tree
 
Unsupervised learning
Unsupervised learningUnsupervised learning
Unsupervised learning
 
Applications of Discrete Structures
Applications of Discrete StructuresApplications of Discrete Structures
Applications of Discrete Structures
 
Recursion
RecursionRecursion
Recursion
 
Circular link list.ppt
Circular link list.pptCircular link list.ppt
Circular link list.ppt
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
 

Similar to Linear Algebra in Python

Chapter 5 Getting Started with Python.pptx
Chapter 5 Getting Started with Python.pptxChapter 5 Getting Started with Python.pptx
Chapter 5 Getting Started with Python.pptx
DattaArte1
 
Introduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptxIntroduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptx
HassanShah396906
 
session5-Getting stated with Python.pdf
session5-Getting stated with Python.pdfsession5-Getting stated with Python.pdf
session5-Getting stated with Python.pdf
AyushDutta32
 

Similar to Linear Algebra in Python (20)

Intro to python
Intro to pythonIntro to python
Intro to python
 
Chapter 5 Getting Started with Python.pptx
Chapter 5 Getting Started with Python.pptxChapter 5 Getting Started with Python.pptx
Chapter 5 Getting Started with Python.pptx
 
Chapter 5 Getting Started with Python.pptx
Chapter 5 Getting Started with Python.pptxChapter 5 Getting Started with Python.pptx
Chapter 5 Getting Started with Python.pptx
 
power point presentation to show oops with python.pptx
power point presentation to show oops with python.pptxpower point presentation to show oops with python.pptx
power point presentation to show oops with python.pptx
 
Chapter 8 getting started with python
Chapter 8 getting started with pythonChapter 8 getting started with python
Chapter 8 getting started with python
 
11 Unit1 Chapter 1 Getting Started With Python
11   Unit1 Chapter 1 Getting Started With Python11   Unit1 Chapter 1 Getting Started With Python
11 Unit1 Chapter 1 Getting Started With Python
 
Introduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptxIntroduction to Python – Learn Python Programming.pptx
Introduction to Python – Learn Python Programming.pptx
 
session5-Getting stated with Python.pdf
session5-Getting stated with Python.pdfsession5-Getting stated with Python.pdf
session5-Getting stated with Python.pdf
 
Before Starting Python Programming Language
Before Starting Python Programming LanguageBefore Starting Python Programming Language
Before Starting Python Programming Language
 
Python.pptx
Python.pptxPython.pptx
Python.pptx
 
A Comprehensive Python Introduction .pptx
A Comprehensive Python Introduction .pptxA Comprehensive Python Introduction .pptx
A Comprehensive Python Introduction .pptx
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptx
 
Intro to Python Programming
Intro to Python ProgrammingIntro to Python Programming
Intro to Python Programming
 
Programming with Python: Week 1
Programming with Python: Week 1Programming with Python: Week 1
Programming with Python: Week 1
 
Introduction to Python.pptx
Introduction to Python.pptxIntroduction to Python.pptx
Introduction to Python.pptx
 
Python Tutorial .pdf
Python Tutorial .pdfPython Tutorial .pdf
Python Tutorial .pdf
 
Python basics
Python basicsPython basics
Python basics
 
Python Introduction.ppt
Python Introduction.pptPython Introduction.ppt
Python Introduction.ppt
 
Python programming language (2017)
Python programming language (2017)Python programming language (2017)
Python programming language (2017)
 
C presentation -python
C presentation -pythonC presentation -python
C presentation -python
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 

Recently uploaded (20)

Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Our Environment Class 10 Science Notes pdf
Our Environment Class 10 Science Notes pdfOur Environment Class 10 Science Notes pdf
Our Environment Class 10 Science Notes pdf
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 

Linear Algebra in Python

  • 2. Introduction to Python A readable, dynamic,pleasant, flexible, fast andpowerful language
  • 3. History Of Python • Python was conceived in the late 1980s, and its implementation began in December 1989 by Guido van Rossum at Centrum Wiskunde & Informatica (CWI) in the Netherlands as a successor to theABC language (itself inspired by SETL) capable of exception handling and interfacing with theAmoeba operating system. Van Rossum remains Python's principal author. His continuing central role in Python's development is reflected in the title given to him by the Python community: Benevolent Dictator For Life
  • 4. Guido Van Rossum On the origins of Python, Van Rossum wrote in 1996: ...In December 1989, I was looking for a "hobby" programming project that would keep me occupied during the week around Christmas. My office ... would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/Chackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus).
  • 5. Releases • Created in 1989 by Guido Van Rossum • Python 1.0 released in 1994 • Python 2.0 released in 2000 • Python 3.0 released in 2008 • Python 2.7 is the recommended version • 3.0 adoption will take afew years
  • 6. What is Python • Multi-purpose (Web, GUI, Scripting, etc.) • Object Oriented • Interpreted • Strongly typed andDynamically typed • Focuson readability andproductivity
  • 7. Features • Everything is anObject • Interactive Shell • Strong Introspection • Cross Platform • CPython, Jython, IronPython, PyPy
  • 8. •CPython, Jython, IronPython, PyPy :- PyPy, Cpython, Jython, IronPython are the implementation of the python program language in Rpython ,C, Java, C# respectively. Implementation means what language was used to implement Python and not how python code would be implemented. All the implementations pretty much do the same thing. Based on which implementation you use
  • 9. Who Uses Python • Google • PBS • NASA • Library of Congress • the ONION • ...the list goes on...
  • 10. DataTypesInPython • Numbers • Strings • Lists • Tuple • Dictionary
  • 12. Indentation • Most languagesdon’t care about indentation • Most humans do • We tend to group similar things together
  • 13. Indentation The elsehere actually belongs to the 2nd if statement
  • 16. How to Declare The Variable In Python
  • 18. Null
  • 20.
  • 23. Lists
  • 24.
  • 28.
  • 29.
  • 30.
  • 33. Python’s Way • No interfaces • No real private attributes/functions • Private attributes start (but do not end) with double underscores. • Specialclassmethods start andend with double underscores. • init , doc , cmp , str
  • 34. Imports • Allows code isolation and re-use • Adds references to variables/classes/functions/etc. into current namespace
  • 35. Uses of Python •Youtube •Instagram •Mozila Firefox •Google •Droopbox
  • 36. Application of Python •WebApplications (Django) •Game Development (Pygame) •Web Scraping •Data Science •Robotics
  • 37. For Simple Matrix from Python 1- Import numpy as np, 2- A is = np.mat(0,1,2,1,0,3,4,5,6) 3-Print(“Value of matrix A”A) Inverse Of Matrix From Python 1- Import numpy as np, 2- A is = np.mat(0,1,2,1,0,3,4,5,6) 3-Print(“Value of matrix A”A) 4- Inverse = np.linalg.inv (A) 5- Print (“inverse of matrix a” inverse)
  • 38. Example :- >>>A=[[3,4],[2,3]] Sol:- Import numpy as np, >>>A=[[3,4],[2,3]] >>>B=linalg.inv(A) Arry([[3,-4].[-2,3]]) Dot(A.B)
  • 39. Matrix Inverse of 3 x 3 >>>import numpy as np >>>from scipy import linalg, A=np.mat([1,3,5 2,5,1 2,3,8]) Linalg inv (A) Array ([[0.48 0.36 0.88], [0,56 o.o8 -0.36], [0.15 0.12 0.04]] Linalg det (A) -25
  • 40. 1- Import matplotlib.pyplot as plt 2-Plt.plot(np.random.randn(100)) 3-plt.show() Ploting of Matrix by Python
  • 41. 3x + y =9 X+ 2y =8 C:/>python >>>import numpy as np a = np.array(((3,1),(1,2))), b = np.array((9,8)) X = np.linalg (a,b) Array ([2,3]) # solution x=2 ,y=3 >>>true Linear Equation to Matrix