benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 8cd9f6ac-6568-5eff-b5d4-733ac10fbc4a

Problem

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

complete prompt

import numpy as np
from sympy import symbols, solve


def task_func(precision=2, seed=0):
    """
    Solve a quadratic equation in the form of ax ^ 2 + bx + c = 0, where a, b, and c randomly generated numbers are between -10 and 10. The solutions are complex numbers rounded to the specified accuracy.

    Parameters:
    precision (int): The number of decimal places to which to round the solutions.
    seed (int, Optional): The seed for the random number generator.

    Returns:
    tuple: A tuple of two solutions formatted as complex numbers (rounded to the specified precision).

    Requirements:
    - numpy
    - math
    - sympy

    Example:
    >>> result = task_func()
    >>> len(result)
    2
    >>> result
    ((-3.86+0j), (-0.54+0j))
    """

instruct prompt

Solve a quadratic equation in the form of ax ^ 2 + bx + c = 0, where a, b, and c randomly generated numbers are between -10 and 10. The solutions are complex numbers rounded to the specified accuracy.
The function should output with:
    tuple: A tuple of two solutions formatted as complex numbers (rounded to the specified precision).
You should write self-contained code starting with:

Code

import numpy as np
from sympy import symbols, solve
def task_func(precision=2, seed=0):

code prompt

Code

import numpy as np
from sympy import symbols, solve
def task_func(precision=2, seed=0):

entry point

task_func

libs

  • sympy
  • 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