Conversion between polar and rectangular coordinates : Math : Development Class : Java examples (example source code) Organized by topic

Java
C++
PHP
Java Home »  Development Class   » [  Math  ]  Screenshots 
 



Conversion between polar and rectangular coordinates

/*
Java Programming for Engineers
Julio Sanchez
Maria P. Canton


ISBN: 0849308100
Publisher: CRC Press
*/

// Java for Engineers
//Filename: Logs
//Reference: Chapter 23
//Description:
//         Conversion between polar and rectangular
//         coordinates
//Requires:
//         Keyin class in current directory

import java.lang.*;

strictfp class Logs
{
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);
}
}



           
       
Related examples in the same category
1.  Absolute value
2.  Get the power value Get the power value
3.  Using the Math Trig Methods Using the Math Trig Methods
4.  Using BigDecimal for Precision Using BigDecimal for Precision
5.  Demonstrate our own version round() Demonstrate our own version round()
6.  Demonstrate a few of the Math functions for Trigonometry Demonstrate a few of the Math functions for Trigonometry
7.  Exponential Demo Exponential Demo
8.  Min Demo
9.  Basic Math Demo Basic Math Demo
10.  Using strict math in applications Using strict math in applications
11.  Using the pow() function
12.  Using strict math at the method level
13.  Calculating hyperbolic functions
14.  Calculating trigonometric functions
15.  Weighted floating-pioint comparisons
16.  Solving right triangles
17.  Applying the quadratic formula
18.  Trigonometric Demo Trigonometric Demo
19.  Complex Number Demo
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.