package jasext.hist.function;

import jas2.hist.*;

public class QuadraticFunction extends AbstractPolynomialFunction 
{
	QuadraticFunction(double[] coefficients)
	{
		p = coefficients;
	}
	public QuadraticFunction(double xmin, double xmax, double ymin, double ymax)
	{
		order = 2;
		p = new double[3];
		final double xVertex = (xmax - xmin) / 2.0;
		p[0]/*a*/ = (ymax - ymin) / Math.pow(xmax - xVertex, 2);
		p[1]/*b*/ = -p[0]/*a*/ * (xmax - xmin);
		p[2]/*c*/ = ymin - p[0]/*a*/ * xVertex * xVertex - p[1]/*b*/ * xVertex;
	}
	public String getTitle()
	{
		return "Quadratic";
	}
}

 

Ads help maintain this website.