GitHub

Original file line numberDiff line numberDiff line change

@@ -23,10 +23,6 @@ kernelspec:

2323
2424

# About Python

2525
26-

```{contents} Contents

27-

:depth: 2

28-

```

29-
3026

```{epigraph}

3127

"Python has gotten sufficiently weapons grade that we don’t descend into R

3228

anymore. Sorry, R people. I used to be one of you but we no longer descend

@@ -255,10 +251,8 @@ Its features include, among many other things:

255251

Here's some example code that generates and plots a random graph, with node color determined by the shortest path length from a central node.

256252
257253

```{code-cell} ipython

258-

%matplotlib inline

259254

import networkx as nx

260255

import matplotlib.pyplot as plt

261-

plt.rcParams['figure.figsize'] = (10,6)

262256

np.random.seed(1234)

263257
264258

# Generate a random graph

Original file line numberDiff line numberDiff line change

@@ -23,10 +23,6 @@ kernelspec:

2323

```{index} single: Debugging

2424

```

2525
26-

```{contents} Contents

27-

:depth: 2

28-

```

29-
3026

```{epigraph}

3127

"Debugging is twice as hard as writing the code in the first place.

3228

Therefore, if you write the code as cleverly as possible, you are, by definition,

@@ -61,10 +57,8 @@ Here we'll focus on Jupyter Notebook and leave you to explore other settings.

6157

We'll need the following imports

6258
6359

```{code-cell} ipython

64-

%matplotlib inline

6560

import numpy as np

6661

import matplotlib.pyplot as plt

67-

plt.rcParams['figure.figsize'] = (10,6)

6862

```

6963
7064

(debug_magic)=

Original file line numberDiff line numberDiff line change

@@ -23,10 +23,6 @@ kernelspec:

2323

```{index} single: Python; User-defined functions

2424

```

2525
26-

```{contents} Contents

27-

:depth: 2

28-

```

29-
3026

## Overview

3127
3228

Functions are an extremely useful construct provided by almost all programming.

Original file line numberDiff line numberDiff line change

@@ -18,6 +18,8 @@ kernelspec:

1818

</div>

1919

```

2020
21+

<!-- TODO: Review this styling -->

22+
2123

<style>

2224

.auto {

2325

width: 70%;

@@ -35,10 +37,6 @@ kernelspec:

3537

```{index} single: Python

3638

```

3739
38-

```{contents} Contents

39-

:depth: 2

40-

```

41-
4240

## Overview

4341
4442

In this lecture, you will learn how to

@@ -278,8 +276,6 @@ On that page, you'll see the following code

278276

```{code-cell} ipython

279277

import numpy as np

280278

import matplotlib.pyplot as plt

281-

%matplotlib inline

282-

plt.rcParams['figure.figsize'] = (10,6)

283279
284280

# Fixing random state for reproducibility

285281

np.random.seed(19680801)

Original file line numberDiff line numberDiff line change

@@ -23,10 +23,6 @@ kernelspec:

2323

```{index} single: Python; Matplotlib

2424

```

2525
26-

```{contents} Contents

27-

:depth: 2

28-

```

29-
3026

## Overview

3127
3228

We've already generated quite a few figures in these lectures using [Matplotlib](http://matplotlib.org/).

@@ -61,9 +57,7 @@ But first, let's discuss the difference.

6157

Here's the kind of easy example you might find in introductory treatments

6258
6359

```{code-cell} ipython

64-

%matplotlib inline

6560

import matplotlib.pyplot as plt

66-

plt.rcParams["figure.figsize"] = (10, 6) #set default figure size

6761

import numpy as np

6862
6963

x = np.linspace(0, 10, 200)

Original file line numberDiff line numberDiff line change

@@ -20,10 +20,6 @@ kernelspec:

2020
2121

# Python for Scientific Computing

2222
23-

```{contents} Contents

24-

:depth: 2

25-

```

26-
2723

```{epigraph}

2824

"We should forget about small efficiencies, say about 97% of the time:

2925

premature optimization is the root of all evil." -- Donald Knuth

@@ -379,7 +375,6 @@ Here's a plot of $f$

379375
380376

```{code-cell} ipython

381377

import matplotlib.pyplot as plt

382-

%matplotlib inline

383378

from mpl_toolkits.mplot3d.axes3d import Axes3D

384379

from matplotlib import cm

385380
Original file line numberDiff line numberDiff line change

@@ -22,10 +22,6 @@ kernelspec:

2222
2323

# Numba

2424
25-

```{contents} Contents

26-

:depth: 2

27-

```

28-
2925

In addition to what's in Anaconda, this lecture will need the following libraries:

3026
3127

```{code-cell} ipython3

@@ -40,11 +36,9 @@ versions are a {doc}`common source of errors <troubleshooting>`.

4036

Let's start with some imports:

4137
4238

```{code-cell} ipython3

43-

%matplotlib inline

4439

import numpy as np

4540

import quantecon as qe

4641

import matplotlib.pyplot as plt

47-

plt.rcParams['figure.figsize'] = (10,6)

4842

```

4943
5044

## Overview

Original file line numberDiff line numberDiff line change

@@ -23,10 +23,6 @@ kernelspec:

2323

```{index} single: Python; NumPy

2424

```

2525
26-

```{contents} Contents

27-

:depth: 2

28-

```

29-
3026

```{epigraph}

3127

"Let's be clear: the work of science has nothing whatever to do with consensus. Consensus is the business of politics. Science, on the contrary, requires only one investigator who happens to be right, which means that he or she has results that are verifiable by reference to the real world. In science consensus is irrelevant. What is relevant is reproducible results." -- Michael Crichton

3228

```

Original file line numberDiff line numberDiff line change

@@ -23,10 +23,6 @@ kernelspec:

2323

```{index} single: Python; Pandas

2424

```

2525
26-

```{contents} Contents

27-

:depth: 2

28-

```

29-
3026

In addition to what’s in Anaconda, this lecture will need the following libraries:

3127
3228

```{code-cell} ipython

@@ -69,11 +65,9 @@ Throughout the lecture, we will assume that the following imports have taken

6965

place

7066
7167

```{code-cell} ipython

72-

%matplotlib inline

7368

import pandas as pd

7469

import numpy as np

7570

import matplotlib.pyplot as plt

76-

plt.rcParams["figure.figsize"] = [10,8] # Set default figure size

7771

import requests

7872

```

7973
Original file line numberDiff line numberDiff line change

@@ -20,10 +20,6 @@ kernelspec:

2020
2121

# Parallelization

2222
23-

```{contents} Contents

24-

:depth: 2

25-

```

26-
2723

In addition to what's in Anaconda, this lecture will need the following libraries:

2824
2925

```{code-cell} ipython

@@ -61,11 +57,9 @@ In this lecture we discuss parallelization for scientific computing, with a focu

6157

Let's start with some imports:

6258
6359

```{code-cell} ipython

64-

%matplotlib inline

6560

import numpy as np

6661

import quantecon as qe

6762

import matplotlib.pyplot as plt

68-

plt.rcParams['figure.figsize'] = (10,6)

6963

```

7064
7165

## Types of Parallelization

Read the original on github.com ↗