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

NLDS alternative function: make the function X with respect to K #474

Merged
merged 1 commit into from
Mar 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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