benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 1d8423f8-284f-5a09-8aee-3f64a2731b8e

Problem

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

complete prompt

import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt

def task_func(x):
    """
    Draws a plot visualizing a complex distribution created from two Gaussian distributions.
    The real part of the complex distribution is a Gaussian centered at 0 with a standard deviation of 1,
    and the imaginary part is a Gaussian centered at 2 with a standard deviation of 2.

    Parameters:
        x (numpy.ndarray): The range of x values over which to plot the distribution.

    Returns:
        numpy.ndarray: The complex distribution created from the two Gaussian distributions.

    Raises:
        TypeError: If `x` is not a numpy.ndarray.
    
    Requirements:
    - numpy
    - scipy.stats.norm
    - matplotlib.pyplot

    Examples:
    >>> X = np.linspace(-10, 10, 1000)
    >>> result = task_func(X)
    >>> result[0]
    (7.69459862670642e-23+3.037941424911643e-09j)
    """

instruct prompt

Draws a plot visualizing a complex distribution created from two Gaussian distributions. The real part of the complex distribution is a Gaussian centered at 0 with a standard deviation of 1, and the imaginary part is a Gaussian centered at 2 with a standard deviation of 2.
The function should raise the exception for: TypeError: If `x` is not a numpy.ndarray.
The function should output with:
    numpy.ndarray: The complex distribution created from the two Gaussian distributions.
You should write self-contained code starting with:

Code

import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt
def task_func(x):

code prompt

Code

import numpy as np
from scipy.stats import norm
import matplotlib.pyplot as plt
def task_func(x):

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