/*
	Komplexe Zahlen
	Physik

*/

public class Complex
{
	double x,y;


	// Konstruktor
	Complex(double x, double y)
	{
		this.x = x;
		this.y = y;
	}


	Complex add(Complex b)
	{
		Complex res = new Complex(this.x+b.x, this.y+b.y);
		return res;
	}

	Complex sub(Complex b)
	{
		Complex res = new Complex(this.x-b.x, this.y-b.y);
		return res;
	}

	Complex mult(Complex b)
	{
		Complex res = new Complex((this.x*b.x)-(this.y*b.y), (this.x*b.y)+(b.x*this.y));
		return res;
	}

	Complex div(Complex b)
	{
		Complex zaehler = mult(b.konj());
		Complex nenner = b.mult(b.konj());
		return new Complex(zaehler.x/nenner.x, zaehler.y/nenner.x);
	}

	Complex konj()
	{
		return new Complex(this.x, - this.y);
	}

	double norm()
	{
		return Math.sqrt(this.x*this.x+this.y*this.y);
	}
}