Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit cd9de83

Browse files
authored
Merge pull request #474 from ccnmtl/fix-nlds
NLDS alternative function: make the function X with respect to K
2 parents 6397c11 + f14f389 commit cd9de83

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/Graph.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ class NonLinearDemandSupplyGraph extends Graph {
407407
f2Shadow = function(x) {
408408
return alpha *
409409
(me.options.gCobbDouglasAInitial *
410-
me.options.gCobbDouglasKInitial ** (alpha - 1)) *
411-
(x ** (1 - alpha));
410+
x ** (alpha - 1)) *
411+
(me.options.gCobbDouglasKInitial ** (1 - alpha));
412412
};
413413
}
414414

@@ -467,8 +467,8 @@ class NonLinearDemandSupplyGraph extends Graph {
467467
f = function(x) {
468468
return alpha *
469469
(me.options.gCobbDouglasA *
470-
me.options.gCobbDouglasK ** (alpha - 1)) *
471-
(x ** (1 - alpha));
470+
x ** (alpha - 1)) *
471+
(me.options.gCobbDouglasK ** (1 - alpha));
472472
};
473473
}
474474

src/editors/NonLinearDemandSupplyEditor.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default class NonLinearDemandSupplyEditor extends React.Component {
1717
}
1818
render() {
1919
const func1 = `MP_N = (1 - α)${this.props.gCobbDouglasAName}${this.props.gCobbDouglasKName}^α N^{-α}`;
20-
const func2 = `MP_${this.props.gCobbDouglasKName} = α${this.props.gCobbDouglasAName}${this.props.gCobbDouglasKName}^{α - 1} N^{1 - α}`;
20+
const func2 = `MP_${this.props.gCobbDouglasKName} = α${this.props.gCobbDouglasAName}K^{α - 1} N^{1 - α}`;
2121
return (
2222
<div>
2323
{this.props.isInstructor && (
@@ -111,7 +111,9 @@ export default class NonLinearDemandSupplyEditor extends React.Component {
111111
</div>
112112
<div className="col-sm-4">
113113
<label htmlFor="gCobbDouglasK">
114-
{this.props.isInstructor ? (
114+
{this.props.gFunctionChoice === 1 && 'N'}
115+
{this.props.gFunctionChoice !== 1 &&
116+
(this.props.isInstructor ? (
115117
<input type="text"
116118
id="gCobbDouglasKName"
117119
maxLength="1"
@@ -122,7 +124,7 @@ export default class NonLinearDemandSupplyEditor extends React.Component {
122124
/>
123125
) : (
124126
this.props.gCobbDouglasKName
125-
)}
127+
))}
126128
</label>
127129
<RangeEditor
128130
dataId="gCobbDouglasK"

0 commit comments

Comments
 (0)