Skip to content

Bug in grader #50

Open
Open
@ziyuwan

Description

@ziyuwan

In grader.py I've tried

print(math_equal("1,-2", "1,-3"))

which outputs True, I think maybe this is a mistake.

Original Problem and Answer

{"problem": "The function $f$ satisfies the functional equation\n\\[f(x) + f(y) = f(x + y) - xy - 1\\]for all real numbers $x$ and $y.$  If $f(1) = 1,$ then find all integers $n$ such that $f(n) = n.$  Enter all such integers, separated by commas.", "level": "Level 5", "solution": "Setting $x = y = 0,$ we get\n\\[2f(0) = f(0) - 1,\\]so $f(0) = -1.$\n\nSetting $y = 1,$ we get\n\\[f(x) + 1 = f(x + 1) - x - 1,\\]so\n\\[f(x + 1) - f(x) = x + 2.\\]Thus,\n\\begin{align*}\nf(2) - f(1) &= 1 + 2, \\\\\nf(3) - f(2) &= 2 + 2, \\\\\nf(4) - f(3) &= 3 + 2, \\\\\n&\\dots, \\\\\nf(n) - f(n - 1) &= (n - 1) + 2.\n\\end{align*}Adding all the equations, we get\n\\[f(n) - f(1) = 1 + 2 + 3 + \\dots + (n - 1) + 2(n - 1) = \\frac{(n - 1)n}{2} + 2n - 2 = \\frac{n^2 + 3n - 4}{2},\\]so\n\\[f(n) = \\frac{n^2 + 3n - 2}{2}\\]for all positive integers $n.$\n\nSetting $x = -n$ and $y = n,$ where $n$ is a positive integer, we get\n\\[f(-n) + f(n) = f(0) + n^2 - 1.\\]Then\n\\[f(-n) = n^2 - f(n) + f(0) - 1 = n^2 - \\frac{n^2 + 3n - 2}{2} - 2 = \\frac{n^2 - 3n - 2}{2}.\\]Thus, the formula\n\\[f(n) = \\frac{n^2 + 3n - 2}{2}\\]holds for all integers $n.$\n\nWe want to solve $f(n) = n,$ or\n\\[\\frac{n^2 + 3n - 2}{2} = n.\\]Then $n^2 + 3n - 2 = 2n,$ or $n^2 + n - 2 = 0.$  This factors as $(n - 1)(n + 2) = 0,$ so the solutions are $n = \\boxed{1,-2}.$", "subject": "Intermediate Algebra", "unique_id": "test/intermediate_algebra/1388.json", "answer": "1,-2"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions