Datasets:
Download code/generators/functions.py from ahmed-wez/hidden-capability-math: direct link, hf CLI and curl.
- Browser
- Download file 3.78 kB
-
https://huggingface.co/datasets/ahmed-wez/hidden-capability-math/resolve/main/code/generators/functions.py
- Command line
-
hf download hf://datasets/ahmed-wez/hidden-capability-math/code/generators/functions.py
-
curl -L -o functions.py https://huggingface.co/datasets/ahmed-wez/hidden-capability-math/resolve/main/code/generators/functions.py
3.78 kB
| from common import register | |
| D = 'functions' | |
| def add(n, c, t, s, e, **kw): | |
| register(D, n, c, t, s, e, **kw) | |
| add('composition', [['Let f(x) = {a}*x + {b} and g(x) = x^2 + {c}.', 'Define f(x) = {a}*x + {b}, with g(x) = x^2 + {c}.', 'Two functions are given by f(x) = {a}*x + {b} and g(x) = x^2 + {c}.'], ['Use the input {v}.', 'The input value is {v}.', 'Take x = {v}.']], ['What is f(g(x)) at that input?', 'Evaluate f composed with g at this input.', 'Find the value of f(g(x)).'], lambda r: dict(a=r.randint(2, 15), b=r.randint(2, 25), c=r.randint(2, 25), v=r.randint(2, 15)), [('inner_value', 'v*v+c'), ('answer', 'a*inner_value+b')], level='easy') | |
| add('inverse_affine', [['Let f(x) = ({a}*x + {b})/{c}.', 'The function f is f(x) = ({a}*x + {b})/{c}.', 'Define the real function f(x) = ({a}*x + {b})/{c}.'], ['The output is {v}.', 'Use {v} as the output value.', 'Suppose f(x) equals {v}.']], ['What input gives this output?', 'Find the corresponding input x.', 'Determine the inverse image of this output.'], lambda r: dict(a=r.randint(2, 17), b=r.randint(2, 30), c=r.randint(2, 13), v=r.randint(5, 50)), [('scaled_output', 'c*v'), ('answer', '(scaled_output-b)/a')], level='easy') | |
| add('horizontal_translation', [['Let f(x) = {a}*x^2 + {b}*x + {c}, and let g(x) = f(x - {h}) + {k}.', 'Define f(x) = {a}*x^2 + {b}*x + {c}; transform it to g(x) = f(x - {h}) + {k}.', 'The function f(x) = {a}*x^2 + {b}*x + {c} is used to define g(x) = f(x - {h}) + {k}.']], ['What is the coefficient of x in g(x)?', 'Expand g and find its linear coefficient.', 'Determine the coefficient multiplying x in g.'], lambda r: dict(a=r.randint(2, 15), b=r.randint(2, 40), c=r.randint(2, 40), h=r.randint(2, 15), k=r.randint(2, 30)), [('translation_contribution', '-2*a*h'), ('answer', 'b+translation_contribution')], level='medium', depth=3) | |
| add('mobius_inverse', [['Let f(x) = ({a}*x + {b})/(x + {c}), where x is not -{c}.', 'For x different from -{c}, define f(x) = ({a}*x + {b})/(x + {c}).', 'The rule f(x) = ({a}*x + {b})/(x + {c}) has domain all reals except -{c}.'], ['The required output is {v}.', 'Use output value {v}.', 'Set f(x) equal to {v}.']], ['What is the corresponding input?', 'Find x for this output.', 'Determine the inverse image of the given output.'], lambda r: dict(a=r.randint(2, 9), b=r.randint(2, 30), c=r.randint(16, 30), v=r.randint(11, 25)), [('rhs', 'b-v*c'), ('answer', 'rhs/(v-a)')], level='hard', depth=3) | |
| add('quadratic_interpolation', [['A polynomial f has degree at most two, with f(0) = {u}, f(1) = {v}, and f(2) = {w}.', 'For a polynomial f of degree at most two, the values at 0, 1, and 2 are {u}, {v}, and {w}, respectively.', 'The polynomial f, of degree no greater than two, satisfies f(0) = {u}, f(1) = {v}, f(2) = {w}.'], ['Use input {t}.', 'Evaluate at argument {t}.', 'Take x = {t}.']], ['What is f at this input?', 'Find the missing function value.', 'Evaluate the polynomial at the given input.'], lambda r: dict(u=r.randint(2, 40), v=r.randint(2, 40), w=r.randint(45, 100), t=r.randint(3, 12)), [('second_difference', 'w-2*v+u'), ('answer', 'u+(v-u)*t+second_difference*t*(t-1)/2')], level='hard', depth=4, concepts=3) | |
| add('inverse_composition', [['Let f(x) = {a}*x + {b} and g(x) = {c}*x - {d}.', 'Define the functions f(x) = {a}*x + {b} and g(x) = {c}*x - {d}.', 'Two invertible functions are f(x) = {a}*x + {b}, g(x) = {c}*x - {d}.'], ['Their composition f(g(x)) equals {v}.', 'The output of f composed with g is {v}.', 'Suppose f(g(x)) = {v}.']], ['What is x?', 'Find the original input.', 'Determine the input to this composition.'], lambda r: dict(a=r.randint(2, 15), b=r.randint(2, 30), c=r.randint(2, 15), d=r.randint(2, 30), v=r.randint(40, 200)), [('inner_output', '(v-b)/a'), ('answer', '(inner_output+d)/c')], level='medium', depth=3) | |