A simple model of the determination of the GDP with Mathematica

Jamel Saadaoui
University of Strasbourg, BETA,CNRS
https://www.jamelsaadaoui.com/​​
​
​
​In this blog, I will show how to build a simple model of the determination of the GDP with government and trade. The idea is to find the equilibrium GDP, where desired aggregate expenditures are equal to the level of good and services produced. To this end, I will use Mathematica 12.3 and the chapter 16 of the following book: https://global.oup.com/ukhe/product/economics-9780198791034, that I use in my lecture of Principles of Macroeconomics at the University of Strasbourg. Let me explain, step by step, the notebook I reproduced below.

​

I. The simple model with a tax rate on GDP

First, I have to clear the symbols to be sure that the previous registered symbol will not interfere with your model . Use (*something*) to insert the comment "something" :
In[]:=
ClearAll["Global`*"](*completelyclearglobalsymbolstostartfresh*)​​
​
​
​Then, I will use a first version of the model, with a tax rate. I name the equation 'eq' and I declare that my model can be reduced to one equation, where the GPD is in function of a consumption function, exogenous investment, exogenous government expenditures, exogenous exports, and an import function.
YC+F+G+(X-M)
(
1
)
C
c
0
+
c
1
(1-t)Y
(
2
)
M
m
1
Y
(
3
)
​
​
​
I use 'f' for the investment to not confuse with imaginary numbers and for the french "formation brute de capital fixe". You have to use "Ctrl+Enter" to execute the command. The above line gives this the following output:
In[]:=
eq=y==c0+c1*(1-t)*y+f+g+x-m1*y(*fstandsfortheinvestment*)
Out[]=
yc0+f+g+x-m1y+c1(1-t)y
Then, I solve the model and I store the result in an object ‘PIB’ (the french acronym for GDP):
In[]:=
PIB=Solve[eq,y]
Out[]=
y
c0+f+g+x
1-c1+m1+c1t

​
​
​
You can also use a Wolfram|Alpha query to obtain a similar result:

In[]:=
solve {Y=c0+c1*(1-t)*Y+F+G+X-m*Y} for Y
Input interpretation
solve
Yc0+c1(1-t)Y+F+G+X-mY
for
Y
Results
Hide steps
Y
c0+F+G+X
c1(t-1)+m+1
and c1t+m+1≠c1
Possible intermediate steps
Solve for Y:
Yc0+F+G+X-mY+c1Y(-t+1)
Expand and collect in terms of Y:
Yc0+F+G+X+Y(c1-m-c1t)
Subtract Y(c1-m-c1t) from both sides:
Y(1-c1+m+c1t)c0+F+G+X
Divide both sides by 1-c1+m+c1t:
Answer:
Y
c0+F+G+X
1-c1+m+c1t
​
​
​
Now, I want to compute the algebraic value of the multiplier effect of this model. By definition, the multiplier is the value of a change in the GDP after an increase in an exogenous expenditure. In this example, I choose to evaluate the value of change in the GDP after an increase in exogenous government spending. I store the value in an object called 'Multiplier'. The numerical value will depend on the value of the parameters of your models.
In[]:=
Multiplier=D[PIB,g]
Out[]=
0
1
1-c1+m1+c1t

​
​
​
You can also use a Wolfram | Alpha query to obtain a similar result :

In[]:=
D[(c0 + F + G + X)/(1 - c1 (1 - t) + m), F]
Assuming "F" is a variable | Use as
a unit
instead
Derivative
Use the power rule | ▾
Hide steps
∂
∂F
c0+F+G+X
1-c1(1-t)+m

1
c1(t-1)+m+1
Possible intermediate steps
Possible derivation:
∂
∂F
c0+F+G+X
1-c1(1-t)+m
Factor out constants:

∂
∂F
(c0+F+G+X)
1+m-c1(1-t)
Differentiate the sum term by term:

∂
∂F
(c0)+
∂
∂F
(F)+
∂
∂F
(G)+
∂
∂F
(X)
1+m-c1(-t+1)
The derivative of c0 is zero:

∂
∂F
(F)+
∂
∂F
(G)+
∂
∂F
(X)+
0
1+m-c1(1-t)
Simplify the expression:

∂
∂F
(F)+
∂
∂F
(G)+
∂
∂F
(X)
1+m-c1(1-t)
The derivative of F is 1:

∂
∂F
(G)+
∂
∂F
(X)+
1
1+m-c1(1-t)
The derivative of G is zero:

1+
∂
∂F
(X)+
0
1+m-c1(1-t)
Simplify the expression:

1+
∂
∂F
(X)
1+m-c1(1-t)
The derivative of X is zero:

1+
0
1+m-c1(1-t)
Simplify the expression:

1
1+m-c1(1-t)
Simplify the expression:
Answer:

1
1+m+c1(-1+t)
Alternate form
1
c1t-c1+m+1
Roots
(no roots exist)
Series expansion at t = 0
1
-c1+m+1
-
c1t
2
(-c1+m+1)
+
2
c1
2
t
3
(-c1+m+1)
-
3
c1
3
t
4
(-c1+m+1)
+
4
c1
4
t
5
(-c1+m+1)
+O(
5
t
)
(Taylor series)
Big-O notation »
Series expansion at t = ∞
1
c1t
+
c1-m-1
2
c1
2
t
+
2
(-c1+m+1)
3
c1
3
t
+
3
(c1-m-1)
4
c1
4
t
+O
5
1
t
(Laurent series)
Big-O notation »
Indefinite integral
☑ Step-by-step solution

1
1+m+c1(-1+t)
t
log(c1(t-1)+m+1)
c1
+constant
(assuming a complex-valued logarithm)
log(x) is the natural logarithm »
Limit
lim
m±∞
1
1+m+c1(-1+t)
0
lim
t±∞
1
1+m+c1(-1+t)
0
​
​
​
In the chapter 16 of the book, we can read that the multiplier is positively linked with the marginal propensity to consume and is negatively linked with the tax rate and the marginal propensity to import. I will derive the value of the multiplier relatively to these three last variables. The partial derivative of the multiplier effect relative to marginal propensity to import is indeed negative:
Besides, the partial derivative of the multiplier effect relative to the tax rate is also negative :
​
​
​
Finally, the partial derivative of the multiplier effect relative to the marginal propensity to consume is positive.

II. A little numerical exercise

Now, we run a numerical example to determine (a) the equilibrium GDP, (b) the size of the multiplier effect, and (c) the sign of the three partial derivatives by choosing vales for the exogenous variables and the parameters:
I use '; ' to hide the output for the parameters . We found the equilibrium value for the GDP (2786.9), the size of the multiplier (1.63934), and the excepted signs for the partial derivative.

III. The simple model with lump-sum taxes

I can use a version of the model with lump-sum taxes to evaluate the balanced budget multiplier (a simultaneous and equivalent increase in public consumption and in taxes).
​
​
The above lines give the following output:

IV. A second little numerical exercise

To simplify, I use a version of this model with lump-sum taxes where the propensity to import is equal to zero and evaluate the balanced budget multiplier:
​
​
​
After an increase in public expenditures and in taxes, we can observe that the balanced budget multiplier is equal to one since the equilibrium GDP moves from 8000 to 8001 ('g' moved from 100 to 101 and 't' moved from 100 to 101), as in the balanced budget multiplier (Haavelmo, 1945):

Bibliographic references


  • Lipsey, R., & Chrystal, A. (2020). Economics. Oxford University Press. https://global.oup.com/ukhe/product/economics-9780198791034
  • 
  • Haavelmo, T. (1945). Multiplier Effects of a Balanced Budget. Econometrica, 13(4), 311–318. https://doi.org/10.2307/1906924