benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf a16fea63-43fc-571d-9d45-3e10f271f0a6

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import numpy as np
import math

def task_func(ax, num_turns):
    """
    Draws a spiral on the polar diagram 'ax' with the specified number of turns 'num_turns'.
    The spiral starts at the center and expands outward with each turn.
    The radial ticks on the plot are positioned at intervals corresponding to the number of turns multiplied by 45 degrees.

    Parameters:
    ax (matplotlib.axes._axes.Axes): The Axes object for plotting the spiral.
    num_turns (int): The number of turns for the spiral.

    Returns:
    matplotlib.axes._axes.Axes: The modified Axes object with the spiral plot.

    Requirements:
    - numpy
    - math

    Example:
    >>> import matplotlib.pyplot as plt
    >>> fig, ax = plt.subplots(subplot_kw={'polar': True})
    >>> ax = task_func(ax, 3)
    >>> ax.get_rlabel_position()
    135.0
    """

instruct prompt

Draws a spiral on the polar diagram 'ax' with the specified number of turns 'num_turns'. The spiral starts at the center and expands outward with each turn. The radial ticks on the plot are positioned at intervals corresponding to the number of turns multiplied by 45 degrees.
The function should output with:
    matplotlib.axes._axes.Axes: The modified Axes object with the spiral plot.
You should write self-contained code starting with:

Code

import numpy as np
import math
def task_func(ax, num_turns):

code prompt

Code

import numpy as np
import math
def task_func(ax, num_turns):

entry point

task_func

libs

  • math
  • numpy

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import