In Julia, tan()
is an in-built function used to calculate the trigonometric tangent value of a variable specified in radians.
The code snippet below shows how to use the tan()
function in Julia.
tan(x)
The tan()
method accepts one argument: x
. The angle for which the user seeks the trigonometric tangent is specified in radians. It returns the tan for x
.
Let's run a script that uses the tan()
method.
## find tan of 30 degreedegree = 30radian = deg2rad(degree)println( "tan($(radian)) => $(tan(radian))")## find tan of 90 degreedegree = 90radian = deg2rad(degree)println( "tan($(radian)) => $(tan(radian))")
2
we create a new variable degree
and initialize it to 30
.3
we use deg2rad()
to convert the value of degree
to radian and store it in radian
.4
we use the tan method with the variable radian
as an argument. This line will calculate the tangent value of radian
.7
we update the value of degree
to 90
.8
we use deg2rad()
to convert the value of degree
to radian and store it in radian
.9
we use the tan method with the variable radian
as an argument. This line will calculate the tangent value of radian
.