package com.powerdata.openpa.tools;

/**
 * Complex number in polar form
 * 
 * @author chris@powerdata.com
 *
 */

public class PComplex
{
	private float _r;
	private float _theta;
	
	public static final Complex Zero = new Complex(0,0);

	public PComplex(float r, float theta)
	{
		_r = r;
		_theta = theta;
	}

	public float r() {return _r;}
	public float theta() {return _theta;}
	
	public PComplex mult(PComplex v) {return new PComplex(_r*v.r(), _theta+v.theta());}
	public PComplex mult(Complex v) {return mult(v.polar());}

	public PComplex div(PComplex v) {return new PComplex(_r/v.r(), _theta-v.theta());}
	
	public Complex cartesian()
	{
		return new Complex((float) (_r * Math.cos(_theta)),
				(float) (_r * Math.sin(_theta)));
	}
}



@@ -198,16 +198,17 @@
 c final 
+P
 Complex 
@@ -214,24 +214,25 @@
  Zero = new 
+P
 Complex(0,0)
@@ -491,126 +491,465 @@
 ult(
-Complex v) %7Breturn mult(v.polar());%7D%0A%0A%09public PComplex div(PComplex v) %7Breturn new PComplex(_r/v.r(), _theta-v.theta()
+float r, float theta) %7Breturn new PComplex(_r*r, _theta + theta);%7D%0A%09public PComplex mult(float scalar) %7Breturn new PComplex(_r * scalar, _theta);%7D%0A%0A%09public PComplex div(PComplex v) %7Breturn new PComplex(_r/v.r(), _theta-v.theta());%7D%0A%09public PComplex div(float r, float theta) %7Breturn new PComplex(_r/r, _theta/theta);%7D%0A%09public PComplex div(float scalar) %7Breturn new PComplex(_r / scalar, _theta);%7D%0A%09%0A%09public PComplex inv() %7Breturn new PComplex(1F/_r, -_theta
 );%7D%0A

add remaining methods for polar form of complex