Convert between polar and rectangular coordinates


strictfp class MainClass {
  public static void main(String[] args) {
    double num, loge, log10, aloge, alog10;

    // Obtain input from user
    num = 0.111d;

    // Calculate and display the natural logarithm
    loge = Math.log(num);
    System.out.println("log base e = " + loge);
    // Calculate the common log
    log10 = Math.log(num) / Math.log(10.0);
    System.out.println("log base 10 = " + log10);

    // Calculate the antilogarithm of log base e
    aloge = Math.exp(loge);
    System.out.println("antilog of log base e = " + aloge);

    // Calculate the antilogarithm of log base 10
    alog10 = Math.pow(10.0, log10);
    System.out.println("anitlog of log base 10 = " + alog10);
  }
}
Home 
  Java Book 
    Runnable examples  

Math:
  1. Convert between polar and rectangular coordinates
  2. Random bytes
  3. Random boolean
  4. Random integer between lo and hi interval
  5. Random long type number
  6. Random numbers between 1 and 100
  7. Random number between 0 AND 10
  8. Random integers that range from from 0 to n
  9. Random string consists of random characters.
  10. Random array of numbers
  11. Round float and double numbers
  12. Round to ceiling
  13. Round to floor value