Book Image

NumPy: Beginner's Guide

By : Ivan Idris
Book Image

NumPy: Beginner's Guide

By: Ivan Idris

Overview of this book

Table of Contents (21 chapters)
NumPy Beginner's Guide Third Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
NumPy Functions' References
Index

Equal arrays


The assert_array_equal() function raises an exception if two arrays are not equal. The shapes of the arrays have to be equal and the elements of each array must be equal. NaNs are allowed in the arrays. Alternatively, arrays can be compared with the array_allclose() function. This function has the parameters absolute tolerance (atol) and relative tolerance (rtol). For two arrays a and b, these parameters satisfy the following equation:

|a - b| <= (atol + rtol * |b|)