Table Row (tr) |
---|
| Table Head (th) |
---|
| Method Details |
|
Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
addPolynomial |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| void |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| addPolynomial |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Adds another polynomial to this polynomial. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters polynomial |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// (x+1) + 2*(x+1)*x + 3*(x+1)*x^2 + 4*(x+1)*x^3
var eq = plugins.amortization.newPolynomial();
for (var i = 0; i < 4; i++)
{
var base = plugins.amortization.newPolynomial();
base.addTerm(1, 1);
base.addTerm(1, 0);
base.multiplyByTerm(1, i);
base.multiplyByTerm(i + 1, 0);
eq.addPolynomial(base);
}
application.output(eq.getValue(2));
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=addTerm|class=node}{tr:id=name}{td}h6.addTerm{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}addTerm{span}{span:id=iets|style=float: left;}\(coefficient, exponent){span}{td}{tr}{tr:id=des}{td}Adds a term to this polynomial.{td}{tr}{tr:id=prs}{td}*Parameters*\\coefficient
exponent
{td}{tr}{tr:id=ret}{td}*Returns*\\void{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| void |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| addTerm |
Span |
---|
| (coefficient, exponent) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Adds a term to this polynomial. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters coefficient exponent |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// Model the quadratic equation -x^2 + 4x + 0.6 = 0
var eq = plugins.amortization.newPolynomial();
eq.addTerm(-1, 2);
eq.addTerm(4, 1);
eq.addTerm(0.6, 0);
// Find the roots of the equation.
r1 = eq.findRoot(100, 1E-5, 1000);
r2 = eq.findRoot(-100, 1E-5, 1000);
application.output("eq(" + r1 + ")=" + eq.getValue(r1));
application.output("eq(" + r2 + ")=" + eq.getValue(r2));
// Find the minimum/maximum point by zeroing the first derivative.
var deriv = eq.getDerivative();
rd = deriv.findRoot(0, 1E-5, 1000);
application.output("Min/max point: " + rd);
application.output("Min/max value: " + eq.getValue(rd));
if (deriv.getDerivativeValue(rd) < 0) application.output("Max point.");
else application.output("Min point.");
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=findRoot|class=node}{tr:id=name}{td}h6.findRoot{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Number]{span}{span:id=iets|style=float: left; font-weight: bold;}findRoot{span}{span:id=iets|style=float: left;}\(startValue, error, iterations){span}{td}{tr}{tr:id=des}{td}Finds a root of this polynomial using Newton's method, starting from an initial search value, and with a given precision.{td}{tr}{tr:id=prs}{td}*Parameters*\\startValue
error
iterations
{td}{tr}{tr:id=ret}{td}*Returns*\\ [Number]{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Number |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| findRoot |
Span |
---|
| (startValue, error, iterations) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Finds a root of this polynomial using Newton's method, starting from an initial search value, and with a given precision. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters startValue error iterations |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// Model the quadratic equation -x^2 + 4x + 0.6 = 0
var eq = plugins.amortization.newPolynomial();
eq.addTerm(-1, 2);
eq.addTerm(4, 1);
eq.addTerm(0.6, 0);
// Find the roots of the equation.
r1 = eq.findRoot(100, 1E-5, 1000);
r2 = eq.findRoot(-100, 1E-5, 1000);
application.output("eq(" + r1 + ")=" + eq.getValue(r1));
application.output("eq(" + r2 + ")=" + eq.getValue(r2));
// Find the minimum/maximum point by zeroing the first derivative.
var deriv = eq.getDerivative();
rd = deriv.findRoot(0, 1E-5, 1000);
application.output("Min/max point: " + rd);
application.output("Min/max value: " + eq.getValue(rd));
if (deriv.getDerivativeValue(rd) < 0) application.output("Max point.");
else application.output("Min point.");
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getDerivative|class=node}{tr:id=name}{td}h6.getDerivative{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Polynomial]{span}{span:id=iets|style=float: left; font-weight: bold;}getDerivative{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}Returns a polynomial that holds the derivative of this polynomial.{td}{tr}{tr:id=ret}{td}*Returns*\\ [Polynomial]{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getDerivative |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Polynomial |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getDerivative |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns a polynomial that holds the derivative of this polynomial. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// Model the quadratic equation -x^2 + 4x + 0.6 = 0
var eq = plugins.amortization.newPolynomial();
eq.addTerm(-1, 2);
eq.addTerm(4, 1);
eq.addTerm(0.6, 0);
// Find the roots of the equation.
r1 = eq.findRoot(100, 1E-5, 1000);
r2 = eq.findRoot(-100, 1E-5, 1000);
application.output("eq(" + r1 + ")=" + eq.getValue(r1));
application.output("eq(" + r2 + ")=" + eq.getValue(r2));
// Find the minimum/maximum point by zeroing the first derivative.
var deriv = eq.getDerivative();
rd = deriv.findRoot(0, 1E-5, 1000);
application.output("Min/max point: " + rd);
application.output("Min/max value: " + eq.getValue(rd));
if (deriv.getDerivativeValue(rd) < 0) application.output("Max point.");
else application.output("Min point.");
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getDerivativeValue|class=node}{tr:id=name}{td}h6.getDerivativeValue{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Number]{span}{span:id=iets|style=float: left; font-weight: bold;}getDerivativeValue{span}{span:id=iets|style=float: left;}\(x){span}{td}{tr}{tr:id=des}{td}Returns the value of the derivative of this polynomial in a certain point.{td}{tr}{tr:id=prs}{td}*Parameters*\\x
{td}{tr}{tr:id=ret}{td}*Returns*\\ [Number]{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
id | getDerivativeValue |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
getDerivativeValue |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Number |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getDerivativeValue |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns the value of the derivative of this polynomial in a certain point. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters x |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// Model the quadratic equation -x^2 + 4x + 0.6 = 0
var eq = plugins.amortization.newPolynomial();
eq.addTerm(-1, 2);
eq.addTerm(4, 1);
eq.addTerm(0.6, 0);
// Find the roots of the equation.
r1 = eq.findRoot(100, 1E-5, 1000);
r2 = eq.findRoot(-100, 1E-5, 1000);
application.output("eq(" + r1 + ")=" + eq.getValue(r1));
application.output("eq(" + r2 + ")=" + eq.getValue(r2));
// Find the minimum/maximum point by zeroing the first derivative.
var deriv = eq.getDerivative();
rd = deriv.findRoot(0, 1E-5, 1000);
application.output("Min/max point: " + rd);
application.output("Min/max value: " + eq.getValue(rd));
if (deriv.getDerivativeValue(rd) < 0) application.output("Max point.");
else application.output("Min point.");
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=getValue|class=node}{tr:id=name}{td}h6.getValue{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}[Number]{span}{span:id=iets|style=float: left; font-weight: bold;}getValue{span}{span:id=iets|style=float: left;}\(x){span}{td}{tr}{tr:id=des}{td}Returns the value of this polynomial in a certain point.{td}{tr}{tr:id=prs}{td}*Parameters*\\x
{td}{tr}{tr:id=ret}{td}*Returns*\\ [Number]{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| Number |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| getValue |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns the value of this polynomial in a certain point. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters x |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// Model the quadratic equation -x^2 + 4x + 0.6 = 0
var eq = plugins.amortization.newPolynomial();
eq.addTerm(-1, 2);
eq.addTerm(4, 1);
eq.addTerm(0.6, 0);
// Find the roots of the equation.
r1 = eq.findRoot(100, 1E-5, 1000);
r2 = eq.findRoot(-100, 1E-5, 1000);
application.output("eq(" + r1 + ")=" + eq.getValue(r1));
application.output("eq(" + r2 + ")=" + eq.getValue(r2));
// Find the minimum/maximum point by zeroing the first derivative.
var deriv = eq.getDerivative();
rd = deriv.findRoot(0, 1E-5, 1000);
application.output("Min/max point: " + rd);
application.output("Min/max value: " + eq.getValue(rd));
if (deriv.getDerivativeValue(rd) < 0) application.output("Max point.");
else application.output("Min point.");
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=multiplyByPolynomial|class=node}{tr:id=name}{td}h6.multiplyByPolynomial{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}multiplyByPolynomial{span}{span:id=iets|style=float: left;}\(polynomial){span}{td}{tr}{tr:id=des}{td}Multiplies this polynomial with another polynomial.{td}{tr}{tr:id=prs}{td}*Parameters*\\polynomial
{td}{tr}{tr:id=ret}{td}*Returns*\\void{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
id | multiplyByPolynomial |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
multiplyByPolynomial |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| void |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| multiplyByPolynomial |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Multiplies this polynomial with another polynomial. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters polynomial |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// Model the quadratic equation (x+1)*(x+2) = 0
var eq = plugins.amortization.newPolynomial();
eq.addTerm(1, 1);
eq.addTerm(1, 0);
var eq2 = plugins.amortization.newPolynomial();
eq2.addTerm(1, 1);
eq2.addTerm(2, 0);
eq.multiplyByPolynomial(eq2);
// Find the roots of the equation.
r1 = eq.findRoot(100, 1E-5, 1000);
r2 = eq.findRoot(-100, 1E-5, 1000);
application.output("eq(" + r1 + ")=" + eq.getValue(r1));
application.output("eq(" + r2 + ")=" + eq.getValue(r2));
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=multiplyByTerm|class=node}{tr:id=name}{td}h6.multiplyByTerm{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}multiplyByTerm{span}{span:id=iets|style=float: left;}\(coefficient, exponent){span}{td}{tr}{tr:id=des}{td}Multiples this polynomial with a term.{td}{tr}{tr:id=prs}{td}*Parameters*\\coefficient
exponent
{td}{tr}{tr:id=ret}{td}*Returns*\\void{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
id | multiplyByTerm |
---|
class | node |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
multiplyByTerm |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| void |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| multiplyByTerm |
Span |
---|
| (coefficient, exponent) |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Multiples this polynomial with a term. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Parameters coefficient exponent |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
// (x+1) + 2*(x+1)*x + 3*(x+1)*x^2 + 4*(x+1)*x^3
var eq = plugins.amortization.newPolynomial();
for (var i = 0; i < 4; i++)
{
var base = plugins.amortization.newPolynomial();
base.addTerm(1, 1);
base.addTerm(1, 0);
base.multiplyByTerm(1, i);
base.multiplyByTerm(i + 1, 0);
eq.addPolynomial(base);
}
application.output(eq.getValue(2));
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{tbody:id=setToZero|class=node}{tr:id=name}{td}h6.setToZero{td}{tr}{tr:id=sig}{td}{span:style=float: left; margin-right: 5px;}void{span}{span:id=iets|style=float: left; font-weight: bold;}setToZero{span}{span:id=iets|style=float: left;}\(){span}{td}{tr}{tr:id=des}{td}Sets this polynomial to zero.{td}{tr}{tr:id=ret}{td}*Returns*\\void{td}{tr}{tr:id=sam}{td}*Sample*\\{div:class=sIndent}{code:language=javascript} Table Body (tbody) |
---|
| Table Row (tr) |
---|
| Table Cell (td) |
---|
Span |
---|
style | float: left; margin-right: 5px; |
---|
| void |
Span |
---|
style | float: left; font-weight: bold; |
---|
id | iets |
---|
| setToZero |
|
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sets this polynomial to zero. |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Returns void |
|
Table Row (tr) |
---|
| Table Cell (td) |
---|
Sample
Div |
---|
| Code Block |
---|
|
var eq = plugins.amortization.newPolynomial();
eq.addTerm(2, 3);
application.output(eq.getValue(1.1));
eq.setToZero();
application.output(eq.getValue(1.1));
|
|
|
|
| {code}{div}{td}{tr}{tr:class=lastDetailRow}{td}{td}{tr}{tbody}{table} |