Cos Function

āļšāˇāļĢāļēāļš āˇƒāļēāˇ’āļąāļē āļ†āļ´āˇƒāˇ” āļŊāļļāˇ āļ¯āˇ™āļēāˇ’. āļšāˇāļĢāļē āļģāˇšāļŠāˇ’āļēāļąāˇŠ āˇ€āļŊāˇ’āļąāˇŠ āˇ€āˇ’āˇāˇšāˇ‚āļĢāļē āļšāļģ āļ‡āļ­. āļ´āˇŠâ€āļģāļ­āˇ’āļĩāļŊāļē -1 āˇƒāˇ„ 1 āļ…āļ­āļģ āˇ€āˇš.

Using the angle Alpha, the Cos function calculates the ratio of the length of the side that is adjacent to the angle, divided by the length of the hypotenuse in a right-angled triangle.

Cos(Alpha) = Adjacent/Hypotenuse

Syntax:


Cos (Number As Double) As Double

Return value:

Double

Parameters:

āļ…āļ‚āļšāļē: āļ”āļļāļ§ āˇƒāļēāˇ’āļąāļē āļœāļĢāļąāļē āļšāˇ’āļģāˇ“āļ¸āļ§ āļ…āˇ€āˇāˇŠâ€āļē āļšāˇāļĢāļē āļģāˇšāļŠāˇ’āļēāļąāˇŠ āˇ€āļŊāˇ’āļąāˇŠ āļ…āļģāˇŠāļŽ āļ¯āļšāˇŠāˇ€āļą āˇƒāļ‚āļ›āˇŠâ€āļēāˇāļ­āˇŠāļ¸āļš āļ´āˇŠâ€āļģāļšāˇāˇāļąāļē.

āļ…āļ‚āˇāļš āļģāˇšāļŠāˇ’āļēāļą āˇ€āļŊāļ§ āļ´āļģāˇ’āˇ€āļģāˇŠāļ­āļąāļē āļšāˇ’āļģāˇ“āļ¸āļ§ āļ…āļ‚āˇāļš Pi/180āļœāˇ™āļąāˇŠ āļœāˇ”āļĢ āļšāļģāļąāˇŠāļą āˇƒāˇ„ āļģāˇšāļŠāˇ’āļēāļą āļ…āļ‚āˇāļš āˇ€āļŊāļ§ āļ´āļģāˇ’āˇ€āļģāˇŠāļ­āļąāļē āļšāˇ’āļģāˇ“āļ¸āļ§ āļģāˇšāļŠāˇ’āļēāļą 180/Piāļœāˇ™āļąāˇŠ āļœāˇ”āļĢ āļšāļģāļąāˇŠāļą.

āļ…āļ‚āˇāļš=(āļģāˇšāļŠāˇ’āļēāļą*180)/Pi

āļģāˇšāļŠāˇ’āļēāļą=(āļ…āļ‚āˇāļš*Pi)/180

Pi is here the fixed circle constant with the rounded value 3.14159...

Error codes:

5 Invalid procedure call

Example:


' The following example allows for a right-angled triangle the input of
' secant and angle (in degrees) and calculates the length of the hypotenuse:
Sub ExampleCosinus
REM rounded Pi = 3.14159
Dim d1 As Double, dAngle As Double
    d1 = InputBox$ (""Enter the length of the adjacent side: ","Adjacent")
    dAngle = InputBox("Enter the angle Alpha (in degrees): ","Alpha")
    Print "The length of the hypotenuse is"; (d1 / cos (dAngle * Pi / 180))
End Sub

Please support us!