Go to the MLX, M, PDF, or HTML version of this file. Go back to fan’s MEconTools Package, Matlab Code Examples Repository (bookdown site), or Math for Econ with Matlab Repository (bookdown site).
We use log for log utility in our household maximization problems, and we use exponential functions with other bases for production functions.
See also: Exponential and Infinitely Compounding Interest Rate.
If the natural log of \(x\) is \(y\) (in economics we generally just write ln and log interchangeably, becareful though, google thinks function log means log with base 10, matlab thinks function log means base e, you will get different numbers typing in log(10) in google and matlab).
then
where e is Euler’s number. Intuitively, \(ln(x)\) is asking what exponent \(y\) of base \(e\) is needed for \(e^y\) to be equal to \(x\). When \(x\) is consumption, the log utility of consumption is in some sense the number of \(e\) terms needed to be multiplied together to equal to \(c\).
We can also write:
because of this:
since \(e^0 =1\), \(\log (1)=0\)
since \(e^1 \approx 2.71828\), \(\log (2.71828)\approx 1\)
The natural log is just the inverse of the exponential function. We use log to linearize exponential functions, which allows us to do regressions afterwards for example.
Suppose we have: \(\log \left(\frac{\exp (A+\epsilon )\cdot a^{\alpha } \cdot b^{\beta } }{c^{\theta } \cdot d^{\phi } }\right)\)
This looks complicated, but because there is log, we can take the equation apart:
\[\log \left(\frac{\exp (A+\epsilon )\cdot a^{\alpha } \cdot b^{\beta } }{c^{\theta } \cdot d^{\phi } }\right)=(A+\epsilon )+\alpha \cdot \log (a)+\beta \cdot \log (b)-\theta \cdot \log (c)-\phi \cdot \log (d)\]
Generally (:
\(\displaystyle \log (\exp (A))=A\)
\(\displaystyle \log (x^{\alpha } )=\alpha \cdot \log (x)\)
\(\displaystyle \log (x\cdot y)=\log (x)+\log (y)\)
\(\displaystyle \log (\frac{x}{y})=\log (x)-\log (y)\)
Why is the log of the product of two numbers the same as the sum of the log of each of the two numbers? Intuitively, because we can write \(x\cdot y\) as the exponential of a sum: when \(e^a \cdot e^b\), even though it’s multiplication, it is also just \(e^{a+b}\), the exponential of a sum.
We can write separately what each term equals to as:
\(\displaystyle \log (x\cdot y)=z\)
\(\displaystyle \log (x)=z_x\)
\(\displaystyle \log (y)=z_y\)
By definition, for each of the three terms above:
\(\displaystyle x\cdot y=\exp (z)\)
\(\displaystyle x=\exp (z_x )\)
\(\displaystyle y=\exp (z_y )\)
So:
Given that: \(e^a \cdot e^b =e^{a+b}\), and \(\log (\exp (x))=x\):
Hence:
Why is the log of an exponential term equal to the power times the log of the base of the exponential?
We start with:
Proceed:
\(\displaystyle \log (x^a )=z\)
\(\displaystyle x^a =e^z\)
\(\displaystyle x=e^{\frac{z}{a}}\)
\(\displaystyle \log (x)=\frac{z}{a}\)
\(\displaystyle a\cdot \log (x)=z\)
Suppose that growth rate is \(x\) percent per year, after 5 years, the gdp will be:
We can take log on both sides:
Which says that the difference in GDP between these two years divided by 5 is equal to the log of \(1\) plus the growth rate.
Approximately, for \(x\) small:
For example:
xVec = linspace(0,0.10,10);
log(1+ xVec)
ans = 1x10
0 0.0110 0.0220 0.0328 0.0435 0.0541 0.0645 0.0749 0.0852 0.0953
xVec
xVec = 1x10
0 0.0111 0.0222 0.0333 0.0444 0.0556 0.0667 0.0778 0.0889 0.1000
Note: This is a bad approximation if \(x\) is large. For example, we know that \(\ln (2.718)=\ln (1+1.718)\approx 1\) is almost exact. But the approximation here would have said \(\ln (1+1.718)\approx 1.718\), which is very incorrect.