



"""simple docstring"""






import math_equivalence  # From: git+https://github.com/hendrycks/math.git

import datasets


snake_case   					=				'''\
@article{hendrycksmath2021,
  title={Measuring Mathematical Problem Solving With the MATH Dataset},
  author={Dan Hendrycks
    and Collin Burns
    and Saurav Kadavath
    and Akul Arora
    and Steven Basart
    and Eric Tang
    and Dawn Song
    and Jacob Steinhardt},
  journal={arXiv preprint arXiv:2103.03874},
  year={2021}
}
'''


snake_case   					=				'''\
This metric is used to assess performance on the Mathematics Aptitude Test of Heuristics (MATH) dataset.
It first canonicalizes the inputs (e.g., converting "1/2" to "\\frac{1}{2}") and then computes accuracy.
'''


snake_case   					=				r'''
Calculates accuracy after canonicalizing inputs.

Args:
    predictions: list of predictions to score. Each prediction
        is a string that contains natural language and LaTex.
    references: list of reference for each prediction. Each
        reference is a string that contains natural language
        and LaTex.
Returns:
    accuracy: accuracy after canonicalizing inputs
        (e.g., converting "1/2" to "\\frac{1}{2}")

Examples:
    >>> metric = datasets.load_metric("competition_math")
    >>> results = metric.compute(references=["\\frac{1}{2}"], predictions=["1/2"])
    >>> print(results)
    {\'accuracy\': 1.0}
'''



@datasets.utils.file_utils.add_end_docstrings(_DESCRIPTION,_KWARGS_DESCRIPTION  )
class     UpperCAmelCase    (	datasets.Metric  ):



   def    __UpperCAmelCase    (       self    :	Any				):



     """simple docstring"""
     return datasets.MetricInfo(
         description=_DESCRIPTION							,       citation=_CITATION							,       inputs_description=_KWARGS_DESCRIPTION							,       features=datasets.Features(
             {
                 '''predictions''': datasets.Value('''string'''				),
                 '''references''': datasets.Value('''string'''				),
             }				)							,       homepage='''https://github.com/hendrycks/math'''							,       codebase_urls=['''https://github.com/hendrycks/math''']							,       )





   def    __UpperCAmelCase    (       self    :	Dict							,       __lowerCamelCase    :	int							,       __lowerCamelCase    :	List[Any]				):



     """simple docstring"""
     _snake_case   	=      0.0
     for i, j in zip(__lowerCamelCase							,       __lowerCamelCase				):
       n_correct += 1.0 if math_equivalence.is_equiv(__lowerCamelCase							,       __lowerCamelCase				) else 0.0
     _snake_case   	=      n_correct / len(__lowerCamelCase				)
     return {
         "accuracy": accuracy,
     }








from collections.abc import Callable

import numpy as np





def 	__a     (      A__			:  Callable			,  A__			:  float			,  A__			:  float			,  A__			:  float			,  A__			:  float       ):
    SCREAMING_SNAKE_CASE										=   int(np.ceil((x_end - xa) / step_size       )       )
    SCREAMING_SNAKE_CASE										=   np.zeros((n + 1,)       )
    SCREAMING_SNAKE_CASE										=   ya
    SCREAMING_SNAKE_CASE										=   xa

    for k in range(A__       ):
        SCREAMING_SNAKE_CASE										=   y[k] + step_size * ode_func(A__			,  y[k]       )
        SCREAMING_SNAKE_CASE										=   y[k] + (
            (step_size / 2) * (ode_func(A__			,  y[k]       ) + ode_func(x + step_size			,  A__       ))
        )
        x += step_size

    return y


if __name__ == "__main__":
    import doctest

    doctest.testmod()