benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf ef38e760-3ffe-5c9c-a835-a6765153be42

Problem

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

complete prompt

import numpy as np
import matplotlib.pyplot as plt

def task_func():
    """
    Generate diagrams for the sine and cosine functions over the interval [0, 2π].

    This function plots the sine and cosine functions, setting appropriate titles and axis labels.

    Returns:
        Figure: A Matplotlib Figure object containing the plots.
        ndarray: An array of Matplotlib Axes objects for the subplots, where:
                 - The first Axes object contains the sine function plot.
                 - The second Axes object contains the cosine function plot.

    The sine function plot is labeled 'Sine function', with x-axis labeled 'x' and y-axis labeled 'sin(x)'.
    The cosine function plot is labeled 'Cosine function', with x-axis labeled 'x' and y-axis labeled 'cos(x)'.

    Requirements:
        - numpy
        - matplotlib.pyplot

    Example:
        >>> fig, axs = task_func()
        >>> plt.show()
    """

instruct prompt

Generate diagrams for the sine and cosine functions over the interval [0, 2π]. This function plots the sine and cosine functions, setting appropriate titles and axis labels. The sine function plot is labeled 'Sine function', with x-axis labeled 'x' and y-axis labeled 'sin(x)'. The cosine function plot is labeled 'Cosine function', with x-axis labeled 'x' and y-axis labeled 'cos(x)'.
The function should output with:
    Figure: A Matplotlib Figure object containing the plots.
    ndarray: An array of Matplotlib Axes objects for the subplots, where:
    The first Axes object contains the sine function plot.
    The second Axes object contains the cosine function plot.
You should write self-contained code starting with:

Code

import numpy as np
import matplotlib.pyplot as plt
def task_func():

code prompt

Code

import numpy as np
import matplotlib.pyplot as plt
def task_func():

entry point

task_func

libs

  • numpy
  • matplotlib

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