1 package JSci.maths.fields; 2 3 import JSci.maths.Complex; 4 import JSci.maths.groups.AbelianGroup; 5 6 11 public final class ComplexField extends Object implements Field { 12 public static final Complex ZERO=new Complex(0.0,0.0); 13 public static final Complex I=new Complex(0.0,1.0); 14 public static final Complex ONE=new Complex(1.0,0.0); 15 public static final Complex MINUS_ONE=new Complex(-1.0,0.0); 16 public static final Complex MINUS_I=new Complex(0.0,-1.0); 17 public static final Complex HALF=new Complex(0.5,0.0); 18 public static final Complex MINUS_HALF=new Complex(-0.5,0.0); 19 public static final Complex HALF_I=new Complex(0.0,0.5); 20 public static final Complex MINUS_HALF_I=new Complex(0.0,-0.5); 21 public static final Complex TWO=new Complex(2.0,0.0); 22 public static final Complex MINUS_TWO=new Complex(-2.0,0.0); 23 public static final Complex SQRT_HALF=new Complex(Math.sqrt(0.5),0.0); 24 public static final Complex SQRT_HALF_I=new Complex(0.0,Math.sqrt(0.5)); 25 public static final Complex MINUS_SQRT_HALF_I=new Complex(0.0,-Math.sqrt(0.5)); 26 public static final Complex PI=new Complex(Math.PI,0.0); 27 public static final Complex PI_I=new Complex(0.0,Math.PI); 28 public static final Complex PI_2=new Complex(Math.PI/2.0,0.0); 29 public static final Complex MINUS_PI_2=new Complex(-Math.PI/2.0,0.0); 30 public static final Complex PI_2_I=new Complex(0.0,Math.PI/2.0); 31 public static final Complex MINUS_PI_2_I=new Complex(0.0,-Math.PI/2.0); 32 33 private final static ComplexField _instance = new ComplexField(); 34 37 private ComplexField() {} 38 42 public static final ComplexField getInstance() { 43 return _instance; 44 } 45 48 public AbelianGroup.Member zero() { 49 return ZERO; 50 } 51 54 public boolean isZero(AbelianGroup.Member g) { 55 return ZERO.equals(g); 56 } 57 60 public boolean isNegative(AbelianGroup.Member a,AbelianGroup.Member b) { 61 return ZERO.equals(a.add(b)); 62 } 63 66 public Ring.Member one() { 67 return ONE; 68 } 69 72 public boolean isOne(Ring.Member r) { 73 return ONE.equals(r); 74 } 75 78 public boolean isInverse(Field.Member a, Field.Member b) { 79 return ONE.equals(a.multiply(b)); 80 } 81 } 82 83 | Popular Tags |