NumPy | Python Methods and Functions

** Parameters :**

arr1, arr2:[array_like]Legs (side and perpendicular) of triangleout:[ndarray, optional]Output array with result.

** Return: **

An array having hypotenuse of the right triangle.

** Code # 1: Work **

` ` |

** Output: **

leg1 array: [12 , 3, 4, 6] leg2 array: [5, 4, 3, 8] Hypotenuse is as follows: [13. 5. 5. 10.]

** Code # 2: Working with a 2D Array **

` ` |

** Output: **

leg1 array: [[0.57520509 0.12043366 0.50011671 0.13800957] [0.0528084 0.17827692 0.44236813 0.87758732] [0.94926413 0.47816742 0.46111934 0.63728903]] leg2 array: [[1. 1. 1. 1.] [1. 1. 1. 1.] [1. 1. 1. 1.]] Hypotenuse is as follows: [[1.15362944 1.00722603 1.11808619 1.0094784] [1.00139339 1.01576703 1.09347591 1.33047342] [1.37880469 1.10844219 1.10119528 1.18580661]]

** 3: Equivalent to sqrt (x1 ** 2 + x2 ** 2), element by element. **

` ` |

** Output: **

leg1 array: [[0.7015073 0.89047987 0.1595603 0.27557254] [0.67249153 0.16430312 0.70137114 0.48763522] [0.68067777 0.52154819 0.04339669 0.2239366] leg [1. 1. 1. 1.] [1. 1. 1. 1.] [1. 1. 1. 1.]] Hypotenuse is as follows: [[1.15362944 1.00722603 1.11808619 1.0094784] [1.00139339 1.01576703 1.09347591 1.33047342] [ 1.37880469 1.10844219 1.10119528 1.18580661]]

** Links: **

https://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.hypot.html#numpy.hypot

,

Cloud computing provides the capability to use computing and storage resources on a metered basis and reduce the investments in an organization’s computing infrastructure. The spawning and deletion ...

10/07/2020

The Pragmatic Programmer: Your Journey To Mastery, 20th Anniversary Edition (2nd Edition). The Pragmatic Programmer is one of those rare technical books that you will read, reread, and re-read over...

23/09/2021

ig Data applications are growing very rapidly around the globe. This new approach to decision making takes into account data gathered from multiple sources. Here my goal is to show how these diverse s...

10/07/2020

This is the first book on synthetic data for deep learning, and its extensive coverage could make this book the standard benchmark for synthetic data for years to come. The book can also serve as an i...

28/08/2021

X
# Submit new EBook