benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 820a85ea-0497-5289-b58b-056842a9c702

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
from scipy.stats import norm

def task_func(mu=0, sigma=1):
    """
    Draw and return a subplot of a normal distribution with the given mean and standard deviation,
    utilizing numpy's linspace to create an array of 100 linearly spaced numbers between
    `mu - 3*sigma` and `mu + 3*sigma`.

    Parameters:
    mu (float): The mean of the distribution. Default is 0.
    sigma (float): The standard deviation of the distribution. Default is 1.

    Returns:
    matplotlib.axes.Axes: The subplot representing the normal distribution.

    Requirements:
    - numpy
    - matplotlib.pyplot
    - scipy.stats.norm

    Example:
    >>> ax = task_func(mu=5, sigma=2)
    >>> ax
    <Axes: >
    >>> type(ax)
    <class 'matplotlib.axes._axes.Axes'>
    """

instruct prompt

Draw and return a subplot of a normal distribution with the given mean and standard deviation, utilizing numpy's linspace to create an array of 100 linearly spaced numbers between `mu - 3*sigma` and `mu + 3*sigma`.
The function should output with:
    matplotlib.axes.Axes: The subplot representing the normal distribution.
You should write self-contained code starting with:

Code

import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
def task_func(mu=0, sigma=1):

code prompt

Code

import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
def task_func(mu=0, sigma=1):

entry point

task_func

libs

  • numpy
  • matplotlib
  • scipy

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