0% found this document useful (0 votes)
43 views2 pages

Theory Part 2 PDF

The Java Math class contains common trigonometric functions like sine, cosine, and tangent. It includes Math.PI, which provides the value of PI for calculations. Math.sin() calculates the sine of an angle value in radians. For example, Math.sin(Math.PI) outputs the sine of 180 degrees. The document also provides examples of using Math.sin() to print the sine values from 0 to 90 degrees.

Uploaded by

Subham
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views2 pages

Theory Part 2 PDF

The Java Math class contains common trigonometric functions like sine, cosine, and tangent. It includes Math.PI, which provides the value of PI for calculations. Math.sin() calculates the sine of an angle value in radians. For example, Math.sin(Math.PI) outputs the sine of 180 degrees. The document also provides examples of using Math.sin() to print the sine values from 0 to 90 degrees.

Uploaded by

Subham
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

TRIGONOMETRIC MATHEMATICS

FUNCTION
The ​Java.Math ​ class contains a set of trigonometric functions. These functions can
calculate values used in trigonometry. like sine, cosine, tangent etc. I will cover the most
used trigonometry functions in the following sections. If you are looking for a trigonometric
function and you cannot find it here, check the JavaDoc for the ​Java.Math​ class. The ​Math
class just might have the function you are looking for, even if I have not described it here.

1. Math.PI
The ​Math.PI​ constant is a double with a value that is very close to the value of PI - the
mathematical definition of PI. You will often need the ​Math.PI​ field when making
trigonometric calculations.

Example program
import java.lang.Math.*;
public class Pie {
public static void main(String[] args) {
//radius and length
double radius = 5;
double len = 15;
// calculate the area using PI
double area = radius * radius * Math.PI;
//and now volume
double volume = area * len;
System.out.println("Volume of cylinder is: " + volume);
}
}

2. Math.sin()
The ​Math.sin()​ method calculates the sine value of some angle value in radians. Here is a
Java Math.sin()​ example:

double sin = Math.sin(Math.PI);


System.out.println("sin="+sin);

To print the sine 0 to 90


Class sinTable {
public static void main(String ss[])
{
int i:
double x.y:
System.out.println("Angle tSin Values");
for(i=0;i<=90;i++)
{
x=(Math.PI * i)/180.0;
y=Math.sin(x);
System.out.println(x+"\t"+y);
}
}
}

Alternative method
class sinTable
{
public static void main(String ss [])
{
int i;
double x,y;

System.out.println("Angle Sin Values");

for(i=0;i<=90:i++)
{
x=Math .to Radians(1);
y=Math. sin(x);
System.out.println(x+"\t"+y);
}
}
}

You might also like