// Model the quadratic equation -x^2 + 4x + 0.6 = 0var 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.");elseapplication.output("Min point.");
getDerivative()
Returns a polynomial that holds the derivative of this polynomial.
// Model the quadratic equation -x^2 + 4x + 0.6 = 0var 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.");elseapplication.output("Min point.");
getDerivativeValue(x)
Returns the value of the derivative of this polynomial in a certain point.
// Model the quadratic equation -x^2 + 4x + 0.6 = 0var 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.");elseapplication.output("Min point.");
getValue(x)
Returns the value of this polynomial in a certain point.
// Model the quadratic equation -x^2 + 4x + 0.6 = 0var 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.");elseapplication.output("Min point.");
multiplyByPolynomial(polynomial)
Multiplies this polynomial with another polynomial.
// Model the quadratic equation (x+1)*(x+2) = 0var 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));