List of usage examples for org.apache.commons.math.complex Complex Complex
public Complex(double real, double imaginary)
From source file:com.discursive.jccook.math.ComplexNumbers.java
public static void main(String[] args) { Complex a = new Complex(2, 3); Complex b = new Complex(4, 5); Complex c = new Complex(0.3, 2); Complex e = new Complex(4, 4); Complex sum = a.add(b);//from w w w . jav a 2 s . c o m Complex d = c.divide(sum); Complex f = e.multiply(d.conjugate()); System.out.println("D is: " + ComplexFormat.formatComplex(d)); System.out.println("F is: " + ComplexFormat.formatComplex(f)); double realF = f.getReal(); double imD = d.getImaginary(); double answer = realF / imD; System.out.println("Answer: " + NumberFormat.getInstance().format(answer)); }
From source file:afest.math.MyMath.java
/** * Convert the specified list to complex numbers. * @param values values to convert.//from w w w . jav a 2s. c om * @return the specified list represented as complex numbers. * */ public static Complex[] convertToComplex(double[] values) { Complex[] result = new Complex[values.length]; for (int i = 0; i < values.length; i++) { result[i] = new Complex(values[i], 0); } return result; }
From source file:BackEnd.FazorVektor.java
public FazorVektor SumFazorVektor(FazorVektor A, FazorVektor B) { Complex C1 = new Complex(A.getX_Real() + B.getX_Real(), A.getX_Imaginary() + B.getX_Imaginary()); Complex C2 = new Complex(A.getY_Real() + B.getY_Real(), A.getY_Imaginary() + B.getY_Imaginary()); Complex C3 = new Complex(A.getZ_Real() + B.getZ_Real(), A.getZ_Imaginary() + B.getZ_Imaginary()); FazorVektor C = new FazorVektor(C1, C2, C3); return C;/*from w w w. j av a 2 s . c o m*/ }
From source file:BackEnd.FazorVektor.java
/** * prida do existujuceho FV daliu hodnotu FV * @param B fazorvekor/*from ww w.j a va2 s.co m*/ */ public void AddToFazorVektor(FazorVektor B) { X = new Complex(X.getReal() + B.getX_Real(), X.getImaginary() + B.getX_Imaginary()); Y = new Complex(Y.getReal() + B.getY_Real(), Y.getImaginary() + B.getY_Imaginary()); Z = new Complex(Z.getReal() + B.getZ_Real(), Z.getImaginary() + B.getZ_Imaginary()); }
From source file:BackEnd.FazorVektor.java
public void setX_Real(double X) { Complex cislo = new Complex(X, this.X.getImaginary()); this.X = cislo; }
From source file:BackEnd.FazorVektor.java
public void setX_Imaginary(double X) { Complex cislo = new Complex(this.X.getReal(), X); this.X = cislo; }
From source file:BackEnd.B_calculation.java
public void run() throws DelaunayError { Complex NULA = new Complex(0, 0); FazorVektor B_v_miesteRp = new FazorVektor(NULA, NULA, NULA); //cyklus //from ww w . j av a2s . co m for (int cl1 = 0; cl1 < this.R0_vectors.size(); cl1++) { B_v_miesteRp.AddToFazorVektor(calc_DB(Rp, R0_vectors.get(cl1), deltaL_vectors.get(cl1))); } this.geoVektor[0] = B_v_miesteRp.getX_Real() / getI_real(); //X hodnota geovektora this.geoVektor[1] = B_v_miesteRp.getY_Real() / getI_real(); //Y hodnota geovektora this.geoVektor[2] = B_v_miesteRp.getZ_Real() / getI_real(); //Z hodnota geovektora this.B = B_v_miesteRp; }
From source file:BackEnd.FazorVektor.java
public void setY_Real(double Y) { Complex cislo = new Complex(Y, this.Y.getImaginary()); this.Y = cislo; }
From source file:BackEnd.E_Spheres_calculation.java
public void run() throws DelaunayError { Complex NULA = new Complex(0, 0); FazorVektor E_v_miesteRp = new FazorVektor(NULA, NULA, NULA); //cyklus od kazdej sfery Q0 for (int cl1 = 0; cl1 < this.Ri.size(); cl1++) { E_v_miesteRp.AddToFazorVektor(calc_DE(qi.get(cl1), this.Rp, Ri.get(cl1))); }//from w w w.j a v a 2 s . c o m // cyklus od kazdej sfery Qij for (int i = 0; i < this.Rij.size(); i++) { for (int j = 0; j < this.Rij.get(0).size(); j++) { E_v_miesteRp.AddToFazorVektor(calc_DE(qij.get(i).get(j), this.Rp, Rij.get(i).get(j))); } } // cyklus od kazdej sfery Qijk for (int i = 0; i < this.Rijk.size(); i++) { for (int j = 0; j < this.Rijk.get(0).size(); j++) { for (int k = 0; k < this.Rijk.get(0).get(0).size(); k++) { E_v_miesteRp.AddToFazorVektor( calc_DE(qijk.get(i).get(j).get(k), this.Rp, Rijk.get(i).get(j).get(k))); } } } // cyklus od kazdej sfery Qijkl for (int i = 0; i < this.Rijkl.size(); i++) { for (int j = 0; j < this.Rijkl.get(0).size(); j++) { for (int k = 0; k < this.Rijkl.get(0).get(0).size(); k++) { for (int l = 0; l < this.Rijkl.get(0).get(0).get(0).size(); l++) { E_v_miesteRp.AddToFazorVektor(calc_DE(qijkl.get(i).get(j).get(k).get(l), this.Rp, Rijkl.get(i).get(j).get(k).get(l))); } } } } this.E = E_v_miesteRp; }
From source file:BackEnd.FazorVektor.java
public void setY_Imaginary(double Y) { Complex cislo = new Complex(this.Y.getReal(), Y); this.Y = cislo; }