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

Commit

Permalink
Merge pull request #474 from ccnmtl/fix-nlds
Browse files Browse the repository at this point in the history
NLDS alternative function: make the function X with respect to K
  • Loading branch information
nbuonin authored Mar 5, 2019
2 parents 6397c11 + f14f389 commit cd9de83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/Graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ class NonLinearDemandSupplyGraph extends Graph {
f2Shadow = function(x) {
return alpha *
(me.options.gCobbDouglasAInitial *
me.options.gCobbDouglasKInitial ** (alpha - 1)) *
(x ** (1 - alpha));
x ** (alpha - 1)) *
(me.options.gCobbDouglasKInitial ** (1 - alpha));
};
}

Expand Down Expand Up @@ -467,8 +467,8 @@ class NonLinearDemandSupplyGraph extends Graph {
f = function(x) {
return alpha *
(me.options.gCobbDouglasA *
me.options.gCobbDouglasK ** (alpha - 1)) *
(x ** (1 - alpha));
x ** (alpha - 1)) *
(me.options.gCobbDouglasK ** (1 - alpha));
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/editors/NonLinearDemandSupplyEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class NonLinearDemandSupplyEditor extends React.Component {
}
render() {
const func1 = `MP_N = (1 - α)${this.props.gCobbDouglasAName}${this.props.gCobbDouglasKName}^α N^{-α}`;
const func2 = `MP_${this.props.gCobbDouglasKName} = α${this.props.gCobbDouglasAName}${this.props.gCobbDouglasKName}^{α - 1} N^{1 - α}`;
const func2 = `MP_${this.props.gCobbDouglasKName} = α${this.props.gCobbDouglasAName}K^{α - 1} N^{1 - α}`;
return (
<div>
{this.props.isInstructor && (
Expand Down Expand Up @@ -111,7 +111,9 @@ export default class NonLinearDemandSupplyEditor extends React.Component {
</div>
<div className="col-sm-4">
<label htmlFor="gCobbDouglasK">
{this.props.isInstructor ? (
{this.props.gFunctionChoice === 1 && 'N'}
{this.props.gFunctionChoice !== 1 &&
(this.props.isInstructor ? (
<input type="text"
id="gCobbDouglasKName"
maxLength="1"
Expand All @@ -122,7 +124,7 @@ export default class NonLinearDemandSupplyEditor extends React.Component {
/>
) : (
this.props.gCobbDouglasKName
)}
))}
</label>
<RangeEditor
dataId="gCobbDouglasK"
Expand Down

0 comments on commit cd9de83

Please sign in to comment.