/*---------------------------------------------------------------
¦	Komplexe Zahlen
----------------------------------------------------------------*/


public class Complex
{
//-----------Datenkomponenten------------------------------------
	public double x, y;

//-----------Konstruktor-----------------------------------------
	public Complex(double x, double y)
	{
		this.x = x;
		this.y = y;
	}

//-----------Methoden--------------------------------------------

	//-------a+b-------------------------------------------------
	public Complex add(Complex b)
	{
		return new Complex(this.x+b.x, this.y+b.y);
	}

	//-------a-b-------------------------------------------------
	public Complex sub(Complex b)
	{
		return new Complex(this.x-b.x, this.y-b.y);
	}

	//-------a*b-------------------------------------------------
	public Complex mult(Complex b)
	{
		return new Complex((this.x*b.x-this.y*b.y), (this.x*b.y+b.x*this.y));
	}

	//-------a/b-------------------------------------------------
	public Complex div(Complex b)
	{
		return new Complex(((this.x*b.x+this.y*b.y)/(b.x*b.x+b.y*b.y)), ((b.x*this.y-this.x*b.y)/(b.x*b.x+b.y*b.y)));
	}

	//-------a*--------------------------------------------------
	public Complex konj()
	{
		return new Complex(this.x, -this.y);
	}

	//-------|a|-------------------------------------------------
	public double norm()
	{
		return Math.sqrt(this.x*this.x+this.y*this.y);
	}

}
