CHAPTER 1
PRELIMINARY CONCEPTS
     
The three main topics studied in this book are the optimizing  techniques, linear economic  theory, and dynamic  economic  analysis.  However, it is difficult  to discuss these subjects before making certain concepts clear.  The definitions  and discussions in this chapter are a review of elementary  concepts in college  algebra or introductory calculus.  The chapter begins  with an introduction  to Mathematica and continues  with the number  system, sets, mathematical  relations, logarithms, and progressions. The economic  applications  require a knowledge of microeconomics and macroeconomics at the principles of economics  level.

TOOL BOX
Mathematica Commands		Function
Abs[n]					Absolute value of n
N[n]					Numerical value of n
Sqrt[n]				Square root of n
Solve[f(x)==0,x]				Solves equation  f(x) = 0 for x 
t={5, 3, 6, 8}				t is a list of data
t = {{5, 2} ,{1, 0}, {6, 8}, {7, 9}}		t is a list of paired observations on x & y
u = {a, b, c}				u is a set with elements  a, b, c
Random[ ]				uniformly distributed pseudorandom  in the range 0 to 1. 
Random[Integer,{a, b}]			generates a random integer  in the range from a to b. 
Union[u, v]				Finds union  of two sets u and v
Intersection[u, v]			Finds intersection of two sets u and v
Complement[u, v]			Finds complement  of two sets u and v
Log[b, n]				Finds log base b of n 
Table[i^2, {i, 0,5}]			Makes a table of values for i = 0 to 5
Sum[i^2, {i, 0, 5}]			Sums a table of values of (i^2) for i =0 to 5
 Out[n]					Value of the (n^th)output
 %					Value of the preceding output
/.					Replace or Evaluate 
%/. p->2				Evaluate the preceding output as p approaches  2
; 					at the end of command statements suppresses the output
I.   Command Structure of  Mathematica
Mathematica is a general computer software system and language  for mathematical  and other applications.  Mathematica has a wide range of applications in quantitative and logical analysis.  Its use in every area of science is growing fast.  In this book, we will use the numerical, symbolic, programming and graphical capabilities of Mathematica in solving some common quantitative business and economic problems.  The simplest way to use Mathematica is to use it like a calculator.  You type in inputs, Mathematica prints output.  However, the computation capabilities of Mathematica  are enormous.  In fact, it is the sophistication of the Mathematica that makes its use so simple.  Mathematica has a large number of built-in functions that can be combined with programming language and other features of Mathematica to perform some of the most advanced mathematical calculations with a few simple commands.  Following a few rules can save you a lot of time and frustrations.

Commands: All the commands in Mathematica start with a capital letter.  For example, "Solve", "Fit", and "Plot" are commands for solving equations, fitting equations to sets of data, and plotting functions, respectively.  For the convenience of the users, Mathematica commands on CDare hyperlinked to the Mathematica's description of the commands in the help section of the program.  For more information on the structure, formulation, and the arguments of the commands double click on the command names, wherever they appear in Magenta color.   As well, many calculus commands and operators can be copied from the "palettes" in the pull-down window of the "BasicInputs" or other pull down menus in palettes.  You can locate the palettes by clicking on the "File" in the toolbar.  For example, to find square root of 25 you may write the command as 
Sqrt[25]   
5
or you may use the "BasicInputs" menu of the palettes to copy the operator (Sqrt[□]) and fill in for the number "25" in the space provided.
(Sqrt[25])
5
In this book, I have used the two types of commands and operators alternately to expose the students to both methods.  Once you have established your own style and feel comfortable with, you may use the one that you prefer.

Variables: Except for few characters which are reserved for certain functions in Mathematica, any other character or combination of characters can be used as a variable name.  The reserved characters are used for commands or for some other purposes in Mathematica.   For example,  "D" is a command used for finding derivative of functions,  "N" is used for finding numerical values, and "E" is reserved for natural number.  These characters can not be used as variable names.  Also,  x and X are considered as two different variables in Mathematica.  That is, the lower case of a  letter and its capital count as two different variables.  Considering that the reserved characters in Mathematica are all capital letters and commands start with capital letters, it is highly advisable not to use capital letters for variable name.  In combining letters, be careful that xy counts as one variable "xy".  However, x y, that is, x space y, means multiplication of two variables, x*y.   

Brackets:  Brackets play an important role in command structure of Mathematica.  Four types of bracketing are used in Mathematica:  
1- Square brackets "[ ]": All the Mathematica commands are followed by a square bracket.  The argument of a command should be enveloped in square brackets.  As well, the arguments of functions should be enveloped in square brackets.  For example, to plot y = Sin x,  the Mathematica command is Plot[Sin[x]].  
2- Curly brackets "{ }" are used for enveloping lists.  For example, if the function y = Sin x is plotted for the range -10 to 10, the plot command is written as Plot[Sin[x], {x, -10, 10}].  
3- Parentheses are used for grouping of arithmetic and algebraic terms.  
4- Double square brackets are used for indexing.  For example, v[[i]] returns the value of the (i^th) element of a list.  

Running The Programs:  Run every program from the first line of the program command which starts with "Clear[   ]".  This command removes any values assigned to variables in the earlier programs or clears all definitions for functions.  To run the program click on the first line of the program to set the cursor and push the Shift and Enter keys of the keyboard together.  If a program doesn't run and returns an error messages, go back to the Clear command and re-run the program.  In some cases, especially in  some programs of difference and differential equations, the Kernel may print a list of error messages.   These messages may be too long or they may run through loops.  In such cases, click on the "Kernel" on the toolbar, click on the "Quit Kernel", and click on the "Local".  This will stop the Kernel from running.  Go back to the Clear[   ] command and run the program again.  You may have to change the Clear[  ] command to ClearAll[   ] to run the program.   

Five Tips To Avoid Frustration In Working With Mathematica:  
1- Always start the programs with the "Clear" command to clear the existing numerical values of the variables off the memory.
2- Never capitalize the variable names.  Mathematica reads x and X as two different variables.
3- Not every character is accepted as variable name.  Letters such as D, I, and C are reserved and can't be used as variable names.
4- Note that Mathematica reads xy as one variable.  If your intention is to multiply x by y, you should write it as x y (x space y) or x*y.
5- Learn the commands as your needs arise.  Most of the arithmetic and algebraic calculations can be done by knowing and combining few Mathematica commands.  Don't memorize the commands.  You always have access to "Help" pull-down window.  This window provides you with examples on the use of every Mathematica command.  You can copy the commands form the example and paste it to your own notebook.  

II.  The Number System and Numerical Calculations: The  N Command
The Number System: A number in general form can be written as a + bi,  where a and b are real numbers, b≠ 0, and i is the imaginary unit having the property i\(TraditionalForm\`\^2\) = -1.  A Number in this form is called a  complex number.  Furthermore, a is the real part of the number and bi is the imaginary part.  The following are some concepts and definitions in number systems:

Natural Numbers: A natural number is a whole number used in counting objects. Numbers such as 5, 2, and 10 are examples of natural numbers.  These numbers are also called positive integers.

Rational Numbers: A rational number is a ratio of two integers, positive or negative.  A rational number, often called a fraction, may qualify as integer, such as (9/3) = 3. Therefore, all integers are considered to be rational numbers, but not all rational numbers are integers. Zero is  considered a rational number.  

Irrational Numbers: Some numbers cannot be written as the ratio of two integers. Such numbers have infinite decimal expansions which are non-repeating.  For example (Sqrt[2]) = 1.41412...., Π = 3.1415...., and e = 2.718.....   Some fractions, like (1/6) = .1666, also have infinite decimal expansion. However, the difference between the  two types is that the decimal expansions for rational  numbers are  repeating, like  the  sequence of 6 in 1666.  Whereas, decimal expansions for irrational numbers are non-repeating.  

Real Numbers: Natural numbers, rational numbers, and irrational numbers taken together constitute the real number system.

Purely Imaginary Numbers: For the equation x2 + 1 = 0, or any equation in the form x2 + k = 0, where k > 0, there is no real number that will satisfy the equation.   Therefore, the solution of x2 + 1 = 0  is  x = + (Sqrt[-1]) = + i.  For x2 + k = 0, the solution is x = +i(Sqrt[k]).  + i and +i(Sqrt[k]) are purely imaginary numbers.

Complex Numbers: The real numbers and the imaginary numbers together form the complex number system.

Absolute Value of a Real Number:  The absolute value of a real number x, denoted by |x|, is equal to x if x > 0 and is equal to -x if x < 0.  The absolute value of a number shows the magnitude, but it does not indicate whether the number is positive or negative.

Numerical Calculations:  Arithmetic operations on numbers with Mathematica is very similar to doing arithmetic operations with a calculator.   Type the input to be evaluated using the same mathematical operators as in a calculator and press Shift and Enter keys together.

Example: Do the following arithmetic operations:  10 + (3^5),   (3^4), (236/12), (236/12) (result in decimal).
Solution:  
10  +  3*5
25
3^4
81
236/12
(59/3)
236. /12
19.666666666666668`
Note that by putting a "." in front of the number in numerator or denominator you are requesting the results in decimal form.
The order of the arithmetic operation in Mathematica is similar to that of a calculator.  It operates first on exponent  ( ^ ), then on division ( / ), followed by multiplication (*), and finally addition (+) and subtraction (-).   Anytime in doubt, it is highly advisable to use as many parentheses as needed, or as many parenthesis as you like to make the operation clear.  For example, a command such as 25^3/2 will raise 25 to the power of 3 and will divide the results by 2.   That is, the operation will be ((25^3)/2).  However, if the intention were to have 25 raised to the power (3/2), ((25^((3/2)))), the command should read as 25^(3/2).  

Example: Find the numerical value of  (Sqrt[(124/35)*(13/5) +  (45^((1/3)))]) .
Solution:
N[Sqrt[(124/35)*(13/5)  +  45^(1/3)]]
3.57327886903872`
or you may command as:
Sqrt[(124/35)*(13/5)  +  45^(1/3)] // N
3.57327886903872`
or you may command as:
N[(124/35 13/5  +  45^(1/3))^ .5]
3.57327886903872`
or using palettes, you may command as:
N[(Sqrt[(124/35) (13/5) + (45^((1/3)))])]
3.57327886903872`
Note that, to multiply two numbers, you may use "*" between the two numbers or you may leave a space between the two numbers.  In the operation above a space between (124/35) and (13/5) is used to multiply the two numbers.

Example:  For the imaginary unit i = (Sqrt[-1]), find the values of (2 + 3i)(2 - 3i), (2 + 3i)(3 + 4i), and (((2  +  3  i ))^8).
Solution:
(2  +  3  I)*(2  -  3  I)
13
(2  +  3  I)*(3  +  4  I)
-6 + 17 i
(2  +  3  I)^8
-239 + 28560 i

Example:  Find the numerical values of irrational numbers  Pi, E, and (Sqrt[2]) up to 30 digit of accuracy.
Solution:
N[Pi,  30]
3.1415926535897932384626433832795028841971694`30
N[E,  30]
2.7182818284590452353602874713526624977572471`30
N[Sqrt[2],  30]
1.4142135623730950488016887242096980785696718`30

Example:  Find the absolute values of 8, -8 and x.
Solution:
Abs[8]
8
Abs[-8]
8
Abs[x]
Abs[x]
Note that Abs[ ] will be left unevaluated if the expression in the square bracket is not a number.

Example:  Future Value (Compounding)  
Find the compounded value of $100 deposited at a rate of 6% for 5 years, if the interest is compounded annually, quarterly, monthly, and continuously.
Solution:  For a discrete compounding, the formula is S = A(((1  +  (r/n) ))^nt),  where S is the compounded value, A is the initial investment, r is the interest rate, n is the number of time the interest is compounded a year, and t is the number of years.  If the interest is compounded continuously, the compounding formula is S = A(e^rt).    
Annual Compounding:
N[100 (1 +  .06)^5]
133.82255776000005`
Quarterly Compounding:
N[100 (1 +  .06/4)^(4*5)]
134.68550065500523`
Monthly Compounding:
N[100 (1 +  .06/12)^(12*5)]
134.88501525493038`
Continuous Compounding:
N[100  E^( .06*5)]
134.98588075760028`

Future Value: General Formulation
You may formulate the problem in general form so that repeated calculations can be done by changing the parameters.  Using the palettes, formulate S = A(((1  +  (r/n) ))^nt),  with the parameters S, the compounded value, A the initial investment, r the interest rate, n the frequency with which the interest is compounded a year to be filled for given problem.  For the case of preceding problem A = 100, r = .06, n = 1, and t = 5, the problem can be solved as,
Clear[S, A, r, n, t]
A= 100 ; r= .06;n= 1;t= 5; 
S =  N[A (((1 + (r/n)))^(n t))]
133.82255776000005`

Do More Practice:
1- In the future value model above change the interest rate r to 7%, 8%, 9%, and 10%.  Run the program and record the corresponding values of S.  Graph the relationship between S and r on a graphing paper.  What is the relationship between the two variables.
2- Find the compounded value of $1000 deposited at an annual rate of 6%  after 10 years if:
a- the interest is compounded annually.
b- the interest is compounded quarterly.
c- the interest is compounded monthly.
d- the interest is compounded daily.
e- the interest is compounded continuously (you may select n as a very large number as, n = 10000).

Example: Present Value (Discounting)  
An investment is expected to have a return of $22000 at the end of the first year, $28500 at the end of the second year, $32000, at the end of the third year, $18000 at the end of the fourth year, and $12000 at the end of the fifth year.  At the end of the fifth year the business is expected to have a market value of $52000. What is the present value of the future returns if the interest rate is 6%?  what is the present value of the investment?
 Solution:  To find the present value of the expected future returns for the next n years, use the formula PV = (R1/(((1 +  r))^1))+ (R2/(((1 + r))^2))+ (R3/(((1 + r))^3))+  ...  ...   + (Rn/(((1 + r))^n)), where PV is the present value, Ri is the return in the (i^th) year, r is the rate of return or interest rate, and n is the number of years.  Therefore, PV = (22000/((1.06)))+ (28500/(1.06^2))+ (32000/(1.06^3))+ (18000/(1.06^4))+ (12000/(1, (06^5))) = 96212.20.  The present value of the investment, PVI is calculated by adding the present value of the scrap price of the investment to PV.  That is PVI = 96212.20 + (52000/(1.06^5)) = 135070.
Using Mathematica, the present value of the future returns is calculated as,
PV=N[22000/(1 +  .06) + 28500/(1 +  .06)^2 + 32000/(1 +  .06)^3 + 18000/(1 +  .06)^4 + 12000/(1 +  .06)^5]
96212.21659124861`
The present value of the investment (PVI) is calculated by adding the present value of the scrap value or the final value of the capital to the present value of the annual returns as,
PVI  =   N[
            22000/(1 +  .06)  +  28500/(1 +  .06)^2  +  
              32000/(1 +  .06)^3  +  18000/(1 +  .06)^4  +  
              12000/(1 +  .06)^5  +  52000/(1 +  .06)^5]
135069.64158028358`

Present Value: General Formulation
You may formulate the problem in general form so that repeated calculations can be done by changing the parameters.  Using the palettes, the formulation is done below, where PV is the present value, (Subscript[R, t]) is cash flow at time period t, and r is the discounting factor.  For the preceding problem, the formulation is,
Clear[PV,  R1, R2, R3, R4, R5, r]
R1=22000; 
R2=28500;
R3=32000; 
R4=18000;
R5=12000;
r=.06;
PV  =  
          (R1/(((1 + r))^1)) + (R2/(((1 + r))^2)) + (R3/(((1 + r))^3)) + 
            (R4/(((1 + r))^4)) + (R5/(((1 + r))^5))
96212.21659124861`

Do More Practice:
1-  Change the discount rate to 7%, 8%, 9%, and 10%.  Finf the PVs and record them. Graph the relation between discount rates and the PVs on a graphing paper.  What can you say about the relationship between the two variables?

Example:  Net Present Value
Net present value, NPV, is the difference between the value of the initial investment, Io and the present value of investment, PVI.  If NPV > 0, the investment is profitable.  If NPV < 0, the investment will have a loss.  Suppose an investment is expected to have returns of $22000, $28500, $32000, $18000, and $12000 at the end of each year for the next five years.  At the end of the fifth year, the business is expected to have a market value of  MV = $52000.  Given that the initial investment is $120000 what is the net present value of the investment, if the discount rate is 6%?
Solution:
Clear[NPV, Io,  MV,  R1, R2, R3, R4, R5, r]
Io=120000;
R1=22000; 
R2=28500;
R3=32000; 
R4=18000;
R5=12000;
MV = 52000;
r=.06;
PV = (R1/(((1 + r))^1))+(R2/(((1 + r))^2))+(R3/(((1 + r))^3))+(R4/(((1 + r))^4))+(R5/(((1 + r))^5))+(MV/(((1 + r))^5))-Io
15069.641580283584`

Do More Practice:
1-  Change the discount rate to 7%, 8%, 9%, and 10%.  Find the NPVs and record them.  What discount rate makes the business to break even (NPV = 0)?
2-  Keep discount rate as it is (6%).  Increase Io by factor $5000 each time.  Find NPVs and record them.  At what value of Io the business breaks even? 

Example:  Perpetuities
A Perpetuity is a security that yields a stream of annual payments at an annual rate of r forever.  The value of the perpetuities are decided by the sum of the present value of the stream of payments for an infinite number of years.  That is, PV = \(TraditionalForm\`∑\+\(t = 1\)\%∞ R\/\((1 + \ r)\)\^t\) where, R is the annual payments and r is the discount factor.   Suppose a perpetuity yields annual payments of $1 forever.  What is the present value of the perpetuity if discount rate is 5%?
To formulate the problem you may use the Sum command or you may use palettes for summation operator "\(TraditionalForm\`∑\+\(□ = □\)\%□ □\)"  and fill in the information at the proper spaces.  With the sum command the problem is formulated as,		
Clear[R,  t, r, PV]
r=.05; R=1;
PV = Sum[1/(1 + r)^t,  {t,  1,  Infinity}]
19.999999999999975`
Using palettes the problem is formulated as,
Clear[t, i, r, pv]
r=.05; R= 1;
PV = (∑_(t = 1)^Infinity) (R/(((1 + r))^t))
19.999999999999975`

Do More Practice:
1-  Change the discount rate to 10%, 15%, and 20%.  Find the PVs and record them.  What is the relationship between discount rates and PVs?
2-  Keep R = 1 and change the maturity date from Infinity to 1 year, 10 years, 20 years, and 50 years and find the corresponding values of PVs.  What is the relationship between the PVs and the extent of the maturity?

Example: Production Function  
Production function is a technical relation between inputs and output.  One of the very well-established production functions in economic literature is Cobb-Douglas production function.  Cobb-Douglas production function is expressed as Q = A (L^α)(K^β) where, A represents the state of the technology, L is labor input, K is capital input, Q is output, and α and β are the shares of labor and capital inputs from the output, respectively (for more information on the properties of this function see, for example, Nicholson (1998)).  Suppose the relationship between labor input (L), capital input (K) and output (Q) is given as Q = 100\(TraditionalForm\`L\^ .75\)\(TraditionalForm\`K\^ .25\).  Find the output level for a labor input of 50 units and capital input of 25 units.
Solution:  This function which shows the physical relationship between labor input, capital input, and output is called Cobb-Douglas production function.  For the given levels of inputs, the output is Q = 100(((50))^(. 75))(((25))^(. 25)) = 4204.48.  
Using Mathematica, the output can be evaluated by substituting for L and K in the function as,
Q  =  100 (50)^ .75 (25)^ .25
4204.482076268573`

Cobb-Douglas Production Function:  General Formulation 
You may formulate the problem in general form as,
Clear[Q,  A,  L,  K,  α,  β]
A = 100; L = 50; K = 25; α=.75; β= .25;
Q = N[A (L^α) (K^β)]
4204.482076268573`

Do More Practice:
1- In the example above double, triple, and quadruple the inputs and write the corresponding values of the outputs.  What is the effect of proportional change in inputs on output?  What type of return to scale exists in this production function? (Note that, in this problem α + β = 1).
2-  Change the α and β coefficients to α = 1 and β = .50, where α + β > 1.  Run the production function model with the initial values of labor and capital and record the output.  Run the model by doubling, tripling, and quadrupling the inputs.  What happens to the corresponding outputs?  What is the effect of a change in scale of operation in this case?  What is the economic name of the returns to scale in this case?

Problems:
1- Find the numerical value of  ((((((2/3)  +  (Sqrt[2])))^5) -  
            (4/5))^(1/3))  
2- Find the numerical value of  8 ((((((29/23) ))^2)   +  
            25)^(1/( 3)))  
3- Find the numerical value of \(TraditionalForm\`\@\(2\/3\)\%3\/\@\(5 \((3\/3)\)\^2\)\%5\) 
4- What is the compounded value of $100 invested at a rate of 8% for five years, if the interest is compounded biannually?  Change the interest rate to 16% and redo the problem.  What is the effect of doubling of interest rate on the compounded value?
5- In the present value problem of the text with the stream of revenues given as: R1=22000; R2=28500; R3=32000; R4=18000; R5=12000; and discount factor of r =6% find the present value.  change the interest rate to 12% and find the present value.  What is the effect of doubling of discount rate on present value?   
6- In the Cobb-Douglas production function Q = A (L^α)(K^β) let A = L = K = 1.  Find the value of Q.
a- Let  α = .8 and β = .2, where α + β = 1.  Find Q.  Now, double, triple, and quadruple inputs and find Q.  How does proportional changes in inputs change output?
b-  Let α = .9 and β = .7, where α + β > 1.  Now, double, triple, and quadruple inputs and find Q.  How does proportional changes in inputs change output?
c-  Let α = .5 and β = .2, where α + β < 1.  Find  Q.  Now, double, triple, and quadruple inputs and find Q.  How does proportional changes in inputs change output?

III. Sets:  The Complement, Union, and Intersection Commands 
A set is a collection of well-defined, distinguishable objects.  A set is usually denoted by a curly bracket.   It may contain a finite number of elements, such as S = {a, m, c, p} and T = {10, 2, 13, 4, 9} or it may contain an infinite number of elements, such as the set N of natural numbers  T = {1, 2, 3,........}.  If b is an element of set S, then we write b ∈ S.  If b is not an element of S, then we write b ∉ S. 

Subset of a Set: If every element of set S is also an element of set T, but S ≠ T,  we say that  S is contained in T or S is a subset of T.  We then write S ⊂ T.  .  For example, if S = {b, c, d} and T = {a,b,c,d}, then S ⊂ T.

Universal Sets: If all sets under consideration are subsets of a set U, then U is called the universal set.  For example, a deck of playing cards is a universal set.  A set containing four aces or a set containing four jacks are subsets of universal set.

The Complement of a Set:  Let S be a subset of a universal set U. The set of elements which belongs to U but not to S is called the complement of S and is denoted by S'.  For example, for a deck of playing cards which contains faces and numbers, a set containing faces is the complement of a set containing numbers.

Example:  Let S = {a, b, c} and T = {a, c, d} be subsets of the universal set U = {a, b, c, d, e}.  Find S' and T'.  
Solution: By the definition of the complement sets above, S' = {d, e} and T' = {b, e}.
Clear[u,  s,  t]
u = {a, b, c, d, e};
s  =  { a, b, c};
t  =  { a,  c, d};
Complement [u, s] 

{d, e}
Complement [u, t]

{b, e}

Example:  Let S be a set of 5 random drawings and T be a set of 10 random drawings of numbers between 0 and 9.    Find S' and T'.  
Solution: The universal set is U = {0, 1, 2, ....., 9}.  S and T can be generated by drawing 5 and 10 random observation from a bag containing the numbers 0 through 9 or by a program that generates random numbers.  Here, we use Mathematica to generate those numbers  Using Mathematica, U = Table[x, {x, 0, 9}] generates a set of numbers from 0 to 9, S = Table[Random[Integer, {0, 9}], {5}] generates a set of 5  random numbers in the range 0 to 9 and T=Table[Random[Integer, {0, 9}], {10}] generates a set of 10 random numbers in the range 0 to 9.
Clear[x,  U, S, T]
U  =  Table[x,  {x,  0,  9}]
S =  Table[Random[Integer,  {0,  9}],  {5}]
T = Table[Random[Integer,  {0,  9}],  {10}]
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
{0, 0, 9, 6, 1}
{8, 7, 9, 8, 8, 4, 9, 6, 0, 2}
The following commands find the complement of S and T.
S' = Complement[U, S]
{2, 3, 4, 5, 7, 8}
T' = Complement[U, T]
{1, 3, 5}

Do More Practice:
Let U be the univesal set of two digit numbers.  Let S,  T, and W be random subsets of u each containing 80, 90, and 100 random picks.  Find the complements of S, T, and W.  How many elements each subset contains?

Null Set: If a set contains no elements it is called an empty set and is denoted by 0.

Equality of Sets: Two sets are equal if and only if they contain the same elements.  If set S is equal to set T, we write S = T, otherwise we write S ≠ T.

Example:  Let S = {1, 2, 3}, T = {3, 1, 2} and V = {3, 3, 2}.  Then, S = T, S ≠ V, and  T ≠ V.

Union of  Two Sets: The union of two sets S and T, written S ⋃ T, is the set of all elements which are members of S or T.  

Example:  Let s = {1, 3, 5} and  t = {7, 3, 1, 2}.  Find s ⋃ t.  
Solution:  Union of two sets s and t is, s ⋃ t = {1, 2, 3, 5, 7}.
Clear[s,  t]
s = {1, 3, 5};
t = {7, 3, 1, 2};
Union [ s, t]
{1, 2, 3, 5, 7}

Example:  Let S be a set of 5 random drawings and T be a set of 7 random drawings of numbers between 0 and 9.    Find S ⋃ T.  
Solution:  S and T can be generated by drawing 5 and 7 random observation from a bag containing the numbers 0 through 9 or by a program that generates random numbers.  Here, we use Mathematica to generate those numbers  Using Mathematica, S = Table[Random[Integer, {0, 9}], {5}] generates a set of 5  random numbers in the range 0 to 9 and T=Table[Random[Integer, {0, 9}], {7}] generates a set of 7 random numbers in the range 0 to 9.  The command Union[S, T] finds the union of the two sets.
Clear[S, T]
S =  Table[Random[Integer,  {0,  9}],  {5}];
T = Table[Random[Integer,  {0,  9}],  {7}];
Union[S, T]
{0, 2, 4, 6, 7, 8, 9}

Do More Practice:
Let u be the univesal set of two digit numbers.  Let S,  T, and W be random subsets of U each containing 80, 90, and 100 random picks.  Find S ⋃ T,  S ⋃ W, and T ⋃ W.  Find (S ⋃ T) ⋃ W.  Is this set equal to u?

Intersection of Two Sets:  The intersection of two sets S and T, written S ⋂ T, is the set of all elements which are members of both S and T. 

Example:  Let s = {1, 3, 5} and t = {7, 3, 1, 2}.  Find s ⋂ t.
Solution:  Intersection of two sets s and t is, s ⋂ t = {1, 3}
Clear[s,  t]
s = {1, 3, 5};
t = {7, 3, 1, 2};
Intersection [s, t]
{1, 3}

Example:  Let S and T be two sets of 10 random drawings of numbers between 0 and 9.    Find S ⋂ T.  
Solution:  S and T can be generated by drawing 10 random observations from each set from a bag containing the numbers 0 through 9 or by a program that generates random numbers.  Here, we use Mathematica to generate those numbers  Using Mathematica, S = Table[Random[Integer, {0, 9}], {10}] generates a set of 10  random numbers in the range 0 to 9 for S and T=Table[Random[Integer, {0, 9}], {10}] generates a set of 10 random numbers in the range 0 to 9 for T.  The command Intersection[S, T] finds the intersection of the two sets.
C  lear[S, T]
S =  Table[Random[Integer,  {0,  9}],  {10}];
T = Table[Random[Integer,  {0,  9}],  {10}];
Intersection[S, T]
{0, 1, 3, 5, 6}

Do More Practice:
Let u be the univesal set of two digit numbers.  Let S,  T, and W be random subsets of u each containing 80, 90, and 100 random picks.  Find S ⋂ T,  S ⋂ W, and T ⋂ W.  Find (S ⋂ T) ⋂ W. 

Disjoint Sets:    Sets  S  and  T  are called disjoint if S ⋂ T = 0.  That is , the sets do not have any common elements.  

Example:  Two sets s = {set of all odd numbers 1, 3, 5, ....} and t = {set of all even numbers 2, 4, 6, ....} are disjoint and s  ⋂ t = 0.
Solution:  The two sets have no common elements.  Therefore, s  ⋂ t = 0. 
Clear[s,  t]
s = { 1, 3, 5};
t = { 2, 4, 6};
Intersection [s, t]
{}

Do More Practice:
Let T be the univesal set of one digit numbersand S be the universal set of two digit numbers.  Show that the two sets are disjoint sets.

The theory of sets, founded by the German mathematician George Cantor, is an important branch of mathematics and is a very useful tool in probability theory or in analyzing economic issues, especially in the area of consumer theory and choice.  The algebra of sets is very similar to, but not identical with, the algebra of the real numbers. The following relationships compare the algebra of sets to the algebra of real numbers.
                        
                                        	Algebra of Sets               Algebra of Real Numbers
1-Commutative Laws:  	 S ⋃ T = T ⋃ S                                S + T = T + S   
                                    	 S ⋂ T = T ⋂ S                               S x T = T x S

2-Associative Laws:    	S⋃(T⋃R)=(S⋃T)⋃R                  S+(T+R)=(S+T)+R
                                      	S⋂(T⋂R)=(S⋂T)⋂R                   Sx(TxR)=(SxT)xR

3-Distributive Laws:     	S⋂(T⋃R)=(S⋂T)⋃(S⋂R)           Sx(T+R)=(SxT)+(SxR)
                                       	S⋃(T⋂R)=(S⋃T)⋂(S⋃R)          S+(TxR) ≠ (S+T)x(S+R)

Furthermore, it should be noted that, although commutative laws hold for union and intersection, they do not hold in general for set differencing. If S and T are two sets, S - T and T - S are not in general equal. Also, set differencing is not associative; i.e., S - (T - R) is not in general equal to (S - T) + R.

Example:   If S = {2, 3, 5, 7} and T = {3, 4, 5, 6, 7, 8},  S - T = {2}, whereas T - S = {4, 6, 8}.   Therefore,  S - T ≠ T - S.

Example:   Let S = {3, 2, 5, 6}, T = {1, 2, 3, 4}, and R = {2, 5, 1, 4}.  Find S - T, T - S, S - (T - R), and (S - T) + R.
Solution:  S - T = {5, 6}  and  T - S = {1, 4}.  Therefore,   S - T ≠ T - S.   
                  S - (T - R) = {2, 5, 6}  and  (S - T) + R = {2, 5, 6, 1, 4},  therefore, S - (T - R) ≠ (S - T) + R. 

Do More Practice:
Let U be the univesal set of two digit numbers.  Let S and T be a random subset of U each containing 10 random picks.
1- Find the complements of S and T.
2- Find intersection of S and T.
3- Find the union of S and T.
4- Run your program from the first line several times.  Do you come with the same solutions each time?

Problems: 
1.  Let S = {3, 4, 5}, T = {6, 7, 8}, V = {5, 4, 3}, and  Z = {3, 2, 5, 6, 9, 1}.  Which of the following statements  are  true?
       a) S = T		e) S ⊂ T		i) S ⋃ V = S
       b) S = V		f) V ⊂ T		j) S ⋃ V ⋃ T = Z
       c) 4 ∈ S		g) V ⊂ Z		k) S ⋂ T = 0
       d) 6 ∈ S		h) S ⋃ T = Z		l) 2 ∈ S ⋂ Z			
    2.  Let S = {1, 2, 3, 4, 5, 6, 7, 8, 9}.  List the elements of  the following subsets of S.
       a) {x:   x is odd}        c) {x:  x is greater than 5}
       b) {x:   x is even}       d) {x:  x is less than 10}
3.  Given S = {1, 2, 3, 4, 5}, T = {2, 3, 5, 6}, and V = {1, 2, 4, 6, 7}, verify that
       a) S ⋂ (T ⋃ V) = (S ⋂ T) ⋃ (S ⋂ V)
       b) S ⋂ (T⋂ V) ≠ (S ⋃ T) ⋂ V
4. Let S be a subset of  a universal set U. Show that
       a) S ⋃ S' = U            
       b) S ⋂ S' = 0
       c) 0' = U
 5. Take 0 to 9 as a universal set, U.  Take your telephone number as a set, T.
	a- Find the complement of T.
	b- Find intersection of U and T.
	c- Find the union of U and T.
6. Let S = {1, 2, 3} and T = {1, 3, 6} be subsets of the universal set U = {1, 2, 3, 4, 5, 6}.   Find the followings:
          a) S'			b) T'     
          c) S' ⋃ T'		d) S' ⋂ T'

IV. Mathematical  Relations:  The Solve Command 
Before discussing the mathematical relations, three concepts which will be used frequently in this section and later chapters will be introduced.

Ordered Pairs: An ordered pair of numbers {x, y} is a set containing two elements, one of which (x) precedes the other (y).  The element x is called the first coordinate, and the element y the second coordinate.  The pair {x, y} is said to be "ordered" because the order in which the numbers appear is of significance.  The pairs {5, 8} and {8,5} are different ordered pairs.
  
Variables : A variable is a symbol that may represent any member of a particular set S and may take on different values.

Example: Suppose that monthly observations on income and consumption of an individual is given as,
Income:            2300, 2500, 1800, 2000, 1500, 2200            
Consumption: 2040, 2350, 1740, 1850, 1450, 1960
The first row (Income) may be represented by a variable, say Y, and the second row (consumption) by a variable, say C.  The variables Y and C can take any values that consumer may have in his income and consumption set.

Coordinate System: Geometrically, real numbers can be represented as points on a straight line.  It is customary to draw this line horizontally and associate an arbitrary point on it with the integer zero.  Points to the right of the zero point will represent positive numbers and points to the left will represent negative numbers.   Such a line is called the x-axis and the point corresponding to zero is called the origin.  The portion of the line to the right of zero is called the positive axis and the portion to the left of origin is called the negative axis.

_______.____.____.____.____.____.____.____.______
	-3      -2       -1        0        1        2        3        4 
Figure 1.   x-axis and origin

To present ordered pairs geometrically, draw a line perpendicular to the x-axis at the origin and call the line the y-axis.  It is customary to draw the positive y-axis above the origin, and to draw the negative y-axis below the origin.  The plane determined by the x- and y-axes is called the xy-plane,


Rectangular Coordinates : Given an ordered pair of real numbers (x, y), we can associate this pair with a point (x, y) on the x-y plane.  Rectangular coordinates use the distance from the origin on x and y axes to locate a point on the coordinate system.  For example, the ordered pairs (0, 1) and (2, -3) are shown in the figure below.



Polar Coordinates: Another way to locate a point on the coordinate system is to use polar coordinates.  The polar coordinates use a distance from a reference point, say origin, and an angle to describe locations.  In polar coordinates, 0 is along a horizontal ray to the right of the reference point and angles are measured counterclockwise.  Polar coordinates are written as ordered pairs (r, θ) where r, radius, is the polar distance and  θ is the measure of the polar angle.  

The relation between rectangular and polar coordinates follows the equality of the ordered pairs (x, y) = (rsinθ, rcosθ).   To convert rectangular coordinates to polar coordinates take the following steps:

1-  Find r = (Sqrt[(x^2)  +  (y^2)])
2-  Find θ using y = rsinθ,  x = rcosθ, or tan θ = (y/x).
3-  Find θ = sin-1((y/r)) = (tan^(-1))((y/x))

Example: Find the point (3,4) on the coordinate system and convert it to polar coordinates.
Solution:  r = (Sqrt[(3^2)  +  (4^2)]) = 5 ,   y = rsinθ  or  4 = 5sinθ,   sin θ = .8  and θ = 53.13o.  Therefore the polar coordinate are (5, 53.13).
 
Economic Relationships:  A relationship between two variables can be expressed in three forms:  Schedule, Graph, and Equation.	
 
Schedule:  A relation here is defined as any set of ordered pairs (x, y), where x and y are real numbers. 

Example:  The relationship between income (Y) and consumption (C) may be studied by listing of data and observing the relation.

       (Y)            (C)  	               (Y, C)
      2300          2040          	(2300, 2040)
      2500          2350          	(2500, 2350)
      1800          1740        	(1800, 1740)
      2000          1850          	(2000, 1850)
      1500          1450          	(1500, 1450)
      2200          1960          	(2200, 1960)     


Graph: The same information may be studied through plotting the paired observations on the coordinate system.   Plotting data will be studied in Chapter 2.  Here, the following graph shows the relationship between C and Y.  


Equation:  An equation is a statement of equality between two or more variables. The relationship between two or more variables my be studied by fitting an equation to the observed data and studying the mathematical relationship between the variables.  For example, for the income-consumption data above, we can fit an equation of a straight line.  Fitting equations to data will be studied in Chapter 3.  Here, assuming that such equation is estimated as C = 219 + 0.8Y, the plot of the points and the equation are shown in the following graph.



Solution of Equations (The Solve Command):  The solution of an equation in variable x is a set of numbers or objects that satisfies the equation. 

Example:  Solve (x^(2  )) - 4 = 0
Solution: Set (x^(2  )) = 4 and solve for x.  The solution is x = (Sqrt[4]) = \(TraditionalForm\`+\&_\) 2.  Using Mathematica,
Clear[x]
Solve[x^2  -  4  == 0 ,  x]
{{x -> -2}, {x -> 2}}
Note that, equality sign "=" in Solve command of Mathematica is "==".

Example: Quadratic Equations:Solve (x^(2  ))+ 2x - 8 = 0.
Solution: The general form of quadratic equation is a(x^2) + bx + c = 0, the solution of which is x = \(TraditionalForm\`\(\(-b\)\ \(\(+\)\(\ \)\)\&_\ \@\(b\^2 - \ 4  ac\)\)\/\(2  a\)\).  Therefore, by substituting the values to the formula, x = \(TraditionalForm\`\(\(-2\)\ \( + \&_\)\ \ \@\(2\^2 - \((4)\) \((\(-8\))\)\)\)\/2\) = -4 & 2.  Using Mathematica, the solution is 
Clear[x]
Solve[X^2 + 2X -8 == 0, X]
{{X -> -4}, {X -> 2}}

Example:  Find the solution: set of |x+3| =  4
Solution: If x > -3, |x + 3| = x + 3.  If  x <3, |x + 3| = -(x + 3).  Therefore, |x + 3| = 4 give rise to two equations, x + 3 = 4 and -x - 3 = 4, the solutions of which are x = 1 & -7.  
Using Mathematica, the solution is 
Clear[x]
Solve[Abs[x+3]==4, x]
{{x -> -7}, {x -> 1}}
Example:  Find the solution set of  (x^(3  )) -  (x^(2  ))+ 4x - 4 = 0.
Solution:  To solve a cubic equation or equations of higher order, use a graphic equation to find the zeroes of the equation.  Zeroes of an equation are the x-intercept of the equation.  Alternatively, you can set values for x and through trial and error find the x-value that will make the equation equal to zero.  For example, in the equation of the example, if x = 0, the value of the equation is -4.  If x = 2, the value of the equation is +8.  Therefore, the x-value that makes equation equal to zero lies between zero and two.   By assigning x some values in this range we find that x = 1.  This is only one of the solutions.  Since the equation is a cubic equation, there should be two more solutions.  To find the other two solutions, divide (x^(3  ))-  (x^(2  ))+ 4  x - 4 by (x - 1) to get (((x^(3  )) -  (x^(2  ))+ 4  x - 4)/((x  -  1))) = (x^2) + 4.  The solution of (X^2) + 4 = 0 is x = \(TraditionalForm\`+\&_\) 2i.  
Using Mathematica, the solution is 
Clear[x]
Solve[x^3 -x^2 + 4x -4==0,x]
{{x -> -2 i}, {x -> 
            2 i}, {x -> 1}}

Example:  Application to Market Analysis-  Demand and supply for a product are given as Qd = 20-2P and Qs = -1+ P.  Find the equilibrium price and quantity.
Solution:  At the equilibrium point, quantity demanded and quantity supplied are equal.  Therefore, by setting Qd = Qs, solve the resulting equation for P.  That is 20 - 2P = -1 + P, where P = 7 is the solution.  Substitute for P in Qd or Qs to get equilibrium Q =  6.  
Using Mathematica,
Clear[Qd, Qs, p, sol]
Qd = 20 - 2p; 	Qs=-1+p;
sol = Solve[Qd == Qs, p]
Qd /. sol
{{p -> 7}}
{6}

Example:  Application to Break-Even Analysis.
Find the break-even quantity for a business with an annual fixed cost of $24000 and average variable cost of $2 per unit of output.  The product is selling at market price of $5 per unit.  Find the quantity that will yield an annual profit of $18000.
Solution: Total revenue (TR) equals price times quantity.  Total cost (TC) equals fixed cost plus variable cost, where variable cost equals average cost times quantity.   At the break-even point TR = TC.  Therefore, define TC and TR with the given information and solve the equation TR = TC for q.    That is, 5q = 24000 + 2q.  Solving this equation for q results in q = 8000.  To find the q that results in $18000 profit, we know that Profit = TR - TC.  Therefore, set TR - TC = 18000 and solve for q.  This results in a quantity of q =  14000 units.
Clear[TR, TC, q,  profit]
TR = 5q;
TC = 24000 + 2q;
Solve[TR == TC, q]
{{q -> 8000}}
profit = TR - TC;
Solve[profit == 18000, q]
{{q -> 14000}}

Example:  Application in Finance (Internal Rate of Return).
Internal rate of return is the break-even discount rate for an investment.  It is the rate at which the present value of the net future cash flow equals to the amount invested.  That is, Io = (R1/(((1  +  r))^1)) + (R2/(((1 +  r))^2)) + (R3/(((1 +  r))^3)) + ..... , where Io is the initial investment, Rt is the return at the end of the (t^th) year, and r is the discount rate. 
Suppose a $24,000 initial investment has annual returns of $4,500 for five years and a scrap value of $2,500 at the end of the fifth year.  The internal rate of return on the investment is calculated by setting the present value of the future returns equal to the value of investment .   Therefore, formulate the problem as 20000 = (4500/(1 + r)) + (4500/(((1 + r))^2)) + (4500/(((1 + r))^3))+ (4500/(((1 + r))^4))+ (4500/((1 + r) 5)) + (2500/(((1 + r))^5))and solve for r.  Since the highest power of the equation is five, there will be five solutions to the equation.  However, only one of the solutions is acceptable.  To find the solution, substitute values for r and use the trial error method of the previous example to find the r-value that will make the two sides of the equation equal to each other.   This value is r =  7.41%.  
Using Mathematica, the solution is  
Clear[ r, sol ]
sol = Solve[20000==4500/(1+r) + 4500/(1+r)^2 + 4500/(1+r)^3 + 4500/(1+r)^4 + 4500/(1+r)^5 + 2500/(1+r)^5, r];
N[sol]
\({{r -> 
            0.07407879420079867`}, {r -> \(-1.6108542228800702`\) - 
              0.42477962655018353`\ i}, {r -> \(-1.6108542228800702`\) + 
              0.42477962655018353`\ i}, {r -> \(-0.8136851742203292`\) - 
              0.7442637253417171`\ i}, {r -> \(-0.8136851742203292`\) + 0.7442637253417171`\ i}}\)
Note that, since the equation is a (5^th) order polynomial, there will be five solutions, some with imaginary numbers.  To find the real-number solution in decimals, use the N command.   Here, the only real solution is r = .0740788 or a rate of return of 7.41%.  

Example:
Find the internal rate of return for $24000 investment with annual net cash flow of R1 = $5000, R2 = $7000, R3 = $8500, R4 = $6000, R5 = $3500, and a scrap value of $1200 at the end of the (5^th) year.
Clear[R  1, R2, R3, R4, R5, Rs, Io,  r, IRR]
R1=5000; R2=7000;R3=8500; R4=6000;R5=3500;Rs=1200;Io=24000;
IRR =N[Solve[ (R1/(((1 + r))^1))+(R2/(((1 + r))^2))+(R3/(((1 + r))^3))+(R4/(((1 + r))^4))+(R5/(((1 + r))^5))+(Rs/(((1 + r))^5))-Io==0,r]]
\({{r -> 
            0.095608734548139`}, {r -> \(-1.5227986333241679`\) - 
              0.3692766442770045`\ i}, {r -> \(-1.5227986333241679`\) + 
              0.3692766442770045`\ i}, {r -> \(-0.920839067283235`\) - 
              0.6557673507573035`\ i}, {r -> \(-0.920839067283235`\) + 0.6557673507573035`\ i}}\)

Do More Practice:
1- Change the initial investment in the preceding example to $25000, $26000, $27000, $28000, $29000, and $30000, and find the corresponding IRRs.  Graph the relationship between the initial investments and the IRRs on a graphing paper and comment on the relationship between the two variables.  

Example: Application to Finance:  Investment and Growth
Suppose an initial investment of $24000 has a net return of $1000 at the end of first year and an expected continuous returns with an annual growth rate of 10% in the coming years.  What is the net present value of the firm after 5 years, 10 years, 15 years, and 20 years if the discount rate is 6%?   After how many years the firm will break even?
Solution:  Assuming the initial investment Io, the first year return R1, the growth rate g, and the discount rate r, the problem can be formulated as:  NPV = \(∑\+\(t = 1\)\%n\( R1(1 + \ g)\)\^t\/\((1 + \ r)\)\^t\) - Io.  The NPV after 5, 10, 15, 20 years can be calculated by substituting for the parameters of the NPV equation.  The NPV at the end of (5^th), (10^th), (15^th), an (20^th) years are -18404.70, -11670.90, -3566.96, and 6185.82, respectively.  The number of years needed for the firm to break-even is calculated by setting NPV = 0 and solving for n.  Using Mathematica, 
Clear[R1, Io, g, r, NPV,  n]
R1 = 1000; Io = 24000; g =  .1; r =  .06;  n =  5;
NPV = \(∑\+\(\(\ \ \ \ \ \ \ \ \ \ \ \ \ \ \)\(t = 1\)\)\%\(\(\ \ \ \ \ \ \ \ \ \ \ \ \ \ \)\(n\)\)\(R1 \((1 + g)\)\^t\)\/\((1 + r)\)\^t\)-Io

\(\(\(5595.3358995191265`\)\(\)\) - i\ o\)
Clear[R1, Io, g, r,  n]
R1 = 1000; Io = 24000; g =  .1; r =  .06;
sol = Solve[\(∑\+\(t = 1\)\%n\( R1 \((1 + g)\)\^t\)\/\((1 + r)\)\^t\)-Io==0, n]
N[sol]
{{n -> -((4 Log[5] + Log[11] - Log[12875])/(Log[5] + 
                    Log[11] - Log[53]))}}
{{n -> 16.93775009700884`}}

Do More Practice:
1- Change the initial investment in the preceding example to $25000, $26000, $27000, $28000, $29000, and $30000, and find the corresponding number of years that the business needs to break-even.  Graph the relationship between the initial investments and the corresponding number of years on a graphing paper and comment on the relationship between the two variables.  
2-  Change the growth rate to 15%, 20%, and 25%.  Keep other parameters as in the text.  Find the number of years that the business needs to break-even.  Graph the relationship between the growth rate and the corresponding number of years on a graphing paper and comment on the relationship between the two variables.  
3-  Change the discount rate to 8%, 10%, 12%, and 15%.  Keep other parameters as in the text.  Find the number of years that the business needs to break-even.  Graph the relationship between the discount rate and the corresponding number of years on a graphing paper and comment on the relationship between the two variables.  
4-  What growth rate is needed for the firm to break-even in 10 years, if the discount rate is 6%?

Problems:
1- Solve the following equations for x. 
	a) (x^(2  )) + 4 = 0
	b) (x^(2  )) - 3x - 4 = 0
	c) (x^(2  ))- 6x + 25 = 0
	d) (x^(3  )) +2(x^(2  )) + 2x + 1 = 0
	e) (x^(2  )) - 5(x^(2  )) + 4 = 0
2- Demand and supply for a product are given as Qd = 100 - 20p and Qs = 5 + .5p, respectively.  Find the equilibrium price and quantity.
3- Demand and supply for a product are given as Qd = 10 + (20/p) and Qs = 5(p^(2  )), respectively.  Find the equilibrium price and quantity.  Find the excess supply when the market price is $2.50.
4- Find the break-even quantity for a manufacturer with a fixed annual cost of $60000 and average variable cost of $3 per unit.  The product is sold at market price of $7 per unit.
5- Find the break-even price for a manufacturer that has a fixed cost of $78000 and average variable cost of $2.  The manufacturer is expected to produce at full capacity of 6000 units a year.
6- A trucking company is operating with an annual fixed cost of $730,000.  The company has 60 trucks.  Every in-use truck has an average daily cost of $35.  Every idle truck has an average daily cost of $4.  Every truck is rented at an average daily price of $95.  
Find the number of trucks that should be rented a day for the company to break even. 
Find the number of trucks that should be rented a day for the company to have an annual profit of $350400.
7-  Find the rate of return on $260,000 investment with annual returns of $44,500 at the end of the first year, $65000 at the end of the second year, $75200 at the end of the third year, $55000 at the end of the fourth year, $42000 at the end of the fifth year, and $21000 at the end of the sixth year.  At the end of the sixth year, the investment has a scrap value of $25000.  

V.  Logarithms:  The Log Command 
Definition:  Let y =(b^x) , b > 0. We define the  exponent x as the logarithm of y to the base b and write (Subscript[log, b]^y) = x.  Expressions y = (b^x) and  (Subscript[log, b]^y) = x are equivalent. The logarithms of numbers to the base 10 are called common logarithms, and are denoted by log.  The logarithms of numbers to the base e,  the natural number, is called natural logarithm and is usually denoted by ln.  Logarithms are one of the basic tools for linearizing (log-linearizing) non-linear relationships. This property of logarithms is used frequently in economic models, data analysis, and econometrics.

Note that if the base of the logarithm is not defined inMathematica and most computer programs take "Log" as the natural logarithm.

Some of the properties of the logarithms are as follows,
 
Logarithms of products			loguv = logu + logv
Logarithms of a ratio				log((u/v)) = logu - logv
Logarithms of a power			log(u^m) = mlogu
Conversion of logarithm base			(Subscript[log, b]^u) = (Subscript[log, e]^u) (Subscript[log, b]^e)
Inversion of logarithm base	  		(Subscript[log, b]^u) = (1/((Subscript[log, u]^b)))

Example: Find the logarithm of 356 to the base 10, 2, and e.
Solution:  Use the logarithm table or a calculator to find the values.  Using  Mathematica, the values can be found as  
N[Log[10,  356]]
2.551449997972875`
 N[Log[2,  356]]
8.475733430966397`
 N[Log[E,  356]]
5.87493073085203`

Example: The relationship between the variable input (L) and the quantity of output (Q) is given as:
L: 	1,   2,   3,    4,      5,    6    7     8     9     10
Q:	2,   7,  15,  29,    42,   51  57   62   64     62
a- Make a list of paired inputs and outputs and plot it.
b- Make a list of the natural logarithmic values of paired inputs and outputs and plot it.
c- Compare the two plots.
Solution:  Find each pair on the x-y axes and plot them.  Find the logarithmic values of each pair and plot them.  The two plots will look similar.  However, the scales of the two plots are different and the logarithmic plot will look more smoother than the other one.  
Using Mathematica, the paired inputs and outputs can be listed as,
Clear[list1]
list1  =  {{1,  2},  {2,  7},  {3,  15},  {4,  
              29},  {5,  42},  {6,  51},  {7,  57},  {8,  
              62},  {9,  64},  {10,  62}}
{{1, 2}, {2, 7}, {3, 15}, {4, 29}, {5, 42}, {6, 51}, {7, 57}, {8, 
          62}, {9, 64}, {10, 62}}
the plot will look as follows (plotting of the functions is studies in the next chapter)
                          
                                   Plot of list1
to transform the numbers to logarithmic values (natural log) use the following command
list2  =  N[Log[list1]]
{{0.`, 0.6931471805599453`}, {0.6931471805599453`, 
          1.9459101490553132`}, {1.0986122886681098`, 
          2.70805020110221`}, {1.3862943611198906`, 
          3.367295829986474`}, {1.6094379124341003`, 
          3.7376696182833684`}, {1.791759469228055`, 
          3.9318256327243257`}, {1.9459101490553132`, 
          4.04305126783455`}, {2.0794415416798357`, 
          4.127134385045092`}, {2.1972245773362196`, 
          4.1588830833596715`}, {2.302585092994046`, 4.127134385045092`}}
the plot of the logarithmic numbers is shown below
                             
                                Plot of logarithmic values (list2)
                                
Example:  Log linearize the Cobb-Douglas production function  Q = A(L^α)(K^β).  
Solution:  Using the logarithm rules, LogQ = LogA + αLogL + βLogK.

Example:  Application in Business (Compounding) - How long does it take the initial value of an investment to double, if the interest rate is 8%.
Solution:  Using the annual compounding formula S = A(((1  +  r))^t), the doubling of the initial investment renders 2A = A(((1  +   .08))^t).  Therefore, solve for t in the equation 2 = (1.08^t) by taking the log as Log2 = tLog1.08 or t = (Log2/(Log1  .08))=  9 years.  Using Mathematica, the problem can be solved as
Clear[t]
Solve[2  ==  1.08^t,  t]
{{t -> 9.006468342000588`}}

Do More Practice:
1- How long does it take the initial value of an investment to double, if the interest rate is 16%.  (Answer:  4.67 years)
2- How long does it take the initial value of an investment to quadruple, if the interest rate is 8%.  (Answer:  18 years)

Example: Growth 
Show that if y grows exponentially at the rate of 20% from an initial value of 10, the natural log of y, lny, will grow at a constant rate along a line with a slope of .20.  List the values of y and lny for t = 0 to 10 and plot the numbers on a graphing paper.  Compare the two graphs.
Solution:   y = 10 (e^( .20  t)).  The natural log of y, lny = ln10 + .20t.  That is lny will change along a straight line with a slope of .20.  To find the points for ploting, make a table of y and lny values for t = 0 to 10.  You may use the Mathematica command Table as,
Clear[y]
Table[10 (E^( .20  t)),  {t,  0,  10}]
{10, 12.214027581601698`, 14.918246976412703`, 18.22118800390509`, 
        22.255409284924678`, 27.18281828459045`, 33.20116922736548`, 
        40.551999668446754`, 49.530324243951156`, 60.49647464412946`, 
        73.89056098930651`}
The plot of the points for y is shown below

Clear[y]
Table[Log[10] +   .20  t,  {t,  0,  10}]

{Log[10], 2.502585092994046`, 2.702585092994046`, 2.902585092994046`, 
        3.1025850929940457`, 3.302585092994046`, 3.502585092994046`, 
        3.7025850929940463`, 3.902585092994046`, 4.102585092994046`, 
        4.302585092994046`}
The plot of the points for lny is shown below


Do More Practice:
1- Change the rate of growth of the preceding example from 20% to 5%.  Find the values of y and lny for t = 0 to 10.  Using graphing paper plot the values of y and lny.  How do they differ from each other.
2- An investor has deposited $100 in a certificate of deposit (CD) account, earning 6% at the end of each year.  Find the compounded values of the investment at the end of each year for the next 10 years and plot them on a graphing paper.  Find the natural log of the compounded values of the investment at the end of each year for the next 10 years and plot them on a graphing paper.  How does the shape of two graphs differ from each other?

Problems:
1- Evaluate Log base 10 of 1, 10, 100, 200, and 300.  
2- Evaluate log base 2 of 1, 2, 4, 8, and 16.
3- Evaluate log base 3 of 1, 3, 9, 27, and 81.
4- Write the following functions in log-linear form:
	a)  Q = A(L^α)(K^β)	
	b)  S = A (((1 + i))^t)
	c)  Q = ((Ay^α)/(p^β))
5- A constant return to scale Cobb-Douglas production function, Q = 32(L^α)(K^β), has an output of 300 units for labor input level of L = 10 and capital input level of K = 8.  Find α and β.  (Hint:  A Cobb-Douglas production function of the form in this problem is constant return to scale if α + β = 1.  A constant return to scale production means that a proportional increase in inputs increases output at the same proportion).
6-  The relationship between labor input (L) and output (Q) of a firm is given as.
L :  0,    1,    2,    3,    4,     5,   6,       7,      8,      9,    10,    11,    12,    13,    14,    15
Q:  0,   10,  22,  36,   54,  74,   91,   106,  117,   126,  133,  138,  142,   143,  141,  136
a) Display the relationship between labor input and output.
b)  Display the relationship between the logarithm of labor input and the logarithm of output.
7-  A consumer's utility (U) for a product is given as
Q:  0,  1,    2,    3,   4,   5,   6,    7,    8,   9,  10
U:  0,  5,   12,  20,  27, 33, 37,  40,  42, 43,  43
a) Display the relationship between Q and U.
b) Display the relationship between LogQ and LogU.
  
VI. Progressions:  The Sum Commands
Definition:  A progression is a sequence of numbers any of which has a specific relation to the preceding one. The two common types of progressions are arithmetic progressions and geometric progressions.

Arithmetic Progression is a sequence of numbers, each of which differs from its preceding number by a factor of constant.  The constant number is called the common difference.  For example, the following sequence of numbers

      a, a + d, a + 2d, .............., a + (n-1)d 

is a progression with an initial value of  a  and common difference of d.  In Business and Economics we are most concerned with the sum of a progression or with the nth element of the progression.  The nth element of the arithmetic progression is a + (n - 1)d and the sum is S =  n(a + ((d(n  -  1))/2)).

Example: List  20 elements of a progression with an initial value of  4 and a common factor of 12.  Find the 10th element and the sum of the first twenty elements.
Solution: The table follows the arithmetic progression rule which produce a table as t = {4, 16, 28, .....}.  To find the 10th element and the sum, use the two formulas above.  The 10th element of the progression is 4 + (10 - 1)12 = 112 and the sum is S = 20(4 + ((12 (20  -  1))/2)) = 2360.  
In Mathematica, the table is generated by defining the element of the progression as 4 + 12i for i = 0, 1, ..., 19.  (Note that 0 to 19 results in 20 elements, n = 20)  
Clear[i]
Table[4 + 12  i,  {i,  0,  19}]
{4, 16, 28, 40, 52, 64, 76, 88, 100, 112, 124, 136, 148, 160, 172, 
        184, 196, 208, 220, 232}
to find the 10th element of the table, use the command,
%[[10]]
112
and to find the sum of the elements, use the command,
Sum[4 + 12  i,  {i,  0,  19}]
2360

Example:  A firm producing an initial output of 100 units can increase output by 10 units a week.  The management is interested in knowing how many weeks it takes to achieve an output level of 1260 units.
Solution:  The increase in output follows an arithmetic progression with an initial value of 100 and a common increment factor of 10 units.  That is, the (i^th) week's production is 100 + 10i, the sum of which over an unknown period x should be 1260.  To find x, set the sum of the weekly production equal to 1260 and solve for x.   That is, x(100 + ((10 (x  -  1))/2)) = 1260.  This gives x = 9 & -28, where only x = 9 is an acceptable solution.  
Using Mathematica,
Clear[i,  x]
Solve[Sum[100  + 10 i,  {i,  0,  x - 1}]  ==  1260,  
          x]
Unique::"usym": "\!\(\*FrameBox[\"\\\"25\\\"\", Rule[BoxFrame, False], Rule[BoxMargins, False]]\) is not a symbol or a valid symbol name."
{{x -> -28}, {x -> 9}}
Note that, as in the previous example (i-count 0 to 19), the i-count here is from 0 to x - 1 and not x.

Geometric Progression is a sequence of numbers, each of which is obtained by multiplying the preceding term by a constant factor.  The constant factor is called the common ratio.  For example, the following numbers
     a,  a(r^1),  a(r^2) ,  a(r^3), ................, a(r^((n - 1)))
form an n-element geometric progression with an initial value of  "a"  and a common ratio of r.  The nth element of the geometric progression is a(r^((n - 1))), and the sum is S = a((1  -   (r^n))/(1  -  r)). 

Example: List 20 elements of a geometric progression with an initial value of 5 and a common ratio of 2.  Find the 10th element and the sum of the first twenty elements.
Solution:  Using the geometric progression rule, the table of elements is t = { 5, 10, 20, ......}.  Using the two formulas above, the (10^th) element is 5(((2))^10) = 2560, and the sum is S = 5((1  -  (2^20))/(1  -  2)) = 5242875.
In Mathematica, define the elements of the progression as 5(((2))^i) for i = 0, 1, 2, ...., 19.  The table can be generated as follows.  (Note that, for 20 elements, i is set from 0 to 19).
Clear[i]
Table[5*2^i,  {i,  0,  19}]
{5, 10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120, 10240, 20480, 
        40960, 81920, 163840, 327680, 655360, 1310720, 2621440}
the 10th element is derived as 
%[[10]]
2560
the sum can be derived as
Sum[5*2^i,  {i,  0,  19}]

5242875

Example:  Application in Macroeconomics (Multiplier Effect):  In a two-sector, simple Keynesian macro-model of the economy with a consumption function of  C = bY, investment function of I = Io, and the income identity of Y = C + I, every one dollar increase in I will increase Y by the following amounts over time periods,
Time Period:           1, 2, 3,  .....................,    n
Increase Y:              1, b, (b^2),...............,  (b^((n - 1)))
Find the total increase in output after n periods (simple multiplier.)
Solution:  The progression is a geometric progression with an initial value of 1 and a common ratio of b.  Using the sum formula, S = ((1  -  (b^n))/(1  -  b)).  However, in this case b, which in macroeconomics is called marginal propensity to consume (MPC), is a number less than 1 (b < 1).  Therefore, as n approaches infinity, (b^n) = 0 and S = (1/(1  -  b)).
Clear[i]
Sum[1*b^i,  {i,  0,  Infinity}]
(1/(1 - b))

Problems:
1-   Find the 10th and 20th terms of the  following progressions
        a) 4, 7, 10, ..............  			  
        b) 1, (4/3), (5/3), .........
        c) 3, (7/2),  4, ..........
2-   Find the  sum of the first thirty terms of the progressions in problem 1.
3-  Find  the 10th and the 20th terms of the following geometric progressions
        a) 3, 9, 27, ...........       			
        b) 3, 1, (1/3), ...........
        c) 9, 6,  4, ...........
4-   Find  the  sum  of the first 3, 5,  and  10  terms of the geometric progressions in problem 3. 
5-   What will be the total savings of a person 10 years from now if she deposits $100 at an annually compounded interest rate of 10% a year.  How long does it take to double a principal of any amount at that rate?     
6- In a simple macro model of an economy C = 100 + .8Y, I = 200, and Y = C + I.  
a-  Assume that investment (I) increases by $100.  What is the effect on Y after 2 years, 5 years, and 10 years?  What is final effect on Y?