import java.awt.*;

public class TestFrame extends BufferedFrameWithExit implements FunctionRnRn{


	public TestFrame(){
		super("Aufgabe 5 - Das Newtonverfahren graphisch dargestellt");
		FunctionPlotter plotterCanvas = new FunctionPlotter(this);
		add(plotterCanvas); 
 		pack();
		show();

	}

	public static void main(String args[]){
		new TestFrame();
	
	}



	/**
     *returns the value 
     *f(x)=y
     */
    public Vektor f(Vektor _x){
		Vektor res = new Vektor(2);
		double x = _x.getElement(0);
		double y = _x.getElement(1);
		res.setElement((x*x*x)-(3.0*x*y*y)-(1.0),0);
		res.setElement((3.0*x*x*y)-(y*y*y),1);
		return res;
	}

    /**
     *returns the value fp(x)=y
     *...
     */
    public QuadMatrix fp(Vektor _x){
		double x = _x.getElement(0);
		double y = _x.getElement(1);
		QuadMatrix res = new QuadMatrix(2);
		res.setElement((3.0*x*x)-(3.0*y*y),0,0);
		res.setElement((6.0)*(x*y),1,0);
		res.setElement((-6.0)*y*x,0,1);
		res.setElement((3.0*x*x)-(3.0*y*y),1,1); 
		return res;
	}



}
