The Math class provides a variety of methods that can be used to perform mathematical functions.The Math class includes methods for generating random numbers, calculating square roots, and perform trigonometric functions.
Mathematical constants such as Pi and logarithmic E are also included in the Math class as read-only variables.These methods are stored in the java.lang.package and are automatically available in your JSP code.
Mathematical constants such as Pi and logarithmic E are also included in the Math class as read-only variables.These methods are stored in the java.lang.package and are automatically available in your JSP code.
Mathematical Functions:
- sqrt(value 1)
- pow(value 1, value 2)
- exp(value 1)
- log(value 1)
Trigonometric Functions:
- sin(value 1)
- cos(value 1)
- tan(value 1)
- asin(value 1)
- acon(value 1)
Numeric Functions:
- abs(value 1)
- max(value 1,value 2)
- min(value 1,value 2)
- round(value 1)
Example :
<html> <head> <title>Mathematical Functions</title> </head> <body> <h3>Calculating the Radius of a Circle:</h3> <p> The radius of a circle with a area of 500m<superscript>2</superscript> = <%=Math.sqrt(500.00/Math.PI) %>m </body> </html>
Description:
This example uses the sqrt method to calculate the radius of a circle that has an area of 500msquare
2 =
12.6156626101008m
********************************************************************************
*********************************OUTPUT***************************************
Calculating the Radius of a Circle:
The radius of a circle with a area of 500m********************************************************************************
No comments:
Post a Comment