# -*- coding: utf-8 -*-
"""Copy of 03-Numpy Operations.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1JopIS7SFuJqtnvO3U6GgPxHS-clp-Smx

#Introduction to NumPy 

![alt text](https://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/NumPy_logo.svg/1200px-NumPy_logo.svg.png)

NumPy (or Numpy) is a Linear Algebra Library for Python. 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.

Numpy is also incredibly fast, as it has bindings to C libraries.

## **About iPython Notebooks**

iPython Notebooks are interactive coding environments embedded in a webpage. You will be using iPython notebooks in this class. You only need to write code between the ### START CODE HERE ### and ### END CODE HERE ### comments. After writing your code, you can run the cell by either pressing "SHIFT"+"ENTER" or by clicking on "Run Cell" (denoted by a play symbol) in the left bar of the cell.


**In this notebook you will learn -**
* Numpy arrays
* Numpy Selecting and Indexing
* Numpy Operations

## Using NumPy

To import NumPy in Colaboratory simply type the following:
"""

import numpy as np

"""# NumPy Operations

## Arithmetic

You can easily perform array with array arithmetic, or scalar with array arithmetic. Let's see some examples:
"""

import numpy as np
arr = np.arange(0,10)
arr

"""###Addition of arrays"""

arr + arr

"""###Multiplication of arrays"""

arr * arr

"""###Subtraction of arrays"""

arr - arr

"""###Division of arrays"""

# Warning on division by zero, but not an error!
# Just replaced with nan
arr/arr

# Also warning, but not an error instead infinity
1/arr

"""###Exponent"""

arr**3

"""## Universal Array Functions

Numpy comes with many universal array functions, which are essentially just mathematical operations you can use to perform the operation across the array. Let's see some common ones:
"""

#Taking Square Roots
np.sqrt(arr)

#Calcualting exponential (e^)
np.exp(arr)

np.max(arr) #same as arr.max()

np.sin(arr)

np.log(arr)

"""# Great Job!"""