@@ -767,36 +767,6 @@ This graph gives a big hint for why the condition $r > g$ is
767767necessary if a lease of length $T = +\infty$ is to have finite
768768value.
769769
770- For fans of 3-d graphs the same point comes through in the following
771- graph.
772-
773- If you aren't enamored of 3-d graphs, feel free to skip the next
774- visualization!
775-
776- ``` {code-cell} julia
777- # Second view
778- plt = plot(xlim = (-0.04, 1.1),ylim = (-0.04, 1.1), zlim = (0,15), title= "Three Period Lease PV with Varying g and r", xlabel = "r", ylabel = "g", zlabel = "Present Value, p0")
779-
780- T = 3
781- r = 0.01:0.005:0.985
782- g = 0.011:0.005:0.986
783-
784- # Construct meshgrid, similar to Numpy.meshgrid in Python
785- function meshgrid(r, g)
786- rr = [i for i in r, j in 1:length(g)]
787- gg = [j for i in 1:length(r), j in g]
788- return rr, gg
789- end
790-
791- rr, gg = meshgrid(r, g)
792- z = finite_lease_pv_true(T, gg, rr, x_0)
793-
794- # Removes points where undefined
795- z[rr .== gg] .= NaN
796-
797- plot!(r, g, z, st = :surface, colour = :balance, camera=(20,50))
798- ```
799-
800770We can use a little calculus to study how the present value $p_0$
801771of a lease varies with $r$ and $g$.
802772
@@ -816,21 +786,24 @@ After that, we'll use `Symbolics.jl` to compute derivatives
816786G = (1 + g)
817787R = (1 + r)
818788p0 = x0 / (1 - G * R ^ (-1))
819- print("Our formula is: $p0")
789+ print("Our formula is")
790+ p0
820791```
821792
822793``` {code-cell} julia
823794# Partial derivative with respect to g
824795dg = Differential(g)
825796dp_dg = expand_derivatives(dg(p0))
826- print("dp0 / dg is: ", dp_dg)
797+ print("dp0 / dg is")
798+ dp_dg
827799```
828800
829801``` {code-cell} julia
830802# Partial derivative with respect to r
831803dr = Differential(r)
832804dp_dr = expand_derivatives(dr(p0))
833- print("dp0 / dr is: ", dp_dr)
805+ print("dp0 / dr is")
806+ dp_dr
834807```
835808
836809We can see that for $\frac{\partial p_0}{\partial r}<0$ as long as
0 commit comments