Here you can find the source of divideComplex(double realOne, double imagOne, double realTwo, double imagTwo)
Parameter | Description |
---|---|
realOne | real part one |
imagOne | imaginary part one |
realTwo | real part two |
imagTwo | imaginary part two |
public static double[] divideComplex(double realOne, double imagOne, double realTwo, double imagTwo)
//package com.java2s; /*// w ww.ja va 2 s .co m * Copyright (C) 2010-2014 Andreas Maier * CONRAD is developed as an Open Source project under the GNU General Public License (GPL). */ public class Main { /** * Divides two complex values * @param realOne real part one * @param imagOne imaginary part one * @param realTwo real part two * @param imagTwo imaginary part two * @return an array of two values: first entry is real, second imaginary */ public static double[] divideComplex(double realOne, double imagOne, double realTwo, double imagTwo) { double[] revan = new double[2]; double denominator = Math.pow(realTwo, 2) + Math.pow(imagTwo, 2); revan[0] = ((realOne * realTwo) + (imagOne * imagTwo)) / denominator; revan[1] = ((imagOne * realTwo) - (realOne * imagTwo)) / denominator; return revan; } }