rad2deg

rad2deg(x)

Convert x from radians to degrees

Examples

  1. Convert radians to degrees:

    julia> rad2deg(pi/2)
    90.0

    This example converts π/2 radians to degrees, which is equal to 90 degrees.

  2. Convert an array of angles to degrees:

    julia> angles = [pi/4, pi/3, pi/6];
    julia> rad2deg.(angles)
    3-element Array{Float64,1}:
    45.0
    60.0
    30.0

    It applies rad2deg element-wise to an array of angles, converting them from radians to degrees.

  3. Convert a single value to degrees:
    julia> angle = 2pi;
    julia> rad2deg(angle)
    360.0

    It converts a single value, , from radians to degrees.

Common mistake example:

julia> rad2deg("pi/4")
ERROR: MethodError: no method matching rad2deg(::String)

In this example, an incorrect input type is provided. The rad2deg function expects a numerical value representing an angle in radians. Ensure that the input value is of the correct type to avoid such errors.

See Also

acos, acosd, acosh, acot, acotd, acoth, acsc, acscd, acsch, asec, asecd, asech, asin, asind, asinh, atan, atan2, atand, atanh, cos, cosc, cosd, cosh, cospi, cot, cotd, coth, csc, cscd, csch, deg2rad, rad2deg, sin, sinc, sind, sinh, sinpi, tan, tand, tanh,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: