Ads

Tutorials

# Sine Table in JSP

There are variety of ways to define sine, cosine, etc other than the trignometric definition.

There are variety of ways to define sine, cosine, etc other than the trignometric definition.

# Sine Table in JSP

What is sine: There are variety of ways to define sine, cosine, etc other than the trignometric definition. They are not angles, by the way, they are the functions of angles. Many centuries ago, far too many to be certain exactly how it happened, people noticed that as long as the angles of triangles were the same, while the sides could be as long or short as you wanted, the ratios stayed the same.

Before we proceed, its important to understand what these programs were designed to do. The main purpose of building a sine table is to create a reference table of sine values plus a fast and simple way for later program parts to retrieve sine and cosine values. Mathematically, the sine of an angle is the ratio of the length of the opposite side to the length of the hypotenuse of an imaginary right triangle having that angle in it.

To calculate the the sine we have one  function provided to calculate a sine of a function.

Here is the code of the JSP file:

 ```<%@page import="java.util.*, java.lang.*" %> Sin Table

Sin Table ``` `<%!int angles[] ={0, 30, 45, 75,90};%>` ```

AngleSign of Angle
<%= angles[i]%> <%=Math.sin( Math.toRadians(angles[i]))%>
<% for (int i=0; i<5; i++){ %> <%} %> ```

Output of the Program: Download this example.

Ads

Ads