From b73099951cd937855cede976f437161146c9bb97 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 3 Nov 2020 11:34:00 +1100 Subject: [PATCH 1/6] test control of output image size --- lectures/geom_series.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index 2501ed129..84eb7b997 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -803,6 +803,11 @@ represents our present value formula for an infinite lease. After that, we'll use SymPy to compute derivatives ```{code-cell} python3 +--- +render: + image: + width: 200px +--- # Creates algebraic symbols that can be used in an algebraic expression g, r, x0 = sym.symbols('g, r, x0') G = (1 + g) From d1567f6866583165880600e93994c92d22aa16c5 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 3 Nov 2020 13:21:16 +1100 Subject: [PATCH 2/6] use latex output for math --- lectures/geom_series.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index 84eb7b997..e0e026b50 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -803,17 +803,12 @@ represents our present value formula for an infinite lease. After that, we'll use SymPy to compute derivatives ```{code-cell} python3 ---- -render: - image: - width: 200px ---- # Creates algebraic symbols that can be used in an algebraic expression g, r, x0 = sym.symbols('g, r, x0') G = (1 + g) R = (1 + r) p0 = x0 / (1 - G * R**(-1)) -init_printing() +init_printing(use_latex=True) print('Our formula is:') p0 ``` From bb62e6b453df2223cb1ba86f93df289c0b147ef5 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 3 Nov 2020 17:44:49 +1100 Subject: [PATCH 3/6] see if latex function returns LaTeX mime type --- lectures/geom_series.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index e0e026b50..db7c061b3 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -53,7 +53,7 @@ import matplotlib.pyplot as plt %matplotlib inline import numpy as np import sympy as sym -from sympy import init_printing +from sympy import init_printing, latex from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D ``` @@ -808,9 +808,9 @@ g, r, x0 = sym.symbols('g, r, x0') G = (1 + g) R = (1 + r) p0 = x0 / (1 - G * R**(-1)) -init_printing(use_latex=True) +init_printing() print('Our formula is:') -p0 +latex(p0) ``` ```{code-cell} python3 From 3e5397eba80164e0b3ffa28cc45aaf0e3882c3ae Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 3 Nov 2020 18:34:11 +1100 Subject: [PATCH 4/6] show tex with mathjax --- lectures/geom_series.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index db7c061b3..9dc750b71 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -808,7 +808,7 @@ g, r, x0 = sym.symbols('g, r, x0') G = (1 + g) R = (1 + r) p0 = x0 / (1 - G * R**(-1)) -init_printing() +init_printing(use_latex='mathjax') print('Our formula is:') latex(p0) ``` From 188eb6dc0236580a0621ab76a4fc76de0b621884 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 3 Nov 2020 19:02:14 +1100 Subject: [PATCH 5/6] remove latex translation for first box --- lectures/geom_series.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index 9dc750b71..05232d17d 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -810,7 +810,7 @@ R = (1 + r) p0 = x0 / (1 - G * R**(-1)) init_printing(use_latex='mathjax') print('Our formula is:') -latex(p0) +p0 ``` ```{code-cell} python3 From d4fdc420f100b30160d597756c1297dd984d8111 Mon Sep 17 00:00:00 2001 From: mmcky Date: Fri, 5 Mar 2021 10:56:26 +1100 Subject: [PATCH 6/6] set default figure size --- lectures/geom_series.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lectures/geom_series.md b/lectures/geom_series.md index bbb3255fb..a3b0fa2d7 100644 --- a/lectures/geom_series.md +++ b/lectures/geom_series.md @@ -49,8 +49,9 @@ These and other applications prove the truth of the wise crack that Below we'll use the following imports: ```{code-cell} ipython -import matplotlib.pyplot as plt %matplotlib inline +import matplotlib.pyplot as plt +plt.rcParams["figure.figsize"] = (11, 5) #set default figure size import numpy as np import sympy as sym from sympy import init_printing, latex