├── .gitignore
├── README.md
├── check_install.py
├── data
├── insurance_male_nonsmoker.csv
├── monthly_co2_clean.csv
└── starbucks-menu-nutrition-drinks.csv
├── environment.yml
├── images
├── PR-4pages.png
├── beam.png
├── comet.png
├── google-irreducible.png
├── launched_ball.png
├── net_problem.png
├── net_problem_2.png
├── network.png
├── oscillator.png
├── rotation.png
├── washington-monument.jpg
└── whatsavector.png
├── notebook_en
├── 01_Transform_all_the_Vectors.ipynb
├── 02_Matrix_is_Everywhere.ipynb
├── 03_Eigenvectors_FTW.ipynb
└── 04_SVD.ipynb
├── requirements.txt
├── scripts
└── plot_helper.py
└── style
└── custom.css
/.gitignore:
--------------------------------------------------------------------------------
1 | #Ignore notebook checkpoints
2 | .ipynb_checkpoints
3 |
4 | #Ignore nbgrader log
5 | .nbgrader.log
6 | .DS_Store
7 | *.pyc
8 | __pycache__
9 | notebook_en/land_global_temperature_anomaly-1880-2016.csv
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Engineering Computations Module 4
2 |
3 | *Engineering Computations* is a collection of stackable learning modules, flexible for adoption in different situations.
4 | It aims to develop computational skills for students in engineering, but it can also be used by students in other science majors.
5 | The course uses the Python programming language and the Jupyter open-source tools for interactive computing.
6 |
7 | ## Module 4: Land on vector spaces
8 |
9 | *Practical Linear algebra with Python.*
10 |
11 | **Pre-requisite: learning module [*EngComp 1*](https://github.com/engineersCode/EngComp1_offtheground) of our collection.**
12 |
13 | This learning module re-imagines the teaching of linear algebra with a visually rich, intuitive approach, enabled by computing with Python.
14 | We disregard all the rules-based, memorization-heavy instruction of typical (undergraduate) courses in linear algebra.
15 | Instead, we rely on visuals to elucidate the core concepts, and on computational thinking for applying those concepts to useful settings.
16 |
17 | > Get an interactive session in MyBinder.org with these course materials by clicking on the button below. Select the folder notebooks_en to access the lessons of this course as fully executable Jupyter notebooks.
18 |
19 | > [](https://mybinder.org/v2/gh/engineersCode/EngComp4_landlinear/master)
20 |
21 | #### [Lesson 1](https://go.gwu.edu/engcomp4lesson1): Transform all the vectors
22 | What is a vector? The physicist's view versus the computer scientist's view. Fundamental vector operations: visualizing vector addition and multiplication by a scalar. Intuitive presentation of basis vectors, linear combination and span. What is a matrix? A matrix as a linear transformation mapping a vector in one space, to another space. Visualizing linear transformations. Matrix-vector multiplication: a linear combination of the matrix columns. Some special transformations: rotation, shear, scaling. Matrix-matrix multiplication: a composition of two linear transformations. Idea of inverse of a matrix as a transformation that takes vectors back to where they came from.
23 |
24 | #### [Lesson 2](https://go.gwu.edu/engcomp4lesson2): The matrix is everywhere
25 | A matrix is a linear transformation… visualize it. Norm of a vector.
26 | A matrix maps a circle to an ellipse… visualize it. A vector that doesn't change direction after a linear transformation is an eigenvector of the matrix.
27 | A matrix is a system of equations… visualize it (row perspective).
28 | Inconsistent and underdetermined systems.
29 | A matrix is a change of basis… visualize it. An inverse of that matrix will change the vector's coordinates back to the original basis.
30 | Matrices in three-dimensional space: linear transformations in 3D; 3D systems of linear equations; dimension and rank.
31 | Visualize the transformations of rank-deficient matrices.
32 |
33 | #### [Lesson 3](https://go.gwu.edu/engcomp4lesson3): Eigenvectors for the win
34 |
35 | Geometry of eigendecomposition. Eigenvectors revisited: a matrix transforms a circle to an ellipse, whose semimajor and semiminor axes align with the eigenvectors.
36 | Composition of scaling transformation and a rotation transformation: not enough! Complete the composition.
37 | Symmetric matrices, orthogonal eigenvectors.
38 | Eigendecomposition in general. Diagonalizable matrices. Similar matrices. Eigendecomposition is similarity via a change of basis.
39 | Compute eigenthings in Python, using NumPy or SymPy.
40 | Eigenvalues in ecology: matrix population models.
41 | Markov chains.
42 | PageRank algorithm.
43 |
44 | #### [Lesson 4](https://go.gwu.edu/engcomp4lesson4): Stick to the essentials: SVD
45 | Geometrical interpretation of singular value decomposition (SVD). While eigendecomposition is a combination of change of basis and stretching, SVD is a combination of rotation and stretching, which can be treated as a generalization of eigendecomposition.
46 | Example: SVD in image compression. A 2D image can be represented as an array where each pixel is an element of the array. By applying SVD and dropping smaller singular values, we can reconstruct the original image at a lower computational and memory cost.
47 | Non-square matrices: SVD in general; pseudo-inverse. Application to linear least squares; linear regression with SVD.
48 |
49 | ## Install the Dependencies
50 | The notebooks are compatible with Python version 3.5 or later, all packages required are listed in `environment.yml` and `requirements.txt`. Pick any option below to install the depencies:
51 |
52 | #### Create a `conda` environment
53 | Use `environment.yml` to create a `conda` environment:
54 |
55 | ```console
56 | conda env create -f environment.yml
57 | ```
58 |
59 | This creates a `conda` environment named "landlinear". For `conda` 4.6 and later versions, activate this environment with
60 |
61 | ```console
62 | conda activate landlinear
63 | ```
64 |
65 | For `conda` version prior to 4.6, run `source activate landlinear` on Linux and MacOS, `activate landlinear` on Windows.
66 |
67 | #### Install with `conda`
68 |
69 | ```console
70 | conda install matplotlib numpy scipy jupyter imageio ipywidgets
71 | ```
72 |
73 | #### Install with `pip`
74 |
75 | Install the packages using `requirements.txt` for `pip`:
76 | ```console
77 | pip install -r requirements.txt
78 | ```
79 |
80 | ## Check Installation
81 | Run the script `check_install.py` to check whether the required packages are installed correctly:
82 |
83 | ```console
84 | python check_install.py
85 | ```
86 |
--------------------------------------------------------------------------------
/check_install.py:
--------------------------------------------------------------------------------
1 | import importlib
2 | from sys import version_info
3 | from distutils.version import StrictVersion
4 |
5 | def compare_version(module, version):
6 | version_loaded = importlib.import_module(module).__version__
7 | if StrictVersion(version_loaded) < StrictVersion(version):
8 | return 'current version {}, please use conda or pip to upgrade to {} or later'.format(version_loaded, version)
9 | return None
10 |
11 | def main():
12 | try:
13 | assert version_info >= (3,5)
14 | except AssertionError:
15 | print('This tutorial requires Python version 3.5 or later.')
16 |
17 | modules = {'numpy': '1.15.1',
18 | 'matplotlib': '2.0.2',
19 | 'jupyter': None,
20 | 'sympy': None,
21 | 'imageio': None,
22 | 'ipywidgets': None}
23 |
24 | for module, version in modules.items():
25 | spec = importlib.util.find_spec(module)
26 | if spec is None:
27 | print('{} ... not found, use conda or pip to install'.format(module))
28 | else:
29 | if version is not None:
30 | msg = compare_version(module, version)
31 | if msg is not None:
32 | print('{} ... {}'.format(module, msg))
33 | else:
34 | print('{} ... OK'.format(module))
35 | else:
36 | print('{} ... OK'.format(module))
37 |
38 | if __name__ == '__main__':
39 | main()
40 |
--------------------------------------------------------------------------------
/data/insurance_male_nonsmoker.csv:
--------------------------------------------------------------------------------
1 | age,sex,bmi,children,smoker,region,charges
2 | 18,male,33.77,1,no,southeast,1725.5523
3 | 28,male,33.0,3,no,southeast,4449.462
4 | 32,male,28.88,0,no,northwest,3866.8552
5 | 37,male,29.83,2,no,northeast,6406.4107
6 | 25,male,26.22,0,no,northeast,2721.3208
7 | 23,male,34.4,0,no,southwest,1826.8429999999998
8 | 19,male,24.6,1,no,southwest,1837.237
9 | 23,male,23.845,0,no,northeast,2395.17155
10 | 56,male,40.3,0,no,southwest,10602.385
11 | 18,male,34.1,0,no,southeast,1137.011
12 | 37,male,28.025,2,no,northwest,6203.90175
13 | 23,male,17.385,1,no,northwest,2775.19215
14 | 63,male,28.31,0,no,northwest,13770.0979
15 | 19,male,20.425,0,no,northwest,1625.43375
16 | 26,male,20.8,0,no,southwest,2302.3
17 | 41,male,21.78,1,no,southeast,6272.4772
18 | 38,male,37.05,1,no,northeast,6079.6715
19 | 43,male,27.36,3,no,northeast,8606.2174
20 | 25,male,33.66,4,no,southeast,4504.6624
21 | 40,male,26.315,1,no,northwest,6389.37785
22 | 31,male,28.5,5,no,northeast,6799.4580000000005
23 | 58,male,32.01,1,no,southeast,11946.6259
24 | 44,male,27.4,2,no,southwest,7726.854
25 | 57,male,34.01,0,no,northwest,11356.6609
26 | 21,male,35.53,0,no,southeast,1532.4697
27 | 31,male,26.885,1,no,northeast,4441.21315
28 | 35,male,34.77,2,no,northwest,5729.0053
29 | 55,male,38.28,0,no,southeast,10226.2842
30 | 30,male,25.46,0,no,northeast,3645.0894
31 | 26,male,30.875,2,no,northwest,3877.30425
32 | 29,male,27.94,0,no,southeast,2867.1196
33 | 54,male,33.63,1,no,northwest,10825.2537
34 | 37,male,30.8,0,no,southwest,4646.759
35 | 52,male,32.205,3,no,northeast,11488.31695
36 | 58,male,49.06,0,no,southeast,11381.3254
37 | 44,male,37.1,2,no,southwest,7740.3369999999995
38 | 18,male,23.75,0,no,northeast,1705.6245
39 | 38,male,34.7,2,no,southwest,6082.405
40 | 19,male,25.555,0,no,northwest,1632.56445
41 | 19,male,34.1,0,no,southwest,1261.442
42 | 22,male,25.175,0,no,northwest,2045.68525
43 | 26,male,32.49,1,no,northeast,3490.5491
44 | 19,male,28.4,1,no,southwest,1842.519
45 | 35,male,24.13,1,no,northwest,5125.2157
46 | 48,male,29.7,0,no,southeast,7789.635
47 | 44,male,39.52,0,no,northwest,6948.7008
48 | 54,male,39.6,1,no,southwest,10450.552
49 | 37,male,29.64,0,no,northwest,5028.1466
50 | 47,male,28.215,4,no,northeast,10407.08585
51 | 27,male,18.905,3,no,northeast,4827.90495
52 | 63,male,41.47,0,no,southeast,13405.3903
53 | 49,male,30.3,0,no,southwest,8116.68
54 | 18,male,15.96,0,no,northeast,1694.7964
55 | 38,male,27.835,2,no,northwest,6455.86265
56 | 54,male,29.2,1,no,southwest,10436.096
57 | 58,male,28.595,0,no,northwest,11735.87905
58 | 22,male,19.95,3,no,northeast,4005.4225
59 | 44,male,30.69,2,no,southeast,7731.4271
60 | 61,male,31.57,0,no,southeast,12557.6053
61 | 25,male,25.74,0,no,southeast,2137.6536
62 | 18,male,34.43,0,no,southeast,1137.4697
63 | 19,male,30.59,0,no,northwest,1639.5631
64 | 46,male,22.3,0,no,southwest,7147.105
65 | 59,male,26.4,0,no,southeast,11743.298999999999
66 | 40,male,41.23,1,no,northeast,6610.1097
67 | 20,male,33.0,1,no,southwest,1980.07
68 | 40,male,30.875,4,no,northwest,8162.71625
69 | 24,male,28.5,2,no,northwest,3537.703
70 | 27,male,23.1,0,no,southeast,2483.736
71 | 32,male,30.8,3,no,southwest,5253.524
72 | 55,male,33.88,3,no,southeast,11987.1682
73 | 28,male,38.06,0,no,southeast,2689.4954
74 | 47,male,25.46,2,no,northeast,9225.2564
75 | 59,male,27.5,1,no,southwest,12333.828000000001
76 | 39,male,24.51,2,no,northwest,6710.1919
77 | 31,male,38.39,2,no,southeast,4463.2051
78 | 44,male,38.06,1,no,southeast,7152.6714
79 | 40,male,35.3,3,no,southwest,7196.866999999999
80 | 24,male,35.86,0,no,southeast,1986.9334
81 | 19,male,20.9,1,no,southwest,1832.094
82 | 29,male,28.975,1,no,northeast,4040.55825
83 | 27,male,30.3,3,no,southwest,4260.744000000001
84 | 51,male,24.415,4,no,northwest,11520.09985
85 | 45,male,30.2,1,no,southwest,7441.053000000001
86 | 49,male,25.84,1,no,northeast,9282.4806
87 | 18,male,29.37,1,no,southeast,1719.4363
88 | 41,male,37.05,2,no,northwest,7265.7025
89 | 50,male,27.455,1,no,northeast,9617.66245
90 | 25,male,27.55,0,no,northwest,2523.1695
91 | 19,male,20.615,2,no,northwest,2803.69785
92 | 59,male,31.79,2,no,southeast,12928.7911
93 | 30,male,27.645,1,no,northeast,4237.12655
94 | 46,male,26.62,1,no,southeast,7742.1098
95 | 25,male,26.8,3,no,southwest,3906.127
96 | 18,male,22.99,0,no,northeast,1704.5681
97 | 36,male,27.55,3,no,northeast,6746.7425
98 | 58,male,34.865,0,no,northeast,11944.59435
99 | 50,male,26.6,0,no,southwest,8444.474
100 | 49,male,35.86,0,no,southeast,8124.4084
101 | 52,male,33.25,0,no,northeast,9722.7695
102 | 50,male,32.205,0,no,northwest,8835.26495
103 | 54,male,32.775,0,no,northeast,10435.06525
104 | 32,male,37.335,1,no,northeast,4667.60765
105 | 34,male,25.27,1,no,northwest,4894.7533
106 | 57,male,40.945,0,no,northeast,11566.30055
107 | 29,male,27.2,0,no,southwest,2866.091
108 | 40,male,34.105,1,no,northeast,6600.20595
109 | 52,male,36.7,0,no,southwest,9144.565
110 | 64,male,34.5,0,no,southwest,13822.803
111 | 60,male,25.74,0,no,southeast,12142.5786
112 | 62,male,27.55,1,no,northwest,13937.6665
113 | 62,male,30.02,0,no,northwest,13352.0998
114 | 63,male,36.765,0,no,northeast,13981.85035
115 | 33,male,35.75,2,no,southeast,4889.9995
116 | 46,male,33.345,1,no,northeast,8334.45755
117 | 19,male,27.835,0,no,northwest,1635.73365
118 | 46,male,43.89,3,no,southeast,8944.1151
119 | 47,male,29.83,3,no,northwest,9620.3307
120 | 23,male,41.91,0,no,southeast,1837.2819
121 | 35,male,30.5,1,no,southwest,4751.07
122 | 44,male,32.015,2,no,northwest,8116.26885
123 | 18,male,30.4,3,no,northeast,3481.868
124 | 20,male,33.33,0,no,southeast,1391.5287
125 | 44,male,22.135,2,no,northeast,8302.53565
126 | 19,male,34.4,0,no,southwest,1261.859
127 | 48,male,35.625,4,no,northeast,10736.87075
128 | 48,male,31.445,1,no,northeast,8964.06055
129 | 49,male,31.35,1,no,northeast,9290.1395
130 | 46,male,19.855,0,no,northwest,7526.70645
131 | 64,male,25.6,2,no,southwest,14988.431999999999
132 | 47,male,47.52,1,no,southeast,8083.9198
133 | 49,male,32.3,3,no,northwest,10269.46
134 | 31,male,20.4,0,no,southwest,3260.199
135 | 38,male,21.12,3,no,southeast,6652.5288
136 | 32,male,30.03,1,no,southeast,4074.4537
137 | 19,male,17.48,0,no,northwest,1621.3402
138 | 25,male,23.9,5,no,southwest,5080.096
139 | 52,male,34.1,0,no,southeast,9140.951
140 | 64,male,39.16,1,no,southeast,14418.2804
141 | 25,male,30.59,0,no,northeast,2727.3951
142 | 48,male,30.2,2,no,southwest,8968.33
143 | 45,male,24.31,5,no,southeast,9788.8659
144 | 42,male,26.9,0,no,southwest,5969.723000000001
145 | 31,male,28.595,1,no,northwest,4243.59005
146 | 60,male,33.11,3,no,southeast,13919.8229
147 | 22,male,31.73,0,no,northeast,2254.7967
148 | 35,male,28.9,3,no,southwest,5926.846
149 | 26,male,29.45,0,no,northeast,2897.3235
150 | 18,male,43.01,0,no,southeast,1149.3959
151 | 60,male,29.64,0,no,northeast,12730.9996
152 | 35,male,38.6,1,no,southwest,4762.329000000001
153 | 39,male,29.6,4,no,southwest,7512.267
154 | 30,male,24.13,1,no,northwest,4032.2407
155 | 24,male,23.4,0,no,southwest,1969.614
156 | 20,male,29.735,0,no,northwest,1769.53165
157 | 32,male,46.53,2,no,southeast,4686.3887
158 | 56,male,39.6,0,no,southwest,10601.412
159 | 56,male,25.935,0,no,northeast,11165.41765
160 | 19,male,25.175,0,no,northwest,1632.03625
161 | 27,male,32.67,0,no,southeast,2497.0383
162 | 25,male,35.625,0,no,northwest,2534.39375
163 | 21,male,36.85,0,no,southeast,1534.3045
164 | 23,male,32.56,0,no,southeast,1824.2854
165 | 63,male,41.325,3,no,northwest,15555.18875
166 | 49,male,37.51,2,no,southeast,9304.7019
167 | 48,male,34.3,3,no,southwest,9563.029
168 | 19,male,28.7,0,no,southwest,1253.9360000000001
169 | 53,male,31.16,1,no,northwest,10461.9794
170 | 61,male,43.4,0,no,southwest,12574.048999999999
171 | 20,male,27.93,0,no,northeast,1967.0227
172 | 45,male,28.7,2,no,southwest,8027.968000000001
173 | 43,male,26.03,0,no,northeast,6837.3687
174 | 37,male,30.875,3,no,northwest,6796.86325
175 | 22,male,31.35,1,no,northwest,2643.2685
176 | 21,male,23.75,2,no,northwest,3077.0955
177 | 56,male,32.11,1,no,northeast,11763.0009
178 | 27,male,33.66,0,no,southeast,2498.4144
179 | 51,male,22.42,0,no,northeast,9361.3268
180 | 19,male,30.4,0,no,southwest,1256.299
181 | 58,male,35.7,0,no,southwest,11362.755
182 | 45,male,30.495,2,no,northwest,8413.46305
183 | 31,male,30.875,0,no,northeast,3857.75925
184 | 46,male,39.425,1,no,northeast,8342.90875
185 | 18,male,25.46,0,no,northeast,1708.0014
186 | 59,male,29.7,2,no,southeast,12925.886
187 | 64,male,40.48,0,no,southeast,13831.1152
188 | 38,male,28.025,1,no,northeast,6067.12675
189 | 54,male,30.21,0,no,northwest,10231.4999
190 | 28,male,35.435,0,no,northeast,3268.84665
191 | 63,male,30.8,0,no,southwest,13390.559
192 | 62,male,21.4,0,no,southwest,12957.118
193 | 28,male,23.8,2,no,southwest,3847.6740000000004
194 | 46,male,33.44,1,no,northeast,8334.5896
195 | 34,male,34.21,0,no,southeast,3935.1799
196 | 19,male,35.53,0,no,northwest,1646.4297
197 | 27,male,30.5,0,no,southwest,2494.022
198 | 50,male,44.77,1,no,southeast,9058.7303
199 | 41,male,30.59,2,no,northwest,7256.7231
200 | 22,male,26.84,0,no,southeast,1664.9996
201 | 52,male,30.2,1,no,southwest,9724.53
202 | 59,male,25.46,1,no,northeast,12913.9924
203 | 19,male,30.59,0,no,northwest,1639.5631
204 | 39,male,45.43,2,no,southeast,6356.2707
205 | 19,male,20.7,0,no,southwest,1242.816
206 | 21,male,20.235,3,no,northeast,3861.20965
207 | 47,male,19.57,1,no,northwest,8428.0693
208 | 20,male,31.13,2,no,southeast,2566.4707
209 | 41,male,40.26,0,no,southeast,5709.1644
210 | 43,male,32.6,2,no,southwest,7441.501
211 | 51,male,31.635,0,no,northwest,9174.13565
212 | 28,male,26.98,2,no,northeast,4435.0942
213 | 30,male,31.4,1,no,southwest,3659.3459999999995
214 | 59,male,28.785,0,no,northwest,12129.61415
215 | 36,male,28.88,3,no,northeast,6748.5912
216 | 58,male,38.0,0,no,southwest,11365.952
217 | 53,male,36.1,1,no,southwest,10085.846
218 | 24,male,29.3,0,no,southwest,1977.815
219 | 40,male,22.705,2,no,northeast,7173.35995
220 | 51,male,39.7,1,no,southwest,9391.346
221 | 64,male,38.19,0,no,northeast,14410.9321
222 | 56,male,33.66,4,no,southeast,12949.1554
223 | 33,male,42.4,5,no,southwest,6666.243
224 | 61,male,33.915,0,no,northeast,13143.86485
225 | 48,male,30.78,3,no,northeast,10141.1362
226 | 39,male,26.22,1,no,northwest,6123.5688
227 | 18,male,28.5,0,no,northeast,1712.227
228 | 27,male,33.155,2,no,northwest,4058.71245
229 | 37,male,46.53,3,no,southeast,6435.6237
230 | 18,male,33.66,0,no,southeast,1136.3994
231 | 49,male,28.7,1,no,southwest,8703.456
232 | 30,male,31.57,3,no,southeast,4837.5823
233 | 36,male,29.7,0,no,southeast,4399.731
234 | 45,male,21.375,0,no,northwest,7222.78625
235 | 56,male,36.1,3,no,southwest,12363.546999999999
236 | 19,male,20.3,0,no,southwest,1242.26
237 | 53,male,24.32,0,no,northwest,9863.4718
238 | 53,male,26.41,2,no,northeast,11244.3769
239 | 42,male,26.125,2,no,northeast,7729.64575
240 | 40,male,41.69,0,no,southeast,5438.7491
241 | 21,male,27.36,0,no,northeast,2104.1134
242 | 47,male,36.2,1,no,southwest,8068.185
243 | 20,male,32.395,1,no,northwest,2362.22905
244 | 24,male,23.655,0,no,northwest,2352.96845
245 | 56,male,33.725,0,no,northwest,10976.24575
246 | 53,male,41.47,0,no,southeast,9504.3103
247 | 49,male,28.69,3,no,northwest,10264.4421
248 | 18,male,35.2,1,no,southeast,1727.54
249 | 20,male,40.47,0,no,northeast,1984.4533
250 | 60,male,28.9,0,no,southwest,12146.971000000001
251 | 60,male,24.32,1,no,northwest,13112.6048
252 | 53,male,36.6,3,no,southwest,11264.541000000001
253 | 62,male,37.4,0,no,southwest,12979.358
254 | 19,male,35.4,0,no,southwest,1263.249
255 | 41,male,28.405,1,no,northwest,6664.68595
256 | 53,male,21.4,1,no,southwest,10065.413
257 | 26,male,23.7,2,no,southwest,3484.3309999999997
258 | 45,male,24.035,2,no,northeast,8604.48365
259 | 50,male,26.41,0,no,northwest,8827.2099
260 | 19,male,21.755,0,no,northwest,1627.28245
261 | 28,male,30.875,0,no,northwest,3062.50825
262 | 21,male,28.975,0,no,northwest,1906.35825
263 | 64,male,37.905,0,no,northwest,14210.53595
264 | 31,male,27.645,2,no,northeast,5031.26955
265 | 30,male,37.43,3,no,northeast,5428.7277
266 | 23,male,35.2,1,no,southwest,2416.955
267 | 27,male,26.03,0,no,northeast,3070.8087
268 | 47,male,32.3,1,no,southwest,8062.764
269 | 41,male,34.2,2,no,northwest,7261.741
270 | 51,male,33.33,3,no,southeast,10560.4917
271 | 40,male,32.3,2,no,northwest,6986.696999999999
272 | 45,male,39.805,0,no,northeast,7448.40395
273 | 35,male,34.32,3,no,southeast,5934.3798
274 | 53,male,28.88,0,no,northwest,9869.8102
275 | 18,male,41.14,0,no,southeast,1146.7966
276 | 51,male,35.97,1,no,southeast,9386.1613
277 | 60,male,36.955,0,no,northeast,12741.16745
278 | 21,male,36.86,0,no,northwest,1917.3184
279 | 29,male,22.515,3,no,northeast,5209.57885
280 | 19,male,27.6,0,no,southwest,1252.407
281 | 30,male,44.22,2,no,southeast,4266.1658
282 | 21,male,22.3,1,no,southwest,2103.08
283 | 23,male,26.51,0,no,southeast,1815.8759
284 | 18,male,30.14,0,no,southeast,1131.5066
285 | 25,male,25.84,1,no,northeast,3309.7926
286 | 54,male,21.01,2,no,southeast,11013.7119
287 | 28,male,22.515,2,no,northeast,4428.88785
288 | 36,male,34.43,2,no,southeast,5584.3057
289 | 23,male,37.1,3,no,southwest,3597.5959999999995
290 | 45,male,33.7,1,no,southwest,7445.918000000001
291 | 26,male,17.67,0,no,northwest,2680.9493
292 | 60,male,24.32,0,no,northwest,12523.6048
293 | 39,male,21.85,1,no,northwest,6117.4945
294 | 63,male,33.1,0,no,southwest,13393.756000000001
295 | 58,male,34.39,0,no,northwest,11743.9341
296 | 36,male,33.82,1,no,northwest,5377.4578
297 | 42,male,35.97,2,no,southeast,7160.3303
298 | 36,male,31.5,0,no,southwest,4402.233
299 | 21,male,31.1,0,no,southwest,1526.3120000000001
300 | 59,male,24.7,0,no,northeast,12323.936000000002
301 | 53,male,30.495,0,no,northeast,10072.05505
302 | 23,male,50.38,1,no,southeast,2438.0552
303 | 55,male,32.775,0,no,northwest,10601.63225
304 | 61,male,32.3,2,no,northwest,14119.62
305 | 57,male,28.1,0,no,southwest,10965.446000000002
306 | 51,male,25.4,0,no,southwest,8782.469000000001
307 | 40,male,29.9,2,no,southwest,6600.361
308 | 18,male,37.29,0,no,southeast,1141.4451
309 | 57,male,43.7,1,no,southwest,11576.13
310 | 61,male,23.655,0,no,northeast,13129.60345
311 | 50,male,36.2,0,no,southwest,8457.818000000001
312 | 42,male,24.86,0,no,southeast,5966.8874
313 | 43,male,30.1,1,no,southwest,6849.026
314 | 44,male,21.85,3,no,northeast,8891.1395
315 | 33,male,33.44,5,no,southeast,6653.7886
316 | 41,male,28.8,1,no,southwest,6282.235
317 | 22,male,34.8,3,no,southwest,3443.0640000000003
318 | 23,male,27.36,1,no,northwest,2789.0574
319 | 25,male,26.695,4,no,northwest,4877.98105
320 | 22,male,39.5,0,no,southwest,1682.5970000000002
321 | 57,male,33.63,1,no,northwest,11945.1327
322 | 54,male,24.035,0,no,northeast,10422.91665
323 | 62,male,32.11,0,no,northeast,13555.0049
324 | 19,male,25.555,1,no,northwest,2221.56445
325 | 49,male,22.515,0,no,northeast,8688.85885
326 | 26,male,27.265,3,no,northeast,4661.28635
327 | 49,male,36.85,0,no,southeast,8125.7845
328 | 27,male,32.585,3,no,northeast,4846.92015
329 | 63,male,39.8,3,no,southwest,15170.069
330 | 22,male,28.31,1,no,northwest,2639.0429
331 | 33,male,24.605,2,no,northwest,5257.50795
332 | 38,male,31.0,1,no,southwest,5488.262
333 | 34,male,35.815,0,no,northwest,4320.41085
334 | 43,male,23.2,0,no,southwest,6250.435
335 | 41,male,34.21,1,no,southeast,6289.7549
336 | 26,male,46.53,1,no,southeast,2927.0647
337 | 46,male,25.8,5,no,southwest,10096.97
338 | 32,male,37.18,2,no,southeast,4673.3922
339 | 18,male,26.18,2,no,southeast,2304.0022
340 | 53,male,29.48,0,no,southeast,9487.6442
341 | 18,male,23.21,0,no,southeast,1121.8739
342 | 19,male,22.61,0,no,northwest,1628.4709
343 | 62,male,39.93,0,no,southeast,12982.8747
344 | 42,male,35.8,2,no,southwest,7160.094
345 | 42,male,31.255,0,no,northwest,6358.77645
346 | 57,male,18.335,0,no,northeast,11534.87265
347 | 31,male,39.49,1,no,southeast,3875.7341
348 | 46,male,24.795,3,no,northeast,9500.57305
349 | 35,male,27.1,1,no,southwest,4746.344
350 | 44,male,25.365,1,no,northwest,7518.02535
351 | 21,male,25.745,2,no,northeast,3279.86855
352 | 26,male,35.42,0,no,southeast,2322.6218
353 | 48,male,40.15,0,no,southeast,7804.1605
354 | 26,male,29.15,1,no,southeast,2902.9065
355 | 34,male,21.375,0,no,northeast,4500.33925
356 | 20,male,30.115,5,no,northeast,4915.05985
357 | 43,male,30.115,3,no,northwest,8410.04685
358 | 34,male,34.675,0,no,northeast,4518.82625
359 | 38,male,28.27,1,no,southeast,5484.4673
360 | 24,male,25.8,0,no,southwest,1972.95
361 | 47,male,19.19,1,no,northeast,8627.5411
362 | 29,male,31.73,2,no,northwest,4433.3877
363 | 28,male,29.26,2,no,northeast,4438.2634
364 | 51,male,27.74,1,no,northeast,9957.7216
365 | 48,male,32.3,1,no,northwest,8765.249
366 | 59,male,25.46,0,no,northwest,12124.9924
367 | 51,male,37.0,0,no,southwest,8798.593
368 | 18,male,23.32,1,no,southeast,1711.0268
369 | 54,male,31.6,0,no,southwest,9850.431999999999
370 | 61,male,38.38,0,no,northwest,12950.0712
371 | 22,male,28.88,0,no,northeast,2250.8352
372 | 18,male,23.085,0,no,northeast,1704.70015
373 | 55,male,35.245,1,no,northeast,11394.06555
374 | 64,male,26.41,0,no,northeast,14394.5579
375 | 49,male,29.83,1,no,northeast,9288.0267
376 | 55,male,27.645,0,no,northwest,10594.50155
377 | 32,male,33.82,1,no,northwest,4462.7218
378 | 24,male,32.01,0,no,southeast,1981.5819
379 | 57,male,27.94,1,no,southeast,11554.2236
380 | 36,male,28.595,3,no,northwest,6548.19505
381 | 48,male,37.29,2,no,southeast,8978.1851
382 | 39,male,42.655,0,no,northeast,5757.41345
383 | 63,male,21.66,1,no,northwest,14349.8544
384 | 63,male,31.445,0,no,northeast,13974.45555
385 | 21,male,31.255,0,no,northwest,1909.52745
386 | 21,male,26.03,0,no,northeast,2102.2647
387 | 63,male,33.66,3,no,southeast,15161.5344
388 | 32,male,27.835,1,no,northwest,4454.40265
389 | 38,male,19.95,1,no,northwest,5855.9025
390 | 32,male,31.5,1,no,southwest,4076.4970000000003
391 | 55,male,28.975,0,no,northeast,10796.35025
392 | 57,male,31.54,0,no,northwest,11353.2276
393 | 52,male,47.74,1,no,southeast,9748.9106
394 | 56,male,22.1,0,no,southwest,10577.087
395 | 23,male,32.7,3,no,southwest,3591.48
396 | 22,male,33.77,0,no,southeast,1674.6323
397 | 53,male,28.6,3,no,southwest,11253.421
398 | 29,male,38.94,1,no,southeast,3471.4096
399 | 58,male,36.08,0,no,southeast,11363.2832
400 | 26,male,30.0,1,no,southwest,2904.0879999999997
401 | 45,male,20.35,3,no,southeast,8605.3615
402 | 23,male,24.51,0,no,northeast,2396.0959
403 | 55,male,32.67,1,no,southeast,10807.4863
404 | 41,male,29.64,5,no,northeast,9222.4026
405 | 46,male,38.17,2,no,southeast,8347.1643
406 | 55,male,29.9,0,no,southwest,10214.636
407 | 27,male,45.9,2,no,southwest,3693.428
408 | 33,male,30.25,0,no,southeast,3704.3545
409 | 50,male,37.07,1,no,southeast,9048.0273
410 | 39,male,32.34,2,no,southeast,6338.0756
411 | 50,male,32.3,2,no,southwest,9630.396999999999
412 | 52,male,32.775,3,no,northwest,11289.10925
413 | 55,male,21.5,1,no,southwest,10791.96
414 | 42,male,34.1,0,no,southwest,5979.731
415 | 34,male,42.13,2,no,southeast,5124.1887
416 | 57,male,40.37,0,no,southeast,10982.5013
417 | 32,male,35.2,2,no,southwest,4670.64
418 | 38,male,29.26,2,no,northwest,6457.8434
419 | 29,male,32.11,2,no,northwest,4433.9159
420 | 45,male,23.56,2,no,northeast,8603.8234
421 | 41,male,33.55,0,no,southeast,5699.8375
422 | 40,male,29.355,1,no,northwest,6393.60345
423 | 37,male,24.32,2,no,northwest,6198.7518
424 | 46,male,40.375,2,no,northwest,8733.22925
425 | 22,male,32.11,0,no,northwest,2055.3249
426 | 51,male,32.3,1,no,northeast,9964.06
427 | 35,male,17.86,1,no,northwest,5116.5004
428 | 59,male,37.1,1,no,southwest,12347.171999999999
429 | 36,male,30.875,1,no,northwest,5373.36425
430 | 18,male,21.47,0,no,northeast,1702.4553
431 | 40,male,25.08,0,no,southeast,5415.6612
432 | 29,male,37.29,2,no,southeast,4058.1161
433 | 40,male,24.97,2,no,southeast,6593.5083
434 | 50,male,25.3,0,no,southeast,8442.667
435 | 41,male,23.94,1,no,northeast,6858.4796
436 | 38,male,16.815,2,no,northeast,6640.54485
437 | 42,male,37.18,2,no,southeast,7162.0122
438 | 56,male,34.43,0,no,southeast,10594.2257
439 | 58,male,30.305,0,no,northeast,11938.25595
440 | 58,male,23.3,0,no,southwest,11345.518999999998
441 | 26,male,31.065,0,no,northwest,2699.56835
442 | 37,male,22.705,3,no,northeast,6985.50695
443 | 18,male,33.33,0,no,southeast,1135.9407
444 | 28,male,24.3,5,no,southwest,5615.369000000001
445 | 33,male,29.4,4,no,southwest,6059.173000000001
446 | 19,male,19.8,0,no,southwest,1241.565
447 | 28,male,37.1,1,no,southwest,3277.1609999999996
448 | 45,male,27.5,3,no,southwest,8615.3
449 | 26,male,33.915,1,no,northwest,3292.52985
450 | 35,male,27.61,1,no,southeast,4747.0529
451 | 57,male,23.7,0,no,southwest,10959.33
452 | 18,male,30.03,1,no,southeast,1720.3537
453 | 44,male,34.32,1,no,southeast,7147.4728
454 | 21,male,23.21,0,no,southeast,1515.3449
455 | 46,male,25.745,3,no,northwest,9301.89355
456 | 58,male,25.175,0,no,northeast,11931.12525
457 | 20,male,22.0,1,no,southwest,1964.78
458 | 18,male,26.125,0,no,northeast,1708.92575
459 | 33,male,27.455,2,no,northwest,5261.46945
460 | 41,male,32.2,2,no,southwest,6875.960999999999
461 | 42,male,26.315,1,no,northwest,6940.90985
462 | 34,male,42.9,1,no,southwest,4536.259
463 | 18,male,53.13,0,no,southeast,1163.4627
464 | 31,male,31.065,3,no,northwest,5425.02335
465 | 62,male,38.83,0,no,southeast,12981.3457
466 | 31,male,25.935,1,no,northwest,4239.89265
467 | 61,male,33.535,0,no,northeast,13143.33665
468 | 51,male,30.03,1,no,southeast,9377.9047
469 | 52,male,38.6,2,no,southwest,10325.206
470 | 50,male,30.97,3,no,northwest,10600.5483
471 |
--------------------------------------------------------------------------------
/data/monthly_co2_clean.csv:
--------------------------------------------------------------------------------
1 | Date,CO2
2 | 1958.2027, 315.71
3 | 1958.2877, 317.45
4 | 1958.3699, 317.51
5 | 1958.4548, 317.25
6 | 1958.5370, 315.86
7 | 1958.6219, 314.93
8 | 1958.7068, 313.21
9 | 1958.7890, 312.44
10 | 1958.8740, 313.33
11 | 1958.9562, 314.67
12 | 1959.0411, 315.58
13 | 1959.1260, 316.49
14 | 1959.2027, 316.65
15 | 1959.2877, 317.72
16 | 1959.3699, 318.29
17 | 1959.4548, 318.15
18 | 1959.5370, 316.54
19 | 1959.6219, 314.80
20 | 1959.7068, 313.84
21 | 1959.7890, 313.33
22 | 1959.8740, 314.81
23 | 1959.9562, 315.58
24 | 1960.0410, 316.43
25 | 1960.1257, 316.98
26 | 1960.2049, 317.58
27 | 1960.2896, 319.03
28 | 1960.3716, 320.03
29 | 1960.4563, 319.59
30 | 1960.5383, 318.18
31 | 1960.6230, 315.90
32 | 1960.7077, 314.17
33 | 1960.7896, 313.83
34 | 1960.8743, 315.00
35 | 1960.9563, 316.19
36 | 1961.0411, 316.89
37 | 1961.1260, 317.70
38 | 1961.2027, 318.54
39 | 1961.2877, 319.48
40 | 1961.3699, 320.58
41 | 1961.4548, 319.77
42 | 1961.5370, 318.56
43 | 1961.6219, 316.79
44 | 1961.7068, 314.99
45 | 1961.7890, 315.31
46 | 1961.8740, 316.10
47 | 1961.9562, 317.01
48 | 1962.0411, 317.94
49 | 1962.1260, 318.55
50 | 1962.2027, 319.68
51 | 1962.2877, 320.57
52 | 1962.3699, 321.02
53 | 1962.4548, 320.62
54 | 1962.5370, 319.61
55 | 1962.6219, 317.40
56 | 1962.7068, 316.25
57 | 1962.7890, 315.42
58 | 1962.8740, 316.69
59 | 1962.9562, 317.70
60 | 1963.0411, 318.74
61 | 1963.1260, 319.07
62 | 1963.2027, 319.86
63 | 1963.2877, 321.38
64 | 1963.3699, 322.25
65 | 1963.4548, 321.48
66 | 1963.5370, 319.74
67 | 1963.6219, 317.77
68 | 1963.7068, 316.21
69 | 1963.7890, 315.99
70 | 1963.8740, 317.07
71 | 1963.9562, 318.35
72 | 1964.0410, 319.57
73 | 1964.1257, 320.02
74 | 1964.2049, 320.75
75 | 1964.2896, 321.84
76 | 1964.3716, 322.25
77 | 1964.4563, 321.89
78 | 1964.5383, 320.44
79 | 1964.6230, 318.69
80 | 1964.7077, 316.71
81 | 1964.7896, 316.87
82 | 1964.8743, 317.68
83 | 1964.9563, 318.71
84 | 1965.0411, 319.44
85 | 1965.1260, 320.44
86 | 1965.2027, 320.89
87 | 1965.2877, 322.14
88 | 1965.3699, 322.17
89 | 1965.4548, 321.87
90 | 1965.5370, 321.21
91 | 1965.6219, 318.87
92 | 1965.7068, 317.82
93 | 1965.7890, 317.30
94 | 1965.8740, 318.87
95 | 1965.9562, 319.42
96 | 1966.0411, 320.62
97 | 1966.1260, 321.60
98 | 1966.2027, 322.39
99 | 1966.2877, 323.70
100 | 1966.3699, 324.08
101 | 1966.4548, 323.75
102 | 1966.5370, 322.38
103 | 1966.6219, 320.36
104 | 1966.7068, 318.64
105 | 1966.7890, 318.10
106 | 1966.8740, 319.78
107 | 1966.9562, 321.03
108 | 1967.0411, 322.33
109 | 1967.1260, 322.50
110 | 1967.2027, 323.03
111 | 1967.2877, 324.42
112 | 1967.3699, 325.00
113 | 1967.4548, 324.09
114 | 1967.5370, 322.54
115 | 1967.6219, 320.92
116 | 1967.7068, 319.25
117 | 1967.7890, 319.39
118 | 1967.8740, 320.73
119 | 1967.9562, 321.96
120 | 1968.0410, 322.57
121 | 1968.1257, 323.15
122 | 1968.2049, 323.89
123 | 1968.2896, 325.02
124 | 1968.3716, 325.57
125 | 1968.4563, 325.36
126 | 1968.5383, 324.14
127 | 1968.6230, 322.11
128 | 1968.7077, 320.33
129 | 1968.7896, 320.25
130 | 1968.8743, 321.32
131 | 1968.9563, 322.89
132 | 1969.0411, 324.00
133 | 1969.1260, 324.42
134 | 1969.2027, 325.63
135 | 1969.2877, 326.66
136 | 1969.3699, 327.38
137 | 1969.4548, 326.71
138 | 1969.5370, 325.88
139 | 1969.6219, 323.66
140 | 1969.7068, 322.38
141 | 1969.7890, 321.78
142 | 1969.8740, 322.85
143 | 1969.9562, 324.12
144 | 1970.0411, 325.06
145 | 1970.1260, 325.98
146 | 1970.2027, 326.93
147 | 1970.2877, 328.13
148 | 1970.3699, 328.08
149 | 1970.4548, 327.67
150 | 1970.5370, 326.34
151 | 1970.6219, 324.68
152 | 1970.7068, 323.10
153 | 1970.7890, 323.07
154 | 1970.8740, 324.01
155 | 1970.9562, 325.13
156 | 1971.0411, 326.17
157 | 1971.1260, 326.68
158 | 1971.2027, 327.18
159 | 1971.2877, 327.79
160 | 1971.3699, 328.93
161 | 1971.4548, 328.57
162 | 1971.5370, 327.36
163 | 1971.6219, 325.43
164 | 1971.7068, 323.36
165 | 1971.7890, 323.56
166 | 1971.8740, 324.80
167 | 1971.9562, 326.01
168 | 1972.0410, 326.77
169 | 1972.1257, 327.63
170 | 1972.2049, 327.75
171 | 1972.2896, 329.72
172 | 1972.3716, 330.07
173 | 1972.4563, 329.09
174 | 1972.5383, 328.04
175 | 1972.6230, 326.32
176 | 1972.7077, 324.84
177 | 1972.7896, 325.20
178 | 1972.8743, 326.50
179 | 1972.9563, 327.55
180 | 1973.0411, 328.55
181 | 1973.1260, 329.56
182 | 1973.2027, 330.30
183 | 1973.2877, 331.50
184 | 1973.3699, 332.48
185 | 1973.4548, 332.07
186 | 1973.5370, 330.87
187 | 1973.6219, 329.31
188 | 1973.7068, 327.52
189 | 1973.7890, 327.19
190 | 1973.8740, 328.17
191 | 1973.9562, 328.65
192 | 1974.0411, 329.36
193 | 1974.1260, 330.71
194 | 1974.2027, 331.49
195 | 1974.2877, 332.65
196 | 1974.3699, 333.10
197 | 1974.4548, 332.26
198 | 1974.5370, 331.18
199 | 1974.6219, 329.40
200 | 1974.7068, 327.44
201 | 1974.7890, 327.38
202 | 1974.8740, 328.46
203 | 1974.9562, 329.58
204 | 1975.0411, 330.41
205 | 1975.1260, 331.41
206 | 1975.2027, 332.05
207 | 1975.2877, 333.32
208 | 1975.3699, 333.98
209 | 1975.4548, 333.61
210 | 1975.5370, 331.91
211 | 1975.6219, 330.06
212 | 1975.7068, 328.57
213 | 1975.7890, 328.35
214 | 1975.8740, 329.50
215 | 1975.9562, 330.77
216 | 1976.0410, 331.76
217 | 1976.1257, 332.58
218 | 1976.2049, 333.50
219 | 1976.2896, 334.59
220 | 1976.3716, 334.89
221 | 1976.4563, 334.34
222 | 1976.5383, 333.06
223 | 1976.6230, 330.95
224 | 1976.7077, 329.31
225 | 1976.7896, 328.95
226 | 1976.8743, 330.32
227 | 1976.9563, 331.69
228 | 1977.0411, 332.94
229 | 1977.1260, 333.43
230 | 1977.2027, 334.71
231 | 1977.2877, 336.08
232 | 1977.3699, 336.76
233 | 1977.4548, 336.28
234 | 1977.5370, 334.93
235 | 1977.6219, 332.76
236 | 1977.7068, 331.60
237 | 1977.7890, 331.17
238 | 1977.8740, 332.41
239 | 1977.9562, 333.86
240 | 1978.0411, 334.98
241 | 1978.1260, 335.40
242 | 1978.2027, 336.65
243 | 1978.2877, 337.77
244 | 1978.3699, 338.02
245 | 1978.4548, 337.91
246 | 1978.5370, 336.55
247 | 1978.6219, 334.69
248 | 1978.7068, 332.77
249 | 1978.7890, 332.56
250 | 1978.8740, 333.93
251 | 1978.9562, 334.96
252 | 1979.0411, 336.24
253 | 1979.1260, 336.77
254 | 1979.2027, 337.97
255 | 1979.2877, 338.89
256 | 1979.3699, 339.48
257 | 1979.4548, 339.30
258 | 1979.5370, 337.74
259 | 1979.6219, 336.10
260 | 1979.7068, 333.93
261 | 1979.7890, 333.87
262 | 1979.8740, 335.30
263 | 1979.9562, 336.74
264 | 1980.0410, 338.03
265 | 1980.1257, 338.37
266 | 1980.2049, 340.09
267 | 1980.2896, 340.78
268 | 1980.3716, 341.48
269 | 1980.4563, 341.18
270 | 1980.5383, 339.57
271 | 1980.6230, 337.61
272 | 1980.7077, 335.90
273 | 1980.7896, 336.03
274 | 1980.8743, 337.12
275 | 1980.9563, 338.23
276 | 1981.0411, 339.25
277 | 1981.1260, 340.50
278 | 1981.2027, 341.40
279 | 1981.2877, 342.52
280 | 1981.3699, 342.93
281 | 1981.4548, 342.27
282 | 1981.5370, 340.50
283 | 1981.6219, 338.45
284 | 1981.7068, 336.71
285 | 1981.7890, 336.88
286 | 1981.8740, 338.38
287 | 1981.9562, 339.63
288 | 1982.0411, 340.77
289 | 1982.1260, 341.63
290 | 1982.2027, 342.72
291 | 1982.2877, 343.59
292 | 1982.3699, 344.16
293 | 1982.4548, 343.37
294 | 1982.5370, 342.07
295 | 1982.6219, 339.83
296 | 1982.7068, 338.00
297 | 1982.7890, 337.88
298 | 1982.8740, 339.28
299 | 1982.9562, 340.51
300 | 1983.0411, 341.39
301 | 1983.1260, 342.54
302 | 1983.2027, 343.12
303 | 1983.2877, 344.96
304 | 1983.3699, 345.78
305 | 1983.4548, 345.34
306 | 1983.5370, 344.00
307 | 1983.6219, 342.40
308 | 1983.7068, 339.88
309 | 1983.7890, 340.00
310 | 1983.8740, 341.16
311 | 1983.9562, 342.99
312 | 1984.0410, 343.82
313 | 1984.1257, 344.62
314 | 1984.2049, 345.39
315 | 1984.2896, 347.15
316 | 1984.3716, 347.52
317 | 1984.4563, 346.88
318 | 1984.5383, 345.47
319 | 1984.6230, 343.34
320 | 1984.7077, 341.13
321 | 1984.7896, 341.40
322 | 1984.8743, 343.02
323 | 1984.9563, 344.25
324 | 1985.0411, 344.99
325 | 1985.1260, 346.01
326 | 1985.2027, 347.43
327 | 1985.2877, 348.34
328 | 1985.3699, 348.92
329 | 1985.4548, 348.24
330 | 1985.5370, 346.54
331 | 1985.6219, 344.64
332 | 1985.7068, 343.06
333 | 1985.7890, 342.77
334 | 1985.8740, 344.21
335 | 1985.9562, 345.53
336 | 1986.0411, 346.28
337 | 1986.1260, 346.93
338 | 1986.2027, 347.83
339 | 1986.2877, 349.53
340 | 1986.3699, 350.19
341 | 1986.4548, 349.53
342 | 1986.5370, 347.92
343 | 1986.6219, 345.88
344 | 1986.7068, 344.83
345 | 1986.7890, 344.15
346 | 1986.8740, 345.64
347 | 1986.9562, 346.88
348 | 1987.0411, 348.00
349 | 1987.1260, 348.47
350 | 1987.2027, 349.40
351 | 1987.2877, 350.97
352 | 1987.3699, 351.84
353 | 1987.4548, 351.25
354 | 1987.5370, 349.50
355 | 1987.6219, 348.09
356 | 1987.7068, 346.44
357 | 1987.7890, 346.09
358 | 1987.8740, 347.54
359 | 1987.9562, 348.69
360 | 1988.0410, 350.16
361 | 1988.1257, 351.47
362 | 1988.2049, 351.96
363 | 1988.2896, 353.33
364 | 1988.3716, 353.97
365 | 1988.4563, 353.55
366 | 1988.5383, 352.14
367 | 1988.6230, 350.19
368 | 1988.7077, 348.50
369 | 1988.7896, 348.66
370 | 1988.8743, 349.85
371 | 1988.9563, 351.12
372 | 1989.0411, 352.55
373 | 1989.1260, 352.86
374 | 1989.2027, 353.48
375 | 1989.2877, 355.22
376 | 1989.3699, 355.47
377 | 1989.4548, 354.92
378 | 1989.5370, 353.70
379 | 1989.6219, 351.47
380 | 1989.7068, 349.61
381 | 1989.7890, 349.79
382 | 1989.8740, 351.10
383 | 1989.9562, 352.32
384 | 1990.0411, 353.46
385 | 1990.1260, 354.50
386 | 1990.2027, 355.19
387 | 1990.2877, 356.00
388 | 1990.3699, 356.96
389 | 1990.4548, 356.04
390 | 1990.5370, 354.62
391 | 1990.6219, 352.71
392 | 1990.7068, 350.77
393 | 1990.7890, 350.99
394 | 1990.8740, 352.64
395 | 1990.9562, 354.02
396 | 1991.0411, 354.53
397 | 1991.1260, 355.55
398 | 1991.2027, 356.96
399 | 1991.2877, 358.40
400 | 1991.3699, 359.14
401 | 1991.4548, 358.04
402 | 1991.5370, 355.98
403 | 1991.6219, 353.81
404 | 1991.7068, 351.95
405 | 1991.7890, 352.02
406 | 1991.8740, 353.55
407 | 1991.9562, 354.79
408 | 1992.0410, 355.79
409 | 1992.1257, 356.52
410 | 1992.2049, 357.61
411 | 1992.2896, 358.95
412 | 1992.3716, 359.46
413 | 1992.4563, 359.05
414 | 1992.5383, 356.82
415 | 1992.6230, 354.80
416 | 1992.7077, 352.81
417 | 1992.7896, 353.11
418 | 1992.8743, 353.96
419 | 1992.9563, 355.20
420 | 1993.0411, 356.50
421 | 1993.1260, 356.97
422 | 1993.2027, 358.18
423 | 1993.2877, 359.26
424 | 1993.3699, 360.08
425 | 1993.4548, 359.40
426 | 1993.5370, 357.38
427 | 1993.6219, 355.33
428 | 1993.7068, 353.50
429 | 1993.7890, 353.80
430 | 1993.8740, 355.14
431 | 1993.9562, 356.62
432 | 1994.0411, 358.19
433 | 1994.1260, 358.73
434 | 1994.2027, 359.79
435 | 1994.2877, 361.09
436 | 1994.3699, 361.52
437 | 1994.4548, 360.77
438 | 1994.5370, 359.38
439 | 1994.6219, 357.31
440 | 1994.7068, 355.68
441 | 1994.7890, 355.83
442 | 1994.8740, 357.42
443 | 1994.9562, 358.88
444 | 1995.0411, 359.81
445 | 1995.1260, 360.84
446 | 1995.2027, 361.48
447 | 1995.2877, 363.30
448 | 1995.3699, 363.64
449 | 1995.4548, 363.11
450 | 1995.5370, 361.75
451 | 1995.6219, 359.31
452 | 1995.7068, 357.91
453 | 1995.7890, 357.62
454 | 1995.8740, 359.42
455 | 1995.9562, 360.56
456 | 1996.0410, 361.91
457 | 1996.1257, 363.11
458 | 1996.2049, 363.89
459 | 1996.2896, 364.58
460 | 1996.3716, 365.29
461 | 1996.4563, 364.84
462 | 1996.5383, 363.52
463 | 1996.6230, 361.35
464 | 1996.7077, 359.32
465 | 1996.7896, 359.48
466 | 1996.8743, 360.64
467 | 1996.9563, 362.21
468 | 1997.0411, 363.06
469 | 1997.1260, 363.87
470 | 1997.2027, 364.44
471 | 1997.2877, 366.23
472 | 1997.3699, 366.68
473 | 1997.4548, 365.52
474 | 1997.5370, 364.36
475 | 1997.6219, 362.39
476 | 1997.7068, 360.08
477 | 1997.7890, 360.67
478 | 1997.8740, 362.32
479 | 1997.9562, 364.17
480 | 1998.0411, 365.22
481 | 1998.1260, 366.04
482 | 1998.2027, 367.20
483 | 1998.2877, 368.50
484 | 1998.3699, 369.19
485 | 1998.4548, 368.77
486 | 1998.5370, 367.53
487 | 1998.6219, 365.67
488 | 1998.7068, 363.80
489 | 1998.7890, 364.13
490 | 1998.8740, 365.36
491 | 1998.9562, 366.87
492 | 1999.0411, 368.05
493 | 1999.1260, 368.77
494 | 1999.2027, 369.49
495 | 1999.2877, 371.04
496 | 1999.3699, 370.90
497 | 1999.4548, 370.25
498 | 1999.5370, 369.17
499 | 1999.6219, 366.83
500 | 1999.7068, 364.54
501 | 1999.7890, 365.04
502 | 1999.8740, 366.58
503 | 1999.9562, 367.92
504 | 2000.0410, 369.05
505 | 2000.1257, 369.37
506 | 2000.2049, 370.42
507 | 2000.2896, 371.57
508 | 2000.3716, 371.74
509 | 2000.4563, 371.60
510 | 2000.5383, 370.02
511 | 2000.6230, 368.03
512 | 2000.7077, 366.53
513 | 2000.7896, 366.64
514 | 2000.8743, 368.20
515 | 2000.9563, 369.44
516 | 2001.0411, 370.20
517 | 2001.1260, 371.42
518 | 2001.2027, 372.04
519 | 2001.2877, 372.78
520 | 2001.3699, 373.94
521 | 2001.4548, 373.23
522 | 2001.5370, 371.54
523 | 2001.6219, 369.47
524 | 2001.7068, 367.88
525 | 2001.7890, 368.01
526 | 2001.8740, 369.60
527 | 2001.9562, 371.16
528 | 2002.0411, 372.36
529 | 2002.1260, 373.00
530 | 2002.2027, 373.44
531 | 2002.2877, 374.77
532 | 2002.3699, 375.48
533 | 2002.4548, 375.33
534 | 2002.5370, 373.95
535 | 2002.6219, 371.41
536 | 2002.7068, 370.63
537 | 2002.7890, 370.18
538 | 2002.8740, 372.01
539 | 2002.9562, 373.71
540 | 2003.0411, 374.61
541 | 2003.1260, 375.55
542 | 2003.2027, 376.04
543 | 2003.2877, 377.58
544 | 2003.3699, 378.28
545 | 2003.4548, 378.07
546 | 2003.5370, 376.54
547 | 2003.6219, 374.42
548 | 2003.7068, 372.92
549 | 2003.7890, 372.94
550 | 2003.8740, 374.29
551 | 2003.9562, 375.63
552 | 2004.0410, 376.73
553 | 2004.1257, 377.31
554 | 2004.2049, 378.33
555 | 2004.2896, 380.44
556 | 2004.3716, 380.56
557 | 2004.4563, 379.49
558 | 2004.5383, 377.71
559 | 2004.6230, 375.77
560 | 2004.7077, 373.99
561 | 2004.7896, 374.17
562 | 2004.8743, 375.79
563 | 2004.9563, 377.39
564 | 2005.0411, 378.29
565 | 2005.1260, 379.56
566 | 2005.2027, 380.06
567 | 2005.2877, 382.02
568 | 2005.3699, 382.21
569 | 2005.4548, 382.05
570 | 2005.5370, 380.63
571 | 2005.6219, 378.64
572 | 2005.7068, 376.38
573 | 2005.7890, 376.77
574 | 2005.8740, 378.27
575 | 2005.9562, 379.93
576 | 2006.0411, 381.33
577 | 2006.1260, 381.98
578 | 2006.2027, 382.53
579 | 2006.2877, 384.33
580 | 2006.3699, 384.89
581 | 2006.4548, 383.99
582 | 2006.5370, 382.25
583 | 2006.6219, 380.44
584 | 2006.7068, 378.77
585 | 2006.7890, 379.03
586 | 2006.8740, 380.11
587 | 2006.9562, 381.63
588 | 2007.0411, 382.55
589 | 2007.1260, 383.68
590 | 2007.2027, 384.31
591 | 2007.2877, 386.20
592 | 2007.3699, 386.38
593 | 2007.4548, 385.85
594 | 2007.5370, 384.42
595 | 2007.6219, 381.81
596 | 2007.7068, 380.83
597 | 2007.7890, 380.83
598 | 2007.8740, 382.32
599 | 2007.9562, 383.58
600 | 2008.0410, 385.04
601 | 2008.1257, 385.81
602 | 2008.2049, 385.80
603 | 2008.2896, 386.74
604 | 2008.3716, 388.49
605 | 2008.4563, 388.02
606 | 2008.5383, 386.22
607 | 2008.6230, 384.05
608 | 2008.7077, 383.05
609 | 2008.7896, 382.75
610 | 2008.8743, 383.98
611 | 2008.9563, 385.08
612 | 2009.0411, 386.63
613 | 2009.1260, 387.10
614 | 2009.2027, 388.50
615 | 2009.2877, 389.54
616 | 2009.3699, 390.15
617 | 2009.4548, 389.60
618 | 2009.5370, 388.05
619 | 2009.6219, 386.07
620 | 2009.7068, 384.64
621 | 2009.7890, 384.32
622 | 2009.8740, 386.05
623 | 2009.9562, 387.49
624 | 2010.0411, 388.55
625 | 2010.1260, 390.08
626 | 2010.2027, 391.02
627 | 2010.2877, 392.39
628 | 2010.3699, 393.24
629 | 2010.4548, 392.26
630 | 2010.5370, 390.35
631 | 2010.6219, 388.53
632 | 2010.7068, 386.85
633 | 2010.7890, 387.18
634 | 2010.8740, 388.69
635 | 2010.9562, 389.83
636 | 2011.0411, 391.33
637 | 2011.1260, 391.96
638 | 2011.2027, 392.49
639 | 2011.2877, 393.41
640 | 2011.3699, 394.33
641 | 2011.4548, 393.75
642 | 2011.5370, 392.64
643 | 2011.6219, 390.25
644 | 2011.7068, 389.05
645 | 2011.7890, 388.98
646 | 2011.8740, 390.30
647 | 2011.9562, 391.86
648 | 2012.0410, 393.13
649 | 2012.1257, 393.42
650 | 2012.2049, 394.43
651 | 2012.2896, 396.51
652 | 2012.3716, 396.96
653 | 2012.4563, 395.97
654 | 2012.5383, 394.60
655 | 2012.6230, 392.61
656 | 2012.7077, 391.20
657 | 2012.7896, 391.09
658 | 2012.8743, 393.03
659 | 2012.9563, 394.42
660 | 2013.0411, 395.69
661 | 2013.1260, 396.94
662 | 2013.2027, 397.35
663 | 2013.2877, 398.44
664 | 2013.3699, 400.06
665 | 2013.4548, 398.95
666 | 2013.5370, 397.45
667 | 2013.6219, 395.49
668 | 2013.7068, 393.48
669 | 2013.7890, 393.77
670 | 2013.8740, 395.27
671 | 2013.9562, 396.90
672 | 2014.0411, 398.01
673 | 2014.1260, 398.18
674 | 2014.2027, 399.56
675 | 2014.2877, 401.44
676 | 2014.3699, 401.99
677 | 2014.4548, 401.41
678 | 2014.5370, 399.17
679 | 2014.6219, 397.30
680 | 2014.7068, 395.49
681 | 2014.7890, 395.74
682 | 2014.8740, 397.32
683 | 2014.9562, 398.89
684 | 2015.0411, 399.94
685 | 2015.1260, 400.39
686 | 2015.2027, 401.60
687 | 2015.2877, 403.53
688 | 2015.3699, 404.04
689 | 2015.4548, 402.81
690 | 2015.5370, 401.54
691 | 2015.6219, 398.93
692 | 2015.7068, 397.43
693 | 2015.7890, 398.21
694 | 2015.8740, 400.17
695 | 2015.9562, 401.82
696 | 2016.0410, 402.58
697 | 2016.1257, 404.09
698 | 2016.2049, 404.79
699 | 2016.2896, 407.50
700 | 2016.3716, 407.59
701 | 2016.4563, 406.94
702 | 2016.5383, 404.43
703 | 2016.6230, 402.17
704 | 2016.7077, 400.94
705 | 2016.7896, 401.43
706 | 2016.8743, 403.57
707 | 2016.9563, 404.48
708 | 2017.0411, 406.00
709 | 2017.1260, 406.57
710 | 2017.2027, 406.99
711 | 2017.2877, 408.88
712 | 2017.3699, 409.84
713 | 2017.4548, 409.05
714 | 2017.5370, 407.13
715 | 2017.6219, 405.17
716 | 2017.7068, 403.20
717 | 2017.7890, 403.57
718 | 2017.8740, 405.10
719 | 2017.9562, 406.68
720 | 2018.0411, 407.98
721 | 2018.1260, 408.36
722 | 2018.2027, 409.21
723 | 2018.2877, 410.24
724 | 2018.3699, 411.23
725 | 2018.4548, 410.81
726 | 2018.5370, 408.83
727 | 2018.6219, 407.02
728 | 2018.7068, 405.52
729 | 2018.7890, 405.93
730 | 2018.8740, 408.04
731 | 2018.9562, 409.17
732 | 2019.0411, 410.85
733 | 2019.1260, 411.59
734 | 2019.2027, 411.91
735 | 2019.2877, 413.46
736 | 2019.3699, 414.76
737 | 2019.4548, 413.89
738 | 2019.5370, 411.78
739 | 2019.6219, 410.01
740 | 2019.7068, 408.48
741 | 2019.7890, 408.39
742 | 2019.8740, 410.16
743 | 2019.9562, 411.81
744 | 2020.0410, 413.30
745 | 2020.1257, 414.05
746 | 2020.2049, 414.45
747 | 2020.2896, 416.11
748 | 2020.3716, 417.15
749 | 2020.4563, 416.29
750 | 2020.5383, 414.42
751 | 2020.6230, 412.52
752 | 2020.7077, 411.18
753 | 2020.7896, 411.12
754 | 2020.8743, 412.88
755 | 2020.9563, 413.89
756 | 2021.0411, 415.15
757 | 2021.1260, 416.47
758 | 2021.2027, 417.16
759 | 2021.2877, 418.24
760 | 2021.3699, 418.95
761 | 2021.4548, 418.70
762 | 2021.5370, 416.65
763 | 2021.6219, 414.35
764 |
--------------------------------------------------------------------------------
/data/starbucks-menu-nutrition-drinks.csv:
--------------------------------------------------------------------------------
1 | ,Calories,Fat (g),Carb. (g),Fiber (g),Protein,Sodium
2 | Cool Lime Starbucks Refreshers™ Beverage,45,0,11,0,0,10
3 | Ombré Pink Drink,-,-,-,-,-,-
4 | Pink Drink,-,-,-,-,-,-
5 | Strawberry Acai Starbucks Refreshers™ Beverage,80,0,18,1,0,10
6 | Very Berry Hibiscus Starbucks Refreshers™ Beverage,60,0,14,1,0,10
7 | Violet Drink,-,-,-,-,-,-
8 | Evolution Fresh™ Cold-Pressed Apple Berry Juice,-,-,-,-,-,-
9 | Evolution Fresh™ Defense Up,-,-,-,-,-,-
10 | Evolution Fresh™ Organic Ginger Limeade,110,0,28,0,0,5
11 | Iced Coffee,0,0,0,0,0,0
12 | Iced Coffee with Milk,-,-,-,-,-,-
13 | Iced Espresso Classics - Vanilla Latte,130,2.5,21,0,5,65
14 | Iced Espresso Classics - Caffe Mocha,140,2.5,23,0,5,90
15 | Iced Espresso Classics - Caramel Macchiato,130,2.5,21,0,5,65
16 | Starbucks® Caramel Iced Coffee,-,-,-,-,-,-
17 | Starbucks® Iced Coffee + Milk,-,-,-,-,-,-
18 | Starbucks® Low Calorie Iced Coffee + Milk,-,-,-,-,-,-
19 | Starbucks® Vanilla Iced Coffee,-,-,-,-,-,-
20 | Shaken Sweet Tea,80,0,19,0,0,10
21 | Tazo® Bottled Berry Blossom White,60,0,15,0,0,10
22 | Tazo® Bottled Black Mango,150,0,38,0,0,15
23 | Tazo® Bottled Black with Lemon,140,0,35,0,0,10
24 | Tazo® Bottled Brambleberry,140,0,35,0,0,15
25 | Tazo® Bottled Giant Peach,150,0,37,0,0,15
26 | Tazo® Bottled Iced Passion,70,0,17,0,0,10
27 | Tazo® Bottled Lemon Ginger,120,0,31,0,0,10
28 | Tazo® Bottled Organic Black Lemonade,140,0,35,0,0,10
29 | Tazo® Bottled Organic Iced Black Tea,60,0,15,0,0,10
30 | Tazo® Bottled Organic Iced Green Tea,120,0,31,0,0,10
31 | Tazo® Bottled Plum Pomegranate,140,0,35,0,0,10
32 | Tazo® Bottled Tazoberry,150,0,38,0,0,15
33 | Tazo® Bottled White Cranberry,140,0,35,0,0,10
34 | Teavana® Shaken Iced Black Tea,30,0,8,0,0,5
35 | Teavana® Shaken Iced Black Tea Lemonade,70,0,17,0,0,0
36 | Teavana® Shaken Iced Green Tea,30,0,8,0,0,5
37 | Teavana® Shaken Iced Green Tea Lemonade,70,0,17,0,0,5
38 | Teavana® Shaken Iced Passion Tango™ Tea,30,0,8,0,0,5
39 | Teavana® Shaken Iced Passion Tango™ Tea Lemonade,90,0,24,0,0,0
40 | Teavana® Shaken Iced Peach Green Tea,60,0,15,0,0,0
41 | Iced Espresso Classics - Vanilla Latte,130,2.5,21,0,5,65
42 | Iced Espresso Classics - Caffe Mocha,140,2.5,23,0,5,90
43 | Iced Espresso Classics - Caramel Macchiato,130,2.5,21,0,5,65
44 | Iced Espresso Classics - Skinny Caramel Macchiato,-,-,-,-,-,-
45 | Iced Espresso Classics - Skinny Vanilla Latte,-,-,-,-,-,-
46 | Starbucks Doubleshot® Energy Coffee Drink,-,-,-,-,-,-
47 | Starbucks Doubleshot® Energy Mexican Mocha,-,-,-,-,-,-
48 | Starbucks Doubleshot® Energy Mocha Drink,-,-,-,-,-,-
49 | Starbucks Doubleshot® Energy Vanilla Drink,-,-,-,-,-,-
50 | Starbucks Doubleshot® Energy White Chocolate Drink,-,-,-,-,-,-
51 | Starbucks Doubleshot® Energy+Cinnamon Dolce Drink,-,-,-,-,-,-
52 | Starbucks Doubleshot® Espresso Cubano,-,-,-,-,-,-
53 | Starbucks Doubleshot® Espresso Drink,-,-,-,-,-,-
54 | Starbucks Doubleshot® Espresso Salted Caramel Cream,-,-,-,-,-,-
55 | Starbucks Doubleshot® Light Espresso Drink,-,-,-,-,-,-
56 | Starbucks Doubleshot® Protein Caramel,-,-,-,-,-,-
57 | Starbucks Refreshers™ Raspberry Pomegranate,90,0,27,0,0,0
58 | Starbucks Refreshers™ Strawberry Lemonade,90,0,27,0,0,0
59 | Starbucks® Bottled Caramel Frappuccino® Coffee Drink,-,-,-,-,-,-
60 | Starbucks® Bottled Coffee Frappuccino® Coffee Drink,-,-,-,-,-,-
61 | "Starbucks® Bottled Cold Brew Black, Unsweetened",-,-,-,-,-,-
62 | Starbucks® Bottled Cold Brew Cocoa and Honey with Cream,-,-,-,-,-,-
63 | Starbucks® Bottled Dulce de Leche Frappuccino® Coffee Drink,-,-,-,-,-,-
64 | Starbucks® Bottled Mocha Frappuccino® Coffee Drink,-,-,-,-,-,-
65 | Starbucks® Bottled Mocha Light Frappuccino® Coffee Drink,-,-,-,-,-,-
66 | Starbucks® Bottled S'mores Frappuccino® Coffee Drink,-,-,-,-,-,-
67 | Starbucks® Bottled Vanilla Frappuccino® Coffee Drink,-,-,-,-,-,-
68 | Starbucks® Bottled Vanilla Light Frappuccino® Coffee Drink,-,-,-,-,-,-
69 | Starbucks® Caramel Iced Coffee,-,-,-,-,-,-
70 | Starbucks® Doubleshot Protein Dark Chocolate,210,2.5,33,2,20,115
71 | Starbucks® Doubleshot Protein Vanilla,200,2.5,34,2,20,120
72 | Starbucks® Iced Coffee + Milk,-,-,-,-,-,-
73 | Starbucks® Iced Coffee Caramel,60,0,13,0,1,0
74 | Starbucks® Iced Coffee Light Sweetened,50,0,11,0,1,0
75 | Starbucks® Iced Coffee Unsweetened,10,0,2,0,1,0
76 | Starbucks® Low Calorie Iced Coffee + Milk,-,-,-,-,-,-
77 | Starbucks® Refreshers™ - Black Cherry Limeade with Coconut Water,-,-,-,-,-,-
78 | Starbucks® Vanilla Iced Coffee,-,-,-,-,-,-
79 | Tazo® Bottled Berry Blossom White,60,0,15,0,0,10
80 | Tazo® Bottled Black Mango,150,0,38,0,0,15
81 | Tazo® Bottled Black with Lemon,140,0,35,0,0,10
82 | Tazo® Bottled Brambleberry,140,0,35,0,0,15
83 | Tazo® Bottled Giant Peach,150,0,37,0,0,15
84 | Tazo® Bottled Iced Passion,70,0,17,0,0,10
85 | Tazo® Bottled Lemon Ginger,120,0,31,0,0,10
86 | Tazo® Bottled Organic Black Lemonade,140,0,35,0,0,10
87 | Tazo® Bottled Organic Iced Black Tea,60,0,15,0,0,10
88 | Tazo® Bottled Organic Iced Green Tea,120,0,31,0,0,10
89 | Tazo® Bottled Plum Pomegranate,140,0,35,0,0,10
90 | Tazo® Bottled Tazoberry,150,0,38,0,0,15
91 | Tazo® Bottled White Cranberry,140,0,35,0,0,10
92 | Teavana® Mango Black Tea,-,-,-,-,-,-
93 | Teavana® Passion Tango® Herbal Tea,-,-,-,-,-,-
94 | Teavana® Peach Green Tea,-,-,-,-,-,-
95 | White Chocolate Mocha Bottled Frappuccino,-,-,-,-,-,-
96 | Blonde Roast,5,0,0,0,1,10
97 | Caffè Misto,-,-,-,-,-,-
98 | Clover® Brewed Coffee,10,0,0,0,1,10
99 | Coffee Traveler,-,-,-,-,-,-
100 | Decaf Pike Place® Roast,5,0,0,0,1,10
101 | Featured Dark Roast,5,0,0,0,1,10
102 | Iced Coffee,5,0,0,0,0,5
103 | Iced Coffee with Milk,-,-,-,-,-,-
104 | Nariño 70 Cold Brew,5,0,0,0,0,15
105 | Nariño 70 Cold Brew with Milk,0,0,0,0,0,0
106 | Nitro Cold Brew,5,0,0,0,0,10
107 | Nitro Cold Brew with Sweet Cream,70,5,5,0,1,20
108 | Pike Place® Roast,5,0,0,0,1,10
109 | Toasted Coconut Cold Brew,-,-,-,-,-,-
110 | Vanilla Sweet Cream Cold Brew,110,6,14,0,1,25
111 | Hot Chocolate,320,9,47,4,14,160
112 | Starbucks® Signature Hot Chocolate,430,26,45,5,12,115
113 | Caffè Americano,-,-,-,-,-,-
114 | Caffè Latte,190,7,19,0,13,170
115 | Caffè Mocha,290,8,42,4,13,140
116 | Cappuccino,120,4,12,0,8,100
117 | Caramel Macchiato,250,7,35,0,10,150
118 | Cascara Coconutmilk Latte,-,-,-,-,-,-
119 | Cinnamon Dolce Latte,260,6,40,0,11,150
120 | Coconutmilk Mocha Macchiato,250,9,32,0,12,180
121 | Espresso,-,-,-,-,-,-
122 | Espresso Con Panna,-,-,-,-,-,-
123 | Espresso Macchiato,-,-,-,-,-,-
124 | Flat White,180,7,18,0,12,160
125 | Iced Caffè Americano,-,-,-,-,-,-
126 | Iced Caffè Latte,130,4.5,13,0,8,115
127 | Iced Caffè Mocha,230,6,36,4,9,90
128 | Iced Caramel Macchiato,250,7,37,0,10,150
129 | Iced Cascara Coconutmilk Latte,-,-,-,-,-,-
130 | Iced Cinnamon Dolce Latte,200,4,34,0,7,95
131 | Iced Coconutmilk Mocha Macchiato,260,9,34,0,11,180
132 | Iced Skinny Cinnamon Dolce Latte,-,-,-,-,-,-
133 | Iced Skinny Mocha,-,-,-,-,-,-
134 | Iced Vanilla Latte,190,4,30,0,7,100
135 | Iced White Chocolate Mocha,300,8,47,0,10,190
136 | Latte Macchiato,190,7,19,0,12,160
137 | Latte Macchiato,190,7,19,0,12,160
138 | Skinny Mocha,-,-,-,-,-,-
139 | Starbucks Doubleshot® on Ice Beverage,45,1,5,0,3,40
140 | Vanilla Latte,250,6,37,0,12,150
141 | White Chocolate Mocha,360,11,53,0,14,240
142 | Caffè Vanilla Frappuccino® Blended Coffee,-,-,-,-,-,-
143 | Caffè Vanilla Light Frappuccino® Blended Coffee,-,-,-,-,-,-
144 | Caramel Cocoa Cluster Frappuccino® Blended Coffee,-,-,-,-,-,-
145 | Caramel Frappuccino® Blended Coffee,-,-,-,-,-,-
146 | Caramel Light Frappuccino® Blended Coffee,-,-,-,-,-,-
147 | Chai Crème Frappuccino® Blended Crème,-,-,-,-,-,-
148 | Cinnamon Dolce Frappuccino® Blended Coffee,350,4.5,64,0,15,0
149 | Cinnamon Dolce Light Frappuccino® Blended Coffee,-,-,-,-,-,-
150 | Cinnamon Roll Frappuccino® Blended Coffee,-,-,-,-,-,-
151 | Coffee Frappuccino® Blended Coffee,-,-,-,-,-,-
152 | Coffee Light Frappuccino® Blended Coffee,110,0,24,0,3,200
153 | Cupcake Crème Frappuccino® Blended Crème,-,-,-,-,-,-
154 | Green Tea Crème Frappuccino® Blended Crème,-,-,-,-,-,-
155 | Java Chip Frappuccino® Blended Coffee,-,-,-,-,-,-
156 | Java Chip Light Frappuccino® Blended Coffee,-,-,-,-,-,-
157 | Lemon Bar Crème Frappuccino® Blended Crème,-,-,-,-,-,-
158 | Midnight Mint Mocha Frappuccino® Blended Coffee,-,-,-,-,-,-
159 | Midnight Mint Mocha Frappuccino® Blended Crème,-,-,-,-,-,-
160 | Mocha Frappuccino® Blended Coffee,280,2.5,60,2,4,220
161 | Mocha Light Frappuccino® Blended Coffee,140,0.5,28,1,4,180
162 | Oprah Cinnamon Chai Crème Frappuccino® Blended Crème,-,-,-,-,-,-
163 | Red Velvet Cake Crème Frappuccino® Blended Crème,-,-,-,-,-,-
164 | S'mores Frappuccino® Blended Coffee,-,-,-,-,-,-
165 | S'mores Frappuccino® Blended Crème,-,-,-,-,-,-
166 | Strawberries & Crème Frappuccino® Blended Crème,-,-,-,-,-,-
167 | The Pokémon™ GO Frappuccino® Blended Beverage,-,-,-,-,-,-
168 | Vanilla Bean Crème Frappuccino® Blended Crème,-,-,-,-,-,-
169 | White Chocolate Mocha Frappuccino® Blended Coffee,-,-,-,-,-,-
170 | Cinnamon Dolce Crème,200,6,28,0,10,135
171 | Organic Chocolate Milk Box,-,-,-,-,-,-
172 | Steamed Apple Juice,-,-,-,-,-,-
173 | Vanilla Crème,200,6,28,0,10,135
174 | Chocolate Smoothie,320,5,53,8,20,170
175 | Strawberry Smoothie,300,2,60,7,16,130
176 | Ginger Ale,-,-,-,-,-,-
177 | Lemon Ale,-,-,-,-,-,-
178 | Orange Cream Soda,-,-,-,-,-,-
179 |
--------------------------------------------------------------------------------
/environment.yml:
--------------------------------------------------------------------------------
1 | name: landlinear
2 | channels:
3 | - defaults
4 | - conda-forge
5 | dependencies:
6 | - python>=3.5
7 | - matplotlib>=2.0.2
8 | - numpy>=1.15.1
9 | - pandas>=0.20.3
10 | - sympy
11 | - jupyter
12 | - imageio
13 | - ipywidgets
14 |
--------------------------------------------------------------------------------
/images/PR-4pages.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineersCode/EngComp4_landlinear/a73c9e4fe2ad590118865354df82bb9cd10ba189/images/PR-4pages.png
--------------------------------------------------------------------------------
/images/beam.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineersCode/EngComp4_landlinear/a73c9e4fe2ad590118865354df82bb9cd10ba189/images/beam.png
--------------------------------------------------------------------------------
/images/comet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineersCode/EngComp4_landlinear/a73c9e4fe2ad590118865354df82bb9cd10ba189/images/comet.png
--------------------------------------------------------------------------------
/images/google-irreducible.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineersCode/EngComp4_landlinear/a73c9e4fe2ad590118865354df82bb9cd10ba189/images/google-irreducible.png
--------------------------------------------------------------------------------
/images/launched_ball.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineersCode/EngComp4_landlinear/a73c9e4fe2ad590118865354df82bb9cd10ba189/images/launched_ball.png
--------------------------------------------------------------------------------
/images/net_problem.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineersCode/EngComp4_landlinear/a73c9e4fe2ad590118865354df82bb9cd10ba189/images/net_problem.png
--------------------------------------------------------------------------------
/images/net_problem_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineersCode/EngComp4_landlinear/a73c9e4fe2ad590118865354df82bb9cd10ba189/images/net_problem_2.png
--------------------------------------------------------------------------------
/images/network.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineersCode/EngComp4_landlinear/a73c9e4fe2ad590118865354df82bb9cd10ba189/images/network.png
--------------------------------------------------------------------------------
/images/oscillator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineersCode/EngComp4_landlinear/a73c9e4fe2ad590118865354df82bb9cd10ba189/images/oscillator.png
--------------------------------------------------------------------------------
/images/rotation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineersCode/EngComp4_landlinear/a73c9e4fe2ad590118865354df82bb9cd10ba189/images/rotation.png
--------------------------------------------------------------------------------
/images/washington-monument.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineersCode/EngComp4_landlinear/a73c9e4fe2ad590118865354df82bb9cd10ba189/images/washington-monument.jpg
--------------------------------------------------------------------------------
/images/whatsavector.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/engineersCode/EngComp4_landlinear/a73c9e4fe2ad590118865354df82bb9cd10ba189/images/whatsavector.png
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | matplotlib>=2.0.2
2 | numpy>=1.15.1
3 | pandas>=0.20.3
4 | sympy
5 | jupyter
6 | imageio
7 | ipywidgets
8 |
--------------------------------------------------------------------------------
/scripts/plot_helper.py:
--------------------------------------------------------------------------------
1 | import numpy
2 | from numpy.linalg import inv, eig
3 | from math import ceil
4 | from matplotlib import pyplot, ticker, get_backend, rc
5 | from itertools import cycle
6 |
7 | # interactive backends
8 | INTERACTIVE_BACKENDS = ['GTK3Agg', 'GTK3Cairo', 'MacOSX', 'nbAgg',
9 | 'Qt4Agg', 'Qt4Cairo', 'Qt5Agg', 'Qt5Cairo',
10 | 'TkAgg', 'TkCairo', 'WebAgg', 'WX', 'WXAgg', 'WXCairo',
11 | 'module://ipympl.backend_nbagg', 'ipympl', 'widget']
12 |
13 | # reduce figure size when using an interactive backend
14 | def get_figure_scale():
15 | return 0.7 if get_backend() in INTERACTIVE_BACKENDS else 1
16 |
17 | grey = '#808080'
18 | gold = '#cab18c' # x-axis grid
19 | lightblue = '#0096d6' # y-axis grid
20 | green = '#008367' # x-axis basis vector
21 | red = '#E31937' # y-axis basis vector
22 | darkblue = '#004065'
23 |
24 | pink, yellow, orange, purple, brown = '#ef7b9d', '#fbd349', '#ffa500', '#a35cff', '#731d1d'
25 |
26 | quiver_params = {'angles': 'xy',
27 | 'scale_units': 'xy',
28 | 'scale': 1,
29 | 'width': 0.012}
30 |
31 | grid_params = {'linewidth': 0.5,
32 | 'alpha': 0.8}
33 |
34 | def set_rc(func):
35 | def wrapper(*args, **kwargs):
36 | fontsize = 4 if get_backend() in INTERACTIVE_BACKENDS else 5
37 | rc('font', family='serif', size=fontsize)
38 | rc('figure', dpi=200)
39 | rc('axes', axisbelow=True, titlesize=5)
40 | rc('lines', linewidth=1)
41 | func(*args, **kwargs)
42 | return wrapper
43 |
44 | @set_rc
45 | def plot_vector(vectors, tails=None):
46 | ''' Draw 2d vectors based on the values of the vectors and the position of their tails.
47 |
48 | Parameters
49 | ----------
50 | vectors : list.
51 | List of 2-element array-like structures, each represents a 2d vector.
52 |
53 | tails : list, optional.
54 | List of 2-element array-like structures, each represents the coordinates of the tail
55 | of the corresponding vector in vectors. If None (default), all tails are set at the
56 | origin (0,0). If len(tails) is 1, all tails are set at the same position. Otherwise,
57 | vectors and tails must have the same length.
58 |
59 | Examples
60 | --------
61 | >>> v = [(1, 3), (3, 3), (4, 6)]
62 | >>> plot_vector(v) # draw 3 vectors with their tails at origin
63 | >>> t = [numpy.array((2, 2))]
64 | >>> plot_vector(v, t) # draw 3 vectors with their tails at (2,2)
65 | >>> t = [[3, 2], [-1, -2], [3, 5]]
66 | >>> plot_vector(v, t) # draw 3 vectors with 3 different tails
67 |
68 | '''
69 | vectors = numpy.array(vectors)
70 | assert vectors.shape[1] == 2, "Each vector should have 2 elements."
71 | if tails is not None:
72 | tails = numpy.array(tails)
73 | assert tails.shape[1] == 2, "Each tail should have 2 elements."
74 | else:
75 | tails = numpy.zeros_like(vectors)
76 |
77 | # tile vectors or tails array if needed
78 | nvectors = vectors.shape[0]
79 | ntails = tails.shape[0]
80 | if nvectors == 1 and ntails > 1:
81 | vectors = numpy.tile(vectors, (ntails, 1))
82 | elif ntails == 1 and nvectors > 1:
83 | tails = numpy.tile(tails, (nvectors, 1))
84 | else:
85 | assert tails.shape == vectors.shape, "vectors and tail must have a same shape"
86 |
87 | # calculate xlimit & ylimit
88 | heads = tails + vectors
89 | limit = numpy.max(numpy.abs(numpy.hstack((tails, heads))))
90 | limit = numpy.ceil(limit * 1.2) # add some margins
91 |
92 | figsize = numpy.array([2,2]) * get_figure_scale()
93 | figure, axis = pyplot.subplots(figsize=figsize)
94 | axis.quiver(tails[:,0], tails[:,1], vectors[:,0], vectors[:,1], color=darkblue,
95 | angles='xy', scale_units='xy', scale=1)
96 | axis.set_xlim([-limit, limit])
97 | axis.set_ylim([-limit, limit])
98 | axis.set_aspect('equal')
99 |
100 | # if xticks and yticks of grid do not match, choose the finer one
101 | xticks = axis.get_xticks()
102 | yticks = axis.get_yticks()
103 | dx = xticks[1] - xticks[0]
104 | dy = yticks[1] - yticks[0]
105 | base = max(int(min(dx, dy)), 1) # grid interval is always an integer
106 | loc = ticker.MultipleLocator(base=base)
107 | axis.xaxis.set_major_locator(loc)
108 | axis.yaxis.set_major_locator(loc)
109 | axis.grid(True, **grid_params)
110 |
111 | # show x-y axis in the center, hide frames
112 | axis.spines['left'].set_position('center')
113 | axis.spines['bottom'].set_position('center')
114 | axis.spines['right'].set_color('none')
115 | axis.spines['top'].set_color('none')
116 |
117 |
118 | @set_rc
119 | def plot_transformation_helper(axis, matrix, *vectors, unit_vector=True, unit_circle=False, title=None):
120 | """ A helper function to plot the linear transformation defined by a 2x2 matrix.
121 |
122 | Parameters
123 | ----------
124 | axis : class matplotlib.axes.Axes.
125 | The axes to plot on.
126 |
127 | matrix : class numpy.ndarray.
128 | The 2x2 matrix to visualize.
129 |
130 | *vectors : class numpy.ndarray.
131 | The vector(s) to plot along with the linear transformation. Each array denotes a vector's
132 | coordinates before the transformation and must have a shape of (2,). Accept any number of vectors.
133 |
134 | unit_vector : bool, optional.
135 | Whether to plot unit vectors of the standard basis, default to True.
136 |
137 | unit_circle: bool, optional.
138 | Whether to plot unit circle, default to False.
139 |
140 | title: str, optional.
141 | Title of the plot.
142 |
143 | """
144 | assert matrix.shape == (2,2), "the input matrix must have a shape of (2,2)"
145 | grid_range = 20
146 | x = numpy.arange(-grid_range, grid_range+1)
147 | X_, Y_ = numpy.meshgrid(x,x)
148 | I = matrix[:,0]
149 | J = matrix[:,1]
150 | X = I[0]*X_ + J[0]*Y_
151 | Y = I[1]*X_ + J[1]*Y_
152 | origin = numpy.zeros(1)
153 |
154 | # draw grid lines
155 | for i in range(x.size):
156 | axis.plot(X[i,:], Y[i,:], c=gold, **grid_params)
157 | axis.plot(X[:,i], Y[:,i], c=lightblue, **grid_params)
158 |
159 | # draw (transformed) unit vectors
160 | if unit_vector:
161 | axis.quiver(origin, origin, [I[0]], [I[1]], color=green, **quiver_params)
162 | axis.quiver(origin, origin, [J[0]], [J[1]], color=red, **quiver_params)
163 |
164 | # draw optional vectors
165 | color_cycle = cycle([pink, darkblue, orange, purple, brown])
166 | if vectors:
167 | for vector in vectors:
168 | color = next(color_cycle)
169 | vector_ = matrix @ vector.reshape(-1,1)
170 | axis.quiver(origin, origin, [vector_[0]], [vector_[1]], color=color, **quiver_params)
171 |
172 | # draw optional unit circle
173 | if unit_circle:
174 | alpha = numpy.linspace(0, 2*numpy.pi, 41)
175 | circle = numpy.vstack((numpy.cos(alpha), numpy.sin(alpha)))
176 | circle_trans = matrix @ circle
177 | axis.plot(circle_trans[0], circle_trans[1], color=red, lw=0.8)
178 |
179 | # hide frames, set xlimit & ylimit, set title
180 | limit = 4
181 | axis.spines['left'].set_position('center')
182 | axis.spines['bottom'].set_position('center')
183 | axis.spines['left'].set_linewidth(0.3)
184 | axis.spines['bottom'].set_linewidth(0.3)
185 | axis.spines['right'].set_color('none')
186 | axis.spines['top'].set_color('none')
187 | axis.set_xlim([-limit, limit])
188 | axis.set_ylim([-limit, limit])
189 | if title is not None:
190 | axis.set_title(title)
191 |
192 | @set_rc
193 | def plot_linear_transformation(matrix, *vectors, unit_vector=True, unit_circle=False):
194 | """ Plot the linear transformation defined by a 2x2 matrix using the helper
195 | function plot_transformation_helper(). It will create 2 subplots to visualize some
196 | vectors before and after the transformation.
197 |
198 | Parameters
199 | ----------
200 | matrix : class numpy.ndarray.
201 | The 2x2 matrix to visualize.
202 |
203 | *vectors : class numpy.ndarray.
204 | The vector(s) to plot along with the linear transformation. Each array denotes a vector's
205 | coordinates before the transformation and must have a shape of (2,). Accept any number of vectors.
206 |
207 | unit_vector : bool, optional.
208 | Whether to plot unit vectors of the standard basis, default to True.
209 |
210 | unit_circle: bool, optional.
211 | Whether to plot unit circle, default to False.
212 |
213 | """
214 | figsize = numpy.array([4,2]) * get_figure_scale()
215 | figure, (axis1, axis2) = pyplot.subplots(1, 2, figsize=figsize)
216 | plot_transformation_helper(axis1, numpy.identity(2), *vectors, unit_vector=unit_vector, unit_circle=unit_circle, title='Before transformation')
217 | plot_transformation_helper(axis2, matrix, *vectors, unit_vector=unit_vector, unit_circle=unit_circle, title='After transformation')
218 |
219 |
220 | @set_rc
221 | def plot_linear_transformations(*matrices, unit_vector=True, unit_circle=False):
222 | """ Plot the linear transformation defined by a sequence of n 2x2 matrices using the helper
223 | function plot_transformation_helper(). It will create n+1 subplots to visualize some
224 | vectors before and after each transformation.
225 |
226 | Parameters
227 | ----------
228 | *matrices : class numpy.ndarray.
229 | The 2x2 matrices to visualize. Accept any number of matrices.
230 |
231 | unit_vector : bool, optional.
232 | Whether to plot unit vectors of the standard basis, default to True.
233 |
234 | unit_circle: bool, optional.
235 | Whether to plot unit circle, default to False.
236 |
237 | """
238 | nplots = len(matrices) + 1
239 | nx = 2
240 | ny = ceil(nplots/nx)
241 | figsize = numpy.array([2*nx, 2*ny]) * get_figure_scale()
242 | figure, axes = pyplot.subplots(nx, ny, figsize=figsize)
243 |
244 | for i in range(nplots): # fig_idx
245 | if i == 0:
246 | matrix_trans = numpy.identity(2)
247 | title = 'Before transformation'
248 | else:
249 | matrix_trans = matrices[i-1] @ matrix_trans
250 | if i == 1:
251 | title = 'After {} transformation'.format(i)
252 | else:
253 | title = 'After {} transformations'.format(i)
254 | plot_transformation_helper(axes[i//nx, i%nx], matrix_trans, unit_vector=unit_vector, unit_circle=unit_circle, title=title)
255 | # hide axes of the extra subplot (only when nplots is an odd number)
256 | if nx*ny > nplots:
257 | axes[-1,-1].axis('off')
258 |
259 |
260 |
261 | @set_rc
262 | def plot_3d_transformation_helper(axis, matrix, grid=True, unit_sphere=False, title=None):
263 | """ A helper function to plot the linear transformation defined by a 3x3 matrix.
264 |
265 | Parameters
266 | ----------
267 | axis : class matplotlib.axes.Axes.
268 | The axes to plot on.
269 |
270 | matrix : class numpy.ndarray.
271 | The 3x3 matrix to visualize.
272 |
273 | grid : bool, optional.
274 | Whether to plot 3d grid lines, default to True.
275 |
276 | unit_sphere : bool, optional.
277 | Whether to plot unit sphere, default to False.
278 |
279 | title : str, optional.
280 | Title of the plot.
281 |
282 | """
283 | assert matrix.shape == (3,3), "the input matrix must have a shape of (3,3)"
284 | xcolor, ycolor, zcolor = '#0084b6', '#d8a322', '#FF3333'
285 | linewidth = 0.7
286 | if grid:
287 | grid_range = 2
288 | x = numpy.arange(-grid_range, grid_range+1)
289 | X, Y, Z = numpy.meshgrid(x,x,x)
290 | X_new = matrix[0,0]*X + matrix[0,1]*Y + matrix[0,2]*Z
291 | Y_new = matrix[1,0]*X + matrix[1,1]*Y + matrix[1,2]*Z
292 | Z_new = matrix[2,0]*X + matrix[2,1]*Y + matrix[2,2]*Z
293 | for i in range(x.size):
294 | for j in range(x.size):
295 | axis.plot(X_new[:,i,j], Y_new[:,i,j], Z_new[:,i,j], color=xcolor, linewidth=linewidth)
296 | axis.plot(X_new[i,:,j], Y_new[i,:,j], Z_new[i,:,j], color=ycolor, linewidth=linewidth)
297 | axis.plot(X_new[i,j,:], Y_new[i,j,:], Z_new[i,j,:], color=zcolor, linewidth=linewidth)
298 |
299 | if unit_sphere:
300 | u = numpy.linspace(0, 2 * numpy.pi, 100)
301 | v = numpy.linspace(0, numpy.pi, 100)
302 | X = 1 * numpy.outer(numpy.cos(u), numpy.sin(v))
303 | Y = 1 * numpy.outer(numpy.sin(u), numpy.sin(v))
304 | Z = 1 * numpy.outer(numpy.ones(numpy.size(u)), numpy.cos(v))
305 | X_new = matrix[0,0]*X + matrix[0,1]*Y + matrix[0,2]*Z
306 | Y_new = matrix[1,0]*X + matrix[1,1]*Y + matrix[1,2]*Z
307 | Z_new = matrix[2,0]*X + matrix[2,1]*Y + matrix[2,2]*Z
308 | axis.plot_surface(X_new, Y_new, Z_new, rstride=4, cstride=4, linewidth=0, cmap='ocean', alpha=0.6)
309 |
310 | if title is not None:
311 | axis.set_title(title)
312 |
313 | limit = 0
314 | if grid or unit_sphere:
315 | for array in (X_new, Y_new, Z_new):
316 | limit_ = numpy.max(numpy.abs(array))
317 | limit = max(limit, limit_)
318 | else:
319 | limit = 1
320 | axis.set_xlim(-limit, limit)
321 | axis.set_ylim(-limit, limit)
322 | axis.set_zlim(-limit, limit)
323 | # adjust the whitespace between ticks and axes to get a tighter plot
324 | for axis_str in ['x', 'y', 'z']:
325 | axis.tick_params(axis=axis_str, pad=-3)
326 |
327 | @set_rc
328 | def plot_3d_linear_transformation(matrix, grid=True, unit_sphere=False):
329 | """ Plot the linear transformation defined by a 3x3 matrix using the helper
330 | function plot_3d_transformation_helper(). It will create 2 subplots to visualize some
331 | vectors before and after the transformation.
332 |
333 | Parameters
334 | ----------
335 | matrix : class numpy.ndarray.
336 | The 3x3 matrix to visualize.
337 |
338 | grid : bool, optional.
339 | Whether to plot 3d grid lines, default to True.
340 |
341 | unit_sphere : bool, optional.
342 | Whether to plot unit sphere, default to False.
343 |
344 | """
345 |
346 | figsize = numpy.array([4,2]) * get_figure_scale()
347 | figure = pyplot.figure(figsize=figsize)
348 | axis1 = figure.add_subplot(1, 2, 1, projection='3d')
349 | axis2 = figure.add_subplot(1, 2, 2, projection='3d')
350 | plot_3d_transformation_helper(axis1, numpy.identity(3), grid=grid, unit_sphere=unit_sphere, title='before transformation')
351 | plot_3d_transformation_helper(axis2, matrix, grid=grid, unit_sphere=unit_sphere, title='after transformation')
352 |
353 |
354 | @set_rc
355 | def plot_3d_linear_transformations(*matrices, grid=False, unit_sphere=False):
356 | """ Plot the linear transformation defined by a sequence of n 3x3 matrices using the helper
357 | function plot_3d_transformation_helper(). It will create n+1 subplots to visualize some
358 | vectors before and after each transformation.
359 |
360 | Parameters
361 | ----------
362 | *matrices : class numpy.ndarray.
363 | The 3x3 matrices to visualize. Accept any number of matrices.
364 |
365 | grid : bool, optional.
366 | Whether to plot 3d grid lines, default to False.
367 |
368 | unit_sphere : bool, optional.
369 | Whether to plot unit sphere, default to False.
370 |
371 | """
372 | nplots = len(matrices) + 1
373 | nx = 2 # number of figures per row
374 | ny = ceil(nplots/nx) # number of figures per column
375 | figsize = numpy.array([2*nx, 2*ny]) * get_figure_scale()
376 | figure = pyplot.figure(figsize=figsize)
377 |
378 | for i in range(nplots): # fig_idx
379 | axis = figure.add_subplot(ny, nx, i+1, projection='3d')
380 | if i == 0:
381 | matrix_trans = numpy.identity(3)
382 | title = 'Before transformation'
383 | else:
384 | matrix_trans = matrices[i-1] @ matrix_trans
385 | if i == 1:
386 | title = 'After {} transformation'.format(i)
387 | else:
388 | title = 'After {} transformations'.format(i)
389 | plot_3d_transformation_helper(axis, matrix_trans, grid=grid, unit_sphere=unit_sphere, title=title)
390 |
391 |
392 | @set_rc
393 | def plot_basis_helper(axis, I, J, *vectors, title=None, I_label='i', J_label='j'):
394 | """ A helper function to plot the 2D coordinate system determined by the basis I,J.
395 |
396 | Parameters
397 | ----------
398 | axis : class matplotlib.axes.Axes.
399 | The axes to plot on.
400 |
401 | I, J: class numpy.ndarray.
402 | The coordinates of the basis vector in the standard basis.
403 |
404 | *vectors : class numpy.ndarray.
405 | The vector(s) to plot along with the change of basis. Each array denotes a vector's
406 | coordinates in I-J coordinate system (not in the standard basis). Each vector must have
407 | a shape of (2,). Accept any number of vectors.
408 |
409 | I_label, J_label : str, optional.
410 | Label of the new basis, default to 'i' and 'j'.
411 |
412 | title: str, optional.
413 | Title of the plot.
414 |
415 | """
416 | grid_range = 20
417 | x = numpy.arange(-grid_range, grid_range+1)
418 | X_, Y_ = numpy.meshgrid(x,x) # grid coordinates on the new basis
419 | X = I[0]*X_ + J[0]*Y_ # grid coordinates on the standard basis
420 | Y = I[1]*X_ + J[1]*Y_
421 |
422 | # draw origin
423 | origin = numpy.zeros(1)
424 | axis.scatter(origin, origin, c='black', s=3)
425 |
426 | # draw grid lines of the new coordinate system
427 | lw_grid = 0.4
428 | for i in range(x.size):
429 | axis.plot(X[i,:], Y[i,:], c=grey, lw=lw_grid)
430 | axis.plot(X[:,i], Y[:,i], c=grey, lw=lw_grid)
431 |
432 | # highlight new axes (spines)
433 | lw_spine = 0.7
434 | zero_id = numpy.where(x==0)[0][0]
435 | axis.plot(X[zero_id,:], Y[zero_id,:], c=gold, lw=lw_spine)
436 | axis.plot(X[:,zero_id], Y[:,zero_id], c=lightblue, lw=lw_spine)
437 |
438 | # draw basis vectors using quiver plot
439 | axis.quiver(origin, origin, [I[0]], [I[1]], color=gold, **quiver_params)
440 | axis.quiver(origin, origin, [J[0]], [J[1]], color=lightblue, **quiver_params)
441 |
442 | # draw input vector on new coordinate system
443 | bound = 5
444 | if vectors:
445 | for vector in vectors:
446 | M = numpy.transpose(numpy.vstack((I,J)))
447 | vector = M @ vector.reshape(-1,1)
448 | axis.quiver(origin, origin, [vector[0]], [vector[1]], color=red, **quiver_params)
449 | bound = max(ceil(numpy.max(numpy.abs(vector))), bound)
450 |
451 | # hide frames, set xlimit & ylimit, set title
452 | axis.set_xlim([-bound, bound])
453 | axis.set_ylim([-bound, bound])
454 | axis.axis('off')
455 | if title is not None:
456 | axis.set_title(title)
457 |
458 | # add text next to new basis vectors
459 | text_params = {'ha': 'center', 'va': 'center', 'size' : 6}
460 | axis.text((I[0]-J[0])/2*1.1, (I[1]-J[1])/2*1.1, r'${}$'.format(I_label), color=gold, **text_params)
461 | axis.text((J[0]-I[0])/2*1.1, (J[1]-I[1])/2*1.1, r'${}$'.format(J_label), color=lightblue, **text_params)
462 |
463 | @set_rc
464 | def plot_basis(I, J, *vectors):
465 | """ Plot 2d vectors on the coordinates system defined by basis I and J using the helper funtion
466 | plot_basis_helper().
467 |
468 | Parameters
469 | ----------
470 | I, J: class numpy.ndarray.
471 | The coordinates of the basis vector in the standard basis.
472 |
473 | *vectors : class numpy.ndarray.
474 | The vector(s) to plot along with the change of basis. Each array denotes a vector's
475 | coordinates in I-J coordinate system (not in the standard basis). Each vector must have
476 | a shape of (2,). Accept any number of vectors.
477 |
478 | """
479 | figsize = numpy.array([2,2]) * get_figure_scale()
480 | figure, axis = pyplot.subplots(figsize=figsize)
481 | plot_basis_helper(axis, I, J, *vectors)
482 |
483 |
484 | @set_rc
485 | def plot_change_basis(I, J, *vectors):
486 | """ Create a side-by-side plot of some vectors both on the standard basis and on the new basis
487 | defined by I and J, using the helper function plot_basis_helper().
488 |
489 | Parameters
490 | ----------
491 | I, J: class numpy.ndarray.
492 | The coordinates of the basis vector in the standard basis.
493 |
494 | *vectors : class numpy.ndarray.
495 | The vector(s) to plot along with the change of basis. Each array denotes a vector's
496 | coordinates in I-J coordinate system (not in the standard basis). Each vector must have
497 | a shape of (2,). Accept any number of vectors.
498 |
499 | """
500 | figsize = numpy.array([4,2]) * get_figure_scale()
501 | figure, (axis1, axis2) = pyplot.subplots(1, 2, figsize=figsize)
502 | M = numpy.transpose(numpy.vstack((I,J)))
503 | M_inv = inv(M)
504 | vectors_ = [ M_inv @ vector.reshape(-1, 1) for vector in vectors ]
505 | plot_basis_helper(axis1, numpy.array([1,0]), numpy.array([0,1]), *vectors, title='standard basis')
506 | plot_basis_helper(axis2, I, J, *vectors_, title='new basis', I_label='a', J_label='b')
507 |
508 |
509 | @set_rc
510 | def plot_eigen(matrix):
511 | """ Visualize the eigendecomposition of a 2x2 matrix as a combination of changing basis
512 | and scaling transformation, using the helper function plot_basis_helper().
513 |
514 | Parameters
515 | ----------
516 | matrix : class numpy.ndarray.
517 | The 2x2 matrix to visualize.
518 |
519 | """
520 | figsize = numpy.array([4,4]) * get_figure_scale()
521 | figure, axes = pyplot.subplots(2, 2, figsize=figsize)
522 |
523 | eigenvalues, eigenvectors = eig(matrix)
524 | C = eigenvectors
525 | D = numpy.diag(eigenvalues)
526 | C_inv = inv(C)
527 |
528 | alpha = numpy.linspace(0, 2*numpy.pi, 41)
529 | circle = numpy.vstack((numpy.cos(alpha), numpy.sin(alpha)))
530 |
531 | plot_basis_helper(axes[0,0], numpy.array([1,0]), numpy.array([0,1]), title=r'coords in standard basis $\mathbf{x}$')
532 | plot_basis_helper(axes[0,1], C[:,0], C[:,1], title=r'change to new basis $C^{-1}\mathbf{x}$', I_label='a', J_label='b')
533 | plot_basis_helper(axes[1,0], C[:,0], C[:,1], title=r'scale along new basis $DC^{-1}\mathbf{x}$', I_label='a', J_label='b')
534 | plot_basis_helper(axes[1,1], numpy.array([1,0]), numpy.array([0,1]), title=r'change back to standard basis $CDC^{-1}\mathbf{x}$')
535 |
536 | circle_trans = matrix @ circle
537 | for axis in axes[0]:
538 | axis.plot(circle[0], circle[1], color=red, lw=0.8)
539 | for axis in axes[1]:
540 | axis.plot(circle_trans[0], circle_trans[1], color=red, lw=0.8)
541 |
542 |
543 |
544 | if __name__ == "__main__":
545 | pass
546 |
--------------------------------------------------------------------------------
/style/custom.css:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
134 |
150 |
--------------------------------------------------------------------------------