# Mathematical functions in VB.NET

This article describes about some in built mathematical function of the math class which are useful to perform some operations.
• 13063

This article describes about some in built mathematical function of the math class which are useful to perform some operations.

Math functions

Math functions are very useful function when we need to perform mathematical operations such as some trigonometric and logarithmtics. To use these math functions without qualification, import the System.Math namespace.

1. Abs() Function

The Abs Function is used to returns the absolute value of a specified number.

Syntax

Math.Abs(n)

Here, n is the number.

This function returns the absolute value.

2. Min() Function

The Min function is used to find out the minimum value from two number.

Syntax

Math.Min(n1, n2)

Here, n1 and n2 are the two number.

This function returns the min value from n1 and n2.

3. Max() Function

The Min function is used to find out the maximum value from two number.

Syntax

Math.Min(n1, n2)

Here, n1 and n2 are the two number.

This function returns the maximum value from n1 and n2.

4. Sqrt() Function

The pow function is used to returns the square root of the number.

Syntax

Math.Sqrt(n1)

Here, n1 is the number.

This function returns the maximum value from n1 and n2.

This function returns a Double value specifying the square root of a number.

5. Pow() Function

This function is used to Returns a specified number raised to the specified power.

Syntax

Math.Pow(n1, n2 )

Here, n1 is the number and n2 is the power of the number.

6. Sin() Function

This function is used to Returns the sine of the specified angle.

Syntax

Math.Sin(90)

Here, 90 is the angle.

7. Log() Function

This function is used to find the logarithm of a specified number.

Syntax

Math.log(n1)

Here, n1 is the number.

For example

The below example describe all the above function.

Module Module1

Sub Main()

Dim absolute As Integer

absolute = Math.Abs(-16)

Console.WriteLine("The absolute value is: " & absolute)

Dim minimum As Integer

minimum = Math.Min(18, 12)

Console.WriteLine("The minimum value is: " & minimum)

Dim maximum As Integer

maximum = Math.Max(18, 12)

Console.WriteLine("The maximum value is: " & maximum)

Dim square As Integer

square = Math.Sqrt(9)

Console.WriteLine("The square root is: " & square)

Dim power As Integer

power = Math.Pow(2, 3)

Console.WriteLine("The power is: " & power)

Dim sine As Integer

sine = Math.Sin(90)

Console.WriteLine("sine value of 90: " & sine)

Dim logvalue As Integer

logvalue = Math.Log(15)

Console.WriteLine("log value of 16 is: " & logvalue)

End Sub

End Module

OUTPUT