예제 #1
0
 public Complex(double m, double a, bool w)//Constructive method for modulus argument.
 {
     argument  = MAL.Round(a, InstantiationDecimals);
     modulus   = MAL.Round(m, InstantiationDecimals);
     real      = MAL.Round((m * MAL.Cos(a)), InstantiationDecimals);
     imaginary = MAL.Round((m * MAL.Sin(a)), InstantiationDecimals);
 }
예제 #2
0
 public Complex(double r, double i)
 {
     real      = MAL.Round(r, InstantiationDecimals);
     imaginary = MAL.Round(i, InstantiationDecimals);
     modulus   = MAL.Round(getModulus(), InstantiationDecimals);
     argument  = MAL.Round(getArgument(), InstantiationDecimals);
 }
예제 #3
0
        public string outputRealImaginary()
        {
            string realImag;

            if (imaginary < 0)
            {
                realImag = Convert.ToString(MAL.Round(real, OutputDecimals)) + Convert.ToString(MAL.Round(imaginary, OutputDecimals)) + "i";
            }
            else
            {
                realImag = Convert.ToString(MAL.Round(real, OutputDecimals)) + " + " + Convert.ToString(MAL.Round(imaginary, OutputDecimals)) + "i";
            }
            return(realImag);
        }
예제 #4
0
        public string outputModulusArgument()
        {
            string modulusArgument = Convert.ToString(MAL.Round(modulus, OutputDecimals)) + "(cos" + Convert.ToString(MAL.Round(argument, OutputDecimals)) + " + isin" + Convert.ToString(MAL.Round(argument, OutputDecimals)) + ")";

            return(modulusArgument);
        }