<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def triangle(rad=0.5):
 """Draw a triangle"""

    # half_height = math.sqrt(3) * side / 6
    # half_height = side / 2
    ctx = _state["ctx"]
    side = 3 * rad / math.sqrt(3)
    ctx.move_to(0, -rad / 2)
    ctx.line_to(-side / 2, -rad / 2)
    ctx.line_to(0, rad)
    ctx.line_to(side / 2, -rad / 2)
    ctx.close_path()
    ctx.fill()