Java Code for Polar Representation of Complex Numbers

This java programming code is used to find the polar representation of complex numbers. You can select the whole java code by clicking the select option and can use it. When you click text, the code will be changed to text format. This java program code will be opened in a new pop up window once you click pop-up from the right corner. You can just copy, paste this java code and use it to find the polar representation of complex numbers.

import java.util.*;
import java.lang.*;
import java.lang.Math.*;
public class Polar_Representation
{  
    public static void main(String args[])
    {
        double x,y,z;
        x=4;
        y=5;
        z=y;
        
        //If "-" Operator
        y=-1*y;
        double r=Math.sqrt(x*x+y*y);
        double t=Math.atan(y/x);
        t=t*180/3.14;
        r=Math.round(r*1000)/1000;
        t=Math.ceil(t);
        System.out.println("Polar representation (z): "+r+"( cos "+t+" (deg) + i sin "+t+" (deg))");
        
        //If "+" Operator
        y=y*1;
        r=Math.sqrt(x*x+z*z);
        t=Math.atan(z/x);
        t=t*180/3.14;
        r=Math.round(r*1000)/1000;
        t=Math.ceil(t);
        System.out.println("Polar representation (z): "+r+"( cos "+t+" (deg) + i sin "+t+" (deg))");
    }
}
Other Programming Codes
Click on the select code link to copy and paste this free java program code for polar representation of complex numbers.

english Calculators and Converters


Sitemap