equilibria-mcp-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +142 -0
- package/LICENSE +21 -0
- package/README.md +240 -0
- package/dist/builders/YAMLBuilder.d.ts +77 -0
- package/dist/builders/YAMLBuilder.d.ts.map +1 -0
- package/dist/builders/YAMLBuilder.js +251 -0
- package/dist/builders/YAMLBuilder.js.map +1 -0
- package/dist/economics/constants.d.ts +39 -0
- package/dist/economics/constants.d.ts.map +1 -0
- package/dist/economics/constants.js +46 -0
- package/dist/economics/constants.js.map +1 -0
- package/dist/economics/formulas.d.ts +19 -0
- package/dist/economics/formulas.d.ts.map +1 -0
- package/dist/economics/formulas.js +260 -0
- package/dist/economics/formulas.js.map +1 -0
- package/dist/economics/index.d.ts +9 -0
- package/dist/economics/index.d.ts.map +1 -0
- package/dist/economics/index.js +9 -0
- package/dist/economics/index.js.map +1 -0
- package/dist/economics/validators.d.ts +18 -0
- package/dist/economics/validators.d.ts.map +1 -0
- package/dist/economics/validators.js +111 -0
- package/dist/economics/validators.js.map +1 -0
- package/dist/errors/index.d.ts +172 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +313 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/formatters/index.d.ts +8 -0
- package/dist/formatters/index.d.ts.map +1 -0
- package/dist/formatters/index.js +8 -0
- package/dist/formatters/index.js.map +1 -0
- package/dist/formatters/redux.d.ts +15 -0
- package/dist/formatters/redux.d.ts.map +1 -0
- package/dist/formatters/redux.js +35 -0
- package/dist/formatters/redux.js.map +1 -0
- package/dist/formatters/yaml.d.ts +18 -0
- package/dist/formatters/yaml.d.ts.map +1 -0
- package/dist/formatters/yaml.js +40 -0
- package/dist/formatters/yaml.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +14 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +86 -0
- package/dist/server.js.map +1 -0
- package/dist/templates/advancedMicro.d.ts +8 -0
- package/dist/templates/advancedMicro.d.ts.map +1 -0
- package/dist/templates/advancedMicro.js +834 -0
- package/dist/templates/advancedMicro.js.map +1 -0
- package/dist/templates/consumer.d.ts +12 -0
- package/dist/templates/consumer.d.ts.map +1 -0
- package/dist/templates/consumer.js +1978 -0
- package/dist/templates/consumer.js.map +1 -0
- package/dist/templates/elasticity.d.ts +8 -0
- package/dist/templates/elasticity.d.ts.map +1 -0
- package/dist/templates/elasticity.js +500 -0
- package/dist/templates/elasticity.js.map +1 -0
- package/dist/templates/externalities.d.ts +11 -0
- package/dist/templates/externalities.d.ts.map +1 -0
- package/dist/templates/externalities.js +997 -0
- package/dist/templates/externalities.js.map +1 -0
- package/dist/templates/financeBehavioral.d.ts +8 -0
- package/dist/templates/financeBehavioral.d.ts.map +1 -0
- package/dist/templates/financeBehavioral.js +860 -0
- package/dist/templates/financeBehavioral.js.map +1 -0
- package/dist/templates/growth.d.ts +8 -0
- package/dist/templates/growth.d.ts.map +1 -0
- package/dist/templates/growth.js +740 -0
- package/dist/templates/growth.js.map +1 -0
- package/dist/templates/index.d.ts +31 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +91 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/inequality.d.ts +8 -0
- package/dist/templates/inequality.d.ts.map +1 -0
- package/dist/templates/inequality.js +562 -0
- package/dist/templates/inequality.js.map +1 -0
- package/dist/templates/intertemporalMacro.d.ts +8 -0
- package/dist/templates/intertemporalMacro.d.ts.map +1 -0
- package/dist/templates/intertemporalMacro.js +550 -0
- package/dist/templates/intertemporalMacro.js.map +1 -0
- package/dist/templates/isLM.d.ts +8 -0
- package/dist/templates/isLM.d.ts.map +1 -0
- package/dist/templates/isLM.js +747 -0
- package/dist/templates/isLM.js.map +1 -0
- package/dist/templates/macro.d.ts +8 -0
- package/dist/templates/macro.d.ts.map +1 -0
- package/dist/templates/macro.js +600 -0
- package/dist/templates/macro.js.map +1 -0
- package/dist/templates/marketStructures.d.ts +11 -0
- package/dist/templates/marketStructures.d.ts.map +1 -0
- package/dist/templates/marketStructures.js +1135 -0
- package/dist/templates/marketStructures.js.map +1 -0
- package/dist/templates/newKeynesian.d.ts +8 -0
- package/dist/templates/newKeynesian.d.ts.map +1 -0
- package/dist/templates/newKeynesian.js +633 -0
- package/dist/templates/newKeynesian.js.map +1 -0
- package/dist/templates/oligopoly.d.ts +11 -0
- package/dist/templates/oligopoly.d.ts.map +1 -0
- package/dist/templates/oligopoly.js +1113 -0
- package/dist/templates/oligopoly.js.map +1 -0
- package/dist/templates/ppf.d.ts +8 -0
- package/dist/templates/ppf.d.ts.map +1 -0
- package/dist/templates/ppf.js +439 -0
- package/dist/templates/ppf.js.map +1 -0
- package/dist/templates/producer.d.ts +11 -0
- package/dist/templates/producer.d.ts.map +1 -0
- package/dist/templates/producer.js +979 -0
- package/dist/templates/producer.js.map +1 -0
- package/dist/templates/production.d.ts +8 -0
- package/dist/templates/production.d.ts.map +1 -0
- package/dist/templates/production.js +574 -0
- package/dist/templates/production.js.map +1 -0
- package/dist/templates/supplyDemand.d.ts +8 -0
- package/dist/templates/supplyDemand.d.ts.map +1 -0
- package/dist/templates/supplyDemand.js +1282 -0
- package/dist/templates/supplyDemand.js.map +1 -0
- package/dist/templates/tradeGrowth.d.ts +8 -0
- package/dist/templates/tradeGrowth.d.ts.map +1 -0
- package/dist/templates/tradeGrowth.js +637 -0
- package/dist/templates/tradeGrowth.js.map +1 -0
- package/dist/tools/index.d.ts +25 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +54 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/models.d.ts +8 -0
- package/dist/tools/models.d.ts.map +1 -0
- package/dist/tools/models.js +828 -0
- package/dist/tools/models.js.map +1 -0
- package/dist/tools/output.d.ts +8 -0
- package/dist/tools/output.d.ts.map +1 -0
- package/dist/tools/output.js +236 -0
- package/dist/tools/output.js.map +1 -0
- package/dist/tools/templates.d.ts +8 -0
- package/dist/tools/templates.d.ts.map +1 -0
- package/dist/tools/templates.js +247 -0
- package/dist/tools/templates.js.map +1 -0
- package/dist/tools/validation.d.ts +8 -0
- package/dist/tools/validation.d.ts.map +1 -0
- package/dist/tools/validation.js +181 -0
- package/dist/tools/validation.js.map +1 -0
- package/dist/types/index.d.ts +187 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/cache.d.ts +99 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +192 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +128 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +251 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/validation/index.d.ts +42 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +282 -0
- package/dist/validation/index.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,747 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IS-LM Model Templates
|
|
3
|
+
*
|
|
4
|
+
* Templates for IS-LM macroeconomic analysis, policy effects, and extensions.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Basic IS-LM Model
|
|
8
|
+
* Shows goods market (IS) and money market (LM) equilibrium
|
|
9
|
+
*/
|
|
10
|
+
const isLmBasic = {
|
|
11
|
+
id: 'is_lm_basic',
|
|
12
|
+
name: 'IS-LM Model',
|
|
13
|
+
description: 'Basic IS-LM model showing simultaneous equilibrium in goods and money markets.',
|
|
14
|
+
category: 'macro',
|
|
15
|
+
level: 'undergraduate',
|
|
16
|
+
tags: ['IS-LM', 'macroeconomics', 'equilibrium', 'goods market', 'money market'],
|
|
17
|
+
parameters: {
|
|
18
|
+
autonomousSpending: {
|
|
19
|
+
type: 'number',
|
|
20
|
+
default: 200,
|
|
21
|
+
description: 'Autonomous spending (C₀ + I₀ + G)',
|
|
22
|
+
},
|
|
23
|
+
mpc: {
|
|
24
|
+
type: 'number',
|
|
25
|
+
default: 0.8,
|
|
26
|
+
description: 'Marginal propensity to consume',
|
|
27
|
+
},
|
|
28
|
+
investmentSensitivity: {
|
|
29
|
+
type: 'number',
|
|
30
|
+
default: 50,
|
|
31
|
+
description: 'Investment sensitivity to interest rate',
|
|
32
|
+
},
|
|
33
|
+
moneySupply: {
|
|
34
|
+
type: 'number',
|
|
35
|
+
default: 500,
|
|
36
|
+
description: 'Real money supply (M/P)',
|
|
37
|
+
},
|
|
38
|
+
moneyDemandIncome: {
|
|
39
|
+
type: 'number',
|
|
40
|
+
default: 0.5,
|
|
41
|
+
description: 'Money demand income sensitivity (k)',
|
|
42
|
+
},
|
|
43
|
+
moneyDemandInterest: {
|
|
44
|
+
type: 'number',
|
|
45
|
+
default: 100,
|
|
46
|
+
description: 'Money demand interest sensitivity (h)',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
generate: (params) => {
|
|
50
|
+
const A = params.autonomousSpending ?? 200;
|
|
51
|
+
const c = params.mpc ?? 0.8;
|
|
52
|
+
const b = params.investmentSensitivity ?? 50;
|
|
53
|
+
const M = params.moneySupply ?? 500;
|
|
54
|
+
const k = params.moneyDemandIncome ?? 0.5;
|
|
55
|
+
const h = params.moneyDemandInterest ?? 100;
|
|
56
|
+
return {
|
|
57
|
+
metadata: {
|
|
58
|
+
specVersion: '1.3',
|
|
59
|
+
title: 'IS-LM Model',
|
|
60
|
+
description: 'Simultaneous equilibrium in goods and money markets',
|
|
61
|
+
},
|
|
62
|
+
parameters: {
|
|
63
|
+
// IS curve parameters
|
|
64
|
+
A: { value: A, label: 'Autonomous Spending', min: 100, max: 400 },
|
|
65
|
+
c: { value: c, label: 'MPC', min: 0.5, max: 0.95, step: 0.05 },
|
|
66
|
+
b: { value: b, label: 'Investment Sensitivity', min: 20, max: 100 },
|
|
67
|
+
// LM curve parameters
|
|
68
|
+
M: { value: M, label: 'Money Supply (M/P)', min: 200, max: 800 },
|
|
69
|
+
k: { value: k, label: 'Income Sensitivity', min: 0.2, max: 1, step: 0.1 },
|
|
70
|
+
h: { value: h, label: 'Interest Sensitivity', min: 50, max: 200 },
|
|
71
|
+
// Multiplier
|
|
72
|
+
mult: {
|
|
73
|
+
expression: '1 / (1 - c)',
|
|
74
|
+
label: 'Multiplier',
|
|
75
|
+
readonly: true,
|
|
76
|
+
},
|
|
77
|
+
// Equilibrium calculations
|
|
78
|
+
Y_eq: {
|
|
79
|
+
expression: '(A * h + b * M / k) / ((1 - c) * h / b + k)',
|
|
80
|
+
label: 'Equilibrium Income',
|
|
81
|
+
readonly: true,
|
|
82
|
+
},
|
|
83
|
+
r_eq: {
|
|
84
|
+
expression: '(k * Y_eq - M) / h',
|
|
85
|
+
label: 'Equilibrium Interest Rate',
|
|
86
|
+
readonly: true,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
charts: [
|
|
90
|
+
{
|
|
91
|
+
id: 'main',
|
|
92
|
+
title: 'IS-LM Model',
|
|
93
|
+
xAxis: { label: 'Income (Y)', min: 0, max: 'A * mult * 1.5' },
|
|
94
|
+
yAxis: { label: 'Interest Rate (r)', min: 0, max: 15 },
|
|
95
|
+
elements: [
|
|
96
|
+
// IS curve: Y = A*mult - b*mult*r => r = (A - Y/mult) / b = A/b - Y/(b*mult)
|
|
97
|
+
{
|
|
98
|
+
id: 'is',
|
|
99
|
+
type: 'line',
|
|
100
|
+
equation: 'A / b - x / (b * mult)',
|
|
101
|
+
color: '#2563EB',
|
|
102
|
+
strokeWidth: 3,
|
|
103
|
+
label: 'IS',
|
|
104
|
+
curveLabel: { text: 'IS', x: 'A * mult * 0.9', position: 'below' },
|
|
105
|
+
},
|
|
106
|
+
// LM curve: r = (k*Y - M) / h
|
|
107
|
+
{
|
|
108
|
+
id: 'lm',
|
|
109
|
+
type: 'line',
|
|
110
|
+
equation: '(k * x - M) / h',
|
|
111
|
+
color: '#DC2626',
|
|
112
|
+
strokeWidth: 3,
|
|
113
|
+
label: 'LM',
|
|
114
|
+
curveLabel: { text: 'LM', x: 'A * mult * 0.9', position: 'above' },
|
|
115
|
+
},
|
|
116
|
+
// Equilibrium point
|
|
117
|
+
{
|
|
118
|
+
id: 'equilibrium',
|
|
119
|
+
type: 'point',
|
|
120
|
+
x: 'Y_eq',
|
|
121
|
+
y: 'r_eq',
|
|
122
|
+
color: '#16A34A',
|
|
123
|
+
size: 10,
|
|
124
|
+
label: 'E',
|
|
125
|
+
droplines: { x: 'Y*', y: 'r*' },
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
annotations: [
|
|
129
|
+
{
|
|
130
|
+
id: 'equilibrium-label',
|
|
131
|
+
text: 'Y* = ${Y_eq:.0f}, r* = ${r_eq:.1f}%',
|
|
132
|
+
x: 'Y_eq * 0.6',
|
|
133
|
+
y: 'r_eq + 2',
|
|
134
|
+
color: '#16A34A',
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
};
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* IS-LM with Fiscal Policy
|
|
144
|
+
* Shows effect of government spending changes
|
|
145
|
+
*/
|
|
146
|
+
const isLmFiscalPolicy = {
|
|
147
|
+
id: 'is_lm_fiscal_policy',
|
|
148
|
+
name: 'IS-LM: Fiscal Policy',
|
|
149
|
+
description: 'Shows how fiscal policy (government spending or tax changes) shifts the IS curve.',
|
|
150
|
+
category: 'macro',
|
|
151
|
+
level: 'undergraduate',
|
|
152
|
+
tags: ['IS-LM', 'fiscal policy', 'government spending', 'crowding out'],
|
|
153
|
+
parameters: {
|
|
154
|
+
initialSpending: {
|
|
155
|
+
type: 'number',
|
|
156
|
+
default: 200,
|
|
157
|
+
description: 'Initial autonomous spending',
|
|
158
|
+
},
|
|
159
|
+
fiscalChange: {
|
|
160
|
+
type: 'number',
|
|
161
|
+
default: 50,
|
|
162
|
+
description: 'Change in government spending (ΔG)',
|
|
163
|
+
},
|
|
164
|
+
mpc: {
|
|
165
|
+
type: 'number',
|
|
166
|
+
default: 0.8,
|
|
167
|
+
description: 'Marginal propensity to consume',
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
generate: (params) => {
|
|
171
|
+
const A0 = params.initialSpending ?? 200;
|
|
172
|
+
const dG = params.fiscalChange ?? 50;
|
|
173
|
+
const c = params.mpc ?? 0.8;
|
|
174
|
+
return {
|
|
175
|
+
metadata: {
|
|
176
|
+
specVersion: '1.3',
|
|
177
|
+
title: 'IS-LM: Fiscal Policy',
|
|
178
|
+
description: 'Effect of fiscal expansion on equilibrium',
|
|
179
|
+
},
|
|
180
|
+
parameters: {
|
|
181
|
+
A0: { value: A0, label: 'Initial Spending' },
|
|
182
|
+
dG: { value: dG, label: 'ΔG', min: -100, max: 100 },
|
|
183
|
+
A1: { expression: 'A0 + dG', label: 'New Spending', readonly: true },
|
|
184
|
+
c: { value: c, label: 'MPC', min: 0.5, max: 0.95, step: 0.05 },
|
|
185
|
+
b: { value: 50, label: 'Investment Sensitivity' },
|
|
186
|
+
mult: { expression: '1 / (1 - c)', label: 'Multiplier', readonly: true },
|
|
187
|
+
// Money market
|
|
188
|
+
M: { value: 500, label: 'Money Supply' },
|
|
189
|
+
k: { value: 0.5, label: 'k' },
|
|
190
|
+
h: { value: 100, label: 'h' },
|
|
191
|
+
// Initial equilibrium
|
|
192
|
+
Y0: {
|
|
193
|
+
expression: '(A0 * h + b * M / k) / ((1 - c) * h / b + k)',
|
|
194
|
+
label: 'Initial Y',
|
|
195
|
+
readonly: true,
|
|
196
|
+
},
|
|
197
|
+
r0: {
|
|
198
|
+
expression: '(k * Y0 - M) / h',
|
|
199
|
+
label: 'Initial r',
|
|
200
|
+
readonly: true,
|
|
201
|
+
},
|
|
202
|
+
// New equilibrium
|
|
203
|
+
Y1: {
|
|
204
|
+
expression: '(A1 * h + b * M / k) / ((1 - c) * h / b + k)',
|
|
205
|
+
label: 'New Y',
|
|
206
|
+
readonly: true,
|
|
207
|
+
},
|
|
208
|
+
r1: {
|
|
209
|
+
expression: '(k * Y1 - M) / h',
|
|
210
|
+
label: 'New r',
|
|
211
|
+
readonly: true,
|
|
212
|
+
},
|
|
213
|
+
// Crowding out
|
|
214
|
+
crowdingOut: {
|
|
215
|
+
expression: 'dG * mult - (Y1 - Y0)',
|
|
216
|
+
label: 'Crowding Out',
|
|
217
|
+
readonly: true,
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
charts: [
|
|
221
|
+
{
|
|
222
|
+
id: 'main',
|
|
223
|
+
title: 'Fiscal Policy Effect',
|
|
224
|
+
xAxis: { label: 'Income (Y)', min: 0, max: 'max(A0, A1) * mult * 1.3' },
|
|
225
|
+
yAxis: { label: 'Interest Rate (r)', min: 0, max: 15 },
|
|
226
|
+
elements: [
|
|
227
|
+
// Initial IS
|
|
228
|
+
{
|
|
229
|
+
id: 'is0',
|
|
230
|
+
type: 'line',
|
|
231
|
+
equation: 'A0 / b - x / (b * mult)',
|
|
232
|
+
color: '#93C5FD',
|
|
233
|
+
lineStyle: 'dashed',
|
|
234
|
+
strokeWidth: 2,
|
|
235
|
+
label: 'IS₀',
|
|
236
|
+
},
|
|
237
|
+
// New IS
|
|
238
|
+
{
|
|
239
|
+
id: 'is1',
|
|
240
|
+
type: 'line',
|
|
241
|
+
equation: 'A1 / b - x / (b * mult)',
|
|
242
|
+
color: '#2563EB',
|
|
243
|
+
strokeWidth: 3,
|
|
244
|
+
label: 'IS₁',
|
|
245
|
+
},
|
|
246
|
+
// LM (unchanged)
|
|
247
|
+
{
|
|
248
|
+
id: 'lm',
|
|
249
|
+
type: 'line',
|
|
250
|
+
equation: '(k * x - M) / h',
|
|
251
|
+
color: '#DC2626',
|
|
252
|
+
strokeWidth: 3,
|
|
253
|
+
label: 'LM',
|
|
254
|
+
},
|
|
255
|
+
// Initial equilibrium
|
|
256
|
+
{
|
|
257
|
+
id: 'eq0',
|
|
258
|
+
type: 'point',
|
|
259
|
+
x: 'Y0',
|
|
260
|
+
y: 'r0',
|
|
261
|
+
color: '#6B7280',
|
|
262
|
+
label: 'E₀',
|
|
263
|
+
},
|
|
264
|
+
// New equilibrium
|
|
265
|
+
{
|
|
266
|
+
id: 'eq1',
|
|
267
|
+
type: 'point',
|
|
268
|
+
x: 'Y1',
|
|
269
|
+
y: 'r1',
|
|
270
|
+
color: '#16A34A',
|
|
271
|
+
size: 10,
|
|
272
|
+
label: 'E₁',
|
|
273
|
+
droplines: { x: true, y: true },
|
|
274
|
+
},
|
|
275
|
+
],
|
|
276
|
+
annotations: [
|
|
277
|
+
{
|
|
278
|
+
id: 'shift-label',
|
|
279
|
+
text: 'ΔG = ${dG} → IS shifts right',
|
|
280
|
+
x: '(A0 + A1) * mult / 4',
|
|
281
|
+
y: 13,
|
|
282
|
+
color: '#2563EB',
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: 'crowding-label',
|
|
286
|
+
text: 'Crowding out = ${crowdingOut:.1f}',
|
|
287
|
+
x: 'Y1 * 0.7',
|
|
288
|
+
y: 'r1 + 1.5',
|
|
289
|
+
color: '#F59E0B',
|
|
290
|
+
},
|
|
291
|
+
],
|
|
292
|
+
},
|
|
293
|
+
],
|
|
294
|
+
};
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
/**
|
|
298
|
+
* IS-LM with Monetary Policy
|
|
299
|
+
* Shows effect of money supply changes
|
|
300
|
+
*/
|
|
301
|
+
const isLmMonetaryPolicy = {
|
|
302
|
+
id: 'is_lm_monetary_policy',
|
|
303
|
+
name: 'IS-LM: Monetary Policy',
|
|
304
|
+
description: 'Shows how monetary policy (money supply changes) shifts the LM curve.',
|
|
305
|
+
category: 'macro',
|
|
306
|
+
level: 'undergraduate',
|
|
307
|
+
tags: ['IS-LM', 'monetary policy', 'money supply', 'interest rate'],
|
|
308
|
+
parameters: {
|
|
309
|
+
initialMoney: {
|
|
310
|
+
type: 'number',
|
|
311
|
+
default: 500,
|
|
312
|
+
description: 'Initial money supply (M/P)',
|
|
313
|
+
},
|
|
314
|
+
moneyChange: {
|
|
315
|
+
type: 'number',
|
|
316
|
+
default: 100,
|
|
317
|
+
description: 'Change in money supply (ΔM)',
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
generate: (params) => {
|
|
321
|
+
const M0 = params.initialMoney ?? 500;
|
|
322
|
+
const dM = params.moneyChange ?? 100;
|
|
323
|
+
return {
|
|
324
|
+
metadata: {
|
|
325
|
+
specVersion: '1.3',
|
|
326
|
+
title: 'IS-LM: Monetary Policy',
|
|
327
|
+
description: 'Effect of monetary expansion on equilibrium',
|
|
328
|
+
},
|
|
329
|
+
parameters: {
|
|
330
|
+
A: { value: 200, label: 'Autonomous Spending' },
|
|
331
|
+
c: { value: 0.8, label: 'MPC' },
|
|
332
|
+
b: { value: 50, label: 'Investment Sensitivity' },
|
|
333
|
+
mult: { expression: '1 / (1 - c)', label: 'Multiplier', readonly: true },
|
|
334
|
+
M0: { value: M0, label: 'Initial Money Supply', min: 300, max: 700 },
|
|
335
|
+
dM: { value: dM, label: 'ΔM', min: -200, max: 200 },
|
|
336
|
+
M1: { expression: 'M0 + dM', label: 'New Money Supply', readonly: true },
|
|
337
|
+
k: { value: 0.5, label: 'k' },
|
|
338
|
+
h: { value: 100, label: 'h' },
|
|
339
|
+
// Initial equilibrium
|
|
340
|
+
Y0: {
|
|
341
|
+
expression: '(A * h + b * M0 / k) / ((1 - c) * h / b + k)',
|
|
342
|
+
label: 'Initial Y',
|
|
343
|
+
readonly: true,
|
|
344
|
+
},
|
|
345
|
+
r0: {
|
|
346
|
+
expression: '(k * Y0 - M0) / h',
|
|
347
|
+
label: 'Initial r',
|
|
348
|
+
readonly: true,
|
|
349
|
+
},
|
|
350
|
+
// New equilibrium
|
|
351
|
+
Y1: {
|
|
352
|
+
expression: '(A * h + b * M1 / k) / ((1 - c) * h / b + k)',
|
|
353
|
+
label: 'New Y',
|
|
354
|
+
readonly: true,
|
|
355
|
+
},
|
|
356
|
+
r1: {
|
|
357
|
+
expression: '(k * Y1 - M1) / h',
|
|
358
|
+
label: 'New r',
|
|
359
|
+
readonly: true,
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
charts: [
|
|
363
|
+
{
|
|
364
|
+
id: 'main',
|
|
365
|
+
title: 'Monetary Policy Effect',
|
|
366
|
+
xAxis: { label: 'Income (Y)', min: 0, max: 'A * mult * 1.5' },
|
|
367
|
+
yAxis: { label: 'Interest Rate (r)', min: -2, max: 15 },
|
|
368
|
+
elements: [
|
|
369
|
+
// IS (unchanged)
|
|
370
|
+
{
|
|
371
|
+
id: 'is',
|
|
372
|
+
type: 'line',
|
|
373
|
+
equation: 'A / b - x / (b * mult)',
|
|
374
|
+
color: '#2563EB',
|
|
375
|
+
strokeWidth: 3,
|
|
376
|
+
label: 'IS',
|
|
377
|
+
},
|
|
378
|
+
// Initial LM
|
|
379
|
+
{
|
|
380
|
+
id: 'lm0',
|
|
381
|
+
type: 'line',
|
|
382
|
+
equation: '(k * x - M0) / h',
|
|
383
|
+
color: '#FCA5A5',
|
|
384
|
+
lineStyle: 'dashed',
|
|
385
|
+
strokeWidth: 2,
|
|
386
|
+
label: 'LM₀',
|
|
387
|
+
},
|
|
388
|
+
// New LM
|
|
389
|
+
{
|
|
390
|
+
id: 'lm1',
|
|
391
|
+
type: 'line',
|
|
392
|
+
equation: '(k * x - M1) / h',
|
|
393
|
+
color: '#DC2626',
|
|
394
|
+
strokeWidth: 3,
|
|
395
|
+
label: 'LM₁',
|
|
396
|
+
},
|
|
397
|
+
// Initial equilibrium
|
|
398
|
+
{
|
|
399
|
+
id: 'eq0',
|
|
400
|
+
type: 'point',
|
|
401
|
+
x: 'Y0',
|
|
402
|
+
y: 'r0',
|
|
403
|
+
color: '#6B7280',
|
|
404
|
+
label: 'E₀',
|
|
405
|
+
},
|
|
406
|
+
// New equilibrium
|
|
407
|
+
{
|
|
408
|
+
id: 'eq1',
|
|
409
|
+
type: 'point',
|
|
410
|
+
x: 'Y1',
|
|
411
|
+
y: 'r1',
|
|
412
|
+
color: '#16A34A',
|
|
413
|
+
size: 10,
|
|
414
|
+
label: 'E₁',
|
|
415
|
+
droplines: { x: true, y: true },
|
|
416
|
+
},
|
|
417
|
+
],
|
|
418
|
+
annotations: [
|
|
419
|
+
{
|
|
420
|
+
id: 'shift-label',
|
|
421
|
+
text: 'ΔM = ${dM} → LM shifts ${dM > 0 ? "right" : "left"}',
|
|
422
|
+
x: 'A * mult * 0.3',
|
|
423
|
+
y: 13,
|
|
424
|
+
color: '#DC2626',
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
id: 'result-label',
|
|
428
|
+
text: 'ΔY = ${Y1 - Y0:.0f}, Δr = ${r1 - r0:.1f}%',
|
|
429
|
+
x: 'Y1 * 0.8',
|
|
430
|
+
y: 'r1 - 1.5',
|
|
431
|
+
color: '#16A34A',
|
|
432
|
+
},
|
|
433
|
+
],
|
|
434
|
+
},
|
|
435
|
+
],
|
|
436
|
+
};
|
|
437
|
+
},
|
|
438
|
+
};
|
|
439
|
+
/**
|
|
440
|
+
* IS-LM Policy Mix
|
|
441
|
+
* Shows combined fiscal and monetary policy
|
|
442
|
+
*/
|
|
443
|
+
const isLmPolicyMix = {
|
|
444
|
+
id: 'is_lm_policy_mix',
|
|
445
|
+
name: 'IS-LM: Policy Mix',
|
|
446
|
+
description: 'Shows combined effects of fiscal and monetary policy on equilibrium.',
|
|
447
|
+
category: 'macro',
|
|
448
|
+
level: 'undergraduate',
|
|
449
|
+
tags: ['IS-LM', 'policy mix', 'fiscal policy', 'monetary policy', 'coordination'],
|
|
450
|
+
parameters: {
|
|
451
|
+
fiscalChange: {
|
|
452
|
+
type: 'number',
|
|
453
|
+
default: 30,
|
|
454
|
+
description: 'Change in government spending (ΔG)',
|
|
455
|
+
},
|
|
456
|
+
monetaryChange: {
|
|
457
|
+
type: 'number',
|
|
458
|
+
default: 50,
|
|
459
|
+
description: 'Change in money supply (ΔM)',
|
|
460
|
+
},
|
|
461
|
+
},
|
|
462
|
+
generate: (params) => {
|
|
463
|
+
const dG = params.fiscalChange ?? 30;
|
|
464
|
+
const dM = params.monetaryChange ?? 50;
|
|
465
|
+
return {
|
|
466
|
+
metadata: {
|
|
467
|
+
specVersion: '1.3',
|
|
468
|
+
title: 'IS-LM: Policy Mix',
|
|
469
|
+
description: 'Coordinated fiscal and monetary policy',
|
|
470
|
+
},
|
|
471
|
+
parameters: {
|
|
472
|
+
// Base parameters
|
|
473
|
+
A0: { value: 200, label: 'Initial Spending' },
|
|
474
|
+
M0: { value: 500, label: 'Initial Money Supply' },
|
|
475
|
+
c: { value: 0.8, label: 'MPC' },
|
|
476
|
+
b: { value: 50, label: 'Inv. Sensitivity' },
|
|
477
|
+
k: { value: 0.5, label: 'k' },
|
|
478
|
+
h: { value: 100, label: 'h' },
|
|
479
|
+
mult: { expression: '1 / (1 - c)', hidden: true },
|
|
480
|
+
// Policy changes
|
|
481
|
+
dG: { value: dG, label: 'ΔG', min: -50, max: 100 },
|
|
482
|
+
dM: { value: dM, label: 'ΔM', min: -100, max: 200 },
|
|
483
|
+
A1: { expression: 'A0 + dG', hidden: true },
|
|
484
|
+
M1: { expression: 'M0 + dM', hidden: true },
|
|
485
|
+
// Initial equilibrium
|
|
486
|
+
Y0: {
|
|
487
|
+
expression: '(A0 * h + b * M0 / k) / ((1 - c) * h / b + k)',
|
|
488
|
+
label: 'Initial Y',
|
|
489
|
+
readonly: true,
|
|
490
|
+
},
|
|
491
|
+
r0: {
|
|
492
|
+
expression: '(k * Y0 - M0) / h',
|
|
493
|
+
label: 'Initial r (%)',
|
|
494
|
+
readonly: true,
|
|
495
|
+
},
|
|
496
|
+
// Final equilibrium
|
|
497
|
+
Y1: {
|
|
498
|
+
expression: '(A1 * h + b * M1 / k) / ((1 - c) * h / b + k)',
|
|
499
|
+
label: 'Final Y',
|
|
500
|
+
readonly: true,
|
|
501
|
+
},
|
|
502
|
+
r1: {
|
|
503
|
+
expression: '(k * Y1 - M1) / h',
|
|
504
|
+
label: 'Final r (%)',
|
|
505
|
+
readonly: true,
|
|
506
|
+
},
|
|
507
|
+
},
|
|
508
|
+
charts: [
|
|
509
|
+
{
|
|
510
|
+
id: 'main',
|
|
511
|
+
title: 'Policy Mix Effect',
|
|
512
|
+
xAxis: { label: 'Income (Y)', min: 0, max: 'max(A0, A1) * mult * 1.4' },
|
|
513
|
+
yAxis: { label: 'Interest Rate (r)', min: -2, max: 15 },
|
|
514
|
+
elements: [
|
|
515
|
+
// Initial IS
|
|
516
|
+
{
|
|
517
|
+
id: 'is0',
|
|
518
|
+
type: 'line',
|
|
519
|
+
equation: 'A0 / b - x / (b * mult)',
|
|
520
|
+
color: '#93C5FD',
|
|
521
|
+
lineStyle: 'dashed',
|
|
522
|
+
label: 'IS₀',
|
|
523
|
+
},
|
|
524
|
+
// Final IS
|
|
525
|
+
{
|
|
526
|
+
id: 'is1',
|
|
527
|
+
type: 'line',
|
|
528
|
+
equation: 'A1 / b - x / (b * mult)',
|
|
529
|
+
color: '#2563EB',
|
|
530
|
+
strokeWidth: 3,
|
|
531
|
+
label: 'IS₁',
|
|
532
|
+
},
|
|
533
|
+
// Initial LM
|
|
534
|
+
{
|
|
535
|
+
id: 'lm0',
|
|
536
|
+
type: 'line',
|
|
537
|
+
equation: '(k * x - M0) / h',
|
|
538
|
+
color: '#FCA5A5',
|
|
539
|
+
lineStyle: 'dashed',
|
|
540
|
+
label: 'LM₀',
|
|
541
|
+
},
|
|
542
|
+
// Final LM
|
|
543
|
+
{
|
|
544
|
+
id: 'lm1',
|
|
545
|
+
type: 'line',
|
|
546
|
+
equation: '(k * x - M1) / h',
|
|
547
|
+
color: '#DC2626',
|
|
548
|
+
strokeWidth: 3,
|
|
549
|
+
label: 'LM₁',
|
|
550
|
+
},
|
|
551
|
+
// Initial equilibrium
|
|
552
|
+
{
|
|
553
|
+
id: 'eq0',
|
|
554
|
+
type: 'point',
|
|
555
|
+
x: 'Y0',
|
|
556
|
+
y: 'r0',
|
|
557
|
+
color: '#6B7280',
|
|
558
|
+
size: 8,
|
|
559
|
+
label: 'E₀',
|
|
560
|
+
},
|
|
561
|
+
// Final equilibrium
|
|
562
|
+
{
|
|
563
|
+
id: 'eq1',
|
|
564
|
+
type: 'point',
|
|
565
|
+
x: 'Y1',
|
|
566
|
+
y: 'r1',
|
|
567
|
+
color: '#16A34A',
|
|
568
|
+
size: 10,
|
|
569
|
+
label: 'E₁',
|
|
570
|
+
droplines: { x: true, y: true },
|
|
571
|
+
},
|
|
572
|
+
],
|
|
573
|
+
annotations: [
|
|
574
|
+
{
|
|
575
|
+
id: 'policy-label',
|
|
576
|
+
text: 'ΔG=${dG}, ΔM=${dM}',
|
|
577
|
+
x: 'A0 * mult * 0.3',
|
|
578
|
+
y: 13,
|
|
579
|
+
color: '#7C3AED',
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
id: 'change-label',
|
|
583
|
+
text: 'ΔY=${Y1-Y0:.0f}, Δr=${r1-r0:.2f}%',
|
|
584
|
+
x: '(Y0 + Y1) / 2',
|
|
585
|
+
y: 'max(r0, r1) + 1.5',
|
|
586
|
+
color: '#16A34A',
|
|
587
|
+
},
|
|
588
|
+
],
|
|
589
|
+
},
|
|
590
|
+
],
|
|
591
|
+
};
|
|
592
|
+
},
|
|
593
|
+
};
|
|
594
|
+
/**
|
|
595
|
+
* IS-LM-BP (Mundell-Fleming) Open Economy Model
|
|
596
|
+
* Shows equilibrium in open economy with capital mobility
|
|
597
|
+
*/
|
|
598
|
+
const mundellFleming = {
|
|
599
|
+
id: 'mundell_fleming',
|
|
600
|
+
name: 'Mundell-Fleming Model',
|
|
601
|
+
description: 'Open economy IS-LM-BP model with international capital flows and exchange rates.',
|
|
602
|
+
category: 'macro',
|
|
603
|
+
level: 'postgraduate',
|
|
604
|
+
tags: ['IS-LM', 'Mundell-Fleming', 'open economy', 'exchange rate', 'capital flows'],
|
|
605
|
+
parameters: {
|
|
606
|
+
capitalMobility: {
|
|
607
|
+
type: 'number',
|
|
608
|
+
default: 2,
|
|
609
|
+
description: 'Capital mobility (BP slope): 0=none, high=perfect',
|
|
610
|
+
},
|
|
611
|
+
worldInterestRate: {
|
|
612
|
+
type: 'number',
|
|
613
|
+
default: 5,
|
|
614
|
+
description: 'World interest rate (%)',
|
|
615
|
+
},
|
|
616
|
+
exchangeRegime: {
|
|
617
|
+
type: 'string',
|
|
618
|
+
default: 'flexible',
|
|
619
|
+
description: 'Exchange rate regime: fixed or flexible',
|
|
620
|
+
},
|
|
621
|
+
},
|
|
622
|
+
generate: (params) => {
|
|
623
|
+
const mobility = params.capitalMobility ?? 2;
|
|
624
|
+
const rWorld = params.worldInterestRate ?? 5;
|
|
625
|
+
return {
|
|
626
|
+
metadata: {
|
|
627
|
+
specVersion: '1.3',
|
|
628
|
+
title: 'Mundell-Fleming Model',
|
|
629
|
+
description: 'Open economy macroeconomic equilibrium',
|
|
630
|
+
},
|
|
631
|
+
parameters: {
|
|
632
|
+
// Structural parameters
|
|
633
|
+
A: { value: 200, label: 'Autonomous Spending' },
|
|
634
|
+
c: { value: 0.8, label: 'MPC' },
|
|
635
|
+
b: { value: 50, label: 'Inv. Sensitivity' },
|
|
636
|
+
m: { value: 0.2, label: 'Import Propensity' },
|
|
637
|
+
M: { value: 500, label: 'Money Supply' },
|
|
638
|
+
k: { value: 0.5, label: 'k' },
|
|
639
|
+
h: { value: 100, label: 'h' },
|
|
640
|
+
// Open economy
|
|
641
|
+
rW: { value: rWorld, label: 'World Interest Rate (%)', min: 0, max: 10 },
|
|
642
|
+
mobility: { value: mobility, label: 'Capital Mobility', min: 0, max: 10, step: 0.5 },
|
|
643
|
+
// Multiplier adjusted for open economy
|
|
644
|
+
mult: { expression: '1 / (1 - c + m)', label: 'Open Multiplier', readonly: true },
|
|
645
|
+
// Equilibrium
|
|
646
|
+
Y_eq: {
|
|
647
|
+
expression: '(A * h + b * M / k) / ((1 - c + m) * h / b + k)',
|
|
648
|
+
label: 'Equilibrium Y',
|
|
649
|
+
readonly: true,
|
|
650
|
+
},
|
|
651
|
+
r_eq: {
|
|
652
|
+
expression: '(k * Y_eq - M) / h',
|
|
653
|
+
label: 'Equilibrium r',
|
|
654
|
+
readonly: true,
|
|
655
|
+
},
|
|
656
|
+
// Balance of Payments Y at world rate
|
|
657
|
+
Y_BP: {
|
|
658
|
+
expression: 'rW / mobility * 100 + 200',
|
|
659
|
+
label: 'Y on BP curve',
|
|
660
|
+
readonly: true,
|
|
661
|
+
},
|
|
662
|
+
},
|
|
663
|
+
charts: [
|
|
664
|
+
{
|
|
665
|
+
id: 'main',
|
|
666
|
+
title: 'Mundell-Fleming (IS-LM-BP)',
|
|
667
|
+
xAxis: { label: 'Income (Y)', min: 0, max: 'A * mult * 1.5' },
|
|
668
|
+
yAxis: { label: 'Interest Rate (r)', min: 0, max: 15 },
|
|
669
|
+
elements: [
|
|
670
|
+
// IS curve (flatter due to imports)
|
|
671
|
+
{
|
|
672
|
+
id: 'is',
|
|
673
|
+
type: 'line',
|
|
674
|
+
equation: 'A / b - x / (b * mult)',
|
|
675
|
+
color: '#2563EB',
|
|
676
|
+
strokeWidth: 3,
|
|
677
|
+
label: 'IS',
|
|
678
|
+
},
|
|
679
|
+
// LM curve
|
|
680
|
+
{
|
|
681
|
+
id: 'lm',
|
|
682
|
+
type: 'line',
|
|
683
|
+
equation: '(k * x - M) / h',
|
|
684
|
+
color: '#DC2626',
|
|
685
|
+
strokeWidth: 3,
|
|
686
|
+
label: 'LM',
|
|
687
|
+
},
|
|
688
|
+
// BP curve (slope depends on capital mobility)
|
|
689
|
+
{
|
|
690
|
+
id: 'bp',
|
|
691
|
+
type: 'line',
|
|
692
|
+
equation: 'rW + mobility * (x - 400) / 100',
|
|
693
|
+
color: '#16A34A',
|
|
694
|
+
strokeWidth: 3,
|
|
695
|
+
label: 'BP',
|
|
696
|
+
curveLabel: { text: 'BP', x: 'A * mult * 0.9', position: 'above' },
|
|
697
|
+
},
|
|
698
|
+
// Equilibrium
|
|
699
|
+
{
|
|
700
|
+
id: 'equilibrium',
|
|
701
|
+
type: 'point',
|
|
702
|
+
x: 'Y_eq',
|
|
703
|
+
y: 'r_eq',
|
|
704
|
+
color: '#7C3AED',
|
|
705
|
+
size: 10,
|
|
706
|
+
label: 'E',
|
|
707
|
+
droplines: { x: true, y: true },
|
|
708
|
+
},
|
|
709
|
+
// World rate reference
|
|
710
|
+
{
|
|
711
|
+
id: 'world-rate',
|
|
712
|
+
type: 'horizontalLine',
|
|
713
|
+
y: 'rW',
|
|
714
|
+
color: '#F59E0B',
|
|
715
|
+
lineStyle: 'dotted',
|
|
716
|
+
strokeWidth: 1,
|
|
717
|
+
},
|
|
718
|
+
],
|
|
719
|
+
annotations: [
|
|
720
|
+
{
|
|
721
|
+
id: 'bp-label',
|
|
722
|
+
text: 'BP (Capital Mobility = ${mobility})',
|
|
723
|
+
x: 'A * mult * 0.5',
|
|
724
|
+
y: 'rW + mobility * (A * mult * 0.5 - 400) / 100 + 1',
|
|
725
|
+
color: '#16A34A',
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
id: 'world-rate-label',
|
|
729
|
+
text: 'r* (world) = ${rW}%',
|
|
730
|
+
x: 'A * mult * 0.2',
|
|
731
|
+
y: 'rW + 0.5',
|
|
732
|
+
color: '#F59E0B',
|
|
733
|
+
},
|
|
734
|
+
],
|
|
735
|
+
},
|
|
736
|
+
],
|
|
737
|
+
};
|
|
738
|
+
},
|
|
739
|
+
};
|
|
740
|
+
export const isLmTemplates = [
|
|
741
|
+
isLmBasic,
|
|
742
|
+
isLmFiscalPolicy,
|
|
743
|
+
isLmMonetaryPolicy,
|
|
744
|
+
isLmPolicyMix,
|
|
745
|
+
mundellFleming,
|
|
746
|
+
];
|
|
747
|
+
//# sourceMappingURL=isLM.js.map
|