benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 4bc15a61-3ea3-5c12-9431-29a099423cb3

Problem

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

complete prompt

import math
import matplotlib.pyplot as plt
import numpy as np
import random
# Constants
RANGE = 10000
SIZE = 1000
PI = np.pi


def task_func(size=SIZE, frequency=1):
    '''
    Create a list of random sinusoidal values and plot them in a graph.
    
    Parameters:
    - size (int): The number of points for the sinusoidal wave. Default is 1000.
    - frequency (float): The frequency of the sinusoidal wave. Default is 1.
    
    Returns:
    - Axes object: The plot of the sinusoidal wave.
    
    Requirements:
    - random
    - math
    - matplotlib.pyplot
    - numpy
    
    Example:
    >>> import matplotlib
    >>> ax = task_func(size=1000, frequency=1)
    >>> isinstance(ax, matplotlib.axes.Axes)
    True
    >>> len(ax.lines[0].get_ydata()) == 1000  # Verify the number of data points in the sinusoidal wave
    True
    >>> isinstance(ax.lines[0].get_ydata()[0], float)  # Check if y-values are floating-point numbers
    True
    '''

instruct prompt

Create a list of random sinusoidal values and plot them in a graph.
The function should output with:
    Axes object: The plot of the sinusoidal wave.
You should write self-contained code starting with:

Code

import math
import matplotlib.pyplot as plt
import numpy as np
import random
# Constants
RANGE = 10000
SIZE = 1000
PI = np.pi
def task_func(size=SIZE, frequency=1):

code prompt

Code

import math
import matplotlib.pyplot as plt
import numpy as np
import random
# Constants
RANGE = 10000
SIZE = 1000
PI = np.pi
def task_func(size=SIZE, frequency=1):

entry point

task_func

libs

  • math
  • numpy
  • matplotlib
  • random

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