SlideShare a Scribd company logo
1 of 13
Introduction to
numpy
Term paper-
Programming II
Submitted to:
Dr. Dharmendra Singh
Submitted by :
Gaurav
19mslsbf03
Table of Contents
 Introduction
 Operations using NumPy
 NumPy – A Replacement for MatLab
Installation of numpy package on Linux-Ubuntu
Numpy-ndarray
Numpy-matplotlib
Introduction
• NumPy is a Python package. It stands for 'Numerical
Python'. It is a library consisting of multidimensional array
objects and a collection of routines for processing of array.
• Numeric, the ancestor of NumPy, was developed by Jim
Hugunin. Another package Numarray was also developed,
having some additional functionalities. In 2005, Travis
Oliphant created NumPy package by incorporating the
features of Numarray into Numeric package. There are
many contributors to this open source project.
Operations using NumPy
Using NumPy, a developer can perform the following operations −
Mathematical and logical operations on arrays.
Fourier transforms and routines for shape manipulation.
Operations related to linear algebra. NumPy has in-built functions for
linear algebra and random number generation.
NumPy – A Replacement for MatLab
NumPy is often used along with packages like SciPy (Scientific
Python) and Mat−plotlib (plotting library). This combination is
widely used as a replacement for MatLab, a popular platform for
technical computing. However, Python alternative to MatLab is now
seen as a more modern and complete programming language.
It is open source, which is an added advantage of NumPy.
Installation of numpy package on Linux-Ubuntu
⁓$sudo apt-get install python-numpy
python-scipy python-
matplotlibipythonipythonnotebook
python-pandas python-sympy python-
nose
Use this command in the Terminal of Ubuntu system
to install numpy package
Numpy-ndarray
• The most important object defined in NumPy is an N-dimensional
array type called ndarray. It describes the collection of items of
the same type. Items in the collection can be accessed using a
zero-based index.
• Every item in an ndarray takes the same size of block in the
memory. Each element in ndarray is an object of data-type object
(called dtype).
Example
import numpy as np
a = np.array([1,2,3])
print a
import numpy as np
a = np.array([[1, 2], [3, 4]])
print a
import numpy as np
a = np.array([1, 2, 3,4,5], ndmin = 2)
print a
import numpy as np
a = np.array([1, 2, 3], dtype = complex)
print a
Numpy-Matplotlib
import numpy as np
from matplotlib import pyplot as plt
x = np.arange(1,11)
y = 2 * x + 5
plt.title("Matplotlib demo")
plt.xlabel("x axis caption")
plt.ylabel("y axis caption")
plt.plot(x,y)
plt.show()
import numpy as np
from matplotlib import pyplot as plt
x = np.arange(1,11)
y = 2 * x + 5
plt.title("Matplotlib demo")
plt.xlabel("x axis caption")
plt.ylabel("y axis caption")
plt.plot(x,y,"ob")
plt.show()
import numpy as np
import matplotlib.pyplot as plt
# Compute the x and y coordinates
for points on a sine curve
x = np.arange(0, 3 * np.pi, 0.1)
y = np.sin(x)
plt.title("sine wave form")
# Plot the points using matplotlib
plt.plot(x, y)
plt.show()
Sine Wave Plot
bar()
from matplotlib import pyplot as plt
x = [5,8,10]
y = [12,16,6]
x2 = [6,9,11]
y2 = [6,15,7]
plt.bar(x, y, align = 'center')
plt.bar(x2, y2, color = 'g', align = 'center')
plt.title('Bar graph')
plt.ylabel('Y axis')
plt.xlabel('X axis')
plt.show()
References
https://www.tutorialspoint.com/numpy
https://www.tutorialspoint.com/numpy/numpy_matplotlib.htm
https://www.tutorialspoint.com/numpy/numpy_ndarray_object.
htm

More Related Content

What's hot

What's hot (20)

Python for Data Science
Python for Data SciencePython for Data Science
Python for Data Science
 
Pandas
PandasPandas
Pandas
 
Introduction to NumPy
Introduction to NumPyIntroduction to NumPy
Introduction to NumPy
 
Introduction to pandas
Introduction to pandasIntroduction to pandas
Introduction to pandas
 
Numpy tutorial
Numpy tutorialNumpy tutorial
Numpy tutorial
 
Arrays in python
Arrays in pythonArrays in python
Arrays in python
 
Machine learning with scikitlearn
Machine learning with scikitlearnMachine learning with scikitlearn
Machine learning with scikitlearn
 
Python pandas Library
Python pandas LibraryPython pandas Library
Python pandas Library
 
Python Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, DictionaryPython Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, Dictionary
 
Loops in Python
Loops in PythonLoops in Python
Loops in Python
 
Python Scipy Numpy
Python Scipy NumpyPython Scipy Numpy
Python Scipy Numpy
 
NumPy.pptx
NumPy.pptxNumPy.pptx
NumPy.pptx
 
Python dictionary
Python   dictionaryPython   dictionary
Python dictionary
 
Datastructures in python
Datastructures in pythonDatastructures in python
Datastructures in python
 
Intoduction to numpy
Intoduction to numpyIntoduction to numpy
Intoduction to numpy
 
Python programming : Arrays
Python programming : ArraysPython programming : Arrays
Python programming : Arrays
 
Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in Python
 
The matplotlib Library
The matplotlib LibraryThe matplotlib Library
The matplotlib Library
 
Python - Numpy/Pandas/Matplot Machine Learning Libraries
Python - Numpy/Pandas/Matplot Machine Learning LibrariesPython - Numpy/Pandas/Matplot Machine Learning Libraries
Python - Numpy/Pandas/Matplot Machine Learning Libraries
 

Similar to NumPy Introduction and Operations

NumPy.pptx Bachelor of Computer Application
NumPy.pptx Bachelor of Computer ApplicationNumPy.pptx Bachelor of Computer Application
NumPy.pptx Bachelor of Computer Applicationsharmavishal49202
 
Introduction to numpy.pptx
Introduction to numpy.pptxIntroduction to numpy.pptx
Introduction to numpy.pptxssuser0e701a
 
Chapter 4 NumPy Basics Arrays and Vectorized Computation (Part I).pptx
Chapter 4 NumPy Basics Arrays and Vectorized Computation (Part I).pptxChapter 4 NumPy Basics Arrays and Vectorized Computation (Part I).pptx
Chapter 4 NumPy Basics Arrays and Vectorized Computation (Part I).pptxSovannDoeur
 
Python 8416516 16 196 46 5163 51 63 51 6.pptx
Python 8416516 16 196 46 5163 51 63 51 6.pptxPython 8416516 16 196 46 5163 51 63 51 6.pptx
Python 8416516 16 196 46 5163 51 63 51 6.pptxChetanRaut43
 
CAP776Numpy.ppt
CAP776Numpy.pptCAP776Numpy.ppt
CAP776Numpy.pptkdr52121
 
CDAT - cdms numpy arrays - Introduction
CDAT - cdms numpy arrays - IntroductionCDAT - cdms numpy arrays - Introduction
CDAT - cdms numpy arrays - IntroductionArulalan T
 
Data Analyzing And Visualization Using Python.pptx
Data Analyzing And Visualization Using Python.pptxData Analyzing And Visualization Using Python.pptx
Data Analyzing And Visualization Using Python.pptxPoojaChavan51
 
Python for Machine Learning(MatPlotLib).pptx
Python for Machine Learning(MatPlotLib).pptxPython for Machine Learning(MatPlotLib).pptx
Python for Machine Learning(MatPlotLib).pptxDr. Amanpreet Kaur
 
getting started with numpy and pandas.pptx
getting started with numpy and pandas.pptxgetting started with numpy and pandas.pptx
getting started with numpy and pandas.pptxworkvishalkumarmahat
 
NUMPY [Autosaved] .pptx
NUMPY [Autosaved]                    .pptxNUMPY [Autosaved]                    .pptx
NUMPY [Autosaved] .pptxcoolmanbalu123
 
Lsn21_NumPy in data science using python
Lsn21_NumPy in data science using pythonLsn21_NumPy in data science using python
Lsn21_NumPy in data science using pythonssuserec53e73
 

Similar to NumPy Introduction and Operations (20)

NumPy.pptx
NumPy.pptxNumPy.pptx
NumPy.pptx
 
NumPy.pptx Bachelor of Computer Application
NumPy.pptx Bachelor of Computer ApplicationNumPy.pptx Bachelor of Computer Application
NumPy.pptx Bachelor of Computer Application
 
NumPy.pptx
NumPy.pptxNumPy.pptx
NumPy.pptx
 
Numpy
NumpyNumpy
Numpy
 
Python for ML.pptx
Python for ML.pptxPython for ML.pptx
Python for ML.pptx
 
Numpy.pptx
Numpy.pptxNumpy.pptx
Numpy.pptx
 
NumPy.pptx
NumPy.pptxNumPy.pptx
NumPy.pptx
 
Introduction to numpy.pptx
Introduction to numpy.pptxIntroduction to numpy.pptx
Introduction to numpy.pptx
 
Chapter 4 NumPy Basics Arrays and Vectorized Computation (Part I).pptx
Chapter 4 NumPy Basics Arrays and Vectorized Computation (Part I).pptxChapter 4 NumPy Basics Arrays and Vectorized Computation (Part I).pptx
Chapter 4 NumPy Basics Arrays and Vectorized Computation (Part I).pptx
 
Python 8416516 16 196 46 5163 51 63 51 6.pptx
Python 8416516 16 196 46 5163 51 63 51 6.pptxPython 8416516 16 196 46 5163 51 63 51 6.pptx
Python 8416516 16 196 46 5163 51 63 51 6.pptx
 
Demo1 use numpy
Demo1 use numpyDemo1 use numpy
Demo1 use numpy
 
CAP776Numpy (2).ppt
CAP776Numpy (2).pptCAP776Numpy (2).ppt
CAP776Numpy (2).ppt
 
CAP776Numpy.ppt
CAP776Numpy.pptCAP776Numpy.ppt
CAP776Numpy.ppt
 
Kaggle tokyo 2018
Kaggle tokyo 2018Kaggle tokyo 2018
Kaggle tokyo 2018
 
CDAT - cdms numpy arrays - Introduction
CDAT - cdms numpy arrays - IntroductionCDAT - cdms numpy arrays - Introduction
CDAT - cdms numpy arrays - Introduction
 
Data Analyzing And Visualization Using Python.pptx
Data Analyzing And Visualization Using Python.pptxData Analyzing And Visualization Using Python.pptx
Data Analyzing And Visualization Using Python.pptx
 
Python for Machine Learning(MatPlotLib).pptx
Python for Machine Learning(MatPlotLib).pptxPython for Machine Learning(MatPlotLib).pptx
Python for Machine Learning(MatPlotLib).pptx
 
getting started with numpy and pandas.pptx
getting started with numpy and pandas.pptxgetting started with numpy and pandas.pptx
getting started with numpy and pandas.pptx
 
NUMPY [Autosaved] .pptx
NUMPY [Autosaved]                    .pptxNUMPY [Autosaved]                    .pptx
NUMPY [Autosaved] .pptx
 
Lsn21_NumPy in data science using python
Lsn21_NumPy in data science using pythonLsn21_NumPy in data science using python
Lsn21_NumPy in data science using python
 

More from Gaurav Aggarwal

Optimal gene circuit design
Optimal gene circuit designOptimal gene circuit design
Optimal gene circuit designGaurav Aggarwal
 
Ethics in assisted reproductive technologies
Ethics in assisted reproductive technologiesEthics in assisted reproductive technologies
Ethics in assisted reproductive technologiesGaurav Aggarwal
 
Epidemiology, Genetic Recombination, and Pathogenesis of Coronaviruses
Epidemiology, Genetic Recombination, and Pathogenesis of CoronavirusesEpidemiology, Genetic Recombination, and Pathogenesis of Coronaviruses
Epidemiology, Genetic Recombination, and Pathogenesis of CoronavirusesGaurav Aggarwal
 
Challenges and drawbacks of drug discovery and development
Challenges and drawbacks of drug discovery and developmentChallenges and drawbacks of drug discovery and development
Challenges and drawbacks of drug discovery and developmentGaurav Aggarwal
 
Forces stabilizing nucleic acid structure
Forces stabilizing nucleic acid structureForces stabilizing nucleic acid structure
Forces stabilizing nucleic acid structureGaurav Aggarwal
 
Memory management in python
Memory management in pythonMemory management in python
Memory management in pythonGaurav Aggarwal
 

More from Gaurav Aggarwal (12)

Optimal gene circuit design
Optimal gene circuit designOptimal gene circuit design
Optimal gene circuit design
 
Ethics in assisted reproductive technologies
Ethics in assisted reproductive technologiesEthics in assisted reproductive technologies
Ethics in assisted reproductive technologies
 
Descriptors
DescriptorsDescriptors
Descriptors
 
Apriori algorithm
Apriori algorithmApriori algorithm
Apriori algorithm
 
Epidemiology, Genetic Recombination, and Pathogenesis of Coronaviruses
Epidemiology, Genetic Recombination, and Pathogenesis of CoronavirusesEpidemiology, Genetic Recombination, and Pathogenesis of Coronaviruses
Epidemiology, Genetic Recombination, and Pathogenesis of Coronaviruses
 
Sequence analysis
Sequence analysisSequence analysis
Sequence analysis
 
Immunity to microbes
Immunity to microbesImmunity to microbes
Immunity to microbes
 
Challenges and drawbacks of drug discovery and development
Challenges and drawbacks of drug discovery and developmentChallenges and drawbacks of drug discovery and development
Challenges and drawbacks of drug discovery and development
 
Nucleus
NucleusNucleus
Nucleus
 
Forces stabilizing nucleic acid structure
Forces stabilizing nucleic acid structureForces stabilizing nucleic acid structure
Forces stabilizing nucleic acid structure
 
Memory management in python
Memory management in pythonMemory management in python
Memory management in python
 
Enzyme catalysis
Enzyme catalysisEnzyme catalysis
Enzyme catalysis
 

Recently uploaded

Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightDelhi Call girls
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxMohammedJunaid861692
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxolyaivanovalion
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...Pooja Nehwal
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxolyaivanovalion
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...shivangimorya083
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfadriantubila
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramMoniSankarHazra
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 

Recently uploaded (20)

Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFx
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics Program
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 

NumPy Introduction and Operations

  • 2. Term paper- Programming II Submitted to: Dr. Dharmendra Singh Submitted by : Gaurav 19mslsbf03
  • 3. Table of Contents  Introduction  Operations using NumPy  NumPy – A Replacement for MatLab Installation of numpy package on Linux-Ubuntu Numpy-ndarray Numpy-matplotlib
  • 4. Introduction • NumPy is a Python package. It stands for 'Numerical Python'. It is a library consisting of multidimensional array objects and a collection of routines for processing of array. • Numeric, the ancestor of NumPy, was developed by Jim Hugunin. Another package Numarray was also developed, having some additional functionalities. In 2005, Travis Oliphant created NumPy package by incorporating the features of Numarray into Numeric package. There are many contributors to this open source project.
  • 5. Operations using NumPy Using NumPy, a developer can perform the following operations − Mathematical and logical operations on arrays. Fourier transforms and routines for shape manipulation. Operations related to linear algebra. NumPy has in-built functions for linear algebra and random number generation. NumPy – A Replacement for MatLab NumPy is often used along with packages like SciPy (Scientific Python) and Mat−plotlib (plotting library). This combination is widely used as a replacement for MatLab, a popular platform for technical computing. However, Python alternative to MatLab is now seen as a more modern and complete programming language. It is open source, which is an added advantage of NumPy.
  • 6. Installation of numpy package on Linux-Ubuntu ⁓$sudo apt-get install python-numpy python-scipy python- matplotlibipythonipythonnotebook python-pandas python-sympy python- nose Use this command in the Terminal of Ubuntu system to install numpy package
  • 7. Numpy-ndarray • The most important object defined in NumPy is an N-dimensional array type called ndarray. It describes the collection of items of the same type. Items in the collection can be accessed using a zero-based index. • Every item in an ndarray takes the same size of block in the memory. Each element in ndarray is an object of data-type object (called dtype).
  • 8. Example import numpy as np a = np.array([1,2,3]) print a import numpy as np a = np.array([[1, 2], [3, 4]]) print a import numpy as np a = np.array([1, 2, 3,4,5], ndmin = 2) print a import numpy as np a = np.array([1, 2, 3], dtype = complex) print a
  • 9. Numpy-Matplotlib import numpy as np from matplotlib import pyplot as plt x = np.arange(1,11) y = 2 * x + 5 plt.title("Matplotlib demo") plt.xlabel("x axis caption") plt.ylabel("y axis caption") plt.plot(x,y) plt.show()
  • 10. import numpy as np from matplotlib import pyplot as plt x = np.arange(1,11) y = 2 * x + 5 plt.title("Matplotlib demo") plt.xlabel("x axis caption") plt.ylabel("y axis caption") plt.plot(x,y,"ob") plt.show()
  • 11. import numpy as np import matplotlib.pyplot as plt # Compute the x and y coordinates for points on a sine curve x = np.arange(0, 3 * np.pi, 0.1) y = np.sin(x) plt.title("sine wave form") # Plot the points using matplotlib plt.plot(x, y) plt.show() Sine Wave Plot
  • 12. bar() from matplotlib import pyplot as plt x = [5,8,10] y = [12,16,6] x2 = [6,9,11] y2 = [6,15,7] plt.bar(x, y, align = 'center') plt.bar(x2, y2, color = 'g', align = 'center') plt.title('Bar graph') plt.ylabel('Y axis') plt.xlabel('X axis') plt.show()