Skip to Content
Mastering Numerical Computing with NumPy
book

Mastering Numerical Computing with NumPy

by Umit Mert Cakmak, Tiago Antao, Mert Cuhadaroglu
June 2018
Intermediate to advanced
248 pages
5h 27m
English
Packt Publishing
Content preview from Mastering Numerical Computing with NumPy

Vector and matrix mathematics 

In the previous chapter, you practiced introductory operations with vectors and matrices. In this section, you will practice more advanced vector and matrix operations that are heavily used in linear algebra. Let's remember the dot product perspective on matrix manipulation and how it can be done with different methods when you have 2-D arrays. The following code block shows alternative ways of performing dot product calculation:

In [1]: import numpy as np         a = np.arange(12).reshape(3,2)         b = np.arange(15).reshape(2,5)         print(a)         print(b)Out[1]: [[ 0 1]  [ 2 3]  [ 4 5]] [[ 0 1 2 3 4]  [ 5 6 7 8 9] In [2]: np.dot(a,b)Out[2]: array([[ 5,  6,  7,  8,  9],                [15, 20, 25, 30, 35],                [25, 34, 43, 52, 61]]) In [3]: np.matmul(a,b) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Numerical Computing with Python

Numerical Computing with Python

Pratap Dangeti, Allen Yu, Claire Chung, Aldrin Yim
Scientific Computing with Python - Second Edition

Scientific Computing with Python - Second Edition

Claus Führer, Claus Fuhrer, Jan Erik Solem, Olivier Verdier
SciPy and NumPy

SciPy and NumPy

Eli Bressert

Publisher Resources

ISBN: 9781788993357Supplemental Content