14 Working with vectors and matrices

 

This chapter covers

  • Working with numbers in matrices and performing calculations
  • Slicing and dicing arrays
  • Concatenating arrays along different dimensions to form larger arrays

In chapter 4, you explored basic operations, such as push!, on one-dimensional arrays, called vectors. In this chapter, you will focus more on working with multidimensional arrays, such as matrices.

What can you use a matrix and vector for? They can be combined to solve a great number of problems. For example, it is popular to use vectors in a geometric interpretation; in this case they represent points in space. You can use matrices to move and rotate these points.

Matrices can even be used to solve mathematical equations, and they are very popular in machine learning. A matrix can be used to represent an image. Every element in a matrix can represent the color of a single pixel. Each of these topics deserves its own chapter or book, so in this chapter I will only cover the essentials of working with vectors and matrices.

14.1 Vectors and matrices in mathematics

A matrix or a vector is not just a dumb container of numbers. For instance, in mathematics, sets, tuples, and vectors may all look like a list of numbers and, hence, seem similar. But what you can do with them is different.

14.2 Constructing a matrix from rows and columns

 
 

14.3 The size, length, and norm of an array

 
 

14.4 Slicing and dicing an array

 
 

14.5 Combining matrices and vectors

 
 
 

14.6 Creating matrices

 
 

Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest