@@ -71,30 +71,70 @@ const ep3 = function(a, b, c, d) {
71
71
72
72
const eq3 = function(a, b, c, d) {
73
73
return (a - c) / (b + d);
74
- };*/
74
+ };*/
75
+
76
+ const sq3 = function ( a , b , c , d , f , g ) {
77
+ return ( a - c + f ) / ( b + d + g ) ;
78
+ } ;
79
+
80
+ const sp3 = function ( a , b , c , d , f , g ) {
81
+ return smb3 ( a , b , f , g , sq3 ( a , b , c , d , f , g ) ) ;
82
+ } ;
83
+
84
+ const spoint3 = function ( a , b , c , d , f , g ) {
85
+ return [ sq3 ( a , b , c , d , f , g ) , sp3 ( a , b , c , d , f , g ) ] ;
86
+ } ;
87
+
88
+ const shint3 = function ( a , b , c , d , f , g ) {
89
+ return [ 0 , sp3 ( a , b , c , d , f , g ) ] ;
90
+ } ;
91
+
92
+ const svint3 = function ( a , b , c , d , f , g ) {
93
+ return [ sq3 ( a , b , c , d , f , g ) , 0 ] ;
94
+ } ;
95
+
96
+ const ep3 = function ( a , b , c , d ) {
97
+ return ( b * c + a * d ) / ( b + d ) ;
98
+ } ;
99
+
100
+ const eq3 = function ( a , b , c , d ) {
101
+ return ( a - c ) / ( b + d ) ;
102
+ } ;
103
+
104
+ const epoint3 = function ( a , b , c , d ) {
105
+ return [ eq3 ( a , b , c , d ) , ep3 ( a , b , c , d ) ] ;
106
+ } ;
107
+
108
+ const ehint3 = function ( a , b , c , d ) {
109
+ return [ 0 , ep3 ( a , b , c , d ) ] ;
110
+ } ;
111
+
112
+ const evint3 = function ( a , b , c , d ) {
113
+ return [ eq3 ( a , b , c , d ) , 0 ] ;
114
+ } ;
75
115
76
116
export class PositiveExternalityIndustryGraph extends Graph {
77
- static getGraphPane ( gFunctionChoice ) {
117
+ static getGraphPane ( gFunctionChoice , gA1 , gA2 , gA3 , gA4 , gA5 , gA6 ) {
78
118
return [
79
119
{
80
120
label : 'Unregulated Output Q*' ,
81
121
color : 'red' ,
82
- value : 240
122
+ value : eq3 ( gA1 , gA2 , gA3 , gA4 ) . toFixed ( 2 )
83
123
} ,
84
124
{
85
125
label : 'Unregulated Price P*' ,
86
126
color : 'red' ,
87
- value : 120
127
+ value : ep3 ( gA1 , gA2 , gA3 , gA4 ) . toFixed ( 2 )
88
128
} ,
89
129
{
90
130
label : 'Socially Desirable Output q<sup>soc</sup>' ,
91
131
color : 'orange' ,
92
- value : 266.667
132
+ value : sq3 ( gA1 , gA2 , gA3 , gA4 , gA5 , gA6 ) . toFixed ( 2 )
93
133
} ,
94
134
{
95
135
label : 'Socially Desirable Price P<sup>soc</sup>' ,
96
136
color : 'orange' ,
97
- value : 133.333
137
+ value : sp3 ( gA1 , gA2 , gA3 , gA4 , gA5 , gA6 ) . toFixed ( 2 )
98
138
} ,
99
139
] ;
100
140
}
@@ -179,6 +219,56 @@ export class PositiveExternalityIndustryGraph extends Graph {
179
219
highlight : false
180
220
}
181
221
) ;
222
+
223
+ if ( this . options . gShowIntersection ) {
224
+ const spointEvaluated = spoint3 (
225
+ this . options . gA1 , this . options . gA2 , this . options . gA3 ,
226
+ this . options . gA4 , this . options . gA5 , this . options . gA6 ) ;
227
+
228
+ this . showIntersection (
229
+ this . board . create ( 'line' , [
230
+ shint3 (
231
+ this . options . gA1 , this . options . gA2 , this . options . gA3 ,
232
+ this . options . gA4 , this . options . gA5 , this . options . gA6 ) ,
233
+ spointEvaluated
234
+ ] , {
235
+ visible : false
236
+ } ) ,
237
+ this . board . create ( 'line' , [
238
+ svint3 (
239
+ this . options . gA1 , this . options . gA2 , this . options . gA3 ,
240
+ this . options . gA4 , this . options . gA5 , this . options . gA6 ) ,
241
+ spointEvaluated
242
+ ] , {
243
+ visible : false
244
+ } ) ,
245
+ false , 'Social' , null , 'Q<sup>soc</sup>' ,
246
+ false , false , this . l1Color ) ;
247
+
248
+ const epointEvaluated = epoint3 (
249
+ this . options . gA1 , this . options . gA2 , this . options . gA3 ,
250
+ this . options . gA4 ) ;
251
+
252
+ this . showIntersection (
253
+ this . board . create ( 'line' , [
254
+ ehint3 (
255
+ this . options . gA1 , this . options . gA2 , this . options . gA3 ,
256
+ this . options . gA4 ) ,
257
+ epointEvaluated
258
+ ] , {
259
+ visible : false
260
+ } ) ,
261
+ this . board . create ( 'line' , [
262
+ evint3 (
263
+ this . options . gA1 , this . options . gA2 , this . options . gA3 ,
264
+ this . options . gA4 ) ,
265
+ epointEvaluated
266
+ ] , {
267
+ visible : false
268
+ } ) ,
269
+ false , 'Market' , null , 'Q' ,
270
+ false , false , this . l4Color ) ;
271
+ }
182
272
}
183
273
}
184
274
0 commit comments