December 2018
Beginner to intermediate
330 pages
8h 32m
English
Here are a couple of little motivating examples about why we need vectorization when doing any kind of scientific computing. You will see what we mean by vectorization in the following example.
Let's perform a couple of simple calculations with Python. We have two examples:
distances = [10, 15, 17, 26]times = [0.3, 0.47, 0.55, 1.20]# Calculate speeds with Pythonspeeds = []for i in range(4): speeds.append(distances[i]/times[i])speeds
Here we have the speeds:
[33.333333333333336, 31.914893617021278, 30.909090909090907, 21.666666666666668]
An alternative to accomplish the same in Python methodology would be the following:
# An ...