diff --git "a/all/amps_algebra.json" "b/all/amps_algebra.json" new file mode 100644--- /dev/null +++ "b/all/amps_algebra.json" @@ -0,0 +1,99163 @@ +{ + "Source": [ + "AMPS.algebra.mathematica/algebra/system_of_equations" + ], + "Categories": [ + { + "Math complexity": 4, + "Language complexity": 1, + "Domain knowledge complexity": 3 + } + ], + "Instances": [ + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{35 x}{\\sqrt{3}}-\\frac{16 y}{\\sqrt{3}}+\\frac{32}{\\sqrt{3}}=0$, $\\frac{41 y}{\\sqrt{3}}+\\frac{4}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{1376}{1435}$, $y=-\\frac{4}{41}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((35*x)/(sqrt(3)))-((16*y)/(sqrt(3)))+(32/(sqrt(3))), ((41*y)/(sqrt(3)))+(4/(sqrt(3)))), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $(1+i) \\sqrt{10}$.", + "Output Answer": [ + "Norm: $2 \\sqrt{5}$\nArgument: $\\frac{\\pi }{4}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (1+i)*math.sqrt(10)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-1+4 i) \\sqrt{3}$ and $y=(-3-3 i) \\sqrt{3}$", + "Output Answer": [ + "$(2+7 i) \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-1+4*i)*math.sqrt(3)\ny = (-3-3*i)*math.sqrt(3)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -2 \\sqrt{5} \\left(3 x^2+x+2\\right)$, $q(x) = \\sqrt{5} \\left(5 x^2-2 x+2\\right)$", + "Output Answer": [ + "$-\\sqrt{5} x^2-4 \\sqrt{5} x-2 \\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*sqrt(5)*(3*x**2+x+2)\nq = sqrt(5)*(5*x**2-2*x+2)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $3 \\left(\\sin \\left(\\frac{7 \\pi }{36}\\right)-i \\cos \\left(\\frac{7 \\pi }{36}\\right)\\right)$.", + "Output Answer": [ + "Norm: $3 \\sqrt{\\sin ^2\\left(\\frac{7 \\pi }{36}\\right)+\\cos ^2\\left(\\frac{7 \\pi }{36}\\right)}$\nArgument: $-\\frac{11 \\pi }{36}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 3*(math.sin(((7*math.pi)/36))-i*math.cos(((7*math.pi)/36)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=16 t+26, x(t)=-8 t-15$", + "Output Answer": [ + "$y=-2 x-4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 16*t+26\nx_t = -8*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{4}{3} \\left(\\cos \\left(\\frac{61}{90}\\right)+i \\sin \\left(\\frac{61}{90}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$\\frac{16}{9} \\left(\\cos \\left(\\frac{61}{45}\\right)+i \\sin \\left(\\frac{61}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(4/3)*(math.cos((61/90))+1j*math.sin((61/90))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $4 x^2-11 x-10$", + "Output Answer": [ + "$4 \\left(x-\\frac{11}{8}\\right)^2-\\frac{281}{16}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (4*x**2-11*x-10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-6 x^2-120 x-\\frac{20736}{49}$", + "Output Answer": [ + "$6 \\left(-x-\\frac{32}{7}\\right) \\left(x+\\frac{108}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-6*x**2-120*x-(20736/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{2}{25} (416 t+1205), x(t)=-\\frac{26 t}{5}-15$", + "Output Answer": [ + "$y=\\frac{32 x}{5}-\\frac{2}{5}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -(2/25)*(416*t+1205)\nx_t = -((26*t)/5)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(-3+4 i) \\sqrt{5}$ and $y=(-2+4 i) \\sqrt{5}$", + "Output Answer": [ + "$(-5+8 i) \\sqrt{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-3+4*i)*math.sqrt(5)\ny = (-2+4*i)*math.sqrt(5)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(13-7)-24}{\\frac{4}{3}}$.", + "Output Answer": [ + "$-\\frac{27}{2}$" + ], + "Output Program": [ + "try: \n print((((13-7)-24)/(4/3)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{8 (6 x-5)^3}{3 \\sqrt{3}}, q(x) = 192 \\sqrt{3} (x-1)^3$", + "Output Answer": [ + "$-96 \\sqrt{3} x^2+176 \\sqrt{3} x-192 \\sqrt{3}+\\frac{1000}{3 \\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((8*(6*x-5)**3)/(3*sqrt(3)))\nq = 192*sqrt(3)*(x-1)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{300 x^2+735 x+450}{-30 x^2+234 x+324}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((300*x**2+735*x+450)/(-30*x**2+234*x+324)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{3}{17}$, and $a_n=a_{n-1}+-4 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$\\frac{13}{2} \\left(\\frac{6}{17}-48 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\na = (3/17) # initial value\nd = -4*math.sqrt(3) # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (3/17) # initial value\nd = -4*math.sqrt(3) # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=7 x+9$ at the point $x=-1$", + "Output Answer": [ + "$2 = 2.$" + ], + "Output Program": [ + "x = -1\ntry: \n f = 7*x+9\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{53}{78}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$\\frac{106}{39}$" + ], + "Output Program": [ + "a = (53/78) # initial value\nd = 0 # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (53/78) # initial value\nd = 0 # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 x^2-x-12$ and $q(x) = -12 x^2-x-14$", + "Output Answer": [ + "$48 x^4+16 x^3+201 x^2+26 x+168$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*x**2-x-12\nq = -12*x**2-x-14\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 14 x^2-3 x-15$ and $q(x) = -5 x^2-10 x+8$", + "Output Answer": [ + "$-70 x^4-125 x^3+217 x^2+126 x-120$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 14*x**2-3*x-15\nq = -5*x**2-10*x+8\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{1}{\\left(-x-\\frac{5}{3}\\right)^5}-1$ at the point $x=2$", + "Output Answer": [ + "$-\\frac{161294}{161051} = -1.002$" + ], + "Output Program": [ + "x = 2\ntry: \n f = (1/((-x-(5/3))**5))-1\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{44 x^6}{5}-\\frac{24 x^5}{5}-\\frac{21 x^4}{5}+3 x^3+\\frac{37 x^2}{5}-\\frac{17 x}{5}+\\frac{36}{5}$ when divided by $\\frac{22 x}{5}+\\frac{9}{5}$.", + "Output Answer": [ + "$-2 x^5-\\frac{3 x^4}{11}-\\frac{102 x^3}{121}+\\frac{2733 x^2}{2662}+\\frac{73897 x}{58564}-\\frac{1660661}{1288408}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((44*x**6)/5)-((24*x**5)/5)-((21*x**4)/5)+3*x**3+((37*x**2)/5)-((17*x)/5)+(36/5)\nq = ((22*x)/5)+(9/5)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(6-3)+(((19-4)+14)+22)$.", + "Output Answer": [ + "$54$" + ], + "Output Program": [ + "try: \n print((6-3)+(((19-4)+14)+22))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 10 x^2+7 x+3$ and $q(x) = 2 x^2-9 x-4$", + "Output Answer": [ + "$20 x^4-76 x^3-97 x^2-55 x-12$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 10*x**2+7*x+3\nq = 2*x**2-9*x-4\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=30 t-\\frac{13}{3} \\left(20+\\sqrt{3}\\right), x(t)=3 \\sqrt{3} t-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=\\frac{10 x}{\\sqrt{3}}-\\frac{13}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 30*t-(13/3)*(20+sqrt(3))\nx_t = 3*sqrt(3)*t-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -25 x^2-8 x-1\\right| =2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{25} \\left(-4-\\sqrt{41}\\right)\\right\\},\\left\\{x\\to \\frac{1}{25} \\left(-4+\\sqrt{41}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-25*x**2-8*x-1), 2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2-10 x+3 y^2+2 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $9 \\left(x-\\frac{5}{9}\\right)^2+3 \\left(y+\\frac{1}{3}\\right)^2=\\frac{73}{9}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{9} & \\frac{1}{9} \\left(-3-\\sqrt{146}\\right) \\\\\n \\frac{5}{9} & \\frac{1}{9} \\left(\\sqrt{146}-3\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{\\frac{5}{9},\\frac{1}{2} \\left(\\frac{1}{9} \\left(-3-\\sqrt{146}\\right)+\\frac{1}{9} \\left(\\sqrt{146}-3\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{73 \\pi }{27 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2-10*x+3*y**2+2*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{9}{25}$, and $a_n=a_{n-1}+\\frac{1}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$10 \\left(\\frac{19}{\\sqrt{3}}-\\frac{18}{25}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(9/25) # initial value\nd = (1/(math.sqrt(3))) # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(9/25) # initial value\nd = (1/(math.sqrt(3))) # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $6 x^4+6 x^3-3 x^2-12 x+3$ and $2 x^4+2 x^3-x^2-4 x+1$.", + "Output Answer": [ + "$2 x^4+2 x^3-x^2-4 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(6*x**4+6*x**3-3*x**2-12*x+3, 2*x**4+2*x**3-x**2-4*x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{136 x}{7}+\\frac{27}{7}\\right| =\\frac{146}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{173}{136}\\right\\},\\left\\{x\\to \\frac{7}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((136*x)/7)+(27/7)), (146/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(6+i) \\sqrt{2}$ and $y=(3+i) \\sqrt{2}$", + "Output Answer": [ + "$3 \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (6+i)*math.sqrt(2)\ny = (3+i)*math.sqrt(2)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2 \\sqrt{2} e^{\\frac{37 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $2 \\sqrt{2}$\nArgument: $\\frac{37 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2*math.sqrt(2)*math.e**((37*i*math.pi)/180)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\sqrt{3} \\left(\\cos \\left(\\frac{29}{30}\\right)+i \\sin \\left(\\frac{29}{30}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$27 \\sqrt{3} \\left(\\cos \\left(\\frac{203}{30}\\right)+i \\sin \\left(\\frac{203}{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.sqrt(3)*(math.cos((29/30))+1j*math.sin((29/30))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^4-4 x^2-x+2$ when divided by $-6$.", + "Output Answer": [ + "$-\\frac{2 x^4}{3}+\\frac{2 x^2}{3}+\\frac{x}{6}-\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**4-4*x**2-x+2\nq = -6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{3 \\left(-\\cos \\left(\\frac{11 \\pi }{180}\\right)-i \\sin \\left(\\frac{11 \\pi }{180}\\right)\\right)}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{3 \\sqrt{\\sin ^2\\left(\\frac{11 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{11 \\pi }{180}\\right)}}{\\pi }$\nArgument: $\\frac{11 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((3*(-math.cos(((11*math.pi)/180))-i*math.sin(((11*math.pi)/180))))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(\\cos \\left(\\frac{29}{15}\\right)+i \\sin \\left(\\frac{29}{15}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$2187 \\left(\\cos \\left(\\frac{203}{15}\\right)+i \\sin \\left(\\frac{203}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(math.cos((29/15))+1j*math.sin((29/15))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-x-2$ and $-x^3-3 x-4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-x-2, -x**3-3*x-4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{\\tan ^{-1}(1-4 x)}$ at the point $x=-8$", + "Output Answer": [ + "$\\sqrt{\\tan ^{-1}(33)} = 1.241$" + ], + "Output Program": [ + "import math\n\nx = -8\ntry: \n f = math.sqrt(math.atan(1-4*x))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=4+6 i$ and $y=-6$", + "Output Answer": [ + "$-24-36 i$" + ], + "Output Program": [ + "i = 1j\nx = 4+6*i\ny = -6\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -2 x^2-14 x$ and $q(x) = -9 x^2+8 x+3$", + "Output Answer": [ + "$18 x^4+110 x^3-118 x^2-42 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -2*x**2-14*x\nq = -9*x**2+8*x+3\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-x^2+19 x+13}{-21 x^2-9 x-20}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(19-\\sqrt{413}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(19+\\sqrt{413}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-x**2+19*x+13)/(-21*x**2-9*x-20)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the third order series of the inverse of the following function around 3:\n$\\frac{16}{x^4}$", + "Output Answer": [ + "$\\frac{15}{64} (x-1)^3-\\frac{5}{16} (x-1)^2+\\frac{x-1}{2}-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, (16/(x**4)))\nprint(solve(f, x)[0].series(y, 3, 3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$e^{\\frac{5}{2}-5 x} (-3 x-6)^5$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = math.e**((5/2)-5*x)*(-3*x-6)**5\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-340 x^2-319 x-70}{380 x+133}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{10}{17}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-340*x**2-319*x-70)/(380*x+133)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 5-7 x, q(x) = (7-5 x)^4$", + "Output Answer": [ + "$625 x^4-3500 x^3+7350 x^2-6867 x+2406$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5-7*x\nq = (7-5*x)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(-\\sin \\left(\\frac{2 \\pi }{9}\\right)-i \\cos \\left(\\frac{2 \\pi }{9}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-1977326743 \\left(\\cos \\left(\\frac{\\pi }{18}\\right)+i \\sin \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(-math.sin(((2*math.pi)/9))-1j*math.cos(((2*math.pi)/9))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{19}{3}-5 i$ and $y=\\frac{26}{3}-\\frac{20 i}{3}$", + "Output Answer": [ + "$\\frac{194}{9}-\\frac{770 i}{9}$" + ], + "Output Program": [ + "i = 1j\nx = (19/3)-5*i\ny = (26/3)-((20*i)/3)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\cos (8 x+6) \\tan (8 x+2)$", + "Output Answer": [ + "$\\frac{8 x+2}{\\pi }+\\frac{1}{2}\\notin \\mathbb{Z}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = cos(8*x+6)*tan(8*x+2)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{83}{51}$, and $a_n=a_{n-1}+-1$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$-\\frac{5057}{51}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(83/51) # initial value\nd = -1 # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(83/51) # initial value\nd = -1 # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{17 x^2}{2}+15 x+\\frac{7}{2}$", + "Output Answer": [ + "$x=\\frac{1}{17} \\left(-15-\\sqrt{106}\\right)\\lor x=\\frac{1}{17} \\left(\\sqrt{106}-15\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((17*x**2)/2)+15*x+(7/2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-98 x^2-14 x+40}{161 x-92}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-98*x**2-14*x+40)/(161*x-92)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(2+4)-(17-11)^2$.", + "Output Answer": [ + "$-30$" + ], + "Output Program": [ + "try: \n print((2+4)-(17-11)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(18-5) \\left(\\frac{18+25}{18}-22\\right)$.", + "Output Answer": [ + "$-\\frac{4589}{18}$" + ], + "Output Program": [ + "try: \n print((18-5)*(((18+25)/18)-22))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{19 x}{\\sqrt{2}}-\\frac{17}{\\sqrt{2}}$", + "Output Answer": [ + "$x=\\frac{17}{19}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((19*x)/(sqrt(2)))-(17/(sqrt(2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-5 x-4$ and $x^3-2 x^2-3 x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-5*x-4, x**3-2*x**2-3*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{80 x^2}{7}+\\frac{120 x}{7}-20}{8 x+\\frac{29}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-3-\\sqrt{37}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(-3+\\sqrt{37}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((80*x**2)/7)+((120*x)/7)-20)/(8*x+(29/7))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\sqrt{2} \\left(\\sin \\left(\\frac{7 \\pi }{45}\\right)-i \\cos \\left(\\frac{7 \\pi }{45}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$9604 \\left(-\\sin \\left(\\frac{11 \\pi }{90}\\right)+i \\cos \\left(\\frac{11 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*math.sqrt(2)*(math.sin(((7*math.pi)/45))-1j*math.cos(((7*math.pi)/45))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(17-16)-3}{((1-24)-12)-6}$.", + "Output Answer": [ + "$\\frac{2}{41}$" + ], + "Output Program": [ + "try: \n print((((17-16)-3)/(((1-24)-12)-6)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((11+12)-16)-\\left(\\left(((3-6)+19)^2+7\\right)-16\\right)$.", + "Output Answer": [ + "$-240$" + ], + "Output Program": [ + "try: \n print(((11+12)-16)-((((3-6)+19)**2+7)-16))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(160-\\sqrt{28}\\right)+\\left(\\sqrt{118}-\\sqrt{52}\\right)$.", + "Output Answer": [ + "$160-2 \\sqrt{7}-2 \\sqrt{13}+\\sqrt{118}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((160-sqrt(28))+(sqrt(118)-sqrt(52)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(((5-15)+4)^2-15\\right)-\\left(\\left(\\left((17+20)^2-19\\right)+18\\right)+21\\right)$.", + "Output Answer": [ + "$-1368$" + ], + "Output Program": [ + "try: \n print((((5-15)+4)**2-15)-((((17+20)**2-19)+18)+21))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x+2}+\\sqrt{8 x-7}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 64-5 \\sqrt{105}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x+2)+sqrt(8*x-7), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-x^2+x+7 y^2+4 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(y+\\frac{2}{7}\\right)^2-\\left(x-\\frac{1}{2}\\right)^2=\\frac{93}{28}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & \\frac{1}{7} \\left(-2-\\sqrt{186}\\right) \\\\\n \\frac{1}{2} & \\frac{1}{7} \\left(\\sqrt{186}-2\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{7} \\left(-2-\\sqrt{186}\\right)+\\frac{1}{7} \\left(\\sqrt{186}-2\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{14} \\left(\\sqrt{7}-4\\right)-\\frac{x}{\\sqrt{7}},y=\\frac{x}{\\sqrt{7}}+\\frac{1}{14} \\left(-4-\\sqrt{7}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-x**2+x+7*y**2+4*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $4 \\sqrt{3} x^2-6 \\sqrt{3} x-\\sqrt{3}$", + "Output Answer": [ + "$x=\\frac{1}{4} \\left(3-\\sqrt{13}\\right)\\lor x=\\frac{1}{4} \\left(3+\\sqrt{13}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(4*sqrt(3)*x**2-6*sqrt(3)*x-sqrt(3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{26}{27}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$-\\frac{286}{27}$" + ], + "Output Program": [ + "a = -(26/27) # initial value\nd = 0 # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(26/27) # initial value\nd = 0 # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{1357 x^2}{49}-\\frac{3863 x}{49}+\\frac{2052}{49}}{\\frac{5251 x}{49}-\\frac{2403}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{76}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((1357*x**2)/49)-((3863*x)/49)+(2052/49))/(((5251*x)/49)-(2403/49))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2 e^{-\\frac{i \\pi }{3}} \\pi$.", + "Output Answer": [ + "Norm: $2 \\pi$\nArgument: $-\\frac{\\pi }{3}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2*math.e**(-((i*math.pi)/3))*math.pi\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $14 x^2+2 x+1$", + "Output Answer": [ + "$14 \\left(x+\\frac{1}{14}\\right)^2+\\frac{13}{14}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (14*x**2+2*x+1), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-6 x-9 y-22 z+3=0$, $25 x+4 y-6 z+8=0$, $9 x-7 y-11 z-20=0$", + "Output Answer": [ + "$x=\\frac{2658}{3169}$, $y=-\\frac{14495}{3169}$, $z=\\frac{5637}{3169}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-6*x-9*y-22*z+3, 25*x+4*y-6*z+8, 9*x-7*y-11*z-20)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $12 x^5-4 x^4+8 x^3+16 x^2+16 x-20$ and $3 x^5-x^4+2 x^3+4 x^2+4 x-5$.", + "Output Answer": [ + "$3 x^5-x^4+2 x^3+4 x^2+4 x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(12*x**5-4*x**4+8*x**3+16*x**2+16*x-20, 3*x**5-x**4+2*x**3+4*x**2+4*x-5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 8 (x-1), q(x) = 49 (x-1)^2$", + "Output Answer": [ + "$49 x^2-90 x+41$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*(x-1)\nq = 49*(x-1)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\sqrt{5} \\left(-\\frac{\\sqrt{3}}{2}-\\frac{i}{2}\\right)$.", + "Output Answer": [ + "Norm: $\\sqrt{5}$\nArgument: $\\frac{\\pi }{6}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.sqrt(5)*(-((math.sqrt(3))/2)-(i/2))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((21+9)-11)+((((12-21)+4)-19)+4)$.", + "Output Answer": [ + "$-1$" + ], + "Output Program": [ + "try: \n print(((21+9)-11)+((((12-21)+4)-19)+4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\pi \\left(x^2-3\\right)$, $q(x) = \\pi \\left(x^2+3 x-2\\right)$", + "Output Answer": [ + "$3 \\pi x+\\pi$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -pi*(x**2-3)\nq = pi*(x**2+3*x-2)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{5}}, \\sqrt{2}, 2)$", + "Output Answer": [ + "$\\left\\{\\sqrt{\\frac{31}{5}},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{11}{5}}}{2}\\right),\\tan ^{-1}\\left(\\sqrt{10}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(5)))\ny = math.sqrt(2)\nz = 2\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=e^{4-3 x^2}-\\frac{1}{-x-7}$ at the point $x=-9$", + "Output Answer": [ + "$-\\frac{1}{2}+\\frac{1}{e^{239}} = -0.5$" + ], + "Output Program": [ + "import math\n\nx = -9\ntry: \n f = math.e**(4-3*x**2)-(1/(-x-7))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{127}+\\sqrt{37}\\right)-\\left(\\sqrt{130}+\\sqrt{49}\\right)$.", + "Output Answer": [ + "$-7+\\sqrt{37}+\\sqrt{127}-\\sqrt{130}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(127)+sqrt(37))-(sqrt(130)+sqrt(49)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{3 x^2}{2}-3 x+\\frac{11}{2}$ when divided by $\\frac{7 x}{2}-\\frac{3}{2}$.", + "Output Answer": [ + "$-\\frac{3 x}{7}-\\frac{51}{49}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((3*x**2)/2)-3*x+(11/2)\nq = ((7*x)/2)-(3/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^4+5 x^3-3 x^2-3$ when divided by $-3 x^2+9 x+7$.", + "Output Answer": [ + "$-\\frac{5 x^2}{3}-\\frac{20 x}{3}-\\frac{206}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**4+5*x**3-3*x**2-3\nq = -3*x**2+9*x+7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{44 x^2}{5}-\\frac{42 x}{5}+\\frac{18}{5}$", + "Output Answer": [ + "$x=\\frac{3}{44} \\left(7-i \\sqrt{39}\\right)\\lor x=\\frac{3}{44} \\left(7+i \\sqrt{39}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((44*x**2)/5)-((42*x)/5)+(18/5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-2 \\pi \\left(\\cos \\left(\\frac{\\pi }{18}\\right)+i \\sin \\left(\\frac{\\pi }{18}\\right)\\right)$.", + "Output Answer": [ + "Norm: $2 \\pi \\sqrt{\\sin ^2\\left(\\frac{\\pi }{18}\\right)+\\cos ^2\\left(\\frac{\\pi }{18}\\right)}$\nArgument: $-\\frac{17 \\pi }{18}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -2*math.pi*(math.cos((math.pi/18))+i*math.sin((math.pi/18)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(103-35 t)^2, x(t)=5 t-15$", + "Output Answer": [ + "$y=49 x^2+28 x+4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (103-35*t)**2\nx_t = 5*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$(3 x+8)^4$", + "Output Answer": [ + "$y\\geq 0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range((3*x+8)**4, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(137-9 t)^2, x(t)=t-15$", + "Output Answer": [ + "$y=81 x^2-36 x+4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (137-9*t)**2\nx_t = t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $12 x^2-6 x+7$", + "Output Answer": [ + "$x=\\frac{1}{12} \\left(3-5 i \\sqrt{3}\\right)\\lor x=\\frac{1}{12} \\left(3+5 i \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(12*x**2-6*x+7, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^5+3 x^4+7 x^3+7 x^2-7 x-9$ when divided by $x^5+x^4-10 x^3+x^2-9 x+2$.", + "Output Answer": [ + "$-7$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**5+3*x**4+7*x**3+7*x**2-7*x-9\nq = x**5+x**4-10*x**3+x**2-9*x+2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{81}{5}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$405$" + ], + "Output Program": [ + "a = (81/5) # initial value\nd = 0 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (81/5) # initial value\nd = 0 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=2 \\sqrt{3} \\left(150 t^2-540 t+487\\right), x(t)=75 t^2-270 t+243$", + "Output Answer": [ + "$y=4 \\sqrt{3} x+2 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 2*sqrt(3)*(150*t**2-540*t+487)\nx_t = 75*t**2-270*t+243\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{11}{67}$, and $a_n=a_{n-1}+-3$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$-\\frac{70848}{67}$" + ], + "Output Program": [ + "a = -(11/67) # initial value\nd = -3 # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(11/67) # initial value\nd = -3 # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $7 x+2 y^2+6 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $7 x+2 y^2+6 y=9$\nVertex: $\\left\\{\\frac{27}{14},-\\frac{3}{2}\\right\\}$\nDirectrix: $x=\\frac{157}{56}$\nFocal Parameter: $\\frac{7}{4}$\nFocus: $\\left\\{\\frac{59}{56},-\\frac{3}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x+2*y**2+6*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2 \\sqrt{5} \\left(-\\sin \\left(\\frac{\\pi }{15}\\right)-i \\cos \\left(\\frac{\\pi }{15}\\right)\\right)$.", + "Output Answer": [ + "Norm: $2 \\sqrt{5 \\left(\\sin ^2\\left(\\frac{\\pi }{15}\\right)+\\cos ^2\\left(\\frac{\\pi }{15}\\right)\\right)}$\nArgument: $-\\frac{17 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2*math.sqrt(5)*(-math.sin((math.pi/15))-i*math.cos((math.pi/15)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\log \\left(\\frac{17}{2}-7 x\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{15}{14}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(log((17/2)-7*x), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the first order series of the inverse of the following function around 1:\n$-\\tan \\left(x^3\\right)$", + "Output Answer": [ + "$\\frac{x+\\tan (125)}{-75-75 \\tan ^2(125)}+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, -tan(x**3))\nprint(solve(f, x)[0].series(y, 1, 1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-1-5 i) \\sqrt{3}$ and $y=(-2+2 i) \\sqrt{3}$", + "Output Answer": [ + "$-1+\\frac{3 i}{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-1-5*i)*math.sqrt(3)\ny = (-2+2*i)*math.sqrt(3)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\sin (7 x+8)$", + "Output Answer": [ + "$-1\\leq y\\leq 1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(sin(7*x+8), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-5 \\sqrt{2} x-\\frac{11 y}{\\sqrt{2}}-4 \\sqrt{2}=0$, $-2 \\sqrt{2} x-\\frac{5 y}{\\sqrt{2}}-8 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{68}{3}$, $y=-\\frac{64}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-5*sqrt(2)*x-((11*y)/(sqrt(2)))-4*sqrt(2), -2*sqrt(2)*x-((5*y)/(sqrt(2)))-8*sqrt(2)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 11 x+3| =20$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{23}{11}\\right\\},\\left\\{x\\to \\frac{17}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11*x+3), 20), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(19+22)-5}{\\left(((1-22)-4)^2-11\\right)+11}$.", + "Output Answer": [ + "$\\frac{36}{625}$" + ], + "Output Program": [ + "try: \n print((((19+22)-5)/((((1-22)-4)**2-11)+11)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{9 t^2}{4}+135 t-2022, x(t)=\\frac{t^2}{4}-15 t+225$", + "Output Answer": [ + "$y=3-9 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -((9*t**2)/4)+135*t-2022\nx_t = ((t**2)/4)-15*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{27} \\left(275 t^2+2860 t+7439\\right)^2, x(t)=\\frac{25 t^2}{3}+\\frac{260 t}{3}+\\frac{676}{3}$", + "Output Answer": [ + "$y=\\frac{121 x^2}{3}+\\frac{22 x}{3}+\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/27)*(275*t**2+2860*t+7439)**2\nx_t = ((25*t**2)/3)+((260*t)/3)+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{31 x^2}{2}-21 x-\\frac{5}{2}}{-3 x-\\frac{17}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{31} \\left(21-2 \\sqrt{149}\\right)\\right\\},\\left\\{x\\to \\frac{1}{31} \\left(21+2 \\sqrt{149}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((31*x**2)/2)-21*x-(5/2))/(-3*x-(17/2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-12 x^5+8 x^4+4 x^3-8 x^2+12$ and $-3 x^5+2 x^4+x^3-2 x^2+3$.", + "Output Answer": [ + "$3 x^5-2 x^4-x^3+2 x^2-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-12*x**5+8*x**4+4*x**3-8*x**2+12, -3*x**5+2*x**4+x**3-2*x**2+3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 12 x^2+18 x+2\\right| =7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(-9-\\sqrt{141}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(-9+\\sqrt{141}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(12*x**2+18*x+2), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 8$, $q(x) = 11 x^2+x+2$", + "Output Answer": [ + "$11 x^2+x+10$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8\nq = 11*x**2+x+2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$17 x+18 y-9 z+16=0$, $-x+24 y+24 z+6=0$, $-16 x-17 y+9 z+12=0$", + "Output Answer": [ + "$x=-\\frac{5902}{83}$, $y=\\frac{3578}{83}$, $z=-\\frac{11534}{249}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((17*x+18*y-9*z+16, -x+24*y+24*z+6, -16*x-17*y+9*z+12)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{23}{3}-\\frac{4 i}{3}$ and $y=\\frac{1}{3}+7 i$", + "Output Answer": [ + "$-\\frac{61}{442}-\\frac{487 i}{442}$" + ], + "Output Program": [ + "i = 1j\nx = (23/3)-((4*i)/3)\ny = (1/3)+7*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt{\\frac{15 x}{2}+8}$", + "Output Answer": [ + "$x\\geq -\\frac{16}{15}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sqrt(((15*x)/2)+8)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{13 x}{\\sqrt{2}}-13 \\sqrt{2} y+\\frac{15}{\\sqrt{2}}=0$, $\\frac{13 x}{\\sqrt{2}}-15 \\sqrt{2} y-\\frac{15}{\\sqrt{2}}=0$", + "Output Answer": [ + "$x=\\frac{15}{13}$, $y=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((13*x)/(sqrt(2)))-13*sqrt(2)*y+(15/(sqrt(2))), ((13*x)/(sqrt(2)))-15*sqrt(2)*y-(15/(sqrt(2)))), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 x^2-x+6$ and $q(x) = -2 x^2+8 x+12$", + "Output Answer": [ + "$-10 x^4+42 x^3+40 x^2+36 x+72$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*x**2-x+6\nq = -2*x**2+8*x+12\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 x^2-7 x+6$ and $q(x) = 11 x^2+13 x-11$", + "Output Answer": [ + "$22 x^4-51 x^3-47 x^2+155 x-66$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*x**2-7*x+6\nq = 11*x**2+13*x-11\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\log \\left(\\frac{17 x}{2}+7\\right)$", + "Output Answer": [ + "$y\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(log(((17*x)/2)+7), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{8 x^2+25 x-1}{21 x^2+20 x+23}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(-25-3 \\sqrt{73}\\right)\\right\\},\\left\\{x\\to \\frac{1}{16} \\left(-25+3 \\sqrt{73}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((8*x**2+25*x-1)/(21*x**2+20*x+23)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$24 x+18 y+11 z-9=0$, $19 x-18 y+7 z-1=0$, $8 x-2 y-12 z+24=0$", + "Output Answer": [ + "$x=-\\frac{2756}{5899}$, $y=\\frac{598}{5899}$, $z=\\frac{9861}{5899}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((24*x+18*y+11*z-9, 19*x-18*y+7*z-1, 8*x-2*y-12*z+24)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 12 x^2-14 x-15$ and $q(x) = -12 x^2-x$", + "Output Answer": [ + "$-144 x^4+156 x^3+194 x^2+15 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 12*x**2-14*x-15\nq = -12*x**2-x\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+2 x-9 y^2-9 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x+\\frac{1}{3}\\right)^2-9 \\left(y+\\frac{1}{2}\\right)^2=-\\frac{35}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{3} & \\frac{1}{18} \\left(-9-2 \\sqrt{105}\\right) \\\\\n -\\frac{1}{3} & \\frac{1}{18} \\left(2 \\sqrt{105}-9\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2$\nCenter: $\\left\\{-\\frac{1}{3},\\frac{1}{2} \\left(\\frac{1}{18} \\left(-9-2 \\sqrt{105}\\right)+\\frac{1}{18} \\left(2 \\sqrt{105}-9\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{18} \\left(-9-2 \\sqrt{3}\\right)-\\frac{x}{\\sqrt{3}},y=\\frac{x}{\\sqrt{3}}+\\frac{1}{18} \\left(2 \\sqrt{3}-9\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+2*x-9*y**2-9*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{7 \\left(-\\cos \\left(\\frac{43 \\pi }{180}\\right)+i \\sin \\left(\\frac{43 \\pi }{180}\\right)\\right)}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{7 \\sqrt{\\sin ^2\\left(\\frac{43 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{43 \\pi }{180}\\right)}}{\\pi }$\nArgument: $\\frac{137 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((7*(-math.cos(((43*math.pi)/180))+i*math.sin(((43*math.pi)/180))))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x+10 y^2-7 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $8 x+10 y^2-7 y=4$\nVertex: $\\left\\{\\frac{209}{320},\\frac{7}{20}\\right\\}$\nDirectrix: $x=\\frac{273}{320}$\nFocal Parameter: $\\frac{2}{5}$\nFocus: $\\left\\{\\frac{29}{64},\\frac{7}{20}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x+10*y**2-7*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^6+5 x^5-x^4-x^3-x^2+6 x+2$ when divided by $-10 x^5+8 x^4-7 x^3-9 x^2+x+8$.", + "Output Answer": [ + "$-\\frac{9 x}{10}-\\frac{61}{50}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**6+5*x**5-x**4-x**3-x**2+6*x+2\nq = -10*x**5+8*x**4-7*x**3-9*x**2+x+8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{91 x^3}{3}-211 x^2-\\frac{583 x}{3}+221}{28 x+156}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{13} \\left(-9-\\sqrt{302}\\right)\\right\\},\\left\\{x\\to \\frac{1}{13} \\left(-9+\\sqrt{302}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((91*x**3)/3)-211*x**2-((583*x)/3)+221)/(28*x+156)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{4} (5 x+8)^2, q(x) = \\frac{3 (x-1)}{2}$", + "Output Answer": [ + "$\\frac{25 x^2}{4}+\\frac{43 x}{2}+\\frac{29}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/4)*(5*x+8)**2\nq = ((3*(x-1))/2)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{72 x}{7}-\\frac{62}{7}}+\\sqrt{-\\frac{17 x}{7}-\\frac{41}{7}}=\\frac{78}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-549561+156 \\sqrt{6716086}}{21175}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((72*x)/7)-(62/7))+sqrt(-((17*x)/7)-(41/7)), (78/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x^2-14 x-8$ and $4 x+2$.", + "Output Answer": [ + "$4 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x**2-14*x-8, 4*x+2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-7 x^2+84 x-245$", + "Output Answer": [ + "$-7 (x-7) (x-5)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-7*x**2+84*x-245, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 10 x^2+x+17\\right| =-20$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(10*x**2+x+17), -20), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+8 x+5 y^2+9 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x+\\frac{1}{2}\\right)^2+5 \\left(y+\\frac{9}{10}\\right)^2=\\frac{261}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{2} & -\\frac{3}{40} \\left(12+\\sqrt{174}\\right) \\\\\n -\\frac{1}{2} & \\frac{3}{40} \\left(\\sqrt{174}-12\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{3}{2}}}{2}$\nCenter: $\\left\\{-\\frac{1}{2},\\frac{1}{2} \\left(\\frac{3}{40} \\left(\\sqrt{174}-12\\right)-\\frac{3}{40} \\left(12+\\sqrt{174}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{261 \\pi }{40 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+8*x+5*y**2+9*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-6 x^2+2 x+4$ and $2 x-2$.", + "Output Answer": [ + "$2 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-6*x**2+2*x+4, 2*x-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-20 x^2-17 x+18}{6-20 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{40} \\left(-17-\\sqrt{1729}\\right)\\right\\},\\left\\{x\\to \\frac{1}{40} \\left(-17+\\sqrt{1729}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-20*x**2-17*x+18)/(6-20*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-192 t^2+720 t-667, x(t)=64 t^2-240 t+225$", + "Output Answer": [ + "$y=8-3 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -192*t**2+720*t-667\nx_t = 64*t**2-240*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -13 x^2+4 x+11$ and $q(x) = 6 x^2+x-8$", + "Output Answer": [ + "$-78 x^4+11 x^3+174 x^2-21 x-88$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -13*x**2+4*x+11\nq = 6*x**2+x-8\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -7 x^2+3 x-10$ and $q(x) = x^2-14 x-8$", + "Output Answer": [ + "$-7 x^4+101 x^3+4 x^2+116 x+80$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -7*x**2+3*x-10\nq = x**2-14*x-8\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the third order series of the inverse of the following function around 3:\n$\\frac{1}{x^3}$", + "Output Answer": [ + "$\\frac{1}{\\sqrt[3]{x}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, (1/(x**3)))\nprint(solve(f, x)[0].series(y, 3, 3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{31}{2}-6 t, x(t)=4 t-15$", + "Output Answer": [ + "$y=-\\frac{3 x}{2}-7$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (31/2)-6*t\nx_t = 4*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(7-4)^2-((22+7)-11)$.", + "Output Answer": [ + "$-9$" + ], + "Output Program": [ + "try: \n print((7-4)**2-((22+7)-11))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 \\left(162 t^2-810 t+1015\\right)^2, x(t)=36 t^2-180 t+225$", + "Output Answer": [ + "$y=81 x^2+90 x+25$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*(162*t**2-810*t+1015)**2\nx_t = 36*t**2-180*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-14 x-13}+\\sqrt{1-13 x}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1421}{-689-10 \\sqrt{4733}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-14*x-13)+sqrt(1-13*x), 5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10-5 x}+\\sqrt{-2 x-5}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-1138+26 \\sqrt{1555}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10-5*x)+sqrt(-2*x-5), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-3 x^2+5 x+1$ when divided by $10$.", + "Output Answer": [ + "$-\\frac{3 x^2}{10}+\\frac{x}{2}+\\frac{1}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x**2+5*x+1\nq = 10\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-8+\\frac{14 i}{3}$ and $y=-1+\\frac{5 i}{3}$", + "Output Answer": [ + "$\\frac{71}{17}+\\frac{39 i}{17}$" + ], + "Output Program": [ + "i = 1j\nx = -8+((14*i)/3)\ny = -1+((5*i)/3)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(13+18)+\\left(\\frac{1}{10} ((16-5)+19)-2\\right)$.", + "Output Answer": [ + "$32$" + ], + "Output Program": [ + "try: \n print((13+18)+((1/10)*((16-5)+19)-2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{89 x}{7}+\\frac{145 y}{7}+\\frac{40 z}{7}-18=0$, $-\\frac{10 x}{7}+\\frac{47 y}{7}+\\frac{95 z}{7}-11=0$, $-\\frac{149 x}{7}+\\frac{101 y}{7}-\\frac{43 z}{7}-\\frac{57}{7}=0$", + "Output Answer": [ + "$x=-\\frac{1858}{280427}$, $y=\\frac{624976}{841281}$, $z=\\frac{372095}{841281}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((89*x)/7)+((145*y)/7)+((40*z)/7)-18, -((10*x)/7)+((47*y)/7)+((95*z)/7)-11, -((149*x)/7)+((101*y)/7)-((43*z)/7)-(57/7))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{1}{27} (21 x-20)^3, q(x) = 4 x+\\frac{25}{3}$", + "Output Answer": [ + "$-343 x^3+980 x^2-\\frac{2788 x}{3}+\\frac{8225}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(1/27)*(21*x-20)**3\nq = 4*x+(25/3)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-10 \\sqrt{3} x+6 \\sqrt{3} y-10 \\sqrt{3} z-13 \\sqrt{3}=0$, $13 \\sqrt{3} x-3 \\sqrt{3} y-10 \\sqrt{3} z=0$, $11 \\sqrt{3} x-7 \\sqrt{3} y-6 \\sqrt{3} z+3 \\sqrt{3}=0$", + "Output Answer": [ + "$x=-\\frac{203}{454}$, $y=\\frac{137}{454}$, $z=-\\frac{305}{454}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-10*sqrt(3)*x+6*sqrt(3)*y-10*sqrt(3)*z-13*sqrt(3), 13*sqrt(3)*x-3*sqrt(3)*y-10*sqrt(3)*z, 11*sqrt(3)*x-7*sqrt(3)*y-6*sqrt(3)*z+3*sqrt(3))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{48 x}{5}+\\frac{76 y}{5}-\\frac{88}{5}=0$, $\\frac{103 x}{5}+\\frac{107 y}{5}-\\frac{44}{5}=0$", + "Output Answer": [ + "$x=-\\frac{1518}{3241}$, $y=\\frac{2794}{3241}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((48*x)/5)+((76*y)/5)-(88/5), ((103*x)/5)+((107*y)/5)-(44/5)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-7 x^2-61 x+986$", + "Output Answer": [ + "$-7 (-x-17) \\left(\\frac{58}{7}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-7*x**2-61*x+986, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+5 x+2 y^2+8 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x+\\frac{5}{8}\\right)^2+2 (y+2)^2=\\frac{185}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{8} & -2-\\frac{\\sqrt{185}}{8} \\\\\n -\\frac{5}{8} & \\frac{\\sqrt{185}}{8}-2 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{-\\frac{5}{8},-2\\right\\}$\nArea Enclosed: $\\frac{185 \\pi }{32 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+5*x+2*y**2+8*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $6 \\sqrt{5} x^2+\\sqrt{5} x-4 \\sqrt{5}$", + "Output Answer": [ + "$x=\\frac{1}{12} \\left(-1-\\sqrt{97}\\right)\\lor x=\\frac{1}{12} \\left(\\sqrt{97}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(6*sqrt(5)*x**2+sqrt(5)*x-4*sqrt(5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-3 x-8$ when divided by $3 x-1$.", + "Output Answer": [ + "$-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x-8\nq = 3*x-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{9 x^2}{\\sqrt{2}}-\\frac{7 x}{\\sqrt{2}}+3 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{\\frac{7}{\\sqrt{2}}-i \\sqrt{\\frac{167}{2}}}{9 \\sqrt{2}}\\lor x=\\frac{\\frac{7}{\\sqrt{2}}+i \\sqrt{\\frac{167}{2}}}{9 \\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((9*x**2)/(sqrt(2)))-((7*x)/(sqrt(2)))+3*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-13 x-22 y+6 z+23=0$, $-19 x+9 y+19 z+20=0$, $6 x-y+10 z+7=0$", + "Output Answer": [ + "$x=\\frac{3483}{8315}$, $y=\\frac{4603}{8315}$, $z=-\\frac{1490}{1663}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-13*x-22*y+6*z+23, -19*x+9*y+19*z+20, 6*x-y+10*z+7)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2+7 x+8 y^2-3 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $\\left(x+\\frac{7}{2}\\right)^2+8 \\left(y-\\frac{3}{16}\\right)^2=\\frac{657}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{7}{2}-\\frac{3 \\sqrt{511}}{16} & \\frac{3}{16} \\\\\n \\frac{3 \\sqrt{511}}{16}-\\frac{7}{2} & \\frac{3}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{7}{2}}}{2}$\nCenter: $\\left\\{-\\frac{7}{2},\\frac{3}{16}\\right\\}$\nArea Enclosed: $\\frac{657 \\pi }{64 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2+7*x+8*y**2-3*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-4 x^2-12 \\sqrt{3} x+1056$", + "Output Answer": [ + "$-4 \\left(x-8 \\sqrt{3}\\right) \\left(x+11 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-4*x**2-12*sqrt(3)*x+1056, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 13 x^2-6 x-2$ and $q(x) = 11 x^2+8 x-4$", + "Output Answer": [ + "$143 x^4+38 x^3-122 x^2+8 x+8$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 13*x**2-6*x-2\nq = 11*x**2+8*x-4\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 (4 x+3)^4, q(x) = \\frac{1-2 x}{\\sqrt{2}}$", + "Output Answer": [ + "$1024 x^4+3072 x^3+3456 x^2-\\sqrt{2} x+1728 x+\\frac{1}{\\sqrt{2}}+324$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*(4*x+3)**4\nq = ((1-2*x)/(sqrt(2)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2-6 x+8 y^2+7 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x-\\frac{3}{10}\\right)^2+8 \\left(y+\\frac{7}{16}\\right)^2=\\frac{869}{160}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{10} & \\frac{1}{80} \\left(-35-\\sqrt{869}\\right) \\\\\n \\frac{3}{10} & \\frac{1}{80} \\left(\\sqrt{869}-35\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{5}}$\nCenter: $\\left\\{\\frac{3}{10},\\frac{1}{2} \\left(\\frac{1}{80} \\left(-35-\\sqrt{869}\\right)+\\frac{1}{80} \\left(\\sqrt{869}-35\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{869 \\pi }{640 \\sqrt{5}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2-6*x+8*y**2+7*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-2 e \\left(-\\cos \\left(\\frac{13 \\pi }{90}\\right)+i \\sin \\left(\\frac{13 \\pi }{90}\\right)\\right)$.", + "Output Answer": [ + "Norm: $2 e \\sqrt{\\sin ^2\\left(\\frac{13 \\pi }{90}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{90}\\right)}$\nArgument: $-\\frac{13 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -2*math.e*(-math.cos(((13*math.pi)/90))+i*math.sin(((13*math.pi)/90)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{25 x^3+529 x^2+63 x-441}{-200 x^2+693 x-441}=0$", + "Output Answer": [ + "$\\{\\{x\\to -21\\},\\{x\\to -1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((25*x**3+529*x**2+63*x-441)/(-200*x**2+693*x-441)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{73 x}{3}+\\frac{7 y}{3}-\\frac{34 z}{3}-\\frac{5}{3}=0$, $\\frac{26 x}{3}-17 y-\\frac{4 z}{3}-\\frac{41}{3}=0$, $\\frac{64 x}{3}+\\frac{46 y}{3}-\\frac{52 z}{3}+\\frac{40}{3}=0$", + "Output Answer": [ + "$x=\\frac{591}{1051}$, $y=-\\frac{621}{1051}$, $z=\\frac{1973}{2102}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((73*x)/3)+((7*y)/3)-((34*z)/3)-(5/3), ((26*x)/3)-17*y-((4*z)/3)-(41/3), ((64*x)/3)+((46*y)/3)-((52*z)/3)+(40/3))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $-\\tan \\left(\\frac{36}{5}-\\frac{32 x}{5}\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{32} (5 \\pi c_1+36)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(-tan((36/5)-((32*x)/5)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{25 x}{3}-\\frac{4}{3}}+\\sqrt{\\frac{32 x}{3}+12}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(4748-8 \\sqrt{347403}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((25*x)/3)-(4/3))+sqrt(((32*x)/3)+12), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $5 x^3+110 x^2-600 x-17280$", + "Output Answer": [ + "$-5 (-x-18) (x-12) (x+16)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(5*x**3+110*x**2-600*x-17280, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 1296 x^4, q(x) = 729$", + "Output Answer": [ + "$1296 x^4+729$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 1296*x**4\nq = 729\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -4 (x+2), q(x) = (7-5 x)^2$", + "Output Answer": [ + "$25 x^2-74 x+41$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*(x+2)\nq = (7-5*x)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(23-19)-((17-15)+5)$.", + "Output Answer": [ + "$-3$" + ], + "Output Program": [ + "try: \n print((23-19)-((17-15)+5))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\cos \\left(\\frac{3}{5}\\right)-i \\sin \\left(\\frac{3}{5}\\right)\\right)^7$", + "Output Answer": [ + "$-\\cos \\left(\\frac{21}{5}\\right)-i \\sin \\left(\\frac{21}{5}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-math.cos((3/5))-1j*math.sin((3/5)))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt{-2 x^4-1}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\sqrt[4]{-\\frac{1}{2}}\\right\\},\\left\\{x\\to \\sqrt[4]{-\\frac{1}{2}}\\right\\},\\left\\{x\\to -\\frac{(-1)^{3/4}}{\\sqrt[4]{2}}\\right\\},\\left\\{x\\to \\frac{(-1)^{3/4}}{\\sqrt[4]{2}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(sqrt(-2*x**4-1), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((13+12)-16)+((((11+12)+6)+12)+8)$.", + "Output Answer": [ + "$58$" + ], + "Output Program": [ + "try: \n print(((13+12)-16)+((((11+12)+6)+12)+8))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $6 x^2+12 x-3$ and $2 x^2+4 x-1$.", + "Output Answer": [ + "$2 x^2+4 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(6*x**2+12*x-3, 2*x**2+4*x-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-7 x-3}+\\sqrt{-3 x-14}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{11}{8} \\left(-53+\\sqrt{2185}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-7*x-3)+sqrt(-3*x-14), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 \\left(224 t^2+840 t+789\\right)^2, x(t)=64 t^2+240 t+225$", + "Output Answer": [ + "$y=49 x^2+42 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*(224*t**2+840*t+789)**2\nx_t = 64*t**2+240*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{31}{4}-\\frac{29 i}{4}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{\\frac{901}{2}}}{2}$\nArgument: $\\tan ^{-1}\\left(\\frac{29}{31}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(31/4)-((29*i)/4)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-8 \\left(\\sin \\left(\\frac{\\pi }{60}\\right)-i \\cos \\left(\\frac{\\pi }{60}\\right)\\right)$.", + "Output Answer": [ + "Norm: $8 \\sqrt{\\sin ^2\\left(\\frac{\\pi }{60}\\right)+\\cos ^2\\left(\\frac{\\pi }{60}\\right)}$\nArgument: $\\frac{31 \\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -8*(math.sin((math.pi/60))-i*math.cos((math.pi/60)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$11 x+5 y-20=0$, $24 x-6 y+10=0$", + "Output Answer": [ + "$x=\\frac{35}{93}$, $y=\\frac{295}{93}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((11*x+5*y-20, 24*x-6*y+10), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x-1$ and $-5$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x-1, -5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{11 x^2-21 x+7}{\\sqrt{2}}$, $q(x) = -\\frac{14 x^2+4 x+17}{\\sqrt{2}}$", + "Output Answer": [ + "$-7 \\sqrt{2} x^2+\\frac{11 x^2}{\\sqrt{2}}-2 \\sqrt{2} x-\\frac{21 x}{\\sqrt{2}}-5 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((11*x**2-21*x+7)/(sqrt(2)))\nq = -((14*x**2+4*x+17)/(sqrt(2)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2+6 x+9 y^2+6 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $(x+3)^2+9 \\left(y+\\frac{1}{3}\\right)^2=15$\nFoci: $\\left(\n\\begin{array}{cc}\n -3-2 \\sqrt{\\frac{10}{3}} & -\\frac{1}{3} \\\\\n 2 \\sqrt{\\frac{10}{3}}-3 & -\\frac{1}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2 \\sqrt{2}}{3}$\nCenter: $\\left\\{-3,-\\frac{1}{3}\\right\\}$\nArea Enclosed: $5 \\pi$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2+6*x+9*y**2+6*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{28 x}{\\sqrt{3}}+2 \\sqrt{3} y-9 \\sqrt{3} z+\\frac{7}{\\sqrt{3}}=0$, $2 \\sqrt{3} x+\\frac{37 y}{\\sqrt{3}}+\\frac{38 z}{\\sqrt{3}}+2 \\sqrt{3}=0$, $6 \\sqrt{3} x-\\frac{37 y}{\\sqrt{3}}+10 \\sqrt{3} z-\\frac{28}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{5915}{21724}$, $y=-\\frac{5963}{10862}$, $z=\\frac{2279}{5431}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((28*x)/(sqrt(3)))+2*sqrt(3)*y-9*sqrt(3)*z+(7/(sqrt(3))), 2*sqrt(3)*x+((37*y)/(sqrt(3)))+((38*z)/(sqrt(3)))+2*sqrt(3), 6*sqrt(3)*x-((37*y)/(sqrt(3)))+10*sqrt(3)*z-(28/(sqrt(3))))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{19 x^2}{2}-\\frac{19 x}{2}+23}{\\frac{87 x^2}{4}-\\frac{41 x}{2}+\\frac{63}{4}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{38} \\left(-19-\\sqrt{3857}\\right)\\right\\},\\left\\{x\\to \\frac{1}{38} \\left(-19+\\sqrt{3857}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((19*x**2)/2)-((19*x)/2)+23)/(((87*x**2)/4)-((41*x)/2)+(63/4))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\log \\left(9 x^2+6\\right)+\\sqrt[3]{\\frac{3}{2}-\\frac{x}{2}}$ at the point $x=-9$", + "Output Answer": [ + "$\\sqrt[3]{6}+\\log (735) = 8.417$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = -9\ntry: \n f = math.log(9*x**2+6)+np.cbrt((3/2)-(x/2))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\sqrt{3} \\left(\\cos \\left(\\frac{71}{45}\\right)+i \\sin \\left(\\frac{71}{45}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$5308416 \\left(\\cos \\left(\\frac{568}{45}\\right)+i \\sin \\left(\\frac{568}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*math.sqrt(3)*(math.cos((71/45))+1j*math.sin((71/45))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(-\\cos \\left(\\frac{\\pi }{9}\\right)-i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$256 \\left(\\sin \\left(\\frac{\\pi }{18}\\right)+i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(-math.cos((math.pi/9))-1j*math.sin((math.pi/9))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\log \\left(4 x^4-4\\right)$", + "Output Answer": [ + "$x<-1\\lor x>1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = log(4*x**4-4)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$11 \\sqrt{2} x-\\frac{13 y}{\\sqrt{2}}+\\frac{29}{\\sqrt{2}}=0$, $-14 \\sqrt{2} x-3 \\sqrt{2} y+\\frac{19}{\\sqrt{2}}=0$", + "Output Answer": [ + "$x=\\frac{73}{496}$, $y=\\frac{615}{248}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((11*sqrt(2)*x-((13*y)/(sqrt(2)))+(29/(sqrt(2))), -14*sqrt(2)*x-3*sqrt(2)*y+(19/(sqrt(2)))), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{36 x^2}{\\pi }-\\frac{22 x}{\\pi }-\\frac{9}{\\pi }$ and $q(x) = -\\frac{4 x^2}{\\pi }+\\frac{31 x}{\\pi }-\\frac{16}{\\pi }$", + "Output Answer": [ + "$\\frac{144 x^4}{\\pi ^2}-\\frac{1028 x^3}{\\pi ^2}-\\frac{70 x^2}{\\pi ^2}+\\frac{73 x}{\\pi ^2}+\\frac{144}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((36*x**2)/pi)-((22*x)/pi)-(9/pi)\nq = -((4*x**2)/pi)+((31*x)/pi)-(16/pi)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-10 x^2-12 x+2$", + "Output Answer": [ + "$x=\\frac{1}{5} \\left(-3-\\sqrt{14}\\right)\\lor x=\\frac{1}{5} \\left(\\sqrt{14}-3\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-10*x**2-12*x+2, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(((20+2)+12) \\frac{1}{1}\\right) \\left(\\frac{1}{11} (((1+10)+14)+20)\\right)$.", + "Output Answer": [ + "$\\frac{1530}{11}$" + ], + "Output Program": [ + "try: \n print((((20+2)+12)*(1/1))*((1/11)*(((1+10)+14)+20)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $6-8 x$ when divided by $-x-1$.", + "Output Answer": [ + "$8$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6-8*x\nq = -x-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^5-4 x^4-24 x^3-12 x^2+16 x+16$ and $x^4-4 x^3-4 x^2+2 x+4$.", + "Output Answer": [ + "$x^4-4 x^3-4 x^2+2 x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**5-4*x**4-24*x**3-12*x**2+16*x+16, x**4-4*x**3-4*x**2+2*x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 \\sqrt{5} x^2+5 \\sqrt{5} x-6 \\sqrt{5}$", + "Output Answer": [ + "$-3 \\sqrt{5} \\left(x-\\frac{5}{6}\\right)^2-\\frac{47 \\sqrt{5}}{12}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*math.sqrt(5)*x**2+5*math.sqrt(5)*x-6*math.sqrt(5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x+5$ when divided by $7 x+3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x+5\nq = 7*x+3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{11 x}{2}+1}+\\sqrt{8 x-5}=\\frac{17}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{50} \\left(7923-68 \\sqrt{13071}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((11*x)/2)+1)+sqrt(8*x-5), (17/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\log (8 x-9)+\\sin (5 x+7)$", + "Output Answer": [ + "$x>\\frac{9}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = log(8*x-9)+sin(5*x+7)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+7 x-2 y^2+4 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x+\\frac{7}{12}\\right)^2-2 (y-1)^2=-\\frac{95}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{7}{12} & 1-\\frac{\\sqrt{95}}{6} \\\\\n -\\frac{7}{12} & \\frac{1}{6} \\left(6+\\sqrt{95}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{3}}$\nCenter: $\\left\\{-\\frac{7}{12},\\frac{1}{2} \\left(1-\\frac{\\sqrt{95}}{6}+\\frac{1}{6} \\left(6+\\sqrt{95}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{12} \\left(12-7 \\sqrt{3}\\right)-\\sqrt{3} x,y=\\sqrt{3} x+\\frac{1}{12} \\left(12+7 \\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+7*x-2*y**2+4*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{28 x}{\\sqrt{3}}-\\frac{5 y}{\\sqrt{3}}-10 \\sqrt{3} z+\\frac{13}{\\sqrt{3}}=0$, $-3 \\sqrt{3} x+\\frac{37 y}{\\sqrt{3}}+10 \\sqrt{3} z+\\frac{20}{\\sqrt{3}}=0$, $\\frac{17 x}{\\sqrt{3}}+\\frac{13 y}{\\sqrt{3}}+\\frac{13 z}{\\sqrt{3}}+\\frac{14}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{8123}{16697}$, $y=-\\frac{26611}{16697}$, $z=\\frac{19252}{16697}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((28*x)/(sqrt(3)))-((5*y)/(sqrt(3)))-10*sqrt(3)*z+(13/(sqrt(3))), -3*sqrt(3)*x+((37*y)/(sqrt(3)))+10*sqrt(3)*z+(20/(sqrt(3))), ((17*x)/(sqrt(3)))+((13*y)/(sqrt(3)))+((13*z)/(sqrt(3)))+(14/(sqrt(3))))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=11 t-\\frac{13}{3} \\left(\\sqrt{3}-22\\right), x(t)=-\\sqrt{3} t-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=-\\frac{11 x}{\\sqrt{3}}-\\frac{13}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 11*t-(13/3)*(sqrt(3)-22)\nx_t = -sqrt(3)*t-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{10 \\sqrt{3} x^2+10 \\sqrt{3} x+\\sqrt{3}}{8 \\sqrt{3} x^2+6 \\sqrt{3} x+\\sqrt{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(-5-\\sqrt{15}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(-5+\\sqrt{15}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((10*sqrt(3)*x**2+10*sqrt(3)*x+sqrt(3))/(8*sqrt(3)*x**2+6*sqrt(3)*x+sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $x^2-2 x+3$ when divided by $9 x^2-2 x+6$.", + "Output Answer": [ + "$\\frac{1}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**2-2*x+3\nq = 9*x**2-2*x+6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-4 x^2+112 x-684$", + "Output Answer": [ + "$-4 (x-19) (x-9)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-4*x**2+112*x-684, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-4 x^2+4 x+728$", + "Output Answer": [ + "$-4 (-x-13) (14-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-4*x**2+4*x+728, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-2+3 i) \\sqrt{5}$ and $y=(-4-2 i) \\sqrt{5}$", + "Output Answer": [ + "$(2+5 i) \\sqrt{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-2+3*i)*math.sqrt(5)\ny = (-4-2*i)*math.sqrt(5)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(12 t+83)^2, x(t)=-2 t-15$", + "Output Answer": [ + "$y=36 x^2+84 x+49$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (12*t+83)**2\nx_t = -2*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -11 x-17| =-9$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-11*x-17), -9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-12 x^2-36 x$", + "Output Answer": [ + "$-12 x (x+3)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-12*x**2-36*x, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^6-\\frac{7 x^5}{3}-5 x^4-\\frac{28 x^3}{3}-\\frac{10 x^2}{3}-9 x+\\frac{22}{3}$ when divided by $-\\frac{20 x^5}{3}-\\frac{13 x^4}{3}+10 x^3-6 x^2+2 x+\\frac{28}{3}$.", + "Output Answer": [ + "$\\frac{3 x}{4}-\\frac{11}{80}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**6-((7*x**5)/3)-5*x**4-((28*x**3)/3)-((10*x**2)/3)-9*x+(22/3)\nq = -((20*x**5)/3)-((13*x**4)/3)+10*x**3-6*x**2+2*x+(28/3)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x-4$ and $x^3-x^2+4 x-4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x-4, x**3-x**2+4*x-4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$14 x+18 y+25=0$, $-x+9 y+11=0$", + "Output Answer": [ + "$x=-\\frac{3}{16}$, $y=-\\frac{179}{144}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((14*x+18*y+25, -x+9*y+11), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2+27 \\sqrt{3} x+108$", + "Output Answer": [ + "$-9 \\left(-x-\\sqrt{3}\\right) \\left(4 \\sqrt{3}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2+27*sqrt(3)*x+108, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{3-8 i}{\\sqrt{\\pi }}$ and $y=\\frac{12+7 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{15-i}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((3-8*i)/(math.sqrt(math.pi)))\ny = ((12+7*i)/(math.sqrt(math.pi)))\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3$ and $5 x^3-5 x^2+4 x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3, 5*x**3-5*x**2+4*x-3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (3-4 x)^4, q(x) = (5-3 x)^4$", + "Output Answer": [ + "$337 x^4-1308 x^3+2214 x^2-1932 x+706$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (3-4*x)**4\nq = (5-3*x)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{21}{23}$, and $a_n=a_{n-1}+\\frac{3}{4}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$\\frac{12789}{46}$" + ], + "Output Program": [ + "a = -(21/23) # initial value\nd = (3/4) # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(21/23) # initial value\nd = (3/4) # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x^2+x-2$ and $2 x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x**2+x-2, 2*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\pi \\left(2 x^2-3 x+4\\right)$, $q(x) = \\pi \\left(-3 x^2-3 x+2\\right)$", + "Output Answer": [ + "$-\\pi x^2-6 \\pi x+6 \\pi$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = pi*(2*x**2-3*x+4)\nq = pi*(-3*x**2-3*x+2)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -9 x^2-3 x-4$, $q(x) = -4 x^2-3 x+4$", + "Output Answer": [ + "$-13 x^2-6 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**2-3*x-4\nq = -4*x**2-3*x+4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-e^{\\frac{31 i \\pi }{36}}$.", + "Output Answer": [ + "Norm: $1$\nArgument: $-\\frac{5 \\pi }{36}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.e**((31*i*math.pi)/36)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-12 x^2-14 x+13}{24 x^2+24 x+7}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(-7-\\sqrt{205}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(-7+\\sqrt{205}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-12*x**2-14*x+13)/(24*x**2+24*x+7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-13 x^2+14 x+9$", + "Output Answer": [ + "$\\frac{166}{13}-13 \\left(x-\\frac{7}{13}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-13*x**2+14*x+9), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((2-20)+11)-15)-((14-24)-22)$.", + "Output Answer": [ + "$10$" + ], + "Output Program": [ + "try: \n print((((2-20)+11)-15)-((14-24)-22))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 21 x^2-11\\right| =14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{\\sqrt{21}}\\right\\},\\left\\{x\\to \\frac{5}{\\sqrt{21}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(21*x**2-11), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^6-6 x^5+3 x^4+9 x^3-4 x^2-8 x+6$ when divided by $-8 x^4+6 x^3-6 x^2-3 x-4$.", + "Output Answer": [ + "$x^2+\\frac{3 x}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**6-6*x**5+3*x**4+9*x**3-4*x**2-8*x+6\nq = -8*x**4+6*x**3-6*x**2-3*x-4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 13 x+9| =17$", + "Output Answer": [ + "$\\left\\{\\{x\\to -2\\},\\left\\{x\\to \\frac{8}{13}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(13*x+9), 17), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8-5 x}+\\sqrt{14 x-6}=3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{361} \\left(347-24 \\sqrt{58}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8-5*x)+sqrt(14*x-6), 3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10-15 x}+\\sqrt{-3 x-4}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{24} \\left(-215+9 \\sqrt{285}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10-15*x)+sqrt(-3*x-4), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+8 x-4 y^2+7 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x+\\frac{2}{3}\\right)^2-4 \\left(y-\\frac{7}{8}\\right)^2=\\frac{269}{48}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{3}-\\frac{\\sqrt{1345}}{24} & \\frac{7}{8} \\\\\n \\frac{1}{24} \\left(\\sqrt{1345}-16\\right) & \\frac{7}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{2}{3}-\\frac{\\sqrt{1345}}{24}+\\frac{1}{24} \\left(\\sqrt{1345}-16\\right)\\right),\\frac{7}{8}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{3}{2}} x+\\frac{1}{24} \\left(21+8 \\sqrt{6}\\right),y=\\frac{1}{24} \\left(21-8 \\sqrt{6}\\right)-\\sqrt{\\frac{3}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+8*x-4*y**2+7*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 12 x^2+\\frac{21 x}{2}-\\frac{11}{2}$ and $q(x) = -8 x^2+x+12$", + "Output Answer": [ + "$-96 x^4-72 x^3+\\frac{397 x^2}{2}+\\frac{241 x}{2}-66$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 12*x**2+((21*x)/2)-(11/2)\nq = -8*x**2+x+12\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{((8+17)+21)-8}{7-18}$.", + "Output Answer": [ + "$-\\frac{38}{11}$" + ], + "Output Program": [ + "try: \n print(((((8+17)+21)-8)/(7-18)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-5 \\sqrt{5} x^2+2 \\sqrt{5} x-6 \\sqrt{5}$", + "Output Answer": [ + "$x=\\frac{1}{5} \\left(1-i \\sqrt{29}\\right)\\lor x=\\frac{1}{5} \\left(1+i \\sqrt{29}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-5*sqrt(5)*x**2+2*sqrt(5)*x-6*sqrt(5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{42 x}{5}-10}+\\sqrt{-\\frac{36 x}{5}-\\frac{66}{5}}=\\frac{19}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{30} \\left(-4613+152 \\sqrt{897}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((42*x)/5)-10)+sqrt(-((36*x)/5)-(66/5)), (19/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 15 x^2-10 x+7$, $q(x) = -x^2+9 x-14$", + "Output Answer": [ + "$14 x^2-x-7$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 15*x**2-10*x+7\nq = -x**2+9*x-14\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sin ^{-1}(\\log (-2 x-4))-\\tan ^{-1}(2 x+3)$", + "Output Answer": [ + "$\\frac{1}{2} (-4-e)\\leq x\\leq \\frac{-1-4 e}{2 e}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = asin(log(-2*x-4))-atan(2*x+3)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{63 x}{5}-\\frac{9}{5}}+\\sqrt{\\frac{21}{5}-\\frac{54 x}{5}}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-790+4 \\sqrt{38805}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((63*x)/5)-(9/5))+sqrt((21/5)-((54*x)/5)), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-4 x-12 y+15 z+6=0$, $5 x-6 y-25 z-21=0$, $12 x-13 y+21 z+9=0$", + "Output Answer": [ + "$x=\\frac{393}{6769}$, $y=-\\frac{2889}{6769}$, $z=-\\frac{702}{967}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-4*x-12*y+15*z+6, 5*x-6*y-25*z-21, 12*x-13*y+21*z+9)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(9 \\left(\\sin \\left(\\frac{\\pi }{9}\\right)+i \\cos \\left(\\frac{\\pi }{9}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$531441 \\left(\\frac{1}{2}+\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((9*(math.sin((math.pi/9))+1j*math.cos((math.pi/9))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{17}{6}$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$-\\frac{19981}{6}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(17/6) # initial value\nd = -8 # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(17/6) # initial value\nd = -8 # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-3 \\sqrt{5} e^{-\\frac{29 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $3 \\sqrt{5}$\nArgument: $\\frac{151 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -3*math.sqrt(5)*math.e**(-((29*i*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^3+2 x^2-7 x-4$ when divided by $6 x^3-8 x^2-2 x+2$.", + "Output Answer": [ + "$\\frac{7}{6}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**3+2*x**2-7*x-4\nq = 6*x**3-8*x**2-2*x+2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9 x-5}+\\sqrt{11 x-6}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(251-5 \\sqrt{2473}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9*x-5)+sqrt(11*x-6), 5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{6525 t^2}{64}-\\frac{6525 t}{8}-\\frac{6529}{4}, x(t)=\\frac{225 t^2}{16}+\\frac{225 t}{2}+225$", + "Output Answer": [ + "$y=-\\frac{29 x}{4}-1$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -((6525*t**2)/64)-((6525*t)/8)-(6529/4)\nx_t = ((225*t**2)/16)+((225*t)/2)+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\cos ^{-1}(8-x)$", + "Output Answer": [ + "$\\{\\{x\\to \\fbox{$8-\\cos (y)\\text{ if }0\\leq y\\leq \\pi $}\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, acos(8-x))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -12 x^2+8 x-7$, $q(x) = 10 x+2$", + "Output Answer": [ + "$-12 x^2+18 x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -12*x**2+8*x-7\nq = 10*x+2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 \\sqrt{5}-\\sqrt{5} x$ and $q(x) = 2 \\sqrt{5} x^2+4 \\sqrt{5} x-2 \\sqrt{5}$", + "Output Answer": [ + "$-10 x^3+50 x-20$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*sqrt(5)-sqrt(5)*x\nq = 2*sqrt(5)*x**2+4*sqrt(5)*x-2*sqrt(5)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{47 x^2}{7}+\\frac{107 x}{7}+\\frac{27}{7}}{\\frac{122 x}{7}+\\frac{50}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{94} \\left(107-5 \\sqrt{661}\\right)\\right\\},\\left\\{x\\to \\frac{1}{94} \\left(107+5 \\sqrt{661}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((47*x**2)/7)+((107*x)/7)+(27/7))/(((122*x)/7)+(50/7))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -7 \\sqrt{5} x-2 \\sqrt{5}\\right| =11 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{13}{7}\\right\\},\\left\\{x\\to \\frac{9}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-7*sqrt(5)*x-2*sqrt(5)), 11*sqrt(5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{13}{2}-x}+\\sqrt{\\frac{11 x}{2}+\\frac{17}{2}}=\\frac{13}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{26} \\left(109-4 \\sqrt{221}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((13/2)-x)+sqrt(((11*x)/2)+(17/2)), (13/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\log \\left(-6 x^2-4\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -i \\sqrt{\\frac{5}{6}}\\right\\},\\left\\{x\\to i \\sqrt{\\frac{5}{6}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(log(-6*x**2-4), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$13 x+5 y-13=0$, $-7 x+10 y+1=0$", + "Output Answer": [ + "$x=\\frac{9}{11}$, $y=\\frac{26}{55}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((13*x+5*y-13, -7*x+10*y+1), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x-5}+\\sqrt{2 x+1}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 6 \\left(31-8 \\sqrt{13}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x-5)+sqrt(2*x+1), 8), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((3+24)+15)^2+((15-25)+12)$.", + "Output Answer": [ + "$1766$" + ], + "Output Program": [ + "try: \n print(((3+24)+15)**2+((15-25)+12))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2-x+2 y^2+3 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(y+\\frac{3}{4}\\right)^2-4 \\left(x+\\frac{1}{8}\\right)^2=-\\frac{63}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{8} \\left(-1-3 \\sqrt{21}\\right) & -\\frac{3}{4} \\\\\n \\frac{1}{8} \\left(3 \\sqrt{21}-1\\right) & -\\frac{3}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{8} \\left(-1-3 \\sqrt{21}\\right)+\\frac{1}{8} \\left(3 \\sqrt{21}-1\\right)\\right),-\\frac{3}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{2} x+\\frac{1}{8} \\left(\\sqrt{2}-6\\right),y=\\frac{1}{8} \\left(-6-\\sqrt{2}\\right)-\\sqrt{2} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2-x+2*y**2+3*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-9 \\left(\\frac{1}{2}+\\frac{i \\sqrt{3}}{2}\\right)\\right)^10$", + "Output Answer": [ + "$3486784401 \\left(-\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-9*((1/2)+((1j*math.sqrt(3))/2)))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 x^2-3 x-12$ and $q(x) = -15 x^2-10 x+10$", + "Output Answer": [ + "$-60 x^4+5 x^3+250 x^2+90 x-120$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*x**2-3*x-12\nq = -15*x**2-10*x+10\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9-14 x}+\\sqrt{3 x+12}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{289} \\left(-326+10 \\sqrt{2265}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9-14*x)+sqrt(3*x+12), 5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{35 x}{3}+22 y-5=0$, $\\frac{50 x}{3}-\\frac{16 y}{3}+\\frac{23}{3}=0$", + "Output Answer": [ + "$x=-\\frac{639}{1370}$, $y=-\\frac{11}{548}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((35*x)/3)+22*y-5, ((50*x)/3)-((16*y)/3)+(23/3)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$11 x-3 y-2 z-3=0$, $5 x+6 y-5 z+9=0$, $10 x+11 y+6 z+4=0$", + "Output Answer": [ + "$x=\\frac{67}{417}$, $y=-\\frac{398}{417}$, $z=\\frac{340}{417}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((11*x-3*y-2*z-3, 5*x+6*y-5*z+9, 10*x+11*y+6*z+4)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 25-23 x| =12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{13}{23}\\right\\},\\left\\{x\\to \\frac{37}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(25-23*x), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{2-i}{\\sqrt{\\pi }}$ and $y=-\\frac{11-10 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{12-31 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((2-i)/(math.sqrt(math.pi)))\ny = -((11-10*i)/(math.sqrt(math.pi)))\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{11}{7}-2 x}+\\sqrt{\\frac{57}{7}-\\frac{6 x}{7}}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-583+12 \\sqrt{2114}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((11/7)-2*x)+sqrt((57/7)-((6*x)/7)), 8), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{43 x^2}{4}+\\frac{27 x}{2}+\\frac{19}{2}$ and $q(x) = -\\frac{13 x^2}{2}+3 x-2$", + "Output Answer": [ + "$-\\frac{559 x^4}{8}-\\frac{111 x^3}{2}-\\frac{171 x^2}{4}+\\frac{3 x}{2}-19$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((43*x**2)/4)+((27*x)/2)+(19/2)\nq = -((13*x**2)/2)+3*x-2\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{12 x^2+\\frac{29 x}{2}-20}{\\frac{7 x^2}{2}+21 x-23}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{48} \\left(-29-\\sqrt{4681}\\right)\\right\\},\\left\\{x\\to \\frac{1}{48} \\left(-29+\\sqrt{4681}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((12*x**2+((29*x)/2)-20)/(((7*x**2)/2)+21*x-23)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((21-16)+23)-((24-5)-1)$.", + "Output Answer": [ + "$10$" + ], + "Output Program": [ + "try: \n print(((21-16)+23)-((24-5)-1))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 \\sqrt{3} x^2-4 \\sqrt{3} x-8 \\sqrt{3}$ and $q(x) = -\\sqrt{3} x^2+3 \\sqrt{3} x-\\sqrt{3}$", + "Output Answer": [ + "$12 x^4-24 x^3-60 x+24$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*sqrt(3)*x**2-4*sqrt(3)*x-8*sqrt(3)\nq = -sqrt(3)*x**2+3*sqrt(3)*x-sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$8 x+7 y+9 z+13=0$, $20 y-8 x=0$, $21 x+23 y-12 z-16=0$", + "Output Answer": [ + "$x=-\\frac{20}{669}$, $y=-\\frac{8}{669}$, $z=-\\frac{2827}{2007}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((8*x+7*y+9*z+13, 20*y-8*x, 21*x+23*y-12*z-16)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2+\\frac{43 x}{2}-\\frac{759}{4}$", + "Output Answer": [ + "$-2 \\left(-x-\\frac{33}{2}\\right) \\left(x-\\frac{23}{4}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2+((43*x)/2)-(759/4), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{\\sqrt{69}}-\\sqrt{37}$.", + "Output Answer": [ + "$\\sqrt[4]{69}-\\sqrt{37}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(sqrt(69))-sqrt(37))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{3} (14 x+25), q(x) = x+\\frac{22}{3}$", + "Output Answer": [ + "$\\frac{17 x}{3}+\\frac{47}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/3)*(14*x+25)\nq = x+(22/3)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(13+13 i) \\log (2)$ and $y=(-10+12 i) \\log (2)$", + "Output Answer": [ + "$(3+25 i) \\log (2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (13+13*i)*math.log10(2)\ny = (-10+12*i)*math.log10(2)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-1.09397+0.114981 i$.", + "Output Answer": [ + "Norm: $1.1$\nArgument: $3.03687$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -1.09397+0.114981*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{7-13 i}{\\sqrt{2}}$ and $y=(6+3 i) \\sqrt{2}$", + "Output Answer": [ + "$(6+3 i) \\sqrt{2}-\\frac{7-13 i}{\\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((7-13*i)/(math.sqrt(2)))\ny = (6+3*i)*math.sqrt(2)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-7 \\sqrt{2}$ and $y=(-4-4 i) \\sqrt{2}$", + "Output Answer": [ + "$(-11-4 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -7*math.sqrt(2)\ny = (-4-4*i)*math.sqrt(2)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\frac{\\frac{14}{5}}{4}+16\\right)^2+17\\right)+((((17+19)-14)+18)-23)$.", + "Output Answer": [ + "$\\frac{31289}{100}$" + ], + "Output Program": [ + "try: \n print(((((14/5)/4)+16)**2+17)+((((17+19)-14)+18)-23))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+220 x-825$", + "Output Answer": [ + "$-11 (5-x) (15-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+220*x-825, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^6+6 x^5+x^4+5 x^3+10 x^2+7 x-15$ and $-2 x^5-x^3-2 x^2-4 x+5$.", + "Output Answer": [ + "$2 x^5+x^3+2 x^2+4 x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**6+6*x**5+x**4+5*x**3+10*x**2+7*x-15, -2*x**5-x**3-2*x**2-4*x+5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2-8 x-3 y^2-2 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x-\\frac{4}{7}\\right)^2-3 \\left(y+\\frac{1}{3}\\right)^2=-\\frac{85}{21}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{4}{7} & \\frac{1}{21} \\left(-7-5 \\sqrt{34}\\right) \\\\\n \\frac{4}{7} & \\frac{1}{21} \\left(5 \\sqrt{34}-7\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{10}{7}}$\nCenter: $\\left\\{\\frac{4}{7},\\frac{1}{2} \\left(\\frac{1}{21} \\left(-7-5 \\sqrt{34}\\right)+\\frac{1}{21} \\left(5 \\sqrt{34}-7\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{21} \\left(4 \\sqrt{21}-7\\right)-\\sqrt{\\frac{7}{3}} x,y=\\sqrt{\\frac{7}{3}} x+\\frac{1}{21} \\left(-7-4 \\sqrt{21}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2-8*x-3*y**2-2*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{1-31 i}{\\pi }$ and $y=\\frac{16+10 i}{\\pi }$", + "Output Answer": [ + "$\\frac{326-486 i}{\\pi ^2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((1-31*i)/math.pi)\ny = ((16+10*i)/math.pi)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{21}{5}$ and $\\frac{23 x^3}{5}+\\frac{11 x^2}{5}+5 x-\\frac{11}{5}$.", + "Output Answer": [ + "$\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-(21/5), ((23*x**3)/5)+((11*x**2)/5)+5*x-(11/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 7 x^2-7 x+11\\right| =11$", + "Output Answer": [ + "$\\{\\{x\\to 0\\},\\{x\\to 1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(7*x**2-7*x+11), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^5+7 x^4+5 x^3-2 x^2+8 x-7$ when divided by $-6 x^2+2 x+4$.", + "Output Answer": [ + "$-\\frac{x^3}{2}-\\frac{4 x^2}{3}-\\frac{29 x}{18}-\\frac{59}{54}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**5+7*x**4+5*x**3-2*x**2+8*x-7\nq = -6*x**2+2*x+4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (8, 2, \\frac{1}{\\sqrt{3}})$", + "Output Answer": [ + "$\\left\\{\\sqrt{\\frac{205}{3}},\\tan ^{-1}\\left(2 \\sqrt{51}\\right),\\tan ^{-1}\\left(\\frac{1}{4}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 8\ny = 2\nz = (1/(math.sqrt(3)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $8 x^2+5 x-10$", + "Output Answer": [ + "$x=\\frac{1}{16} \\left(-5-\\sqrt{345}\\right)\\lor x=\\frac{1}{16} \\left(\\sqrt{345}-5\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(8*x**2+5*x-10, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-x^2-5 x+3 y^2-y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(y-\\frac{1}{6}\\right)^2-\\left(x+\\frac{5}{2}\\right)^2=-\\frac{7}{6}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{2}-\\frac{\\sqrt{14}}{3} & \\frac{1}{6} \\\\\n \\frac{\\sqrt{14}}{3}-\\frac{5}{2} & \\frac{1}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{3}}$\nCenter: $\\left\\{-\\frac{5}{2},\\frac{1}{6}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{3}}+\\frac{1}{6} \\left(1+5 \\sqrt{3}\\right),y=\\frac{1}{6} \\left(1-5 \\sqrt{3}\\right)-\\frac{x}{\\sqrt{3}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-x**2-5*x+3*y**2-y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -13 x^2+8 x+15$ and $q(x) = 13 x^2+8 x+2$", + "Output Answer": [ + "$-169 x^4+233 x^2+136 x+30$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -13*x**2+8*x+15\nq = 13*x**2+8*x+2\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\cos \\left(\\frac{7}{18}\\right)+i \\sin \\left(\\frac{7}{18}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$823543 \\left(\\cos \\left(\\frac{49}{18}\\right)+i \\sin \\left(\\frac{49}{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.cos((7/18))+1j*math.sin((7/18))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{149}+\\left(\\sqrt{153}+\\sqrt{73}\\right)$.", + "Output Answer": [ + "$3 \\sqrt{17}+\\sqrt{73}+\\sqrt{149}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(149)+(sqrt(153)+sqrt(73)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-11 x^2+13 x+5}{11 x^2-6 x+19}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{22} \\left(13-\\sqrt{389}\\right)\\right\\},\\left\\{x\\to \\frac{1}{22} \\left(13+\\sqrt{389}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-11*x**2+13*x+5)/(11*x**2-6*x+19)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{x}{\\sqrt{3}}-\\frac{13}{\\sqrt{3}}\\right| =\\frac{1}{\\sqrt{3}}$", + "Output Answer": [ + "$\\{\\{x\\to 12\\},\\{x\\to 14\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs((x/(sqrt(3)))-(13/(sqrt(3)))), (1/(sqrt(3)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -3, q(x) = 6 x+7$", + "Output Answer": [ + "$6 x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3\nq = 6*x+7\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((10-3)+18) (11-24)$.", + "Output Answer": [ + "$-325$" + ], + "Output Program": [ + "try: \n print(((10-3)+18)*(11-24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left((6+12)^2+5\\right)+((21-3)+24)$.", + "Output Answer": [ + "$371$" + ], + "Output Program": [ + "try: \n print(((6+12)**2+5)+((21-3)+24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^6+x^5-7 x^4-9 x^2+9 x+10$ when divided by $-6 x-2$.", + "Output Answer": [ + "$\\frac{5 x^5}{6}-\\frac{4 x^4}{9}+\\frac{71 x^3}{54}-\\frac{71 x^2}{162}+\\frac{400 x}{243}-\\frac{2987}{1458}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**6+x**5-7*x**4-9*x**2+9*x+10\nq = -6*x-2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{4 x-6}+\\cos (6-9 x)$ at the point $x=-5$", + "Output Answer": [ + "$-\\sqrt[3]{26}+\\cos (51) = -2.22$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = -5\ntry: \n f = np.cbrt(4*x-6)+math.cos(6-9*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $4 e^{-\\frac{23 i \\pi }{60}} \\log (2)$.", + "Output Answer": [ + "Norm: $4 \\log (2)$\nArgument: $-\\frac{23 \\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 4*math.e**(-((23*i*math.pi)/60))*math.log(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left((((12-2)+14)+16)^2+11\\right) \\left(\\frac{1}{3} ((18-1)+14)+15\\right)$.", + "Output Answer": [ + "$40812$" + ], + "Output Program": [ + "try: \n print(((((12-2)+14)+16)**2+11)*((1/3)*((18-1)+14)+15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2+6 x+2 y^2+y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $(x+3)^2+2 \\left(y+\\frac{1}{4}\\right)^2=\\frac{129}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -3-\\frac{\\sqrt{129}}{4} & -\\frac{1}{4} \\\\\n \\frac{\\sqrt{129}}{4}-3 & -\\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{-3,-\\frac{1}{4}\\right\\}$\nArea Enclosed: $\\frac{129 \\pi }{8 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2+6*x+2*y**2+y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-4 \\sqrt{2} e^{-\\frac{41 i \\pi }{60}}$.", + "Output Answer": [ + "Norm: $4 \\sqrt{2}$\nArgument: $\\frac{19 \\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -4*math.sqrt(2)*math.e**(-((41*i*math.pi)/60))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{19 x}{3}-\\frac{41}{3}}+\\sqrt{-x-\\frac{19}{3}}=\\frac{26}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{96} \\left(-1991+39 \\sqrt{753}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((19*x)/3)-(41/3))+sqrt(-x-(19/3)), (26/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{3} \\left(1125 t^2+3900 t+3376\\right)^2, x(t)=75 t^2+260 t+\\frac{676}{3}$", + "Output Answer": [ + "$y=75 x^2-40 x+\\frac{16}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/3)*(1125*t**2+3900*t+3376)**2\nx_t = 75*t**2+260*t+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{14 x^2-19 x-19}{8-8 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{28} \\left(19-5 \\sqrt{57}\\right)\\right\\},\\left\\{x\\to \\frac{1}{28} \\left(19+5 \\sqrt{57}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((14*x**2-19*x-19)/(8-8*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{13 x^2}{4}-\\frac{11 x}{4}-\\frac{19}{2}$", + "Output Answer": [ + "$x=\\frac{1}{26} \\left(11-3 \\sqrt{233}\\right)\\lor x=\\frac{1}{26} \\left(11+3 \\sqrt{233}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((13*x**2)/4)-((11*x)/4)-(19/2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-7 x^2+\\frac{693 x}{4}-\\frac{7623}{8}$", + "Output Answer": [ + "$7 \\left(\\frac{33}{2}-x\\right) \\left(x-\\frac{33}{4}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-7*x**2+((693*x)/4)-(7623/8), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{25} (5 x+36)^2, q(x) = \\frac{1}{5} (9 x+41)$", + "Output Answer": [ + "$x^2+\\frac{81 x}{5}+\\frac{1501}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/25)*(5*x+36)**2\nq = (1/5)*(9*x+41)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2+4 x+5 y^2+10 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x+\\frac{1}{5}\\right)^2+5 (y+1)^2=\\frac{62}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{5} & -1-\\frac{\\sqrt{31}}{5} \\\\\n -\\frac{1}{5} & \\frac{1}{5} \\left(\\sqrt{31}-5\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{-\\frac{1}{5},\\frac{1}{2} \\left(-1-\\frac{\\sqrt{31}}{5}+\\frac{1}{5} \\left(\\sqrt{31}-5\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{31 \\sqrt{2} \\pi }{25}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2+4*x+5*y**2+10*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{11}{98}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$-\\frac{21069}{98}$" + ], + "Output Program": [ + "a = (11/98) # initial value\nd = -6 # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (11/98) # initial value\nd = -6 # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{\\left(171 t^2+11970 t+206731\\right)^2}{117649}, x(t)=\\frac{9 t^2}{49}+\\frac{90 t}{7}+225$", + "Output Answer": [ + "$y=\\frac{361 x^2}{49}-\\frac{304 x}{7}+64$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (((171*t**2+11970*t+206731)**2)/117649)\nx_t = ((9*t**2)/49)+((90*t)/7)+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\left(-\\sin \\left(\\frac{2 \\pi }{45}\\right)+i \\cos \\left(\\frac{2 \\pi }{45}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$36 \\left(-\\cos \\left(\\frac{4 \\pi }{45}\\right)-i \\sin \\left(\\frac{4 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*(-math.sin(((2*math.pi)/45))+1j*math.cos(((2*math.pi)/45))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$13 \\sqrt{3} x+4 \\sqrt{3} y+\\frac{7}{\\sqrt{3}}=0$, $\\frac{14 x}{\\sqrt{3}}-9 \\sqrt{3} y-3 \\sqrt{3}=0$", + "Output Answer": [ + "$x=-\\frac{27}{407}$, $y=-\\frac{449}{1221}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((13*sqrt(3)*x+4*sqrt(3)*y+(7/(sqrt(3))), ((14*x)/(sqrt(3)))-9*sqrt(3)*y-3*sqrt(3)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-11 x^2-9 x+9$", + "Output Answer": [ + "$x=\\frac{3}{22} \\left(-3-\\sqrt{53}\\right)\\lor x=\\frac{3}{22} \\left(\\sqrt{53}-3\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-11*x**2-9*x+9, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(1-3 i) \\sqrt{3}$ and $y=(-3-3 i) \\sqrt{3}$", + "Output Answer": [ + "$\\frac{1}{3}+\\frac{2 i}{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (1-3*i)*math.sqrt(3)\ny = (-3-3*i)*math.sqrt(3)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{7 x^2}{\\sqrt{3}}-\\frac{13 x}{\\sqrt{3}}-\\frac{2}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(-13-\\sqrt{113}\\right)\\lor x=\\frac{1}{14} \\left(\\sqrt{113}-13\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((7*x**2)/(sqrt(3)))-((13*x)/(sqrt(3)))-(2/(sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^4-2 x^3+9 x^2+x+9$ when divided by $8 x^3-6 x^2+4$.", + "Output Answer": [ + "$\\frac{x}{2}+\\frac{1}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**4-2*x**3+9*x**2+x+9\nq = 8*x**3-6*x**2+4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\cos \\left(\\frac{x}{2}+\\frac{1}{2}\\right)$", + "Output Answer": [ + "$-1\\leq y\\leq 1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(cos((x/2)+(1/2)), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 x^2+3 x-4$", + "Output Answer": [ + "$-2 \\left(x-\\frac{3}{4}\\right)^2-\\frac{23}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*x**2+3*x-4), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{5 x}{\\sqrt{3}}+\\frac{7 y}{\\sqrt{3}}+\\frac{29}{\\sqrt{3}}=0$, $-3 \\sqrt{3} x+5 \\sqrt{3} y+\\frac{19}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{151}{6}$, $y=\\frac{83}{6}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((5*x)/(sqrt(3)))+((7*y)/(sqrt(3)))+(29/(sqrt(3))), -3*sqrt(3)*x+5*sqrt(3)*y+(19/(sqrt(3)))), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2-7 x-9 y^2+8 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(x-\\frac{7}{4}\\right)^2-9 \\left(y-\\frac{4}{9}\\right)^2=\\frac{529}{72}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{7}{4}-\\frac{23 \\sqrt{11}}{36} & \\frac{4}{9} \\\\\n \\frac{7}{4}+\\frac{23 \\sqrt{11}}{36} & \\frac{4}{9} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{11}}{3}$\nCenter: $\\left\\{\\frac{7}{4},\\frac{4}{9}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{2} x}{3}+\\frac{1}{36} \\left(16-21 \\sqrt{2}\\right),y=\\frac{1}{36} \\left(16+21 \\sqrt{2}\\right)-\\frac{\\sqrt{2} x}{3}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2-7*x-9*y**2+8*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{14 x^2}{\\sqrt{3}}+7 \\sqrt{3} x+\\frac{23}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{28} \\sqrt{3} \\left(-7 \\sqrt{3}-11 i \\sqrt{\\frac{7}{3}}\\right)\\lor x=\\frac{1}{28} \\sqrt{3} \\left(-7 \\sqrt{3}+11 i \\sqrt{\\frac{7}{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((14*x**2)/(sqrt(3)))+7*sqrt(3)*x+(23/(sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 9 x^2-14 x+3$ and $q(x) = -8 x^2-9 x-1$", + "Output Answer": [ + "$-72 x^4+31 x^3+93 x^2-13 x-3$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 9*x**2-14*x+3\nq = -8*x**2-9*x-1\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-9 x^2+8 x+13$", + "Output Answer": [ + "$\\frac{133}{9}-9 \\left(x-\\frac{4}{9}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-9*x**2+8*x+13), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $-\\tanh ^{-1}(4 x+5)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(-atanh(4*x+5), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 x^2+10 x-\\frac{9}{2}$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(5-i \\sqrt{2}\\right)\\lor x=\\frac{1}{6} \\left(5+i \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*x**2+10*x-(9/2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-9 \\left(\\sin \\left(\\frac{11 \\pi }{90}\\right)-i \\cos \\left(\\frac{11 \\pi }{90}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-4782969 \\left(-\\sin \\left(\\frac{13 \\pi }{90}\\right)-i \\cos \\left(\\frac{13 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-9*(math.sin(((11*math.pi)/90))-1j*math.cos(((11*math.pi)/90))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^6+4 x^5-8 x^4-9 x^3-x^2+6 x+4$ when divided by $6 x^3-9 x^2-x+6$.", + "Output Answer": [ + "$\\frac{5 x^3}{6}+\\frac{23 x^2}{12}+\\frac{121 x}{72}+\\frac{73}{144}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**6+4*x**5-8*x**4-9*x**3-x**2+6*x+4\nq = 6*x**3-9*x**2-x+6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{22}{5} \\left(\\cos \\left(\\frac{13 \\pi }{180}\\right)-i \\sin \\left(\\frac{13 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{22}{5} \\sqrt{\\sin ^2\\left(\\frac{13 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{180}\\right)}$\nArgument: $\\frac{167 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(22/5)*(math.cos(((13*math.pi)/180))-i*math.sin(((13*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-x-5 y+8 z+10=0$, $15 x+10 y-8 z-14=0$, $-5 x-7 y+8 z-9=0$", + "Output Answer": [ + "$x=\\frac{103}{8}$, $y=-\\frac{141}{4}$, $z=-\\frac{1387}{64}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-x-5*y+8*z+10, 15*x+10*y-8*z-14, -5*x-7*y+8*z-9)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-2 x-8}+\\sqrt{9-x}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -692+60 \\sqrt{119}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-2*x-8)+sqrt(9-x), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{139}+\\sqrt{71}\\right)+\\sqrt{7}$.", + "Output Answer": [ + "$\\sqrt{7}+\\sqrt{71}+\\sqrt{139}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(139)+sqrt(71))+sqrt(7))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $-\\sin ^{-1}\\left(\\frac{3}{2}-8 x\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{16} (2 \\sin (y)+3)\\text{ if }-\\frac{\\pi }{2}\\leq y\\leq \\frac{\\pi }{2}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, -asin((3/2)-8*x))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=7+\\frac{38 i}{5}$ and $y=\\frac{42}{5}+\\frac{21 i}{5}$", + "Output Answer": [ + "$\\frac{77}{5}+\\frac{59 i}{5}$" + ], + "Output Program": [ + "i = 1j\nx = 7+((38*i)/5)\ny = (42/5)+((21*i)/5)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{22 x^2}{3}+\\frac{29 x}{3}+\\frac{13}{3}}{\\frac{49}{3}-\\frac{43 x}{3}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((22*x**2)/3)+((29*x)/3)+(13/3))/((49/3)-((43*x)/3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{15+4 i}{\\sqrt{3}}$ and $y=\\frac{9-13 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{6+17 i}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((15+4*i)/(math.sqrt(3)))\ny = ((9-13*i)/(math.sqrt(3)))\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{10-20}{((7+25)+17)+8}$.", + "Output Answer": [ + "$-\\frac{10}{57}$" + ], + "Output Program": [ + "try: \n print(((10-20)/(((7+25)+17)+8)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 8 \\sqrt{2} x+13 \\sqrt{2}\\right| =\\frac{33}{\\sqrt{2}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{59}{16}\\right\\},\\left\\{x\\to \\frac{7}{16}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(8*sqrt(2)*x+13*sqrt(2)), (33/(sqrt(2)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 5 (x-2)^2, q(x) = 2 \\sqrt{5} x$", + "Output Answer": [ + "$5 x^2+2 \\sqrt{5} x-20 x+20$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*(x-2)**2\nq = 2*sqrt(5)*x\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3} \\sqrt{x}+\\sqrt{2 x-1}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\left(9 \\sqrt{3}-\\sqrt{161}\\right)^2\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3)*sqrt(x)+sqrt(2*x-1), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 x^2-15 x-3$, $q(x) = 4 x^2+9 x-13$", + "Output Answer": [ + "$8 x^2-6 x-16$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**2-15*x-3\nq = 4*x**2+9*x-13\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $x^2+5 x+14$", + "Output Answer": [ + "$\\left(x+\\frac{5}{2}\\right)^2+\\frac{31}{4}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (x**2+5*x+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 8 \\sqrt{5} x-2 \\sqrt{5}\\right| =8 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{4}\\right\\},\\left\\{x\\to \\frac{5}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(8*sqrt(5)*x-2*sqrt(5)), 8*sqrt(5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 16 x^2-22 x+12\\right| =10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(11-\\sqrt{89}\\right)\\right\\},\\left\\{x\\to \\frac{1}{16} \\left(11+\\sqrt{89}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(16*x**2-22*x+12), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{175 x^3+279 x^2+164 x-24}{18-150 x}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((175*x**3+279*x**2+164*x-24)/(18-150*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $8 \\sqrt{2} x^2-6 \\sqrt{2} x+3 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{8} \\left(3-i \\sqrt{15}\\right)\\lor x=\\frac{1}{8} \\left(3+i \\sqrt{15}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(8*sqrt(2)*x**2-6*sqrt(2)*x+3*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 2-13 x| =-23$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(2-13*x), -23), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{9}{20}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$-\\frac{2583}{20}$" + ], + "Output Program": [ + "a = -(9/20) # initial value\nd = -6 # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(9/20) # initial value\nd = -6 # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = x^2+6 x-8$ and $q(x) = 13 x^2+x-10$", + "Output Answer": [ + "$13 x^4+79 x^3-108 x^2-68 x+80$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = x**2+6*x-8\nq = 13*x**2+x-10\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2+4 x-3 y^2+6 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Circle\nEquation: $-3 \\left(x-\\frac{2}{3}\\right)^2-3 (y-1)^2=-\\frac{22}{3}$\nRadius: $\\frac{\\sqrt{22}}{3}$\nCircumference: $\\frac{2 \\sqrt{22} \\pi }{3}$\nCenter: $\\left\\{\\frac{2}{3},1\\right\\}$\nArea Enclosed: $\\frac{22 \\pi }{9}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2+4*x-3*y**2+6*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-21 x-19 y+2=0$, $-\\frac{23 x}{2}-\\frac{27 y}{2}+4 z-\\frac{29}{2}=0$, $\\frac{27 x}{2}+\\frac{49 y}{2}+\\frac{39 z}{2}+10=0$", + "Output Answer": [ + "$x=\\frac{3917}{1314}$, $y=-\\frac{1397}{438}$, $z=\\frac{940}{657}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-21*x-19*y+2, -((23*x)/2)-((27*y)/2)+4*z-(29/2), ((27*x)/2)+((49*y)/2)+((39*z)/2)+10)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $10 x^5+x^4+4 x^3-4 x^2+6 x$ when divided by $-7 x^3+2 x^2-7 x-3$.", + "Output Answer": [ + "$-\\frac{10 x^2}{7}-\\frac{27 x}{49}+\\frac{240}{343}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x**5+x**4+4*x**3-4*x**2+6*x\nq = -7*x**3+2*x**2-7*x-3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-3 x^2-6 x+22}{24 x+15}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-3-5 \\sqrt{3}\\right)\\right\\},\\left\\{x\\to \\frac{1}{3} \\left(-3+5 \\sqrt{3}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-3*x**2-6*x+22)/(24*x+15)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^6-9 x^5-6 x^4-6 x^3+x^2-9 x-7$ when divided by $-2 x^5-9 x^4-10 x^3+9 x^2-9 x-1$.", + "Output Answer": [ + "$\\frac{81}{4}-\\frac{7 x}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**6-9*x**5-6*x**4-6*x**3+x**2-9*x-7\nq = -2*x**5-9*x**4-10*x**3+9*x**2-9*x-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2-88 x$", + "Output Answer": [ + "$-8 x (x+11)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2-88*x, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{((8+24)-17)-3}{(((1+11)-9)-19)+16}$.", + "Output Answer": [ + "$\\text{ComplexInfinity}$" + ], + "Output Program": [ + "try: \n print(((((8+24)-17)-3)/((((1+11)-9)-19)+16)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (2 x+9)^4, q(x) = 5 x-4$", + "Output Answer": [ + "$16 x^4+288 x^3+1944 x^2+5837 x+6557$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (2*x+9)**4\nq = 5*x-4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-9 x+9 y^2-3 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x-\\frac{9}{8}\\right)^2+9 \\left(y-\\frac{1}{6}\\right)^2=\\frac{181}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{9}{8}-\\frac{\\sqrt{905}}{24} & \\frac{1}{6} \\\\\n \\frac{1}{24} \\left(27+\\sqrt{905}\\right) & \\frac{1}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{9}{8}-\\frac{\\sqrt{905}}{24}+\\frac{1}{24} \\left(27+\\sqrt{905}\\right)\\right),\\frac{1}{6}\\right\\}$\nArea Enclosed: $\\frac{181 \\pi }{96}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-9*x+9*y**2-3*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{3}{5}$, and $a_n=a_{n-1}+\\frac{39}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=17$.", + "Output Answer": [ + "$\\frac{5253}{5}$" + ], + "Output Program": [ + "a = -(3/5) # initial value\nd = (39/5) # second term\nn = 17 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(3/5) # initial value\nd = (39/5) # second term\nn = 17 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+2 x+6 y^2+3 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $3 \\left(x+\\frac{1}{3}\\right)^2+6 \\left(y+\\frac{1}{4}\\right)^2=\\frac{209}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{12} \\left(-4-\\sqrt{209}\\right) & -\\frac{1}{4} \\\\\n \\frac{1}{12} \\left(\\sqrt{209}-4\\right) & -\\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{12} \\left(-4-\\sqrt{209}\\right)+\\frac{1}{12} \\left(\\sqrt{209}-4\\right)\\right),-\\frac{1}{4}\\right\\}$\nArea Enclosed: $\\frac{209 \\pi }{72 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+2*x+6*y**2+3*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^4-\\frac{23 x^3}{5}-\\frac{41 x^2}{5}-\\frac{24 x}{5}+\\frac{22}{5}$ when divided by $-\\frac{9 x^4}{5}-\\frac{22 x^3}{5}-4 x^2-\\frac{34 x}{5}-\\frac{29}{5}$.", + "Output Answer": [ + "$\\frac{10}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**4-((23*x**3)/5)-((41*x**2)/5)-((24*x)/5)+(22/5)\nq = -((9*x**4)/5)-((22*x**3)/5)-4*x**2-((34*x)/5)-(29/5)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (5 x+1)^2, q(x) = x^2$", + "Output Answer": [ + "$26 x^2+10 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (5*x+1)**2\nq = x**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\sqrt{5} e^{-\\frac{i \\pi }{6}}$.", + "Output Answer": [ + "Norm: $\\sqrt{5}$\nArgument: $\\frac{5 \\pi }{6}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.sqrt(5)*math.e**(-((i*math.pi)/6))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{12 x}{7}-\\frac{92 y}{7}-\\frac{16}{7}=0$, $-\\frac{66 x}{7}+\\frac{103 y}{7}-1=0$", + "Output Answer": [ + "$x=-\\frac{191}{403}$, $y=-\\frac{95}{403}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((12*x)/7)-((92*y)/7)-(16/7), -((66*x)/7)+((103*y)/7)-1), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{3} \\left(588 t^2-56 \\left(78+\\sqrt{3}\\right) t+208 \\sqrt{3}+8116\\right), x(t)=\\frac{7 t}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=12 x^2-8 x+\\frac{4}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/3)*(588*t**2-56*(78+sqrt(3))*t+208*sqrt(3)+8116)\nx_t = ((7*t)/(sqrt(3)))-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{3}{2} \\left(-5 t+4 \\sqrt{2}+21\\right), x(t)=\\frac{5 t}{\\sqrt{2}}-\\frac{21}{\\sqrt{2}}$", + "Output Answer": [ + "$y=6 \\sqrt{2}-\\frac{3 x}{\\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (3/2)*(-5*t+4*sqrt(2)+21)\nx_t = ((5*t)/(sqrt(2)))-(21/(sqrt(2)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-21 x^2-15 x+5}{-13 x-20}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{42} \\left(-15-\\sqrt{645}\\right)\\right\\},\\left\\{x\\to \\frac{1}{42} \\left(-15+\\sqrt{645}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-21*x**2-15*x+5)/(-13*x-20)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-5-9 i$ and $y=-5+3 i$", + "Output Answer": [ + "$-12 i$" + ], + "Output Program": [ + "i = 1j\nx = -5-9*i\ny = -5+3*i\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{4}{3}-9 x}+\\sqrt{8-8 x}=\\frac{13}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-2933+104 \\sqrt{795}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((4/3)-9*x)+sqrt(8-8*x), (13/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{3-2}{((21-18)-22)-22}$.", + "Output Answer": [ + "$-\\frac{1}{41}$" + ], + "Output Program": [ + "try: \n print(((3-2)/(((21-18)-22)-22)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-x^2-x$ when divided by $8 x+8$.", + "Output Answer": [ + "$-\\frac{x}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**2-x\nq = 8*x+8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{21 x^2}{2}-\\frac{19 x}{2}+\\frac{17}{2}$", + "Output Answer": [ + "$\\frac{21}{2} \\left(x-\\frac{19}{42}\\right)^2+\\frac{1067}{168}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((21*x**2)/2)-((19*x)/2)+(17/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{41 x}{\\sqrt{3}}-5 \\sqrt{3} y-13 \\sqrt{3} z+\\frac{14}{\\sqrt{3}}=0$, $-\\frac{31 x}{\\sqrt{3}}-\\frac{7 y}{\\sqrt{3}}-\\frac{34 z}{\\sqrt{3}}-\\frac{16}{\\sqrt{3}}=0$, $-\\frac{x}{\\sqrt{3}}-\\frac{25 y}{\\sqrt{3}}-\\frac{43 z}{\\sqrt{3}}-\\frac{29}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{6613}{4014}$, $y=\\frac{40405}{12042}$, $z=-\\frac{16037}{6021}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((41*x)/(sqrt(3)))-5*sqrt(3)*y-13*sqrt(3)*z+(14/(sqrt(3))), -((31*x)/(sqrt(3)))-((7*y)/(sqrt(3)))-((34*z)/(sqrt(3)))-(16/(sqrt(3))), -(x/(sqrt(3)))-((25*y)/(sqrt(3)))-((43*z)/(sqrt(3)))-(29/(sqrt(3))))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{1}{(5 x+8)^2}+\\tan \\left(\\sqrt{-2 x-5}\\right)$ at the point $x=-3$", + "Output Answer": [ + "$\\frac{1}{49}+\\tan (1) = 1.578$" + ], + "Output Program": [ + "import math\n\nx = -3\ntry: \n f = (1/((5*x+8)**2))+math.tan(math.sqrt(-2*x-5))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $-\\frac{-7 \\sqrt{5} x^2-5 \\sqrt{5} x-10 \\sqrt{5}}{9 \\sqrt{5}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((-7*sqrt(5)*x**2-5*sqrt(5)*x-10*sqrt(5))/(9*sqrt(5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^5-7 x^4+6 x^3-9 x^2-x+2$ when divided by $5-9 x$.", + "Output Answer": [ + "$-\\frac{8 x^4}{9}+\\frac{23 x^3}{81}-\\frac{371 x^2}{729}+\\frac{4706 x}{6561}+\\frac{30091}{59049}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**5-7*x**4+6*x**3-9*x**2-x+2\nq = 5-9*x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-23 x-11 y+8 z-2=0$, $17 x-15 y-24 z-15=0$, $-3 x+10 y+20 z-13=0$", + "Output Answer": [ + "$x=\\frac{781}{444}$, $y=-\\frac{3121}{1332}$, $z=\\frac{11111}{5328}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-23*x-11*y+8*z-2, 17*x-15*y-24*z-15, -3*x+10*y+20*z-13)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{3}{4} \\left(\\cos \\left(\\frac{43}{45}\\right)+i \\sin \\left(\\frac{43}{45}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$-\\frac{243 \\left(\\cos \\left(\\frac{43}{9}\\right)+i \\sin \\left(\\frac{43}{9}\\right)\\right)}{1024}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(3/4)*(math.cos((43/45))+1j*math.sin((43/45))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-24 x^2+17 x+18}{-12 x-3}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{48} \\left(17-\\sqrt{2017}\\right)\\right\\},\\left\\{x\\to \\frac{1}{48} \\left(17+\\sqrt{2017}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-24*x**2+17*x+18)/(-12*x-3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x+6}+\\sqrt{7 x-14}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 202-16 \\sqrt{154}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x+6)+sqrt(7*x-14), 8), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((7+17)+6)^2-((((19+18)+10)-20)-2)$.", + "Output Answer": [ + "$875$" + ], + "Output Program": [ + "try: \n print(((7+17)+6)**2-((((19+18)+10)-20)-2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{132 x^3-12 x^2-231 x+21}{-198 x^2+249 x-21}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{\\sqrt{7}}{2}\\right\\},\\left\\{x\\to \\frac{\\sqrt{7}}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((132*x**3-12*x**2-231*x+21)/(-198*x**2+249*x-21)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=7 (t-2), x(t)=7 t-15$", + "Output Answer": [ + "$y=x+1$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 7*(t-2)\nx_t = 7*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{90}+22\\right) \\left(\\sqrt{43}+4\\right)$.", + "Output Answer": [ + "$\\left(22+3 \\sqrt{10}\\right) \\left(4+\\sqrt{43}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(90)+22)*(sqrt(43)+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{84 x}{5}+\\frac{61 y}{5}-5 z+\\frac{46}{5}=0$, $24 x-6 y-\\frac{31 z}{5}-\\frac{113}{5}=0$, $\\frac{57 x}{5}-\\frac{101 y}{5}+\\frac{106 z}{5}-\\frac{43}{5}=0$", + "Output Answer": [ + "$x=\\frac{89530}{384527}$, $y=-\\frac{55047}{34957}$, $z=-\\frac{469111}{384527}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((84*x)/5)+((61*y)/5)-5*z+(46/5), 24*x-6*y-((31*z)/5)-(113/5), ((57*x)/5)-((101*y)/5)+((106*z)/5)-(43/5))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{11}{3} \\left(-\\sin \\left(\\frac{3 \\pi }{20}\\right)+i \\cos \\left(\\frac{3 \\pi }{20}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{11}{3} \\sqrt{\\sin ^2\\left(\\frac{3 \\pi }{20}\\right)+\\cos ^2\\left(\\frac{3 \\pi }{20}\\right)}$\nArgument: $-\\frac{7 \\pi }{20}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(11/3)*(-math.sin(((3*math.pi)/20))+i*math.cos(((3*math.pi)/20)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -3 x, q(x) = -(x+6)^3$", + "Output Answer": [ + "$-x^3-18 x^2-111 x-216$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x\nq = -(x+6)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-2 x^2+8 x-3$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(4-\\sqrt{10}\\right)\\lor x=\\frac{1}{2} \\left(4+\\sqrt{10}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-2*x**2+8*x-3, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 \\sqrt{5} x^2-\\sqrt{5} x-5 \\sqrt{5}$", + "Output Answer": [ + "$-3 \\sqrt{5} \\left(x+\\frac{1}{6}\\right)^2-\\frac{59 \\sqrt{5}}{12}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*math.sqrt(5)*x**2-math.sqrt(5)*x-5*math.sqrt(5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{39 x^3}{25}-\\frac{323 x^2}{25}+\\frac{447 x}{25}-\\frac{36}{5}$ and $-\\frac{13 x^2}{5}+\\frac{21 x}{5}-\\frac{9}{5}$.", + "Output Answer": [ + "$\\frac{13 x^2}{25}-\\frac{21 x}{25}+\\frac{9}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((39*x**3)/25)-((323*x**2)/25)+((447*x)/25)-(36/5), -((13*x**2)/5)+((21*x)/5)-(9/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $8 x^2-160 x+\\frac{9048}{25}$", + "Output Answer": [ + "$8 \\left(\\frac{13}{5}-x\\right) \\left(\\frac{87}{5}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(8*x**2-160*x+(9048/25), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2+\\frac{800 x}{7}+\\frac{11590}{49}$", + "Output Answer": [ + "$10 \\left(-x-\\frac{61}{7}\\right) \\left(-x-\\frac{19}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2+((800*x)/7)+(11590/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4-12 x$ and $3 x-1$.", + "Output Answer": [ + "$3 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4-12*x, 3*x-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $3 x^2+x-13$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(-1-\\sqrt{157}\\right)\\lor x=\\frac{1}{6} \\left(\\sqrt{157}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(3*x**2+x-13, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-22 x^2+\\frac{35 x}{2}+\\frac{33}{2}}{\\frac{49 x^2}{2}+24 x+12}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{88} \\left(35-\\sqrt{7033}\\right)\\right\\},\\left\\{x\\to \\frac{1}{88} \\left(35+\\sqrt{7033}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-22*x**2+((35*x)/2)+(33/2))/(((49*x**2)/2)+24*x+12)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^6-3 x^5+5 x^4+5 x^3+9 x^2-6 x+3$ when divided by $-9 x^4+10 x^3+10 x^2+10 x-3$.", + "Output Answer": [ + "$-\\frac{8 x^2}{9}-\\frac{53 x}{81}-\\frac{1655}{729}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**6-3*x**5+5*x**4+5*x**3+9*x**2-6*x+3\nq = -9*x**4+10*x**3+10*x**2+10*x-3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{83 x^2+\\frac{7433 x}{49}-\\frac{14652}{49}}{\\frac{9504}{49}-\\frac{7968 x}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{148}{49}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((83*x**2+((7433*x)/49)-(14652/49))/((9504/49)-((7968*x)/49))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^4-9 x^3-4 x^2+x-7$ when divided by $8 x^3+6 x^2-4 x+6$.", + "Output Answer": [ + "$\\frac{7 x}{8}-\\frac{57}{32}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**4-9*x**3-4*x**2+x-7\nq = 8*x**3+6*x**2-4*x+6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{1}{25}$, and $a_n=a_{n-1}+7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$\\frac{44252}{25}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(1/25) # initial value\nd = 7 # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(1/25) # initial value\nd = 7 # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\log (2 x+4)$", + "Output Answer": [ + "$y\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(log(2*x+4), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x^2-\\frac{11 x}{3}-4$ and $\\frac{8 x^2}{3}+4 x-\\frac{8}{3}$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x**2-((11*x)/3)-4, ((8*x**2)/3)+4*x-(8/3)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-12 t-35, x(t)=-6 t-15$", + "Output Answer": [ + "$y=2 x-5$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -12*t-35\nx_t = -6*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{1}{6} (((25+25)+24)-18)}{2-9}$.", + "Output Answer": [ + "$-\\frac{4}{3}$" + ], + "Output Program": [ + "try: \n print((((1/6)*(((25+25)+24)-18))/(2-9)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{74 x^2}{5}+\\frac{27 x}{5}-\\frac{33}{5}$ and $q(x) = -\\frac{3 x^2}{5}+\\frac{16 x}{5}-\\frac{73}{5}$", + "Output Answer": [ + "$-\\frac{222 x^4}{25}+\\frac{1103 x^3}{25}-\\frac{4871 x^2}{25}-\\frac{2499 x}{25}+\\frac{2409}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((74*x**2)/5)+((27*x)/5)-(33/5)\nq = -((3*x**2)/5)+((16*x)/5)-(73/5)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2-3 x-y^2-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $\\left(x-\\frac{3}{2}\\right)^2-y^2=\\frac{49}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{2}-\\frac{7}{\\sqrt{2}} & 0 \\\\\n \\frac{3}{2}+\\frac{7}{\\sqrt{2}} & 0 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{3}{2},0\\right\\}$\nAsymptotes: $\\left\\{y=x-\\frac{3}{2},y=\\frac{3}{2}-x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-3*x-y**2-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{15}{7}-\\frac{59 i}{7}$ and $y=-\\frac{8}{7}-\\frac{55 i}{7}$", + "Output Answer": [ + "$-1-\\frac{4 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = -(15/7)-((59*i)/7)\ny = -(8/7)-((55*i)/7)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{175 x^3}{2}+\\frac{315 x^2}{2}-175 x+28}{560 x^2-497 x+77}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(-5-\\sqrt{65}\\right)\\right\\},\\left\\{x\\to \\frac{1}{5} \\left(-5+\\sqrt{65}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((175*x**3)/2)+((315*x**2)/2)-175*x+28)/(560*x**2-497*x+77)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{11 x^6}{2}+\\frac{19 x^5}{2}+5 x^4+\\frac{13 x^3}{2}+\\frac{5 x^2}{2}-\\frac{5 x}{2}-9$ when divided by $\\frac{11 x^5}{2}+\\frac{7 x^4}{2}-2 x^3-7 x^2+10 x+\\frac{13}{2}$.", + "Output Answer": [ + "$x+\\frac{12}{11}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((11*x**6)/2)+((19*x**5)/2)+5*x**4+((13*x**3)/2)+((5*x**2)/2)-((5*x)/2)-9\nq = ((11*x**5)/2)+((7*x**4)/2)-2*x**3-7*x**2+10*x+(13/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{144 t^2-624 t+721}{3 \\sqrt{3}}, x(t)=48 t^2-208 t+\\frac{676}{3}$", + "Output Answer": [ + "$y=-\\frac{x}{\\sqrt{3}}-5 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -((144*t**2-624*t+721)/(3*sqrt(3)))\nx_t = 48*t**2-208*t+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-7 \\sqrt{2} x^2-\\sqrt{2} x+7 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(-1-\\sqrt{197}\\right)\\lor x=\\frac{1}{14} \\left(\\sqrt{197}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-7*sqrt(2)*x**2-sqrt(2)*x+7*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10 x+5}+\\sqrt{10 x+11}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1709}{1000}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10*x+5)+sqrt(10*x+11), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{45 x}{4}+\\frac{1}{2}}+\\sqrt{12 x-5}=\\frac{25}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{59087}{3 \\left(2771+100 \\sqrt{767}\\right)}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((45*x)/4)+(1/2))+sqrt(12*x-5), (25/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2+25 x$", + "Output Answer": [ + "$-10 \\left(-x-\\frac{5}{2}\\right) x$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2+25*x, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{15 x^3-160 x^2+339 x+46}{60 x^2-442 x-138}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(15-\\sqrt{265}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(15+\\sqrt{265}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((15*x**3-160*x**2+339*x+46)/(60*x**2-442*x-138)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$20 x+5 y-7=0$, $-13 x-2 y-7=0$", + "Output Answer": [ + "$x=-\\frac{49}{25}$, $y=\\frac{231}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((20*x+5*y-7, -13*x-2*y-7), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2-6 x+10 y^2+3 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(y+\\frac{3}{20}\\right)^2-8 \\left(x+\\frac{3}{8}\\right)^2=-\\frac{69}{10}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{40} \\left(5+2 \\sqrt{69}\\right) & -\\frac{3}{20} \\\\\n \\frac{3}{40} \\left(2 \\sqrt{69}-5\\right) & -\\frac{3}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{3}{40} \\left(2 \\sqrt{69}-5\\right)-\\frac{3}{40} \\left(5+2 \\sqrt{69}\\right)\\right),-\\frac{3}{20}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2 x}{\\sqrt{5}}+\\frac{3}{20} \\left(\\sqrt{5}-1\\right),y=-\\frac{2 x}{\\sqrt{5}}-\\frac{3}{20} \\left(1+\\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2-6*x+10*y**2+3*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 (x-3)^4, q(x) = 3$", + "Output Answer": [ + "$9 x^4-108 x^3+486 x^2-972 x+732$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*(x-3)**4\nq = 3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-3 x+9 y^2-4 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x-\\frac{3}{10}\\right)^2+9 \\left(y-\\frac{2}{9}\\right)^2=\\frac{701}{180}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{90} \\left(27-2 \\sqrt{701}\\right) & \\frac{2}{9} \\\\\n \\frac{1}{90} \\left(27+2 \\sqrt{701}\\right) & \\frac{2}{9} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{90} \\left(27-2 \\sqrt{701}\\right)+\\frac{1}{90} \\left(27+2 \\sqrt{701}\\right)\\right),\\frac{2}{9}\\right\\}$\nArea Enclosed: $\\frac{701 \\pi }{540 \\sqrt{5}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-3*x+9*y**2-4*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{37}{7}-\\frac{5 i}{7}$ and $y=-\\frac{10 i}{7}$", + "Output Answer": [ + "$\\frac{37}{7}-\\frac{15 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = (37/7)-((5*i)/7)\ny = -((10*i)/7)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{13 x-10}+\\sqrt{\\frac{92 x}{7}-\\frac{36}{7}}=\\frac{34}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(211310-408 \\sqrt{268219}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(13*x-10)+sqrt(((92*x)/7)-(36/7)), (34/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{13 x^2}{\\sqrt{3}}+\\frac{14 x}{\\sqrt{3}}-2 \\sqrt{3}$ and $q(x) = -4 \\sqrt{3} x^2-\\frac{13 x}{\\sqrt{3}}-\\sqrt{3}$", + "Output Answer": [ + "$52 x^4+\\frac{x^3}{3}-\\frac{71 x^2}{3}+12 x+6$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((13*x**2)/(sqrt(3)))+((14*x)/(sqrt(3)))-2*sqrt(3)\nq = -4*sqrt(3)*x**2-((13*x)/(sqrt(3)))-sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-11 x^2+14 x+1$", + "Output Answer": [ + "$x=\\frac{1}{11} \\left(7-2 \\sqrt{15}\\right)\\lor x=\\frac{1}{11} \\left(7+2 \\sqrt{15}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-11*x**2+14*x+1, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-14 x-14}+\\sqrt{5} \\sqrt{-x}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{81} \\left(-1342+16 \\sqrt{5110}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-14*x-14)+sqrt(5)*sqrt(-x), 8), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{29}{69}$, and $a_n=a_{n-1}+2 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$15 \\left(\\frac{58}{69}+58 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\na = (29/69) # initial value\nd = 2*math.pi # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (29/69) # initial value\nd = 2*math.pi # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(((1+9)+25)^2-13\\right)+\\left(\\frac{1}{7} ((7-21)-17)+16\\right)$.", + "Output Answer": [ + "$\\frac{8565}{7}$" + ], + "Output Program": [ + "try: \n print((((1+9)+25)**2-13)+((1/7)*((7-21)-17)+16))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=16 t^2+12 \\left(\\sqrt{2}-56\\right) t-252 \\sqrt{2}+\\frac{14121}{2}, x(t)=\\frac{t}{\\sqrt{2}}-\\frac{21}{\\sqrt{2}}$", + "Output Answer": [ + "$y=32 x^2+24 x+\\frac{9}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 16*t**2+12*(sqrt(2)-56)*t-252*sqrt(2)+(14121/2)\nx_t = (t/(sqrt(2)))-(21/(sqrt(2)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\sqrt{2} \\left(\\cos \\left(\\frac{\\pi }{15}\\right)+i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$50 \\left(\\cos \\left(\\frac{2 \\pi }{15}\\right)+i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*math.sqrt(2)*(math.cos((math.pi/15))+1j*math.sin((math.pi/15))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^7+3 x^6+3 x^5-7 x^4-15 x^3-10 x^2-x+15$ and $x^5-x^3-2 x^2-2 x+3$.", + "Output Answer": [ + "$x^5-x^3-2 x^2-2 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**7+3*x**6+3*x**5-7*x**4-15*x**3-10*x**2-x+15, x**5-x**3-2*x**2-2*x+3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-x^3+6 x^2-5 x-3$ when divided by $-9 x^2+10 x-1$.", + "Output Answer": [ + "$\\frac{x}{9}-\\frac{44}{81}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**3+6*x**2-5*x-3\nq = -9*x**2+10*x-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $x^5+7 x^4+9 x^3-8 x^2-6 x+4$ when divided by $x^3-4 x^2+9 x+7$.", + "Output Answer": [ + "$x^2+11 x+44$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**5+7*x**4+9*x**3-8*x**2-6*x+4\nq = x**3-4*x**2+9*x+7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2-\\frac{54 x}{7}+\\frac{88128}{49}$", + "Output Answer": [ + "$9 \\left(\\frac{96}{7}-x\\right) \\left(x+\\frac{102}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2-((54*x)/7)+(88128/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{3} \\left(-16 t-7 \\sqrt{3}-52\\right), x(t)=-\\frac{8 t}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=\\frac{2 x}{\\sqrt{3}}-\\frac{7}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/3)*(-16*t-7*sqrt(3)-52)\nx_t = -((8*t)/(sqrt(3)))-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{x^2}{\\sqrt{\\pi }}+\\frac{6 x}{\\sqrt{\\pi }}+\\frac{12}{\\sqrt{\\pi }}$ and $q(x) = \\frac{16 x^2}{\\sqrt{\\pi }}+\\frac{22 x}{\\sqrt{\\pi }}-\\frac{19}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{16 x^4}{\\pi }+\\frac{74 x^3}{\\pi }+\\frac{343 x^2}{\\pi }+\\frac{150 x}{\\pi }-\\frac{228}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((x**2)/(sqrt(pi)))+((6*x)/(sqrt(pi)))+(12/(sqrt(pi)))\nq = ((16*x**2)/(sqrt(pi)))+((22*x)/(sqrt(pi)))-(19/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{8 x^4}{25}+\\frac{138 x^3}{25}+\\frac{169 x^2}{25}-\\frac{117 x}{25}-\\frac{162}{25}$ and $-\\frac{8 x^2}{5}-\\frac{2 x}{5}+\\frac{9}{5}$.", + "Output Answer": [ + "$\\frac{8 x^2}{25}+\\frac{2 x}{25}-\\frac{9}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((8*x**4)/25)+((138*x**3)/25)+((169*x**2)/25)-((117*x)/25)-(162/25), -((8*x**2)/5)-((2*x)/5)+(9/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $12 x^5+15 x^4+22 x^3+28 x^2+18 x+4$ and $-3 x^3-4 x-2$.", + "Output Answer": [ + "$3 x^3+4 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(12*x**5+15*x**4+22*x**3+28*x**2+18*x+4, -3*x**3-4*x-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3 x+12}+\\sqrt{4 x+12}=2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 28-8 \\sqrt{15}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3*x+12)+sqrt(4*x+12), 2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((23-5)-22)-(15-21)$.", + "Output Answer": [ + "$2$" + ], + "Output Program": [ + "try: \n print(((23-5)-22)-(15-21))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((10-5)+5)+19)+(11+25)$.", + "Output Answer": [ + "$65$" + ], + "Output Program": [ + "try: \n print((((10-5)+5)+19)+(11+25))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=8 \\left(5 t^2-110 t+602\\right)^2, x(t)=2 t^2-44 t+242$", + "Output Answer": [ + "$y=50 x^2-120 x+72$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 8*(5*t**2-110*t+602)**2\nx_t = 2*t**2-44*t+242\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{9}{26}$, and $a_n=a_{n-1}+5$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$\\frac{33097}{26}$" + ], + "Output Program": [ + "a = (9/26) # initial value\nd = 5 # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (9/26) # initial value\nd = 5 # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -2 x^2+2 x-12$ and $q(x) = -8 x^2+5 x+8$", + "Output Answer": [ + "$16 x^4-26 x^3+90 x^2-44 x-96$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -2*x**2+2*x-12\nq = -8*x**2+5*x+8\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\sqrt{2} \\left(\\cos \\left(\\frac{11}{9}\\right)+i \\sin \\left(\\frac{11}{9}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$33554432 \\left(\\cos \\left(\\frac{110}{9}\\right)+i \\sin \\left(\\frac{110}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*math.sqrt(2)*(math.cos((11/9))+1j*math.sin((11/9))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 x^2+10 x-8$ and $q(x) = -12 x^2-12 x-3$", + "Output Answer": [ + "$60 x^4-60 x^3-9 x^2+66 x+24$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -5*x**2+10*x-8\nq = -12*x**2-12*x-3\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{65}{7}+\\frac{59 i}{7}$ and $y=-\\frac{51}{7}+\\frac{51 i}{7}$", + "Output Answer": [ + "$2+\\frac{110 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = (65/7)+((59*i)/7)\ny = -(51/7)+((51*i)/7)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 x^2+7 x+11$", + "Output Answer": [ + "$\\frac{181}{12}-3 \\left(x-\\frac{7}{6}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*x**2+7*x+11), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=8 x-8$ at the point $x=1$", + "Output Answer": [ + "$0 = 0.$" + ], + "Output Program": [ + "x = 1\ntry: \n f = 8*x-8\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $10 x^6+29 x^5+11 x^4-10 x^3-9 x^2-6 x-1$ and $5 x^4+2 x^3-2 x^2-x-1$.", + "Output Answer": [ + "$5 x^4+2 x^3-2 x^2-x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(10*x**6+29*x**5+11*x**4-10*x**3-9*x**2-6*x-1, 5*x**4+2*x**3-2*x**2-x-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{8}+\\sqrt{53}\\right) \\sqrt{\\sqrt{110}-\\sqrt{32}}$.", + "Output Answer": [ + "$\\sqrt[4]{2} \\left(2 \\sqrt{2}+\\sqrt{53}\\right) \\sqrt{\\sqrt{55}-4}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(8)+sqrt(53))*sqrt(sqrt(110)-sqrt(32)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=4-6 i$ and $y=9+4 i$", + "Output Answer": [ + "$\\frac{12}{97}-\\frac{70 i}{97}$" + ], + "Output Program": [ + "i = 1j\nx = 4-6*i\ny = 9+4*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2-2 x+4 y^2-3 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(y-\\frac{3}{8}\\right)^2-10 \\left(x+\\frac{1}{10}\\right)^2=-\\frac{43}{80}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{40} \\left(-4-\\sqrt{301}\\right) & \\frac{3}{8} \\\\\n \\frac{1}{40} \\left(\\sqrt{301}-4\\right) & \\frac{3}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{40} \\left(-4-\\sqrt{301}\\right)+\\frac{1}{40} \\left(\\sqrt{301}-4\\right)\\right),\\frac{3}{8}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{5}{2}} x+\\frac{1}{40} \\left(15+2 \\sqrt{10}\\right),y=\\frac{1}{40} \\left(15-2 \\sqrt{10}\\right)-\\sqrt{\\frac{5}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2-2*x+4*y**2-3*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{25 x}{\\sqrt{3}}-8 \\sqrt{3}\\right| =\\frac{38}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{14}{25}\\right\\},\\left\\{x\\to \\frac{62}{25}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((25*x)/(sqrt(3)))-8*sqrt(3)), (38/(sqrt(3)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{35}{76}$, and $a_n=a_{n-1}+-\\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{11}{2} \\left(-\\frac{35}{38}-10 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(35/76) # initial value\nd = -math.sqrt(3) # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(35/76) # initial value\nd = -math.sqrt(3) # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{37}{5} \\left(\\left(\\frac{1}{2}+\\frac{i}{2}\\right) \\sqrt{\\frac{3}{2}}-\\frac{\\frac{1}{2}-\\frac{i}{2}}{\\sqrt{2}}\\right)$.", + "Output Answer": [ + "Norm: $\\frac{37}{5} \\sqrt{\\left(\\frac{\\sqrt{\\frac{3}{2}}}{2}-\\frac{1}{2 \\sqrt{2}}\\right)^2+\\left(\\frac{\\sqrt{\\frac{3}{2}}}{2}+\\frac{1}{2 \\sqrt{2}}\\right)^2}$\nArgument: $\\tan ^{-1}\\left(\\frac{-\\frac{\\sqrt{\\frac{3}{2}}}{2}-\\frac{1}{2 \\sqrt{2}}}{\\frac{1}{2 \\sqrt{2}}-\\frac{\\sqrt{\\frac{3}{2}}}{2}}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(37/5)*(((1/2)+(i/2))*math.sqrt((3/2))-(((1/2)-(i/2))/(math.sqrt(2))))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x^4+2 x^3+x^2+4 x+1$ and $3 x^4-2 x^3-x^2-4 x-1$.", + "Output Answer": [ + "$3 x^4-2 x^3-x^2-4 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x**4+2*x**3+x**2+4*x+1, 3*x**4-2*x**3-x**2-4*x-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{4}{15}+\\left(((24+16)+1)^2+7\\right)$.", + "Output Answer": [ + "$\\frac{25324}{15}$" + ], + "Output Program": [ + "try: \n print((4/15)+(((24+16)+1)**2+7))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{3224 x^3}{9}+\\frac{992 x^2}{9}-104 x-32}{\\frac{2392 x}{9}+\\frac{736}{9}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{\\sqrt{31}}\\right\\},\\left\\{x\\to \\frac{3}{\\sqrt{31}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((3224*x**3)/9)+((992*x**2)/9)-104*x-32)/(((2392*x)/9)+(736/9))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{22 x}{3}+24 y-13=0$, $5 x-\\frac{17 y}{3}+\\frac{74}{3}=0$", + "Output Answer": [ + "$x=-\\frac{4665}{706}$, $y=-\\frac{1043}{706}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((22*x)/3)+24*y-13, 5*x-((17*y)/3)+(74/3)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{13 x}{4}-\\frac{17}{4}}+\\sqrt{\\frac{39 x}{4}+15}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{26} \\left(571-90 \\sqrt{30}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((13*x)/4)-(17/4))+sqrt(((39*x)/4)+15), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{x^4}{3}+\\frac{10 x^3}{3}+\\frac{29 x^2}{3}+2 x+\\frac{5}{3}$ when divided by $\\frac{26 x^2}{3}-6 x+6$.", + "Output Answer": [ + "$-\\frac{x^2}{26}+\\frac{121 x}{338}+\\frac{6107}{4394}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((x**4)/3)+((10*x**3)/3)+((29*x**2)/3)+2*x+(5/3)\nq = ((26*x**2)/3)-6*x+6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=9 \\left(75 t^2+450 t+674\\right)^2, x(t)=25 t^2+150 t+225$", + "Output Answer": [ + "$y=81 x^2-54 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 9*(75*t**2+450*t+674)**2\nx_t = 25*t**2+150*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-8 x-4$ and $-4$.", + "Output Answer": [ + "$4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-8*x-4, -4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-6 (3 t+23), x(t)=-2 t-15$", + "Output Answer": [ + "$y=9 x-3$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -6*(3*t+23)\nx_t = -2*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{7 x^2}{\\sqrt{2}}+4 \\sqrt{2} x+\\frac{1}{\\sqrt{2}}$", + "Output Answer": [ + "$-\\frac{7 \\left(x-\\frac{4}{7}\\right)^2}{\\sqrt{2}}+\\frac{8 \\sqrt{2}}{7}+\\frac{1}{\\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((7*x**2)/(math.sqrt(2)))+4*math.sqrt(2)*x+(1/(math.sqrt(2)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 64 x^2, q(x) = -6 x-8$", + "Output Answer": [ + "$64 x^2-6 x-8$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 64*x**2\nq = -6*x-8\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt[3]{-2 x-\\frac{7}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{10}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(cbrt(-2*x-(7/5)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{32 x^2-18 x-35}{e}$, $q(x) = \\frac{40 x^2+40 x-34}{e}$", + "Output Answer": [ + "$\\frac{72 x^2}{e}+\\frac{22 x}{e}-\\frac{69}{e}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x\n\np = ((32*x**2-18*x-35)/math.e)\nq = ((40*x**2+40*x-34)/math.e)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{28}{3} \\left(\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(\\sqrt{5}-1\\right)\\right)\\right)^4$", + "Output Answer": [ + "$\\frac{614656}{81} \\left(\\frac{1}{4} \\left(\\sqrt{5}-1\\right)+i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(28/3)*(math.sqrt((5/8)+((math.sqrt(5))/8))+(1/4)*1j*(math.sqrt(5)-1)))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-x-10 y+14 z-12=0$, $-12 x-15 y-3 z-14=0$, $-24 x+10 y+7 z+23=0$", + "Output Answer": [ + "$x=\\frac{232}{547}$, $y=-\\frac{10411}{8205}$, $z=-\\frac{31}{1641}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-x-10*y+14*z-12, -12*x-15*y-3*z-14, -24*x+10*y+7*z+23)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{16}{5}-\\frac{28 x}{5}}+\\sqrt{-\\frac{14 x}{5}-5}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(-1667+30 \\sqrt{2730}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((16/5)-((28*x)/5))+sqrt(-((14*x)/5)-5), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 12 \\sqrt{3} x-\\frac{38}{\\sqrt{3}}\\right| =5 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{23}{36}\\right\\},\\left\\{x\\to \\frac{53}{36}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(12*sqrt(3)*x-(38/(sqrt(3)))), 5*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=42 t+104, x(t)=-6 t-15$", + "Output Answer": [ + "$y=-7 x-1$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 42*t+104\nx_t = -6*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $7 x^2+112 x+\\frac{1225}{4}$", + "Output Answer": [ + "$-7 \\left(-x-\\frac{7}{2}\\right) \\left(x+\\frac{25}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(7*x**2+112*x+(1225/4), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\cos \\left(\\frac{71}{45}\\right)-i \\sin \\left(\\frac{71}{45}\\right)\\right)^5$", + "Output Answer": [ + "$-\\cos \\left(\\frac{71}{9}\\right)-i \\sin \\left(\\frac{71}{9}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-math.cos((71/45))-1j*math.sin((71/45)))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\frac{2-16}{4}-1\\right)-13\\right)^2 \\left((13+3)^2+10\\right)$.", + "Output Answer": [ + "$\\frac{162925}{2}$" + ], + "Output Program": [ + "try: \n print(((((2-16)/4)-1)-13)**2*((13+3)**2+10))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 e x^2+3 e x-5 e$ and $q(x) = 3 e x^2-3 e x+4 e$", + "Output Answer": [ + "$12 e^2 x^4-3 e^2 x^3-8 e^2 x^2+27 e^2 x-20 e^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = 4*math.e*x**2+3*math.e*x-5*math.e\nq = 3*math.e*x**2-3*math.e*x+4*math.e\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{x^2-11 x+5}{10 x^2+17 x+1}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(11-\\sqrt{101}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(11+\\sqrt{101}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((x**2-11*x+5)/(10*x**2+17*x+1)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 6 x^2-11 x+15$, $q(x) = -10 x^2-8 x+6$", + "Output Answer": [ + "$-4 x^2-19 x+21$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**2-11*x+15\nq = -10*x**2-8*x+6\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (6 x+5)^2, q(x) = \\frac{1}{4} (16 x+5)^2$", + "Output Answer": [ + "$100 x^2+100 x+\\frac{125}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (6*x+5)**2\nq = (1/4)*(16*x+5)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 13.7 x^2-12.6 x-2.3$, $q(x) = -3.2 x^2-1.4 x+8.5$", + "Output Answer": [ + "$10.5 x^2-14. x+6.2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 13.7*x**2-12.6*x-2.3\nq = -3.2*x**2-1.4*x+8.5\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{42 x^6}{5}+\\frac{38 x^5}{5}+\\frac{19 x^4}{5}+\\frac{38 x^3}{5}+\\frac{48 x^2}{5}-\\frac{11 x}{5}-\\frac{13}{5}$ when divided by $\\frac{27 x^5}{5}+\\frac{26 x^4}{5}-\\frac{16 x^3}{5}+\\frac{8 x^2}{5}+\\frac{8 x}{5}-6$.", + "Output Answer": [ + "$\\frac{14 x}{9}-\\frac{22}{243}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((42*x**6)/5)+((38*x**5)/5)+((19*x**4)/5)+((38*x**3)/5)+((48*x**2)/5)-((11*x)/5)-(13/5)\nq = ((27*x**5)/5)+((26*x**4)/5)-((16*x**3)/5)+((8*x**2)/5)+((8*x)/5)-6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 x^2-14 x-5$ and $q(x) = 12 x^2-12 x+9$", + "Output Answer": [ + "$36 x^4-204 x^3+135 x^2-66 x-45$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*x**2-14*x-5\nq = 12*x**2-12*x+9\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{49}{22}$, and $a_n=a_{n-1}+-\\frac{11}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$-\\frac{15911}{22}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (49/22) # initial value\nd = -(11/3) # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (49/22) # initial value\nd = -(11/3) # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x-2$ and $-2 x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x-2, -2*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (7 x-2)^3, q(x) = 9$", + "Output Answer": [ + "$343 x^3-294 x^2+84 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (7*x-2)**3\nq = 9\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\sqrt{2}\\right)^12$", + "Output Answer": [ + "$139314069504$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*math.sqrt(2))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{7 x^2}{5}-\\frac{71 x}{5}-\\frac{17}{5}$", + "Output Answer": [ + "$\\frac{913}{28}-\\frac{7}{5} \\left(x+\\frac{71}{14}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((7*x**2)/5)-((71*x)/5)-(17/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -4 x-23| =11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{17}{2}\\right\\},\\{x\\to -3\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-4*x-23), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{27 x^2}{5}-\\frac{18 x}{5}+\\frac{11}{5}$", + "Output Answer": [ + "$\\frac{14}{5}-\\frac{27}{5} \\left(x+\\frac{1}{3}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((27*x**2)/5)-((18*x)/5)+(11/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(6-i) \\log (2)$ and $y=(14+i) \\log (2)$", + "Output Answer": [ + "$(85-8 i) \\log ^2(2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (6-i)*math.log10(2)\ny = (14+i)*math.log10(2)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-10 x^6-5 x^5-7 x^4-7 x^3-10 x^2+3 x+8$ when divided by $-4$.", + "Output Answer": [ + "$\\frac{5 x^6}{2}+\\frac{5 x^5}{4}+\\frac{7 x^4}{4}+\\frac{7 x^3}{4}+\\frac{5 x^2}{2}-\\frac{3 x}{4}-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -10*x**6-5*x**5-7*x**4-7*x**3-10*x**2+3*x+8\nq = -4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{11}{6}$, and $a_n=a_{n-1}+-\\frac{23}{4}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$-\\frac{200}{3}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(11/6) # initial value\nd = -(23/4) # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(11/6) # initial value\nd = -(23/4) # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$12 \\sqrt{2} x+13 \\sqrt{2} y-3 \\sqrt{2} z-4 \\sqrt{2}=0$, $-5 \\sqrt{2} x+6 \\sqrt{2} y+5 \\sqrt{2} z-16 \\sqrt{2}=0$, $-4 \\sqrt{2} x+8 \\sqrt{2} y+7 \\sqrt{2} z+16 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{3160}{267}$, $y=\\frac{644}{89}$, $z=-\\frac{4624}{267}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((12*sqrt(2)*x+13*sqrt(2)*y-3*sqrt(2)*z-4*sqrt(2), -5*sqrt(2)*x+6*sqrt(2)*y+5*sqrt(2)*z-16*sqrt(2), -4*sqrt(2)*x+8*sqrt(2)*y+7*sqrt(2)*z+16*sqrt(2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-x^5+x^4+5 x^3-9 x^2+3 x+1$ when divided by $-5 x^5-10 x^4-2 x^3-4 x^2+2 x+2$.", + "Output Answer": [ + "$\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**5+x**4+5*x**3-9*x**2+3*x+1\nq = -5*x**5-10*x**4-2*x**3-4*x**2+2*x+2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{9 x^2+3 x+23}{\\sqrt{3}}$, $q(x) = -\\frac{7 x^2+22 x+16}{\\sqrt{3}}$", + "Output Answer": [ + "$3 \\sqrt{3} x^2-\\frac{7 x^2}{\\sqrt{3}}+\\sqrt{3} x-\\frac{22 x}{\\sqrt{3}}+\\frac{7}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((9*x**2+3*x+23)/(sqrt(3)))\nq = -((7*x**2+22*x+16)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{1}{9} ((19+21)-20)-24\\right)-((13+18)-2)$.", + "Output Answer": [ + "$-\\frac{457}{9}$" + ], + "Output Program": [ + "try: \n print(((1/9)*((19+21)-20)-24)-((13+18)-2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-12 x^3+264 x^2-732 x-7920$", + "Output Answer": [ + "$-12 (x-15) (x-11) (x+4)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-12*x**3+264*x**2-732*x-7920, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2-8 x+9$ and $q(x) = -2 x^2-3 x-5$", + "Output Answer": [ + "$28 x^4+58 x^3+76 x^2+13 x-45$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2-8*x+9\nq = -2*x**2-3*x-5\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2-341 x-\\frac{10395}{4}$", + "Output Answer": [ + "$-11 \\left(x+\\frac{27}{2}\\right) \\left(x+\\frac{35}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2-341*x-(10395/4), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{69}{98}$, and $a_n=a_{n-1}+-5$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$-\\frac{196939}{98}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (69/98) # initial value\nd = -5 # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (69/98) # initial value\nd = -5 # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2-108 \\sqrt{2} x+504$", + "Output Answer": [ + "$-9 \\left(x-2 \\sqrt{2}\\right) \\left(x+14 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2-108*sqrt(2)*x+504, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -11 \\sqrt{3} x-14 \\sqrt{3}\\right| =10 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{24}{11}\\right\\},\\left\\{x\\to -\\frac{4}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-11*sqrt(3)*x-14*sqrt(3)), 10*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{1}{41}$, and $a_n=a_{n-1}+-\\frac{64}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$-\\frac{78699}{41}$" + ], + "Output Program": [ + "a = (1/41) # initial value\nd = -(64/7) # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (1/41) # initial value\nd = -(64/7) # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -10 x^2+x-5$ and $q(x) = -6 x^2+x-11$", + "Output Answer": [ + "$60 x^4-16 x^3+141 x^2-16 x+55$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -10*x**2+x-5\nq = -6*x**2+x-11\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{11}{6}$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$\\frac{22243}{6}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (11/6) # initial value\nd = 9 # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (11/6) # initial value\nd = 9 # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{1}{10} ((19-4)+15)\\right) ((((11+2)-2)-8)-10)$.", + "Output Answer": [ + "$-21$" + ], + "Output Program": [ + "try: \n print(((1/10)*((19-4)+15))*((((11+2)-2)-8)-10))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{6+24 i}{e}$.", + "Output Answer": [ + "Norm: $\\frac{6 \\sqrt{17}}{e}$\nArgument: $\\tan ^{-1}(4)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((6+24*i)/math.e)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{15 x^2}{e}-\\frac{16 x}{e}-\\frac{23}{e}$ and $q(x) = \\frac{x^2}{e}+\\frac{8 x}{e}+\\frac{33}{e}$", + "Output Answer": [ + "$-\\frac{15 x^4}{e^2}-\\frac{136 x^3}{e^2}-\\frac{646 x^2}{e^2}-\\frac{712 x}{e^2}-\\frac{759}{e^2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -((15*x**2)/math.e)-((16*x)/math.e)-(23/math.e)\nq = ((x**2)/math.e)+((8*x)/math.e)+(33/math.e)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(25-12)-(((8-9)+9)-6)$.", + "Output Answer": [ + "$11$" + ], + "Output Program": [ + "try: \n print((25-12)-(((8-9)+9)-6))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $13 x-x^2$", + "Output Answer": [ + "$\\frac{169}{4}-\\left(x-\\frac{13}{2}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (13*x-x**2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{332 x^3}{7}+\\frac{11582 x^2}{49}-\\frac{10588 x}{49}-\\frac{10608}{49}}{\\frac{6806 x}{49}+\\frac{4264}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{28} \\left(-61-\\sqrt{9433}\\right)\\right\\},\\left\\{x\\to \\frac{1}{28} \\left(-61+\\sqrt{9433}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((332*x**3)/7)+((11582*x**2)/49)-((10588*x)/49)-(10608/49))/(((6806*x)/49)+(4264/49))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-5 x^2+6 y^2-3 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y-\\frac{1}{4}\\right)^2-5 x^2=\\frac{19}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n 0 & \\frac{1}{60} \\left(15-\\sqrt{3135}\\right) \\\\\n 0 & \\frac{1}{60} \\left(15+\\sqrt{3135}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{11}{5}}$\nCenter: $\\left\\{0,\\frac{1}{2} \\left(\\frac{1}{60} \\left(15-\\sqrt{3135}\\right)+\\frac{1}{60} \\left(15+\\sqrt{3135}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{4}-\\sqrt{\\frac{5}{6}} x,y=\\sqrt{\\frac{5}{6}} x+\\frac{1}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-5*x**2+6*y**2-3*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-x^2+\\frac{25 x}{7}+\\frac{85}{7}$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(25-\\sqrt{3005}\\right)\\lor x=\\frac{1}{14} \\left(25+\\sqrt{3005}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-x**2+((25*x)/7)+(85/7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2-8 x+9 y^2+8 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x-\\frac{2}{5}\\right)^2+9 \\left(y+\\frac{4}{9}\\right)^2=\\frac{557}{45}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{2}{5} & \\frac{1}{90} \\left(-40-\\sqrt{1114}\\right) \\\\\n \\frac{2}{5} & \\frac{1}{90} \\left(\\sqrt{1114}-40\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{10}}$\nCenter: $\\left\\{\\frac{2}{5},\\frac{1}{2} \\left(\\frac{1}{90} \\left(-40-\\sqrt{1114}\\right)+\\frac{1}{90} \\left(\\sqrt{1114}-40\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{557 \\pi }{135 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2-8*x+9*y**2+8*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{456 x^2-522 x+102}{187-209 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((456*x**2-522*x+102)/(187-209*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\frac{\\sin (\\cos (5 x+3))}{(-7 x-7)^3}$", + "Output Answer": [ + "$x<-1\\lor x>-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = ((sin(cos(5*x+3)))/((-7*x-7)**3))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x$ and $-2 x^4+4 x^3+x^2+3 x+1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x, -2*x**4+4*x**3+x**2+3*x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^2+8 x-5$ when divided by $6 x-8 x^2$.", + "Output Answer": [ + "$-\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**2+8*x-5\nq = 6*x-8*x**2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-y^2+6 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $-(y-3)^2=-6 x^2$\nFoci: $\\left(\\fbox{$\n\\begin{array}{cc}\n \\text{[$\\blacksquare$]} & \\text{HyperbolaProperties} \\\\\n\\end{array}\n$}\\left(-(y-3)^2=-6 x^2,\\{x,y\\}\\right)\\right)(\\text{Foci})$\nEccentricity: $\\left(\\fbox{$\n\\begin{array}{cc}\n \\text{[$\\blacksquare$]} & \\text{HyperbolaProperties} \\\\\n\\end{array}\n$}\\left(-(y-3)^2=-6 x^2,\\{x,y\\}\\right)\\right)(\\text{Eccentricity})$\nCenter: $\\left(\\fbox{$\n\\begin{array}{cc}\n \\text{[$\\blacksquare$]} & \\text{HyperbolaProperties} \\\\\n\\end{array}\n$}\\left(-(y-3)^2=-6 x^2,\\{x,y\\}\\right)\\right)(\\text{Center})$\nAsymptotes: $\\left(\\fbox{$\n\\begin{array}{cc}\n \\text{[$\\blacksquare$]} & \\text{HyperbolaProperties} \\\\\n\\end{array}\n$}\\left(-(y-3)^2=-6 x^2,\\{x,y\\}\\right)\\right)(\\text{Asymptotes})$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-y**2+6*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = x^2-x+2$ and $q(x) = -11 x^2+7 x-11$", + "Output Answer": [ + "$-11 x^4+18 x^3-40 x^2+25 x-22$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = x**2-x+2\nq = -11*x**2+7*x-11\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((8-12)-3)+(16-1)$.", + "Output Answer": [ + "$8$" + ], + "Output Program": [ + "try: \n print(((8-12)-3)+(16-1))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-4+9 i) \\log (2)$ and $y=(3-12 i) \\log (2)$", + "Output Answer": [ + "$(-7+21 i) \\log (2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-4+9*i)*math.log10(2)\ny = (3-12*i)*math.log10(2)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{5 x^2}{\\sqrt{3}}-\\frac{16 x}{\\sqrt{3}}+\\frac{10}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{5} \\left(8-\\sqrt{14}\\right)\\lor x=\\frac{1}{5} \\left(8+\\sqrt{14}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((5*x**2)/(sqrt(3)))-((16*x)/(sqrt(3)))+(10/(sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $10 x^6-9 x^5+8 x^4-9 x^3+5 x^2+7 x+8$ when divided by $10 x^2+4$.", + "Output Answer": [ + "$x^4-\\frac{9 x^3}{10}+\\frac{2 x^2}{5}-\\frac{27 x}{50}+\\frac{17}{50}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x**6-9*x**5+8*x**4-9*x**3+5*x**2+7*x+8\nq = 10*x**2+4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{14 \\sqrt{2} x^2+4 \\sqrt{2} x-2 \\sqrt{2}}{5 \\sqrt{2} x+12 \\sqrt{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(-1-2 \\sqrt{2}\\right)\\right\\},\\left\\{x\\to \\frac{1}{7} \\left(-1+2 \\sqrt{2}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((14*sqrt(2)*x**2+4*sqrt(2)*x-2*sqrt(2))/(5*sqrt(2)*x+12*sqrt(2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\log (8 x+4)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(e^y-4\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, log(8*x+4))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left((4+4)^2-7\\right)-9\\right)+\\frac{3+16}{2}$.", + "Output Answer": [ + "$\\frac{115}{2}$" + ], + "Output Program": [ + "try: \n print((((4+4)**2-7)-9)+((3+16)/2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{35}{4} \\left(-\\cos \\left(\\frac{7 \\pi }{30}\\right)+i \\sin \\left(\\frac{7 \\pi }{30}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$\\frac{1500625}{256} \\left(-\\cos \\left(\\frac{\\pi }{15}\\right)-i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(35/4)*(-math.cos(((7*math.pi)/30))+1j*math.sin(((7*math.pi)/30))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{1}{(x-8)^5}+\\log (3-8 x)$ at the point $x=-3$", + "Output Answer": [ + "$-\\frac{1}{161051}+\\log (27) = 3.296$" + ], + "Output Program": [ + "import math\n\nx = -3\ntry: \n f = (1/((x-8)**5))+math.log(3-8*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x-4}+\\sqrt{8 x-10}=\\frac{25}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{196} \\left(5793-200 \\sqrt{274}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x-4)+sqrt(8*x-10), (25/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $8 x^2-32 \\sqrt{2} x-512$", + "Output Answer": [ + "$8 \\left(-x-4 \\sqrt{2}\\right) \\left(8 \\sqrt{2}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(8*x**2-32*sqrt(2)*x-512, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $3 e^{-\\frac{91 i \\pi }{180}} \\log (2)$.", + "Output Answer": [ + "Norm: $3 \\log (2)$\nArgument: $-\\frac{91 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 3*math.e**(-((91*i*math.pi)/180))*math.log(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2-36 x+288$", + "Output Answer": [ + "$-9 (x-4) (x+8)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2-36*x+288, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{85}+\\sqrt{81}\\right)+\\left(\\sqrt{132}-16\\right)$.", + "Output Answer": [ + "$-7+2 \\sqrt{33}+\\sqrt{85}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(85)+sqrt(81))+(sqrt(132)-16))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = x^2-8 x-14$ and $q(x) = 3 x^2+x-6$", + "Output Answer": [ + "$3 x^4-23 x^3-56 x^2+34 x+84$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = x**2-8*x-14\nq = 3*x**2+x-6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $4 x^2-4 x$", + "Output Answer": [ + "$x=0\\lor x=1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(4*x**2-4*x, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{3}, \\sqrt{3}, 7)$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{469}}{3},\\tan ^{-1}\\left(\\frac{2}{3 \\sqrt{7}}\\right),\\tan ^{-1}\\left(3 \\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/3)\ny = math.sqrt(3)\nz = 7\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-9 \\sqrt{3} x^2-5 \\sqrt{3} x-8 \\sqrt{3}$", + "Output Answer": [ + "$-9 \\sqrt{3} \\left(x+\\frac{5}{18}\\right)^2-8 \\sqrt{3}+\\frac{25}{12 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-9*math.sqrt(3)*x**2-5*math.sqrt(3)*x-8*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(-4-2 i) \\sqrt{5}$ and $y=(3+3 i) \\sqrt{5}$", + "Output Answer": [ + "$(-1+i) \\sqrt{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-4-2*i)*math.sqrt(5)\ny = (3+3*i)*math.sqrt(5)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -11.876 x^2-13.794 x-6.436$, $q(x) = 8.453 x^2-12.29 x+5.589$", + "Output Answer": [ + "$-3.423 x^2-26.084 x-0.847$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -11.876*x**2-13.794*x-6.436\nq = 8.453*x**2-12.29*x+5.589\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 x^2-10 x-4$", + "Output Answer": [ + "$\\frac{17}{2}-2 \\left(x+\\frac{5}{2}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*x**2-10*x-4), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $5 \\sqrt{5} x^2-2 \\sqrt{5} x+6 \\sqrt{5}$", + "Output Answer": [ + "$x=\\frac{1}{5} \\left(1-i \\sqrt{29}\\right)\\lor x=\\frac{1}{5} \\left(1+i \\sqrt{29}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(5*sqrt(5)*x**2-2*sqrt(5)*x+6*sqrt(5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((8-15)+3)+17) \\left(\\frac{1}{12} ((18-9)-25)+18\\right)$.", + "Output Answer": [ + "$\\frac{650}{3}$" + ], + "Output Program": [ + "try: \n print((((8-15)+3)+17)*((1/12)*((18-9)-25)+18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{13 x}{2}-\\frac{43}{4}}+\\sqrt{\\frac{37 x}{4}+\\frac{1}{4}}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{4}{121} \\left(8951-60 \\sqrt{21453}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((13*x)/2)-(43/4))+sqrt(((37*x)/4)+(1/4)), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 x^2-10$ and $q(x) = 6 x^2-11 x+8$", + "Output Answer": [ + "$12 x^4-22 x^3-44 x^2+110 x-80$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*x**2-10\nq = 6*x**2-11*x+8\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $(3 x+7)^4 \\sqrt[3]{6 x^5-4}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{3}\\right\\},\\left\\{x\\to \\sqrt[5]{\\frac{2}{3}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve((3*x+7)**4*cbrt(6*x**5-4), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{83}{95}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$\\frac{581}{95}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (83/95) # initial value\nd = 0 # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (83/95) # initial value\nd = 0 # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x+11}+\\sqrt{7 x+11}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 8 \\left(22-3 \\sqrt{51}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x+11)+sqrt(7*x+11), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{255 x^2+51 x-306}{-195 x-234}=0$", + "Output Answer": [ + "$\\{\\{x\\to 1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((255*x**2+51*x-306)/(-195*x-234)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{x^2+19 x-23}{-6 x^2-16 x-6}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-19-\\sqrt{453}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(-19+\\sqrt{453}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((x**2+19*x-23)/(-6*x**2-16*x-6)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $2 \\sqrt{x}+\\sqrt{9 x+3}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{25} \\left(-14+\\sqrt{426}\\right)^2\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(2*sqrt(x)+sqrt(9*x+3), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{34}{7}+\\frac{27 i}{7}$ and $y=-\\frac{37}{7}-7 i$", + "Output Answer": [ + "$-\\frac{1}{58}-\\frac{41 i}{58}$" + ], + "Output Program": [ + "i = 1j\nx = -(34/7)+((27*i)/7)\ny = -(37/7)-7*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{33}{35}$, and $a_n=a_{n-1}+-\\frac{21}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=17$.", + "Output Answer": [ + "$\\frac{17}{2} \\left(\\frac{66}{35}-\\frac{336}{\\sqrt{5}}\\right)$" + ], + "Output Program": [ + "import math\n\na = (33/35) # initial value\nd = -(21/(math.sqrt(5))) # second term\nn = 17 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (33/35) # initial value\nd = -(21/(math.sqrt(5))) # second term\nn = 17 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{97}{70}$, and $a_n=a_{n-1}+-\\frac{19}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$-\\frac{218647}{70}$" + ], + "Output Program": [ + "a = -(97/70) # initial value\nd = -(19/2) # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(97/70) # initial value\nd = -(19/2) # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2-10 x+8 y^2+10 y+9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y+\\frac{5}{8}\\right)^2-9 \\left(x+\\frac{5}{9}\\right)^2=-\\frac{623}{72}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{9}-\\frac{\\sqrt{10591}}{72} & -\\frac{5}{8} \\\\\n \\frac{1}{72} \\left(\\sqrt{10591}-40\\right) & -\\frac{5}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{17}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{5}{9}-\\frac{\\sqrt{10591}}{72}+\\frac{1}{72} \\left(\\sqrt{10591}-40\\right)\\right),-\\frac{5}{8}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3 x}{2 \\sqrt{2}}+\\frac{5}{24} \\left(2 \\sqrt{2}-3\\right),y=-\\frac{3 x}{2 \\sqrt{2}}-\\frac{5}{24} \\left(3+2 \\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2-10*x+8*y**2+10*y+9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the seventh order series of the inverse of the following function around 7:\n$\\sin ^{-1}(x)$", + "Output Answer": [ + "$-\\frac{x^7}{5040}+\\frac{x^5}{120}-\\frac{x^3}{6}+x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, asin(x))\nprint(solve(f, x)[0].series(y, 7, 6))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{69 x^2}{7}-\\frac{11 x}{7}+\\frac{27}{7}$", + "Output Answer": [ + "$x=\\frac{1}{138} \\left(11-i \\sqrt{7331}\\right)\\lor x=\\frac{1}{138} \\left(11+i \\sqrt{7331}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((69*x**2)/7)-((11*x)/7)+(27/7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{14 x^2}{\\sqrt{3}}-\\frac{10 x}{\\sqrt{3}}+6 \\sqrt{3}$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(\\sqrt{277}-5\\right)\\lor x=\\frac{1}{14} \\left(-5-\\sqrt{277}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((14*x**2)/(sqrt(3)))-((10*x)/(sqrt(3)))+6*sqrt(3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (4 x+7)^4, q(x) = 8 x$", + "Output Answer": [ + "$256 x^4+1792 x^3+4704 x^2+5496 x+2401$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (4*x+7)**4\nq = 8*x\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^5+6 x^4+4 x^3-5 x^2-5 x+8$ when divided by $-10$.", + "Output Answer": [ + "$\\frac{9 x^5}{10}-\\frac{3 x^4}{5}-\\frac{2 x^3}{5}+\\frac{x^2}{2}+\\frac{x}{2}-\\frac{4}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**5+6*x**4+4*x**3-5*x**2-5*x+8\nq = -10\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((5+17)-4)+((7-20)-17)$.", + "Output Answer": [ + "$-12$" + ], + "Output Program": [ + "try: \n print(((5+17)-4)+((7-20)-17))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{-8 x^2-15 x-16}{\\sqrt{\\pi }}$, $q(x) = \\frac{2 x^2+19 x+19}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{6 x^2}{\\sqrt{\\pi }}+\\frac{4 x}{\\sqrt{\\pi }}+\\frac{3}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((-8*x**2-15*x-16)/(sqrt(pi)))\nq = ((2*x**2+19*x+19)/(sqrt(pi)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-3 x^6+x^5+6 x^4+4 x^3-5 x^2-4 x+3$ when divided by $8 x+3$.", + "Output Answer": [ + "$-\\frac{3 x^5}{8}+\\frac{17 x^4}{64}+\\frac{333 x^3}{512}+\\frac{1049 x^2}{4096}-\\frac{23627 x}{32768}-\\frac{60191}{262144}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x**6+x**5+6*x**4+4*x**3-5*x**2-4*x+3\nq = 8*x+3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (5-3 x)^2, q(x) = 4 x-7$", + "Output Answer": [ + "$9 x^2-26 x+18$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (5-3*x)**2\nq = 4*x-7\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x-12}+\\sqrt{6 x+4}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 875-18 \\sqrt{2338}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x-12)+sqrt(6*x+4), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{160}+\\left(\\sqrt{111}+\\sqrt{13}\\right)$.", + "Output Answer": [ + "$4 \\sqrt{10}+\\sqrt{13}+\\sqrt{111}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(160)+(sqrt(111)+sqrt(13)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^3-8 x^2-8 x+8$ and $2-3 x$.", + "Output Answer": [ + "$3 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**3-8*x**2-8*x+8, 2-3*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-12 \\sqrt{3} x-3 \\sqrt{3} y-\\frac{14 z}{\\sqrt{3}}+12 \\sqrt{3}=0$, $-\\frac{16 x}{\\sqrt{3}}-\\frac{y}{\\sqrt{3}}+\\frac{z}{\\sqrt{3}}+\\frac{26}{\\sqrt{3}}=0$, $\\frac{4 x}{\\sqrt{3}}+\\frac{37 y}{\\sqrt{3}}-14 \\sqrt{3} z+4 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{1462}{879}$, $y=-\\frac{1240}{879}$, $z=-\\frac{234}{293}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-12*sqrt(3)*x-3*sqrt(3)*y-((14*z)/(sqrt(3)))+12*sqrt(3), -((16*x)/(sqrt(3)))-(y/(sqrt(3)))+(z/(sqrt(3)))+(26/(sqrt(3))), ((4*x)/(sqrt(3)))+((37*y)/(sqrt(3)))-14*sqrt(3)*z+4*sqrt(3))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -7 x^2-10 x+9$ and $q(x) = x^2+4 x+10$", + "Output Answer": [ + "$-7 x^4-38 x^3-101 x^2-64 x+90$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -7*x**2-10*x+9\nq = x**2+4*x+10\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$2 \\sqrt{5} x+3 \\sqrt{5} y-9 \\sqrt{5} z-9 \\sqrt{5}=0$, $-3 \\sqrt{5} x+10 \\sqrt{5} y-2 \\sqrt{5} z-4 \\sqrt{5}=0$, $-6 \\sqrt{5} x-11 \\sqrt{5} z-5 \\sqrt{5}=0$", + "Output Answer": [ + "$x=\\frac{438}{823}$, $y=\\frac{338}{823}$, $z=-\\frac{613}{823}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((2*sqrt(5)*x+3*sqrt(5)*y-9*sqrt(5)*z-9*sqrt(5), -3*sqrt(5)*x+10*sqrt(5)*y-2*sqrt(5)*z-4*sqrt(5), -6*sqrt(5)*x-11*sqrt(5)*z-5*sqrt(5))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(\\cos \\left(\\frac{76}{45}\\right)+i \\sin \\left(\\frac{76}{45}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$2401 \\left(\\cos \\left(\\frac{304}{45}\\right)+i \\sin \\left(\\frac{304}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(math.cos((76/45))+1j*math.sin((76/45))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{((1-2)-13)^2}{19-6}$.", + "Output Answer": [ + "$\\frac{196}{13}$" + ], + "Output Program": [ + "try: \n print(((((1-2)-13)**2)/(19-6)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2+5 x+8 y^2+6 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y+\\frac{3}{8}\\right)^2-8 \\left(x-\\frac{5}{16}\\right)^2=-\\frac{245}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{16} \\left(5-7 \\sqrt{10}\\right) & -\\frac{3}{8} \\\\\n \\frac{1}{16} \\left(5+7 \\sqrt{10}\\right) & -\\frac{3}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{16} \\left(5-7 \\sqrt{10}\\right)+\\frac{1}{16} \\left(5+7 \\sqrt{10}\\right)\\right),-\\frac{3}{8}\\right\\}$\nAsymptotes: $\\left\\{y=x-\\frac{11}{16},y=-x-\\frac{1}{16}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2+5*x+8*y**2+6*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 5 x^2-10 x-2$, $q(x) = -10 x^2+4 x+11$", + "Output Answer": [ + "$-5 x^2-6 x+9$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**2-10*x-2\nq = -10*x**2+4*x+11\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((22-18)-4)+9)+(((6-9)+10)-18)$.", + "Output Answer": [ + "$-2$" + ], + "Output Program": [ + "try: \n print((((22-18)-4)+9)+(((6-9)+10)-18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 10 x^2+9 x-3$ and $q(x) = 3 x^2-10 x-13$", + "Output Answer": [ + "$30 x^4-73 x^3-229 x^2-87 x+39$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 10*x**2+9*x-3\nq = 3*x**2-10*x-13\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{150}+\\sqrt{156}$.", + "Output Answer": [ + "$5 \\sqrt{6}+2 \\sqrt{39}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(150)+sqrt(156))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(-\\sin \\left(\\frac{19 \\pi }{90}\\right)+i \\cos \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$177147 \\left(\\cos \\left(\\frac{8 \\pi }{45}\\right)-i \\sin \\left(\\frac{8 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(-math.sin(((19*math.pi)/90))+1j*math.cos(((19*math.pi)/90))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{11}{3} \\left(\\cos \\left(\\frac{161}{90}\\right)+i \\sin \\left(\\frac{161}{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$\\frac{285311670611 \\left(\\cos \\left(\\frac{1771}{90}\\right)+i \\sin \\left(\\frac{1771}{90}\\right)\\right)}{177147}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((11/3)*(math.cos((161/90))+1j*math.sin((161/90))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9-6 x}+\\sqrt{11-3 x}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-302+20 \\sqrt{213}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9-6*x)+sqrt(11-3*x), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2+9 x+18$", + "Output Answer": [ + "$-9 (-x-1) (2-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2+9*x+18, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\sqrt{2}$ and $y=(-4+3 i) \\sqrt{2}$", + "Output Answer": [ + "$-\\frac{4}{25}-\\frac{3 i}{25}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = math.sqrt(2)\ny = (-4+3*i)*math.sqrt(2)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-12 x^2+6 x-5$", + "Output Answer": [ + "$x=\\frac{1}{12} \\left(3-i \\sqrt{51}\\right)\\lor x=\\frac{1}{12} \\left(3+i \\sqrt{51}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-12*x**2+6*x-5, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$3 x-4 y-23=0$, $9 x-24 y-10=0$", + "Output Answer": [ + "$x=\\frac{128}{9}$, $y=\\frac{59}{12}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((3*x-4*y-23, 9*x-24*y-10), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2-8 x-10 y^2+6 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(x-\\frac{2}{5}\\right)^2-10 \\left(y-\\frac{3}{10}\\right)^2=-\\frac{43}{10}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{2}{5} & \\frac{1}{10} \\left(3-\\sqrt{86}\\right) \\\\\n \\frac{2}{5} & \\frac{1}{10} \\left(3+\\sqrt{86}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{2}{5},\\frac{1}{2} \\left(\\frac{1}{10} \\left(3-\\sqrt{86}\\right)+\\frac{1}{10} \\left(3+\\sqrt{86}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{7}{10}-x,y=x-\\frac{1}{10}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2-8*x-10*y**2+6*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{13+9 i}{\\sqrt{2}}$ and $y=-\\frac{13+13 i}{\\sqrt{2}}$", + "Output Answer": [ + "$2 i \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((13+9*i)/(math.sqrt(2)))\ny = -((13+13*i)/(math.sqrt(2)))\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{4}{2}-(5+20)$.", + "Output Answer": [ + "$-23$" + ], + "Output Program": [ + "try: \n print((4/2)-(5+20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{5 \\left(-\\sin \\left(\\frac{43 \\pi }{180}\\right)+i \\cos \\left(\\frac{43 \\pi }{180}\\right)\\right)}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $5 \\sqrt{\\frac{1}{3} \\left(\\sin ^2\\left(\\frac{43 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{43 \\pi }{180}\\right)\\right)}$\nArgument: $\\frac{133 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((5*(-math.sin(((43*math.pi)/180))+i*math.cos(((43*math.pi)/180))))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=4 i$ and $y=-10+4 i$", + "Output Answer": [ + "$-10+8 i$" + ], + "Output Program": [ + "i = 1j\nx = 4*i\ny = -10+4*i\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{1}{7}$, and $a_n=a_{n-1}+5 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=17$.", + "Output Answer": [ + "$\\frac{17}{2} \\left(80 \\sqrt{3}-\\frac{2}{7}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(1/7) # initial value\nd = 5*math.sqrt(3) # second term\nn = 17 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(1/7) # initial value\nd = 5*math.sqrt(3) # second term\nn = 17 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(8 \\left(\\cos \\left(\\frac{29}{15}\\right)+i \\sin \\left(\\frac{29}{15}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1073741824 \\left(\\cos \\left(\\frac{58}{3}\\right)+i \\sin \\left(\\frac{58}{3}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((8*(math.cos((29/15))+1j*math.sin((29/15))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $3 \\sqrt{5} e^{\\frac{139 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $3 \\sqrt{5}$\nArgument: $\\frac{139 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 3*math.sqrt(5)*math.e**((139*i*math.pi)/180)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{19 x^2}{\\sqrt{3}}+\\frac{14 x}{\\sqrt{3}}+\\frac{5}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{48 \\sqrt{3}}{19}-\\frac{19 \\left(x-\\frac{7}{19}\\right)^2}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((19*x**2)/(math.sqrt(3)))+((14*x)/(math.sqrt(3)))+(5/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{15 x}{\\sqrt{2}}+\\frac{25 y}{\\sqrt{2}}+\\frac{3 z}{\\sqrt{2}}+2 \\sqrt{2}=0$, $9 \\sqrt{2} x+14 \\sqrt{2} y+13 \\sqrt{2} z+3 \\sqrt{2}=0$, $-\\frac{17 x}{\\sqrt{2}}-\\frac{17 y}{\\sqrt{2}}+\\frac{11 z}{\\sqrt{2}}+\\frac{33}{\\sqrt{2}}=0$", + "Output Answer": [ + "$x=\\frac{9861}{2120}$, $y=-\\frac{772}{265}$, $z=-\\frac{133}{424}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((15*x)/(sqrt(2)))+((25*y)/(sqrt(2)))+((3*z)/(sqrt(2)))+2*sqrt(2), 9*sqrt(2)*x+14*sqrt(2)*y+13*sqrt(2)*z+3*sqrt(2), -((17*x)/(sqrt(2)))-((17*y)/(sqrt(2)))+((11*z)/(sqrt(2)))+(33/(sqrt(2))))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^5-8 x^4-x^3+10 x^2+9 x-4$ when divided by $-8 x^2-7 x+3$.", + "Output Answer": [ + "$\\frac{9 x^3}{8}+\\frac{x^2}{64}+\\frac{273 x}{512}-\\frac{7007}{4096}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**5-8*x**4-x**3+10*x**2+9*x-4\nq = -8*x**2-7*x+3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^6-3 x^5+x^4+6 x^3-8 x^2-4$ when divided by $9 x-3$.", + "Output Answer": [ + "$-\\frac{2 x^5}{9}-\\frac{11 x^4}{27}-\\frac{2 x^3}{81}+\\frac{160 x^2}{243}-\\frac{488 x}{729}-\\frac{488}{2187}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**6-3*x**5+x**4+6*x**3-8*x**2-4\nq = 9*x-3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2-198 x-\\frac{11349}{25}$", + "Output Answer": [ + "$9 \\left(-x-\\frac{97}{5}\\right) \\left(x+\\frac{13}{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2-198*x-(11349/25), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=675 (9-4 t)^4, x(t)=48 t^2-216 t+243$", + "Output Answer": [ + "$y=75 x^2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 675*(9-4*t)**4\nx_t = 48*t**2-216*t+243\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^6+3 x^5+2 x^4-x^3+3 x^2+2 x-5$ when divided by $x^2-4 x+7$.", + "Output Answer": [ + "$7 x^4+31 x^3+77 x^2+90 x-176$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**6+3*x**5+2*x**4-x**3+3*x**2+2*x-5\nq = x**2-4*x+7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-7 x^2-217 x-1680$", + "Output Answer": [ + "$-7 (-x-16) (-x-15)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-7*x**2-217*x-1680, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{22 x^2}{5}-\\frac{2 x}{5}+4$ and $-\\frac{9 x^5}{5}+4 x^4+5 x^3-\\frac{23 x^2}{5}+2 x-\\frac{7}{5}$.", + "Output Answer": [ + "$\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((22*x**2)/5)-((2*x)/5)+4, -((9*x**5)/5)+4*x**4+5*x**3-((23*x**2)/5)+2*x-(7/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = x^2+12 x+14$ and $q(x) = 12 x^2+14 x-13$", + "Output Answer": [ + "$12 x^4+158 x^3+323 x^2+40 x-182$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = x**2+12*x+14\nq = 12*x**2+14*x-13\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x+10}+\\sqrt{12 x+14}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(584-12 \\sqrt{2510}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x+10)+sqrt(12*x+14), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2-\\frac{71 x}{2}-\\frac{35}{4}$", + "Output Answer": [ + "$2 \\left(-x-\\frac{1}{4}\\right) \\left(x+\\frac{35}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2-((71*x)/2)-(35/4), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{70 x^2}{3}-\\frac{70}{3}}{-28 x-28}=0$", + "Output Answer": [ + "$\\{\\{x\\to 1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((70*x**2)/3)-(70/3))/(-28*x-28)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(-\\cos \\left(\\frac{\\pi }{9}\\right)+i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$177147 \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(-math.cos((math.pi/9))+1j*math.sin((math.pi/9))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-4 x^2+28 \\sqrt{3} x-120$", + "Output Answer": [ + "$-4 \\left(x-5 \\sqrt{3}\\right) \\left(x-2 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-4*x**2+28*sqrt(3)*x-120, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 5-x, q(x) = 9 (1-2 x)^2$", + "Output Answer": [ + "$36 x^2-37 x+14$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5-x\nq = 9*(1-2*x)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(18+16) ((((21+25)+2)-12)+1)$.", + "Output Answer": [ + "$1258$" + ], + "Output Program": [ + "try: \n print((18+16)*((((21+25)+2)-12)+1))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\sqrt{2} \\left(108 t^2-792 t+1451\\right), x(t)=18 t^2-132 t+242$", + "Output Answer": [ + "$y=6 \\sqrt{2} x-\\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = sqrt(2)*(108*t**2-792*t+1451)\nx_t = 18*t**2-132*t+242\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{4 x}{\\sqrt{3}}+\\frac{7}{\\sqrt{3}}\\right| =\\frac{28}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{35}{4}\\right\\},\\left\\{x\\to \\frac{21}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((4*x)/(sqrt(3)))+(7/(sqrt(3)))), (28/(sqrt(3)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 6 x^2-7 x+2$ and $q(x) = 5 x^2+4 x-4$", + "Output Answer": [ + "$30 x^4-11 x^3-42 x^2+36 x-8$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 6*x**2-7*x+2\nq = 5*x**2+4*x-4\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((3-9)-14) ((((14-22)+15)+15)+18)$.", + "Output Answer": [ + "$-800$" + ], + "Output Program": [ + "try: \n print(((3-9)-14)*((((14-22)+15)+15)+18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{5 x^2}{2}+\\frac{25 x}{2}+\\frac{25}{2}$", + "Output Answer": [ + "$\\frac{5}{2} \\left(x+\\frac{5}{2}\\right)^2-\\frac{25}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((5*x**2)/2)+((25*x)/2)+(25/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{71 x}{7}-\\frac{104}{7}}+\\sqrt{\\frac{101 x}{7}+\\frac{36}{7}}=\\frac{60}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{21} \\left(1966-4 \\sqrt{230730}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((71*x)/7)-(104/7))+sqrt(((101*x)/7)+(36/7)), (60/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x-9$ when divided by $-1$.", + "Output Answer": [ + "$5 x+9$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x-9\nq = -1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-9 \\sqrt{2} x^2+9 \\sqrt{2} x+5 \\sqrt{2}$", + "Output Answer": [ + "$-9 \\sqrt{2} \\left(x-\\frac{1}{2}\\right)^2+5 \\sqrt{2}+\\frac{9}{2 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-9*math.sqrt(2)*x**2+9*math.sqrt(2)*x+5*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-6 x^2+8 x-2$", + "Output Answer": [ + "$\\frac{2}{3}-6 \\left(x-\\frac{2}{3}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-6*x**2+8*x-2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-5 \\sqrt{2} x^2-6 \\sqrt{2} x-\\sqrt{2}$", + "Output Answer": [ + "$\\frac{4 \\sqrt{2}}{5}-5 \\sqrt{2} \\left(x+\\frac{3}{5}\\right)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-5*math.sqrt(2)*x**2-6*math.sqrt(2)*x-math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{21 x}{2}-\\frac{17}{2}}+\\sqrt{\\frac{27}{2}-\\frac{3 x}{2}}=\\frac{25}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{108} \\left(-2764+25 \\sqrt{6847}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((21*x)/2)-(17/2))+sqrt((27/2)-((3*x)/2)), (25/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(4+3 i) \\sqrt{3}$ and $y=(-2+2 i) \\sqrt{3}$", + "Output Answer": [ + "$-42+6 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (4+3*i)*math.sqrt(3)\ny = (-2+2*i)*math.sqrt(3)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-2 \\sqrt{5} \\left(-\\cos \\left(\\frac{2 \\pi }{45}\\right)+i \\sin \\left(\\frac{2 \\pi }{45}\\right)\\right)$.", + "Output Answer": [ + "Norm: $2 \\sqrt{5 \\left(\\sin ^2\\left(\\frac{2 \\pi }{45}\\right)+\\cos ^2\\left(\\frac{2 \\pi }{45}\\right)\\right)}$\nArgument: $-\\frac{2 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -2*math.sqrt(5)*(-math.cos(((2*math.pi)/45))+i*math.sin(((2*math.pi)/45)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-13 x-4}+\\sqrt{-9 x-5}=2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-21+4 \\sqrt{22}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-13*x-4)+sqrt(-9*x-5), 2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{16 e^{\\frac{119 i \\pi }{180}}}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\frac{16}{\\sqrt{3}}$\nArgument: $-\\frac{61 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((16*math.e**((119*i*math.pi)/180))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{36}{85}$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$\\frac{117693}{85}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (36/85) # initial value\nd = 9 # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (36/85) # initial value\nd = 9 # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{32 x}{3}-\\frac{4}{3}}+\\sqrt{5-8 x}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-640+99 \\sqrt{41}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((32*x)/3)-(4/3))+sqrt(5-8*x), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\sqrt{3} \\left(-\\cos \\left(\\frac{\\pi }{90}\\right)-i \\sin \\left(\\frac{\\pi }{90}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$3 \\sqrt{3} \\left(-\\cos \\left(\\frac{\\pi }{30}\\right)-i \\sin \\left(\\frac{\\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.sqrt(3)*(-math.cos((math.pi/90))-1j*math.sin((math.pi/90))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{14}{43}$, and $a_n=a_{n-1}+2 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$\\frac{5}{2} \\left(8 \\pi -\\frac{28}{43}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(14/43) # initial value\nd = 2*math.pi # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(14/43) # initial value\nd = 2*math.pi # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(\\cos \\left(\\frac{7}{90}\\right)+i \\sin \\left(\\frac{7}{90}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$256 \\left(\\cos \\left(\\frac{14}{45}\\right)+i \\sin \\left(\\frac{14}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(math.cos((7/90))+1j*math.sin((7/90))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\pi x^2-2 \\pi x+4 \\pi$ and $q(x) = 5 \\pi x^2+4 \\pi x+3 \\pi$", + "Output Answer": [ + "$-5 \\pi ^2 x^4-14 \\pi ^2 x^3+9 \\pi ^2 x^2+10 \\pi ^2 x+12 \\pi ^2$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -pi*x**2-2*pi*x+4*pi\nq = 5*pi*x**2+4*pi*x+3*pi\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{19 x}{3}-\\frac{20 y}{3}-\\frac{41}{3}=0$, $-x-\\frac{28 y}{3}+\\frac{32}{3}=0$", + "Output Answer": [ + "$x=\\frac{447}{148}$, $y=\\frac{485}{592}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((19*x)/3)-((20*y)/3)-(41/3), -x-((28*y)/3)+(32/3)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x+1$ and $-4 x^3-x^2-4 x+2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x+1, -4*x**3-x**2-4*x+2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x-1$ when divided by $-3 x$.", + "Output Answer": [ + "$-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x-1\nq = -3*x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{11}{19}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$\\frac{264}{19}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (11/19) # initial value\nd = 0 # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (11/19) # initial value\nd = 0 # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-6-\\frac{24 i}{5}$ and $y=9+\\frac{21 i}{5}$", + "Output Answer": [ + "$-\\frac{846}{25}-\\frac{342 i}{5}$" + ], + "Output Program": [ + "i = 1j\nx = -6-((24*i)/5)\ny = 9+((21*i)/5)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{60}{19}$, and $a_n=a_{n-1}+-\\frac{1}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$-\\frac{10}{57}$" + ], + "Output Program": [ + "a = (60/19) # initial value\nd = -(1/3) # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (60/19) # initial value\nd = -(1/3) # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{2 x}{7}-6}+\\sqrt{\\frac{43 x}{7}-\\frac{86}{7}}=\\frac{95}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{418753-380 \\sqrt{76798}}{11767}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((2*x)/7)-6)+sqrt(((43*x)/7)-(86/7)), (95/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{9 x}{2}+2, q(x) = \\frac{1}{4} (8 x+11)^2$", + "Output Answer": [ + "$16 x^2+\\frac{97 x}{2}+\\frac{129}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((9*x)/2)+2\nq = (1/4)*(8*x+11)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{25 x^2}{2}+7 x+3$ and $q(x) = -\\frac{3 x^2}{2}+3 x-1$", + "Output Answer": [ + "$\\frac{75 x^4}{4}-48 x^3+29 x^2+2 x-3$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((25*x**2)/2)+7*x+3\nq = -((3*x**2)/2)+3*x-1\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 9 x^2+8 x+4$ and $q(x) = -13 x^2-3 x+6$", + "Output Answer": [ + "$-117 x^4-131 x^3-22 x^2+36 x+24$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 9*x**2+8*x+4\nq = -13*x**2-3*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2+\\frac{5 x}{\\sqrt{2}}+12$", + "Output Answer": [ + "$-\\left(\\left(x+\\frac{3}{\\sqrt{2}}\\right) \\left(x-4 \\sqrt{2}\\right)\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2+((5*x)/(sqrt(2)))+12, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $6 \\sqrt{3} x-3 \\sqrt{3} x^2$", + "Output Answer": [ + "$x=2\\lor x=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(6*sqrt(3)*x-3*sqrt(3)*x**2, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\sqrt{3} x^2-\\frac{34 x}{\\sqrt{3}}+6 \\sqrt{3}}{\\frac{16 x}{\\sqrt{3}}-\\frac{37}{\\sqrt{3}}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-17-7 \\sqrt{7}\\right)\\right\\},\\left\\{x\\to \\frac{1}{3} \\left(-17+7 \\sqrt{7}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-sqrt(3)*x**2-((34*x)/(sqrt(3)))+6*sqrt(3))/(((16*x)/(sqrt(3)))-(37/(sqrt(3))))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{17}{33}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{17}{11}$" + ], + "Output Program": [ + "a = (17/33) # initial value\nd = 0 # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (17/33) # initial value\nd = 0 # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-15 x^2-3 x+5$", + "Output Answer": [ + "$\\frac{103}{20}-15 \\left(x+\\frac{1}{10}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-15*x**2-3*x+5), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{13+10}{\\left(((20+8)-5)^2-25\\right)-7}$.", + "Output Answer": [ + "$\\frac{23}{497}$" + ], + "Output Program": [ + "try: \n print(((13+10)/((((20+8)-5)**2-25)-7)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{1369 x^2}{3}+148 x-\\frac{13}{3}}{\\frac{43}{3}-\\frac{1591 x}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{13}{37}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((1369*x**2)/3)+148*x-(13/3))/((43/3)-((1591*x)/3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 x^2+10 x-10$ and $q(x) = -3 x^2+7 x-12$", + "Output Answer": [ + "$12 x^4-58 x^3+148 x^2-190 x+120$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*x**2+10*x-10\nq = -3*x**2+7*x-12\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-4 e^{-\\frac{4 i \\pi }{5}}$.", + "Output Answer": [ + "Norm: $4$\nArgument: $\\tan ^{-1}\\left(\\frac{\\Im\\left(e^{-\\frac{4 i \\pi }{5}}\\right)}{\\Re\\left(e^{-\\frac{4 i \\pi }{5}}\\right)}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -4*math.e**(-((4*i*math.pi)/5))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $5 x^2+9 x+\\frac{25}{2}$", + "Output Answer": [ + "$x=-\\frac{9}{10}-\\frac{13 i}{10}\\lor x=-\\frac{9}{10}+\\frac{13 i}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(5*x**2+9*x+(25/2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -12 x^2+6 x-6$ and $q(x) = -3 x^2+9 x+9$", + "Output Answer": [ + "$36 x^4-126 x^3-36 x^2-54$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -12*x**2+6*x-6\nq = -3*x**2+9*x+9\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(-\\cos \\left(\\frac{7 \\pi }{90}\\right)+i \\sin \\left(\\frac{7 \\pi }{90}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-40353607 \\left(\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(1+\\sqrt{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(-math.cos(((7*math.pi)/90))+1j*math.sin(((7*math.pi)/90))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -12 x^2 \\log (2)-5 x \\log (2)+13 \\log (2)$ and $q(x) = -20 x^2 \\log (2)+19 x \\log (2)-7 \\log (2)$", + "Output Answer": [ + "$240 x^4 \\log ^2(2)-128 x^3 \\log ^2(2)-271 x^2 \\log ^2(2)+282 x \\log ^2(2)-91 \\log ^2(2)$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -12*x**2*log(2)-5*x*log(2)+13*log(2)\nq = -20*x**2*log(2)+19*x*log(2)-7*log(2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5-11 x}+\\sqrt{-2 x-7}=8$", + "Output Answer": [ + "$\\{\\{x\\to -4\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5-11*x)+sqrt(-2*x-7), 8), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{(10 x+19)^4}{2401}, q(x) = \\frac{1}{49} (35 x+41)^2$", + "Output Answer": [ + "$\\frac{10000 x^4}{2401}+\\frac{76000 x^3}{2401}+\\frac{276625 x^2}{2401}+\\frac{414990 x}{2401}+\\frac{212690}{2401}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (((10*x+19)**4)/2401)\nq = (1/49)*(35*x+41)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-12 x^2+24 x+3876$", + "Output Answer": [ + "$12 (19-x) (x+17)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-12*x**2+24*x+3876, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{2400 x^2}{49}-\\frac{520 x}{49}+\\frac{19352}{49}}{\\frac{4520 x^2}{49}+\\frac{18134 x}{49}+\\frac{14160}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{41}{15}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((2400*x**2)/49)-((520*x)/49)+(19352/49))/(((4520*x**2)/49)+((18134*x)/49)+(14160/49))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{2 \\sqrt{5} x^2+4 \\sqrt{5} x-\\sqrt{5}}{7 \\sqrt{5} x-4 \\sqrt{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-2-\\sqrt{6}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(-2+\\sqrt{6}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((2*sqrt(5)*x**2+4*sqrt(5)*x-sqrt(5))/(7*sqrt(5)*x-4*sqrt(5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{224 t^2+2912 t+9431}{3 \\sqrt{3}}, x(t)=\\frac{16 t^2}{3}+\\frac{208 t}{3}+\\frac{676}{3}$", + "Output Answer": [ + "$y=\\frac{14 x}{\\sqrt{3}}-\\frac{11}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = ((224*t**2+2912*t+9431)/(3*sqrt(3)))\nx_t = ((16*t**2)/3)+((208*t)/3)+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{10+8 i}{\\sqrt{\\pi }}$ and $y=-\\frac{1+13 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{9-5 i}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((10+8*i)/(math.sqrt(math.pi)))\ny = -((1+13*i)/(math.sqrt(math.pi)))\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$19 x-6 y-2 z-8=0$, $5 x+15 y+8 z+6=0$, $-3 x-22 y-9 z+20=0$", + "Output Answer": [ + "$x=\\frac{748}{783}$, $y=\\frac{1490}{261}$, $z=-\\frac{9436}{783}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((19*x-6*y-2*z-8, 5*x+15*y+8*z+6, -3*x-22*y-9*z+20)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{5}{2}+\\frac{39 i}{4}$ and $y=-\\frac{17}{2}-\\frac{15 i}{2}$", + "Output Answer": [ + "$11+\\frac{69 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = (5/2)+((39*i)/4)\ny = -(17/2)-((15*i)/2)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2$ and $2 x^4-x^3-3 x^2-x+1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2, 2*x**4-x**3-3*x**2-x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-20 x^3-30 x^2+60 x+35}{60 x+30}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-1-\\sqrt{15}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(-1+\\sqrt{15}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-20*x**3-30*x**2+60*x+35)/(60*x+30)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^4+\\frac{13 x^3}{2}+\\frac{17 x^2}{2}+\\frac{19 x}{2}+10$ when divided by $-\\frac{x^3}{2}-\\frac{3 x^2}{2}-\\frac{15 x}{2}+\\frac{11}{2}$.", + "Output Answer": [ + "$18 x-67$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**4+((13*x**3)/2)+((17*x**2)/2)+((19*x)/2)+10\nq = -((x**3)/2)-((3*x**2)/2)-((15*x)/2)+(11/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(7+7 i) \\log (2)$ and $y=-11 \\log (2)$", + "Output Answer": [ + "$(-77-77 i) \\log ^2(2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (7+7*i)*math.log10(2)\ny = -11*math.log10(2)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -24 x-21| =9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{4}\\right\\},\\left\\{x\\to -\\frac{1}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-24*x-21), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+8 x-4 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $7 x^2+8 x-4 y=-1$\nVertex: $\\left\\{-\\frac{4}{7},-\\frac{9}{28}\\right\\}$\nDirectrix: $y=-\\frac{13}{28}$\nFocal Parameter: $\\frac{2}{7}$\nFocus: $\\left\\{-\\frac{4}{7},-\\frac{5}{28}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+8*x-4*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\sqrt{2} \\left(\\sin \\left(\\frac{13 \\pi }{90}\\right)+i \\cos \\left(\\frac{13 \\pi }{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$-67228 \\sqrt{2} \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*math.sqrt(2)*(math.sin(((13*math.pi)/90))+1j*math.cos(((13*math.pi)/90))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-10 x^3+9 x^2+\\frac{5 x}{2}-\\frac{19}{2}$ when divided by $\\frac{19 x^3}{2}-3 x^2-10 x-\\frac{1}{2}$.", + "Output Answer": [ + "$-\\frac{20}{19}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -10*x**3+9*x**2+((5*x)/2)-(19/2)\nq = ((19*x**3)/2)-3*x**2-10*x-(1/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$4 x+20 y+25 z-\\frac{11}{3}=0$, $-\\frac{26 x}{3}+\\frac{47 y}{3}-\\frac{26 z}{3}-\\frac{29}{3}=0$, $-7 x-7 y+12 z-\\frac{71}{3}=0$", + "Output Answer": [ + "$x=-\\frac{152248}{72549}$, $y=-\\frac{13931}{72549}$, $z=\\frac{46145}{72549}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((4*x+20*y+25*z-(11/3), -((26*x)/3)+((47*y)/3)-((26*z)/3)-(29/3), -7*x-7*y+12*z-(71/3))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{93}{32}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$-\\frac{2325}{32}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(93/32) # initial value\nd = 0 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(93/32) # initial value\nd = 0 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-8 e^{-\\frac{67 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $8$\nArgument: $\\frac{113 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -8*math.e**(-((67*i*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+5 x-8 y^2+6 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x+\\frac{5}{14}\\right)^2-8 \\left(y-\\frac{3}{8}\\right)^2=\\frac{323}{56}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{56} \\left(-20-\\sqrt{4845}\\right) & \\frac{3}{8} \\\\\n \\frac{1}{56} \\left(\\sqrt{4845}-20\\right) & \\frac{3}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{15}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{56} \\left(-20-\\sqrt{4845}\\right)+\\frac{1}{56} \\left(\\sqrt{4845}-20\\right)\\right),\\frac{3}{8}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{2} \\sqrt{\\frac{7}{2}} x+\\frac{1}{56} \\left(21+5 \\sqrt{14}\\right),y=\\frac{1}{56} \\left(21-5 \\sqrt{14}\\right)-\\frac{1}{2} \\sqrt{\\frac{7}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+5*x-8*y**2+6*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $9 x^2-144 x+135$", + "Output Answer": [ + "$9 (x-15) (x-1)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(9*x**2-144*x+135, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(-\\cos \\left(\\frac{11 \\pi }{90}\\right)+i \\sin \\left(\\frac{11 \\pi }{90}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$729 \\left(-\\sin \\left(\\frac{7 \\pi }{30}\\right)-i \\cos \\left(\\frac{7 \\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(-math.cos(((11*math.pi)/90))+1j*math.sin(((11*math.pi)/90))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 22 x^2+19 x+21\\right| =-15$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(22*x**2+19*x+21), -15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-4 x^2+19 x-13}{-x-20}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(19-3 \\sqrt{17}\\right)\\right\\},\\left\\{x\\to \\frac{1}{8} \\left(19+3 \\sqrt{17}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-4*x**2+19*x-13)/(-x-20)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{25 x^2+50 x-171}{-65 x^2-132 x+437}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{9}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((25*x**2+50*x-171)/(-65*x**2-132*x+437)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -6 x^2+11 x+10$ and $q(x) = -7 x^2-2 x-4$", + "Output Answer": [ + "$42 x^4-65 x^3-68 x^2-64 x-40$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -6*x**2+11*x+10\nq = -7*x**2-2*x-4\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\log \\left(5 x+\\frac{7}{2}\\right)-\\tan \\left(\\frac{3 x}{2}+\\frac{5}{2}\\right)$ at the point $x=0$", + "Output Answer": [ + "$-\\log \\left(\\frac{7}{2}\\right)-\\tan \\left(\\frac{5}{2}\\right) = -0.506$" + ], + "Output Program": [ + "import math\n\nx = 0\ntry: \n f = -math.log(5*x+(7/2))-math.tan(((3*x)/2)+(5/2))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{71}{69}$, and $a_n=a_{n-1}+-7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$-\\frac{5185}{69}$" + ], + "Output Program": [ + "a = -(71/69) # initial value\nd = -7 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(71/69) # initial value\nd = -7 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $11 x^2-13 x-10$", + "Output Answer": [ + "$11 \\left(x-\\frac{13}{22}\\right)^2-\\frac{609}{44}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (11*x**2-13*x-10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{59}-\\sqrt{71}}{\\sqrt{128}+73}$.", + "Output Answer": [ + "$\\frac{\\sqrt{59}-\\sqrt{71}}{73+8 \\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(59)-sqrt(71))/(sqrt(128)+73)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-21 x^2+157 x+88}{-189 x-99}=0$", + "Output Answer": [ + "$\\{\\{x\\to 8\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-21*x**2+157*x+88)/(-189*x-99)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((((4-13)-14)-7)+3)+(((3+24)+13)-25)$.", + "Output Answer": [ + "$-12$" + ], + "Output Program": [ + "try: \n print(((((4-13)-14)-7)+3)+(((3+24)+13)-25))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{11 x^2}{3}+3 x+10$", + "Output Answer": [ + "$\\frac{11}{3} \\left(x+\\frac{9}{22}\\right)^2+\\frac{413}{44}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((11*x**2)/3)+3*x+10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left((((21+21)-11)-19)^2+10\\right) ((7+22)+15)$.", + "Output Answer": [ + "$6776$" + ], + "Output Program": [ + "try: \n print(((((21+21)-11)-19)**2+10)*((7+22)+15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{26 x}{5}+\\frac{82 y}{5}+\\frac{2}{5}=0$, $-4 x+\\frac{51 y}{5}-\\frac{104}{5}=0$", + "Output Answer": [ + "$x=-\\frac{4315}{1483}$, $y=\\frac{1332}{1483}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((26*x)/5)+((82*y)/5)+(2/5), -4*x+((51*y)/5)-(104/5)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{79 x}{7}-\\frac{96}{7}}+\\sqrt{-\\frac{60 x}{7}-\\frac{76}{7}}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{361} \\left(-35408+24 \\sqrt{2082227}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((79*x)/7)-(96/7))+sqrt(-((60*x)/7)-(76/7)), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{7}{\\sqrt{3}}-\\frac{26 x}{\\sqrt{3}}\\right| =\\frac{22}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{15}{26}\\right\\},\\left\\{x\\to \\frac{29}{26}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs((7/(sqrt(3)))-((26*x)/(sqrt(3)))), (22/(sqrt(3)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\left(\\cos \\left(\\frac{7}{9}\\right)+i \\sin \\left(\\frac{7}{9}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-16384 \\left(\\cos \\left(\\frac{49}{9}\\right)+i \\sin \\left(\\frac{49}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*(math.cos((7/9))+1j*math.sin((7/9))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{71}{43}$, and $a_n=a_{n-1}+\\frac{28}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$\\frac{41075}{43}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(71/43) # initial value\nd = (28/3) # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(71/43) # initial value\nd = (28/3) # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-10 x+4 y-1=0$, $8 x+11 y+13=0$", + "Output Answer": [ + "$x=-\\frac{63}{142}$, $y=-\\frac{61}{71}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-10*x+4*y-1, 8*x+11*y+13), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 15 x^2+9 x-13$ and $q(x) = 11 x^2+5 x-12$", + "Output Answer": [ + "$165 x^4+174 x^3-278 x^2-173 x+156$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 15*x**2+9*x-13\nq = 11*x**2+5*x-12\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{95 x^2}{7}-\\frac{61 x}{7}-\\frac{92}{7}$", + "Output Answer": [ + "$x=\\frac{1}{190} \\left(61-\\sqrt{38681}\\right)\\lor x=\\frac{1}{190} \\left(61+\\sqrt{38681}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((95*x**2)/7)-((61*x)/7)-(92/7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{35}{4} \\left(-\\sin \\left(\\frac{7 \\pi }{30}\\right)+i \\cos \\left(\\frac{7 \\pi }{30}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$\\frac{1500625}{256} \\left(-\\cos \\left(\\frac{\\pi }{15}\\right)+i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(35/4)*(-math.sin(((7*math.pi)/30))+1j*math.cos(((7*math.pi)/30))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-8 \\left(\\cos \\left(\\frac{143}{90}\\right)+i \\sin \\left(\\frac{143}{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-8589934592 \\left(\\cos \\left(\\frac{1573}{90}\\right)+i \\sin \\left(\\frac{1573}{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-8*(math.cos((143/90))+1j*math.sin((143/90))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-x+4 y^2-y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Circle\nEquation: $4 \\left(x-\\frac{1}{8}\\right)^2+4 \\left(y-\\frac{1}{8}\\right)^2=\\frac{81}{8}$\nRadius: $\\frac{9}{4 \\sqrt{2}}$\nCircumference: $\\frac{9 \\pi }{2 \\sqrt{2}}$\nCenter: $\\left\\{\\frac{1}{8},\\frac{1}{8}\\right\\}$\nArea Enclosed: $\\frac{81 \\pi }{32}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-x+4*y**2-y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{18}{19}$, and $a_n=a_{n-1}+-\\frac{39}{4}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=28$.", + "Output Answer": [ + "$-\\frac{141057}{38}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(18/19) # initial value\nd = -(39/4) # second term\nn = 28 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(18/19) # initial value\nd = -(39/4) # second term\nn = 28 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(1+2 i) \\sqrt{5}$ and $y=(2-i) \\sqrt{5}$", + "Output Answer": [ + "$(3+i) \\sqrt{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (1+2*i)*math.sqrt(5)\ny = (2-i)*math.sqrt(5)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$8 x+22 y+21=0$, $-21 x-15 y+6=0$", + "Output Answer": [ + "$x=\\frac{149}{114}$, $y=-\\frac{163}{114}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((8*x+22*y+21, -21*x-15*y+6), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$7 \\sqrt{3} x+\\frac{14 y}{\\sqrt{3}}-13 \\sqrt{3} z+\\frac{1}{\\sqrt{3}}=0$, $11 \\sqrt{3} x+\\frac{16 y}{\\sqrt{3}}-\\frac{41 z}{\\sqrt{3}}-10 \\sqrt{3}=0$, $\\frac{29 x}{\\sqrt{3}}-\\frac{4 y}{\\sqrt{3}}+\\frac{4 z}{\\sqrt{3}}+\\frac{1}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{61}{53}$, $y=\\frac{38197}{2650}$, $z=\\frac{7711}{1325}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((7*sqrt(3)*x+((14*y)/(sqrt(3)))-13*sqrt(3)*z+(1/(sqrt(3))), 11*sqrt(3)*x+((16*y)/(sqrt(3)))-((41*z)/(sqrt(3)))-10*sqrt(3), ((29*x)/(sqrt(3)))-((4*y)/(sqrt(3)))+((4*z)/(sqrt(3)))+(1/(sqrt(3))))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{7+9 i}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{130}}{\\pi }$\nArgument: $\\tan ^{-1}\\left(\\frac{9}{7}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((7+9*i)/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{88}{71}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$\\frac{440}{71}$" + ], + "Output Program": [ + "a = (88/71) # initial value\nd = 0 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (88/71) # initial value\nd = 0 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -19 x-22| =7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{29}{19}\\right\\},\\left\\{x\\to -\\frac{15}{19}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-19*x-22), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+7 x+2 y^2-9 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x+\\frac{7}{16}\\right)^2+2 \\left(y-\\frac{9}{4}\\right)^2=\\frac{597}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{7}{16} & -\\frac{3}{16} \\left(\\sqrt{199}-12\\right) \\\\\n -\\frac{7}{16} & \\frac{3}{16} \\left(12+\\sqrt{199}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{3}}{2}$\nCenter: $\\left\\{-\\frac{7}{16},\\frac{1}{2} \\left(\\frac{3}{16} \\left(12+\\sqrt{199}\\right)-\\frac{3}{16} \\left(\\sqrt{199}-12\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{597 \\pi }{128}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+7*x+2*y**2-9*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{34}-\\sqrt{51}}{\\sqrt{153}}$.", + "Output Answer": [ + "$\\frac{1}{3} \\left(\\sqrt{2}-\\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(34)-sqrt(51))/(sqrt(153))))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2-5 x-4 y^2-10 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $\\left(x-\\frac{5}{2}\\right)^2-4 \\left(y+\\frac{5}{4}\\right)^2=6$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} \\left(5-\\sqrt{30}\\right) & -\\frac{5}{4} \\\\\n \\frac{1}{2} \\left(5+\\sqrt{30}\\right) & -\\frac{5}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{2} \\left(5-\\sqrt{30}\\right)+\\frac{1}{2} \\left(5+\\sqrt{30}\\right)\\right),-\\frac{5}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{2}-\\frac{5}{2},y=-\\frac{x}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-5*x-4*y**2-10*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^5+4 x^4-3 x^3-8 x^2-9 x-8$ when divided by $-8 x^5-x^4-2 x^3-x^2-8 x-2$.", + "Output Answer": [ + "$-\\frac{5}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**5+4*x**4-3*x**3-8*x**2-9*x-8\nq = -8*x**5-x**4-2*x**3-x**2-8*x-2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$2 \\sqrt{5} x-8 \\sqrt{5} y-9 \\sqrt{5} z+10 \\sqrt{5}=0$, $8 \\sqrt{5} y-10 \\sqrt{5} z-5 \\sqrt{5}=0$, $2 \\sqrt{5} x-7 \\sqrt{5} y-10 \\sqrt{5} z-3 \\sqrt{5}=0$", + "Output Answer": [ + "$x=\\frac{1871}{4}$, $y=\\frac{125}{2}$, $z=\\frac{99}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((2*sqrt(5)*x-8*sqrt(5)*y-9*sqrt(5)*z+10*sqrt(5), 8*sqrt(5)*y-10*sqrt(5)*z-5*sqrt(5), 2*sqrt(5)*x-7*sqrt(5)*y-10*sqrt(5)*z-3*sqrt(5))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $8 \\sqrt{2} x^2+2 \\sqrt{2} x-8 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{8} \\left(-1-\\sqrt{65}\\right)\\lor x=\\frac{1}{8} \\left(\\sqrt{65}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(8*sqrt(2)*x**2+2*sqrt(2)*x-8*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=3-2 i$ and $y=9-8 i$", + "Output Answer": [ + "$12-10 i$" + ], + "Output Program": [ + "i = 1j\nx = 3-2*i\ny = 9-8*i\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x^2-11 x-12$ and $x-3$.", + "Output Answer": [ + "$x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x**2-11*x-12, x-3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{5733 x^3}{16}+\\frac{2275 x^2}{8}+\\frac{3185 x}{8}-\\frac{5187}{16}}{455 x-455}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{126} \\left(-13-\\sqrt{14533}\\right)\\right\\},\\left\\{x\\to \\frac{1}{126} \\left(-13+\\sqrt{14533}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((5733*x**3)/16)+((2275*x**2)/8)+((3185*x)/8)-(5187/16))/(455*x-455)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=2-\\frac{34 i}{5}$ and $y=\\frac{34}{5}+7 i$", + "Output Answer": [ + "$-\\frac{24}{5}-\\frac{69 i}{5}$" + ], + "Output Program": [ + "i = 1j\nx = 2-((34*i)/5)\ny = (34/5)+7*i\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{37 x}{4}-\\frac{25}{4}}+\\sqrt{-\\frac{27 x}{4}-8}=\\frac{27}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{200} \\left(-23188+27 \\sqrt{707911}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((37*x)/4)-(25/4))+sqrt(-((27*x)/4)-8), (27/4)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{41}{97}$, and $a_n=a_{n-1}+-10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=17$.", + "Output Answer": [ + "$-\\frac{132617}{97}$" + ], + "Output Program": [ + "a = -(41/97) # initial value\nd = -10 # second term\nn = 17 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(41/97) # initial value\nd = -10 # second term\nn = 17 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (4, 2, \\pi)$", + "Output Answer": [ + "$\\left\\{\\sqrt{20+\\pi ^2},\\tan ^{-1}\\left(\\frac{2 \\sqrt{5}}{\\pi }\\right),\\tan ^{-1}\\left(\\frac{1}{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 4\ny = 2\nz = math.pi\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (8 x+1)^4, q(x) = -5 x-4$", + "Output Answer": [ + "$4096 x^4+2048 x^3+384 x^2+27 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (8*x+1)**4\nq = -5*x-4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{16}{3} \\left(\\cos \\left(\\frac{\\pi }{20}\\right)+i \\sin \\left(\\frac{\\pi }{20}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{16}{3} \\sqrt{\\sin ^2\\left(\\frac{\\pi }{20}\\right)+\\cos ^2\\left(\\frac{\\pi }{20}\\right)}$\nArgument: $-\\frac{19 \\pi }{20}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(16/3)*(math.cos((math.pi/20))+i*math.sin((math.pi/20)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $3 \\sqrt{5} x^2-\\sqrt{5} x-\\sqrt{5}$", + "Output Answer": [ + "$3 \\sqrt{5} \\left(x-\\frac{1}{6}\\right)^2-\\frac{13 \\sqrt{5}}{12}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (3*math.sqrt(5)*x**2-math.sqrt(5)*x-math.sqrt(5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{10}{3}$ and $y=\\frac{26}{3}-\\frac{10 i}{3}$", + "Output Answer": [ + "$12-\\frac{10 i}{3}$" + ], + "Output Program": [ + "i = 1j\nx = (10/3)\ny = (26/3)-((10*i)/3)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $14 | x| =3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{14}\\right\\},\\left\\{x\\to \\frac{3}{14}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(14*abs(x), 3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-5 x^2-8 x+3 y^2+y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(y+\\frac{1}{6}\\right)^2-5 \\left(x+\\frac{4}{5}\\right)^2=-\\frac{427}{60}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{4}{5}-\\frac{\\sqrt{854}}{15} & -\\frac{1}{6} \\\\\n \\frac{1}{15} \\left(\\sqrt{854}-12\\right) & -\\frac{1}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{4}{5}-\\frac{\\sqrt{854}}{15}+\\frac{1}{15} \\left(\\sqrt{854}-12\\right)\\right),-\\frac{1}{6}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{5}{3}} x+\\frac{1}{30} \\left(8 \\sqrt{15}-5\\right),y=\\frac{1}{30} \\left(-5-8 \\sqrt{15}\\right)-\\sqrt{\\frac{5}{3}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-5*x**2-8*x+3*y**2+y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\left(-\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(1-\\sqrt{5}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$256 \\left(\\frac{1}{4} \\left(-1-\\sqrt{5}\\right)+i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*(-math.sqrt((5/8)+((math.sqrt(5))/8))+(1/4)*1j*(1-math.sqrt(5))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{43}{23}$, and $a_n=a_{n-1}+-\\frac{64}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$-\\frac{245993}{161}$" + ], + "Output Program": [ + "a = (43/23) # initial value\nd = -(64/7) # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (43/23) # initial value\nd = -(64/7) # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{40 x}{\\sqrt{3}}+\\frac{41 y}{\\sqrt{3}}+\\frac{4 z}{\\sqrt{3}}-\\frac{35}{\\sqrt{3}}=0$, $\\frac{13 x}{\\sqrt{3}}+\\frac{y}{\\sqrt{3}}-7 \\sqrt{3} z-12 \\sqrt{3}=0$, $\\frac{37 x}{\\sqrt{3}}+\\frac{34 y}{\\sqrt{3}}-\\frac{41 z}{\\sqrt{3}}-\\frac{17}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{12377}{5884}$, $y=-\\frac{1324}{1471}$, $z=-\\frac{18001}{5884}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((40*x)/(sqrt(3)))+((41*y)/(sqrt(3)))+((4*z)/(sqrt(3)))-(35/(sqrt(3))), ((13*x)/(sqrt(3)))+(y/(sqrt(3)))-7*sqrt(3)*z-12*sqrt(3), ((37*x)/(sqrt(3)))+((34*y)/(sqrt(3)))-((41*z)/(sqrt(3)))-(17/(sqrt(3))))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $8 \\sqrt{3} x^2-3 \\sqrt{3} x-5 \\sqrt{3}$", + "Output Answer": [ + "$x=-\\frac{5}{8}\\lor x=1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(8*sqrt(3)*x**2-3*sqrt(3)*x-5*sqrt(3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{22}{5} \\left(\\sin \\left(\\frac{11 \\pi }{90}\\right)+i \\cos \\left(\\frac{11 \\pi }{90}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$\\frac{484}{25} \\left(-\\cos \\left(\\frac{11 \\pi }{45}\\right)+i \\sin \\left(\\frac{11 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((22/5)*(math.sin(((11*math.pi)/90))+1j*math.cos(((11*math.pi)/90))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^6+4 x^5+x^4-2 x^3+8 x^2+6 x-1$ when divided by $-7 x-4$.", + "Output Answer": [ + "$-x^5-\\frac{x^3}{7}+\\frac{18 x^2}{49}-\\frac{464 x}{343}-\\frac{202}{2401}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**6+4*x**5+x**4-2*x**3+8*x**2+6*x-1\nq = -7*x-4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2+72 x-135$", + "Output Answer": [ + "$9 (3-x) (x-5)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2+72*x-135, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5$ and $-\\frac{5 x^4}{2}-3 x^3+5 x^2-x+1$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5, -((5*x**4)/2)-3*x**3+5*x**2-x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-10 x-y^2+y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x-\\frac{5}{8}\\right)^2-\\left(y-\\frac{1}{2}\\right)^2=-\\frac{1}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{8} & \\frac{1}{8} \\\\\n \\frac{5}{8} & \\frac{7}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2 \\sqrt{2}}$\nCenter: $\\left\\{\\frac{5}{8},\\frac{1}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{4} \\left(2+5 \\sqrt{2}\\right)-2 \\sqrt{2} x,y=2 \\sqrt{2} x+\\frac{1}{4} \\left(2-5 \\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-10*x-y**2+y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\tan \\left(7 x^2+3\\right)+\\sin (2-2 x)$ at the point $x=1$", + "Output Answer": [ + "$\\tan (10) = 0.648$" + ], + "Output Program": [ + "import math\n\nx = 1\ntry: \n f = math.tan(7*x**2+3)+math.sin(2-2*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $16 x+16$ and $4 x+4$.", + "Output Answer": [ + "$4 x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(16*x+16, 4*x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{21 x^2}{\\sqrt{\\pi }}+\\frac{10 x}{\\sqrt{\\pi }}+\\frac{2}{\\sqrt{\\pi }}$ and $q(x) = \\frac{21 x^2}{\\sqrt{\\pi }}-\\frac{25 x}{\\sqrt{\\pi }}+\\frac{23}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{441 x^4}{\\pi }-\\frac{315 x^3}{\\pi }+\\frac{275 x^2}{\\pi }+\\frac{180 x}{\\pi }+\\frac{46}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((21*x**2)/(sqrt(pi)))+((10*x)/(sqrt(pi)))+(2/(sqrt(pi)))\nq = ((21*x**2)/(sqrt(pi)))-((25*x)/(sqrt(pi)))+(23/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=e^{2-4 x^2}$ at the point $x=-1$", + "Output Answer": [ + "$\\frac{1}{e^2} = 0.135$" + ], + "Output Program": [ + "import math\n\nx = -1\ntry: \n f = math.e**(2-4*x**2)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{187 x^3}{2}+324 x^2+22 x-\\frac{1085}{2}}{217-77 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{34} \\left(11-\\sqrt{2501}\\right)\\right\\},\\left\\{x\\to \\frac{1}{34} \\left(11+\\sqrt{2501}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((187*x**3)/2)+324*x**2+22*x-(1085/2))/(217-77*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $7 x^2-91 x-798$", + "Output Answer": [ + "$-7 (19-x) (x+6)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(7*x**2-91*x-798, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-9-8 i$ and $y=2+8 i$", + "Output Answer": [ + "$-7$" + ], + "Output Program": [ + "i = 1j\nx = -9-8*i\ny = 2+8*i\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5-4 x$ and $4 x-5$.", + "Output Answer": [ + "$4 x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5-4*x, 4*x-5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-9 x+11 y+\\frac{43}{2}=0$, $-15 x-\\frac{35 y}{2}-1=0$", + "Output Answer": [ + "$x=\\frac{487}{430}$, $y=-\\frac{221}{215}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-9*x+11*y+(43/2), -15*x-((35*y)/2)-1), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -11 x^2-10 x+3\\right| =9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{11} \\left(-5-\\sqrt{157}\\right)\\right\\},\\left\\{x\\to \\frac{1}{11} \\left(-5+\\sqrt{157}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-11*x**2-10*x+3), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{63}{125} \\left(7 t^2-150 t+800\\right), x(t)=\\frac{49 t^2}{25}-42 t+225$", + "Output Answer": [ + "$y=\\frac{9 x}{5}-\\frac{9}{5}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (63/125)*(7*t**2-150*t+800)\nx_t = ((49*t**2)/25)-42*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{8 \\left(\\cos \\left(\\frac{73}{90}\\right)+i \\sin \\left(\\frac{73}{90}\\right)\\right)}{\\sqrt{3}}\\right)^5$", + "Output Answer": [ + "$\\frac{32768 \\left(\\cos \\left(\\frac{73}{18}\\right)+i \\sin \\left(\\frac{73}{18}\\right)\\right)}{9 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((8*(math.cos((73/90))+1j*math.sin((73/90))))/(math.sqrt(3))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (7, \\pi, 10)$", + "Output Answer": [ + "$\\left\\{\\sqrt{149+\\pi ^2},\\tan ^{-1}\\left(\\frac{\\sqrt{49+\\pi ^2}}{10}\\right),\\tan ^{-1}\\left(\\frac{\\pi }{7}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 7\ny = math.pi\nz = 10\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-3 \\sqrt{3} x-7 \\sqrt{3} y+6 \\sqrt{3} z+8 \\sqrt{3}=0$, $2 \\sqrt{3} x+7 \\sqrt{3} y-9 \\sqrt{3} z-11 \\sqrt{3}=0$, $-12 \\sqrt{3} x-8 \\sqrt{3} y+11 \\sqrt{3} z+13 \\sqrt{3}=0$", + "Output Answer": [ + "$x=-\\frac{6}{209}$, $y=\\frac{64}{209}$, $z=-\\frac{207}{209}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-3*sqrt(3)*x-7*sqrt(3)*y+6*sqrt(3)*z+8*sqrt(3), 2*sqrt(3)*x+7*sqrt(3)*y-9*sqrt(3)*z-11*sqrt(3), -12*sqrt(3)*x-8*sqrt(3)*y+11*sqrt(3)*z+13*sqrt(3))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((1+16)-2)+9) \\left((21+8)^2-1\\right)$.", + "Output Answer": [ + "$20160$" + ], + "Output Program": [ + "try: \n print((((1+16)-2)+9)*((21+8)**2-1))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{10 \\left(-\\cos \\left(\\frac{17 \\pi }{90}\\right)-i \\sin \\left(\\frac{17 \\pi }{90}\\right)\\right)}{\\sqrt{3}}\\right)^8$", + "Output Answer": [ + "$\\frac{100000000}{81} \\left(\\sin \\left(\\frac{\\pi }{90}\\right)-i \\cos \\left(\\frac{\\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((10*(-math.cos(((17*math.pi)/90))-1j*math.sin(((17*math.pi)/90))))/(math.sqrt(3))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{1}{2} \\left(\\cos \\left(\\frac{11 \\pi }{45}\\right)-i \\sin \\left(\\frac{11 \\pi }{45}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{1}{2} \\sqrt{\\sin ^2\\left(\\frac{11 \\pi }{45}\\right)+\\cos ^2\\left(\\frac{11 \\pi }{45}\\right)}$\nArgument: $-\\frac{11 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (1/2)*(math.cos(((11*math.pi)/45))-i*math.sin(((11*math.pi)/45)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3 x-8}+\\sqrt{6 x-9}=3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(28-6 \\sqrt{11}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3*x-8)+sqrt(6*x-9), 3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{19 x^2}{\\sqrt{2}}-\\frac{9 x}{\\sqrt{2}}$ and $q(x) = -3 \\sqrt{2} x^2-\\frac{11 x}{\\sqrt{2}}+\\frac{7}{\\sqrt{2}}$", + "Output Answer": [ + "$-57 x^4-\\frac{155 x^3}{2}+116 x^2-\\frac{63 x}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((19*x**2)/(sqrt(2)))-((9*x)/(sqrt(2)))\nq = -3*sqrt(2)*x**2-((11*x)/(sqrt(2)))+(7/(sqrt(2)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{10-7 i}{\\sqrt{2}}$ and $y=-\\frac{2+i}{\\sqrt{2}}$", + "Output Answer": [ + "$(-6+3 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((10-7*i)/(math.sqrt(2)))\ny = -((2+i)/(math.sqrt(2)))\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -4 x^2-4 x+9$, $q(x) = x (14 x-3)$", + "Output Answer": [ + "$10 x^2-7 x+9$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**2-4*x+9\nq = x*(14*x-3)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{16}{3} \\left(-75 t^2+10 \\left(39+2 \\sqrt{3}\\right) t-52 \\sqrt{3}-511\\right), x(t)=\\frac{10 t}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=12 x^2-32 x+\\frac{64}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -(16/3)*(-75*t**2+10*(39+2*sqrt(3))*t-52*sqrt(3)-511)\nx_t = ((10*t)/(sqrt(3)))-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{15 x^2}{4}+\\frac{9 x}{2}+\\frac{33}{4}$", + "Output Answer": [ + "$x=\\frac{11}{5}\\lor x=-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((15*x**2)/4)+((9*x)/2)+(33/4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{288 x^3+540 x^2+136 x-39}{-120 x-65}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{2}\\right\\},\\left\\{x\\to \\frac{1}{6}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((288*x**3+540*x**2+136*x-39)/(-120*x-65)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$11 x+18 y-5 z+15=0$, $14 x+8 y+17 z+10=0$, $-4 x+18 y+23 z-5=0$", + "Output Answer": [ + "$x=-\\frac{4300}{4891}$, $y=-\\frac{2235}{9782}$, $z=\\frac{1190}{4891}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((11*x+18*y-5*z+15, 14*x+8*y+17*z+10, -4*x+18*y+23*z-5)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\left(((16+11)+6)^2+22\\right)+22}{(20-1)+14}$.", + "Output Answer": [ + "$\\frac{103}{3}$" + ], + "Output Program": [ + "try: \n print((((((16+11)+6)**2+22)+22)/((20-1)+14)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 19 x-12| =-16$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(19*x-12), -16), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{1}{9}$, and $a_n=a_{n-1}+2 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$\\frac{29}{2} \\left(56 \\sqrt{2}-\\frac{2}{9}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(1/9) # initial value\nd = 2*math.sqrt(2) # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(1/9) # initial value\nd = 2*math.sqrt(2) # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-4 x-8 y^2-3 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x-\\frac{1}{3}\\right)^2-8 \\left(y+\\frac{3}{16}\\right)^2=-\\frac{731}{96}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{3} & \\frac{1}{48} \\left(-9-\\sqrt{5117}\\right) \\\\\n \\frac{1}{3} & \\frac{1}{48} \\left(\\sqrt{5117}-9\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{3}}$\nCenter: $\\left\\{\\frac{1}{3},\\frac{1}{2} \\left(\\frac{1}{48} \\left(-9-\\sqrt{5117}\\right)+\\frac{1}{48} \\left(\\sqrt{5117}-9\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{48} \\left(8 \\sqrt{3}-9\\right)-\\frac{\\sqrt{3} x}{2},y=\\frac{\\sqrt{3} x}{2}+\\frac{1}{48} \\left(-9-8 \\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-4*x-8*y**2-3*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -x (4 x+5)$, $q(x) = -14 x^2-14 x-3$", + "Output Answer": [ + "$-18 x^2-19 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x*(4*x+5)\nq = -14*x**2-14*x-3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{9 x^2}{2}+\\frac{3 x}{2}-4$ and $-4 x^3-4 x^2-\\frac{9}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((9*x**2)/2)+((3*x)/2)-4, -4*x**3-4*x**2-(9/2)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{1}{5} e^{-\\frac{i \\pi }{5}}$.", + "Output Answer": [ + "Norm: $\\frac{1}{5}$\nArgument: $-\\frac{\\pi }{5}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (1/5)*math.e**(-((i*math.pi)/5))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 15-23 x| =7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{8}{23}\\right\\},\\left\\{x\\to \\frac{22}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(15-23*x), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -6 x^2-9 x-14$ and $q(x) = -6 x^2+9 x+14$", + "Output Answer": [ + "$36 x^4-81 x^2-252 x-196$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -6*x**2-9*x-14\nq = -6*x**2+9*x+14\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{64} \\left(\\sqrt{44}+3\\right)$.", + "Output Answer": [ + "$8 \\left(3+2 \\sqrt{11}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(64)*(sqrt(44)+3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{35}{18}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$\\frac{6764}{3}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (35/18) # initial value\nd = 8 # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (35/18) # initial value\nd = 8 # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2-4 x-\\frac{11}{3}$ and $2 x^2-\\frac{1}{3}$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2-4*x-(11/3), 2*x**2-(1/3)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-4+4 i) \\sqrt{5}$ and $y=(-2-i) \\sqrt{5}$", + "Output Answer": [ + "$\\frac{4}{5}-\\frac{12 i}{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-4+4*i)*math.sqrt(5)\ny = (-2-i)*math.sqrt(5)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{25 x}{4}-10 y+13=0$, $-5 x-\\frac{37 y}{4}-\\frac{63}{4}=0$", + "Output Answer": [ + "$x=-\\frac{4444}{1725}$, $y=-\\frac{107}{345}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((25*x)/4)-10*y+13, -5*x-((37*y)/4)-(63/4)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $5 \\left(\\sin \\left(\\frac{7 \\pi }{180}\\right)-i \\cos \\left(\\frac{7 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $5 \\sqrt{\\sin ^2\\left(\\frac{7 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{7 \\pi }{180}\\right)}$\nArgument: $-\\frac{83 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 5*(math.sin(((7*math.pi)/180))-i*math.cos(((7*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{32 x^2}{e}+\\frac{4 x}{e}+\\frac{33}{e}$ and $q(x) = \\frac{12 x^2}{e}+\\frac{16 x}{e}$", + "Output Answer": [ + "$\\frac{384 x^4}{e^2}+\\frac{560 x^3}{e^2}+\\frac{460 x^2}{e^2}+\\frac{528 x}{e^2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = ((32*x**2)/math.e)+((4*x)/math.e)+(33/math.e)\nq = ((12*x**2)/math.e)+((16*x)/math.e)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{4}{3} \\left(\\cos \\left(\\frac{1}{90}\\right)+i \\sin \\left(\\frac{1}{90}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$\\frac{16777216 \\left(\\cos \\left(\\frac{2}{15}\\right)+i \\sin \\left(\\frac{2}{15}\\right)\\right)}{531441}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(4/3)*(math.cos((1/90))+1j*math.sin((1/90))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{57 x^2}{5}+\\frac{52 x}{5}-\\frac{4}{5}$", + "Output Answer": [ + "$\\frac{57}{5} \\left(x+\\frac{26}{57}\\right)^2-\\frac{904}{285}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((57*x**2)/5)+((52*x)/5)-(4/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x+4$ and $3 x^2-2 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x+4, 3*x**2-2*x-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\sqrt{5} x-6 \\sqrt{5}\\right| =6 \\sqrt{5}$", + "Output Answer": [ + "$\\{\\{x\\to -12\\},\\{x\\to 0\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-sqrt(5)*x-6*sqrt(5)), 6*sqrt(5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $9 x^2-9 x-1404$", + "Output Answer": [ + "$9 (-x-12) (13-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(9*x**2-9*x-1404, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{3 x^5}{2}-\\frac{17 x^4}{2}-\\frac{15 x^3}{2}-\\frac{9 x^2}{2}-9 x-\\frac{13}{2}$ when divided by $\\frac{19 x^5}{2}+5 x^4-\\frac{19 x^3}{2}+2 x^2+\\frac{7 x}{2}-5$.", + "Output Answer": [ + "$-\\frac{3}{19}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((3*x**5)/2)-((17*x**4)/2)-((15*x**3)/2)-((9*x**2)/2)-9*x-(13/2)\nq = ((19*x**5)/2)+5*x**4-((19*x**3)/2)+2*x**2+((7*x)/2)-5\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{31 x}{3}-\\frac{34}{3}}+\\sqrt{\\frac{4}{3}-\\frac{2 x}{3}}=\\frac{34}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-41454+136 \\sqrt{22094}}{2523}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((31*x)/3)-(34/3))+sqrt((4/3)-((2*x)/3)), (34/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x^3+8 x^2-3 x-9$ and $2 x+3$.", + "Output Answer": [ + "$2 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x**3+8*x**2-3*x-9, 2*x+3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-9 x-18 y-18=0$, $14 x+17 y+24=0$", + "Output Answer": [ + "$x=-\\frac{14}{11}$, $y=-\\frac{4}{11}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-9*x-18*y-18, 14*x+17*y+24), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{20}{7}-\\frac{86 x}{7}}+\\sqrt{\\frac{53}{7}-\\frac{x}{7}}=\\frac{75}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-101802+60 \\sqrt{795965}}{10115}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((20/7)-((86*x)/7))+sqrt((53/7)-(x/7)), (75/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{5}, \\frac{1}{2}, \\frac{1}{4})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{141}}{20},\\tan ^{-1}\\left(\\frac{2 \\sqrt{29}}{5}\\right),\\tan ^{-1}\\left(\\frac{5}{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/5)\ny = (1/2)\nz = (1/4)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-6 x^2-48 x+54$", + "Output Answer": [ + "$6 (-x-9) (x-1)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-6*x**2-48*x+54, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $13 x^2-11 x-6$", + "Output Answer": [ + "$13 \\left(x-\\frac{11}{26}\\right)^2-\\frac{433}{52}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (13*x**2-11*x-6), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{9 x^2}{\\sqrt{2}}-\\frac{9 x}{\\sqrt{2}}+\\frac{1}{\\sqrt{2}}$ and $q(x) = \\frac{11 x}{\\sqrt{2}}-\\frac{13}{\\sqrt{2}}$", + "Output Answer": [ + "$-\\frac{99 x^3}{2}+9 x^2+64 x-\\frac{13}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((9*x**2)/(sqrt(2)))-((9*x)/(sqrt(2)))+(1/(sqrt(2)))\nq = ((11*x)/(sqrt(2)))-(13/(sqrt(2)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{11 \\left(\\cos \\left(\\frac{7}{5}\\right)+i \\sin \\left(\\frac{7}{5}\\right)\\right)}{\\sqrt{2}}\\right)^9$", + "Output Answer": [ + "$-\\frac{2357947691 \\left(\\cos \\left(\\frac{63}{5}\\right)+i \\sin \\left(\\frac{63}{5}\\right)\\right)}{16 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((11*(math.cos((7/5))+1j*math.sin((7/5))))/(math.sqrt(2))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{5 x^2}{\\sqrt{3}}+\\sqrt{3} x+\\frac{17}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{5 \\left(x+\\frac{3}{10}\\right)^2}{\\sqrt{3}}-\\frac{3 \\sqrt{3}}{20}+\\frac{17}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((5*x**2)/(math.sqrt(3)))+math.sqrt(3)*x+(17/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2+7 x+5 y^2+10 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 (y+1)^2-10 \\left(x-\\frac{7}{20}\\right)^2=-\\frac{89}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{20} \\left(7-\\sqrt{267}\\right) & -1 \\\\\n \\frac{1}{20} \\left(7+\\sqrt{267}\\right) & -1 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{20} \\left(7-\\sqrt{267}\\right)+\\frac{1}{20} \\left(7+\\sqrt{267}\\right)\\right),-1\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{2} x+\\frac{1}{20} \\left(-20-7 \\sqrt{2}\\right),y=\\frac{1}{20} \\left(7 \\sqrt{2}-20\\right)-\\sqrt{2} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2+7*x+5*y**2+10*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-x-3 y^2-4 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x-\\frac{1}{16}\\right)^2-3 \\left(y+\\frac{2}{3}\\right)^2=\\frac{835}{96}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{48} \\left(3-\\sqrt{9185}\\right) & -\\frac{2}{3} \\\\\n \\frac{1}{48} \\left(3+\\sqrt{9185}\\right) & -\\frac{2}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{11}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{48} \\left(3-\\sqrt{9185}\\right)+\\frac{1}{48} \\left(3+\\sqrt{9185}\\right)\\right),-\\frac{2}{3}\\right\\}$\nAsymptotes: $\\left\\{y=2 \\sqrt{\\frac{2}{3}} x+\\frac{1}{24} \\left(-16-\\sqrt{6}\\right),y=\\frac{1}{24} \\left(\\sqrt{6}-16\\right)-2 \\sqrt{\\frac{2}{3}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-x-3*y**2-4*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{22}{5}-\\frac{3 i}{5}$ and $y=\\frac{1}{5}-\\frac{2 i}{5}$", + "Output Answer": [ + "$-\\frac{23}{5}-\\frac{i}{5}$" + ], + "Output Program": [ + "i = 1j\nx = -(22/5)-((3*i)/5)\ny = (1/5)-((2*i)/5)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{103}+\\sqrt{167}$.", + "Output Answer": [ + "$\\sqrt{103}+\\sqrt{167}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(103)+sqrt(167))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-10 x^3-60 x^2+2950 x+3000$", + "Output Answer": [ + "$10 (-x-20) (x-15) (x+1)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-10*x**3-60*x**2+2950*x+3000, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -15 x^2-4 x-14\\right| =24$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{15} \\left(-2-\\sqrt{154}\\right)\\right\\},\\left\\{x\\to \\frac{1}{15} \\left(-2+\\sqrt{154}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-15*x**2-4*x-14), 24), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -18 x^2+15 x-\\frac{46}{7}\\right| =-\\frac{143}{7}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-18*x**2+15*x-(46/7)), -(143/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^6-5 x^5-\\frac{19 x^4}{2}-\\frac{19 x^3}{2}-3 x^2+6 x-\\frac{17}{2}$ when divided by $\\frac{x^3}{2}+3 x^2-3 x-\\frac{3}{2}$.", + "Output Answer": [ + "$6 x^3-46 x^2+293 x-2035$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**6-5*x**5-((19*x**4)/2)-((19*x**3)/2)-3*x**2+6*x-(17/2)\nq = ((x**3)/2)+3*x**2-3*x-(3/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x-8}=13$", + "Output Answer": [ + "$\\{\\{x\\to 177\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x-8), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2-\\frac{495 x}{2}+\\frac{2717}{2}$", + "Output Answer": [ + "$11 \\left(\\frac{19}{2}-x\\right) (13-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2-((495*x)/2)+(2717/2), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3 x-14}+\\sqrt{11 x+7}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{32} \\left(763-11 \\sqrt{2593}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3*x-14)+sqrt(11*x+7), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4$ and $-x-5$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4, -x-5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5-\\frac{17 x}{4}}+\\sqrt{-4 x-\\frac{1}{2}}=\\frac{45}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-66737+180 \\sqrt{137346}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5-((17*x)/4))+sqrt(-4*x-(1/2)), (45/4)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$e^{e^{6 x+4}}$", + "Output Answer": [ + "$y>1$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(math.e**(math.e**(6*x+4)), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{x^4}{3}+x^3+\\frac{29 x^2}{3}+\\frac{16 x}{3}-\\frac{2}{3}$ when divided by $-\\frac{11 x^4}{3}+\\frac{14 x^3}{3}-\\frac{16 x^2}{3}+\\frac{28 x}{3}+\\frac{8}{3}$.", + "Output Answer": [ + "$\\frac{1}{11}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((x**4)/3)+x**3+((29*x**2)/3)+((16*x)/3)-(2/3)\nq = -((11*x**4)/3)+((14*x**3)/3)-((16*x**2)/3)+((28*x)/3)+(8/3)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $x^5+6 x^4-6 x^3+5 x^2+3 x-8$ when divided by $5 x^3+5 x^2-2 x-2$.", + "Output Answer": [ + "$\\frac{x^2}{5}+x-\\frac{53}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**5+6*x**4-6*x**3+5*x**2+3*x-8\nq = 5*x**3+5*x**2-2*x-2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{67 x^2}{7}-\\frac{74 x}{7}-\\frac{50}{7}$", + "Output Answer": [ + "$\\frac{67}{7} \\left(x-\\frac{37}{67}\\right)^2-\\frac{4719}{469}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((67*x**2)/7)-((74*x)/7)-(50/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt{\\frac{11 x}{5}+9}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{45}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(sqrt(((11*x)/5)+9), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\sin \\left(\\frac{13 \\pi }{90}\\right)-i \\cos \\left(\\frac{13 \\pi }{90}\\right)$.", + "Output Answer": [ + "Norm: $\\sqrt{\\sin ^2\\left(\\frac{13 \\pi }{90}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{90}\\right)}$\nArgument: $-\\frac{29 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.sin(((13*math.pi)/90))-i*math.cos(((13*math.pi)/90))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{8 x^2}{\\sqrt{3}}-\\sqrt{3} x+\\sqrt{3}$", + "Output Answer": [ + "$x=\\frac{1}{16} \\left(\\sqrt{105}-3\\right)\\lor x=\\frac{1}{16} \\left(-3-\\sqrt{105}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((8*x**2)/(sqrt(3)))-sqrt(3)*x+sqrt(3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\left(320 t^2+1200 t+1133\\right)^2, x(t)=64 t^2+240 t+225$", + "Output Answer": [ + "$y=25 x^2+80 x+64$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (320*t**2+1200*t+1133)**2\nx_t = 64*t**2+240*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=i \\pi$ and $y=(3+i) \\pi$", + "Output Answer": [ + "$(-1+3 i) \\pi ^2$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = i*math.pi\ny = (3+i)*math.pi\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-2 x+9 y^2-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x-\\frac{1}{5}\\right)^2+9 y^2=\\frac{26}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{15} \\left(3-2 \\sqrt{26}\\right) & 0 \\\\\n \\frac{1}{15} \\left(3+2 \\sqrt{26}\\right) & 0 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{15} \\left(3-2 \\sqrt{26}\\right)+\\frac{1}{15} \\left(3+2 \\sqrt{26}\\right)\\right),0\\right\\}$\nArea Enclosed: $\\frac{26 \\pi }{15 \\sqrt{5}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-2*x+9*y**2-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{87}{86}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$-\\frac{206973}{86}$" + ], + "Output Program": [ + "a = (87/86) # initial value\nd = -6 # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (87/86) # initial value\nd = -6 # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 10 x^2-13 x-2$, $q(x) = -14 x^2-6 x+13$", + "Output Answer": [ + "$-4 x^2-19 x+11$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x**2-13*x-2\nq = -14*x**2-6*x+13\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-21 x-11 y+14=0$, $10 x+2 y-21=0$", + "Output Answer": [ + "$x=\\frac{203}{68}$, $y=-\\frac{301}{68}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-21*x-11*y+14, 10*x+2*y-21), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{2+i}{\\sqrt{3}}$ and $y=\\frac{13-10 i}{\\sqrt{3}}$", + "Output Answer": [ + "$(-5+3 i) \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((2+i)/(math.sqrt(3)))\ny = ((13-10*i)/(math.sqrt(3)))\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{69}{70}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$\\frac{67353}{35}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(69/70) # initial value\nd = 6 # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(69/70) # initial value\nd = 6 # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 14 \\left(x^2-x-1\\right)$, $q(x) = -14 x^2-10 x-9$", + "Output Answer": [ + "$-24 x-23$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 14*(x**2-x-1)\nq = -14*x**2-10*x-9\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 6 x^2+13 x+15$ and $q(x) = 4 x^2+15 x+8$", + "Output Answer": [ + "$24 x^4+142 x^3+303 x^2+329 x+120$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 6*x**2+13*x+15\nq = 4*x**2+15*x+8\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$x-7 y+25=0$, $10 x-7 y-12=0$", + "Output Answer": [ + "$x=\\frac{37}{9}$, $y=\\frac{262}{63}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((x-7*y+25, 10*x-7*y-12), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2-3 x-2 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $2 x^2-3 x-2 y=10$\nVertex: $\\left\\{\\frac{3}{4},-\\frac{89}{16}\\right\\}$\nDirectrix: $y=-\\frac{93}{16}$\nFocal Parameter: $\\frac{1}{2}$\nFocus: $\\left\\{\\frac{3}{4},-\\frac{85}{16}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2-3*x-2*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-18 x^2+15 x+23}{-15 x^2+9 x-5}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(5-\\sqrt{209}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(5+\\sqrt{209}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-18*x**2+15*x+23)/(-15*x**2+9*x-5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{97}{71}$, and $a_n=a_{n-1}+-9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$-\\frac{123350}{71}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(97/71) # initial value\nd = -9 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(97/71) # initial value\nd = -9 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sqrt[3]{-8 x-\\frac{1}{2}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(-2 y^3-1\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, cbrt(-8*x-(1/2)))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $2 x^3+4 x^2-526 x-2040$", + "Output Answer": [ + "$-2 (-x-15) (-x-4) (17-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(2*x**3+4*x**2-526*x-2040, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-46$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$-1012$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -46 # initial value\nd = 0 # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -46 # initial value\nd = 0 # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2-\\frac{38 x}{3}-48$", + "Output Answer": [ + "$2 \\left(-x-\\frac{8}{3}\\right) (9-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2-((38*x)/3)-48, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\left(\\frac{2}{17}-10\\right)+5}{\\left(\\frac{1}{13} (15+15)^2+25\\right)-13}$.", + "Output Answer": [ + "$-\\frac{1079}{17952}$" + ], + "Output Program": [ + "try: \n print(((((2/17)-10)+5)/(((1/13)*(15+15)**2+25)-13)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{144 x^2+235 x+76}{256 x+304}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{4}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((144*x**2+235*x+76)/(256*x+304)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{17 x^2}{7}+\\frac{61 x}{7}-\\frac{58}{7}}{-\\frac{48 x}{7}-\\frac{149}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{34} \\left(-61-\\sqrt{7665}\\right)\\right\\},\\left\\{x\\to \\frac{1}{34} \\left(-61+\\sqrt{7665}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((17*x**2)/7)+((61*x)/7)-(58/7))/(-((48*x)/7)-(149/7))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-13 x^2-19 x+20}{-11 x-23}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{26} \\left(-19-\\sqrt{1401}\\right)\\right\\},\\left\\{x\\to \\frac{1}{26} \\left(-19+\\sqrt{1401}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-13*x**2-19*x+20)/(-11*x-23)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{81 x^2}{7}+\\frac{18 x}{7}+\\frac{55}{7}$", + "Output Answer": [ + "$x=\\frac{1}{9} \\left(-1-3 i \\sqrt{6}\\right)\\lor x=\\frac{1}{9} \\left(-1+3 i \\sqrt{6}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((81*x**2)/7)+((18*x)/7)+(55/7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $x^2-14 x+7$", + "Output Answer": [ + "$x=7-\\sqrt{42}\\lor x=7+\\sqrt{42}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(x**2-14*x+7, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2+7 x+2 y^2-y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(y-\\frac{1}{4}\\right)^2-7 \\left(x-\\frac{1}{2}\\right)^2=\\frac{19}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & \\frac{1}{28} \\left(7-3 \\sqrt{133}\\right) \\\\\n \\frac{1}{2} & \\frac{1}{28} \\left(7+3 \\sqrt{133}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{7}}$\nCenter: $\\left\\{\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{28} \\left(7-3 \\sqrt{133}\\right)+\\frac{1}{28} \\left(7+3 \\sqrt{133}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{4} \\left(1+\\sqrt{14}\\right)-\\sqrt{\\frac{7}{2}} x,y=\\sqrt{\\frac{7}{2}} x+\\frac{1}{4} \\left(1-\\sqrt{14}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2+7*x+2*y**2-y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{27}{4} \\left(\\cos \\left(\\frac{17}{15}\\right)+i \\sin \\left(\\frac{17}{15}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-\\frac{10460353203 \\left(\\cos \\left(\\frac{119}{15}\\right)+i \\sin \\left(\\frac{119}{15}\\right)\\right)}{16384}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(27/4)*(math.cos((17/15))+1j*math.sin((17/15))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{8 x^4}{3}-\\frac{11 x^3}{3}-3 x^2-4 x+3$ and $-\\frac{8 x^4}{3}-\\frac{11 x^3}{3}-3 x^2-4 x+3$.", + "Output Answer": [ + "$\\frac{8 x^4}{3}+\\frac{11 x^3}{3}+3 x^2+4 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((8*x**4)/3)-((11*x**3)/3)-3*x**2-4*x+3, -((8*x**4)/3)-((11*x**3)/3)-3*x**2-4*x+3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^5-11 x^4+7 x^3+16 x^2+7 x-15$ and $-4 x^4+x^3+4 x^2+4 x-5$.", + "Output Answer": [ + "$4 x^4-x^3-4 x^2-4 x+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**5-11*x**4+7*x**3+16*x**2+7*x-15, -4*x**4+x**3+4*x**2+4*x-5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $-\\tan ^{-1}\\left(\\frac{13}{2}-3 x\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{\\tan (y)}{3}+\\frac{13}{6}\\text{ if }-\\frac{\\pi }{2} 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$\\frac{9}{2} \\left(8 \\sqrt{5}-\\frac{18}{5}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(9/5) # initial value\nd = math.sqrt(5) # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(9/5) # initial value\nd = math.sqrt(5) # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{3}{23}$, and $a_n=a_{n-1}+-\\frac{11}{\\sqrt{2}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$\\frac{5}{2} \\left(-\\frac{6}{23}-22 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(3/23) # initial value\nd = -(11/(math.sqrt(2))) # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(3/23) # initial value\nd = -(11/(math.sqrt(2))) # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((((15+7)+21)+3)+9)+(((14+14)+21)-8)$.", + "Output Answer": [ + "$96$" + ], + "Output Program": [ + "try: \n print(((((15+7)+21)+3)+9)+(((14+14)+21)-8))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 14 x-10| =10$", + "Output Answer": [ + "$\\left\\{\\{x\\to 0\\},\\left\\{x\\to \\frac{10}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(14*x-10), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-x^2-6 x+8 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-x^2-6 x+8 y=1$\nVertex: $\\{-3,-1\\}$\nDirectrix: $y=-3$\nFocal Parameter: $4$\nFocus: $\\{-3,1\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-x**2-6*x+8*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -3 x^2-8 x-\\frac{23}{2}$ and $q(x) = -\\frac{7 x^2}{2}-14 x+\\frac{21}{2}$", + "Output Answer": [ + "$\\frac{21 x^4}{2}+70 x^3+\\frac{483 x^2}{4}+77 x-\\frac{483}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -3*x**2-8*x-(23/2)\nq = -((7*x**2)/2)-14*x+(21/2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x^2+2 x+5$ and $-4 x^3-3 x^2-x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x**2+2*x+5, -4*x**3-3*x**2-x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{68}{47}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{642}{47}$" + ], + "Output Program": [ + "a = -(68/47) # initial value\nd = 6 # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(68/47) # initial value\nd = 6 # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-112 x^2-154 x-49}{196 x^2+448 x+175}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-112*x**2-154*x-49)/(196*x**2+448*x+175)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 11-25 x| =19$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{8}{25}\\right\\},\\left\\{x\\to \\frac{6}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11-25*x), 19), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{23}{20}$, and $a_n=a_{n-1}+5 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$9 \\left(85 \\sqrt{3}-\\frac{23}{10}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(23/20) # initial value\nd = 5*math.sqrt(3) # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(23/20) # initial value\nd = 5*math.sqrt(3) # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x+5$ and $-3 x^2-5 x+2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x+5, -3*x**2-5*x+2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{27} \\left(225 t^2+780 t+652\\right)^2, x(t)=75 t^2+260 t+\\frac{676}{3}$", + "Output Answer": [ + "$y=\\frac{x^2}{3}-\\frac{16 x}{3}+\\frac{64}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/27)*(225*t**2+780*t+652)**2\nx_t = 75*t**2+260*t+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{11 t}{2}+5 \\sqrt{2}-\\frac{21}{2}, x(t)=\\frac{11 t}{\\sqrt{2}}-\\frac{21}{\\sqrt{2}}$", + "Output Answer": [ + "$y=\\frac{x}{\\sqrt{2}}+5 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = ((11*t)/2)+5*sqrt(2)-(21/2)\nx_t = ((11*t)/(sqrt(2)))-(21/(sqrt(2)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-(5 x-2)^2 \\tan \\left(3 x^3+6\\right)$ at the point $x=7$", + "Output Answer": [ + "$-1089 \\tan (1035) = -6979.55$" + ], + "Output Program": [ + "import math\n\nx = 7\ntry: \n f = -(5*x-2)**2*math.tan(3*x**3+6)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2-4 x+y^2-8 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $2 (x-1)^2+(y-4)^2=24$\nFoci: $\\left(\n\\begin{array}{cc}\n 1 & 4-2 \\sqrt{3} \\\\\n 1 & 2 \\left(2+\\sqrt{3}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{1,\\frac{1}{2} \\left(4-2 \\sqrt{3}+2 \\left(2+\\sqrt{3}\\right)\\right)\\right\\}$\nArea Enclosed: $12 \\sqrt{2} \\pi$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2-4*x+y**2-8*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{48}{7}+\\frac{10 i}{7}$ and $y=\\frac{32}{7}-\\frac{69 i}{7}$", + "Output Answer": [ + "$\\frac{846}{5785}+\\frac{3632 i}{5785}$" + ], + "Output Program": [ + "i = 1j\nx = (48/7)+((10*i)/7)\ny = (32/7)-((69*i)/7)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 x^2 \\log (2)-5 x \\log (2)+13 \\log (2)$ and $q(x) = 21 x^2 \\log (2)-3 x \\log (2)-16 \\log (2)$", + "Output Answer": [ + "$42 x^4 \\log ^2(2)-111 x^3 \\log ^2(2)+256 x^2 \\log ^2(2)+41 x \\log ^2(2)-208 \\log ^2(2)$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*x**2*log(2)-5*x*log(2)+13*log(2)\nq = 21*x**2*log(2)-3*x*log(2)-16*log(2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $6 x^2-18 x-\\frac{24300}{49}$", + "Output Answer": [ + "$-6 \\left(-x-\\frac{54}{7}\\right) \\left(x-\\frac{75}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(6*x**2-18*x-(24300/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(3+5 i) \\sqrt{3}$ and $y=(-3-2 i) \\sqrt{3}$", + "Output Answer": [ + "$-\\frac{19}{13}-\\frac{9 i}{13}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (3+5*i)*math.sqrt(3)\ny = (-3-2*i)*math.sqrt(3)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 14 x^2-11 x-16\\right| =23$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{28} \\left(11-\\sqrt{2305}\\right)\\right\\},\\left\\{x\\to \\frac{1}{28} \\left(11+\\sqrt{2305}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(14*x**2-11*x-16), 23), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\frac{23}{22}+24\\right)-14\\right)-(14-3)$.", + "Output Answer": [ + "$\\frac{1}{22}$" + ], + "Output Program": [ + "try: \n print((((23/22)+24)-14)-(14-3))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\sqrt{3} \\left(\\cos \\left(\\frac{7 \\pi }{30}\\right)+i \\sin \\left(\\frac{7 \\pi }{30}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\sqrt{3 \\left(\\sin ^2\\left(\\frac{7 \\pi }{30}\\right)+\\cos ^2\\left(\\frac{7 \\pi }{30}\\right)\\right)}$\nArgument: $-\\frac{23 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.sqrt(3)*(math.cos(((7*math.pi)/30))+i*math.sin(((7*math.pi)/30)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-5 y^2+3 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 x^2-5 \\left(y-\\frac{3}{10}\\right)^2=-\\frac{89}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n 0 & \\frac{1}{40} \\left(12-\\sqrt{2314}\\right) \\\\\n 0 & \\frac{1}{40} \\left(12+\\sqrt{2314}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{13}{2}}}{2}$\nCenter: $\\left\\{0,\\frac{1}{2} \\left(\\frac{1}{40} \\left(12-\\sqrt{2314}\\right)+\\frac{1}{40} \\left(12+\\sqrt{2314}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3}{10}-2 \\sqrt{\\frac{2}{5}} x,y=2 \\sqrt{\\frac{2}{5}} x+\\frac{3}{10}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-5*y**2+3*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\sqrt{2} \\left(\\cos \\left(\\frac{61}{90}\\right)+i \\sin \\left(\\frac{61}{90}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$1073741824 \\left(\\cos \\left(\\frac{122}{15}\\right)+i \\sin \\left(\\frac{122}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*math.sqrt(2)*(math.cos((61/90))+1j*math.sin((61/90))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x-10}+\\sqrt{10 x-14}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(680-13 \\sqrt{2519}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x-10)+sqrt(10*x-14), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+4 x-y^2+6 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x+\\frac{1}{4}\\right)^2-(y-3)^2=-\\frac{9}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{4} & \\frac{3}{4} \\\\\n -\\frac{1}{4} & \\frac{21}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2 \\sqrt{2}}$\nCenter: $\\left\\{-\\frac{1}{4},3\\right\\}$\nAsymptotes: $\\left\\{y=-2 \\sqrt{2} x-\\frac{1}{\\sqrt{2}}+3,y=2 \\sqrt{2} x+\\frac{1}{\\sqrt{2}}+3\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+4*x-y**2+6*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{37}{35}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$\\frac{243}{7}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(37/35) # initial value\nd = 4 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(37/35) # initial value\nd = 4 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=1-\\frac{14 i}{5}$ and $y=-\\frac{18}{5}-\\frac{41 i}{5}$", + "Output Answer": [ + "$\\frac{484}{2005}+\\frac{457 i}{2005}$" + ], + "Output Program": [ + "i = 1j\nx = 1-((14*i)/5)\ny = -(18/5)-((41*i)/5)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-8-\\frac{20 i}{3}$ and $y=8+2 i$", + "Output Answer": [ + "$-\\frac{58}{51}-\\frac{28 i}{51}$" + ], + "Output Program": [ + "i = 1j\nx = -8-((20*i)/3)\ny = 8+2*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3$ and $4 x^3-5 x^2-4 x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3, 4*x**3-5*x**2-4*x-3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\sqrt{5} x^2-3 \\sqrt{5} x+4 \\sqrt{5}$ and $q(x) = -2 \\sqrt{5} x^2+5 \\sqrt{5} x+5 \\sqrt{5}$", + "Output Answer": [ + "$-10 x^4+55 x^3-90 x^2+25 x+100$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = sqrt(5)*x**2-3*sqrt(5)*x+4*sqrt(5)\nq = -2*sqrt(5)*x**2+5*sqrt(5)*x+5*sqrt(5)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\left(\\left((9-7)^2-10\\right)+2\\right)^2+23}{15-14}$.", + "Output Answer": [ + "$39$" + ], + "Output Program": [ + "try: \n print((((((9-7)**2-10)+2)**2+23)/(15-14)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{2 x^2}{5}-\\frac{23 x}{5}+\\frac{48}{5}$", + "Output Answer": [ + "$\\frac{2}{5} \\left(x-\\frac{23}{4}\\right)^2-\\frac{29}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((2*x**2)/5)-((23*x)/5)+(48/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^4-3 x^3-\\frac{x^2}{2}-\\frac{5 x}{2}+\\frac{9}{2}$ when divided by $\\frac{17 x}{2}$.", + "Output Answer": [ + "$-\\frac{18 x^3}{17}-\\frac{6 x^2}{17}-\\frac{x}{17}-\\frac{5}{17}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**4-3*x**3-((x**2)/2)-((5*x)/2)+(9/2)\nq = ((17*x)/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{61}-50}{\\sqrt{191}+65}$.", + "Output Answer": [ + "$\\frac{\\sqrt{61}-50}{65+\\sqrt{191}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(61)-50)/(sqrt(191)+65)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{5}}, 2, \\frac{1}{4})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{\\frac{341}{5}}}{4},\\tan ^{-1}\\left(4 \\sqrt{\\frac{21}{5}}\\right),\\tan ^{-1}\\left(2 \\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(5)))\ny = 2\nz = (1/4)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-6 x+10 y^2-4 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x-\\frac{3}{5}\\right)^2+10 \\left(y-\\frac{1}{5}\\right)^2=\\frac{16}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{5} \\left(3-2 \\sqrt{2}\\right) & \\frac{1}{5} \\\\\n \\frac{1}{5} \\left(3+2 \\sqrt{2}\\right) & \\frac{1}{5} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{5} \\left(3-2 \\sqrt{2}\\right)+\\frac{1}{5} \\left(3+2 \\sqrt{2}\\right)\\right),\\frac{1}{5}\\right\\}$\nArea Enclosed: $\\frac{8 \\sqrt{2} \\pi }{25}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-6*x+10*y**2-4*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\left(\\cos \\left(\\frac{59}{45}\\right)+i \\sin \\left(\\frac{59}{45}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$16 \\left(\\cos \\left(\\frac{236}{45}\\right)+i \\sin \\left(\\frac{236}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*(math.cos((59/45))+1j*math.sin((59/45))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2-7 x-6 y^2+5 y+9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(x-\\frac{7}{20}\\right)^2-6 \\left(y-\\frac{5}{12}\\right)^2=-\\frac{529}{60}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{7}{20} & -\\frac{67}{60} \\\\\n \\frac{7}{20} & \\frac{39}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{5}}$\nCenter: $\\left\\{\\frac{7}{20},\\frac{5}{12}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{60} \\left(25+7 \\sqrt{15}\\right)-\\sqrt{\\frac{5}{3}} x,y=\\sqrt{\\frac{5}{3}} x+\\frac{1}{60} \\left(25-7 \\sqrt{15}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2-7*x-6*y**2+5*y+9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sqrt[3]{\\frac{11 x}{3}+\\frac{5}{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{11} \\left(3 y^3-5\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, cbrt(((11*x)/3)+(5/3)))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-14 \\sqrt{3} x-12 \\sqrt{3} y-5 \\sqrt{3} z+9 \\sqrt{3}=0$, $-\\sqrt{3} x+9 \\sqrt{3} y-13 \\sqrt{3} z+2 \\sqrt{3}=0$, $12 \\sqrt{3} x-8 \\sqrt{3} y-3 \\sqrt{3} z+\\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{485}{2121}$, $y=\\frac{234}{707}$, $z=\\frac{775}{2121}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-14*sqrt(3)*x-12*sqrt(3)*y-5*sqrt(3)*z+9*sqrt(3), -sqrt(3)*x+9*sqrt(3)*y-13*sqrt(3)*z+2*sqrt(3), 12*sqrt(3)*x-8*sqrt(3)*y-3*sqrt(3)*z+sqrt(3))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-13 x^2-8 x+1$", + "Output Answer": [ + "$x=\\frac{1}{13} \\left(-4-\\sqrt{29}\\right)\\lor x=\\frac{1}{13} \\left(\\sqrt{29}-4\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-13*x**2-8*x+1, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{7 x^3}{4}+\\frac{17 x^2}{4}-\\frac{11 x}{2}-\\frac{15}{2}$ and $\\frac{7 x^2}{2}-2 x-5$.", + "Output Answer": [ + "$\\frac{7 x^2}{4}-x-\\frac{5}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((7*x**3)/4)+((17*x**2)/4)-((11*x)/2)-(15/2), ((7*x**2)/2)-2*x-5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2+12 x-832$", + "Output Answer": [ + "$-4 (13-x) (x+16)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2+12*x-832, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(\\cos \\left(\\frac{11}{30}\\right)+i \\sin \\left(\\frac{11}{30}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-40353607 \\left(\\cos \\left(\\frac{33}{10}\\right)+i \\sin \\left(\\frac{33}{10}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(math.cos((11/30))+1j*math.sin((11/30))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $14 x^2+7 x+3$", + "Output Answer": [ + "$x=\\frac{1}{28} \\left(-7-i \\sqrt{119}\\right)\\lor x=\\frac{1}{28} \\left(-7+i \\sqrt{119}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(14*x**2+7*x+3, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\tan (5-x)$ at the point $x=-1$", + "Output Answer": [ + "$-\\tan (6) = 0.291$" + ], + "Output Program": [ + "import math\n\nx = -1\ntry: \n f = -math.tan(5-x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -8 (2 x-1)^3, q(x) = (7 x+3)^4$", + "Output Answer": [ + "$2401 x^4+4052 x^3+2742 x^2+708 x+89$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*(2*x-1)**3\nq = (7*x+3)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x-\\frac{101}{7}}+\\sqrt{\\frac{65 x}{7}-\\frac{19}{7}}=\\frac{85}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{243454-85 \\sqrt{675983}}{11774}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x-(101/7))+sqrt(((65*x)/7)-(19/7)), (85/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{22 x^2}{5}-\\frac{71 x}{5}-\\frac{22}{5}$", + "Output Answer": [ + "$\\frac{22}{5} \\left(x-\\frac{71}{44}\\right)^2-\\frac{6977}{440}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((22*x**2)/5)-((71*x)/5)-(22/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{32}{11}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$-\\frac{160}{11}$" + ], + "Output Program": [ + "a = -(32/11) # initial value\nd = 0 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(32/11) # initial value\nd = 0 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 \\sqrt{5} \\left(5 t^2+35 t+62\\right), x(t)=20 t^2+140 t+245$", + "Output Answer": [ + "$y=\\sqrt{5} x+3 \\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*sqrt(5)*(5*t**2+35*t+62)\nx_t = 20*t**2+140*t+245\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{87 x^2}{7}-\\frac{53 x}{7}-\\frac{40}{7}$", + "Output Answer": [ + "$\\frac{87}{7} \\left(x-\\frac{53}{174}\\right)^2-\\frac{16729}{2436}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((87*x**2)/7)-((53*x)/7)-(40/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((5+4)+3)+1)-((22+11)-24)$.", + "Output Answer": [ + "$4$" + ], + "Output Program": [ + "try: \n print((((5+4)+3)+1)-((22+11)-24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -2 x^2-11 x-4$, $q(x) = 9 x^2+10 x+6$", + "Output Answer": [ + "$7 x^2-x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**2-11*x-4\nq = 9*x**2+10*x+6\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 15 \\sqrt{2}-2 \\sqrt{2} x\\right| =5 \\sqrt{2}$", + "Output Answer": [ + "$\\{\\{x\\to 5\\},\\{x\\to 10\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(15*sqrt(2)-2*sqrt(2)*x), 5*sqrt(2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{7} (61-30 x), q(x) = \\frac{58 x}{7}-4$", + "Output Answer": [ + "$4 x+\\frac{33}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/7)*(61-30*x)\nq = ((58*x)/7)-4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-125 t^2-750 t-1117, x(t)=25 t^2+150 t+225$", + "Output Answer": [ + "$y=8-5 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -125*t**2-750*t-1117\nx_t = 25*t**2+150*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 11 x-20| =16$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{4}{11}\\right\\},\\left\\{x\\to \\frac{36}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11*x-20), 16), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{12}{17}$, and $a_n=a_{n-1}+-\\frac{37}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$-\\frac{157757}{85}$" + ], + "Output Program": [ + "a = (12/17) # initial value\nd = -(37/5) # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (12/17) # initial value\nd = -(37/5) # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{93}{41}$, and $a_n=a_{n-1}+-2 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$\\frac{29}{2} \\left(\\frac{186}{41}-56 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (93/41) # initial value\nd = -2*math.pi # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (93/41) # initial value\nd = -2*math.pi # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 10 \\sqrt{3} x+7 \\sqrt{3}\\right| =\\frac{13}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{17}{15}\\right\\},\\left\\{x\\to -\\frac{4}{15}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(10*sqrt(3)*x+7*sqrt(3)), (13/(sqrt(3)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{14}{15}$, and $a_n=a_{n-1}+\\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$13 \\left(25 \\sqrt{3}-\\frac{28}{15}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(14/15) # initial value\nd = math.sqrt(3) # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(14/15) # initial value\nd = math.sqrt(3) # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (7, \\sqrt{3}, \\sqrt{2})$", + "Output Answer": [ + "$\\left\\{3 \\sqrt{6},\\tan ^{-1}\\left(\\sqrt{26}\\right),\\tan ^{-1}\\left(\\frac{\\sqrt{3}}{7}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 7\ny = math.sqrt(3)\nz = math.sqrt(2)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-14 x-7}+\\sqrt{8-x}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{169} \\left(-3135+28 \\sqrt{4291}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-14*x-7)+sqrt(8-x), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{19 x^2}{\\sqrt{3}}-4 \\sqrt{3} x+5 \\sqrt{3}}{\\frac{26 x}{\\sqrt{3}}+\\frac{37}{\\sqrt{3}}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{19} \\left(-6-\\sqrt{321}\\right)\\right\\},\\left\\{x\\to \\frac{1}{19} \\left(-6+\\sqrt{321}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((19*x**2)/(sqrt(3)))-4*sqrt(3)*x+5*sqrt(3))/(((26*x)/(sqrt(3)))+(37/(sqrt(3))))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2-\\frac{1353 x}{7}-\\frac{41140}{49}$", + "Output Answer": [ + "$-11 \\left(-x-\\frac{68}{7}\\right) \\left(-x-\\frac{55}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2-((1353*x)/7)-(41140/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{15-24}{13}}{(23+8)+16}$.", + "Output Answer": [ + "$-\\frac{9}{611}$" + ], + "Output Program": [ + "try: \n print((((15-24)/13)/((23+8)+16)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 10 \\sqrt{3} x-12 \\sqrt{3}\\right| =12 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\{x\\to 0\\},\\left\\{x\\to \\frac{12}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(10*sqrt(3)*x-12*sqrt(3)), 12*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{38 x}{\\sqrt{3}}-\\frac{20 y}{\\sqrt{3}}-\\frac{17}{\\sqrt{3}}=0$, $-\\frac{26 x}{\\sqrt{3}}+\\frac{29 y}{\\sqrt{3}}+\\frac{10}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{293}{1622}$, $y=-\\frac{411}{811}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((38*x)/(sqrt(3)))-((20*y)/(sqrt(3)))-(17/(sqrt(3))), -((26*x)/(sqrt(3)))+((29*y)/(sqrt(3)))+(10/(sqrt(3)))), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{10 x^2}{\\sqrt{3}}-\\frac{14 x}{\\sqrt{3}}+\\frac{11}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{10} \\left(-7-\\sqrt{159}\\right)\\lor x=\\frac{1}{10} \\left(\\sqrt{159}-7\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((10*x**2)/(sqrt(3)))-((14*x)/(sqrt(3)))+(11/(sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 12 x^2 \\log (2)+16 x \\log (2)+18 \\log (2)$ and $q(x) = -14 x^2 \\log (2)+4 x \\log (2)-\\log (2)$", + "Output Answer": [ + "$-168 x^4 \\log ^2(2)-176 x^3 \\log ^2(2)-200 x^2 \\log ^2(2)+56 x \\log ^2(2)-18 \\log ^2(2)$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 12*x**2*log(2)+16*x*log(2)+18*log(2)\nq = -14*x**2*log(2)+4*x*log(2)-log(2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\cosh ^{-1}\\left(\\sin ^{-1}(7-5 x)\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} (7-\\sin (1))\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(acosh(asin(7-5*x)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$2 \\sqrt{3} x-\\frac{y}{\\sqrt{3}}+\\frac{29}{\\sqrt{3}}=0$, $\\frac{23 x}{\\sqrt{3}}-4 \\sqrt{3} y-8 \\sqrt{3}=0$", + "Output Answer": [ + "$x=-\\frac{372}{49}$, $y=-\\frac{811}{49}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((2*sqrt(3)*x-(y/(sqrt(3)))+(29/(sqrt(3))), ((23*x)/(sqrt(3)))-4*sqrt(3)*y-8*sqrt(3)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{58 x^2}{7}+\\frac{41 x}{7}-\\frac{135}{7}}{\\frac{36 x}{7}+\\frac{96}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{116} \\left(-41-\\sqrt{33001}\\right)\\right\\},\\left\\{x\\to \\frac{1}{116} \\left(-41+\\sqrt{33001}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((58*x**2)/7)+((41*x)/7)-(135/7))/(((36*x)/7)+(96/7))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $9 x^2+x+11$", + "Output Answer": [ + "$x=\\frac{1}{18} \\left(-1-i \\sqrt{395}\\right)\\lor x=\\frac{1}{18} \\left(-1+i \\sqrt{395}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(9*x**2+x+11, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x^2+4 x+2$ and $1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x**2+4*x+2, 1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(7+i) \\sqrt{2}$ and $y=(1+i) \\sqrt{2}$", + "Output Answer": [ + "$4-3 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (7+i)*math.sqrt(2)\ny = (1+i)*math.sqrt(2)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $2 \\sqrt{3} \\sqrt{-x}+\\sqrt{8 x+15}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{147}{100}\\right\\},\\left\\{x\\to -\\frac{3}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(2*sqrt(3)*sqrt(-x)+sqrt(8*x+15), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^5+x^4-5 x^3+6 x^2-10 x-7$ when divided by $-3 x^4-2 x^3-6 x^2-6 x-6$.", + "Output Answer": [ + "$3 x-\\frac{7}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**5+x**4-5*x**3+6*x**2-10*x-7\nq = -3*x**4-2*x**3-6*x**2-6*x-6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-198 x^2+269 x-91}{-132 x^2-59 x+91}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{13}{18}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-198*x**2+269*x-91)/(-132*x**2-59*x+91)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{1}{8} (((5-11)-15)-18)}{((20+21)-8)-23}$.", + "Output Answer": [ + "$-\\frac{39}{80}$" + ], + "Output Program": [ + "try: \n print((((1/8)*(((5-11)-15)-18))/(((20+21)-8)-23)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{48}{65}$, and $a_n=a_{n-1}+-3$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$-\\frac{22632}{65}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (48/65) # initial value\nd = -3 # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (48/65) # initial value\nd = -3 # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{17}{5} \\left(\\cos \\left(\\frac{3}{10}\\right)+i \\sin \\left(\\frac{3}{10}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-\\frac{34271896307633 \\left(\\cos \\left(\\frac{33}{10}\\right)+i \\sin \\left(\\frac{33}{10}\\right)\\right)}{48828125}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(17/5)*(math.cos((3/10))+1j*math.sin((3/10))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-16 x-8 y+23 z+15=0$, $25 x+24 y-9 z-12=0$, $17 x+4 y-12 z-1=0$", + "Output Answer": [ + "$x=-\\frac{813}{1057}$, $y=\\frac{2081}{2114}$, $z=-\\frac{893}{1057}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-16*x-8*y+23*z+15, 25*x+24*y-9*z-12, 17*x+4*y-12*z-1)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((10+1)-2)+1)-((((20+22)-9)-11)+16)$.", + "Output Answer": [ + "$-28$" + ], + "Output Program": [ + "try: \n print((((10+1)-2)+1)-((((20+22)-9)-11)+16))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{4} (175 t+321), x(t)=-\\frac{35 t}{4}-15$", + "Output Answer": [ + "$y=\\frac{21}{4}-5 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/4)*(175*t+321)\nx_t = -((35*t)/4)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x+4}+\\sqrt{8 x-10}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(827-18 \\sqrt{942}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x+4)+sqrt(8*x-10), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 15 x^2-10 x-8$ and $q(x) = 13 x^2+3 x+4$", + "Output Answer": [ + "$195 x^4-85 x^3-74 x^2-64 x-32$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 15*x**2-10*x-8\nq = 13*x**2+3*x+4\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (8, \\frac{1}{3}, \\frac{1}{2})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{2317}}{6},\\tan ^{-1}\\left(\\frac{2 \\sqrt{577}}{3}\\right),\\tan ^{-1}\\left(\\frac{1}{24}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 8\ny = (1/3)\nz = (1/2)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2-11 \\sqrt{3} x+990$", + "Output Answer": [ + "$-11 \\left(x-5 \\sqrt{3}\\right) \\left(x+6 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2-11*sqrt(3)*x+990, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\frac{3 x}{2}-8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2 y}{3}+\\frac{16}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, ((3*x)/2)-8)\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2+9 \\sqrt{2} x-18$", + "Output Answer": [ + "$2 \\left(\\frac{3}{\\sqrt{2}}-x\\right) \\left(x-3 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2+9*sqrt(2)*x-18, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{7 x^2}{3}+\\frac{34 x}{3}+14$", + "Output Answer": [ + "$\\frac{7}{3} \\left(x+\\frac{17}{7}\\right)^2+\\frac{5}{21}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((7*x**2)/3)+((34*x)/3)+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$\\frac{1}{x^{16}}$", + "Output Answer": [ + "$285212672 \\left(x-\\frac{1}{65536}\\right)^2-8192 \\left(x-\\frac{1}{65536}\\right)+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, (1/(x**16)))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-130 x^3+96 x^2+608 x-418}{528-240 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{26} \\left(-19-\\sqrt{1349}\\right)\\right\\},\\left\\{x\\to \\frac{1}{26} \\left(-19+\\sqrt{1349}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-130*x**3+96*x**2+608*x-418)/(528-240*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2-64 \\sqrt{3} x+\\frac{2048}{3}$", + "Output Answer": [ + "$-8 \\left(-x-\\frac{32}{\\sqrt{3}}\\right) \\left(\\frac{8}{\\sqrt{3}}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2-64*sqrt(3)*x+(2048/3), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{33}{4} \\left(-\\sin \\left(\\frac{\\pi }{90}\\right)-i \\cos \\left(\\frac{\\pi }{90}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$\\frac{1089}{16} \\left(-\\cos \\left(\\frac{\\pi }{45}\\right)+i \\sin \\left(\\frac{\\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((33/4)*(-math.sin((math.pi/90))-1j*math.cos((math.pi/90))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-2 x^2-10 x+7 y^2-10 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(y-\\frac{5}{7}\\right)^2-2 \\left(x+\\frac{5}{2}\\right)^2=-\\frac{55}{14}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{2}-\\frac{3 \\sqrt{55}}{14} & \\frac{5}{7} \\\\\n \\frac{3 \\sqrt{55}}{14}-\\frac{5}{2} & \\frac{5}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{7}}$\nCenter: $\\left\\{-\\frac{5}{2},\\frac{5}{7}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{2}{7}} x+\\frac{5}{14} \\left(2+\\sqrt{14}\\right),y=-\\sqrt{\\frac{2}{7}} x-\\frac{5}{14} \\left(\\sqrt{14}-2\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x**2-10*x+7*y**2-10*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{1}{24} \\left(\\frac{1}{11} (22-21)^2\\right)-12}{\\left(\\left(\\frac{17}{25}+3\\right)-6\\right)-3}$.", + "Output Answer": [ + "$\\frac{79175}{35112}$" + ], + "Output Program": [ + "try: \n print((((1/24)*((1/11)*(22-21)**2)-12)/((((17/25)+3)-6)-3)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{33 x}{5}+\\frac{68}{5}}+\\sqrt{\\frac{73 x}{5}-\\frac{3}{5}}=\\frac{74}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{74332-37 \\sqrt{3551071}}{1000}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((33*x)/5)+(68/5))+sqrt(((73*x)/5)-(3/5)), (74/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\cos \\left(e^{6 x+2}\\right)$ at the point $x=-5$", + "Output Answer": [ + "$\\cos \\left(\\frac{1}{e^{28}}\\right) = 1.$" + ], + "Output Program": [ + "import math\n\nx = -5\ntry: \n f = math.cos(math.e**(6*x+2))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-22 x^2-4 x-6}{-16 x^2+2 x-7}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-22*x**2-4*x-6)/(-16*x**2+2*x-7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{99}{28}$, and $a_n=a_{n-1}+\\frac{1}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$\\frac{120}{7}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (99/28) # initial value\nd = (1/2) # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (99/28) # initial value\nd = (1/2) # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2+8 x-\\frac{561}{4}$", + "Output Answer": [ + "$-\\left(\\left(\\frac{17}{2}-x\\right) \\left(x+\\frac{33}{2}\\right)\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2+8*x-(561/4), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{62}{75}$, and $a_n=a_{n-1}+\\frac{16}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{47358}{25}$" + ], + "Output Program": [ + "a = (62/75) # initial value\nd = (16/3) # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (62/75) # initial value\nd = (16/3) # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-x^2-7 x-3$", + "Output Answer": [ + "$\\frac{37}{4}-\\left(x+\\frac{7}{2}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-x**2-7*x-3), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{27}{125} (9 x+13)^3, q(x) = \\frac{1}{25} (9 x+41)^2$", + "Output Answer": [ + "$-\\frac{19683 x^3}{125}-\\frac{84888 x^2}{125}-\\frac{119511 x}{125}-\\frac{50914}{125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(27/125)*(9*x+13)**3\nq = (1/25)*(9*x+41)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((24+10)-1)+((((5+25)+20)-19)-5)$.", + "Output Answer": [ + "$59$" + ], + "Output Program": [ + "try: \n print(((24+10)-1)+((((5+25)+20)-19)-5))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{45 x^2}{7}-\\frac{52 x}{7}+\\frac{10}{7}$", + "Output Answer": [ + "$\\frac{1126}{315}-\\frac{45}{7} \\left(x+\\frac{26}{45}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((45*x**2)/7)-((52*x)/7)+(10/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 8-13 x| =6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{13}\\right\\},\\left\\{x\\to \\frac{14}{13}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(8-13*x), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{11}{2}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$-88$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(11/2) # initial value\nd = 0 # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(11/2) # initial value\nd = 0 # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $15 x^2+8 x+14$", + "Output Answer": [ + "$15 \\left(x+\\frac{4}{15}\\right)^2+\\frac{194}{15}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (15*x**2+8*x+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{5 x^2}{\\sqrt{3}}-\\frac{14 x}{\\sqrt{3}}+\\sqrt{3}}{-8 \\sqrt{3} x^2+11 \\sqrt{3} x+\\frac{14}{\\sqrt{3}}}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to -3\\},\\left\\{x\\to \\frac{1}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((5*x**2)/(sqrt(3)))-((14*x)/(sqrt(3)))+sqrt(3))/(-8*sqrt(3)*x**2+11*sqrt(3)*x+(14/(sqrt(3))))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-8 x^2-10 x-9$", + "Output Answer": [ + "$-8 \\left(x+\\frac{5}{8}\\right)^2-\\frac{47}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-8*x**2-10*x-9), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4-3 x$ and $x^5+x^4-4 x^3-5 x^2-4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4-3*x, x**5+x**4-4*x**3-5*x**2-4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{13 x^6}{2}+x^5+6 x^4-4 x^3+\\frac{17 x^2}{2}+5 x+6$ when divided by $-\\frac{19 x^5}{2}-10 x^4-\\frac{19 x^3}{2}+8 x^2+\\frac{9 x}{2}+8$.", + "Output Answer": [ + "$\\frac{13 x}{19}-\\frac{298}{361}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((13*x**6)/2)+x**5+6*x**4-4*x**3+((17*x**2)/2)+5*x+6\nq = -((19*x**5)/2)-10*x**4-((19*x**3)/2)+8*x**2+((9*x)/2)+8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{6}{13}+((((15-22)+1)+14)+2)$.", + "Output Answer": [ + "$\\frac{136}{13}$" + ], + "Output Program": [ + "try: \n print((6/13)+((((15-22)+1)+14)+2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{575 x^2+550 x}{276 x+264}=0$", + "Output Answer": [ + "$\\{\\{x\\to 0\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((575*x**2+550*x)/(276*x+264)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{41}{12}$, and $a_n=a_{n-1}+2$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$\\frac{791}{12}$" + ], + "Output Program": [ + "a = (41/12) # initial value\nd = 2 # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (41/12) # initial value\nd = 2 # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\frac{\\sqrt[3]{2} \\tan ^{-1}\\left(\\frac{3}{2}-2 x^3\\right)}{\\sqrt[3]{x^3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{\\sqrt[3]{3}}{2^{2/3}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(((cbrt2*atan((3/2)-2*x**3))/(cbrt(x**3))), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{23 x}{5}+\\frac{114 y}{5}-23 z-\\frac{12}{5}=0$, $\\frac{x}{5}+y+\\frac{31 z}{5}-\\frac{124}{5}=0$, $\\frac{23 x}{5}+\\frac{48 y}{5}+\\frac{99 z}{5}+\\frac{51}{5}=0$", + "Output Answer": [ + "$x=-\\frac{2305419}{100540}$, $y=\\frac{11251}{50270}$, $z=\\frac{472899}{100540}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((23*x)/5)+((114*y)/5)-23*z-(12/5), (x/5)+y+((31*z)/5)-(124/5), ((23*x)/5)+((48*y)/5)+((99*z)/5)+(51/5))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 15 x^2-2 x+3$, $q(x) = 3 x^2+5 x+4$", + "Output Answer": [ + "$18 x^2+3 x+7$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 15*x**2-2*x+3\nq = 3*x**2+5*x+4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2-8 x+8 y^2-3 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y-\\frac{3}{16}\\right)^2-10 \\left(x+\\frac{2}{5}\\right)^2=-\\frac{691}{160}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{5}-\\frac{3 \\sqrt{691}}{80} & \\frac{3}{16} \\\\\n \\frac{3 \\sqrt{691}}{80}-\\frac{2}{5} & \\frac{3}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2}$\nCenter: $\\left\\{-\\frac{2}{5},\\frac{3}{16}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{5} x}{2}+\\frac{1}{80} \\left(15+16 \\sqrt{5}\\right),y=-\\frac{\\sqrt{5} x}{2}-\\frac{1}{\\sqrt{5}}+\\frac{3}{16}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2-8*x+8*y**2-3*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$17 x-11 y+7=0$, $-9 x-10 y+14=0$", + "Output Answer": [ + "$x=\\frac{84}{269}$, $y=\\frac{301}{269}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((17*x-11*y+7, -9*x-10*y+14), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $2 x^3-26 x^2+4 x+560$", + "Output Answer": [ + "$-2 (-x-4) (7-x) (10-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(2*x**3-26*x**2+4*x+560, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{1}{26}$, and $a_n=a_{n-1}+-\\frac{1}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$-\\frac{186}{13}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(1/26) # initial value\nd = -(1/2) # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(1/26) # initial value\nd = -(1/2) # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\frac{\\left(\\frac{7 x}{2}+\\frac{11}{2}\\right)^2+1}{2 \\left(\\frac{7 x}{2}+\\frac{11}{2}\\right)}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{11}{7}-\\frac{2 i}{7}\\right\\},\\left\\{x\\to -\\frac{11}{7}+\\frac{2 i}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve((((((7*x)/2)+(11/2))**2+1)/(2*(((7*x)/2)+(11/2)))), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{88}}{\\sqrt{150}+29}$.", + "Output Answer": [ + "$\\frac{2 \\sqrt{22}}{29+5 \\sqrt{6}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(88))/(sqrt(150)+29)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-4+4 i$ and $y=-1+6 i$", + "Output Answer": [ + "$-3-2 i$" + ], + "Output Program": [ + "i = 1j\nx = -4+4*i\ny = -1+6*i\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -2 \\sqrt{3} x^2+3 \\sqrt{3} x-8 \\sqrt{3}$ and $q(x) = 3 \\sqrt{3} x^2-7 \\sqrt{3} x+8 \\sqrt{3}$", + "Output Answer": [ + "$-18 x^4+69 x^3-183 x^2+240 x-192$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -2*sqrt(3)*x**2+3*sqrt(3)*x-8*sqrt(3)\nq = 3*sqrt(3)*x**2-7*sqrt(3)*x+8*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-7 x-9}+\\sqrt{6-3 x}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(-155+15 \\sqrt{89}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-7*x-9)+sqrt(6-3*x), 5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 \\sqrt{3} x^2-6 \\sqrt{3} x+4 \\sqrt{3}$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(-3-\\sqrt{33}\\right)\\lor x=\\frac{1}{6} \\left(\\sqrt{33}-3\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*sqrt(3)*x**2-6*sqrt(3)*x+4*sqrt(3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(20+25) \\left(\\left(\\frac{9}{12}+14\\right)-24\\right)$.", + "Output Answer": [ + "$-\\frac{1665}{4}$" + ], + "Output Program": [ + "try: \n print((20+25)*(((9/12)+14)-24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2+8 x+9 y^2-9 y+7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(y-\\frac{1}{2}\\right)^2-6 \\left(x-\\frac{2}{3}\\right)^2=-\\frac{89}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{2}{3}-\\frac{\\sqrt{\\frac{445}{6}}}{6} & \\frac{1}{2} \\\\\n \\frac{1}{36} \\left(24+\\sqrt{2670}\\right) & \\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{2}{3}-\\frac{\\sqrt{\\frac{445}{6}}}{6}+\\frac{1}{36} \\left(24+\\sqrt{2670}\\right)\\right),\\frac{1}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{2}{3}} x+\\frac{1}{18} \\left(9-4 \\sqrt{6}\\right),y=\\frac{1}{18} \\left(9+4 \\sqrt{6}\\right)-\\sqrt{\\frac{2}{3}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2+8*x+9*y**2-9*y+7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{23}{2}$, and $a_n=a_{n-1}+3$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$\\frac{175}{2}$" + ], + "Output Program": [ + "a = (23/2) # initial value\nd = 3 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (23/2) # initial value\nd = 3 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{43}{22}$, and $a_n=a_{n-1}+\\frac{9}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$\\frac{38550}{77}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(43/22) # initial value\nd = (9/7) # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(43/22) # initial value\nd = (9/7) # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-4 x-\\frac{103}{7}}+\\sqrt{-\\frac{10 x}{7}-\\frac{99}{7}}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-1066+4 \\sqrt{48783}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-4*x-(103/7))+sqrt(-((10*x)/7)-(99/7)), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x^2-4 x+4$ and $2-3 x$.", + "Output Answer": [ + "$3 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x**2-4*x+4, 2-3*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{5}{2}$ and $-2 x^2+3 x+\\frac{9}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd((5/2), -2*x**2+3*x+(9/2)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{11 x^2}{\\sqrt{\\pi }}+\\frac{25 x}{\\sqrt{\\pi }}-\\frac{4}{\\sqrt{\\pi }}$ and $q(x) = -\\frac{20 x^2}{\\sqrt{\\pi }}-\\frac{6 x}{\\sqrt{\\pi }}+\\frac{16}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{220 x^4}{\\pi }-\\frac{434 x^3}{\\pi }-\\frac{246 x^2}{\\pi }+\\frac{424 x}{\\pi }-\\frac{64}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((11*x**2)/(sqrt(pi)))+((25*x)/(sqrt(pi)))-(4/(sqrt(pi)))\nq = -((20*x**2)/(sqrt(pi)))-((6*x)/(sqrt(pi)))+(16/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $3 \\sqrt{5} e^{-\\frac{61 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $3 \\sqrt{5}$\nArgument: $-\\frac{61 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 3*math.sqrt(5)*math.e**(-((61*i*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\sqrt{5} x^2+2 \\sqrt{5} x-7 \\sqrt{5}}{-2 \\sqrt{5} x^2-11 \\sqrt{5} x-5 \\sqrt{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -1-2 \\sqrt{2}\\right\\},\\left\\{x\\to -1+2 \\sqrt{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((sqrt(5)*x**2+2*sqrt(5)*x-7*sqrt(5))/(-2*sqrt(5)*x**2-11*sqrt(5)*x-5*sqrt(5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $x^2+x+1$ when divided by $-6 x^2+9 x-9$.", + "Output Answer": [ + "$-\\frac{1}{6}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**2+x+1\nq = -6*x**2+9*x-9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{191}+\\sqrt{16}\\right) \\sqrt{195}$.", + "Output Answer": [ + "$\\sqrt{195} \\left(4+\\sqrt{191}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(191)+sqrt(16))*sqrt(195))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(3+8)^2 ((((24-9)+15)-10)+17)$.", + "Output Answer": [ + "$4477$" + ], + "Output Program": [ + "try: \n print((3+8)**2*((((24-9)+15)-10)+17))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 x^2-15 x+12$ and $q(x) = -10 x^2+13 x-8$", + "Output Answer": [ + "$-50 x^4+215 x^3-355 x^2+276 x-96$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*x**2-15*x+12\nq = -10*x**2+13*x-8\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2+77 x-660$", + "Output Answer": [ + "$11 (-x-12) (5-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2+77*x-660, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 19 x-4| =16$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{12}{19}\\right\\},\\left\\{x\\to \\frac{20}{19}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(19*x-4), 16), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+8 x+2 y^2+2 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x+\\frac{1}{2}\\right)^2+2 \\left(y+\\frac{1}{2}\\right)^2=\\frac{17}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{2} & \\frac{1}{4} \\left(-2-\\sqrt{51}\\right) \\\\\n -\\frac{1}{2} & \\frac{1}{4} \\left(\\sqrt{51}-2\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{3}}{2}$\nCenter: $\\left\\{-\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{4} \\left(-2-\\sqrt{51}\\right)+\\frac{1}{4} \\left(\\sqrt{51}-2\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{17 \\pi }{8}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+8*x+2*y**2+2*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -9 x-9| =17$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{26}{9}\\right\\},\\left\\{x\\to \\frac{8}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-9*x-9), 17), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(\\cos \\left(\\frac{1}{90}\\right)+i \\sin \\left(\\frac{1}{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$-32 \\left(\\cos \\left(\\frac{1}{18}\\right)+i \\sin \\left(\\frac{1}{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(math.cos((1/90))+1j*math.sin((1/90))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{69}{7}-\\frac{66 i}{7}$ and $y=-\\frac{27}{7}-\\frac{67 i}{7}$", + "Output Answer": [ + "$-\\frac{2559}{49}+\\frac{915 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = -(69/7)-((66*i)/7)\ny = -(27/7)-((67*i)/7)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 x^2+15 x-13$", + "Output Answer": [ + "$x=\\frac{1}{12} \\left(15-i \\sqrt{87}\\right)\\lor x=\\frac{1}{12} \\left(15+i \\sqrt{87}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*x**2+15*x-13, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2-6 x+8 y^2+10 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y+\\frac{5}{8}\\right)^2-4 \\left(x+\\frac{3}{4}\\right)^2=\\frac{31}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{4} & \\frac{1}{8} \\left(-5-\\sqrt{93}\\right) \\\\\n -\\frac{3}{4} & \\frac{1}{8} \\left(\\sqrt{93}-5\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{3}$\nCenter: $\\left\\{-\\frac{3}{4},\\frac{1}{2} \\left(\\frac{1}{8} \\left(-5-\\sqrt{93}\\right)+\\frac{1}{8} \\left(\\sqrt{93}-5\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{8} \\left(-5-3 \\sqrt{2}\\right)-\\frac{x}{\\sqrt{2}},y=\\frac{x}{\\sqrt{2}}+\\frac{1}{8} \\left(3 \\sqrt{2}-5\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2-6*x+8*y**2+10*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+6 x-2 y^2+5 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 (x+1)^2-2 \\left(y-\\frac{5}{4}\\right)^2=\\frac{71}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -1-\\frac{\\sqrt{\\frac{355}{3}}}{4} & \\frac{5}{4} \\\\\n \\frac{\\sqrt{\\frac{355}{3}}}{4}-1 & \\frac{5}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{2}}$\nCenter: $\\left\\{-1,\\frac{5}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{3}{2}} x+\\frac{1}{4} \\left(5+2 \\sqrt{6}\\right),y=\\frac{1}{4} \\left(5-2 \\sqrt{6}\\right)-\\sqrt{\\frac{3}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+6*x-2*y**2+5*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2-65 \\sqrt{5} x-1000$", + "Output Answer": [ + "$-5 \\left(x+5 \\sqrt{5}\\right) \\left(x+8 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2-65*sqrt(5)*x-1000, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2 x-3$ and $4 x+2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2*x-3, 4*x+2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{37}{27}$, and $a_n=a_{n-1}+-12$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$-\\frac{25753}{27}$" + ], + "Output Program": [ + "a = -(37/27) # initial value\nd = -12 # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(37/27) # initial value\nd = -12 # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{24-8}{17}-14}{((13-20)-24)-13}$.", + "Output Answer": [ + "$\\frac{111}{374}$" + ], + "Output Program": [ + "try: \n print(((((24-8)/17)-14)/(((13-20)-24)-13)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{9 x^2}{2}-x-\\frac{3}{2}$ and $\\frac{9}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((9*x**2)/2)-x-(3/2), (9/2)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{4 x}{5}+\\frac{122}{5}\\right| =23$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{237}{4}\\right\\},\\left\\{x\\to -\\frac{7}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((4*x)/5)+(122/5)), 23), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{19 x}{\\sqrt{3}}-\\frac{34 y}{\\sqrt{3}}-\\frac{5}{\\sqrt{3}}=0$, $\\frac{22 x}{\\sqrt{3}}+\\frac{2 y}{\\sqrt{3}}+\\frac{40}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{135}{71}$, $y=\\frac{65}{71}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((19*x)/(sqrt(3)))-((34*y)/(sqrt(3)))-(5/(sqrt(3))), ((22*x)/(sqrt(3)))+((2*y)/(sqrt(3)))+(40/(sqrt(3)))), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2+4 x-9$ and $q(x) = 8 x^2-14 x+11$", + "Output Answer": [ + "$-112 x^4+228 x^3-282 x^2+170 x-99$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2+4*x-9\nq = 8*x**2-14*x+11\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 10 x^2+5 x+12$, $q(x) = -6 \\left(x^2+2 x-1\\right)$", + "Output Answer": [ + "$4 x^2-7 x+18$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x**2+5*x+12\nq = -6*(x**2+2*x-1)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{156 x-108}{240 x-48}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{9}{13}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((156*x-108)/(240*x-48)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{46 x}{3}-\\frac{53 y}{3}-10=0$, $2 x-14 y-\\frac{16}{3}=0$", + "Output Answer": [ + "$x=-\\frac{206}{1125}$, $y=-\\frac{458}{1125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((46*x)/3)-((53*y)/3)-10, 2*x-14*y-(16/3)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{2}{3}$, and $a_n=a_{n-1}+-\\frac{17}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{3}{2} \\left(-\\frac{4}{3}-\\frac{34}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(2/3) # initial value\nd = -(17/(math.sqrt(3))) # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(2/3) # initial value\nd = -(17/(math.sqrt(3))) # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2-372 x+2880$", + "Output Answer": [ + "$12 (15-x) (16-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2-372*x+2880, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-18 x^2-12 x-2}{-16 x^2-3 x+8}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{3}\\right\\},\\left\\{x\\to -\\frac{1}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-18*x**2-12*x-2)/(-16*x**2-3*x+8)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^6+6 x^5-8 x^4+2 x^3-6 x^2-8 x-6$ when divided by $6 x+6$.", + "Output Answer": [ + "$\\frac{x^5}{3}+\\frac{2 x^4}{3}-2 x^3+\\frac{7 x^2}{3}-\\frac{10 x}{3}+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**6+6*x**5-8*x**4+2*x**3-6*x**2-8*x-6\nq = 6*x+6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{42}{5} e^{-\\frac{17 i \\pi }{36}}$.", + "Output Answer": [ + "Norm: $\\frac{42}{5}$\nArgument: $\\frac{19 \\pi }{36}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(42/5)*math.e**(-((17*i*math.pi)/36))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{1}{7} \\left(\\frac{19+2}{11}+23\\right)+(14-23)^2$.", + "Output Answer": [ + "$\\frac{6511}{77}$" + ], + "Output Program": [ + "try: \n print((1/7)*(((19+2)/11)+23)+(14-23)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(((12+14)-20)-17)-3}{\\frac{1}{23} \\left((1+25)^2+25\\right)}$.", + "Output Answer": [ + "$-\\frac{322}{701}$" + ], + "Output Program": [ + "try: \n print((((((12+14)-20)-17)-3)/((1/23)*((1+25)**2+25))))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^6+8 x^5-10 x^4-8 x^3+9 x^2-2 x$ when divided by $2 x^3-9 x^2-4 x+4$.", + "Output Answer": [ + "$-x^3-\\frac{x^2}{2}-\\frac{37 x}{4}-\\frac{357}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**6+8*x**5-10*x**4-8*x**3+9*x**2-2*x\nq = 2*x**3-9*x**2-4*x+4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-x^2-8 x-5$", + "Output Answer": [ + "$x=-4-\\sqrt{11}\\lor x=\\sqrt{11}-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-x**2-8*x-5, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+7 x+5 y^2+6 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $9 \\left(x+\\frac{7}{18}\\right)^2+5 \\left(y+\\frac{3}{5}\\right)^2=\\frac{2369}{180}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{7}{18} & -\\frac{3}{5}-\\frac{\\sqrt{2369}}{45} \\\\\n -\\frac{7}{18} & \\frac{1}{45} \\left(\\sqrt{2369}-27\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{3}$\nCenter: $\\left\\{-\\frac{7}{18},\\frac{1}{2} \\left(-\\frac{3}{5}-\\frac{\\sqrt{2369}}{45}+\\frac{1}{45} \\left(\\sqrt{2369}-27\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{2369 \\pi }{540 \\sqrt{5}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+7*x+5*y**2+6*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(\\sin \\left(\\frac{2 \\pi }{9}\\right)-i \\cos \\left(\\frac{2 \\pi }{9}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$64 \\left(-\\frac{\\sqrt{3}}{2}-\\frac{i}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(math.sin(((2*math.pi)/9))-1j*math.cos(((2*math.pi)/9))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{14 x-11}+\\sqrt{\\frac{44 x}{3}+\\frac{4}{3}}=\\frac{26}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(28957-52 \\sqrt{309882}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(14*x-11)+sqrt(((44*x)/3)+(4/3)), (26/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{13 x}{2}+7\\right| =-\\frac{31}{2}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((13*x)/2)+7), -(31/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{5} \\left(-3 x^2+6 x-4\\right)$, $q(x) = \\sqrt{5} \\left(-6 x^2-3 x+5\\right)$", + "Output Answer": [ + "$-9 \\sqrt{5} x^2+3 \\sqrt{5} x+\\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(5)*(-3*x**2+6*x-4)\nq = sqrt(5)*(-6*x**2-3*x+5)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{14+17 i}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\sqrt{\\frac{485}{3}}$\nArgument: $\\tan ^{-1}\\left(\\frac{17}{14}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((14+17*i)/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $-\\frac{7 \\sqrt{5} x^2+5 \\sqrt{5} x+3 \\sqrt{5}}{10 \\sqrt{5} x}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((7*sqrt(5)*x**2+5*sqrt(5)*x+3*sqrt(5))/(10*sqrt(5)*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{9} (3 x+5)^4, q(x) = \\frac{2 (7 x-1)}{\\sqrt{3}}$", + "Output Answer": [ + "$9 x^4+60 x^3+150 x^2+\\frac{14 x}{\\sqrt{3}}+\\frac{500 x}{3}-\\frac{2}{\\sqrt{3}}+\\frac{625}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/9)*(3*x+5)**4\nq = ((2*(7*x-1))/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{135 x^2+237 x+42}{-60 x^2+198 x+42}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{14}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((135*x**2+237*x+42)/(-60*x**2+198*x+42)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{5}{2}$ and $5 x^5+3 x^4+\\frac{7 x^3}{2}-\\frac{x^2}{2}-\\frac{9 x}{2}-\\frac{9}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd((5/2), 5*x**5+3*x**4+((7*x**3)/2)-((x**2)/2)-((9*x)/2)-(9/2)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=2 \\left(144 t^2+528 t+485\\right)^2, x(t)=72 t^2+264 t+242$", + "Output Answer": [ + "$y=8 x^2+8 x+2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 2*(144*t**2+528*t+485)**2\nx_t = 72*t**2+264*t+242\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(18-16)+(2-3)$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "try: \n print((18-16)+(2-3))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^4+4 x^3+8 x-8$ and $4-2 x^3$.", + "Output Answer": [ + "$2 x^3-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**4+4*x**3+8*x-8, 4-2*x**3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10} \\sqrt{x}+\\sqrt{4 x-10}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\left(5 \\sqrt{\\frac{5}{2}}-\\sqrt{\\frac{70}{3}}\\right)^2\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10)*sqrt(x)+sqrt(4*x-10), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{1}{6} \\left(\\frac{11}{7}+6\\right)+((6-5)-12)$.", + "Output Answer": [ + "$-\\frac{409}{42}$" + ], + "Output Program": [ + "try: \n print((1/6)*((11/7)+6)+((6-5)-12))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $13 x^2-8 x-15$", + "Output Answer": [ + "$x=\\frac{1}{13} \\left(4-\\sqrt{211}\\right)\\lor x=\\frac{1}{13} \\left(4+\\sqrt{211}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(13*x**2-8*x-15, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{79}{54}$, and $a_n=a_{n-1}+-5 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{3}{2} \\left(-\\frac{79}{27}-10 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(79/54) # initial value\nd = -5*math.sqrt(3) # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(79/54) # initial value\nd = -5*math.sqrt(3) # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{3 x^2}{\\sqrt{2}}-5 \\sqrt{2} x+\\sqrt{2}$", + "Output Answer": [ + "$-\\frac{3 \\left(x+\\frac{5}{3}\\right)^2}{\\sqrt{2}}+\\sqrt{2}+\\frac{25}{3 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((3*x**2)/(math.sqrt(2)))-5*math.sqrt(2)*x+math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2-\\frac{693 x}{4}+\\frac{4301}{8}$", + "Output Answer": [ + "$-11 \\left(\\frac{17}{4}-x\\right) \\left(x-\\frac{23}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2-((693*x)/4)+(4301/8), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-6 x^2-2 x+5}{19 x^2+13 x-10}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(-1-\\sqrt{31}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(-1+\\sqrt{31}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-6*x**2-2*x+5)/(19*x**2+13*x-10)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{17}{2} \\left(\\sin \\left(\\frac{13 \\pi }{90}\\right)+i \\cos \\left(\\frac{13 \\pi }{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-\\frac{34271896307633 \\left(\\cos \\left(\\frac{4 \\pi }{45}\\right)-i \\sin \\left(\\frac{4 \\pi }{45}\\right)\\right)}{2048}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(17/2)*(math.sin(((13*math.pi)/90))+1j*math.cos(((13*math.pi)/90))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\pi x^2+2 \\pi x$ and $q(x) = 2 \\pi x^2-4 \\pi x+4 \\pi$", + "Output Answer": [ + "$2 \\pi ^2 x^4-4 \\pi ^2 x^2+8 \\pi ^2 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = pi*x**2+2*pi*x\nq = 2*pi*x**2-4*pi*x+4*pi\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2+8 x+6 y^2+8 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y+\\frac{2}{3}\\right)^2-7 \\left(x-\\frac{4}{7}\\right)^2=\\frac{176}{21}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{4}{7} & -\\frac{2}{21} \\left(7+\\sqrt{286}\\right) \\\\\n \\frac{4}{7} & \\frac{2}{21} \\left(\\sqrt{286}-7\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{13}{7}}$\nCenter: $\\left\\{\\frac{4}{7},\\frac{1}{2} \\left(\\frac{2}{21} \\left(\\sqrt{286}-7\\right)-\\frac{2}{21} \\left(7+\\sqrt{286}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2}{21} \\left(\\sqrt{42}-7\\right)-\\sqrt{\\frac{7}{6}} x,y=\\sqrt{\\frac{7}{6}} x-\\frac{2}{21} \\left(7+\\sqrt{42}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2+8*x+6*y**2+8*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 13 x^2+12 x+8$ and $q(x) = -2 x^2+15 x+3$", + "Output Answer": [ + "$-26 x^4+171 x^3+203 x^2+156 x+24$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 13*x**2+12*x+8\nq = -2*x**2+15*x+3\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 10 x^2-4 x-3$ and $q(x) = -10 x^2+11 x-11$", + "Output Answer": [ + "$-100 x^4+150 x^3-124 x^2+11 x+33$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 10*x**2-4*x-3\nq = -10*x**2+11*x-11\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{14 x}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}$ and $q(x) = \\frac{17 x^2}{\\sqrt{3}}-\\frac{25 x}{\\sqrt{3}}-\\frac{20}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{238 x^3}{3}-\\frac{92 x^2}{3}+310 x+\\frac{520}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((14*x)/(sqrt(3)))-(26/(sqrt(3)))\nq = ((17*x**2)/(sqrt(3)))-((25*x)/(sqrt(3)))-(20/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the eighth order series of the inverse of the following function around 8:\n$2 x$", + "Output Answer": [ + "$\\frac{x-2}{2}+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, 2*x)\nprint(solve(f, x)[0].series(y, 8, 6))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-13 x-7}+\\sqrt{11} \\sqrt{-x}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-2707+15 \\sqrt{32329}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-13*x-7)+sqrt(11)*sqrt(-x), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x^3+x^2-2$ and $-x^3-x^2+2$.", + "Output Answer": [ + "$x^3+x^2-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x**3+x**2-2, -x**3-x**2+2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 x^2-2 x+3$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(-1-\\sqrt{19}\\right)\\lor x=\\frac{1}{6} \\left(\\sqrt{19}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*x**2-2*x+3, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-x+4 y^2-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x-\\frac{1}{16}\\right)^2+4 y^2=\\frac{97}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{16} & -\\frac{\\sqrt{97}}{16} \\\\\n \\frac{1}{16} & \\frac{\\sqrt{97}}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{\\frac{1}{16},0\\right\\}$\nArea Enclosed: $\\frac{97 \\pi }{128 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-x+4*y**2-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x^5+9 x^4+4 x^3-15 x^2+4$ and $-x^3+3 x^2-1$.", + "Output Answer": [ + "$x^3-3 x^2+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x**5+9*x**4+4*x**3-15*x**2+4, -x**3+3*x**2-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-9 \\sqrt{3} x^2+7 \\sqrt{3} x+12 \\sqrt{3}}{11 \\sqrt{3} x^2+4 \\sqrt{3} x+2 \\sqrt{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(7-\\sqrt{481}\\right)\\right\\},\\left\\{x\\to \\frac{1}{18} \\left(7+\\sqrt{481}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-9*sqrt(3)*x**2+7*sqrt(3)*x+12*sqrt(3))/(11*sqrt(3)*x**2+4*sqrt(3)*x+2*sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{42}{5} \\left(\\cos \\left(\\frac{31}{18}\\right)+i \\sin \\left(\\frac{31}{18}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-\\frac{406671383849472 \\left(\\cos \\left(\\frac{31}{2}\\right)+i \\sin \\left(\\frac{31}{2}\\right)\\right)}{1953125}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(42/5)*(math.cos((31/18))+1j*math.sin((31/18))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{6 x^2-29 x-16}{\\pi }$, $q(x) = \\frac{-13 x^2+2 x-16}{\\pi }$", + "Output Answer": [ + "$-\\frac{7 x^2}{\\pi }-\\frac{27 x}{\\pi }-\\frac{32}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((6*x**2-29*x-16)/pi)\nq = ((-13*x**2+2*x-16)/pi)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^5+\\frac{7 x^4}{3}-\\frac{10 x^3}{3}-6 x^2-2 x+9$ when divided by $\\frac{26 x^5}{3}+\\frac{13 x^4}{3}-\\frac{16 x^3}{3}+\\frac{17 x^2}{3}+\\frac{26 x}{3}-1$.", + "Output Answer": [ + "$-\\frac{6}{13}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**5+((7*x**4)/3)-((10*x**3)/3)-6*x**2-2*x+9\nq = ((26*x**5)/3)+((13*x**4)/3)-((16*x**3)/3)+((17*x**2)/3)+((26*x)/3)-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{66 x^2}{5}-\\frac{47 x}{5}-\\frac{52}{5}$", + "Output Answer": [ + "$\\frac{66}{5} \\left(x-\\frac{47}{132}\\right)^2-\\frac{15937}{1320}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((66*x**2)/5)-((47*x)/5)-(52/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\left(\\cos \\left(\\frac{7 \\pi }{90}\\right)+i \\sin \\left(\\frac{7 \\pi }{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$32 \\left(\\sin \\left(\\frac{\\pi }{9}\\right)+i \\cos \\left(\\frac{\\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*(math.cos(((7*math.pi)/90))+1j*math.sin(((7*math.pi)/90))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| x-10| =24$", + "Output Answer": [ + "$\\{\\{x\\to -14\\},\\{x\\to 34\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(x-10), 24), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{7 x^2}{2}-\\frac{61 x}{2}-45}{\\frac{133 x^2}{2}+26 x-\\frac{153}{2}}=0$", + "Output Answer": [ + "$\\{\\{x\\to 10\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((7*x**2)/2)-((61*x)/2)-45)/(((133*x**2)/2)+26*x-(153/2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{83}{88}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$\\frac{54195}{88}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(83/88) # initial value\nd = 6 # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(83/88) # initial value\nd = 6 # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\tan (2-9 x)$ at the point $x=5$", + "Output Answer": [ + "$\\tan (43) = -1.498$" + ], + "Output Program": [ + "import math\n\nx = 5\ntry: \n f = -math.tan(2-9*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{57}{28}$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{13233}{28}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(57/28) # initial value\nd = 9 # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(57/28) # initial value\nd = 9 # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-8 \\left(\\cos \\left(\\frac{\\pi }{45}\\right)+i \\sin \\left(\\frac{\\pi }{45}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-2097152 \\left(\\cos \\left(\\frac{7 \\pi }{45}\\right)+i \\sin \\left(\\frac{7 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-8*(math.cos((math.pi/45))+1j*math.sin((math.pi/45))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^4-9 x^2-3 x+4$ when divided by $2 x^3-4 x^2-7 x+9$.", + "Output Answer": [ + "$\\frac{5 x}{2}+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**4-9*x**2-3*x+4\nq = 2*x**3-4*x**2-7*x+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{9} (17 x+21)^2, q(x) = -8 (2 x-3)^3$", + "Output Answer": [ + "$-64 x^3+\\frac{2881 x^2}{9}-\\frac{1058 x}{3}+265$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/9)*(17*x+21)**2\nq = -8*(2*x-3)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{27}{4} \\left(\\cos \\left(\\frac{11 \\pi }{90}\\right)+i \\sin \\left(\\frac{11 \\pi }{90}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{205891132094649 \\left(-\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)}{1048576}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(27/4)*(math.cos(((11*math.pi)/90))+1j*math.sin(((11*math.pi)/90))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $15 x^5+x^4+10 x^3+8 x^2+8 x-4$ and $5 x^4+2 x^3+4 x^2+4 x+4$.", + "Output Answer": [ + "$5 x^4+2 x^3+4 x^2+4 x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(15*x**5+x**4+10*x**3+8*x**2+8*x-4, 5*x**4+2*x**3+4*x**2+4*x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{x^2}{2}-4 x+\\frac{5}{2}$ and $-\\frac{x^4}{2}-x^3-2 x^2+\\frac{x}{2}+\\frac{1}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((x**2)/2)-4*x+(5/2), -((x**4)/2)-x**3-2*x**2+(x/2)+(1/2)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-12 x^2+204 x-792$", + "Output Answer": [ + "$12 (6-x) (x-11)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-12*x**2+204*x-792, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{14 x^4}{3}-9 x^3-\\frac{23 x^2}{3}+5 x-10$ when divided by $9 x^2+8 x-8$.", + "Output Answer": [ + "$\\frac{14 x^2}{27}-\\frac{355 x}{243}+\\frac{1985}{2187}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((14*x**4)/3)-9*x**3-((23*x**2)/3)+5*x-10\nq = 9*x**2+8*x-8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $2 x^2-13 x-3$", + "Output Answer": [ + "$x=\\frac{1}{4} \\left(13-\\sqrt{193}\\right)\\lor x=\\frac{1}{4} \\left(13+\\sqrt{193}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(2*x**2-13*x-3, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{51}{7}+\\frac{5 i}{7}$ and $y=-\\frac{12}{7}+\\frac{31 i}{7}$", + "Output Answer": [ + "$\\frac{59}{85}+\\frac{117 i}{85}$" + ], + "Output Program": [ + "i = 1j\nx = -(51/7)+((5*i)/7)\ny = -(12/7)+((31*i)/7)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $5 x^2-8 x-6$", + "Output Answer": [ + "$5 \\left(x-\\frac{4}{5}\\right)^2-\\frac{46}{5}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (5*x**2-8*x-6), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-484 x^2+242 x+180}{264 x^2-680 x+400}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{9}{22}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-484*x**2+242*x+180)/(264*x**2-680*x+400)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{41 x^2}{5}-\\frac{71 x}{5}-\\frac{28}{5}$ and $q(x) = -\\frac{41 x^2}{5}-6 x-\\frac{68}{5}$", + "Output Answer": [ + "$-\\frac{1681 x^4}{25}+\\frac{1681 x^3}{25}+\\frac{98 x^2}{5}+\\frac{5668 x}{25}+\\frac{1904}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((41*x**2)/5)-((71*x)/5)-(28/5)\nq = -((41*x**2)/5)-6*x-(68/5)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$19 x-20 y+2=0$, $-8 x-13 y+8=0$", + "Output Answer": [ + "$x=\\frac{134}{407}$, $y=\\frac{168}{407}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((19*x-20*y+2, -8*x-13*y+8), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{5 x^4-6}+\\sqrt[3]{-6 x-3}$ at the point $x=5$", + "Output Answer": [ + "$-\\sqrt[3]{33}+\\sqrt{3119} = 52.64$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 5\ntry: \n f = math.sqrt(5*x**4-6)+np.cbrt(-6*x-3)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 12 \\sqrt{3}-\\frac{34 x}{\\sqrt{3}}\\right| =\\frac{40}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{2}{17}\\right\\},\\left\\{x\\to \\frac{38}{17}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(12*sqrt(3)-((34*x)/(sqrt(3)))), (40/(sqrt(3)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x+2}+\\sqrt{15 x+15}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(19-4 \\sqrt{30}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x+2)+sqrt(15*x+15), 4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-10 x^6-8 x^5-3 x^4-2 x^3+9 x^2-2 x+3$ when divided by $-8 x^5-3 x^4-7 x^3+3 x^2+10 x-9$.", + "Output Answer": [ + "$\\frac{5 x}{4}+\\frac{17}{32}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -10*x**6-8*x**5-3*x**4-2*x**3+9*x**2-2*x+3\nq = -8*x**5-3*x**4-7*x**3+3*x**2+10*x-9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{5 x^2}{\\sqrt{2}}-\\frac{21 x}{\\sqrt{2}}+\\frac{3}{\\sqrt{2}}$ and $q(x) = \\frac{15 x^2}{\\sqrt{2}}-\\frac{15 x}{\\sqrt{2}}+10 \\sqrt{2}$", + "Output Answer": [ + "$\\frac{75 x^4}{2}-195 x^3+230 x^2-\\frac{465 x}{2}+30$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((5*x**2)/(sqrt(2)))-((21*x)/(sqrt(2)))+(3/(sqrt(2)))\nq = ((15*x**2)/(sqrt(2)))-((15*x)/(sqrt(2)))+10*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 7 x^2-9 x-2$ and $q(x) = -11 x^2+13 x+5$", + "Output Answer": [ + "$-77 x^4+190 x^3-60 x^2-71 x-10$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 7*x**2-9*x-2\nq = -11*x**2+13*x+5\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=9 (10 t+27)^2, x(t)=-6 t-15$", + "Output Answer": [ + "$y=25 x^2-60 x+36$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 9*(10*t+27)**2\nx_t = -6*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{47}{44}$, and $a_n=a_{n-1}+-\\frac{13}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$\\frac{21}{2} \\left(\\frac{47}{22}-\\frac{260}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\na = (47/44) # initial value\nd = -(13/(math.sqrt(3))) # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (47/44) # initial value\nd = -(13/(math.sqrt(3))) # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-8 x-\\frac{23}{2}}+\\sqrt{-\\frac{15 x}{2}-\\frac{7}{2}}=\\frac{25}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-19407+50 \\sqrt{150466}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-8*x-(23/2))+sqrt(-((15*x)/2)-(7/2)), (25/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{16 x^3}{3}-\\frac{19 x^2}{3}-5 x-2$ when divided by $\\frac{26}{3}$.", + "Output Answer": [ + "$\\frac{8 x^3}{13}-\\frac{19 x^2}{26}-\\frac{15 x}{26}-\\frac{3}{13}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((16*x**3)/3)-((19*x**2)/3)-5*x-2\nq = (26/3)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^6+6 x^5+10 x^4-3 x^3-6 x^2+x+9$ when divided by $-4$.", + "Output Answer": [ + "$-\\frac{5 x^6}{4}-\\frac{3 x^5}{2}-\\frac{5 x^4}{2}+\\frac{3 x^3}{4}+\\frac{3 x^2}{2}-\\frac{x}{4}-\\frac{9}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**6+6*x**5+10*x**4-3*x**3-6*x**2+x+9\nq = -4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $15-\\frac{55 x}{3}$ and $3-\\frac{11 x}{3}$.", + "Output Answer": [ + "$\\frac{11 x}{3}-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(15-((55*x)/3), 3-((11*x)/3)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{9-24}{\\frac{1}{24} \\left(\\left(\\frac{11}{2}-22\\right)-1\\right)}$.", + "Output Answer": [ + "$\\frac{144}{7}$" + ], + "Output Program": [ + "try: \n print(((9-24)/((1/24)*(((11/2)-22)-1))))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2+10 x+10 y^2+9 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $(x+5)^2+10 \\left(y+\\frac{9}{20}\\right)^2=\\frac{1441}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n -5-\\frac{3 \\sqrt{1441}}{20} & -\\frac{9}{20} \\\\\n \\frac{3 \\sqrt{1441}}{20}-5 & -\\frac{9}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{10}}$\nCenter: $\\left\\{-5,-\\frac{9}{20}\\right\\}$\nArea Enclosed: $\\frac{1441 \\pi }{40 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2+10*x+10*y**2+9*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2-2 x+y^2-9 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $\\left(y-\\frac{9}{2}\\right)^2-8 \\left(x+\\frac{1}{8}\\right)^2=\\frac{97}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{8} & -\\frac{3}{8} \\left(\\sqrt{97}-12\\right) \\\\\n -\\frac{1}{8} & \\frac{3}{8} \\left(12+\\sqrt{97}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2 \\sqrt{2}}$\nCenter: $\\left\\{-\\frac{1}{8},\\frac{1}{2} \\left(\\frac{3}{8} \\left(12+\\sqrt{97}\\right)-\\frac{3}{8} \\left(\\sqrt{97}-12\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{4} \\left(18-\\sqrt{2}\\right)-2 \\sqrt{2} x,y=2 \\sqrt{2} x+\\frac{1}{4} \\left(18+\\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2-2*x+y**2-9*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-5 \\sqrt{3} x-\\sqrt{3} y-11 \\sqrt{3}=0$, $-7 \\sqrt{3} x+\\sqrt{3} y-7 \\sqrt{3}=0$", + "Output Answer": [ + "$x=-\\frac{3}{2}$, $y=-\\frac{7}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-5*sqrt(3)*x-sqrt(3)*y-11*sqrt(3), -7*sqrt(3)*x+sqrt(3)*y-7*sqrt(3)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-150 x^2+390 x-132}{144-360 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{11}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-150*x**2+390*x-132)/(144-360*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 x^2+15 x+11$, $q(x) = -10 x^2-12 x-15$", + "Output Answer": [ + "$-x^2+3 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**2+15*x+11\nq = -10*x**2-12*x-15\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 25 x-7| =16$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{9}{25}\\right\\},\\left\\{x\\to \\frac{23}{25}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(25*x-7), 16), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{33}{4}-6 x}+\\sqrt{10 x+\\frac{39}{4}}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{31}{32}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((33/4)-6*x)+sqrt(10*x+(39/4)), 4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{12-9 i}{\\pi }$ and $y=\\frac{10-21 i}{\\pi }$", + "Output Answer": [ + "$-\\frac{2+12 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((12-9*i)/math.pi)\ny = ((10-21*i)/math.pi)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-24 x+12 y+20=0$, $-5 x-20 y-23=0$", + "Output Answer": [ + "$x=\\frac{31}{135}$, $y=-\\frac{163}{135}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-24*x+12*y+20, -5*x-20*y-23), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-6 \\left(-\\sin \\left(\\frac{23 \\pi }{180}\\right)-i \\cos \\left(\\frac{23 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $6 \\sqrt{\\sin ^2\\left(\\frac{23 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{23 \\pi }{180}\\right)}$\nArgument: $\\frac{67 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -6*(-math.sin(((23*math.pi)/180))-i*math.cos(((23*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{37}{4} e^{\\frac{i \\pi }{5}}$.", + "Output Answer": [ + "Norm: $\\frac{37}{4}$\nArgument: $\\frac{\\pi }{5}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (37/4)*math.e**((i*math.pi)/5)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-10 \\sqrt{3} y-5 \\sqrt{3} z+4 \\sqrt{3}=0$, $9 \\sqrt{3} x+4 \\sqrt{3} y+10 \\sqrt{3} z+7 \\sqrt{3}=0$, $-\\sqrt{3} x+12 \\sqrt{3} y+2 \\sqrt{3} z-13 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{39}{35}$, $y=\\frac{219}{140}$, $z=-\\frac{163}{70}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-10*sqrt(3)*y-5*sqrt(3)*z+4*sqrt(3), 9*sqrt(3)*x+4*sqrt(3)*y+10*sqrt(3)*z+7*sqrt(3), -sqrt(3)*x+12*sqrt(3)*y+2*sqrt(3)*z-13*sqrt(3))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{22 x^2+31 x-27}{e}$, $q(x) = \\frac{24 x^2-7 x-32}{e}$", + "Output Answer": [ + "$\\frac{46 x^2}{e}+\\frac{24 x}{e}-\\frac{59}{e}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x\n\np = ((22*x**2+31*x-27)/math.e)\nq = ((24*x**2-7*x-32)/math.e)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{22}{89}$, and $a_n=a_{n-1}+-4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$-\\frac{67200}{89}$" + ], + "Output Program": [ + "a = (22/89) # initial value\nd = -4 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (22/89) # initial value\nd = -4 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 \\sqrt{2} x^2-2 \\sqrt{2} x-10 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(-1-i \\sqrt{59}\\right)\\lor x=\\frac{1}{6} \\left(-1+i \\sqrt{59}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*sqrt(2)*x**2-2*sqrt(2)*x-10*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$4 x-16 y+20=0$, $-18 x+7 y-2=0$", + "Output Answer": [ + "$x=\\frac{27}{65}$, $y=\\frac{88}{65}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((4*x-16*y+20, -18*x+7*y-2), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{25 \\left(\\cos \\left(\\frac{\\pi }{15}\\right)+i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{25 \\sqrt{\\sin ^2\\left(\\frac{\\pi }{15}\\right)+\\cos ^2\\left(\\frac{\\pi }{15}\\right)}}{\\pi }$\nArgument: $-\\frac{14 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((25*(math.cos((math.pi/15))+i*math.sin((math.pi/15))))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 7 x^2-8 x-2$ and $q(x) = 2 x^2+13 x-5$", + "Output Answer": [ + "$14 x^4+75 x^3-143 x^2+14 x+10$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 7*x**2-8*x-2\nq = 2*x**2+13*x-5\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 6 \\sqrt{3} x^2-8 \\sqrt{3} x-\\frac{13}{\\sqrt{3}}$ and $q(x) = \\sqrt{3} x^2+4 \\sqrt{3} x-\\sqrt{3}$", + "Output Answer": [ + "$18 x^4+48 x^3-127 x^2-28 x+13$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 6*sqrt(3)*x**2-8*sqrt(3)*x-(13/(sqrt(3)))\nq = sqrt(3)*x**2+4*sqrt(3)*x-sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{27}{68}$, and $a_n=a_{n-1}+-12$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$-\\frac{170793}{68}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (27/68) # initial value\nd = -12 # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (27/68) # initial value\nd = -12 # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-10 x^6+8 x^5+17 x^4-20 x^3+40 x^2-16 x+16$ and $2 x^4-5 x^2-4$.", + "Output Answer": [ + "$2 x^4-5 x^2-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-10*x**6+8*x**5+17*x**4-20*x**3+40*x**2-16*x+16, 2*x**4-5*x**2-4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{12-9 x}+\\sqrt{8-7 x}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -574+12 \\sqrt{2262}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(12-9*x)+sqrt(8-7*x), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{79 x^2}{7}-\\frac{160 x}{7}-\\frac{61}{7}}{-\\frac{104 x^2}{7}-\\frac{80 x}{7}+\\frac{68}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{79} \\left(-80-\\sqrt{1581}\\right)\\right\\},\\left\\{x\\to \\frac{1}{79} \\left(-80+\\sqrt{1581}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((79*x**2)/7)-((160*x)/7)-(61/7))/(-((104*x**2)/7)-((80*x)/7)+(68/7))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-12$, and $a_n=a_{n-1}+\\frac{13}{\\sqrt{2}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{3}{2} \\left(13 \\sqrt{2}-24\\right)$" + ], + "Output Program": [ + "import math\n\na = -12 # initial value\nd = (13/(math.sqrt(2))) # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -12 # initial value\nd = (13/(math.sqrt(2))) # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2-15 x-18$", + "Output Answer": [ + "$3 (-x-3) (x+2)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2-15*x-18, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2+x+8 y^2+10 y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y+\\frac{5}{8}\\right)^2-7 \\left(x-\\frac{1}{14}\\right)^2=\\frac{61}{56}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{14} & -\\frac{5}{8}-\\frac{\\sqrt{915}}{56} \\\\\n \\frac{1}{14} & \\frac{1}{56} \\left(\\sqrt{915}-35\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{15}{7}}$\nCenter: $\\left\\{\\frac{1}{14},\\frac{1}{2} \\left(-\\frac{5}{8}-\\frac{\\sqrt{915}}{56}+\\frac{1}{56} \\left(\\sqrt{915}-35\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{56} \\left(\\sqrt{14}-35\\right)-\\frac{1}{2} \\sqrt{\\frac{7}{2}} x,y=\\frac{1}{2} \\sqrt{\\frac{7}{2}} x+\\frac{1}{56} \\left(-35-\\sqrt{14}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2+x+8*y**2+10*y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-20 x+11 y+8 z+20=0$, $24 x+14 y+4 z+24=0$, $-13 x+15 y-9 z-20=0$", + "Output Answer": [ + "$x=-\\frac{724}{2465}$, $y=-\\frac{1164}{2465}$, $z=-\\frac{6372}{2465}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-20*x+11*y+8*z+20, 24*x+14*y+4*z+24, -13*x+15*y-9*z-20)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $15 x^2-4 x-\\frac{21}{4}$", + "Output Answer": [ + "$15 \\left(x-\\frac{2}{15}\\right)^2-\\frac{331}{60}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (15*x**2-4*x-(21/4)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$14 x+23 y-24 z-4=0$, $-12 x-10 y-23 z-14=0$, $-17 x-23 y-9 z+11=0$", + "Output Answer": [ + "$x=-\\frac{17329}{2181}$, $y=\\frac{13054}{2181}$, $z=\\frac{2038}{2181}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((14*x+23*y-24*z-4, -12*x-10*y-23*z-14, -17*x-23*y-9*z+11)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((14-14)-13)-\\frac{1}{22} ((11-12)+18)$.", + "Output Answer": [ + "$-\\frac{303}{22}$" + ], + "Output Program": [ + "try: \n print(((14-14)-13)-(1/22)*((11-12)+18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2+4 x-10 y^2-5 y+9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 (x+1)^2-10 \\left(y+\\frac{1}{4}\\right)^2=-\\frac{61}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -1 & \\frac{1}{20} \\left(-5-\\sqrt{1830}\\right) \\\\\n -1 & \\frac{1}{20} \\left(\\sqrt{1830}-5\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{6}$\nCenter: $\\left\\{-1,\\frac{1}{2} \\left(\\frac{1}{20} \\left(-5-\\sqrt{1830}\\right)+\\frac{1}{20} \\left(\\sqrt{1830}-5\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\frac{x}{\\sqrt{5}}-\\frac{1}{\\sqrt{5}}-\\frac{1}{4},y=\\frac{x}{\\sqrt{5}}+\\frac{1}{20} \\left(4 \\sqrt{5}-5\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2+4*x-10*y**2-5*y+9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{1}{343} (5 x-22)^3, q(x) = \\frac{9}{49} (8 x+3)^2$", + "Output Answer": [ + "$-\\frac{125 x^3}{343}+\\frac{5682 x^2}{343}-\\frac{4236 x}{343}+\\frac{11215}{343}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(1/343)*(5*x-22)**3\nq = (9/49)*(8*x+3)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -x^2-14 x-5$, $q(x) = x^2+2 x+3$", + "Output Answer": [ + "$-12 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**2-14*x-5\nq = x**2+2*x+3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 11 \\sqrt{3}-\\sqrt{3} x\\right| =\\frac{10}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{23}{3}\\right\\},\\left\\{x\\to \\frac{43}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11*sqrt(3)-sqrt(3)*x), (10/(sqrt(3)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt{1-(9-4 x)^2}$", + "Output Answer": [ + "$2\\leq x\\leq \\frac{5}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sqrt(1-(9-4*x)**2)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{8+7 i}{\\sqrt{\\pi }}$ and $y=-\\frac{3-17 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{143-115 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((8+7*i)/(math.sqrt(math.pi)))\ny = -((3-17*i)/(math.sqrt(math.pi)))\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\cos ^{-1}(6 x+8)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{6}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(acos(6*x+8), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -x^2+11 x-5$ and $q(x) = -3 x^2-x+13$", + "Output Answer": [ + "$3 x^4-32 x^3-9 x^2+148 x-65$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -x**2+11*x-5\nq = -3*x**2-x+13\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $2 x^2+12 x+4$", + "Output Answer": [ + "$2 (x+3)^2-14$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (2*x**2+12*x+4), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $10 x^2-4 x-11$", + "Output Answer": [ + "$x=\\frac{1}{10} \\left(2-\\sqrt{114}\\right)\\lor x=\\frac{1}{10} \\left(2+\\sqrt{114}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(10*x**2-4*x-11, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 x^2+4 x-10$ and $q(x) = 6 x^2+10 x+8$", + "Output Answer": [ + "$18 x^4+54 x^3+4 x^2-68 x-80$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*x**2+4*x-10\nq = 6*x**2+10*x+8\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\left(\\left((5+20)^2-3\\right)+5\\right)+3}{5-8}$.", + "Output Answer": [ + "$-210$" + ], + "Output Program": [ + "try: \n print((((((5+20)**2-3)+5)+3)/(5-8)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-4 x^3-\\frac{896 x^2}{5}-\\frac{65172 x}{25}-\\frac{304776}{25}$", + "Output Answer": [ + "$4 \\left(-x-\\frac{51}{5}\\right) \\left(x+\\frac{83}{5}\\right) (x+18)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-4*x**3-((896*x**2)/5)-((65172*x)/25)-(304776/25), a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{21-25}{\\frac{7-13}{19}+15}$.", + "Output Answer": [ + "$-\\frac{76}{279}$" + ], + "Output Program": [ + "try: \n print(((21-25)/(((7-13)/19)+15)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{x^5}{2}+\\frac{17 x^4}{2}+8 x^3-\\frac{11 x^2}{2}-\\frac{9 x}{2}-\\frac{15}{2}$ when divided by $3$.", + "Output Answer": [ + "$-\\frac{x^5}{6}+\\frac{17 x^4}{6}+\\frac{8 x^3}{3}-\\frac{11 x^2}{6}-\\frac{3 x}{2}-\\frac{5}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((x**5)/2)+((17*x**4)/2)+8*x**3-((11*x**2)/2)-((9*x)/2)-(15/2)\nq = 3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+5 x-6 y^2+9 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x+\\frac{5}{6}\\right)^2-6 \\left(y-\\frac{3}{4}\\right)^2=\\frac{185}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{12} \\left(-10-\\sqrt{555}\\right) & \\frac{3}{4} \\\\\n \\frac{1}{12} \\left(\\sqrt{555}-10\\right) & \\frac{3}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{12} \\left(-10-\\sqrt{555}\\right)+\\frac{1}{12} \\left(\\sqrt{555}-10\\right)\\right),\\frac{3}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{2}}+\\frac{1}{12} \\left(9+5 \\sqrt{2}\\right),y=\\frac{1}{12} \\left(9-5 \\sqrt{2}\\right)-\\frac{x}{\\sqrt{2}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+5*x-6*y**2+9*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(-\\cos \\left(\\frac{17 \\pi }{90}\\right)-i \\sin \\left(\\frac{17 \\pi }{90}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$16 \\left(-\\cos \\left(\\frac{11 \\pi }{45}\\right)+i \\sin \\left(\\frac{11 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(-math.cos(((17*math.pi)/90))-1j*math.sin(((17*math.pi)/90))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{11}{25}$, and $a_n=a_{n-1}+5 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$5 \\left(\\frac{22}{25}+45 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = (11/25) # initial value\nd = 5*math.sqrt(2) # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (11/25) # initial value\nd = 5*math.sqrt(2) # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-4.01385+2.81052 i$.", + "Output Answer": [ + "Norm: $4.9$\nArgument: $2.53073$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -4.01385+2.81052*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\sqrt{2} \\left(\\sin \\left(\\frac{4 \\pi }{45}\\right)+i \\cos \\left(\\frac{4 \\pi }{45}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1934917632 \\left(\\cos \\left(\\frac{\\pi }{9}\\right)+i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*math.sqrt(2)*(math.sin(((4*math.pi)/45))+1j*math.cos(((4*math.pi)/45))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-4 x^2+84 x-152$", + "Output Answer": [ + "$4 (2-x) (x-19)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-4*x**2+84*x-152, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\cos (3-8 x)$ at the point $x=-4$", + "Output Answer": [ + "$\\cos (35) = -0.904$" + ], + "Output Program": [ + "import math\n\nx = -4\ntry: \n f = math.cos(3-8*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-3+2 i$ and $y=-7-i$", + "Output Answer": [ + "$4+3 i$" + ], + "Output Program": [ + "i = 1j\nx = -3+2*i\ny = -7-i\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2+6 x+7 y^2-3 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $(x+3)^2+7 \\left(y-\\frac{3}{14}\\right)^2=\\frac{401}{28}$\nFoci: $\\left(\n\\begin{array}{cc}\n -3-\\frac{\\sqrt{\\frac{1203}{2}}}{7} & \\frac{3}{14} \\\\\n \\frac{1}{14} \\left(\\sqrt{2406}-42\\right) & \\frac{3}{14} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{6}{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-3-\\frac{\\sqrt{\\frac{1203}{2}}}{7}+\\frac{1}{14} \\left(\\sqrt{2406}-42\\right)\\right),\\frac{3}{14}\\right\\}$\nArea Enclosed: $\\frac{401 \\pi }{28 \\sqrt{7}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2+6*x+7*y**2-3*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\sqrt{3} x^2+5 \\sqrt{3} x-3 \\sqrt{3}$", + "Output Answer": [ + "$\\frac{13 \\sqrt{3}}{4}-\\sqrt{3} \\left(x-\\frac{5}{2}\\right)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-math.sqrt(3)*x**2+5*math.sqrt(3)*x-3*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{4-23}{((6+22)-5)-23}$.", + "Output Answer": [ + "$\\text{ComplexInfinity}$" + ], + "Output Program": [ + "try: \n print(((4-23)/(((6+22)-5)-23)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $6 \\sqrt{2} \\left(-\\sin \\left(\\frac{7 \\pi }{90}\\right)+i \\cos \\left(\\frac{7 \\pi }{90}\\right)\\right)$.", + "Output Answer": [ + "Norm: $6 \\sqrt{2 \\left(\\sin ^2\\left(\\frac{7 \\pi }{90}\\right)+\\cos ^2\\left(\\frac{7 \\pi }{90}\\right)\\right)}$\nArgument: $\\frac{26 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 6*math.sqrt(2)*(-math.sin(((7*math.pi)/90))+i*math.cos(((7*math.pi)/90)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $13 x^2-9 x-7$", + "Output Answer": [ + "$13 \\left(x-\\frac{9}{26}\\right)^2-\\frac{445}{52}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (13*x**2-9*x-7), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-12 t+\\sqrt{3}+108, x(t)=\\sqrt{3} t-9 \\sqrt{3}$", + "Output Answer": [ + "$y=\\sqrt{3}-4 \\sqrt{3} x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -12*t+sqrt(3)+108\nx_t = sqrt(3)*t-9*sqrt(3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-10 \\sqrt{5} x+8 \\sqrt{5} y-5 \\sqrt{5} z+7 \\sqrt{5}=0$, $7 \\sqrt{5} x-9 \\sqrt{5} y-7 \\sqrt{5} z+6 \\sqrt{5}=0$, $-11 \\sqrt{5} x+4 \\sqrt{5} y+10 \\sqrt{5} z+8 \\sqrt{5}=0$", + "Output Answer": [ + "$x=\\frac{1842}{1031}$, $y=\\frac{1721}{1031}$, $z=\\frac{513}{1031}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-10*sqrt(5)*x+8*sqrt(5)*y-5*sqrt(5)*z+7*sqrt(5), 7*sqrt(5)*x-9*sqrt(5)*y-7*sqrt(5)*z+6*sqrt(5), -11*sqrt(5)*x+4*sqrt(5)*y+10*sqrt(5)*z+8*sqrt(5))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -11 \\sqrt{2} x-7 \\sqrt{2}\\right| =0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-11*sqrt(2)*x-7*sqrt(2)), 0), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(1-6)+(24-25)$.", + "Output Answer": [ + "$-6$" + ], + "Output Program": [ + "try: \n print((1-6)+(24-25))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\left(-\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$531441 \\left(-\\frac{1}{2}+\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*(-math.cos(((2*math.pi)/9))-1j*math.sin(((2*math.pi)/9))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2+x+2 y^2+2 y+7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(y+\\frac{1}{2}\\right)^2-6 \\left(x-\\frac{1}{12}\\right)^2=-\\frac{157}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{12} \\left(1-2 \\sqrt{157}\\right) & -\\frac{1}{2} \\\\\n \\frac{1}{12} \\left(1+2 \\sqrt{157}\\right) & -\\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{12} \\left(1-2 \\sqrt{157}\\right)+\\frac{1}{12} \\left(1+2 \\sqrt{157}\\right)\\right),-\\frac{1}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{3} x+\\frac{1}{12} \\left(-6-\\sqrt{3}\\right),y=\\frac{1}{12} \\left(\\sqrt{3}-6\\right)-\\sqrt{3} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2+x+2*y**2+2*y+7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 11 x^2-9 x-4$ and $q(x) = -5 x^2-9 x-2$", + "Output Answer": [ + "$-55 x^4-54 x^3+79 x^2+54 x+8$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 11*x**2-9*x-4\nq = -5*x**2-9*x-2\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x-6}+\\sqrt{14 x-3}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(157-8 \\sqrt{303}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x-6)+sqrt(14*x-3), 8), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-362797056 \\left(\\sin \\left(\\frac{\\pi }{18}\\right)-i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*(math.cos(((2*math.pi)/9))-1j*math.sin(((2*math.pi)/9))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $10 x^2+5 x-7$ when divided by $6-8 x$.", + "Output Answer": [ + "$-\\frac{5 x}{4}-\\frac{25}{16}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x**2+5*x-7\nq = 6-8*x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{11 x^2}{\\sqrt{3}}-\\frac{17 x}{\\sqrt{3}}+\\frac{19}{\\sqrt{3}}$ and $q(x) = -\\frac{11 x^2}{\\sqrt{3}}-\\sqrt{3} x-\\frac{22}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{121 x^4}{3}+\\frac{154 x^3}{3}-\\frac{400 x^2}{3}+\\frac{317 x}{3}-\\frac{418}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((11*x**2)/(sqrt(3)))-((17*x)/(sqrt(3)))+(19/(sqrt(3)))\nq = -((11*x**2)/(sqrt(3)))-sqrt(3)*x-(22/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2+6 x+6 y^2-4 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y-\\frac{1}{3}\\right)^2-8 \\left(x-\\frac{3}{8}\\right)^2=\\frac{157}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{8} & \\frac{1}{24} \\left(8-\\sqrt{1099}\\right) \\\\\n \\frac{3}{8} & \\frac{1}{24} \\left(8+\\sqrt{1099}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{7}}{2}$\nCenter: $\\left\\{\\frac{3}{8},\\frac{1}{2} \\left(\\frac{1}{24} \\left(8-\\sqrt{1099}\\right)+\\frac{1}{24} \\left(8+\\sqrt{1099}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{12} \\left(4+3 \\sqrt{3}\\right)-\\frac{2 x}{\\sqrt{3}},y=\\frac{2 x}{\\sqrt{3}}+\\frac{1}{12} \\left(4-3 \\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2+6*x+6*y**2-4*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{6120 x^3}{49}+\\frac{4248 x^2}{49}-\\frac{2432 x}{49}}{\\frac{13260 x}{49}-\\frac{4940}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{16}{15}\\right\\},\\{x\\to 0\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((6120*x**3)/49)+((4248*x**2)/49)-((2432*x)/49))/(((13260*x)/49)-(4940/49))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{22 x^2}{\\sqrt{3}}-\\frac{20 x}{\\sqrt{3}}-4 \\sqrt{3}$ and $q(x) = -5 \\sqrt{3} x^2-\\frac{4 x}{\\sqrt{3}}-\\frac{25}{\\sqrt{3}}$", + "Output Answer": [ + "$110 x^4+\\frac{388 x^3}{3}+270 x^2+\\frac{548 x}{3}+100$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((22*x**2)/(sqrt(3)))-((20*x)/(sqrt(3)))-4*sqrt(3)\nq = -5*sqrt(3)*x**2-((4*x)/(sqrt(3)))-(25/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\left(\\cos \\left(\\frac{11}{45}\\right)+i \\sin \\left(\\frac{11}{45}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$1679616 \\left(\\cos \\left(\\frac{88}{45}\\right)+i \\sin \\left(\\frac{88}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*(math.cos((11/45))+1j*math.sin((11/45))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=42-\\frac{28 t}{9}, x(t)=\\frac{4 t}{3}-15$", + "Output Answer": [ + "$y=7-\\frac{7 x}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 42-((28*t)/9)\nx_t = ((4*t)/3)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\tan ^{-1}\\left(6 x^4+9\\right)-\\sin \\left(8 x^2+4\\right)$ at the point $x=9$", + "Output Answer": [ + "$\\tan ^{-1}(39375)-\\sin (652) = 2.564$" + ], + "Output Program": [ + "import math\n\nx = 9\ntry: \n f = math.atan(6*x**4+9)-math.sin(8*x**2+4)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(137-36 t)^2, x(t)=4 t-15$", + "Output Answer": [ + "$y=81 x^2-36 x+4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (137-36*t)**2\nx_t = 4*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2+10 x-2 y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-4 x^2+10 x-2 y=-2$\nVertex: $\\left\\{\\frac{5}{4},\\frac{33}{8}\\right\\}$\nDirectrix: $y=\\frac{17}{4}$\nFocal Parameter: $\\frac{1}{4}$\nFocus: $\\left\\{\\frac{5}{4},4\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2+10*x-2*y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+5 x-4 y^2+5 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x+\\frac{5}{16}\\right)^2-4 \\left(y-\\frac{5}{8}\\right)^2=-\\frac{217}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{16} & \\frac{5}{8}-\\frac{\\sqrt{651}}{16} \\\\\n -\\frac{5}{16} & \\frac{1}{16} \\left(10+\\sqrt{651}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{2}}$\nCenter: $\\left\\{-\\frac{5}{16},\\frac{1}{2} \\left(\\frac{5}{8}-\\frac{\\sqrt{651}}{16}+\\frac{1}{16} \\left(10+\\sqrt{651}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\sqrt{2} x-\\frac{5}{16} \\left(\\sqrt{2}-2\\right),y=\\sqrt{2} x+\\frac{5}{16} \\left(2+\\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+5*x-4*y**2+5*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^5+5 x^4-6 x^3+4 x^2-3 x+7$ when divided by $8 x^4-4 x^3+8 x^2-5 x+1$.", + "Output Answer": [ + "$\\frac{3 x}{4}+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**5+5*x**4-6*x**3+4*x**2-3*x+7\nq = 8*x**4-4*x**3+8*x**2-5*x+1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{1+5}{(((8+7)-24)-18)^2+18}$.", + "Output Answer": [ + "$\\frac{2}{249}$" + ], + "Output Program": [ + "try: \n print(((1+5)/((((8+7)-24)-18)**2+18)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\tan \\left(\\cos \\left(8 x^2+7\\right)\\right)+\\sqrt[3]{7 x-4}$ at the point $x=2$", + "Output Answer": [ + "$\\sqrt[3]{10}+\\tan (\\cos (39)) = 2.428$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 2\ntry: \n f = math.tan(math.cos(8*x**2+7))+np.cbrt(7*x-4)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-1$ and $x^4-4 x^3+4 x^2+2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-1, x**4-4*x**3+4*x**2+2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{5 x^5}{2}-\\frac{x^4}{4}-\\frac{3 x^3}{2}+\\frac{7 x^2}{4}+\\frac{3 x}{4}+\\frac{1}{2}$ and $\\frac{5 x^3}{2}-x^2-\\frac{x}{2}-\\frac{1}{2}$.", + "Output Answer": [ + "$\\frac{5 x^3}{4}-\\frac{x^2}{2}-\\frac{x}{4}-\\frac{1}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((5*x**5)/2)-((x**4)/4)-((3*x**3)/2)+((7*x**2)/4)+((3*x)/4)+(1/2), ((5*x**3)/2)-x**2-(x/2)-(1/2)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\sqrt{3} x-\\frac{8}{\\sqrt{3}}\\right| =-8 \\sqrt{3}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-sqrt(3)*x-(8/(sqrt(3)))), -8*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-10 x^2-270 x-1400$", + "Output Answer": [ + "$-10 (-x-20) (-x-7)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-10*x**2-270*x-1400, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{28}{3} e^{-\\frac{83 i \\pi }{90}}$.", + "Output Answer": [ + "Norm: $\\frac{28}{3}$\nArgument: $-\\frac{83 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (28/3)*math.e**(-((83*i*math.pi)/90))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{16 x^2+13 x-18}{-20 x-24}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{32} \\left(-13-\\sqrt{1321}\\right)\\right\\},\\left\\{x\\to \\frac{1}{32} \\left(-13+\\sqrt{1321}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((16*x**2+13*x-18)/(-20*x-24)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2-48 \\sqrt{3} x+960$", + "Output Answer": [ + "$-8 \\left(-x-10 \\sqrt{3}\\right) \\left(4 \\sqrt{3}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2-48*sqrt(3)*x+960, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -2 x-1| =15$", + "Output Answer": [ + "$\\{\\{x\\to -8\\},\\{x\\to 7\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-2*x-1), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{93}{67}$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$\\frac{13419}{67}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(93/67) # initial value\nd = 10 # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(93/67) # initial value\nd = 10 # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{19 x^2}{\\sqrt{3}}+\\frac{22 x}{\\sqrt{3}}-\\frac{20}{\\sqrt{3}}$ and $q(x) = -5 \\sqrt{3} x^2-\\sqrt{3}$", + "Output Answer": [ + "$-95 x^4-110 x^3+81 x^2-22 x+20$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((19*x**2)/(sqrt(3)))+((22*x)/(sqrt(3)))-(20/(sqrt(3)))\nq = -5*sqrt(3)*x**2-sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{4} (157-80 t)^2, x(t)=8 t-15$", + "Output Answer": [ + "$y=25 x^2-35 x+\\frac{49}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/4)*(157-80*t)**2\nx_t = 8*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{7}{3}+\\frac{5 i}{3}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{74}}{3}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{5}{7}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(7/3)+((5*i)/3)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\sqrt{3} x^2+7 \\sqrt{3} x-6 \\sqrt{3}}{-9 \\sqrt{3} x-3 \\sqrt{3}}=0$", + "Output Answer": [ + "$\\{\\{x\\to 1\\},\\{x\\to 6\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-sqrt(3)*x**2+7*sqrt(3)*x-6*sqrt(3))/(-9*sqrt(3)*x-3*sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{22-i}{\\pi }$ and $y=\\frac{5-31 i}{\\pi }$", + "Output Answer": [ + "$\\frac{141}{986}+\\frac{677 i}{986}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((22-i)/math.pi)\ny = ((5-31*i)/math.pi)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\sinh ^{-1}\\left(2 x+\\frac{11}{2}\\right)$", + "Output Answer": [ + "$y\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(asinh(2*x+(11/2)), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\frac{16-15}{10}-7\\right)-6\\right)+(13+5)$.", + "Output Answer": [ + "$\\frac{51}{10}$" + ], + "Output Program": [ + "try: \n print(((((16-15)/10)-7)-6)+(13+5))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2+6 x+2 y^2-4 y+10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 (y-1)^2-8 \\left(x-\\frac{3}{8}\\right)^2=-\\frac{73}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{8} \\left(3-\\sqrt{365}\\right) & 1 \\\\\n \\frac{1}{8} \\left(3+\\sqrt{365}\\right) & 1 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{5}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{8} \\left(3-\\sqrt{365}\\right)+\\frac{1}{8} \\left(3+\\sqrt{365}\\right)\\right),1\\right\\}$\nAsymptotes: $\\left\\{y=2 x+\\frac{1}{4},y=\\frac{7}{4}-2 x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2+6*x+2*y**2-4*y+10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{7}, \\sqrt{3}, \\frac{1}{\\sqrt{2}})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{\\frac{345}{2}}}{7},\\tan ^{-1}\\left(\\frac{2 \\sqrt{74}}{7}\\right),\\tan ^{-1}\\left(7 \\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/7)\ny = math.sqrt(3)\nz = (1/(math.sqrt(2)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2-5 x-2$ and $x^5-2 x^4+3 x^3+2 x^2-2 x+4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2-5*x-2, x**5-2*x**4+3*x**3+2*x**2-2*x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{23}{4}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{621}{4}$" + ], + "Output Program": [ + "a = (23/4) # initial value\nd = 0 # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (23/4) # initial value\nd = 0 # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^5+8 x^4-5 x^3+7 x^2-2 x+8$ when divided by $-2 x^4-3 x^3-4 x^2-x-10$.", + "Output Answer": [ + "$-\\frac{3 x}{2}-\\frac{7}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**5+8*x**4-5*x**3+7*x**2-2*x+8\nq = -2*x**4-3*x**3-4*x**2-x-10\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=3$ and $y=5+9 i$", + "Output Answer": [ + "$\\frac{15}{106}-\\frac{27 i}{106}$" + ], + "Output Program": [ + "i = 1j\nx = 3\ny = 5+9*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-7-7 i$ and $y=4+4 i$", + "Output Answer": [ + "$-11-11 i$" + ], + "Output Program": [ + "i = 1j\nx = -7-7*i\ny = 4+4*i\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{9}{2}-6 i$ and $y=\\frac{11}{2}+\\frac{3 i}{2}$", + "Output Answer": [ + "$\\frac{135}{4}-\\frac{105 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = (9/2)-6*i\ny = (11/2)+((3*i)/2)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x-3$ when divided by $-4 x-6$.", + "Output Answer": [ + "$-\\frac{3}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x-3\nq = -4*x-6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$6 x+21 y+19=0$, $4 x+23=0$", + "Output Answer": [ + "$x=-\\frac{23}{4}$, $y=\\frac{31}{42}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((6*x+21*y+19, 4*x+23), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(3-2 i) \\sqrt{5}$ and $y=(-2-3 i) \\sqrt{5}$", + "Output Answer": [ + "$(1-5 i) \\sqrt{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (3-2*i)*math.sqrt(5)\ny = (-2-3*i)*math.sqrt(5)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-25 x^2-3 x+17}{-23 x^2-18 x-3}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{50} \\left(-3-\\sqrt{1709}\\right)\\right\\},\\left\\{x\\to \\frac{1}{50} \\left(-3+\\sqrt{1709}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-25*x**2-3*x+17)/(-23*x**2-18*x-3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(\\cos \\left(\\frac{7}{6}\\right)+i \\sin \\left(\\frac{7}{6}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$4194304 \\left(\\cos \\left(\\frac{77}{6}\\right)+i \\sin \\left(\\frac{77}{6}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(math.cos((7/6))+1j*math.sin((7/6))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (6, 4, \\sqrt{5})$", + "Output Answer": [ + "$\\left\\{\\sqrt{57},\\tan ^{-1}\\left(2 \\sqrt{\\frac{13}{5}}\\right),\\tan ^{-1}\\left(\\frac{2}{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 6\ny = 4\nz = math.sqrt(5)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 x^2-4 x$ and $q(x) = -14 x^2+12 x-1$", + "Output Answer": [ + "$70 x^4-4 x^3-43 x^2+4 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -5*x**2-4*x\nq = -14*x**2+12*x-1\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^6+4 x^5-5 x^4-6 x^3+6 x^2-x-2$ when divided by $-4 x^2-6 x+9$.", + "Output Answer": [ + "$-\\frac{7 x^4}{4}+\\frac{13 x^3}{8}-\\frac{41 x^2}{8}+\\frac{411 x}{32}-\\frac{2067}{64}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**6+4*x**5-5*x**4-6*x**3+6*x**2-x-2\nq = -4*x**2-6*x+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4$ and $x^3+x^2+2 x+4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4, x**3+x**2+2*x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2-5 x-6 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-3 x^2-5 x-6 y=-1$\nVertex: $\\left\\{-\\frac{5}{6},\\frac{37}{72}\\right\\}$\nDirectrix: $y=\\frac{73}{72}$\nFocal Parameter: $1$\nFocus: $\\left\\{-\\frac{5}{6},\\frac{1}{72}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2-5*x-6*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x+2$ and $x^4+4 x^2-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x+2, x**4+4*x**2-3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\cos ^{-1}\\left(\\sqrt[3]{4 x+9}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{4} \\left(\\cos ^3(y)-9\\right)\\text{ if }0 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{96875}{81}$" + ], + "Output Program": [ + "a = -(13/81) # initial value\nd = 4 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(13/81) # initial value\nd = 4 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 4 x^2-15 x-3\\right| =18$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(15-\\sqrt{561}\\right)\\right\\},\\left\\{x\\to \\frac{1}{8} \\left(15+\\sqrt{561}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(4*x**2-15*x-3), 18), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{625}{256} (2-5 x)^4, q(x) = \\frac{1}{16} (8 x+29)^2$", + "Output Answer": [ + "$\\frac{390625 x^4}{256}-\\frac{78125 x^3}{32}+\\frac{47003 x^2}{32}-\\frac{2893 x}{8}+\\frac{733}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (625/256)*(2-5*x)**4\nq = (1/16)*(8*x+29)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 14.22 x^2-13.03 x-7.97$, $q(x) = -8.6 x^2-4.09 x+5.9$", + "Output Answer": [ + "$5.62 x^2-17.12 x-2.07$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 14.22*x**2-13.03*x-7.97\nq = -8.6*x**2-4.09*x+5.9\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $8 x^2-14 x-1$", + "Output Answer": [ + "$x=\\frac{1}{8} \\left(7-\\sqrt{57}\\right)\\lor x=\\frac{1}{8} \\left(7+\\sqrt{57}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(8*x**2-14*x-1, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\sqrt{2} x^2-\\sqrt{2}$ and $q(x) = 9 \\sqrt{2} x^2-10 \\sqrt{2} x-7 \\sqrt{2}$", + "Output Answer": [ + "$18 x^4-20 x^3-32 x^2+20 x+14$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = sqrt(2)*x**2-sqrt(2)\nq = 9*sqrt(2)*x**2-10*sqrt(2)*x-7*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{((5-3)-2)^2}{\\left((10-6)^2-10\\right)-2}$.", + "Output Answer": [ + "$0$" + ], + "Output Program": [ + "try: \n print(((((5-3)-2)**2)/(((10-6)**2-10)-2)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{43}{3}-13 x}+\\sqrt{12-\\frac{19 x}{3}}=\\frac{35}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{120} \\left(-7063+7 \\sqrt{942945}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((43/3)-13*x)+sqrt(12-((19*x)/3)), (35/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{10 x^2}{\\sqrt{3}}+\\frac{7 x}{\\sqrt{3}}-\\frac{23}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{20} \\left(7-i \\sqrt{871}\\right)\\lor x=\\frac{1}{20} \\left(7+i \\sqrt{871}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((10*x**2)/(sqrt(3)))+((7*x)/(sqrt(3)))-(23/(sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-210 x^2+144 x+210}{63 x+45}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-210*x**2+144*x+210)/(63*x+45)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{72 x}{5}+\\frac{81 y}{5}+\\frac{19 z}{5}-\\frac{108}{5}=0$, $-11 x+\\frac{34 y}{5}+\\frac{74 z}{5}+\\frac{103}{5}=0$, $\\frac{53 x}{5}-22 y+\\frac{112 z}{5}+\\frac{101}{5}=0$", + "Output Answer": [ + "$x=\\frac{949961}{18549}$, $y=\\frac{795293}{18549}$, $z=\\frac{34981}{2061}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((72*x)/5)+((81*y)/5)+((19*z)/5)-(108/5), -11*x+((34*y)/5)+((74*z)/5)+(103/5), ((53*x)/5)-22*y+((112*z)/5)+(101/5))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $7 x^2-49 \\sqrt{3} x$", + "Output Answer": [ + "$-7 \\left(7 \\sqrt{3}-x\\right) x$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(7*x**2-49*sqrt(3)*x, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-108 x^2+216 x-108}{-351 x-108}=0$", + "Output Answer": [ + "$\\{\\{x\\to 1\\},\\{x\\to 1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-108*x**2+216*x-108)/(-351*x-108)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-3 x-23 y+15 z-21=0$, $3 x+y+3 z-10=0$, $9 x+9 y+z+14=0$", + "Output Answer": [ + "$x=-\\frac{65}{6}$, $y=8$, $z=\\frac{23}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-3*x-23*y+15*z-21, 3*x+y+3*z-10, 9*x+9*y+z+14)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2+2 x+3 y^2-y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(y-\\frac{1}{6}\\right)^2-9 \\left(x-\\frac{1}{9}\\right)^2=-\\frac{73}{36}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{9} \\left(1-\\sqrt{73}\\right) & \\frac{1}{6} \\\\\n \\frac{1}{9} \\left(1+\\sqrt{73}\\right) & \\frac{1}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{9} \\left(1-\\sqrt{73}\\right)+\\frac{1}{9} \\left(1+\\sqrt{73}\\right)\\right),\\frac{1}{6}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{3} x+\\frac{1}{18} \\left(3-2 \\sqrt{3}\\right),y=\\frac{1}{18} \\left(3+2 \\sqrt{3}\\right)-\\sqrt{3} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2+2*x+3*y**2-y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{\\left(17797 t^2+72150 t+73275\\right)^2}{15625}, x(t)=\\frac{1369 t^2}{25}+222 t+225$", + "Output Answer": [ + "$y=\\frac{169 x^2}{25}+\\frac{156 x}{25}+\\frac{36}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (((17797*t**2+72150*t+73275)**2)/15625)\nx_t = ((1369*t**2)/25)+222*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(15-10)-10}{18-11}$.", + "Output Answer": [ + "$-\\frac{5}{7}$" + ], + "Output Program": [ + "try: \n print((((15-10)-10)/(18-11)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $1-3 x$ and $5$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(1-3*x, 5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $3 x^2-\\frac{45 x}{7}+2$", + "Output Answer": [ + "$x=\\frac{1}{42} \\left(45-\\sqrt{849}\\right)\\lor x=\\frac{1}{42} \\left(45+\\sqrt{849}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(3*x**2-((45*x)/7)+2, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{9}{7} \\left(\\sin \\left(\\frac{5 \\pi }{36}\\right)+i \\cos \\left(\\frac{5 \\pi }{36}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{9}{7} \\sqrt{\\sin ^2\\left(\\frac{5 \\pi }{36}\\right)+\\cos ^2\\left(\\frac{5 \\pi }{36}\\right)}$\nArgument: $-\\frac{23 \\pi }{36}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(9/7)*(math.sin(((5*math.pi)/36))+i*math.cos(((5*math.pi)/36)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{11 x^3}{9}+\\frac{143 x^2}{9}-\\frac{121 x}{9}+11$ and $\\frac{x^3}{3}+\\frac{13 x^2}{3}-\\frac{11 x}{3}+3$.", + "Output Answer": [ + "$\\frac{x^3}{9}+\\frac{13 x^2}{9}-\\frac{11 x}{9}+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((11*x**3)/9)+((143*x**2)/9)-((121*x)/9)+11, ((x**3)/3)+((13*x**2)/3)-((11*x)/3)+3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{84}{41}$, and $a_n=a_{n-1}+-\\frac{1}{\\sqrt{2}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=12$.", + "Output Answer": [ + "$6 \\left(-\\frac{168}{41}-\\frac{11}{\\sqrt{2}}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(84/41) # initial value\nd = -(1/(math.sqrt(2))) # second term\nn = 12 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(84/41) # initial value\nd = -(1/(math.sqrt(2))) # second term\nn = 12 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{78 x}{5}-\\frac{12}{5}\\right| =\\frac{93}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{27}{26}\\right\\},\\left\\{x\\to \\frac{35}{26}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((78*x)/5)-(12/5)), (93/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^3+3 x^2+10 x+1$ when divided by $-3 x^3+4 x^2-x$.", + "Output Answer": [ + "$-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**3+3*x**2+10*x+1\nq = -3*x**3+4*x**2-x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^2+4 x+5$ when divided by $8 x-6$.", + "Output Answer": [ + "$\\frac{7 x}{8}+\\frac{37}{32}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**2+4*x+5\nq = 8*x-6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{7 x^5}{5}+9 x^4-7 x^3-\\frac{29 x^2}{5}+\\frac{43 x}{5}+3$ when divided by $-\\frac{43 x^5}{5}-\\frac{33 x^4}{5}+\\frac{17 x^3}{5}-\\frac{33 x^2}{5}+7 x+\\frac{42}{5}$.", + "Output Answer": [ + "$\\frac{7}{43}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((7*x**5)/5)+9*x**4-7*x**3-((29*x**2)/5)+((43*x)/5)+3\nq = -((43*x**5)/5)-((33*x**4)/5)+((17*x**3)/5)-((33*x**2)/5)+7*x+(42/5)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{81}{2} \\left(32 t^2+112 t+99\\right)^2, x(t)=72 t^2+252 t+\\frac{441}{2}$", + "Output Answer": [ + "$y=8 x^2+36 x+\\frac{81}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (81/2)*(32*t**2+112*t+99)**2\nx_t = 72*t**2+252*t+(441/2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{41 x}{\\sqrt{3}}-\\frac{22 y}{\\sqrt{3}}+\\frac{28}{\\sqrt{3}}=0$, $-\\frac{20 x}{\\sqrt{3}}+14 \\sqrt{3} y-\\frac{13}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{445}{641}$, $y=-\\frac{27}{1282}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((41*x)/(sqrt(3)))-((22*y)/(sqrt(3)))+(28/(sqrt(3))), -((20*x)/(sqrt(3)))+14*sqrt(3)*y-(13/(sqrt(3)))), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^4+5 x^3-10 x^2+5 x-7$ when divided by $-5 x^4-6 x^3-6 x^2+8 x+9$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**4+5*x**3-10*x**2+5*x-7\nq = -5*x**4-6*x**3-6*x**2+8*x+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{16} (65 t+291)^2, x(t)=-\\frac{13 t}{4}-15$", + "Output Answer": [ + "$y=25 x^2+\\frac{45 x}{2}+\\frac{81}{16}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/16)*(65*t+291)**2\nx_t = -((13*t)/4)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $6 x^2-72 \\sqrt{3} x+576$", + "Output Answer": [ + "$6 \\left(x-8 \\sqrt{3}\\right) \\left(x-4 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(6*x**2-72*sqrt(3)*x+576, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $2 x^2+10 x-11$", + "Output Answer": [ + "$2 \\left(x+\\frac{5}{2}\\right)^2-\\frac{47}{2}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (2*x**2+10*x-11), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{48 x^2}{5}+\\frac{34 x}{5}-3$", + "Output Answer": [ + "$-\\frac{48}{5} \\left(x-\\frac{17}{48}\\right)^2-\\frac{431}{240}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((48*x**2)/5)+((34*x)/5)-3), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{21}{19}$, and $a_n=a_{n-1}+-7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$-\\frac{1225}{19}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (21/19) # initial value\nd = -7 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (21/19) # initial value\nd = -7 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-24 x+9 y+19 z-14=0$, $23 x+17 y-20 z+9=0$, $5 x+2 y-20 z-21=0$", + "Output Answer": [ + "$x=-\\frac{5575}{3233}$, $y=\\frac{224}{3233}$, $z=-\\frac{4766}{3233}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-24*x+9*y+19*z-14, 23*x+17*y-20*z+9, 5*x+2*y-20*z-21)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 x^2 \\log (2)-15 x \\log (2)-21 \\log (2)$ and $q(x) = -11 x^2 \\log (2)-14 \\log (2)$", + "Output Answer": [ + "$-22 x^4 \\log ^2(2)+165 x^3 \\log ^2(2)+203 x^2 \\log ^2(2)+210 x \\log ^2(2)+294 \\log ^2(2)$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*x**2*log(2)-15*x*log(2)-21*log(2)\nq = -11*x**2*log(2)-14*log(2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -2 x-4| =0$", + "Output Answer": [ + "$\\{\\{x\\to -2\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-2*x-4), 0), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{41}{51}$, and $a_n=a_{n-1}+-9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=12$.", + "Output Answer": [ + "$-\\frac{9934}{17}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (41/51) # initial value\nd = -9 # second term\nn = 12 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (41/51) # initial value\nd = -9 # second term\nn = 12 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((9-23)+9)+13)-((22+20)-5)$.", + "Output Answer": [ + "$-29$" + ], + "Output Program": [ + "try: \n print((((9-23)+9)+13)-((22+20)-5))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-29 x^3-\\frac{694 x^2}{3}+241 x-\\frac{140}{3}}{\\frac{551 x^2}{3}+\\frac{229 x}{3}-140}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-13-\\sqrt{190}\\right)\\right\\},\\left\\{x\\to \\frac{1}{3} \\left(-13+\\sqrt{190}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-29*x**3-((694*x**2)/3)+241*x-(140/3))/(((551*x**2)/3)+((229*x)/3)-140)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{64} (3 t+50)^2, x(t)=-\\frac{t}{2}-15$", + "Output Answer": [ + "$y=\\frac{9 x^2}{16}+\\frac{15 x}{2}+25$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/64)*(3*t+50)**2\nx_t = -(t/2)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $6 \\sqrt{2} \\left(\\sin \\left(\\frac{17 \\pi }{90}\\right)-i \\cos \\left(\\frac{17 \\pi }{90}\\right)\\right)$.", + "Output Answer": [ + "Norm: $6 \\sqrt{2 \\left(\\sin ^2\\left(\\frac{17 \\pi }{90}\\right)+\\cos ^2\\left(\\frac{17 \\pi }{90}\\right)\\right)}$\nArgument: $-\\frac{14 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 6*math.sqrt(2)*(math.sin(((17*math.pi)/90))-i*math.cos(((17*math.pi)/90)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2-171 x-702$", + "Output Answer": [ + "$-9 (x+6) (x+13)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2-171*x-702, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-x-18 y+13 z-8=0$, $-11 x-15 y-3 z-9=0$, $5 x+18 y+18 z-11=0$", + "Output Answer": [ + "$x=-\\frac{2011}{1559}$, $y=\\frac{889}{4677}$, $z=\\frac{1215}{1559}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-x-18*y+13*z-8, -11*x-15*y-3*z-9, 5*x+18*y+18*z-11)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{19 x}{2}-19 y+\\frac{3}{2}=0$, $8 x-18 y-\\frac{9}{2}=0$", + "Output Answer": [ + "$x=-\\frac{225}{38}$, $y=-\\frac{219}{76}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((19*x)/2)-19*y+(3/2), 8*x-18*y-(9/2)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2-\\frac{376 x}{\\sqrt{3}}-\\frac{4400}{3}$", + "Output Answer": [ + "$-8 \\left(x+\\frac{22}{\\sqrt{3}}\\right) \\left(x+\\frac{25}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2-((376*x)/(sqrt(3)))-(4400/3), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+x+10 y^2+9 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $7 \\left(x+\\frac{1}{14}\\right)^2+10 \\left(y+\\frac{9}{20}\\right)^2=\\frac{1977}{280}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{140} \\left(-10-3 \\sqrt{659}\\right) & -\\frac{9}{20} \\\\\n \\frac{1}{140} \\left(3 \\sqrt{659}-10\\right) & -\\frac{9}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{10}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{140} \\left(-10-3 \\sqrt{659}\\right)+\\frac{1}{140} \\left(3 \\sqrt{659}-10\\right)\\right),-\\frac{9}{20}\\right\\}$\nArea Enclosed: $\\frac{1977 \\pi }{280 \\sqrt{70}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+x+10*y**2+9*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 8 (3 x+2)^3, q(x) = (4 x+1)^4$", + "Output Answer": [ + "$256 x^4+472 x^3+528 x^2+304 x+65$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*(3*x+2)**3\nq = (4*x+1)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-4 x-10 y^2-7 y+10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x-\\frac{1}{4}\\right)^2-10 \\left(y+\\frac{7}{20}\\right)^2=-\\frac{429}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{4} & \\frac{1}{40} \\left(-14-3 \\sqrt{429}\\right) \\\\\n \\frac{1}{4} & \\frac{1}{40} \\left(3 \\sqrt{429}-14\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2}$\nCenter: $\\left\\{\\frac{1}{4},\\frac{1}{2} \\left(\\frac{1}{40} \\left(-14-3 \\sqrt{429}\\right)+\\frac{1}{40} \\left(3 \\sqrt{429}-14\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{20} \\left(2 \\sqrt{5}-7\\right)-\\frac{2 x}{\\sqrt{5}},y=\\frac{2 x}{\\sqrt{5}}+\\frac{1}{20} \\left(-7-2 \\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-4*x-10*y**2-7*y+10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 15 x^2+23 x+17\\right| =-4$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(15*x**2+23*x+17), -4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{26}{5} \\left(\\cos \\left(\\frac{29}{18}\\right)+i \\sin \\left(\\frac{29}{18}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$\\frac{8031810176 \\left(\\cos \\left(\\frac{203}{18}\\right)+i \\sin \\left(\\frac{203}{18}\\right)\\right)}{78125}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((26/5)*(math.cos((29/18))+1j*math.sin((29/18))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{5}{19}$, and $a_n=a_{n-1}+-\\frac{7}{\\sqrt{2}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$12 \\left(\\frac{10}{19}-\\frac{161}{\\sqrt{2}}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (5/19) # initial value\nd = -(7/(math.sqrt(2))) # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (5/19) # initial value\nd = -(7/(math.sqrt(2))) # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^3-3 x^2+3 x-7$ when divided by $-2 x-6$.", + "Output Answer": [ + "$-\\frac{9 x^2}{2}+15 x-\\frac{93}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**3-3*x**2+3*x-7\nq = -2*x-6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2+3 x+y^2+6 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $(y+3)^2-4 \\left(x-\\frac{3}{8}\\right)^2=\\frac{71}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{8} & -3-\\frac{\\sqrt{355}}{8} \\\\\n \\frac{3}{8} & \\frac{\\sqrt{355}}{8}-3 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{2}$\nCenter: $\\left\\{\\frac{3}{8},-3\\right\\}$\nAsymptotes: $\\left\\{y=-2 x-\\frac{9}{4},y=2 x-\\frac{15}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2+3*x+y**2+6*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{7 x+3}+\\sqrt{9 x-10}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(405-7 \\sqrt{3281}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(7*x+3)+sqrt(9*x-10), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-7 x^2-\\frac{11 x}{2}+5$", + "Output Answer": [ + "$x=\\frac{1}{28} \\left(-11-\\sqrt{681}\\right)\\lor x=\\frac{1}{28} \\left(\\sqrt{681}-11\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-7*x**2-((11*x)/2)+5, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{25 x^2}{2}+10 x+\\frac{7}{2}$ and $q(x) = -\\frac{5 x^2}{2}+6 x+\\frac{23}{2}$", + "Output Answer": [ + "$\\frac{125 x^4}{4}-100 x^3-\\frac{185 x^2}{2}+136 x+\\frac{161}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((25*x**2)/2)+10*x+(7/2)\nq = -((5*x**2)/2)+6*x+(23/2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $11 x^2-2 x+12$", + "Output Answer": [ + "$11 \\left(x-\\frac{1}{11}\\right)^2+\\frac{131}{11}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (11*x**2-2*x+12), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\cos \\left(8 x^3+1\\right)$ at the point $x=-2$", + "Output Answer": [ + "$\\cos (63) = 0.986$" + ], + "Output Program": [ + "import math\n\nx = -2\ntry: \n f = math.cos(8*x**3+1)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$22 x+13 y-3 z+5=0$, $-23 x-3 y+13 z-5=0$, $-21 x-23 y-18 z-19=0$", + "Output Answer": [ + "$x=-\\frac{2790}{2563}$, $y=\\frac{2983}{2563}$, $z=-\\frac{14}{11}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((22*x+13*y-3*z+5, -23*x-3*y+13*z-5, -21*x-23*y-18*z-19)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $x^5+9 x^4-6 x^3-5 x^2+8 x+4$ when divided by $-5 x^4+5 x^3+9 x^2+x+6$.", + "Output Answer": [ + "$-\\frac{x}{5}-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**5+9*x**4-6*x**3-5*x**2+8*x+4\nq = -5*x**4+5*x**3+9*x**2+x+6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{64}{27}$, and $a_n=a_{n-1}+-5 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$8 \\left(\\frac{128}{27}-75 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (64/27) # initial value\nd = -5*math.sqrt(2) # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (64/27) # initial value\nd = -5*math.sqrt(2) # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(12+12 i) \\log (2)$ and $y=(-9+3 i) \\log (2)$", + "Output Answer": [ + "$-\\frac{4}{5}-\\frac{8 i}{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (12+12*i)*math.log10(2)\ny = (-9+3*i)*math.log10(2)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2-3 x+5 y^2-5 y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(y-\\frac{1}{2}\\right)^2-3 \\left(x+\\frac{1}{2}\\right)^2=-\\frac{3}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{2}-\\frac{2}{\\sqrt{5}} & \\frac{1}{2} \\\\\n \\frac{2}{\\sqrt{5}}-\\frac{1}{2} & \\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{5}}$\nCenter: $\\left\\{-\\frac{1}{2},\\frac{1}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{3}{5}} x+\\frac{1}{10} \\left(5+\\sqrt{15}\\right),y=\\frac{1}{10} \\left(5-\\sqrt{15}\\right)-\\sqrt{\\frac{3}{5}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2-3*x+5*y**2-5*y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((7-11)+15)-16)-((19+12)+18)$.", + "Output Answer": [ + "$-54$" + ], + "Output Program": [ + "try: \n print((((7-11)+15)-16)-((19+12)+18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{7+10 i}{\\sqrt{2}}$ and $y=-\\frac{5+7 i}{\\sqrt{2}}$", + "Output Answer": [ + "$\\frac{2+3 i}{\\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((7+10*i)/(math.sqrt(2)))\ny = -((5+7*i)/(math.sqrt(2)))\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-6 x^2-88 \\sqrt{3} x-950$", + "Output Answer": [ + "$-6 \\left(x+\\frac{19}{\\sqrt{3}}\\right) \\left(x+\\frac{25}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-6*x**2-88*sqrt(3)*x-950, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $12 x^6-19 x^5+4 x^4-16 x^3+4 x^2+20 x-5$ and $3 x^5-4 x^4-4 x^2+5$.", + "Output Answer": [ + "$3 x^5-4 x^4-4 x^2+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(12*x**6-19*x**5+4*x**4-16*x**3+4*x**2+20*x-5, 3*x**5-4*x**4-4*x**2+5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^5-2 x^4-x^3-7 x^2+x+10$ when divided by $-3 x^3+10 x^2-9$.", + "Output Answer": [ + "$-2 x^2-6 x-\\frac{59}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**5-2*x**4-x**3-7*x**2+x+10\nq = -3*x**3+10*x**2-9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3$ and $\\frac{7 x^4}{2}+\\frac{3 x^3}{2}+3 x^2-\\frac{7 x}{2}-4$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3, ((7*x**4)/2)+((3*x**3)/2)+3*x**2-((7*x)/2)-4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x-15}+2 \\sqrt{2}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(59-24 \\sqrt{2}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x-15)+2*sqrt(2), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^3-8 x^2-9 x+9$ when divided by $7-x$.", + "Output Answer": [ + "$-8 x^2-48 x-327$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**3-8*x**2-9*x+9\nq = 7-x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^4-x^3-2 x^2-7 x+3$ when divided by $9-7 x$.", + "Output Answer": [ + "$\\frac{2 x^3}{7}+\\frac{25 x^2}{49}+\\frac{323 x}{343}+\\frac{5308}{2401}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**4-x**3-2*x**2-7*x+3\nq = 9-7*x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$24 x-22 y-2 z-6=0$, $15 x-18 y-8 z+19=0$, $x-11 y-13 z-9=0$", + "Output Answer": [ + "$x=-\\frac{1788}{79}$, $y=-\\frac{4235}{158}$, $z=\\frac{3199}{158}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((24*x-22*y-2*z-6, 15*x-18*y-8*z+19, x-11*y-13*z-9)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{15 t}{2}-16, x(t)=\\frac{15 t}{2}-15$", + "Output Answer": [ + "$y=x-1$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = ((15*t)/2)-16\nx_t = ((15*t)/2)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 x^2+11 x-11$ and $q(x) = 2 x^2+9 x+1$", + "Output Answer": [ + "$-10 x^4-23 x^3+72 x^2-88 x-11$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -5*x**2+11*x-11\nq = 2*x**2+9*x+1\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{18}{31}$, and $a_n=a_{n-1}+-7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$-\\frac{41590}{31}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(18/31) # initial value\nd = -7 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(18/31) # initial value\nd = -7 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-456 x^2+630 x-216}{399 x-252}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-456*x**2+630*x-216)/(399*x-252)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10-4 x}+\\sqrt{14 x-14}=3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(29-4 \\sqrt{7}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10-4*x)+sqrt(14*x-14), 3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{17 x^6}{2}+5 x^5-5 x^4+8 x^3+\\frac{17 x^2}{2}+\\frac{19 x}{2}-\\frac{3}{2}$ when divided by $-7 x^5-\\frac{7 x^4}{2}+6 x^3-\\frac{9 x^2}{2}-\\frac{5 x}{2}+\\frac{11}{2}$.", + "Output Answer": [ + "$\\frac{17 x}{14}-\\frac{37}{28}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((17*x**6)/2)+5*x**5-5*x**4+8*x**3+((17*x**2)/2)+((19*x)/2)-(3/2)\nq = -7*x**5-((7*x**4)/2)+6*x**3-((9*x**2)/2)-((5*x)/2)+(11/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 6 x^2-2 x-12$ and $q(x) = -11 x^2-13 x+6$", + "Output Answer": [ + "$-66 x^4-56 x^3+194 x^2+144 x-72$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 6*x**2-2*x-12\nq = -11*x**2-13*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{23 x}{\\sqrt{2}}+3 \\sqrt{2}\\right| =-\\frac{31}{\\sqrt{2}}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((23*x)/(sqrt(2)))+3*sqrt(2)), -(31/(sqrt(2)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $9 x^2+\\frac{315 x}{\\sqrt{2}}+1188$", + "Output Answer": [ + "$-9 \\left(-x-12 \\sqrt{2}\\right) \\left(x+\\frac{11}{\\sqrt{2}}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(9*x**2+((315*x)/(sqrt(2)))+1188, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (2, 10, \\frac{1}{2})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{417}}{2},\\tan ^{-1}\\left(4 \\sqrt{26}\\right),\\tan ^{-1}(5)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 2\ny = 10\nz = (1/2)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((22+1)-10)-25) \\left(\\left((23-22)^2-25\\right)-24\\right)$.", + "Output Answer": [ + "$576$" + ], + "Output Program": [ + "try: \n print((((22+1)-10)-25)*(((23-22)**2-25)-24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\sqrt{3} \\left(-144 t^2+648 t-727\\right), x(t)=48 t^2-216 t+243$", + "Output Answer": [ + "$y=2 \\sqrt{3}-3 \\sqrt{3} x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = sqrt(3)*(-144*t**2+648*t-727)\nx_t = 48*t**2-216*t+243\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^3+6 x^2-3 x+8$ when divided by $5 x-3$.", + "Output Answer": [ + "$\\frac{4 x^2}{5}+\\frac{42 x}{25}+\\frac{51}{125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**3+6*x**2-3*x+8\nq = 5*x-3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $-\\tanh ^{-1}\\left(\\sin ^{-1}\\left(x+\\frac{25}{3}\\right)\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{25}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(-atanh(asin(x+(25/3))), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{66 x^2}{7}+\\frac{4 x}{7}-\\frac{1}{7}$ and $q(x) = -\\frac{103 x^2}{7}+\\frac{67 x}{7}+\\frac{57}{7}$", + "Output Answer": [ + "$\\frac{6798 x^4}{49}-\\frac{4834 x^3}{49}-\\frac{3391 x^2}{49}+\\frac{23 x}{7}-\\frac{57}{49}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((66*x**2)/7)+((4*x)/7)-(1/7)\nq = -((103*x**2)/7)+((67*x)/7)+(57/7)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{4}{69}$, and $a_n=a_{n-1}+-4 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{27}{2} \\left(-\\frac{8}{69}-104 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(4/69) # initial value\nd = -4*math.sqrt(3) # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(4/69) # initial value\nd = -4*math.sqrt(3) # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $9 x^2+\\frac{243 x}{4}+\\frac{495}{8}$", + "Output Answer": [ + "$-9 \\left(-x-\\frac{11}{2}\\right) \\left(x+\\frac{5}{4}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(9*x**2+((243*x)/4)+(495/8), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{6 x^2+17 x+2}{12 x-21}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(-17-\\sqrt{241}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(-17+\\sqrt{241}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((6*x**2+17*x+2)/(12*x-21)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2+4 x+7 y^2-2 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x+\\frac{2}{5}\\right)^2+7 \\left(y-\\frac{1}{7}\\right)^2=\\frac{383}{35}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{5}-\\frac{\\sqrt{766}}{35} & \\frac{1}{7} \\\\\n \\frac{1}{35} \\left(\\sqrt{766}-14\\right) & \\frac{1}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{2}{5}-\\frac{\\sqrt{766}}{35}+\\frac{1}{35} \\left(\\sqrt{766}-14\\right)\\right),\\frac{1}{7}\\right\\}$\nArea Enclosed: $\\frac{383 \\pi }{35 \\sqrt{35}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2+4*x+7*y**2-2*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\left(\\frac{11 x}{2}+\\frac{9}{2}\\right)^4 \\sqrt[3]{8-7 x}$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = (((11*x)/2)+(9/2))**4*cbrt(8-7*x)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-22 x+18 y+5 z-3=0$, $2 x+17 y-18 z-16=0$, $-21 x+20 y-8 z-3=0$", + "Output Answer": [ + "$x=\\frac{3349}{4149}$, $y=\\frac{4520}{4149}$, $z=\\frac{953}{4149}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-22*x+18*y+5*z-3, 2*x+17*y-18*z-16, -21*x+20*y-8*z-3)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\sqrt{2} \\left(\\sin \\left(\\frac{\\pi }{45}\\right)-i \\cos \\left(\\frac{\\pi }{45}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$16 \\left(\\cos \\left(\\frac{8 \\pi }{45}\\right)+i \\sin \\left(\\frac{8 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-math.sqrt(2)*(math.sin((math.pi/45))-1j*math.cos((math.pi/45))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{992 x^2}{7}+\\frac{6716 x}{49}+\\frac{1406}{49}}{-\\frac{1054 x}{7}-\\frac{323}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{37}{56}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((992*x**2)/7)+((6716*x)/49)+(1406/49))/(-((1054*x)/7)-(323/7))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $11 x^3-286 x^2+\\frac{9031 x}{4}-\\frac{19481}{4}$", + "Output Answer": [ + "$11 (11-x) \\left(\\frac{23}{2}-x\\right) \\left(x-\\frac{7}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(11*x**3-286*x**2+((9031*x)/4)-(19481/4), a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$-\\tan \\left(\\frac{13}{2}\\right)$", + "Output Answer": [ + "$y=-\\tan \\left(\\frac{13}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(-tan((13/2)), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-6 x^4-7 x^3+12 x^2+26 x+8$ and $2 x^2+5 x+4$.", + "Output Answer": [ + "$2 x^2+5 x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-6*x**4-7*x**3+12*x**2+26*x+8, 2*x**2+5*x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-x^5+10 x^4-\\frac{5 x^3}{2}-2 x^2-\\frac{3 x}{2}-\\frac{17}{2}$ when divided by $-8 x^5-9 x^4-3 x^3+\\frac{5 x^2}{2}-6 x+\\frac{5}{2}$.", + "Output Answer": [ + "$\\frac{1}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**5+10*x**4-((5*x**3)/2)-2*x**2-((3*x)/2)-(17/2)\nq = -8*x**5-9*x**4-3*x**3+((5*x**2)/2)-6*x+(5/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{-3 x^2+17 x-2}{\\sqrt{3}}$, $q(x) = \\frac{5 x^2+19 x-11}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\sqrt{3} x^2+\\frac{5 x^2}{\\sqrt{3}}+12 \\sqrt{3} x-\\frac{13}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((-3*x**2+17*x-2)/(sqrt(3)))\nq = ((5*x**2+19*x-11)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{25}{18}$, and $a_n=a_{n-1}+7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=17$.", + "Output Answer": [ + "$\\frac{16711}{18}$" + ], + "Output Program": [ + "a = -(25/18) # initial value\nd = 7 # second term\nn = 17 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(25/18) # initial value\nd = 7 # second term\nn = 17 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{12 x^2}{\\sqrt{\\pi }}-\\frac{21 x}{\\sqrt{\\pi }}-\\frac{14}{\\sqrt{\\pi }}$ and $q(x) = -\\frac{22 x^2}{\\sqrt{\\pi }}+\\frac{7 x}{\\sqrt{\\pi }}-\\frac{18}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{264 x^4}{\\pi }+\\frac{546 x^3}{\\pi }-\\frac{55 x^2}{\\pi }+\\frac{280 x}{\\pi }+\\frac{252}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((12*x**2)/(sqrt(pi)))-((21*x)/(sqrt(pi)))-(14/(sqrt(pi)))\nq = -((22*x**2)/(sqrt(pi)))+((7*x)/(sqrt(pi)))-(18/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$4 x+19 y+21=0$, $-23 x-15 y-12=0$", + "Output Answer": [ + "$x=\\frac{3}{13}$, $y=-\\frac{15}{13}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((4*x+19*y+21, -23*x-15*y-12), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{-3 x-3}-\\sqrt[3]{-8 x-3}$ at the point $x=6$", + "Output Answer": [ + "$-\\sqrt[3]{21}+\\sqrt[3]{51} = 0.95$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 6\ntry: \n f = np.cbrt(-3*x-3)-np.cbrt(-8*x-3)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-2 x-5 y-12 z-18=0$, $10 x+18 y-17 z-14=0$, $-7 x+11 y+19 z-5=0$", + "Output Answer": [ + "$x=-\\frac{10509}{3535}$, $y=\\frac{3756}{3535}$, $z=-\\frac{5116}{3535}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-2*x-5*y-12*z-18, 10*x+18*y-17*z-14, -7*x+11*y+19*z-5)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -6 x^2-5 x$ and $q(x) = 12 x^2-11 x+6$", + "Output Answer": [ + "$-72 x^4+6 x^3+19 x^2-30 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -6*x**2-5*x\nq = 12*x**2-11*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{200 x^2+\\frac{41 x}{3}-21}{-\\frac{125 x^2}{3}+85 x+36}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7}{24}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((200*x**2+((41*x)/3)-21)/(-((125*x**2)/3)+85*x+36)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-9 x-13 y-\\frac{40}{3}=0$, $11 x+22 y-\\frac{25}{3}=0$", + "Output Answer": [ + "$x=-\\frac{241}{33}$, $y=\\frac{133}{33}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-9*x-13*y-(40/3), 11*x+22*y-(25/3)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11-\\frac{31 x}{3}}+\\sqrt{7-x}=\\frac{35}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{168} \\left(-2903+5 \\sqrt{160293}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11-((31*x)/3))+sqrt(7-x), (35/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 3 x-5| =9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{4}{3}\\right\\},\\left\\{x\\to \\frac{14}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(3*x-5), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$14 x+16 y+11 z+3=0$, $-13 x+25 y+3 z-7=0$, $-23 x+11 y+14 z+13=0$", + "Output Answer": [ + "$x=\\frac{1279}{10998}$, $y=\\frac{5209}{10998}$, $z=-\\frac{678}{611}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((14*x+16*y+11*z+3, -13*x+25*y+3*z-7, -23*x+11*y+14*z+13)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-5 \\sqrt{3} \\left(-\\sin \\left(\\frac{11 \\pi }{45}\\right)+i \\cos \\left(\\frac{11 \\pi }{45}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-158203125 \\sqrt{3} \\left(-\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(1+\\sqrt{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-5*math.sqrt(3)*(-math.sin(((11*math.pi)/45))+1j*math.cos(((11*math.pi)/45))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{10 \\sqrt{2} x^2+4 \\sqrt{2} x+5 \\sqrt{2}}{-11 \\sqrt{2} x^2-8 \\sqrt{2} x-13 \\sqrt{2}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((10*sqrt(2)*x**2+4*sqrt(2)*x+5*sqrt(2))/(-11*sqrt(2)*x**2-8*sqrt(2)*x-13*sqrt(2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2-6 x+5 y^2-9 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $(x-3)^2+5 \\left(y-\\frac{9}{10}\\right)^2=\\frac{381}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n 3-\\frac{\\sqrt{381}}{5} & \\frac{9}{10} \\\\\n 3+\\frac{\\sqrt{381}}{5} & \\frac{9}{10} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{5}}$\nCenter: $\\left\\{3,\\frac{9}{10}\\right\\}$\nArea Enclosed: $\\frac{381 \\pi }{20 \\sqrt{5}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-6*x+5*y**2-9*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{39 x^3}{25}-\\frac{83 x^2}{25}-\\frac{274 x}{25}+\\frac{456}{25}$ and $\\frac{3 x^2}{5}-\\frac{2 x}{5}-\\frac{24}{5}$.", + "Output Answer": [ + "$\\frac{3 x^2}{25}-\\frac{2 x}{25}-\\frac{24}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((39*x**3)/25)-((83*x**2)/25)-((274*x)/25)+(456/25), ((3*x**2)/5)-((2*x)/5)-(24/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$-\\tan ^{-1}\\left(x+\\frac{2}{3}\\right)$", + "Output Answer": [ + "$-\\frac{\\pi }{2} 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$-\\frac{4700}{9}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(7/9) # initial value\nd = -(8/3) # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(7/9) # initial value\nd = -(8/3) # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -12 x^2+x+9$ and $q(x) = -13 x^2-11 x-14$", + "Output Answer": [ + "$156 x^4+119 x^3+40 x^2-113 x-126$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -12*x**2+x+9\nq = -13*x**2-11*x-14\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(11+12)^2+8}{13+3}$.", + "Output Answer": [ + "$\\frac{537}{16}$" + ], + "Output Program": [ + "try: \n print((((11+12)**2+8)/(13+3)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{9+23}{24}}{(22+24)-5}$.", + "Output Answer": [ + "$\\frac{4}{123}$" + ], + "Output Program": [ + "try: \n print((((9+23)/24)/((22+24)-5)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2+7 x+4 y^2-2 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $\\left(x+\\frac{7}{2}\\right)^2+4 \\left(y-\\frac{1}{4}\\right)^2=\\frac{35}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{4} \\left(-14-\\sqrt{210}\\right) & \\frac{1}{4} \\\\\n \\frac{1}{4} \\left(\\sqrt{210}-14\\right) & \\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{3}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{4} \\left(-14-\\sqrt{210}\\right)+\\frac{1}{4} \\left(\\sqrt{210}-14\\right)\\right),\\frac{1}{4}\\right\\}$\nArea Enclosed: $\\frac{35 \\pi }{4}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2+7*x+4*y**2-2*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$5 \\sqrt{2} x-5 \\sqrt{2} y-7 \\sqrt{2}=0$, $\\frac{5 x}{\\sqrt{2}}+\\frac{23 y}{\\sqrt{2}}+17 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{9}{140}$, $y=-\\frac{41}{28}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((5*sqrt(2)*x-5*sqrt(2)*y-7*sqrt(2), ((5*x)/(sqrt(2)))+((23*y)/(sqrt(2)))+17*sqrt(2)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+x+9 y^2-9 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $3 \\left(x+\\frac{1}{6}\\right)^2+9 \\left(y-\\frac{1}{2}\\right)^2=\\frac{19}{3}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{18} \\left(-3-2 \\sqrt{114}\\right) & \\frac{1}{2} \\\\\n \\frac{1}{18} \\left(2 \\sqrt{114}-3\\right) & \\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{18} \\left(-3-2 \\sqrt{114}\\right)+\\frac{1}{18} \\left(2 \\sqrt{114}-3\\right)\\right),\\frac{1}{2}\\right\\}$\nArea Enclosed: $\\frac{19 \\pi }{9 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+x+9*y**2-9*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-7 x^2+2 x+14$", + "Output Answer": [ + "$\\frac{99}{7}-7 \\left(x-\\frac{1}{7}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-7*x**2+2*x+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{11}{3}$ and $-\\frac{2 x^4}{3}-\\frac{5 x^3}{3}+2 x^2+\\frac{2 x}{3}+\\frac{4}{3}$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd((11/3), -((2*x**4)/3)-((5*x**3)/3)+2*x**2+((2*x)/3)+(4/3)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((((13+13)+10)+17)+17) ((21+8)+6)$.", + "Output Answer": [ + "$2450$" + ], + "Output Program": [ + "try: \n print(((((13+13)+10)+17)+17)*((21+8)+6))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{2 x}{3}-\\frac{52}{3}\\right| =\\frac{46}{3}$", + "Output Answer": [ + "$\\{\\{x\\to 3\\},\\{x\\to 49\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((2*x)/3)-(52/3)), (46/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{100}+\\sqrt{73}\\right) \\sqrt{18}$.", + "Output Answer": [ + "$3 \\sqrt{2} \\left(10+\\sqrt{73}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(100)+sqrt(73))*sqrt(18))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-14 x-\\frac{43}{4}}+\\sqrt{\\frac{19}{4}-4 x}=\\frac{13}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{200} \\left(-1831+26 \\sqrt{3461}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-14*x-(43/4))+sqrt((19/4)-4*x), (13/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{41 x}{3}-\\frac{10}{3}}+\\sqrt{6-\\frac{4 x}{3}}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-20476+24 \\sqrt{298902}}{1369}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((41*x)/3)-(10/3))+sqrt(6-((4*x)/3)), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{13 \\left(-\\cos \\left(\\frac{19 \\pi }{90}\\right)-i \\sin \\left(\\frac{19 \\pi }{90}\\right)\\right)}{\\sqrt{3}}\\right)^11$", + "Output Answer": [ + "$\\frac{1792160394037 \\left(-\\sin \\left(\\frac{8 \\pi }{45}\\right)-i \\cos \\left(\\frac{8 \\pi }{45}\\right)\\right)}{243 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((13*(-math.cos(((19*math.pi)/90))-1j*math.sin(((19*math.pi)/90))))/(math.sqrt(3))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $8 \\sqrt{3} x^2-\\frac{5 x}{\\sqrt{3}}-\\frac{13}{\\sqrt{3}}$", + "Output Answer": [ + "$8 \\sqrt{3} \\left(x-\\frac{5}{48}\\right)^2-\\frac{1273}{96 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (8*math.sqrt(3)*x**2-((5*x)/(math.sqrt(3)))-(13/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -(9 x-1)^3, q(x) = 16 (x+2)^2$", + "Output Answer": [ + "$-729 x^3+259 x^2+37 x+65$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(9*x-1)**3\nq = 16*(x+2)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -13 x^2-14 x+1$, $q(x) = 11 x^2-4 x+5$", + "Output Answer": [ + "$-2 x^2-18 x+6$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -13*x**2-14*x+1\nq = 11*x**2-4*x+5\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{64}{35}$, and $a_n=a_{n-1}+7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$\\frac{38637}{35}$" + ], + "Output Program": [ + "a = (64/35) # initial value\nd = 7 # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (64/35) # initial value\nd = 7 # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{62 x^2}{7}-\\frac{x}{7}-\\frac{53}{7}$", + "Output Answer": [ + "$x=\\frac{1}{124} \\left(1-\\sqrt{13145}\\right)\\lor x=\\frac{1}{124} \\left(1+\\sqrt{13145}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((62*x**2)/7)-(x/7)-(53/7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-5 \\sqrt{2} x^2-6 \\sqrt{2} x-12 \\sqrt{2}}{3 \\sqrt{2}-5 \\sqrt{2} x}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-5*sqrt(2)*x**2-6*sqrt(2)*x-12*sqrt(2))/(3*sqrt(2)-5*sqrt(2)*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 1, q(x) = -27 (2 x-1)^3$", + "Output Answer": [ + "$-216 x^3+324 x^2-162 x+28$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 1\nq = -27*(2*x-1)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9 x-4}+\\sqrt{10 x+9}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{24272}{2131+15 \\sqrt{20129}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9*x-4)+sqrt(10*x+9), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $6 x^5-9 x^4-18 x^3+15 x^2+3 x-12$ and $-3 x^3+3 x-3$.", + "Output Answer": [ + "$3 x^3-3 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(6*x**5-9*x**4-18*x**3+15*x**2+3*x-12, -3*x**3+3*x-3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\log \\left(6-\\frac{15 x}{2}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{15} \\left(12-2 e^y\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, log(6-((15*x)/2)))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\left(\\frac{15}{20}+1\\right)+4}{((10+2)+10)-25}$.", + "Output Answer": [ + "$-\\frac{23}{12}$" + ], + "Output Program": [ + "try: \n print(((((15/20)+1)+4)/(((10+2)+10)-25)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-9 x^2-9 x+14$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(-3-\\sqrt{65}\\right)\\lor x=\\frac{1}{6} \\left(\\sqrt{65}-3\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-9*x**2-9*x+14, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{3}{2}-\\frac{29 x}{2}}+\\sqrt{\\frac{25}{2}-3 x}=\\frac{9}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-3847+36 \\sqrt{11654}}{1058}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((3/2)-((29*x)/2))+sqrt((25/2)-3*x), (9/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -4 x^2+15 x+11$, $q(x) = -3 x^2+14 x-2$", + "Output Answer": [ + "$-7 x^2+29 x+9$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**2+15*x+11\nq = -3*x**2+14*x-2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\log (4 x-5)-\\tan (7-x)$ at the point $x=6$", + "Output Answer": [ + "$\\log (19)-\\tan (1) = 1.387$" + ], + "Output Program": [ + "import math\n\nx = 6\ntry: \n f = math.log(4*x-5)-math.tan(7-x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{5}{63}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$-\\frac{125}{63}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(5/63) # initial value\nd = 0 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(5/63) # initial value\nd = 0 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{\\sin (5 x+2)}{\\sqrt[3]{3 x-1}}$ at the point $x=-8$", + "Output Answer": [ + "$\\frac{\\sin (38)}{5^{2/3}} = 0.101$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = -8\ntry: \n f = ((math.sin(5*x+2))/(np.cbrt(3*x-1)))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\sqrt{2} \\left(-\\cos \\left(\\frac{\\pi }{15}\\right)-i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$-4096 \\sqrt{2} \\left(-\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*math.sqrt(2)*(-math.cos((math.pi/15))-1j*math.sin((math.pi/15))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-8 \\sqrt{3} x^2+4 \\sqrt{3} x-\\frac{7}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{4} \\left(1+i \\sqrt{\\frac{11}{3}}\\right)\\lor x=\\frac{1}{4} \\left(1-i \\sqrt{\\frac{11}{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-8*sqrt(3)*x**2+4*sqrt(3)*x-(7/(sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$22 x+16 y+14 z-22=0$, $-24 x+3 y-19 z+9=0$, $11 x-9 y-8 z-20=0$", + "Output Answer": [ + "$x=\\frac{2807}{2036}$, $y=\\frac{1053}{2036}$, $z=-\\frac{2415}{2036}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((22*x+16*y+14*z-22, -24*x+3*y-19*z+9, 11*x-9*y-8*z-20)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{23}{89}$, and $a_n=a_{n-1}+-2 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{27}{2} \\left(-\\frac{46}{89}-52 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(23/89) # initial value\nd = -2*math.sqrt(5) # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(23/89) # initial value\nd = -2*math.sqrt(5) # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $6 \\sqrt{2} x^2+\\frac{3 x}{\\sqrt{2}}-\\frac{9}{\\sqrt{2}}$", + "Output Answer": [ + "$6 \\sqrt{2} \\left(x+\\frac{1}{8}\\right)^2-\\frac{147}{16 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (6*math.sqrt(2)*x**2+((3*x)/(math.sqrt(2)))-(9/(math.sqrt(2)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x^2-4 x+2$ and $x^3-3 x^2+4 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x**2-4*x+2, x**3-3*x**2+4*x-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2+13 x-1$ and $q(x) = 14 x^2-14$", + "Output Answer": [ + "$-196 x^4+182 x^3+182 x^2-182 x+14$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2+13*x-1\nq = 14*x**2-14\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -6 x^2+12 x+11$ and $q(x) = -10 x^2+14 x-1$", + "Output Answer": [ + "$60 x^4-204 x^3+64 x^2+142 x-11$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -6*x**2+12*x+11\nq = -10*x**2+14*x-1\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $7 x^2+\\frac{84 x}{5}-\\frac{46816}{25}$", + "Output Answer": [ + "$7 \\left(-x-\\frac{88}{5}\\right) \\left(\\frac{76}{5}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(7*x**2+((84*x)/5)-(46816/25), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\cos \\left(\\frac{82}{45}\\right)+i \\sin \\left(\\frac{82}{45}\\right)\\right)^11$", + "Output Answer": [ + "$\\cos \\left(\\frac{902}{45}\\right)+i \\sin \\left(\\frac{902}{45}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.cos((82/45))+1j*math.sin((82/45)))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-x^5-5 x^4+8 x^3-9 x^2+2 x-4$ when divided by $7 x^5-2 x^4+x^3+3 x^2+6 x+5$.", + "Output Answer": [ + "$-\\frac{1}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**5-5*x**4+8*x**3-9*x**2+2*x-4\nq = 7*x**5-2*x**4+x**3+3*x**2+6*x+5\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-10 x-6 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $6 x^2-10 x-6 y=-6$\nVertex: $\\left\\{\\frac{5}{6},\\frac{11}{36}\\right\\}$\nDirectrix: $y=\\frac{1}{18}$\nFocal Parameter: $\\frac{1}{2}$\nFocus: $\\left\\{\\frac{5}{6},\\frac{5}{9}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-10*x-6*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{64}{49}$, and $a_n=a_{n-1}+-3$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$-\\frac{12298}{49}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(64/49) # initial value\nd = -3 # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(64/49) # initial value\nd = -3 # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 x^2-2 x+13$", + "Output Answer": [ + "$\\frac{27}{2}-2 \\left(x+\\frac{1}{2}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*x**2-2*x+13), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-5+4 i) \\sqrt{3}$ and $y=(1+3 i) \\sqrt{3}$", + "Output Answer": [ + "$\\frac{7}{10}+\\frac{19 i}{10}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-5+4*i)*math.sqrt(3)\ny = (1+3*i)*math.sqrt(3)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{256}{9} (x-3)^4, q(x) = \\frac{1}{3} (5 x+13)^2$", + "Output Answer": [ + "$\\frac{256 x^4}{9}-\\frac{1024 x^3}{3}+\\frac{4633 x^2}{3}-\\frac{9086 x}{3}+\\frac{7081}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (256/9)*(x-3)**4\nq = (1/3)*(5*x+13)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-322 x^2+\\frac{1156 x}{3}-\\frac{320}{3}}{\\frac{832}{3}-364 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{10}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-322*x**2+((1156*x)/3)-(320/3))/((832/3)-364*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{39}{7} e^{-\\frac{113 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $\\frac{39}{7}$\nArgument: $\\frac{67 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(39/7)*math.e**(-((113*i*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{49 x}{4}-4}+\\sqrt{13 x-6}=\\frac{31}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1232065}{4 \\left(97157+124 \\sqrt{613189}\\right)}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((49*x)/4)-4)+sqrt(13*x-6), (31/4)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $2 \\sqrt{3} x^2+\\frac{26 x}{\\sqrt{3}}+\\sqrt{3}$", + "Output Answer": [ + "$2 \\sqrt{3} \\left(x+\\frac{13}{6}\\right)^2+\\sqrt{3}-\\frac{169}{6 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (2*math.sqrt(3)*x**2+((26*x)/(math.sqrt(3)))+math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-7 x^2-x-13$", + "Output Answer": [ + "$-7 \\left(x+\\frac{1}{14}\\right)^2-\\frac{363}{28}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-7*x**2-x-13), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{25 x^3}{3}+\\frac{4 x^2}{3}+\\frac{23 x}{3}-\\frac{22}{3}$ when divided by $\\frac{22}{3}$.", + "Output Answer": [ + "$-\\frac{25 x^3}{22}+\\frac{2 x^2}{11}+\\frac{23 x}{22}-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((25*x**3)/3)+((4*x**2)/3)+((23*x)/3)-(22/3)\nq = (22/3)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-8 x^2+14 x-13$", + "Output Answer": [ + "$-8 \\left(x-\\frac{7}{8}\\right)^2-\\frac{55}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-8*x**2+14*x-13), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 x^2-13 x-10$, $q(x) = -5 x^2+11 x-12$", + "Output Answer": [ + "$4 x^2-2 x-22$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**2-13*x-10\nq = -5*x**2+11*x-12\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=3 i e^{-x-7}$ at the point $x=30$", + "Output Answer": [ + "$\\frac{3 i}{e^{37}} = 0.$" + ], + "Output Program": [ + "i = 1j\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{59}{15}$, and $a_n=a_{n-1}+7 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$10 \\left(\\frac{118}{15}+133 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = (59/15) # initial value\nd = 7*math.sqrt(2) # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (59/15) # initial value\nd = 7*math.sqrt(2) # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{11}{2} \\left(-\\cos \\left(\\frac{11 \\pi }{45}\\right)+i \\sin \\left(\\frac{11 \\pi }{45}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{25937424601 \\left(\\sin \\left(\\frac{\\pi }{18}\\right)-i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)}{1024}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((11/2)*(-math.cos(((11*math.pi)/45))+1j*math.sin(((11*math.pi)/45))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{17 x}{2}-\\frac{23}{2}}+\\sqrt{\\frac{53}{4}-7 x}=\\frac{23}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-8348+23 \\sqrt{130537}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((17*x)/2)-(23/2))+sqrt((53/4)-7*x), (23/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -4 x-22| =6$", + "Output Answer": [ + "$\\{\\{x\\to -7\\},\\{x\\to -4\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-4*x-22), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-7 x^2+9 x-6$", + "Output Answer": [ + "$-7 \\left(x-\\frac{9}{14}\\right)^2-\\frac{87}{28}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-7*x**2+9*x-6), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{38 x^2}{5}+\\frac{4 x}{5}-\\frac{4}{5}$", + "Output Answer": [ + "$x=\\frac{1}{19} \\left(1-i \\sqrt{37}\\right)\\lor x=\\frac{1}{19} \\left(1+i \\sqrt{37}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((38*x**2)/5)+((4*x)/5)-(4/5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -9 x^2+12 x+5$, $q(x) = -5 x^2+x+2$", + "Output Answer": [ + "$-14 x^2+13 x+7$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**2+12*x+5\nq = -5*x**2+x+2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$14 x-2 y+24=0$, $-9 x-18 y-14=0$", + "Output Answer": [ + "$x=-\\frac{46}{27}$, $y=\\frac{2}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((14*x-2*y+24, -9*x-18*y-14), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-2-3 i) \\pi$ and $y=(1+3 i) \\pi$", + "Output Answer": [ + "$-\\frac{11}{10}+\\frac{3 i}{10}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-2-3*i)*math.pi\ny = (1+3*i)*math.pi\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{8 x^2}{\\sqrt{\\pi }}-\\frac{25 x}{\\sqrt{\\pi }}-\\frac{1}{\\sqrt{\\pi }}$ and $q(x) = \\frac{21 x^2}{\\sqrt{\\pi }}+\\frac{25 x}{\\sqrt{\\pi }}+\\frac{6}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{168 x^4}{\\pi }-\\frac{325 x^3}{\\pi }-\\frac{598 x^2}{\\pi }-\\frac{175 x}{\\pi }-\\frac{6}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((8*x**2)/(sqrt(pi)))-((25*x)/(sqrt(pi)))-(1/(sqrt(pi)))\nq = ((21*x**2)/(sqrt(pi)))+((25*x)/(sqrt(pi)))+(6/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{23}{4} \\left(\\cos \\left(\\frac{77}{45}\\right)+i \\sin \\left(\\frac{77}{45}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{41426511213649 \\left(\\cos \\left(\\frac{154}{9}\\right)+i \\sin \\left(\\frac{154}{9}\\right)\\right)}{1048576}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((23/4)*(math.cos((77/45))+1j*math.sin((77/45))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x-\\frac{10}{3}}+\\sqrt{15 x+\\frac{16}{3}}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{15} \\left(575-14 \\sqrt{1254}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x-(10/3))+sqrt(15*x+(16/3)), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{26 x^2}{3}+\\frac{40 x}{3}-\\frac{41}{3}$", + "Output Answer": [ + "$x=\\frac{1}{26} \\left(20-3 i \\sqrt{74}\\right)\\lor x=\\frac{1}{26} \\left(20+3 i \\sqrt{74}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((26*x**2)/3)+((40*x)/3)-(41/3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{14 \\sqrt{2} x^2-9 \\sqrt{2} x-13 \\sqrt{2}}{-16 \\sqrt{2} x^2+4 \\sqrt{2} x+16 \\sqrt{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{28} \\left(9-\\sqrt{809}\\right)\\right\\},\\left\\{x\\to \\frac{1}{28} \\left(9+\\sqrt{809}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((14*sqrt(2)*x**2-9*sqrt(2)*x-13*sqrt(2))/(-16*sqrt(2)*x**2+4*sqrt(2)*x+16*sqrt(2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{13 x}{\\sqrt{3}}+\\frac{41 y}{\\sqrt{3}}-5 \\sqrt{3} z-\\frac{31}{\\sqrt{3}}=0$, $\\frac{7 x}{\\sqrt{3}}-9 \\sqrt{3} y-\\frac{4 z}{\\sqrt{3}}-14 \\sqrt{3}=0$, $\\frac{41 x}{\\sqrt{3}}+\\frac{2 y}{\\sqrt{3}}+\\frac{40 z}{\\sqrt{3}}+\\frac{26}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{88578}{21083}$, $y=\\frac{5692}{21083}$, $z=-\\frac{104781}{21083}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((13*x)/(sqrt(3)))+((41*y)/(sqrt(3)))-5*sqrt(3)*z-(31/(sqrt(3))), ((7*x)/(sqrt(3)))-9*sqrt(3)*y-((4*z)/(sqrt(3)))-14*sqrt(3), ((41*x)/(sqrt(3)))+((2*y)/(sqrt(3)))+((40*z)/(sqrt(3)))+(26/(sqrt(3))))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{11}{7}-x}+\\sqrt{10 x+9}=\\frac{22}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{539} \\left(32-4 \\sqrt{8481}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((11/7)-x)+sqrt(10*x+9), (22/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9 x-11}+\\sqrt{11 x-10}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(639-8 \\sqrt{6274}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9*x-11)+sqrt(11*x-10), 8), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{44 x^6}{5}-\\frac{38 x^5}{5}-\\frac{12 x^4}{5}-\\frac{37 x^3}{5}+\\frac{8 x^2}{5}-\\frac{31 x}{5}+\\frac{49}{5}$ when divided by $-\\frac{x^4}{5}-\\frac{12 x^3}{5}+7 x^2-\\frac{12 x}{5}+\\frac{37}{5}$.", + "Output Answer": [ + "$44 x^2-490 x+7432$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((44*x**6)/5)-((38*x**5)/5)-((12*x**4)/5)-((37*x**3)/5)+((8*x**2)/5)-((31*x)/5)+(49/5)\nq = -((x**4)/5)-((12*x**3)/5)+7*x**2-((12*x)/5)+(37/5)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$12 x-14 y+17 z+3=0$, $3 x+17 y+6 z+6=0$, $8 x+8 y-12 z-4=0$", + "Output Answer": [ + "$x=\\frac{68}{763}$, $y=-\\frac{24}{109}$, $z=-\\frac{321}{763}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((12*x-14*y+17*z+3, 3*x+17*y+6*z+6, 8*x+8*y-12*z-4)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -2 x^2-14 x-8$ and $q(x) = -9 x^2+9 x+6$", + "Output Answer": [ + "$18 x^4+108 x^3-66 x^2-156 x-48$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -2*x**2-14*x-8\nq = -9*x**2+9*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-15 x+22 y-21 z-22=0$, $2 x-16 y-z-23=0$, $4 x-19 y+5 z+23=0$", + "Output Answer": [ + "$x=\\frac{12703}{631}$, $y=\\frac{1210}{631}$, $z=-\\frac{8467}{631}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-15*x+22*y-21*z-22, 2*x-16*y-z-23, 4*x-19*y+5*z+23)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^4+9 x^3-7 x^2-5 x+9$ when divided by $6$.", + "Output Answer": [ + "$-\\frac{3 x^4}{2}+\\frac{3 x^3}{2}-\\frac{7 x^2}{6}-\\frac{5 x}{6}+\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**4+9*x**3-7*x**2-5*x+9\nq = 6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\sqrt{\\frac{8}{3}-7 x}$", + "Output Answer": [ + "$y\\geq 0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(sqrt((8/3)-7*x), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{13 x^2}{\\pi }-\\frac{11 x}{\\pi }+\\frac{26}{\\pi }$ and $q(x) = -\\frac{43 x^2}{\\pi }-\\frac{4 x}{\\pi }-\\frac{18}{\\pi }$", + "Output Answer": [ + "$-\\frac{559 x^4}{\\pi ^2}+\\frac{421 x^3}{\\pi ^2}-\\frac{1308 x^2}{\\pi ^2}+\\frac{94 x}{\\pi ^2}-\\frac{468}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((13*x**2)/pi)-((11*x)/pi)+(26/pi)\nq = -((43*x**2)/pi)-((4*x)/pi)-(18/pi)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{83 x}{7}+\\frac{18 y}{7}-\\frac{130 z}{7}+\\frac{143}{7}=0$, $-\\frac{149 y}{7}+12 z-\\frac{164}{7}=0$, $\\frac{137 x}{7}+\\frac{60 y}{7}+\\frac{127 z}{7}-\\frac{75}{7}=0$", + "Output Answer": [ + "$x=-\\frac{433255}{457617}$, $y=-\\frac{23124}{152539}$, $z=\\frac{770390}{457617}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((83*x)/7)+((18*y)/7)-((130*z)/7)+(143/7), -((149*y)/7)+12*z-(164/7), ((137*x)/7)+((60*y)/7)+((127*z)/7)-(75/7))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{57}{7}-\\frac{62 x}{7}}+\\sqrt{\\frac{23 x}{7}+\\frac{32}{7}}=\\frac{29}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-17924+58 \\sqrt{761259}}{50575}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((57/7)-((62*x)/7))+sqrt(((23*x)/7)+(32/7)), (29/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the seventh order series of the inverse of the following function around 7:\n$64 x^3$", + "Output Answer": [ + "$\\frac{\\sqrt[3]{x}}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, 64*x**3)\nprint(solve(f, x)[0].series(y, 7, 6))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{15}{16}$, and $a_n=a_{n-1}+2$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$\\frac{5187}{16}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(15/16) # initial value\nd = 2 # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(15/16) # initial value\nd = 2 # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $20 x^3-16 x^2+16 x+16$ and $-5 x^3+4 x^2-4 x-4$.", + "Output Answer": [ + "$5 x^3-4 x^2+4 x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(20*x**3-16*x**2+16*x+16, -5*x**3+4*x**2-4*x-4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=9 (34-21 t)^2, x(t)=9 t-15$", + "Output Answer": [ + "$y=49 x^2+42 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 9*(34-21*t)**2\nx_t = 9*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{86}{7}$, and $a_n=a_{n-1}+-10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$-\\frac{18062}{7}$" + ], + "Output Program": [ + "a = -(86/7) # initial value\nd = -10 # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(86/7) # initial value\nd = -10 # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-23 x-6 y-7 z-16=0$, $-23 x+18 y+14 z+19=0$, $25 x+12 y+9 z-16=0$", + "Output Answer": [ + "$x=\\frac{191}{313}$, $y=\\frac{8624}{939}$, $z=-\\frac{3807}{313}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-23*x-6*y-7*z-16, -23*x+18*y+14*z+19, 25*x+12*y+9*z-16)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\sqrt{3} \\left(\\frac{1}{4} \\left(-1-\\sqrt{5}\\right)+i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)\\right)^5$", + "Output Answer": [ + "$-288 \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*math.sqrt(3)*((1/4)*(-1-math.sqrt(5))+1j*math.sqrt((5/8)-((math.sqrt(5))/8))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\cos ^{-1}(\\log (-6 x-7))=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} (-7-e)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(acos(log(-6*x-7)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 24-x| =6$", + "Output Answer": [ + "$\\{\\{x\\to 18\\},\\{x\\to 30\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(24-x), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{429 x^2-393 x+90}{429 x-195}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{6}{13}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((429*x**2-393*x+90)/(429*x-195)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^6+x^5+6 x^4-9 x^3-4 x^2+6 x+8$ when divided by $2 x^4+9 x^3+7 x^2+10 x+4$.", + "Output Answer": [ + "$x^2-4 x+\\frac{35}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**6+x**5+6*x**4-9*x**3-4*x**2+6*x+8\nq = 2*x**4+9*x**3+7*x**2+10*x+4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=32 \\left(25 t^2+110 t+122\\right)^2, x(t)=50 t^2+220 t+242$", + "Output Answer": [ + "$y=8 x^2+32 x+32$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 32*(25*t**2+110*t+122)**2\nx_t = 50*t**2+220*t+242\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{4}{7} \\left(\\frac{1}{2}+\\frac{i \\sqrt{3}}{2}\\right)$.", + "Output Answer": [ + "Norm: $\\frac{4}{7}$\nArgument: $-\\frac{2 \\pi }{3}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(4/7)*((1/2)+((i*math.sqrt(3))/2))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2+7 x-9 y^2+4 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(x+\\frac{7}{20}\\right)^2-9 \\left(y-\\frac{2}{9}\\right)^2=\\frac{641}{360}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{180} \\left(-63-\\sqrt{12179}\\right) & \\frac{2}{9} \\\\\n \\frac{1}{180} \\left(\\sqrt{12179}-63\\right) & \\frac{2}{9} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{19}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{180} \\left(-63-\\sqrt{12179}\\right)+\\frac{1}{180} \\left(\\sqrt{12179}-63\\right)\\right),\\frac{2}{9}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{10} x}{3}+\\frac{1}{180} \\left(40+21 \\sqrt{10}\\right),y=\\frac{1}{180} \\left(40-21 \\sqrt{10}\\right)-\\frac{\\sqrt{10} x}{3}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2+7*x-9*y**2+4*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^5-7 x^4-4 x^3+5 x^2+2 x-4$ when divided by $-2 x^4+8 x^3-7 x^2-6 x-3$.", + "Output Answer": [ + "$-4 x-\\frac{25}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**5-7*x**4-4*x**3+5*x**2+2*x-4\nq = -2*x**4+8*x**3-7*x**2-6*x-3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 11 x+23| =17$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{40}{11}\\right\\},\\left\\{x\\to -\\frac{6}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11*x+23), 17), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -4 x^2+7 x+13$, $q(x) = 2 x^2+14 x+11$", + "Output Answer": [ + "$-2 x^2+21 x+24$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**2+7*x+13\nq = 2*x**2+14*x+11\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt{\\sin (7 x+6)}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{7} (2 \\pi c_1-6)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\},\\left\\{x\\to \\fbox{$\\frac{1}{7} (2 \\pi c_1+\\pi -6)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(sqrt(sin(7*x+6)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{17 x^3+\\frac{219 x^2}{2}-\\frac{1001 x}{2}+387}{234-221 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-15-\\sqrt{569}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(-15+\\sqrt{569}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((17*x**3+((219*x**2)/2)-((1001*x)/2)+387)/(234-221*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -6 x-23| =20$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{43}{6}\\right\\},\\left\\{x\\to -\\frac{1}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-6*x-23), 20), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-8 \\sqrt{3} x^2-\\sqrt{3} x+4 \\sqrt{3}$", + "Output Answer": [ + "$x=\\frac{1}{16} \\left(-1-\\sqrt{129}\\right)\\lor x=\\frac{1}{16} \\left(\\sqrt{129}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-8*sqrt(3)*x**2-sqrt(3)*x+4*sqrt(3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $4 \\sqrt{2} x^2+5 \\sqrt{2} x-10 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{8} \\left(-5-\\sqrt{185}\\right)\\lor x=\\frac{1}{8} \\left(\\sqrt{185}-5\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(4*sqrt(2)*x**2+5*sqrt(2)*x-10*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 x^2+8 x+8$ and $q(x) = 7 x^2+8 x+6$", + "Output Answer": [ + "$14 x^4+72 x^3+132 x^2+112 x+48$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*x**2+8*x+8\nq = 7*x**2+8*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $8 x^2+16 x+6$ and $-4 x-2$.", + "Output Answer": [ + "$4 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(8*x**2+16*x+6, -4*x-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 \\sqrt{3} x^2+3 \\sqrt{3} x+4 \\sqrt{3}$ and $q(x) = -\\sqrt{3} x^2+2 \\sqrt{3} x+6 \\sqrt{3}$", + "Output Answer": [ + "$-12 x^4+15 x^3+78 x^2+78 x+72$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*sqrt(3)*x**2+3*sqrt(3)*x+4*sqrt(3)\nq = -sqrt(3)*x**2+2*sqrt(3)*x+6*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $13 x^2-7 x+11$", + "Output Answer": [ + "$13 \\left(x-\\frac{7}{26}\\right)^2+\\frac{523}{52}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (13*x**2-7*x+11), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{12}{5}$ and $-\\frac{6}{5}$.", + "Output Answer": [ + "$\\frac{6}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-(12/5), -(6/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$3 x-11 y-4=0$, $21 x-5 y+12=0$", + "Output Answer": [ + "$x=-\\frac{19}{27}$, $y=-\\frac{5}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((3*x-11*y-4, 21*x-5*y+12), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2+9 x+8 y^2+8 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y+\\frac{1}{2}\\right)^2-4 \\left(x-\\frac{9}{8}\\right)^2=\\frac{111}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{9}{8} & \\frac{1}{16} \\left(-8-3 \\sqrt{74}\\right) \\\\\n \\frac{9}{8} & \\frac{1}{16} \\left(3 \\sqrt{74}-8\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{3}$\nCenter: $\\left\\{\\frac{9}{8},\\frac{1}{2} \\left(\\frac{1}{16} \\left(-8-3 \\sqrt{74}\\right)+\\frac{1}{16} \\left(3 \\sqrt{74}-8\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{16} \\left(9 \\sqrt{2}-8\\right)-\\frac{x}{\\sqrt{2}},y=\\frac{x}{\\sqrt{2}}+\\frac{1}{16} \\left(-8-9 \\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2+9*x+8*y**2+8*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{35}{54}$, and $a_n=a_{n-1}+\\frac{11}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$\\frac{66682}{135}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(35/54) # initial value\nd = (11/5) # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(35/54) # initial value\nd = (11/5) # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\pi (x-3) x$, $q(x) = \\pi \\left(-x^2+x+3\\right)$", + "Output Answer": [ + "$3 \\pi -2 \\pi x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = pi*(x-3)*x\nq = pi*(-x**2+x+3)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{3 \\left(-\\sin \\left(\\frac{13 \\pi }{90}\\right)+i \\cos \\left(\\frac{13 \\pi }{90}\\right)\\right)}{\\sqrt{2}}$.", + "Output Answer": [ + "Norm: $3 \\sqrt{\\frac{1}{2} \\left(\\sin ^2\\left(\\frac{13 \\pi }{90}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{90}\\right)\\right)}$\nArgument: $\\frac{29 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((3*(-math.sin(((13*math.pi)/90))+i*math.cos(((13*math.pi)/90))))/(math.sqrt(2)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-7 x-6 y^2+6 y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-7 x-6 y^2+6 y=-2$\nVertex: $\\left\\{\\frac{1}{2},\\frac{1}{2}\\right\\}$\nDirectrix: $x=\\frac{19}{24}$\nFocal Parameter: $\\frac{7}{12}$\nFocus: $\\left\\{\\frac{5}{24},\\frac{1}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x-6*y**2+6*y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{13}{76}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{33583}{76}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (13/76) # initial value\nd = 8 # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (13/76) # initial value\nd = 8 # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{31 x^2}{3}+\\frac{14 x}{3}-\\frac{25}{3}$", + "Output Answer": [ + "$x=\\frac{1}{31} \\left(-7-2 \\sqrt{206}\\right)\\lor x=\\frac{1}{31} \\left(2 \\sqrt{206}-7\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((31*x**2)/3)+((14*x)/3)-(25/3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 (7 t+55)^2, x(t)=-2 t-15$", + "Output Answer": [ + "$y=49 x^2-70 x+25$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*(7*t+55)**2\nx_t = -2*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{53}{7}-\\frac{6 x}{7}}+\\sqrt{-\\frac{3 x}{7}-\\frac{67}{7}}=\\frac{104}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{21} \\left(-31608+208 \\sqrt{20323}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((53/7)-((6*x)/7))+sqrt(-((3*x)/7)-(67/7)), (104/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-6 x^2+9 x-13$", + "Output Answer": [ + "$-6 \\left(x-\\frac{3}{4}\\right)^2-\\frac{77}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-6*x**2+9*x-13), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(t+23)^2, x(t)=-t-15$", + "Output Answer": [ + "$y=x^2-16 x+64$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (t+23)**2\nx_t = -t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sin ^{-1}\\left(\\sqrt[3]{1-9 x}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{9} \\left(1-\\sin ^3(y)\\right)\\text{ if }0 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{2}{23} ((((1+16)+20)+8)+24)$.", + "Output Answer": [ + "$6$" + ], + "Output Program": [ + "try: \n print((2/23)*((((1+16)+20)+8)+24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2+8 x+15$", + "Output Answer": [ + "$-((-x-5) (x+3))$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2+8*x+15, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\cos \\left(\\frac{11 \\pi }{90}\\right)+i \\sin \\left(\\frac{11 \\pi }{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$16807 \\left(-\\sin \\left(\\frac{\\pi }{9}\\right)+i \\cos \\left(\\frac{\\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.cos(((11*math.pi)/90))+1j*math.sin(((11*math.pi)/90))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^4+2 x^3-6 x^2+6 x-6$ when divided by $-4 x^3+4 x^2+4 x+9$.", + "Output Answer": [ + "$-\\frac{9 x}{4}-\\frac{11}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**4+2*x**3-6*x**2+6*x-6\nq = -4*x**3+4*x**2+4*x+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 14 x+9| =0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{9}{14}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(14*x+9), 0), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\cos (\\log (3-5 x))$", + "Output Answer": [ + "$x<\\frac{3}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = cos(log(3-5*x))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{5}{7}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$-\\frac{130}{7}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(5/7) # initial value\nd = 0 # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(5/7) # initial value\nd = 0 # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{20}{3}+\\frac{4 i}{3}$ and $y=-9+\\frac{8 i}{3}$", + "Output Answer": [ + "$-\\frac{7}{3}+4 i$" + ], + "Output Program": [ + "i = 1j\nx = (20/3)+((4*i)/3)\ny = -9+((8*i)/3)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{7 x}{\\sqrt{3}}-\\frac{29}{\\sqrt{3}}\\right| =\\frac{4}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{25}{7}\\right\\},\\left\\{x\\to \\frac{33}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((7*x)/(sqrt(3)))-(29/(sqrt(3)))), (4/(sqrt(3)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{5684 x^2}{25}-\\frac{1706 x}{25}+\\frac{528}{25}}{\\frac{539 x}{5}+\\frac{264}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{11}{58}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((5684*x**2)/25)-((1706*x)/25)+(528/25))/(((539*x)/5)+(264/5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2+54 x-340$", + "Output Answer": [ + "$-2 (10-x) (17-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2+54*x-340, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=128 \\left(4 t^2-22 t+31\\right)^2, x(t)=32 t^2-176 t+242$", + "Output Answer": [ + "$y=2 x^2+24 x+72$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 128*(4*t**2-22*t+31)**2\nx_t = 32*t**2-176*t+242\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{27 x}{4}+13}+\\frac{\\sqrt{19}}{2}=\\frac{9}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(16-6 \\sqrt{19}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((27*x)/4)+13)+((sqrt(19))/2), (9/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$9 x-5 y+6 z-9=0$, $-13 x+18 y+16 z+25=0$, $-5 x+22 y+9 z+19=0$", + "Output Answer": [ + "$x=\\frac{2563}{3071}$, $y=-\\frac{48}{83}$, $z=-\\frac{718}{3071}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((9*x-5*y+6*z-9, -13*x+18*y+16*z+25, -5*x+22*y+9*z+19)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{21 x^2}{2}+8 x-12$", + "Output Answer": [ + "$x=\\frac{2}{21} \\left(-4-\\sqrt{142}\\right)\\lor x=\\frac{2}{21} \\left(\\sqrt{142}-4\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((21*x**2)/2)+8*x-12, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-9 i$ and $y=-4-4 i$", + "Output Answer": [ + "$\\frac{9}{8}+\\frac{9 i}{8}$" + ], + "Output Program": [ + "i = 1j\nx = -9*i\ny = -4-4*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{56}{95}$, and $a_n=a_{n-1}+\\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$\\frac{7}{2} \\left(6 \\pi -\\frac{112}{95}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(56/95) # initial value\nd = math.pi # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(56/95) # initial value\nd = math.pi # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left(\\frac{17}{18}+15\\right)+12\\right)+14\\right) (((25+21)-14)+6)$.", + "Output Answer": [ + "$\\frac{14345}{9}$" + ], + "Output Program": [ + "try: \n print(((((17/18)+15)+12)+14)*(((25+21)-14)+6))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x+2}+\\sqrt{12 x-3}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(40-5 \\sqrt{57}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x+2)+sqrt(12*x-3), 5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{1}{(8 x+6)^2}+\\tan ^{-1}(2-2 x)$ at the point $x=-9$", + "Output Answer": [ + "$\\frac{1}{4356}+\\tan ^{-1}(20) = 1.521$" + ], + "Output Program": [ + "import math\n\nx = -9\ntry: \n f = (1/((8*x+6)**2))+math.atan(2-2*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\left(\\cos \\left(\\frac{\\pi }{9}\\right)+i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$2176782336 \\left(-\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*(math.cos((math.pi/9))+1j*math.sin((math.pi/9))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x-5$ and $4 x^2+3 x+4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x-5, 4*x**2+3*x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{343}{125} (5 x-6)^3, q(x) = \\frac{16}{625} (15-4 x)^4$", + "Output Answer": [ + "$\\frac{4096 x^4}{625}+\\frac{30587 x^3}{125}-\\frac{17046 x^2}{25}+\\frac{2484 x}{25}+\\frac{87912}{125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (343/125)*(5*x-6)**3\nq = (16/625)*(15-4*x)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+6 x+6 y^2-7 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x+\\frac{3}{4}\\right)^2+6 \\left(y-\\frac{7}{12}\\right)^2=\\frac{247}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{24} \\left(-18-\\sqrt{494}\\right) & \\frac{7}{12} \\\\\n \\frac{1}{24} \\left(\\sqrt{494}-18\\right) & \\frac{7}{12} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{24} \\left(-18-\\sqrt{494}\\right)+\\frac{1}{24} \\left(\\sqrt{494}-18\\right)\\right),\\frac{7}{12}\\right\\}$\nArea Enclosed: $\\frac{247 \\pi }{48 \\sqrt{6}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+6*x+6*y**2-7*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left((24+24)^2-11\\right)-6\\right) ((13+25)+1)$.", + "Output Answer": [ + "$89193$" + ], + "Output Program": [ + "try: \n print((((24+24)**2-11)-6)*((13+25)+1))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $10 x^2-11 x+10$", + "Output Answer": [ + "$10 \\left(x-\\frac{11}{20}\\right)^2+\\frac{279}{40}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (10*x**2-11*x+10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = x^2-10 x-2$, $q(x) = -3 x^2+7 x+12$", + "Output Answer": [ + "$-2 x^2-3 x+10$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**2-10*x-2\nq = -3*x**2+7*x+12\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{37}{4} \\left(\\cos \\left(\\frac{8 \\pi }{45}\\right)+i \\sin \\left(\\frac{8 \\pi }{45}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$-\\frac{69343957 \\left(-\\cos \\left(\\frac{\\pi }{9}\\right)+i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)}{1024}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(37/4)*(math.cos(((8*math.pi)/45))+1j*math.sin(((8*math.pi)/45))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\left(\\cos \\left(\\frac{19}{18}\\right)+i \\sin \\left(\\frac{19}{18}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$-243 \\left(\\cos \\left(\\frac{95}{18}\\right)+i \\sin \\left(\\frac{95}{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*(math.cos((19/18))+1j*math.sin((19/18))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+9 x-7 y^2-5 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x+\\frac{1}{2}\\right)^2-7 \\left(y+\\frac{5}{14}\\right)^2=\\frac{131}{14}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{2}-\\frac{2 \\sqrt{262}}{21} & -\\frac{5}{14} \\\\\n \\frac{2 \\sqrt{262}}{21}-\\frac{1}{2} & -\\frac{5}{14} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{4}{\\sqrt{7}}$\nCenter: $\\left\\{-\\frac{1}{2},-\\frac{5}{14}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3 x}{\\sqrt{7}}+\\frac{1}{14} \\left(3 \\sqrt{7}-5\\right),y=\\frac{1}{14} \\left(-5-3 \\sqrt{7}\\right)-\\frac{3 x}{\\sqrt{7}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+9*x-7*y**2-5*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\sqrt{5} x^2+3 \\sqrt{5} x-\\sqrt{5}$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(3-\\sqrt{5}\\right)\\lor x=\\frac{1}{2} \\left(3+\\sqrt{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-sqrt(5)*x**2+3*sqrt(5)*x-sqrt(5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 24 x+3| =-7$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(24*x+3), -7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(\\cos \\left(\\frac{89}{45}\\right)+i \\sin \\left(\\frac{89}{45}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$27 \\left(\\cos \\left(\\frac{89}{15}\\right)+i \\sin \\left(\\frac{89}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(math.cos((89/45))+1j*math.sin((89/45))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{517 x^2}{9}+\\frac{1217 x}{9}+28}{\\frac{329 x^2}{3}-\\frac{3242 x}{9}-73}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{28}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((517*x**2)/9)+((1217*x)/9)+28)/(((329*x**2)/3)-((3242*x)/9)-73)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $3 x^2-12 \\sqrt{3} x-448$", + "Output Answer": [ + "$3 \\left(x-\\frac{28}{\\sqrt{3}}\\right) \\left(x+\\frac{16}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(3*x**2-12*sqrt(3)*x-448, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-x^3-6 x^2-11 x-6$ and $x^2+3 x+2$.", + "Output Answer": [ + "$x^2+3 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-x**3-6*x**2-11*x-6, x**2+3*x+2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-6 \\sqrt{2} \\left(6 t^2+44 t+81\\right), x(t)=18 t^2+132 t+242$", + "Output Answer": [ + "$y=-2 \\sqrt{2} x-2 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -6*sqrt(2)*(6*t**2+44*t+81)\nx_t = 18*t**2+132*t+242\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{1}{18}$, and $a_n=a_{n-1}+\\frac{37}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=12$.", + "Output Answer": [ + "$\\frac{7316}{15}$" + ], + "Output Program": [ + "a = -(1/18) # initial value\nd = (37/5) # second term\nn = 12 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(1/18) # initial value\nd = (37/5) # second term\nn = 12 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-4 \\sqrt{3} x-3 \\sqrt{3} y-\\frac{29 z}{\\sqrt{3}}-\\frac{37}{\\sqrt{3}}=0$, $\\frac{7 x}{\\sqrt{3}}+\\frac{38 y}{\\sqrt{3}}-4 \\sqrt{3} z-\\frac{11}{\\sqrt{3}}=0$, $\\frac{2 x}{\\sqrt{3}}-11 \\sqrt{3} y-\\frac{31 z}{\\sqrt{3}}-\\frac{28}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{8450}{13027}$, $y=\\frac{2155}{26054}$, $z=-\\frac{26917}{26054}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-4*sqrt(3)*x-3*sqrt(3)*y-((29*z)/(sqrt(3)))-(37/(sqrt(3))), ((7*x)/(sqrt(3)))+((38*y)/(sqrt(3)))-4*sqrt(3)*z-(11/(sqrt(3))), ((2*x)/(sqrt(3)))-11*sqrt(3)*y-((31*z)/(sqrt(3)))-(28/(sqrt(3))))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{81}{16} \\left(80 t^2-400 t+497\\right)^2, x(t)=36 t^2-180 t+225$", + "Output Answer": [ + "$y=25 x^2-\\frac{135 x}{2}+\\frac{729}{16}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (81/16)*(80*t**2-400*t+497)**2\nx_t = 36*t**2-180*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 16 \\sqrt{2} (2 x-1)^3, q(x) = 2 \\sqrt{2} (x-2)$", + "Output Answer": [ + "$128 \\sqrt{2} x^3-192 \\sqrt{2} x^2+98 \\sqrt{2} x-20 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 16*sqrt(2)*(2*x-1)**3\nq = 2*sqrt(2)*(x-2)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\sin (6-8 x)$ at the point $x=-9$", + "Output Answer": [ + "$-\\sin (78) = -0.514$" + ], + "Output Program": [ + "import math\n\nx = -9\ntry: \n f = -math.sin(6-8*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-5 \\sqrt{3} \\left(\\cos \\left(\\frac{7 \\pi }{90}\\right)-i \\sin \\left(\\frac{7 \\pi }{90}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$31640625 \\left(-\\sin \\left(\\frac{11 \\pi }{90}\\right)-i \\cos \\left(\\frac{11 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-5*math.sqrt(3)*(math.cos(((7*math.pi)/90))-1j*math.sin(((7*math.pi)/90))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $4 \\sqrt{2} x^2-3 \\sqrt{2} x+4 \\sqrt{2}$", + "Output Answer": [ + "$4 \\sqrt{2} \\left(x-\\frac{3}{8}\\right)^2+4 \\sqrt{2}-\\frac{9}{8 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (4*math.sqrt(2)*x**2-3*math.sqrt(2)*x+4*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x-12}+\\sqrt{14 x-5}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(185-4 \\sqrt{534}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x-12)+sqrt(14*x-5), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{10}{7}-\\frac{96 x}{7}}+\\sqrt{\\frac{44}{7}-\\frac{40 x}{7}}=\\frac{79}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-107763+158 \\sqrt{397882}}{2744}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((10/7)-((96*x)/7))+sqrt((44/7)-((40*x)/7)), (79/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{((21-14)+25)-6}{((11+8)+21)+13}$.", + "Output Answer": [ + "$\\frac{26}{53}$" + ], + "Output Program": [ + "try: \n print(((((21-14)+25)-6)/(((11+8)+21)+13)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(1+3 i) \\log (2)$ and $y=(14-2 i) \\log (2)$", + "Output Answer": [ + "$(15+i) \\log (2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (1+3*i)*math.log10(2)\ny = (14-2*i)*math.log10(2)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $5 x^2+11 x+5$", + "Output Answer": [ + "$x=\\frac{1}{10} \\left(-11-\\sqrt{21}\\right)\\lor x=\\frac{1}{10} \\left(\\sqrt{21}-11\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(5*x**2+11*x+5, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 x^2+13 x+10$ and $q(x) = 3 x^2+12 x+11$", + "Output Answer": [ + "$-12 x^4-9 x^3+142 x^2+263 x+110$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*x**2+13*x+10\nq = 3*x**2+12*x+11\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((21-16)-19)+18) (25+3)^2$.", + "Output Answer": [ + "$3136$" + ], + "Output Program": [ + "try: \n print((((21-16)-19)+18)*(25+3)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{172}}{\\sqrt{158}}$.", + "Output Answer": [ + "$\\sqrt{\\frac{86}{79}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(172))/(sqrt(158))))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $2 \\sqrt{2} x^2-3 \\sqrt{2} x-3 \\sqrt{2}$", + "Output Answer": [ + "$2 \\sqrt{2} \\left(x-\\frac{3}{4}\\right)^2-3 \\sqrt{2}-\\frac{9}{4 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (2*math.sqrt(2)*x**2-3*math.sqrt(2)*x-3*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{43 x^3}{4}-243 x^2-\\frac{297 x}{4}+68}{129 x^2-\\frac{747 x}{2}+\\frac{255}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-23-\\sqrt{465}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(-23+\\sqrt{465}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((43*x**3)/4)-243*x**2-((297*x)/4)+68)/(129*x**2-((747*x)/2)+(255/2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^5-3 x^4-8 x^3-3 x^2-3 x-1$ when divided by $-5 x-6$.", + "Output Answer": [ + "$-\\frac{6 x^4}{5}+\\frac{51 x^3}{25}-\\frac{106 x^2}{125}+\\frac{1011 x}{625}-\\frac{4191}{3125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**5-3*x**4-8*x**3-3*x**2-3*x-1\nq = -5*x-6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -8 x^2-11 x+12$ and $q(x) = 14 x^2-14 x+4$", + "Output Answer": [ + "$-112 x^4-42 x^3+290 x^2-212 x+48$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -8*x**2-11*x+12\nq = 14*x**2-14*x+4\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (6, 9, \\frac{1}{5})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{2926}}{5},\\tan ^{-1}\\left(15 \\sqrt{13}\\right),\\tan ^{-1}\\left(\\frac{3}{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 6\ny = 9\nz = (1/5)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2+\\frac{37 x}{4}-\\frac{235}{8}$", + "Output Answer": [ + "$\\left(-x-\\frac{47}{4}\\right) \\left(\\frac{5}{2}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2+((37*x)/4)-(235/8), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(13+i) \\log (2)$ and $y=(14+4 i) \\log (2)$", + "Output Answer": [ + "$(-1-3 i) \\log (2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (13+i)*math.log10(2)\ny = (14+4*i)*math.log10(2)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 25 (x-1)^4, q(x) = 25 (3-2 x)^4$", + "Output Answer": [ + "$425 x^4-2500 x^3+5550 x^2-5500 x+2050$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 25*(x-1)**4\nq = 25*(3-2*x)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-6 x+2 y^2-y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $6 \\left(x-\\frac{1}{2}\\right)^2+2 \\left(y-\\frac{1}{4}\\right)^2=\\frac{93}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & \\frac{1}{4} \\left(1-\\sqrt{62}\\right) \\\\\n \\frac{1}{2} & \\frac{1}{4} \\left(1+\\sqrt{62}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{4} \\left(1-\\sqrt{62}\\right)+\\frac{1}{4} \\left(1+\\sqrt{62}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{31 \\sqrt{3} \\pi }{16}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-6*x+2*y**2-y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^2-6 x+4$ when divided by $10 x^2+5 x+1$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**2-6*x+4\nq = 10*x**2+5*x+1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 11 x^2+6 x+8$ and $q(x) = x^2+4 x-7$", + "Output Answer": [ + "$11 x^4+50 x^3-45 x^2-10 x-56$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 11*x**2+6*x+8\nq = x**2+4*x-7\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(20-17)+\\left(\\left((13-12)^2-9\\right)^2-8\\right)$.", + "Output Answer": [ + "$59$" + ], + "Output Program": [ + "try: \n print((20-17)+(((13-12)**2-9)**2-8))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^6-2 x^5-x^4-x^3-6 x^2-3 x$ when divided by $x^2-2 x+9$.", + "Output Answer": [ + "$-6 x^4-14 x^3+25 x^2+175 x+119$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**6-2*x**5-x**4-x**3-6*x**2-3*x\nq = x**2-2*x+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{4 x^2-33 x-180}{276-23 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{15}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((4*x**2-33*x-180)/(276-23*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{21 x^2}{e}+\\frac{x}{e}+\\frac{31}{e}$ and $q(x) = -\\frac{32 x^2}{e}+\\frac{13 x}{e}-\\frac{21}{e}$", + "Output Answer": [ + "$\\frac{672 x^4}{e^2}-\\frac{305 x^3}{e^2}-\\frac{538 x^2}{e^2}+\\frac{382 x}{e^2}-\\frac{651}{e^2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -((21*x**2)/math.e)+(x/math.e)+(31/math.e)\nq = -((32*x**2)/math.e)+((13*x)/math.e)-(21/math.e)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2-\\frac{150 x}{7}-\\frac{416}{7}$", + "Output Answer": [ + "$-2 (13-x) \\left(x+\\frac{16}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2-((150*x)/7)-(416/7), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-7 \\sqrt{2} e^{\\frac{i \\pi }{6}}$.", + "Output Answer": [ + "Norm: $7 \\sqrt{2}$\nArgument: $-\\frac{5 \\pi }{6}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -7*math.sqrt(2)*math.e**((i*math.pi)/6)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -216 (x+1)^3, q(x) = 64$", + "Output Answer": [ + "$-216 x^3-648 x^2-648 x-152$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -216*(x+1)**3\nq = 64\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 6 x^2+4 x+14$ and $q(x) = 2 x^2+15 x+11$", + "Output Answer": [ + "$12 x^4+98 x^3+154 x^2+254 x+154$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 6*x**2+4*x+14\nq = 2*x**2+15*x+11\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (3-4 x)^2, q(x) = (3-7 x)^4$", + "Output Answer": [ + "$2401 x^4-4116 x^3+2662 x^2-780 x+90$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (3-4*x)**2\nq = (3-7*x)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{13-10 i}{\\pi }$ and $y=-\\frac{24+27 i}{\\pi }$", + "Output Answer": [ + "$-\\frac{37+17 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((13-10*i)/math.pi)\ny = -((24+27*i)/math.pi)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2-49$", + "Output Answer": [ + "$-((-x-7) (x-7))$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2-49, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{44}{5}-\\frac{28 i}{5}$.", + "Output Answer": [ + "Norm: $4 \\sqrt{\\frac{34}{5}}$\nArgument: $-\\tan ^{-1}\\left(\\frac{7}{11}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (44/5)-((28*i)/5)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^5+x^4+5 x^3+8 x^2+5 x-7$ when divided by $8 x^4-2 x^3-8 x^2-8 x+1$.", + "Output Answer": [ + "$-x-\\frac{1}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**5+x**4+5*x**3+8*x**2+5*x-7\nq = 8*x**4-2*x**3-8*x**2-8*x+1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{4 x^2+13 x-14}{11 x^2-22 x-20}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(-13-\\sqrt{393}\\right)\\right\\},\\left\\{x\\to \\frac{1}{8} \\left(-13+\\sqrt{393}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((4*x**2+13*x-14)/(11*x**2-22*x-20)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-3 e^{-\\frac{107 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $3$\nArgument: $\\frac{73 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -3*math.e**(-((107*i*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(-4-5 i) \\sqrt{2}$ and $y=4 \\sqrt{2}$", + "Output Answer": [ + "$-32-40 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-4-5*i)*math.sqrt(2)\ny = 4*math.sqrt(2)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{9}{2} \\left(\\cos \\left(\\frac{11}{15}\\right)+i \\sin \\left(\\frac{11}{15}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$\\frac{81}{4} \\left(\\cos \\left(\\frac{22}{15}\\right)+i \\sin \\left(\\frac{22}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((9/2)*(math.cos((11/15))+1j*math.sin((11/15))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((14+16)-14)+14)+(((11-22)-16)-12)$.", + "Output Answer": [ + "$-9$" + ], + "Output Program": [ + "try: \n print((((14+16)-14)+14)+(((11-22)-16)-12))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-6 \\left(-\\cos \\left(\\frac{2 \\pi }{15}\\right)+i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)$.", + "Output Answer": [ + "Norm: $6 \\sqrt{\\sin ^2\\left(\\frac{2 \\pi }{15}\\right)+\\cos ^2\\left(\\frac{2 \\pi }{15}\\right)}$\nArgument: $-\\frac{2 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -6*(-math.cos(((2*math.pi)/15))+i*math.sin(((2*math.pi)/15)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\log (x+16)}{\\log (9)}+\\frac{\\log (9 x-12)}{\\log (9)}=\\frac{\\log (x+16)}{\\log (9)}$", + "Output Answer": [ + "$\\left\\{\\{x\\to -16\\},\\left\\{x\\to \\frac{13}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(((log(x+16))/(log(9)))+((log(9*x-12))/(log(9))), ((log(x+16))/(log(9)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((24+23)-1) (((5+20)-14)-2)$.", + "Output Answer": [ + "$414$" + ], + "Output Program": [ + "try: \n print(((24+23)-1)*(((5+20)-14)-2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-8 y^2-2 y+9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 x^2-8 \\left(y+\\frac{1}{8}\\right)^2=-\\frac{73}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n 0 & \\frac{1}{8} \\left(-1-\\sqrt{219}\\right) \\\\\n 0 & \\frac{1}{8} \\left(\\sqrt{219}-1\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{3}$\nCenter: $\\left\\{0,\\frac{1}{2} \\left(\\frac{1}{8} \\left(-1-\\sqrt{219}\\right)+\\frac{1}{8} \\left(\\sqrt{219}-1\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\frac{x}{\\sqrt{2}}-\\frac{1}{8},y=\\frac{x}{\\sqrt{2}}-\\frac{1}{8}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-8*y**2-2*y+9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{11 x^2}{\\sqrt{3}}+\\frac{10 x}{\\sqrt{3}}+\\frac{19}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{78 \\sqrt{3}}{11}-\\frac{11 \\left(x-\\frac{5}{11}\\right)^2}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((11*x**2)/(math.sqrt(3)))+((10*x)/(math.sqrt(3)))+(19/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{1}{\\sqrt{3}}-2 \\sqrt{3} x\\right| =\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{25}{6}\\right\\},\\left\\{x\\to \\frac{9}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs((1/(sqrt(3)))-2*sqrt(3)*x), (26/(sqrt(3)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{12 x^2+7 x-5}{18 x^2+5 x-7}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to -1\\},\\left\\{x\\to \\frac{5}{12}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((12*x**2+7*x-5)/(18*x**2+5*x-7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^3-7 x^2-8 x+5$ when divided by $-4 x^3+3 x^2+10 x-1$.", + "Output Answer": [ + "$-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**3-7*x**2-8*x+5\nq = -4*x**3+3*x**2+10*x-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-11 x-10}+\\sqrt{-x-10}=10$", + "Output Answer": [ + "$\\{\\{x\\to -10\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-11*x-10)+sqrt(-x-10), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 19 x-15| =-9$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(19*x-15), -9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((10+1)-10)+20)-\\left(\\left(((7+13)+4)^2-14\\right)-14\\right)$.", + "Output Answer": [ + "$-527$" + ], + "Output Program": [ + "try: \n print((((10+1)-10)+20)-((((7+13)+4)**2-14)-14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{25}{16}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$\\frac{15925}{8}$" + ], + "Output Program": [ + "a = (25/16) # initial value\nd = 6 # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (25/16) # initial value\nd = 6 # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{33 x}{2}-\\frac{19}{2}\\right| =22$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{25}{33}\\right\\},\\left\\{x\\to \\frac{21}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((33*x)/2)-(19/2)), 22), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-3 x^2+9 x+8$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(9-\\sqrt{177}\\right)\\lor x=\\frac{1}{6} \\left(9+\\sqrt{177}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-3*x**2+9*x+8, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{50 x}{7}-\\frac{156 y}{7}-14=0$, $-\\frac{62 x}{7}-\\frac{90 y}{7}+\\frac{131}{7}=0$", + "Output Answer": [ + "$x=\\frac{2438}{1181}$, $y=\\frac{79}{2362}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((50*x)/7)-((156*y)/7)-14, -((62*x)/7)-((90*y)/7)+(131/7)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-18 x^2-4 x+1}{15-5 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(-2-\\sqrt{22}\\right)\\right\\},\\left\\{x\\to \\frac{1}{18} \\left(-2+\\sqrt{22}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-18*x**2-4*x+1)/(15-5*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2+112 x-384$", + "Output Answer": [ + "$-8 (6-x) (8-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2+112*x-384, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{7} (-26 x-11), q(x) = \\frac{(2-21 x)^4}{2401}$", + "Output Answer": [ + "$81 x^4-\\frac{216 x^3}{7}+\\frac{216 x^2}{49}-\\frac{1370 x}{343}-\\frac{3757}{2401}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/7)*(-26*x-11)\nq = (((2-21*x)**4)/2401)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{32 x^2}{3}+\\frac{10 x}{3}-\\frac{31}{3}$", + "Output Answer": [ + "$x=\\frac{1}{32} \\left(-5-3 \\sqrt{113}\\right)\\lor x=\\frac{1}{32} \\left(3 \\sqrt{113}-5\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((32*x**2)/3)+((10*x)/3)-(31/3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-10 \\left(\\sin \\left(\\frac{11 \\pi }{45}\\right)+i \\cos \\left(\\frac{11 \\pi }{45}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$100000000 \\left(\\cos \\left(\\frac{2 \\pi }{45}\\right)+i \\sin \\left(\\frac{2 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-10*(math.sin(((11*math.pi)/45))+1j*math.cos(((11*math.pi)/45))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{6 x}{7}-\\frac{10}{7}}+\\sqrt{3 x-\\frac{72}{7}}=\\frac{33}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{525} \\left(11971-924 \\sqrt{91}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((6*x)/7)-(10/7))+sqrt(3*x-(72/7)), (33/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{61}{81}$, and $a_n=a_{n-1}+2$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$\\frac{64003}{81}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(61/81) # initial value\nd = 2 # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(61/81) # initial value\nd = 2 # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 \\pi x-2 \\pi x^2$ and $q(x) = 5 \\pi x^2-3 \\pi x-4 \\pi$", + "Output Answer": [ + "$-10 \\pi ^2 x^4+26 \\pi ^2 x^3-4 \\pi ^2 x^2-16 \\pi ^2 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*pi*x-2*pi*x**2\nq = 5*pi*x**2-3*pi*x-4*pi\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x^2-3 x$ and $-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x**2-3*x, -3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{10-23 x}{-3 x^2+7 x+12}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{10}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((10-23*x)/(-3*x**2+7*x+12)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -3 \\sqrt{5} x^2-2 \\sqrt{5}\\right| =7 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\sqrt{\\frac{5}{3}}\\right\\},\\left\\{x\\to \\sqrt{\\frac{5}{3}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-3*sqrt(5)*x**2-2*sqrt(5)), 7*sqrt(5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\left(-\\sin \\left(\\frac{7 \\pi }{90}\\right)+i \\cos \\left(\\frac{7 \\pi }{90}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$256 \\left(\\sin \\left(\\frac{17 \\pi }{90}\\right)+i \\cos \\left(\\frac{17 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*(-math.sin(((7*math.pi)/90))+1j*math.cos(((7*math.pi)/90))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (9 x+1)^4, q(x) = -5 x$", + "Output Answer": [ + "$6561 x^4+2916 x^3+486 x^2+31 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (9*x+1)**4\nq = -5*x\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((((2-3)-8)-20)-5)^2-((((7+6)+6)+20)+25)$.", + "Output Answer": [ + "$1092$" + ], + "Output Program": [ + "try: \n print(((((2-3)-8)-20)-5)**2-((((7+6)+6)+20)+25))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{8 x^2}{\\sqrt{3}}+4 \\sqrt{3} x+\\sqrt{3}$", + "Output Answer": [ + "$\\frac{8 \\left(x+\\frac{3}{4}\\right)^2}{\\sqrt{3}}-\\frac{\\sqrt{3}}{2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((8*x**2)/(math.sqrt(3)))+4*math.sqrt(3)*x+math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3 x+5}+\\sqrt{9 x+10}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(157-9 \\sqrt{253}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3*x+5)+sqrt(9*x+10), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\left(45 t^2+450 t+1117\\right)^2, x(t)=9 t^2+90 t+225$", + "Output Answer": [ + "$y=25 x^2-80 x+64$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (45*t**2+450*t+1117)**2\nx_t = 9*t**2+90*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((17+2)-23)-10)-((((22-14)+15)+4)-12)$.", + "Output Answer": [ + "$-29$" + ], + "Output Program": [ + "try: \n print((((17+2)-23)-10)-((((22-14)+15)+4)-12))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $12 x^2-15 x-4$", + "Output Answer": [ + "$12 \\left(x-\\frac{5}{8}\\right)^2-\\frac{139}{16}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (12*x**2-15*x-4), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{19}{7}+\\frac{20 i}{7}$ and $y=8-\\frac{69 i}{7}$", + "Output Answer": [ + "$\\frac{37}{7}-7 i$" + ], + "Output Program": [ + "i = 1j\nx = -(19/7)+((20*i)/7)\ny = 8-((69*i)/7)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $8-2 x$ and $x-4$.", + "Output Answer": [ + "$x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(8-2*x, x-4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^3-14 x^2-4 x-5$ and $3 x^2+x+1$.", + "Output Answer": [ + "$3 x^2+x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**3-14*x**2-4*x-5, 3*x**2+x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+7 x+3 y^2+8 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $7 \\left(x+\\frac{1}{2}\\right)^2+3 \\left(y+\\frac{4}{3}\\right)^2=\\frac{97}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{2} & -\\frac{4}{3}-\\frac{\\sqrt{\\frac{97}{7}}}{3} \\\\\n -\\frac{1}{2} & \\frac{1}{21} \\left(\\sqrt{679}-28\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{7}}$\nCenter: $\\left\\{-\\frac{1}{2},\\frac{1}{2} \\left(-\\frac{4}{3}-\\frac{\\sqrt{\\frac{97}{7}}}{3}+\\frac{1}{21} \\left(\\sqrt{679}-28\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{97 \\pi }{12 \\sqrt{21}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+7*x+3*y**2+8*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{69 x}{4}-\\frac{43 y}{4}+\\frac{71 z}{4}+\\frac{19}{4}=0$, $\\frac{37 x}{4}+\\frac{19 y}{2}+\\frac{81 z}{4}-18=0$, $-\\frac{95 x}{4}-\\frac{79 y}{4}+\\frac{3 z}{2}-\\frac{99}{4}=0$", + "Output Answer": [ + "$x=\\frac{374368}{22685}$, $y=-\\frac{36401}{1745}$, $z=\\frac{71158}{22685}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((69*x)/4)-((43*y)/4)+((71*z)/4)+(19/4), ((37*x)/4)+((19*y)/2)+((81*z)/4)-18, -((95*x)/4)-((79*y)/4)+((3*z)/2)-(99/4))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$22 x+15 y-8=0$, $-15 x-24 y-6=0$", + "Output Answer": [ + "$x=\\frac{94}{101}$, $y=-\\frac{84}{101}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((22*x+15*y-8, -15*x-24*y-6), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-250 x^2+125 x+15}{200 x^2+220 x+20}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-250*x**2+125*x+15)/(200*x**2+220*x+20)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-12 x^2-10 x-11$", + "Output Answer": [ + "$x=\\frac{1}{12} \\left(-5-i \\sqrt{107}\\right)\\lor x=\\frac{1}{12} \\left(-5+i \\sqrt{107}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-12*x**2-10*x-11, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$-\\tan (8)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = -tan(8)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$x+19 y+18 z-23=0$, $-11 x-11 y+22 z+7=0$, $19 x+5 y+16 z-9=0$", + "Output Answer": [ + "$x=\\frac{116}{3443}$, $y=\\frac{3491}{3443}$, $z=\\frac{708}{3443}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((x+19*y+18*z-23, -11*x-11*y+22*z+7, 19*x+5*y+16*z-9)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{14 x^2}{\\sqrt{3}}-\\frac{25 x}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{625}{56 \\sqrt{3}}-\\frac{14 \\left(x+\\frac{25}{28}\\right)^2}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((14*x**2)/(math.sqrt(3)))-((25*x)/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{21}{94}$, and $a_n=a_{n-1}+-10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$-\\frac{33651}{94}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (21/94) # initial value\nd = -10 # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (21/94) # initial value\nd = -10 # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 4 x^2-10 x+11\\right| =17$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{2}\\right\\},\\{x\\to 3\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(4*x**2-10*x+11), 17), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3 x-12}+\\sqrt{13 x+15}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{50} \\left(833-33 \\sqrt{301}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3*x-12)+sqrt(13*x+15), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{13 x^4}{2}+8 x^3-\\frac{x^2}{2}-\\frac{9 x}{2}-9$ when divided by $\\frac{19 x^3}{2}+\\frac{11 x^2}{2}-6 x+\\frac{19}{2}$.", + "Output Answer": [ + "$\\frac{447}{361}-\\frac{13 x}{19}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((13*x**4)/2)+8*x**3-((x**2)/2)-((9*x)/2)-9\nq = ((19*x**3)/2)+((11*x**2)/2)-6*x+(19/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{25 t^2+210 t+439}{\\sqrt{2}}, x(t)=\\frac{25 t^2}{2}+105 t+\\frac{441}{2}$", + "Output Answer": [ + "$y=\\sqrt{2}-\\sqrt{2} x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -((25*t**2+210*t+439)/(sqrt(2)))\nx_t = ((25*t**2)/2)+105*t+(441/2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 11 x-12| =7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5}{11}\\right\\},\\left\\{x\\to \\frac{19}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11*x-12), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$14 x+18 y-3 z+22=0$, $-13 x-22 y+17 z-21=0$, $11 x+7 y-10 z-17=0$", + "Output Answer": [ + "$x=\\frac{5197}{1987}$, $y=-\\frac{6884}{1987}$, $z=-\\frac{2480}{1987}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((14*x+18*y-3*z+22, -13*x-22*y+17*z-21, 11*x+7*y-10*z-17)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (x-6)^2, q(x) = 9 (2 x+1)^2$", + "Output Answer": [ + "$37 x^2+24 x+45$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (x-6)**2\nq = 9*(2*x+1)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{75}{77}$, and $a_n=a_{n-1}+-\\frac{50}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$-\\frac{20125}{11}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(75/77) # initial value\nd = -(50/7) # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(75/77) # initial value\nd = -(50/7) # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=8-4 i$ and $y=8-9 i$", + "Output Answer": [ + "$5 i$" + ], + "Output Program": [ + "i = 1j\nx = 8-4*i\ny = 8-9*i\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 x^2-4 x-8$", + "Output Answer": [ + "$-3 \\left(x+\\frac{2}{3}\\right)^2-\\frac{20}{3}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*x**2-4*x-8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{23 x^2}{5}-\\frac{24 x}{5}+\\frac{11}{5}$ and $\\frac{12 x^4}{5}+\\frac{22 x^3}{5}-\\frac{21 x^2}{5}-\\frac{6 x}{5}-\\frac{7}{5}$.", + "Output Answer": [ + "$\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((23*x**2)/5)-((24*x)/5)+(11/5), ((12*x**4)/5)+((22*x**3)/5)-((21*x**2)/5)-((6*x)/5)-(7/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{2}{27} \\left(250 t^2+2250 t+5031\\right), x(t)=\\frac{100 t^2}{9}+100 t+225$", + "Output Answer": [ + "$y=\\frac{7}{3}-\\frac{5 x}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -(2/27)*(250*t**2+2250*t+5031)\nx_t = ((100*t**2)/9)+100*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{23 x^2}{7}-\\frac{99 x}{7}-\\frac{41}{7}$", + "Output Answer": [ + "$x=\\frac{1}{46} \\left(99-7 \\sqrt{277}\\right)\\lor x=\\frac{1}{46} \\left(99+7 \\sqrt{277}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((23*x**2)/7)-((99*x)/7)-(41/7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 x^2+7 x-8$", + "Output Answer": [ + "$-3 \\left(x-\\frac{7}{6}\\right)^2-\\frac{47}{12}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*x**2+7*x-8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{4} (-30 t-203), x(t)=-\\frac{5 t}{2}-15$", + "Output Answer": [ + "$y=3 x-\\frac{23}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/4)*(-30*t-203)\nx_t = -((5*t)/2)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=1$, and $a_n=a_{n-1}+-\\frac{47}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$-\\frac{7942}{5}$" + ], + "Output Program": [ + "a = 1 # initial value\nd = -(47/5) # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 1 # initial value\nd = -(47/5) # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(\\cos \\left(\\frac{44}{45}\\right)+i \\sin \\left(\\frac{44}{45}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$117649 \\left(\\cos \\left(\\frac{88}{15}\\right)+i \\sin \\left(\\frac{88}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(math.cos((44/45))+1j*math.sin((44/45))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{11-16 i}{\\sqrt{3}}$ and $y=-\\frac{8+16 i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{344}{3}+16 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((11-16*i)/(math.sqrt(3)))\ny = -((8+16*i)/(math.sqrt(3)))\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\sqrt{5} \\left(240 t^2-840 t+739\\right), x(t)=80 t^2-280 t+245$", + "Output Answer": [ + "$y=3 \\sqrt{5} x+4 \\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = sqrt(5)*(240*t**2-840*t+739)\nx_t = 80*t**2-280*t+245\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\frac{\\log \\left(6-8 x^3\\right)}{\\sqrt{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{\\sqrt[3]{-5}}{2}\\right\\},\\left\\{x\\to \\frac{\\sqrt[3]{5}}{2}\\right\\},\\left\\{x\\to \\frac{1}{2} (-1)^{2/3} \\sqrt[3]{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(((log(6-8*x**3))/(sqrt(7))), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 6 x^2+13 x-13$ and $q(x) = -5 x^2+10 x-12$", + "Output Answer": [ + "$-30 x^4-5 x^3+123 x^2-286 x+156$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 6*x**2+13*x-13\nq = -5*x**2+10*x-12\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -4.38 x^2+3.67 x-4.21$, $q(x) = -14.09 x^2+0.93 x-1.86$", + "Output Answer": [ + "$-18.47 x^2+4.6 x-6.07$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4.38*x**2+3.67*x-4.21\nq = -14.09*x**2+0.93*x-1.86\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2+168 \\sqrt{2} x+1080$", + "Output Answer": [ + "$12 \\left(x+5 \\sqrt{2}\\right) \\left(x+9 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2+168*sqrt(2)*x+1080, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -8 \\sqrt{2} x^2+9 \\sqrt{2} x+7 \\sqrt{2}$ and $q(x) = 9 \\sqrt{2} x^2+\\sqrt{2} x-5 \\sqrt{2}$", + "Output Answer": [ + "$-144 x^4+146 x^3+224 x^2-76 x-70$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -8*sqrt(2)*x**2+9*sqrt(2)*x+7*sqrt(2)\nq = 9*sqrt(2)*x**2+sqrt(2)*x-5*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\sqrt{3} \\left(-\\sin \\left(\\frac{11 \\pi }{90}\\right)+i \\cos \\left(\\frac{11 \\pi }{90}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$24 \\sqrt{3} \\left(\\cos \\left(\\frac{2 \\pi }{15}\\right)-i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*math.sqrt(3)*(-math.sin(((11*math.pi)/90))+1j*math.cos(((11*math.pi)/90))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2-\\frac{49 x}{2}+\\frac{145}{2}$", + "Output Answer": [ + "$2 (5-x) \\left(\\frac{29}{4}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2-((49*x)/2)+(145/2), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-10 x-14}+\\sqrt{-9 x-1}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -317+16 \\sqrt{389}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-10*x-14)+sqrt(-9*x-1), 4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$14 x+24 y+5 z-8=0$, $9 x+2 y+5 z+17=0$, $16 x-9 y+20 z-1=0$", + "Output Answer": [ + "$x=-\\frac{1943}{355}$, $y=\\frac{169}{71}$, $z=\\frac{9762}{1775}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((14*x+24*y+5*z-8, 9*x+2*y+5*z+17, 16*x-9*y+20*z-1)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(3-i) \\sqrt{5}$ and $y=(4-4 i) \\sqrt{5}$", + "Output Answer": [ + "$(7-5 i) \\sqrt{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (3-i)*math.sqrt(5)\ny = (4-4*i)*math.sqrt(5)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 2 x^2-7 x+12$, $q(x) = 4 x^2-6 x-1$", + "Output Answer": [ + "$6 x^2-13 x+11$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**2-7*x+12\nq = 4*x**2-6*x-1\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^5-7 x^4+4 x^3-5 x^2-2$ when divided by $-x^4+2 x^3+4 x-7$.", + "Output Answer": [ + "$1-3 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**5-7*x**4+4*x**3-5*x**2-2\nq = -x**4+2*x**3+4*x-7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{6 \\sqrt{5} x^2+7 \\sqrt{5} x}{5 \\sqrt{5} x^2+4 \\sqrt{5} x-2 \\sqrt{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{6}\\right\\},\\{x\\to 0\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((6*sqrt(5)*x**2+7*sqrt(5)*x)/(5*sqrt(5)*x**2+4*sqrt(5)*x-2*sqrt(5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{20}{7}+\\frac{16 i}{7}$ and $y=-\\frac{3}{7}+\\frac{61 i}{7}$", + "Output Answer": [ + "$\\frac{518}{1865}+\\frac{586 i}{1865}$" + ], + "Output Program": [ + "i = 1j\nx = -(20/7)+((16*i)/7)\ny = -(3/7)+((61*i)/7)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(13-3)-\\left((14-10)^2-14\\right)$.", + "Output Answer": [ + "$8$" + ], + "Output Program": [ + "try: \n print((13-3)-((14-10)**2-14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{17 x^2}{4}+\\frac{19 x}{4}-\\frac{37}{4}$ and $q(x) = 11 x^2-\\frac{21 x}{4}+\\frac{53}{4}$", + "Output Answer": [ + "$\\frac{187 x^4}{4}+\\frac{479 x^3}{16}-\\frac{563 x^2}{8}+\\frac{223 x}{2}-\\frac{1961}{16}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((17*x**2)/4)+((19*x)/4)-(37/4)\nq = 11*x**2-((21*x)/4)+(53/4)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{4 \\left(\\cos \\left(\\frac{43 \\pi }{180}\\right)+i \\sin \\left(\\frac{43 \\pi }{180}\\right)\\right)}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $4 \\sqrt{\\frac{\\sin ^2\\left(\\frac{43 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{43 \\pi }{180}\\right)}{\\pi }}$\nArgument: $\\frac{43 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((4*(math.cos(((43*math.pi)/180))+i*math.sin(((43*math.pi)/180))))/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^5-8 x^4-9 x^3+8 x^2-2 x-1$ when divided by $6 x^5+3 x^4+10 x^3-4 x^2+8 x-6$.", + "Output Answer": [ + "$\\frac{2}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**5-8*x**4-9*x**3+8*x**2-2*x-1\nq = 6*x**5+3*x**4+10*x**3-4*x**2+8*x-6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x+2$ and $-5 x^4+2 x^3-4 x^2-2 x+3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x+2, -5*x**4+2*x**3-4*x**2-2*x+3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{14}{5}-\\frac{18 x}{5}$ and $-\\frac{24 x^2}{5}-\\frac{19 x}{5}-\\frac{9}{5}$.", + "Output Answer": [ + "$\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd((14/5)-((18*x)/5), -((24*x**2)/5)-((19*x)/5)-(9/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{1-13 x}+\\sqrt{3-4 x}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{81} \\left(-859+10 \\sqrt{5515}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(1-13*x)+sqrt(3-4*x), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{-4 x^2+19 x-2}{\\sqrt{\\pi }}$, $q(x) = \\frac{-2 x^2-x+10}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{6 x^2}{\\sqrt{\\pi }}+\\frac{18 x}{\\sqrt{\\pi }}+\\frac{8}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((-4*x**2+19*x-2)/(sqrt(pi)))\nq = ((-2*x**2-x+10)/(sqrt(pi)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{8453 x^2}{49}+\\frac{14260 x}{49}+\\frac{4223}{49}}{-\\frac{9717 x^2}{49}-\\frac{1460 x}{7}+\\frac{3193}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{41}{107}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((8453*x**2)/49)+((14260*x)/49)+(4223/49))/(-((9717*x**2)/49)-((1460*x)/7)+(3193/49))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{7 x^2}{2}+\\frac{9 x}{2}-4$ and $\\frac{x}{2}+\\frac{7}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((7*x**2)/2)+((9*x)/2)-4, (x/2)+(7/2)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(11-6) \\left(\\frac{21}{18}+10\\right)$.", + "Output Answer": [ + "$\\frac{335}{6}$" + ], + "Output Program": [ + "try: \n print((11-6)*((21/18)+10))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-18 x^2+21 x-3}{9 x^2+12 x-13}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-18*x**2+21*x-3)/(9*x**2+12*x-13)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{20 x}{3}+\\frac{31}{3}}+\\sqrt{\\frac{38 x}{3}+14}=\\frac{44}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{486} \\left(55847-88 \\sqrt{372403}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((20*x)/3)+(31/3))+sqrt(((38*x)/3)+14), (44/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-10 x^2-8 x+14$", + "Output Answer": [ + "$x=\\frac{1}{5} \\left(-2-\\sqrt{39}\\right)\\lor x=\\frac{1}{5} \\left(\\sqrt{39}-2\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-10*x**2-8*x+14, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-14 x^2+12 x+8$", + "Output Answer": [ + "$x=\\frac{1}{7} \\left(3-\\sqrt{37}\\right)\\lor x=\\frac{1}{7} \\left(3+\\sqrt{37}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-14*x**2+12*x+8, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-5-6 i$ and $y=-7+10 i$", + "Output Answer": [ + "$95-8 i$" + ], + "Output Program": [ + "i = 1j\nx = -5-6*i\ny = -7+10*i\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{34 x^4}{5}+8 x^3+9 x^2+\\frac{48 x}{5}-\\frac{7}{5}$ when divided by $\\frac{22 x^2}{5}-\\frac{21 x}{5}-\\frac{4}{5}$.", + "Output Answer": [ + "$\\frac{17 x^2}{11}+\\frac{797 x}{242}+\\frac{29123}{5324}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((34*x**4)/5)+8*x**3+9*x**2+((48*x)/5)-(7/5)\nq = ((22*x**2)/5)-((21*x)/5)-(4/5)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -8 \\sqrt{5} x^2+9 \\sqrt{5} x-5 \\sqrt{5}\\right| =6 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(9-\\sqrt{113}\\right)\\right\\},\\left\\{x\\to \\frac{1}{16} \\left(9+\\sqrt{113}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-8*sqrt(5)*x**2+9*sqrt(5)*x-5*sqrt(5)), 6*sqrt(5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-90 x^2-310 x+200}{90 x-50}=0$", + "Output Answer": [ + "$\\{\\{x\\to -4\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-90*x**2-310*x+200)/(90*x-50)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-6$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$60$" + ], + "Output Program": [ + "a = -6 # initial value\nd = 9 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -6 # initial value\nd = 9 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2+8 x+6 y^2-6 y+7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y-\\frac{1}{2}\\right)^2-10 \\left(x-\\frac{2}{5}\\right)^2=-\\frac{71}{10}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{15} \\left(6-\\sqrt{426}\\right) & \\frac{1}{2} \\\\\n \\frac{1}{15} \\left(6+\\sqrt{426}\\right) & \\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{15} \\left(6-\\sqrt{426}\\right)+\\frac{1}{15} \\left(6+\\sqrt{426}\\right)\\right),\\frac{1}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{5}{3}} x+\\frac{1}{30} \\left(15-4 \\sqrt{15}\\right),y=\\frac{1}{30} \\left(15+4 \\sqrt{15}\\right)-\\sqrt{\\frac{5}{3}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2+8*x+6*y**2-6*y+7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x-11}+\\sqrt{6 x+15}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{6589}{1944}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x-11)+sqrt(6*x+15), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{1330 x^3}{3}-883 x^2+479 x-\\frac{145}{3}}{\\frac{608 x}{3}-\\frac{464}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{70} \\left(43-\\sqrt{1149}\\right)\\right\\},\\left\\{x\\to \\frac{1}{70} \\left(43+\\sqrt{1149}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((1330*x**3)/3)-883*x**2+479*x-(145/3))/(((608*x)/3)-(464/3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=2 i \\sqrt{3}$ and $y=(-3+i) \\sqrt{3}$", + "Output Answer": [ + "$\\frac{1}{5}-\\frac{3 i}{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = 2*i*math.sqrt(3)\ny = (-3+i)*math.sqrt(3)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{1}{17} (6-3)^2-\\left(\\left(\\frac{25+11}{21}+21\\right)+16\\right)$.", + "Output Answer": [ + "$-\\frac{4544}{119}$" + ], + "Output Program": [ + "try: \n print((1/17)*(6-3)**2-((((25+11)/21)+21)+16))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -x^2+2 x+15$ and $q(x) = 3 x^2+5 x+2$", + "Output Answer": [ + "$-3 x^4+x^3+53 x^2+79 x+30$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -x**2+2*x+15\nq = 3*x**2+5*x+2\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^5-7 x^4-7 x^3+5 x^2-2 x-5$ when divided by $-6 x^4+7 x^3-6 x-10$.", + "Output Answer": [ + "$\\frac{7}{12}-\\frac{x}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**5-7*x**4-7*x**3+5*x**2-2*x-5\nq = -6*x**4+7*x**3-6*x-10\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\sqrt{5}, \\frac{1}{7}, \\sqrt{3})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{393}}{7},\\tan ^{-1}\\left(\\frac{\\sqrt{82}}{7}\\right),\\tan ^{-1}\\left(\\frac{1}{7 \\sqrt{5}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.sqrt(5)\ny = (1/7)\nz = math.sqrt(3)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-5 \\sqrt{3} x^2-7 \\sqrt{3} x+\\sqrt{3}$", + "Output Answer": [ + "$\\frac{69 \\sqrt{3}}{20}-5 \\sqrt{3} \\left(x+\\frac{7}{10}\\right)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-5*math.sqrt(3)*x**2-7*math.sqrt(3)*x+math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{61}+\\left(\\sqrt{64}+\\sqrt{31}\\right)$.", + "Output Answer": [ + "$8+\\sqrt{31}+\\sqrt{61}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(61)+(sqrt(64)+sqrt(31)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{x}{e}-\\frac{15 x^2}{e}$ and $q(x) = -\\frac{5 x^2}{e}+\\frac{23 x}{e}-\\frac{21}{e}$", + "Output Answer": [ + "$\\frac{75 x^4}{e^2}-\\frac{350 x^3}{e^2}+\\frac{338 x^2}{e^2}-\\frac{21 x}{e^2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = (x/math.e)-((15*x**2)/math.e)\nq = -((5*x**2)/math.e)+((23*x)/math.e)-(21/math.e)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2+6 x+3 y^2+3 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $(x+3)^2+3 \\left(y+\\frac{1}{2}\\right)^2=\\frac{55}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n -3-\\sqrt{\\frac{55}{6}} & -\\frac{1}{2} \\\\\n \\sqrt{\\frac{55}{6}}-3 & -\\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{-3,-\\frac{1}{2}\\right\\}$\nArea Enclosed: $\\frac{55 \\pi }{4 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2+6*x+3*y**2+3*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-48 x^3-124 x^2+124 x+255}{138 x^2+445 x+153}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{4}\\right\\},\\left\\{x\\to \\frac{3}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-48*x**3-124*x**2+124*x+255)/(138*x**2+445*x+153)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -12 x^2+7 x-15$ and $q(x) = 3 x^2+7 x-12$", + "Output Answer": [ + "$-36 x^4-63 x^3+148 x^2-189 x+180$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -12*x**2+7*x-15\nq = 3*x**2+7*x-12\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{11-9 i}{\\sqrt{3}}$ and $y=\\frac{1-7 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{37}{25}-\\frac{34 i}{25}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((11-9*i)/(math.sqrt(3)))\ny = ((1-7*i)/(math.sqrt(3)))\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{7}, 3, \\frac{1}{7})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{443}}{7},\\tan ^{-1}\\left(\\sqrt{442}\\right),\\tan ^{-1}(21)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/7)\ny = 3\nz = (1/7)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-6 x^2-x-3$", + "Output Answer": [ + "$-6 \\left(x+\\frac{1}{12}\\right)^2-\\frac{71}{24}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-6*x**2-x-3), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=900 t^2-60 \\left(2 \\sqrt{3}-135\\right) t-540 \\sqrt{3}+18237, x(t)=-2 \\sqrt{3} t-9 \\sqrt{3}$", + "Output Answer": [ + "$y=75 x^2+60 x+12$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 900*t**2-60*(2*sqrt(3)-135)*t-540*sqrt(3)+18237\nx_t = -2*sqrt(3)*t-9*sqrt(3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{32 x^2+\\frac{800 x}{3}}{\\frac{320 x^2}{3}+160 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{25}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((32*x**2+((800*x)/3))/(((320*x**2)/3)+160*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{92 x^2+184 x+92}{-88 x^2-48 x+40}=0$", + "Output Answer": [ + "$\\{\\{x\\to -1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((92*x**2+184*x+92)/(-88*x**2-48*x+40)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{32 x}{3}+\\frac{1}{3}\\right| =12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{37}{32}\\right\\},\\left\\{x\\to \\frac{35}{32}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((32*x)/3)+(1/3)), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (6, 7, \\frac{1}{\\sqrt{2}})$", + "Output Answer": [ + "$\\left\\{3 \\sqrt{\\frac{19}{2}},\\tan ^{-1}\\left(\\sqrt{170}\\right),\\tan ^{-1}\\left(\\frac{7}{6}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 6\ny = 7\nz = (1/(math.sqrt(2)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{18}{23}$, and $a_n=a_{n-1}+-12$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$-\\frac{15378}{23}$" + ], + "Output Program": [ + "a = -(18/23) # initial value\nd = -12 # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(18/23) # initial value\nd = -12 # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{78 x^2}{25}-\\frac{3261 x}{25}-\\frac{126}{5}}{-\\frac{6396 x^2}{25}+\\frac{2124 x}{25}+\\frac{129}{5}}=0$", + "Output Answer": [ + "$\\{\\{x\\to 42\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((78*x**2)/25)-((3261*x)/25)-(126/5))/(-((6396*x**2)/25)+((2124*x)/25)+(129/5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{14 \\left(\\sin \\left(\\frac{29 \\pi }{180}\\right)-i \\cos \\left(\\frac{29 \\pi }{180}\\right)\\right)}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{14 \\sqrt{\\sin ^2\\left(\\frac{29 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{29 \\pi }{180}\\right)}}{\\pi }$\nArgument: $-\\frac{61 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((14*(math.sin(((29*math.pi)/180))-i*math.cos(((29*math.pi)/180))))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2-6 x+y^2+y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $\\left(y+\\frac{1}{2}\\right)^2-8 \\left(x+\\frac{3}{8}\\right)^2=-\\frac{55}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{8} \\left(1+\\sqrt{55}\\right) & -\\frac{1}{2} \\\\\n \\frac{3}{8} \\left(\\sqrt{55}-1\\right) & -\\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $3$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{3}{8} \\left(\\sqrt{55}-1\\right)-\\frac{3}{8} \\left(1+\\sqrt{55}\\right)\\right),-\\frac{1}{2}\\right\\}$\nAsymptotes: $\\left\\{y=2 \\sqrt{2} x+\\frac{1}{4} \\left(3 \\sqrt{2}-2\\right),y=\\frac{1}{4} \\left(-2-3 \\sqrt{2}\\right)-2 \\sqrt{2} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2-6*x+y**2+y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2-\\frac{53 x}{5}}+\\sqrt{-\\frac{34 x}{5}-\\frac{2}{5}}=\\frac{33}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-93603+132 \\sqrt{480002}}{1805}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2-((53*x)/5))+sqrt(-((34*x)/5)-(2/5)), (33/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{28 x^4}{3}+\\frac{26 x^3}{3}-\\frac{5 x^2}{3}+\\frac{5 x}{3}-\\frac{4}{3}$ when divided by $-\\frac{29 x^2}{3}-\\frac{2 x}{3}+\\frac{25}{3}$.", + "Output Answer": [ + "$-\\frac{28 x^2}{29}-\\frac{698 x}{841}-\\frac{14699}{24389}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((28*x**4)/3)+((26*x**3)/3)-((5*x**2)/3)+((5*x)/3)-(4/3)\nq = -((29*x**2)/3)-((2*x)/3)+(25/3)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(\\cos \\left(\\frac{2 \\pi }{15}\\right)+i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1024 \\left(-\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(math.cos(((2*math.pi)/15))+1j*math.sin(((2*math.pi)/15))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^6-x^5-3 x^4-3 x^3-5 x^2+7 x+3$ when divided by $-7 x^3-6 x^2-7 x+7$.", + "Output Answer": [ + "$\\frac{2 x^3}{7}-\\frac{5 x^2}{49}+\\frac{79 x}{343}+\\frac{1486}{2401}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**6-x**5-3*x**4-3*x**3-5*x**2+7*x+3\nq = -7*x**3-6*x**2-7*x+7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-3 x^4+3 x^3-5 x+2$ when divided by $-8$.", + "Output Answer": [ + "$\\frac{3 x^4}{8}-\\frac{3 x^3}{8}+\\frac{5 x}{8}-\\frac{1}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x**4+3*x**3-5*x+2\nq = -8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+3 x+4 y^2-3 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Circle\nEquation: $4 \\left(x+\\frac{3}{8}\\right)^2+4 \\left(y-\\frac{3}{8}\\right)^2=\\frac{33}{8}$\nRadius: $\\frac{\\sqrt{\\frac{33}{2}}}{4}$\nCircumference: $\\frac{1}{2} \\sqrt{\\frac{33}{2}} \\pi$\nCenter: $\\left\\{-\\frac{3}{8},\\frac{3}{8}\\right\\}$\nArea Enclosed: $\\frac{33 \\pi }{32}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+3*x+4*y**2-3*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+10 x-4 y^2-y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x+\\frac{5}{6}\\right)^2-4 \\left(y+\\frac{1}{8}\\right)^2=-\\frac{91}{48}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{6} & \\frac{1}{24} \\left(-3-\\sqrt{455}\\right) \\\\\n -\\frac{5}{6} & \\frac{1}{24} \\left(\\sqrt{455}-3\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{3}}$\nCenter: $\\left\\{-\\frac{5}{6},\\frac{1}{2} \\left(\\frac{1}{24} \\left(-3-\\sqrt{455}\\right)+\\frac{1}{24} \\left(\\sqrt{455}-3\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{24} \\left(-3-10 \\sqrt{6}\\right)-\\sqrt{\\frac{3}{2}} x,y=\\sqrt{\\frac{3}{2}} x+\\frac{1}{24} \\left(10 \\sqrt{6}-3\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+10*x-4*y**2-y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $9 x^2-4 x+10$", + "Output Answer": [ + "$x=\\frac{1}{9} \\left(2-i \\sqrt{86}\\right)\\lor x=\\frac{1}{9} \\left(2+i \\sqrt{86}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(9*x**2-4*x+10, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(3-2 i) \\sqrt{2}$ and $y=(-4-6 i) \\sqrt{2}$", + "Output Answer": [ + "$(7+4 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (3-2*i)*math.sqrt(2)\ny = (-4-6*i)*math.sqrt(2)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-140 x^3+30 x^2+195 x+50}{315 x^2+475 x+110}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(1-\\sqrt{21}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(1+\\sqrt{21}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-140*x**3+30*x**2+195*x+50)/(315*x**2+475*x+110)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-5 \\sqrt{3} \\left(\\sin \\left(\\frac{2 \\pi }{15}\\right)+i \\cos \\left(\\frac{2 \\pi }{15}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-2109375 \\sqrt{3} \\left(-\\sin \\left(\\frac{\\pi }{15}\\right)+i \\cos \\left(\\frac{\\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-5*math.sqrt(3)*(math.sin(((2*math.pi)/15))+1j*math.cos(((2*math.pi)/15))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-10 \\sqrt{3} x+10 \\sqrt{3} y+\\sqrt{3} z-4 \\sqrt{3}=0$, $-5 \\sqrt{3} x+4 \\sqrt{3} z-8 \\sqrt{3}=0$, $5 \\sqrt{3} x-8 \\sqrt{3} y+6 \\sqrt{3} z-10 \\sqrt{3}=0$", + "Output Answer": [ + "$x=-\\frac{4}{55}$, $y=\\frac{3}{22}$, $z=\\frac{21}{11}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-10*sqrt(3)*x+10*sqrt(3)*y+sqrt(3)*z-4*sqrt(3), -5*sqrt(3)*x+4*sqrt(3)*z-8*sqrt(3), 5*sqrt(3)*x-8*sqrt(3)*y+6*sqrt(3)*z-10*sqrt(3))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{87 x}{7}-\\frac{155 y}{7}-\\frac{17}{7}=0$, $-x+\\frac{122 y}{7}-\\frac{117}{7}=0$", + "Output Answer": [ + "$x=\\frac{20209}{9529}$, $y=\\frac{10298}{9529}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((87*x)/7)-((155*y)/7)-(17/7), -x+((122*y)/7)-(117/7)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{11 x}{\\sqrt{3}}-7 \\sqrt{3} y-\\frac{34}{\\sqrt{3}}=0$, $-2 \\sqrt{3} x-3 \\sqrt{3} y-\\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{27}{25}$, $y=-\\frac{79}{75}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((11*x)/(sqrt(3)))-7*sqrt(3)*y-(34/(sqrt(3))), -2*sqrt(3)*x-3*sqrt(3)*y-sqrt(3)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-108 x^2+89 x-6}{100 x-75}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{27}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-108*x**2+89*x-6)/(100*x-75)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{414 x^3+558 x^2-224 x-128}{207 x^2-135 x-72}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(-3-\\sqrt{41}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(-3+\\sqrt{41}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((414*x**3+558*x**2-224*x-128)/(207*x**2-135*x-72)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+33 x-22$", + "Output Answer": [ + "$-11 (1-x) (2-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+33*x-22, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{74}{89}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$-\\frac{24770}{89}$" + ], + "Output Program": [ + "a = -(74/89) # initial value\nd = -6 # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(74/89) # initial value\nd = -6 # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{2}{5} \\left(22 x^2-11 x+3\\right)$, $q(x) = \\frac{2}{5} \\left(18 x^2+14 x-19\\right)$", + "Output Answer": [ + "$-\\frac{8 x^2}{5}+10 x-\\frac{44}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(2/5)*(22*x**2-11*x+3)\nq = (2/5)*(18*x**2+14*x-19)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-330 x^2-309 x+156}{-150 x-195}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{4}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-330*x**2-309*x+156)/(-150*x-195)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2-34 x-288$", + "Output Answer": [ + "$(-x-18) (x+16)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2-34*x-288, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(1-2 i) \\sqrt{5}$ and $y=2 i \\sqrt{5}$", + "Output Answer": [ + "$20+10 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (1-2*i)*math.sqrt(5)\ny = 2*i*math.sqrt(5)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-2.8+5.9 i$ and $y=-5.9-0.2 i$", + "Output Answer": [ + "$0.440172\\, -1.01492 i$" + ], + "Output Program": [ + "i = 1j\nx = -2.8+5.9*i\ny = -5.9-0.2*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{9+12}{8}}{20-22}$.", + "Output Answer": [ + "$-\\frac{21}{16}$" + ], + "Output Program": [ + "try: \n print((((9+12)/8)/(20-22)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{70}{17}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$-\\frac{1470}{17}$" + ], + "Output Program": [ + "a = -(70/17) # initial value\nd = 0 # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(70/17) # initial value\nd = 0 # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+5 x-6 y^2-10 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x+\\frac{5}{12}\\right)^2-6 \\left(y+\\frac{5}{6}\\right)^2=-\\frac{1}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{12} & -\\frac{5}{6}-\\frac{1}{2 \\sqrt{6}} \\\\\n -\\frac{5}{12} & \\frac{1}{12} \\left(\\sqrt{6}-10\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{-\\frac{5}{12},\\frac{1}{2} \\left(-\\frac{5}{6}-\\frac{1}{2 \\sqrt{6}}+\\frac{1}{12} \\left(\\sqrt{6}-10\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-x-\\frac{5}{4},y=x-\\frac{5}{12}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+5*x-6*y**2-10*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-7 x+y+4 z+10=0$, $-10 x-11 y-23 z-21=0$, $-13 x-y+14 z+15=0$", + "Output Answer": [ + "$x=\\frac{359}{382}$, $y=-\\frac{2341}{1146}$, $z=-\\frac{395}{1146}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-7*x+y+4*z+10, -10*x-11*y-23*z-21, -13*x-y+14*z+15)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=3$, and $a_n=a_{n-1}+4 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{27}{2} \\left(6+104 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 3 # initial value\nd = 4*math.sqrt(3) # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = 3 # initial value\nd = 4*math.sqrt(3) # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-23 x-8 y+23 z+19=0$, $8 x-6 y+5 z+4=0$, $11 x+23 y+18 z-4=0$", + "Output Answer": [ + "$x=\\frac{1937}{11591}$, $y=\\frac{5555}{11591}$, $z=-\\frac{5706}{11591}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-23*x-8*y+23*z+19, 8*x-6*y+5*z+4, 11*x+23*y+18*z-4)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{7 x^2}{2}+3 x+\\frac{1}{2}$ and $-\\frac{7 x^5}{2}-\\frac{3 x^4}{2}-\\frac{7 x^3}{2}+\\frac{7 x^2}{2}-\\frac{5}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((7*x**2)/2)+3*x+(1/2), -((7*x**5)/2)-((3*x**4)/2)-((7*x**3)/2)+((7*x**2)/2)-(5/2)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\sqrt{3} \\left(\\cos \\left(\\frac{151}{90}\\right)+i \\sin \\left(\\frac{151}{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$2187 \\sqrt{3} \\left(\\cos \\left(\\frac{151}{18}\\right)+i \\sin \\left(\\frac{151}{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*math.sqrt(3)*(math.cos((151/90))+1j*math.sin((151/90))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((18+4)+7)-(((7-15)+16)-13)$.", + "Output Answer": [ + "$34$" + ], + "Output Program": [ + "try: \n print(((18+4)+7)-(((7-15)+16)-13))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(9 t+44)^2, x(t)=-3 t-15$", + "Output Answer": [ + "$y=9 x^2+6 x+1$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (9*t+44)**2\nx_t = -3*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$14 x+12 y+3=0$, $-x+22 y+8=0$", + "Output Answer": [ + "$x=\\frac{3}{32}$, $y=-\\frac{23}{64}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((14*x+12*y+3, -x+22*y+8), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{388 x^2}{49}+\\frac{1045 x}{49}+\\frac{2567}{49}}{\\frac{268 x^2}{49}-\\frac{611 x}{49}-\\frac{2244}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{151}{97}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((388*x**2)/49)+((1045*x)/49)+(2567/49))/(((268*x**2)/49)-((611*x)/49)-(2244/49))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-9 x-\\frac{33 y}{4}+\\frac{51 z}{4}-\\frac{91}{4}=0$, $-\\frac{25 x}{2}-\\frac{61 y}{4}-19 z-\\frac{1}{4}=0$, $\\frac{69 x}{4}+\\frac{y}{2}-\\frac{29 z}{4}-23=0$", + "Output Answer": [ + "$x=\\frac{690904}{361305}$, $y=-\\frac{1097941}{361305}$, $z=\\frac{60278}{51615}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-9*x-((33*y)/4)+((51*z)/4)-(91/4), -((25*x)/2)-((61*y)/4)-19*z-(1/4), ((69*x)/4)+(y/2)-((29*z)/4)-23)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((((23-24)+5)+21)-6)+\\left(\\left((24-4)^2+20\\right)+15\\right)$.", + "Output Answer": [ + "$454$" + ], + "Output Program": [ + "try: \n print(((((23-24)+5)+21)-6)+(((24-4)**2+20)+15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 16 x^2-20 x+2\\right| =8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{4}\\right\\},\\left\\{x\\to \\frac{3}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(16*x**2-20*x+2), 8), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{27 x^2}{5}-\\frac{99 x}{5}-12}{-\\frac{119 x}{5}-\\frac{31}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(11-\\sqrt{201}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(11+\\sqrt{201}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((27*x**2)/5)-((99*x)/5)-12)/(-((119*x)/5)-(31/5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=75 t^2+450 t+672, x(t)=25 t^2+150 t+225$", + "Output Answer": [ + "$y=3 x-3$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 75*t**2+450*t+672\nx_t = 25*t**2+150*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 5 x-3, q(x) = 16 (x-2)^2$", + "Output Answer": [ + "$16 x^2-59 x+61$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x-3\nq = 16*(x-2)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{34 x}{\\sqrt{3}}-\\frac{32 y}{\\sqrt{3}}+\\frac{22}{\\sqrt{3}}=0$, $\\frac{37 x}{\\sqrt{3}}+\\frac{34 y}{\\sqrt{3}}-\\frac{8}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{123}{7}$, $y=\\frac{271}{14}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((34*x)/(sqrt(3)))-((32*y)/(sqrt(3)))+(22/(sqrt(3))), ((37*x)/(sqrt(3)))+((34*y)/(sqrt(3)))-(8/(sqrt(3)))), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=7+8 i$ and $y=-10-5 i$", + "Output Answer": [ + "$-30-115 i$" + ], + "Output Program": [ + "i = 1j\nx = 7+8*i\ny = -10-5*i\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{4}{625} \\left(867 t^2-7650 t+16850\\right)^2, x(t)=\\frac{289 t^2}{25}-102 t+225$", + "Output Answer": [ + "$y=36 x^2-24 x+4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (4/625)*(867*t**2-7650*t+16850)**2\nx_t = ((289*t**2)/25)-102*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{11 x^2}{\\sqrt{2}}-\\frac{9 x}{\\sqrt{2}}-9 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{3}{11} \\left(\\frac{3}{2}-\\frac{\\sqrt{97}}{2}\\right)\\lor x=\\frac{3}{11} \\left(\\frac{3}{2}+\\frac{\\sqrt{97}}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((11*x**2)/(sqrt(2)))-((9*x)/(sqrt(2)))-9*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{61}{28}$, and $a_n=a_{n-1}+-9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$-\\frac{40157}{14}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (61/28) # initial value\nd = -9 # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (61/28) # initial value\nd = -9 # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{9 x^2-12 x-11}{\\sqrt{2}}$, $q(x) = \\frac{3 x^2+5 x+19}{\\sqrt{2}}$", + "Output Answer": [ + "$6 \\sqrt{2} x^2-6 \\sqrt{2} x+\\frac{5 x}{\\sqrt{2}}+4 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((9*x**2-12*x-11)/(sqrt(2)))\nq = ((3*x**2+5*x+19)/(sqrt(2)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+2 x-2 y^2-8 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x+\\frac{1}{9}\\right)^2-2 (y+2)^2=-\\frac{125}{9}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{9} & -2-\\frac{5 \\sqrt{\\frac{55}{2}}}{9} \\\\\n -\\frac{1}{9} & \\frac{5 \\sqrt{\\frac{55}{2}}}{9}-2 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{11}}{3}$\nCenter: $\\left\\{-\\frac{1}{9},-2\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{6} \\left(-12-\\sqrt{2}\\right)-\\frac{3 x}{\\sqrt{2}},y=\\frac{3 x}{\\sqrt{2}}+\\frac{1}{6} \\left(\\sqrt{2}-12\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+2*x-2*y**2-8*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{63}{32}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$-\\frac{1197}{32}$" + ], + "Output Program": [ + "a = -(63/32) # initial value\nd = 0 # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(63/32) # initial value\nd = 0 # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{32 x}{7}-6}+\\sqrt{\\frac{67 x}{7}-\\frac{25}{7}}=\\frac{23}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{48206-138 \\sqrt{71194}}{8575}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((32*x)/7)-6)+sqrt(((67*x)/7)-(25/7)), (23/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{x^2+15 x+8}{5 x-4}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-15-\\sqrt{193}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(-15+\\sqrt{193}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((x**2+15*x+8)/(5*x-4)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\sqrt{2} x^2-14 \\sqrt{2} x-17 \\sqrt{2}}{-17 \\sqrt{2} x-5 \\sqrt{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 7-\\sqrt{66}\\right\\},\\left\\{x\\to 7+\\sqrt{66}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((sqrt(2)*x**2-14*sqrt(2)*x-17*sqrt(2))/(-17*sqrt(2)*x-5*sqrt(2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $4 \\sqrt{3} e^{\\frac{9 i \\pi }{10}}$.", + "Output Answer": [ + "Norm: $4 \\sqrt{3}$\nArgument: $\\frac{9 \\pi }{10}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 4*math.sqrt(3)*math.e**((9*i*math.pi)/10)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{11 x^2}{\\sqrt{2}}+\\frac{27 x}{\\sqrt{2}}+\\frac{33}{\\sqrt{2}}}{13 \\sqrt{2} x^2+\\frac{35 x}{\\sqrt{2}}-\\frac{13}{\\sqrt{2}}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{22} \\left(27-\\sqrt{2181}\\right)\\right\\},\\left\\{x\\to \\frac{1}{22} \\left(27+\\sqrt{2181}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((11*x**2)/(sqrt(2)))+((27*x)/(sqrt(2)))+(33/(sqrt(2))))/(13*sqrt(2)*x**2+((35*x)/(sqrt(2)))-(13/(sqrt(2))))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{19 \\left(\\sin \\left(\\frac{\\pi }{20}\\right)-i \\cos \\left(\\frac{\\pi }{20}\\right)\\right)}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{19 \\sqrt{\\sin ^2\\left(\\frac{\\pi }{20}\\right)+\\cos ^2\\left(\\frac{\\pi }{20}\\right)}}{\\pi }$\nArgument: $-\\frac{9 \\pi }{20}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((19*(math.sin((math.pi/20))-i*math.cos((math.pi/20))))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{x}{7}-\\frac{25 y}{7}-\\frac{30}{7}=0$, $-\\frac{16 x}{7}-\\frac{117 y}{7}+\\frac{162}{7}=0$", + "Output Answer": [ + "$x=\\frac{7560}{283}$, $y=-\\frac{642}{283}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-(x/7)-((25*y)/7)-(30/7), -((16*x)/7)-((117*y)/7)+(162/7)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$2 \\sqrt{3} x+13 \\sqrt{3} y-6 \\sqrt{3} z+\\frac{35}{\\sqrt{3}}=0$, $3 \\sqrt{3} x+\\frac{2 y}{\\sqrt{3}}+3 \\sqrt{3} z+3 \\sqrt{3}=0$, $\\frac{25 x}{\\sqrt{3}}+\\frac{31 y}{\\sqrt{3}}-9 \\sqrt{3} z-\\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{929}{1348}$, $y=-\\frac{545}{337}$, $z=-\\frac{16133}{12132}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((2*sqrt(3)*x+13*sqrt(3)*y-6*sqrt(3)*z+(35/(sqrt(3))), 3*sqrt(3)*x+((2*y)/(sqrt(3)))+3*sqrt(3)*z+3*sqrt(3), ((25*x)/(sqrt(3)))+((31*y)/(sqrt(3)))-9*sqrt(3)*z-sqrt(3))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-5 x^2-19 x-11}{20 x^2+5 x+3}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(-19-\\sqrt{141}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(-19+\\sqrt{141}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-5*x**2-19*x-11)/(20*x**2+5*x+3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\pi, \\frac{1}{\\sqrt{3}}, 5)$", + "Output Answer": [ + "$\\left\\{\\sqrt{\\frac{76}{3}+\\pi ^2},\\tan ^{-1}\\left(\\frac{1}{5} \\sqrt{\\frac{1}{3}+\\pi ^2}\\right),\\tan ^{-1}\\left(\\frac{1}{\\sqrt{3} \\pi }\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.pi\ny = (1/(math.sqrt(3)))\nz = 5\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{19-13 i}{e}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{530}}{e}$\nArgument: $-\\tan ^{-1}\\left(\\frac{13}{19}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((19-13*i)/math.e)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{180 x^2+87 x+6}{360 x^2+129 x-6}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{12}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((180*x**2+87*x+6)/(360*x**2+129*x-6)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$-\\tan ^{-1}\\left(x^5+5\\right)$", + "Output Answer": [ + "$-\\frac{\\pi }{2} 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\sqrt{5} \\left(-\\cos \\left(\\frac{2 \\pi }{15}\\right)+i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\sqrt{5 \\left(\\sin ^2\\left(\\frac{2 \\pi }{15}\\right)+\\cos ^2\\left(\\frac{2 \\pi }{15}\\right)\\right)}$\nArgument: $\\frac{13 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = math.sqrt(5)*(-math.cos(((2*math.pi)/15))+i*math.sin(((2*math.pi)/15)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt{-\\frac{9 x}{2}-8}$", + "Output Answer": [ + "$x\\leq -\\frac{16}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sqrt(-((9*x)/2)-8)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(3+4 i) \\sqrt{3}$ and $y=(5+3 i) \\sqrt{3}$", + "Output Answer": [ + "$(-2+i) \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (3+4*i)*math.sqrt(3)\ny = (5+3*i)*math.sqrt(3)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(\\cos \\left(\\frac{167}{90}\\right)+i \\sin \\left(\\frac{167}{90}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$244140625 \\left(\\cos \\left(\\frac{334}{15}\\right)+i \\sin \\left(\\frac{334}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(math.cos((167/90))+1j*math.sin((167/90))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -3 \\pi \\left(x^2-1\\right)$, $q(x) = \\pi \\left(-x^2+4 x+1\\right)$", + "Output Answer": [ + "$-4 \\pi x^2+4 \\pi x+4 \\pi$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*pi*(x**2-1)\nq = pi*(-x**2+4*x+1)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\log \\left(\\frac{x^2}{3}-5\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\sqrt{3 e^y+15}\\right\\},\\left\\{x\\to \\sqrt{3 e^y+15}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, log(((x**2)/3)-5))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2-3 x-5 y^2+6 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x-\\frac{3}{14}\\right)^2-5 \\left(y-\\frac{3}{5}\\right)^2=\\frac{633}{140}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{70} \\left(5-2 \\sqrt{211}\\right) & \\frac{3}{5} \\\\\n \\frac{3}{70} \\left(5+2 \\sqrt{211}\\right) & \\frac{3}{5} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{3}{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{3}{70} \\left(5-2 \\sqrt{211}\\right)+\\frac{3}{70} \\left(5+2 \\sqrt{211}\\right)\\right),\\frac{3}{5}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{7}{5}} x-\\frac{3}{70} \\left(\\sqrt{35}-14\\right),y=\\frac{3}{70} \\left(14+\\sqrt{35}\\right)-\\sqrt{\\frac{7}{5}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2-3*x-5*y**2+6*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(3-6 i) \\sqrt{2}$ and $y=(-3+3 i) \\sqrt{2}$", + "Output Answer": [ + "$-3 i \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (3-6*i)*math.sqrt(2)\ny = (-3+3*i)*math.sqrt(2)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{4} (203-30 t), x(t)=\\frac{5 t}{2}-15$", + "Output Answer": [ + "$y=\\frac{23}{4}-3 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/4)*(203-30*t)\nx_t = ((5*t)/2)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{25}{3}+\\frac{29 i}{3}$ and $y=\\frac{10}{3}+3 i$", + "Output Answer": [ + "$-\\frac{11}{9}+\\frac{515 i}{9}$" + ], + "Output Program": [ + "i = 1j\nx = (25/3)+((29*i)/3)\ny = (10/3)+3*i\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{86}{53}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$-\\frac{1204}{53}$" + ], + "Output Program": [ + "a = -(86/53) # initial value\nd = 0 # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(86/53) # initial value\nd = 0 # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $3 x^2-3 x-4$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(3-\\sqrt{57}\\right)\\lor x=\\frac{1}{6} \\left(3+\\sqrt{57}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(3*x**2-3*x-4, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{27 x^2+8 x+38}{e}$, $q(x) = \\frac{-11 x^2-35 x+18}{e}$", + "Output Answer": [ + "$-\\frac{38 x^2}{e}-\\frac{43 x}{e}-\\frac{20}{e}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x\n\np = -((27*x**2+8*x+38)/math.e)\nq = ((-11*x**2-35*x+18)/math.e)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(((9+25)-20)+21)+16}{\\frac{10}{24}+25}$.", + "Output Answer": [ + "$\\frac{612}{305}$" + ], + "Output Program": [ + "try: \n print((((((9+25)-20)+21)+16)/((10/24)+25)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{14 x^2-10 x-10}{2 x-22}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{14} \\left(5-\\sqrt{165}\\right)\\right\\},\\left\\{x\\to \\frac{1}{14} \\left(5+\\sqrt{165}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((14*x**2-10*x-10)/(2*x-22)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(\\cos \\left(\\frac{7}{90}\\right)+i \\sin \\left(\\frac{7}{90}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-343 \\left(\\cos \\left(\\frac{7}{30}\\right)+i \\sin \\left(\\frac{7}{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(math.cos((7/90))+1j*math.sin((7/90))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-23 x-18 y+17 z-23=0$, $-11 x-8 y-12 z+11=0$, $-12 x-20 y-4 z-11=0$", + "Output Answer": [ + "$x=\\frac{905}{1273}$, $y=-\\frac{6049}{5092}$, $z=\\frac{2691}{2546}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-23*x-18*y+17*z-23, -11*x-8*y-12*z+11, -12*x-20*y-4*z-11)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{21 x^3-151 x^2+90 x+152}{9 x^2-75 x+114}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(3-\\sqrt{65}\\right)\\right\\},\\left\\{x\\to \\frac{1}{7} \\left(3+\\sqrt{65}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((21*x**3-151*x**2+90*x+152)/(9*x**2-75*x+114)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{3}{17}$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{8382}{17}$" + ], + "Output Program": [ + "a = -(3/17) # initial value\nd = 9 # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(3/17) # initial value\nd = 9 # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(4-11)+\\left(\\left(\\left(\\frac{24}{9}+5\\right)^2-5\\right)+15\\right)$.", + "Output Answer": [ + "$\\frac{556}{9}$" + ], + "Output Program": [ + "try: \n print((4-11)+((((24/9)+5)**2-5)+15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -5 \\sqrt{5} x-3 \\sqrt{5}\\right| =4 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{5}\\right\\},\\left\\{x\\to \\frac{1}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-5*sqrt(5)*x-3*sqrt(5)), 4*sqrt(5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\sqrt{2} \\left(\\sin \\left(\\frac{2 \\pi }{9}\\right)+i \\cos \\left(\\frac{2 \\pi }{9}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$17496 \\sqrt{2} \\left(\\cos \\left(\\frac{\\pi }{18}\\right)-i \\sin \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*math.sqrt(2)*(math.sin(((2*math.pi)/9))+1j*math.cos(((2*math.pi)/9))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{4 x^2-16 x+39}{e}$, $q(x) = -\\frac{2 \\left(5 x^2-15 x+12\\right)}{e}$", + "Output Answer": [ + "$-\\frac{6 x^2}{e}+\\frac{14 x}{e}+\\frac{15}{e}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x\n\np = ((4*x**2-16*x+39)/math.e)\nq = -((2*(5*x**2-15*x+12))/math.e)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{1-3 i}{e}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{10}}{e}$\nArgument: $-\\tan ^{-1}(3)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((1-3*i)/math.e)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-x^2+x+8 y^2-3 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y-\\frac{3}{16}\\right)^2-\\left(x-\\frac{1}{2}\\right)^2=\\frac{129}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & -\\frac{3}{16} \\left(\\sqrt{129}-1\\right) \\\\\n \\frac{1}{2} & \\frac{3}{16} \\left(1+\\sqrt{129}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $3$\nCenter: $\\left\\{\\frac{1}{2},\\frac{1}{2} \\left(\\frac{3}{16} \\left(1+\\sqrt{129}\\right)-\\frac{3}{16} \\left(\\sqrt{129}-1\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{16} \\left(3+2 \\sqrt{2}\\right)-\\frac{x}{2 \\sqrt{2}},y=\\frac{x}{2 \\sqrt{2}}+\\frac{1}{16} \\left(3-2 \\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-x**2+x+8*y**2-3*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{19}{2}+3 i$ and $y=-\\frac{3}{2}-\\frac{9 i}{2}$", + "Output Answer": [ + "$-\\frac{3}{4}-\\frac{189 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = (19/2)+3*i\ny = -(3/2)-((9*i)/2)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2-6 x+y^2-6 y+9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $(y-3)^2-10 \\left(x+\\frac{3}{10}\\right)^2=-\\frac{9}{10}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{10} \\left(1+\\sqrt{11}\\right) & 3 \\\\\n \\frac{3}{10} \\left(\\sqrt{11}-1\\right) & 3 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{11}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{3}{10} \\left(\\sqrt{11}-1\\right)-\\frac{3}{10} \\left(1+\\sqrt{11}\\right)\\right),3\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{10} x+\\frac{3}{10} \\left(10+\\sqrt{10}\\right),y=-\\sqrt{10} x-\\frac{3}{10} \\left(\\sqrt{10}-10\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2-6*x+y**2-6*y+9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-13 x-\\frac{29}{4}}+\\sqrt{-\\frac{19 x}{2}-\\frac{31}{4}}=\\frac{25}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{98} \\left(-28111+1450 \\sqrt{365}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-13*x-(29/4))+sqrt(-((19*x)/2)-(31/4)), (25/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{9}{2} \\left(\\cos \\left(\\frac{37}{30}\\right)+i \\sin \\left(\\frac{37}{30}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$\\frac{6561}{16} \\left(\\cos \\left(\\frac{74}{15}\\right)+i \\sin \\left(\\frac{74}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(9/2)*(math.cos((37/30))+1j*math.sin((37/30))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{2}{7}-\\frac{15 i}{7}$ and $y=\\frac{9}{7}+\\frac{16 i}{7}$", + "Output Answer": [ + "$-\\frac{11}{7}-\\frac{31 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = -(2/7)-((15*i)/7)\ny = (9/7)+((16*i)/7)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{66 x}{7}-\\frac{75}{7}}+\\sqrt{-\\frac{33 x}{7}-\\frac{58}{7}}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{33} \\left(-3566+130 \\sqrt{651}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((66*x)/7)-(75/7))+sqrt(-((33*x)/7)-(58/7)), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{37}{17}$, and $a_n=a_{n-1}+-10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$-\\frac{47808}{17}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(37/17) # initial value\nd = -10 # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(37/17) # initial value\nd = -10 # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{40 x}{\\sqrt{3}}-\\frac{y}{\\sqrt{3}}-14 \\sqrt{3}=0$, $-13 \\sqrt{3} x+\\frac{23 y}{\\sqrt{3}}-\\frac{5}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{971}{881}$, $y=\\frac{1838}{881}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((40*x)/(sqrt(3)))-(y/(sqrt(3)))-14*sqrt(3), -13*sqrt(3)*x+((23*y)/(sqrt(3)))-(5/(sqrt(3)))), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{4 x^2-\\frac{45 x}{4}-\\frac{61}{4}}{-\\frac{31 x^2}{2}+\\frac{5 x}{4}+2}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to -1\\},\\left\\{x\\to \\frac{61}{16}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((4*x**2-((45*x)/4)-(61/4))/(-((31*x**2)/2)+((5*x)/4)+2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -21 x^2-17 x+4\\right| =10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{42} \\left(-17-\\sqrt{1465}\\right)\\right\\},\\left\\{x\\to \\frac{1}{42} \\left(-17+\\sqrt{1465}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-21*x**2-17*x+4), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\frac{5-x^3}{(4-7 x)^5}$", + "Output Answer": [ + "$y\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(((5-x**3)/((4-7*x)**5)), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-10 x-4 y+6 z-2=0$, $-x-y+8 z-20=0$, $-12 x+19 y+8 z+13=0$", + "Output Answer": [ + "$x=\\frac{1469}{883}$, $y=-\\frac{649}{883}$, $z=\\frac{2310}{883}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-10*x-4*y+6*z-2, -x-y+8*z-20, -12*x+19*y+8*z+13)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-x^3+\\frac{14 x^2}{3}+\\frac{23 x}{3}-\\frac{10}{3}$ when divided by $\\frac{2 x^3}{3}-8 x^2-5 x-1$.", + "Output Answer": [ + "$-\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**3+((14*x**2)/3)+((23*x)/3)-(10/3)\nq = ((2*x**3)/3)-8*x**2-5*x-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-9 x-3}+\\sqrt{-2 x-2}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(-1591+48 \\sqrt{627}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-9*x-3)+sqrt(-2*x-2), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{4-3}{((((4+6)+12)+13)+10)^2}$.", + "Output Answer": [ + "$\\frac{1}{2025}$" + ], + "Output Program": [ + "try: \n print(((4-3)/(((((4+6)+12)+13)+10)**2)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5-x$ and $5 x^4+4 x^3+5 x^2-3 x-2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5-x, 5*x**4+4*x**3+5*x**2-3*x-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-44 x^2-115 x+306}{-110 x^2+48 x+216}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{17}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-44*x**2-115*x+306)/(-110*x**2+48*x+216)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$16 x-14 y+14=0$, $-3 x+5 y+14=0$", + "Output Answer": [ + "$x=-7$, $y=-7$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((16*x-14*y+14, -3*x+5*y+14), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{2 \\sqrt{5} x-8 \\sqrt{5}}{-3 \\sqrt{5} x^2+3 \\sqrt{5} x+7 \\sqrt{5}}=0$", + "Output Answer": [ + "$\\{\\{x\\to 4\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((2*sqrt(5)*x-8*sqrt(5))/(-3*sqrt(5)*x**2+3*sqrt(5)*x+7*sqrt(5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -18 x-9| =13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{11}{9}\\right\\},\\left\\{x\\to \\frac{2}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-18*x-9), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{83}{59}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$\\frac{2775}{59}$" + ], + "Output Program": [ + "a = (83/59) # initial value\nd = 4 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (83/59) # initial value\nd = 4 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-13 x-10}+\\sqrt{1-4 x}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{81} \\left(-262+5 \\sqrt{1777}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-13*x-10)+sqrt(1-4*x), 5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $x^2+4 x+7$", + "Output Answer": [ + "$(x+2)^2+3$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (x**2+4*x+7), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{11}{8}$, and $a_n=a_{n-1}+2 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$\\frac{23}{2} \\left(44 \\sqrt{2}-\\frac{11}{4}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(11/8) # initial value\nd = 2*math.sqrt(2) # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(11/8) # initial value\nd = 2*math.sqrt(2) # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{12-10 x}+\\sqrt{8-\\frac{4 x}{3}}=3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{338} \\left(-303+18 \\sqrt{1518}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(12-10*x)+sqrt(8-((4*x)/3)), 3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -16 x^2+13 x-2\\right| =18$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{32} \\left(13-\\sqrt{1193}\\right)\\right\\},\\left\\{x\\to \\frac{1}{32} \\left(13+\\sqrt{1193}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-16*x**2+13*x-2), 18), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x+6}+\\sqrt{7 x-6}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(2192-28 \\sqrt{5686}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x+6)+sqrt(7*x-6), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{41 x}{7}-\\frac{55}{7}}+\\sqrt{-3 x-\\frac{48}{7}}=\\frac{32}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{700} \\left(-16117+96 \\sqrt{21329}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((41*x)/7)-(55/7))+sqrt(-3*x-(48/7)), (32/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-15 x^2+14 x+12$", + "Output Answer": [ + "$\\frac{229}{15}-15 \\left(x-\\frac{7}{15}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-15*x**2+14*x+12), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2+7 \\sqrt{3} x+90$", + "Output Answer": [ + "$-\\left(\\left(x-10 \\sqrt{3}\\right) \\left(x+3 \\sqrt{3}\\right)\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2+7*sqrt(3)*x+90, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2+6 x+9 y^2+5 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $2 \\left(x+\\frac{3}{2}\\right)^2+9 \\left(y+\\frac{5}{18}\\right)^2=\\frac{475}{36}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{36} \\left(-54-5 \\sqrt{266}\\right) & -\\frac{5}{18} \\\\\n \\frac{1}{36} \\left(5 \\sqrt{266}-54\\right) & -\\frac{5}{18} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{7}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{36} \\left(-54-5 \\sqrt{266}\\right)+\\frac{1}{36} \\left(5 \\sqrt{266}-54\\right)\\right),-\\frac{5}{18}\\right\\}$\nArea Enclosed: $\\frac{475 \\pi }{108 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2+6*x+9*y**2+5*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-5 x-y^2-7 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x-\\frac{5}{12}\\right)^2-\\left(y+\\frac{7}{2}\\right)^2=-\\frac{101}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{12} & -\\frac{7}{2}-\\frac{\\sqrt{707}}{12} \\\\\n \\frac{5}{12} & \\frac{1}{12} \\left(\\sqrt{707}-42\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{6}}$\nCenter: $\\left\\{\\frac{5}{12},\\frac{1}{2} \\left(-\\frac{7}{2}-\\frac{\\sqrt{707}}{12}+\\frac{1}{12} \\left(\\sqrt{707}-42\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{12} \\left(5 \\sqrt{6}-42\\right)-\\sqrt{6} x,y=\\sqrt{6} x+\\frac{1}{12} \\left(-42-5 \\sqrt{6}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-5*x-y**2-7*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{41}{6}$, and $a_n=a_{n-1}+-4 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$13 \\left(-\\frac{41}{3}-100 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(41/6) # initial value\nd = -4*math.sqrt(2) # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(41/6) # initial value\nd = -4*math.sqrt(2) # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\cosh \\left(\\sqrt{6-4 x}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{4} \\left(6-\\cosh ^{-1}(y)^2\\right)\\text{ if }y>1$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, cosh(sqrt(6-4*x)))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^5-x^4+4 x^3+6 x^2+4 x+7$ when divided by $-9 x^2+8 x+1$.", + "Output Answer": [ + "$-\\frac{5 x^3}{9}-\\frac{31 x^2}{81}-\\frac{617 x}{729}-\\frac{9589}{6561}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**5-x**4+4*x**3+6*x**2+4*x+7\nq = -9*x**2+8*x+1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 6-15 x^2$ and $q(x) = 7 x^2+5 x-1$", + "Output Answer": [ + "$-105 x^4-75 x^3+57 x^2+30 x-6$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 6-15*x**2\nq = 7*x**2+5*x-1\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{26}-\\left(\\sqrt{130}-\\sqrt{75}\\right)$.", + "Output Answer": [ + "$5 \\sqrt{3}+\\sqrt{26}-\\sqrt{130}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(26)-(sqrt(130)-sqrt(75)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{59}{94}$, and $a_n=a_{n-1}+-\\frac{14}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$-\\frac{1434}{47}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(59/94) # initial value\nd = -(14/3) # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(59/94) # initial value\nd = -(14/3) # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9-\\frac{3 x}{5}}+\\sqrt{\\frac{47 x}{5}-\\frac{74}{5}}=\\frac{52}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{74363-52 \\sqrt{91986}}{6250}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9-((3*x)/5))+sqrt(((47*x)/5)-(74/5)), (52/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{3 x^2+11 x+6}{7 x-6}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to -3\\},\\left\\{x\\to -\\frac{2}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((3*x**2+11*x+6)/(7*x-6)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2-5 x-8 y^2-5 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x-\\frac{5}{6}\\right)^2-8 \\left(y+\\frac{5}{16}\\right)^2=\\frac{989}{96}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{6}-\\frac{\\sqrt{10879}}{48} & -\\frac{5}{16} \\\\\n \\frac{1}{48} \\left(40+\\sqrt{10879}\\right) & -\\frac{5}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{11}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{5}{6}-\\frac{\\sqrt{10879}}{48}+\\frac{1}{48} \\left(40+\\sqrt{10879}\\right)\\right),-\\frac{5}{16}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{2} \\sqrt{\\frac{3}{2}} x-\\frac{5}{48} \\left(3+2 \\sqrt{6}\\right),y=\\frac{5}{48} \\left(2 \\sqrt{6}-3\\right)-\\frac{1}{2} \\sqrt{\\frac{3}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2-5*x-8*y**2-5*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $15 x^2+x-3$", + "Output Answer": [ + "$15 \\left(x+\\frac{1}{30}\\right)^2-\\frac{181}{60}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (15*x**2+x-3), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{42 x^2}{5}+\\frac{26 x}{5}+\\frac{29}{5}$ and $q(x) = 6 x^2+\\frac{26 x}{5}-\\frac{42}{5}$", + "Output Answer": [ + "$-\\frac{252 x^4}{5}-\\frac{312 x^3}{25}+\\frac{662 x^2}{5}-\\frac{338 x}{25}-\\frac{1218}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((42*x**2)/5)+((26*x)/5)+(29/5)\nq = 6*x**2+((26*x)/5)-(42/5)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2+15 \\sqrt{2} x+396$", + "Output Answer": [ + "$3 \\left(-x-6 \\sqrt{2}\\right) \\left(x-11 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2+15*sqrt(2)*x+396, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{275 x^2}{2}+\\frac{1085 x}{2}+\\frac{3015}{8}}{\\frac{253 x}{8}+\\frac{1541}{16}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{9}{10}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((275*x**2)/2)+((1085*x)/2)+(3015/8))/(((253*x)/8)+(1541/16))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+44 x+1540$", + "Output Answer": [ + "$11 (14-x) (x+10)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+44*x+1540, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{4}{19}$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$-\\frac{1500}{19}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (4/19) # initial value\nd = -8 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (4/19) # initial value\nd = -8 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{13 x+3}{\\sqrt{3}}, q(x) = 3 (1-4 x)^2$", + "Output Answer": [ + "$48 x^2-\\frac{13 x}{\\sqrt{3}}-24 x-\\sqrt{3}+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((13*x+3)/(sqrt(3)))\nq = 3*(1-4*x)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{59 x^2}{5}+\\frac{6 x}{5}-\\frac{29}{5}$", + "Output Answer": [ + "$-\\frac{59}{5} \\left(x-\\frac{3}{59}\\right)^2-\\frac{1702}{295}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((59*x**2)/5)+((6*x)/5)-(29/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-24 t-65, x(t)=-6 t-15$", + "Output Answer": [ + "$y=4 x-5$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -24*t-65\nx_t = -6*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-19 x^2+14 x+5}{-x-6}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{19}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-19*x**2+14*x+5)/(-x-6)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -8 (x-2)^3, q(x) = (x+7)^4$", + "Output Answer": [ + "$x^4+20 x^3+342 x^2+1276 x+2465$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*(x-2)**3\nq = (x+7)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-4 \\sqrt{3} x^2-\\sqrt{3} x+5 \\sqrt{3}$", + "Output Answer": [ + "$\\frac{81 \\sqrt{3}}{16}-4 \\sqrt{3} \\left(x+\\frac{1}{8}\\right)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-4*math.sqrt(3)*x**2-math.sqrt(3)*x+5*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^6+8 x^5-x^3-7 x^2-4 x+1$ when divided by $x^2+8 x+7$.", + "Output Answer": [ + "$9 x^4-64 x^3+449 x^2-3145 x+22010$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**6+8*x**5-x**3-7*x**2-4*x+1\nq = x**2+8*x+7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{5} x, q(x) = \\sqrt{5} (1-4 x)$", + "Output Answer": [ + "$\\sqrt{5}-3 \\sqrt{5} x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(5)*x\nq = sqrt(5)*(1-4*x)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 23-7 x| =6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{17}{7}\\right\\},\\left\\{x\\to \\frac{29}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(23-7*x), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{7 e^{-\\frac{29 i \\pi }{60}}}{\\sqrt{2}}$.", + "Output Answer": [ + "Norm: $\\frac{7}{\\sqrt{2}}$\nArgument: $\\frac{31 \\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((7*math.e**(-((29*i*math.pi)/60)))/(math.sqrt(2)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-5 \\left(\\cos \\left(\\frac{31}{18}\\right)+i \\sin \\left(\\frac{31}{18}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$244140625 \\left(\\cos \\left(\\frac{62}{3}\\right)+i \\sin \\left(\\frac{62}{3}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-5*(math.cos((31/18))+1j*math.sin((31/18))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-4 x^2-122 x-918$", + "Output Answer": [ + "$4 (-x-17) \\left(x+\\frac{27}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-4*x**2-122*x-918, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -6 x^2+9 x+10$, $q(x) = -4 x^2-7 x+12$", + "Output Answer": [ + "$-10 x^2+2 x+22$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**2+9*x+10\nq = -4*x**2-7*x+12\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=8-5 i$ and $y=4-i$", + "Output Answer": [ + "$12-6 i$" + ], + "Output Program": [ + "i = 1j\nx = 8-5*i\ny = 4-i\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-10 \\left(\\cos \\left(\\frac{28}{45}\\right)+i \\sin \\left(\\frac{28}{45}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-10000000 \\left(\\cos \\left(\\frac{196}{45}\\right)+i \\sin \\left(\\frac{196}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-10*(math.cos((28/45))+1j*math.sin((28/45))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sixth order series of the inverse of the following function around 6:\n$\\cos ^{-1}(x)$", + "Output Answer": [ + "$-\\frac{1}{120} \\left(x-\\frac{\\pi }{2}\\right)^5+\\frac{1}{6} \\left(x-\\frac{\\pi }{2}\\right)^3-x+\\frac{\\pi }{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, acos(x))\nprint(solve(f, x)[0].series(y, 6, 6))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^2-2 x-3$ and $-x^2+x-4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**2-2*x-3, -x**2+x-4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $-\\frac{\\sqrt{5} x^2-2 \\sqrt{5}}{4 \\sqrt{5} x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\sqrt{2}\\right\\},\\left\\{x\\to \\sqrt{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((sqrt(5)*x**2-2*sqrt(5))/(4*sqrt(5)*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{7 x}{2}+2}+\\sqrt{7 x+\\frac{15}{2}}=\\frac{5}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((7*x)/2)+2)+sqrt(7*x+(15/2)), (5/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{72 x}{5}-\\frac{9}{5}}+\\sqrt{\\frac{73}{5}-\\frac{16 x}{5}}=\\frac{51}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-31481+306 \\sqrt{7827}}{1960}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((72*x)/5)-(9/5))+sqrt((73/5)-((16*x)/5)), (51/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^4+4 x^3-8 x^2+4 x+8$ and $x^4-x^3+2 x^2-x-2$.", + "Output Answer": [ + "$x^4-x^3+2 x^2-x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**4+4*x**3-8*x**2+4*x+8, x**4-x**3+2*x**2-x-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-5-5 i) \\sqrt{3}$ and $y=(-5+2 i) \\sqrt{3}$", + "Output Answer": [ + "$\\frac{15}{29}+\\frac{35 i}{29}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-5-5*i)*math.sqrt(3)\ny = (-5+2*i)*math.sqrt(3)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left((13-17)^2+20\\right)-1\\right)-(11-13)$.", + "Output Answer": [ + "$37$" + ], + "Output Program": [ + "try: \n print((((13-17)**2+20)-1)-(11-13))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{35 x}{3}-\\frac{40 y}{3}-z+14=0$, $-\\frac{64 x}{3}+\\frac{43 y}{3}-17 z-\\frac{28}{3}=0$, $8 x-24 y-\\frac{73 z}{3}+\\frac{14}{3}=0$", + "Output Answer": [ + "$x=\\frac{179984}{463497}$, $y=\\frac{343490}{463497}$, $z=-\\frac{63574}{154499}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((35*x)/3)-((40*y)/3)-z+14, -((64*x)/3)+((43*y)/3)-17*z-(28/3), 8*x-24*y-((73*z)/3)+(14/3))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(1+4 i) \\sqrt{5}$ and $y=(1-i) \\sqrt{5}$", + "Output Answer": [ + "$(2+3 i) \\sqrt{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (1+4*i)*math.sqrt(5)\ny = (1-i)*math.sqrt(5)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $13 x^2+12 x-6$", + "Output Answer": [ + "$x=\\frac{1}{13} \\left(-6-\\sqrt{114}\\right)\\lor x=\\frac{1}{13} \\left(\\sqrt{114}-6\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(13*x**2+12*x-6, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{36}{67}$, and $a_n=a_{n-1}+\\frac{60}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{12816}{469}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (36/67) # initial value\nd = (60/7) # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (36/67) # initial value\nd = (60/7) # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3$ and $-2 x^2-3 x+1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3, -2*x**2-3*x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^4-4 x^3-7 x^2-6 x-5$ when divided by $-2 x^4-5 x^3-x^2+x-4$.", + "Output Answer": [ + "$\\frac{9}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**4-4*x**3-7*x**2-6*x-5\nq = -2*x**4-5*x**3-x**2+x-4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{5-24 i}{e}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{601}}{e}$\nArgument: $-\\tan ^{-1}\\left(\\frac{24}{5}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((5-24*i)/math.e)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 x^2-11 x-2$", + "Output Answer": [ + "$\\frac{105}{8}-2 \\left(x+\\frac{11}{4}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*x**2-11*x-2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x+4$ and $-4 x^3+3 x^2-4 x+4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x+4, -4*x**3+3*x**2-4*x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{13}{5} e^{-\\frac{23 i \\pi }{36}}$.", + "Output Answer": [ + "Norm: $\\frac{13}{5}$\nArgument: $-\\frac{23 \\pi }{36}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (13/5)*math.e**(-((23*i*math.pi)/36))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-12 x-15$ and $3$.", + "Output Answer": [ + "$3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-12*x-15, 3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-14 i \\log (2)$ and $y=(10+i) \\log (2)$", + "Output Answer": [ + "$-\\frac{14}{101}-\\frac{140 i}{101}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -14*i*math.log10(2)\ny = (10+i)*math.log10(2)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$25 x+5 y-24 z+6=0$, $16 x-15 y+12 z-24=0$, $x+7 z-5=0$", + "Output Answer": [ + "$x=\\frac{342}{697}$, $y=-\\frac{1956}{3485}$, $z=\\frac{449}{697}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((25*x+5*y-24*z+6, 16*x-15*y+12*z-24, x+7*z-5)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=7+i$ and $y=-\\frac{39}{5}-3 i$", + "Output Answer": [ + "$-\\frac{80}{97}+\\frac{55 i}{291}$" + ], + "Output Program": [ + "i = 1j\nx = 7+i\ny = -(39/5)-3*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $3 x^2-x+12$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(1-i \\sqrt{143}\\right)\\lor x=\\frac{1}{6} \\left(1+i \\sqrt{143}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(3*x**2-x+12, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{11}{4} \\left(\\cos \\left(\\frac{1}{6}\\right)+i \\sin \\left(\\frac{1}{6}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$\\frac{2357947691 \\left(\\cos \\left(\\frac{3}{2}\\right)+i \\sin \\left(\\frac{3}{2}\\right)\\right)}{262144}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((11/4)*(math.cos((1/6))+1j*math.sin((1/6))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\cos (4 x+6)-\\tan (1-6 x)$", + "Output Answer": [ + "$\\frac{1-6 x}{\\pi }+\\frac{1}{2}\\notin \\mathbb{Z}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = cos(4*x+6)-tan(1-6*x)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{25}{27}$, and $a_n=a_{n-1}+4 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{25}{2} \\left(96 \\sqrt{2}-\\frac{50}{27}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(25/27) # initial value\nd = 4*math.sqrt(2) # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(25/27) # initial value\nd = 4*math.sqrt(2) # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\log \\left(-\\frac{x^4}{2}-\\frac{13}{2}\\right)$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = log(-((x**4)/2)-(13/2))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(22+4)+((17+8)+18)$.", + "Output Answer": [ + "$69$" + ], + "Output Program": [ + "try: \n print((22+4)+((17+8)+18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{9 e^{\\frac{4 i \\pi }{45}}}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $\\frac{9}{\\sqrt{\\pi }}$\nArgument: $\\frac{4 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((9*math.e**((4*i*math.pi)/45))/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 19 x-5| =\\frac{160}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{125}{133}\\right\\},\\left\\{x\\to \\frac{195}{133}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(19*x-5), (160/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $12 x^2+x-3$", + "Output Answer": [ + "$12 \\left(x+\\frac{1}{24}\\right)^2-\\frac{145}{48}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (12*x**2+x-3), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$7 x-\\frac{77 y}{5}-\\frac{118 z}{5}-\\frac{113}{5}=0$, $\\frac{78 x}{5}-\\frac{68 y}{5}+\\frac{4 z}{5}+\\frac{89}{5}=0$, $-\\frac{29 x}{5}-\\frac{114 y}{5}+\\frac{77 z}{5}+\\frac{118}{5}=0$", + "Output Answer": [ + "$x=-\\frac{427291}{528682}$, $y=\\frac{158503}{528682}$, $z=-\\frac{105207}{75526}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((7*x-((77*y)/5)-((118*z)/5)-(113/5), ((78*x)/5)-((68*y)/5)+((4*z)/5)+(89/5), -((29*x)/5)-((114*y)/5)+((77*z)/5)+(118/5))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$14 x+20 y+24=0$, $6 x-17 y+24=0$", + "Output Answer": [ + "$x=-\\frac{444}{179}$, $y=\\frac{96}{179}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((14*x+20*y+24, 6*x-17*y+24), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 8 x^2-25 x+23\\right| =-22$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(8*x**2-25*x+23), -22), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((((19+3)-2)+15)-6)-(21-17)$.", + "Output Answer": [ + "$25$" + ], + "Output Program": [ + "try: \n print(((((19+3)-2)+15)-6)-(21-17))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x-7}+\\sqrt{4 x+12}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 2 \\left(86-33 \\sqrt{6}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x-7)+sqrt(4*x+12), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-x^2-3 x+4 y^2+10 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(y+\\frac{5}{4}\\right)^2-\\left(x+\\frac{3}{2}\\right)^2=5$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{2} & -\\frac{15}{4} \\\\\n -\\frac{3}{2} & \\frac{5}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{5}$\nCenter: $\\left\\{-\\frac{3}{2},-\\frac{5}{4}\\right\\}$\nAsymptotes: $\\left\\{y=-\\frac{x}{2}-2,y=\\frac{x}{2}-\\frac{1}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-x**2-3*x+4*y**2+10*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x-9}+\\sqrt{4 x-3}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(227-14 \\sqrt{97}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x-9)+sqrt(4*x-3), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$4 x-5 y+23 z-15=0$, $-20 x+13 y+21 z+24=0$, $-19 x-19 y+13 z-15=0$", + "Output Answer": [ + "$x=\\frac{949}{1449}$, $y=-\\frac{7327}{5796}$, $z=\\frac{509}{1932}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((4*x-5*y+23*z-15, -20*x+13*y+21*z+24, -19*x-19*y+13*z-15)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{20}{3}+\\frac{26 i}{3}$ and $y=\\frac{2}{3}+\\frac{i}{3}$", + "Output Answer": [ + "$\\frac{66}{5}+\\frac{32 i}{5}$" + ], + "Output Program": [ + "i = 1j\nx = (20/3)+((26*i)/3)\ny = (2/3)+(i/3)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{11 x}{\\sqrt{3}}+\\frac{7 y}{\\sqrt{3}}+\\frac{14}{\\sqrt{3}}=0$, $-\\frac{23 x}{\\sqrt{3}}-\\frac{29 y}{\\sqrt{3}}+8 \\sqrt{3}=0$", + "Output Answer": [ + "$x=-\\frac{287}{79}$, $y=\\frac{293}{79}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((11*x)/(sqrt(3)))+((7*y)/(sqrt(3)))+(14/(sqrt(3))), -((23*x)/(sqrt(3)))-((29*y)/(sqrt(3)))+8*sqrt(3)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2-5 x-10 y^2-y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x-\\frac{5}{6}\\right)^2-10 \\left(y+\\frac{1}{20}\\right)^2=\\frac{1327}{120}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{6}-\\frac{\\sqrt{17251}}{60} & -\\frac{1}{20} \\\\\n \\frac{1}{60} \\left(50+\\sqrt{17251}\\right) & -\\frac{1}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{13}{10}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{5}{6}-\\frac{\\sqrt{17251}}{60}+\\frac{1}{60} \\left(50+\\sqrt{17251}\\right)\\right),-\\frac{1}{20}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{3}{10}} x+\\frac{1}{60} \\left(-3-5 \\sqrt{30}\\right),y=\\frac{1}{60} \\left(5 \\sqrt{30}-3\\right)-\\sqrt{\\frac{3}{10}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2-5*x-10*y**2-y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{11 e^{\\frac{19 i \\pi }{60}}}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\frac{11}{\\sqrt{3}}$\nArgument: $\\frac{19 \\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((11*math.e**((19*i*math.pi)/60))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $5 \\sqrt{3} x^2+2 \\sqrt{3} x+3 \\sqrt{3}$", + "Output Answer": [ + "$x=\\frac{1}{5} \\left(-1-i \\sqrt{14}\\right)\\lor x=\\frac{1}{5} \\left(-1+i \\sqrt{14}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(5*sqrt(3)*x**2+2*sqrt(3)*x+3*sqrt(3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $5 \\sqrt{2} x^2+4 \\sqrt{2}$", + "Output Answer": [ + "$5 \\sqrt{2} x^2+4 \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (5*math.sqrt(2)*x**2+4*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{8+13 i}{\\sqrt{2}}$ and $y=\\frac{8+i}{\\sqrt{2}}$", + "Output Answer": [ + "$-\\frac{51}{2}-56 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((8+13*i)/(math.sqrt(2)))\ny = ((8+i)/(math.sqrt(2)))\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{17}{2}-\\frac{13 i}{2}$ and $y=\\frac{9}{2}+7 i$", + "Output Answer": [ + "$\\frac{29}{4}-\\frac{355 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = -(17/2)-((13*i)/2)\ny = (9/2)+7*i\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(25-12)^2-5}{2+5}$.", + "Output Answer": [ + "$\\frac{164}{7}$" + ], + "Output Program": [ + "try: \n print((((25-12)**2-5)/(2+5)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-12 x^2-72 \\sqrt{2} x+648$", + "Output Answer": [ + "$-12 \\left(-x-9 \\sqrt{2}\\right) \\left(3 \\sqrt{2}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-12*x**2-72*sqrt(2)*x+648, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -8 x^2-7 x+5$, $q(x) = 11 x^2-5 x-5$", + "Output Answer": [ + "$3 x^2-12 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**2-7*x+5\nq = 11*x**2-5*x-5\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{4}{11}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$1378$" + ], + "Output Program": [ + "a = -(4/11) # initial value\nd = 6 # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(4/11) # initial value\nd = 6 # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{20 x^2+\\frac{35 x}{2}-22}{\\frac{17 x^2}{2}+\\frac{15 x}{2}+18}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{80} \\left(-35-\\sqrt{8265}\\right)\\right\\},\\left\\{x\\to \\frac{1}{80} \\left(-35+\\sqrt{8265}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((20*x**2+((35*x)/2)-22)/(((17*x**2)/2)+((15*x)/2)+18)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^6+2 x^5+2 x^4-3 x^3-4 x^2-x$ and $-2 x^5-2 x^4-2 x^3+3 x^2+4 x+1$.", + "Output Answer": [ + "$2 x^5+2 x^4+2 x^3-3 x^2-4 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**6+2*x**5+2*x**4-3*x**3-4*x**2-x, -2*x**5-2*x**4-2*x**3+3*x**2+4*x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -13 x^2-6 x-11\\right| =13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{13} \\left(-3-\\sqrt{35}\\right)\\right\\},\\left\\{x\\to \\frac{1}{13} \\left(-3+\\sqrt{35}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-13*x**2-6*x-11), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\cos \\left(\\frac{3}{2}-8 x\\right)+\\tan \\left(7-\\frac{7 x}{2}\\right)$ at the point $x=2$", + "Output Answer": [ + "$\\cos \\left(\\frac{29}{2}\\right) = -0.355$" + ], + "Output Program": [ + "import math\n\nx = 2\ntry: \n f = math.cos((3/2)-8*x)+math.tan(7-((7*x)/2))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{78 x}{7}-\\frac{22}{7}\\right| =\\frac{145}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{41}{26}\\right\\},\\left\\{x\\to \\frac{167}{78}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((78*x)/7)-(22/7)), (145/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2+2 \\sqrt{5} x+60$", + "Output Answer": [ + "$2 \\left(3 \\sqrt{5}-x\\right) \\left(x+2 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2+2*sqrt(5)*x+60, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{9}{20}$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$\\frac{20691}{10}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(9/20) # initial value\nd = 9 # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(9/20) # initial value\nd = 9 # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{4 x^2}{\\pi }-\\frac{42 x}{\\pi }+\\frac{12}{\\pi }$ and $q(x) = -\\frac{15 x^2}{\\pi }+\\frac{45 x}{\\pi }+\\frac{3}{\\pi }$", + "Output Answer": [ + "$\\frac{60 x^4}{\\pi ^2}+\\frac{450 x^3}{\\pi ^2}-\\frac{2082 x^2}{\\pi ^2}+\\frac{414 x}{\\pi ^2}+\\frac{36}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((4*x**2)/pi)-((42*x)/pi)+(12/pi)\nq = -((15*x**2)/pi)+((45*x)/pi)+(3/pi)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2$ and $4 x-5$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2, 4*x-5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-9 x^2+11 x+10$", + "Output Answer": [ + "$\\frac{481}{36}-9 \\left(x-\\frac{11}{18}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-9*x**2+11*x+10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $x^2+5 x+8$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(-5-i \\sqrt{7}\\right)\\lor x=\\frac{1}{2} \\left(-5+i \\sqrt{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(x**2+5*x+8, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-7 x-6 y^2-10 y+10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x-\\frac{7}{10}\\right)^2-6 \\left(y+\\frac{5}{6}\\right)^2=-\\frac{703}{60}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{7}{10} & \\frac{1}{60} \\left(-50-\\sqrt{15466}\\right) \\\\\n \\frac{7}{10} & \\frac{1}{60} \\left(\\sqrt{15466}-50\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{11}{5}}$\nCenter: $\\left\\{\\frac{7}{10},\\frac{1}{2} \\left(\\frac{1}{60} \\left(-50-\\sqrt{15466}\\right)+\\frac{1}{60} \\left(\\sqrt{15466}-50\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{60} \\left(7 \\sqrt{30}-50\\right)-\\sqrt{\\frac{5}{6}} x,y=\\sqrt{\\frac{5}{6}} x+\\frac{1}{60} \\left(-50-7 \\sqrt{30}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-7*x-6*y**2-10*y+10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = x^2-14 x-4$, $q(x) = x^2-2 x+12$", + "Output Answer": [ + "$2 x^2-16 x+8$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**2-14*x-4\nq = x**2-2*x+12\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2+\\frac{63 x}{5}+\\frac{22116}{25}$", + "Output Answer": [ + "$3 \\left(\\frac{97}{5}-x\\right) \\left(x+\\frac{76}{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2+((63*x)/5)+(22116/25), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{49}{40}$, and $a_n=a_{n-1}+-7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$-\\frac{21203}{40}$" + ], + "Output Program": [ + "a = (49/40) # initial value\nd = -7 # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (49/40) # initial value\nd = -7 # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$x+25 y+4=0$, $-2 x+3 y-21=0$", + "Output Answer": [ + "$x=-\\frac{537}{53}$, $y=\\frac{13}{53}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((x+25*y+4, -2*x+3*y-21), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(((4+17)+23)-18)^2}{\\frac{1}{18} ((11+22)-19)}$.", + "Output Answer": [ + "$\\frac{6084}{7}$" + ], + "Output Program": [ + "try: \n print((((((4+17)+23)-18)**2)/((1/18)*((11+22)-19))))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{4 x}{3}-\\frac{13}{3}$ and $-\\frac{14 x}{3}-2$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((4*x)/3)-(13/3), -((14*x)/3)-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (4, \\frac{1}{3}, \\sqrt{3})$", + "Output Answer": [ + "$\\left\\{\\frac{2 \\sqrt{43}}{3},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{145}{3}}}{3}\\right),\\tan ^{-1}\\left(\\frac{1}{12}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 4\ny = (1/3)\nz = math.sqrt(3)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{33}{41}$, and $a_n=a_{n-1}+-12$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$-\\frac{135000}{41}$" + ], + "Output Program": [ + "a = (33/41) # initial value\nd = -12 # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (33/41) # initial value\nd = -12 # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{34 x^2}{3}-5 x+\\frac{14}{3}$ and $q(x) = -9 x^2-5 x+\\frac{32}{3}$", + "Output Answer": [ + "$-102 x^4-\\frac{35 x^3}{3}+\\frac{935 x^2}{9}-\\frac{230 x}{3}+\\frac{448}{9}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((34*x**2)/3)-5*x+(14/3)\nq = -9*x**2-5*x+(32/3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $11 x^2+12 x-\\frac{21}{2}$", + "Output Answer": [ + "$x=\\frac{1}{22} \\left(-12-\\sqrt{606}\\right)\\lor x=\\frac{1}{22} \\left(\\sqrt{606}-12\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(11*x**2+12*x-(21/2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{1147 x^2}{8}+\\frac{483 x}{2}-72}{-\\frac{527 x^2}{8}+\\frac{1661 x}{8}-\\frac{141}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{48}{37}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((1147*x**2)/8)+((483*x)/2)-72)/(-((527*x**2)/8)+((1661*x)/8)-(141/2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{23 x^2}{4}-\\frac{21 x}{2}-\\frac{55}{4}$", + "Output Answer": [ + "$x=\\frac{1}{23} \\left(-21-2 i \\sqrt{206}\\right)\\lor x=\\frac{1}{23} \\left(-21+2 i \\sqrt{206}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((23*x**2)/4)-((21*x)/2)-(55/4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{7 x}{2}-3}+\\sqrt{\\frac{27 x}{2}-\\frac{1}{2}}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{100} \\left(247-4 \\sqrt{1474}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((7*x)/2)-3)+sqrt(((27*x)/2)-(1/2)), 4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-21 x^2+2 x+20}{11 x^2+x-14}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{21} \\left(1-\\sqrt{421}\\right)\\right\\},\\left\\{x\\to \\frac{1}{21} \\left(1+\\sqrt{421}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-21*x**2+2*x+20)/(11*x**2+x-14)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{11 x^2-6 x-4}{\\sqrt{2}}$, $q(x) = \\frac{-x^2+9 x+8}{\\sqrt{2}}$", + "Output Answer": [ + "$5 \\sqrt{2} x^2-3 \\sqrt{2} x+\\frac{9 x}{\\sqrt{2}}+2 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((11*x**2-6*x-4)/(sqrt(2)))\nq = ((-x**2+9*x+8)/(sqrt(2)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-11 x^2-7 x-15$", + "Output Answer": [ + "$x=\\frac{1}{22} \\left(-7-i \\sqrt{611}\\right)\\lor x=\\frac{1}{22} \\left(-7+i \\sqrt{611}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-11*x**2-7*x-15, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{23}{5} \\left(\\cos \\left(\\frac{61}{90}\\right)+i \\sin \\left(\\frac{61}{90}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-\\frac{1801152661463 \\left(\\cos \\left(\\frac{61}{10}\\right)+i \\sin \\left(\\frac{61}{10}\\right)\\right)}{1953125}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(23/5)*(math.cos((61/90))+1j*math.sin((61/90))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x-5}+\\sqrt{14 x-1}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(89-6 \\sqrt{181}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x-5)+sqrt(14*x-1), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $10 x^7-18 x^6+8 x^5+2 x^4-2 x^3-12 x^2+20 x-8$ and $-5 x^5-x^4-x^3-2 x^2-2 x+4$.", + "Output Answer": [ + "$5 x^5+x^4+x^3+2 x^2+2 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(10*x**7-18*x**6+8*x**5+2*x**4-2*x**3-12*x**2+20*x-8, -5*x**5-x**4-x**3-2*x**2-2*x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=8 x-6$ at the point $x=-6$", + "Output Answer": [ + "$-54 = -54.$" + ], + "Output Program": [ + "x = -6\ntry: \n f = 8*x-6\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 2 x^2+\\frac{17 x}{4}-12$, $q(x) = \\frac{1}{4} \\left(-21 x^2-38 x-59\\right)$", + "Output Answer": [ + "$-\\frac{13 x^2}{4}-\\frac{21 x}{4}-\\frac{107}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**2+((17*x)/4)-12\nq = (1/4)*(-21*x**2-38*x-59)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $8 \\sqrt{3} x^2-4 \\sqrt{3} x-9 \\sqrt{3}$", + "Output Answer": [ + "$8 \\sqrt{3} \\left(x-\\frac{1}{4}\\right)^2-\\frac{19 \\sqrt{3}}{2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (8*math.sqrt(3)*x**2-4*math.sqrt(3)*x-9*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x-1$ and $-2 x^5-2 x^4+5 x^3+2 x+4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x-1, -2*x**5-2*x**4+5*x**3+2*x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-21 x-9 y+24=0$, $-17 x+5 y-2=0$", + "Output Answer": [ + "$x=\\frac{17}{43}$, $y=\\frac{75}{43}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-21*x-9*y+24, -17*x+5*y-2), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\sqrt{2} \\left(\\cos \\left(\\frac{\\pi }{18}\\right)-i \\sin \\left(\\frac{\\pi }{18}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$32768 \\left(\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*math.sqrt(2)*(math.cos((math.pi/18))-1j*math.sin((math.pi/18))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{61}{80}$, and $a_n=a_{n-1}+\\frac{37}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$\\frac{44739}{40}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(61/80) # initial value\nd = (37/5) # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(61/80) # initial value\nd = (37/5) # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(\\cos \\left(\\frac{13 \\pi }{90}\\right)+i \\sin \\left(\\frac{13 \\pi }{90}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$125 \\left(\\sin \\left(\\frac{\\pi }{15}\\right)+i \\cos \\left(\\frac{\\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(math.cos(((13*math.pi)/90))+1j*math.sin(((13*math.pi)/90))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+4 x-5 y^2-y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x+\\frac{2}{3}\\right)^2-5 \\left(y+\\frac{1}{10}\\right)^2=\\frac{557}{60}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{3}-\\frac{\\sqrt{1114}}{15} & -\\frac{1}{10} \\\\\n \\frac{1}{15} \\left(\\sqrt{1114}-10\\right) & -\\frac{1}{10} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{2}{3}-\\frac{\\sqrt{1114}}{15}+\\frac{1}{15} \\left(\\sqrt{1114}-10\\right)\\right),-\\frac{1}{10}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{3}{5}} x+\\frac{1}{30} \\left(4 \\sqrt{15}-3\\right),y=\\frac{1}{30} \\left(-3-4 \\sqrt{15}\\right)-\\sqrt{\\frac{3}{5}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+4*x-5*y**2-y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{32 x}{\\sqrt{3}}+\\frac{40 y}{\\sqrt{3}}+12 \\sqrt{3}=0$, $-\\frac{16 x}{\\sqrt{3}}-\\sqrt{3} y+14 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{447}{136}$, $y=-\\frac{60}{17}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((32*x)/(sqrt(3)))+((40*y)/(sqrt(3)))+12*sqrt(3), -((16*x)/(sqrt(3)))-sqrt(3)*y+14*sqrt(3)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{7}{2} \\left(-\\sin \\left(\\frac{7 \\pi }{30}\\right)-i \\cos \\left(\\frac{7 \\pi }{30}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-\\frac{343}{8} \\left(\\frac{1}{4} \\left(1+\\sqrt{5}\\right)-i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(7/2)*(-math.sin(((7*math.pi)/30))-1j*math.cos(((7*math.pi)/30))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\sqrt{2} \\left(\\cos \\left(\\frac{\\pi }{9}\\right)+i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$12500 \\sqrt{2} \\left(-\\sin \\left(\\frac{\\pi }{18}\\right)+i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*math.sqrt(2)*(math.cos((math.pi/9))+1j*math.sin((math.pi/9))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{6}{13}$, and $a_n=a_{n-1}+-\\frac{16}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{27}{2} \\left(-\\frac{12}{13}-\\frac{416}{\\sqrt{5}}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(6/13) # initial value\nd = -(16/(math.sqrt(5))) # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(6/13) # initial value\nd = -(16/(math.sqrt(5))) # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^6-10 x^5+3 x^4-8 x^3-7 x^2+8 x-9$ when divided by $-x^3-8 x^2+9 x-7$.", + "Output Answer": [ + "$5 x^3-30 x^2+282 x-2553$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**6-10*x**5+3*x**4-8*x**3-7*x**2+8*x-9\nq = -x**3-8*x**2+9*x-7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{4}, 3, \\frac{1}{4})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{\\frac{73}{2}}}{2},\\tan ^{-1}\\left(\\sqrt{145}\\right),\\tan ^{-1}(12)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/4)\ny = 3\nz = (1/4)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left((6-1)^2+16\\right)-6\\right) ((16-12)+9)$.", + "Output Answer": [ + "$455$" + ], + "Output Program": [ + "try: \n print((((6-1)**2+16)-6)*((16-12)+9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-2 x^2-7 x+6}{-24 x^2-11 x-2}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-7-\\sqrt{97}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(-7+\\sqrt{97}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-2*x**2-7*x+6)/(-24*x**2-11*x-2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $1-4 x$ and $4 x^3-x^2-x-4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(1-4*x, 4*x**3-x**2-x-4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x-2$ and $3-2 x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x-2, 3-2*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2+24 x-\\frac{25}{2}$", + "Output Answer": [ + "$2 \\left(-x-\\frac{25}{2}\\right) \\left(\\frac{1}{2}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2+24*x-(25/2), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{26 x}{7}+\\frac{51 y}{7}-19=0$, $-\\frac{50 x}{7}-21 y-\\frac{132}{7}=0$", + "Output Answer": [ + "$x=\\frac{8761}{424}$, $y=-\\frac{5041}{636}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((26*x)/7)+((51*y)/7)-19, -((50*x)/7)-21*y-(132/7)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-18 \\left(-32 t^2+8 \\left(\\sqrt{2}-22\\right) t+22 \\sqrt{2}-243\\right), x(t)=-4 \\sqrt{2} t-11 \\sqrt{2}$", + "Output Answer": [ + "$y=18 x^2+36 x+18$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -18*(-32*t**2+8*(sqrt(2)-22)*t+22*sqrt(2)-243)\nx_t = -4*sqrt(2)*t-11*sqrt(2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 9 x-2| =15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{13}{9}\\right\\},\\left\\{x\\to \\frac{17}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(9*x-2), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((21-22)-9)+((1-3)-6)$.", + "Output Answer": [ + "$-18$" + ], + "Output Program": [ + "try: \n print(((21-22)-9)+((1-3)-6))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{5 x^2}{\\sqrt{3}}-\\frac{20 x}{\\sqrt{3}}+\\frac{11}{\\sqrt{3}}$ and $q(x) = -6 \\sqrt{3} x^2+\\frac{11 x}{\\sqrt{3}}-4 \\sqrt{3}$", + "Output Answer": [ + "$-30 x^4+\\frac{415 x^3}{3}-\\frac{478 x^2}{3}+\\frac{361 x}{3}-44$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((5*x**2)/(sqrt(3)))-((20*x)/(sqrt(3)))+(11/(sqrt(3)))\nq = -6*sqrt(3)*x**2+((11*x)/(sqrt(3)))-4*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-90 x^3-207 x^2-243 x-126}{-18 x^2-72 x-54}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-90*x**3-207*x**2-243*x-126)/(-18*x**2-72*x-54)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-x^6-3 x^5+2 x^4+6 x^3-3 x^2-8 x-3$ and $x^5+2 x^4-4 x^3-2 x^2+5 x+3$.", + "Output Answer": [ + "$x^5+2 x^4-4 x^3-2 x^2+5 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-x**6-3*x**5+2*x**4+6*x**3-3*x**2-8*x-3, x**5+2*x**4-4*x**3-2*x**2+5*x+3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{13+8 i}{\\sqrt{2}}$ and $y=-\\frac{7+8 i}{\\sqrt{2}}$", + "Output Answer": [ + "$-\\frac{155}{113}+\\frac{48 i}{113}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((13+8*i)/(math.sqrt(2)))\ny = -((7+8*i)/(math.sqrt(2)))\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{1}{2}+\\frac{13 i}{2}$ and $y=-\\frac{1}{2}-\\frac{11 i}{2}$", + "Output Answer": [ + "$i$" + ], + "Output Program": [ + "i = 1j\nx = (1/2)+((13*i)/2)\ny = -(1/2)-((11*i)/2)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\sqrt{3} \\left(\\frac{\\sqrt{3}}{2}+\\frac{i}{2}\\right)\\right)^5$", + "Output Answer": [ + "$28125 \\sqrt{3} \\left(-\\frac{\\sqrt{3}}{2}+\\frac{i}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*math.sqrt(3)*(((math.sqrt(3))/2)+(i/2)))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{34 x^2}{3}+\\frac{16 x}{3}+\\frac{19}{3}$ and $q(x) = 7 x^2+\\frac{44 x}{3}-10$", + "Output Answer": [ + "$-\\frac{238 x^4}{3}-\\frac{1160 x^3}{9}+\\frac{2123 x^2}{9}+\\frac{356 x}{9}-\\frac{190}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((34*x**2)/3)+((16*x)/3)+(19/3)\nq = 7*x**2+((44*x)/3)-10\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-6 \\sqrt{2} x-17 \\sqrt{2} y+14 \\sqrt{2}=0$, $7 \\sqrt{2} x-11 \\sqrt{2} y-13 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{75}{37}$, $y=\\frac{4}{37}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-6*sqrt(2)*x-17*sqrt(2)*y+14*sqrt(2), 7*sqrt(2)*x-11*sqrt(2)*y-13*sqrt(2)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{52}{85}$, and $a_n=a_{n-1}+2$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$\\frac{19568}{85}$" + ], + "Output Program": [ + "a = -(52/85) # initial value\nd = 2 # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(52/85) # initial value\nd = 2 # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2+45 \\sqrt{5} x+1080$", + "Output Answer": [ + "$9 \\left(-x-3 \\sqrt{5}\\right) \\left(x-8 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2+45*sqrt(5)*x+1080, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\cos (8) \\tan (\\log (7 x+7))=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{7} \\left(-7+e^{\\pi c_1}\\right)\\text{ if }c_1\\in \\mathbb{Z}\\land -\\pi <\\pi \\Im(c_1)\\leq \\pi $}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(cos(8)*tan(log(7*x+7)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $7 x^3-77 x^2-679 x-595$", + "Output Answer": [ + "$7 (-x-5) (-x-1) (x-17)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(7*x**3-77*x**2-679*x-595, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -25 x-\\frac{11}{2}\\right| =-21$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-25*x-(11/2)), -21), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{4 x^2}{\\pi }+\\frac{19 x}{\\pi }+\\frac{31}{\\pi }$ and $q(x) = -\\frac{19 x^2}{\\pi }+\\frac{43 x}{\\pi }-\\frac{4}{\\pi }$", + "Output Answer": [ + "$\\frac{76 x^4}{\\pi ^2}-\\frac{533 x^3}{\\pi ^2}+\\frac{244 x^2}{\\pi ^2}+\\frac{1257 x}{\\pi ^2}-\\frac{124}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((4*x**2)/pi)+((19*x)/pi)+(31/pi)\nq = -((19*x**2)/pi)+((43*x)/pi)-(4/pi)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^4+6 x^3+x^2-3 x+1$ when divided by $-8 x^3+2 x^2+8 x-8$.", + "Output Answer": [ + "$x-\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**4+6*x**3+x**2-3*x+1\nq = -8*x**3+2*x**2+8*x-8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\frac{\\frac{12}{24}}{25}+8\\right)-25\\right) (10-11)^2$.", + "Output Answer": [ + "$-\\frac{849}{50}$" + ], + "Output Program": [ + "try: \n print(((((12/24)/25)+8)-25)*(10-11)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{16 x^2}{\\sqrt{3}}-7 \\sqrt{3} x+\\frac{19}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{32} \\sqrt{3} \\left(7 \\sqrt{3}-5 i \\sqrt{\\frac{31}{3}}\\right)\\lor x=\\frac{1}{32} \\sqrt{3} \\left(7 \\sqrt{3}+5 i \\sqrt{\\frac{31}{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((16*x**2)/(sqrt(3)))-7*sqrt(3)*x+(19/(sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{49} (31-46 x)^2, q(x) = -\\frac{16 x}{7}-6$", + "Output Answer": [ + "$\\frac{2116 x^2}{49}-\\frac{2964 x}{49}+\\frac{667}{49}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/49)*(31-46*x)**2\nq = -((16*x)/7)-6\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{7367 x^2}{49}+\\frac{14524 x}{49}-\\frac{3420}{49}}{\\frac{10981 x}{49}-\\frac{3002}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{90}{53}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((7367*x**2)/49)+((14524*x)/49)-(3420/49))/(((10981*x)/49)-(3002/49))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{5 x^2}{e}+\\frac{17 x}{e}+\\frac{16}{e}$ and $q(x) = -\\frac{6 x^2}{e}-\\frac{13 x}{e}-\\frac{32}{e}$", + "Output Answer": [ + "$\\frac{30 x^4}{e^2}-\\frac{37 x^3}{e^2}-\\frac{157 x^2}{e^2}-\\frac{752 x}{e^2}-\\frac{512}{e^2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -((5*x**2)/math.e)+((17*x)/math.e)+(16/math.e)\nq = -((6*x**2)/math.e)-((13*x)/math.e)-(32/math.e)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=5+9 i$ and $y=-3+8 i$", + "Output Answer": [ + "$8+i$" + ], + "Output Program": [ + "i = 1j\nx = 5+9*i\ny = -3+8*i\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-14 \\log (2) \\left(-\\sin \\left(\\frac{19 \\pi }{180}\\right)+i \\cos \\left(\\frac{19 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $14 \\log (2) \\sqrt{\\sin ^2\\left(\\frac{19 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{19 \\pi }{180}\\right)}$\nArgument: $-\\frac{71 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -14*math.log(2)*(-math.sin(((19*math.pi)/180))+i*math.cos(((19*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{121}+\\left(\\sqrt{78}+\\sqrt{71}\\right)$.", + "Output Answer": [ + "$11+\\sqrt{71}+\\sqrt{78}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(121)+(sqrt(78)+sqrt(71)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$5 \\sqrt{5} x-4 \\sqrt{5} y+6 \\sqrt{5} z-4 \\sqrt{5}=0$, $\\sqrt{5} x-9 \\sqrt{5} y+5 \\sqrt{5} z+10 \\sqrt{5}=0$, $-10 \\sqrt{5} x+2 \\sqrt{5} y+10 \\sqrt{5} z+3 \\sqrt{5}=0$", + "Output Answer": [ + "$x=\\frac{511}{394}$, $y=\\frac{1283}{788}$, $z=\\frac{529}{788}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((5*sqrt(5)*x-4*sqrt(5)*y+6*sqrt(5)*z-4*sqrt(5), sqrt(5)*x-9*sqrt(5)*y+5*sqrt(5)*z+10*sqrt(5), -10*sqrt(5)*x+2*sqrt(5)*y+10*sqrt(5)*z+3*sqrt(5))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^6-2 x^5+7 x^4-9 x^3+6 x^2+5 x-4$ when divided by $2 x^5-7 x^4+6 x^2+x+8$.", + "Output Answer": [ + "$4 x+13$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**6-2*x**5+7*x**4-9*x**3+6*x**2+5*x-4\nq = 2*x**5-7*x**4+6*x**2+x+8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\sqrt{2} x^2-3 \\sqrt{2} x+\\frac{3}{\\sqrt{2}}$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(\\sqrt{15}-3\\right)\\lor x=\\frac{1}{2} \\left(-3-\\sqrt{15}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-sqrt(2)*x**2-3*sqrt(2)*x+(3/(sqrt(2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{32 x}{7}-\\frac{48}{7}}+\\sqrt{\\frac{45 x}{7}-2}=\\frac{45}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{152831-360 \\sqrt{172513}}{1183}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((32*x)/7)-(48/7))+sqrt(((45*x)/7)-2), (45/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 x^2-6 x+4$ and $q(x) = 14 x^2-14 x+5$", + "Output Answer": [ + "$-70 x^4-14 x^3+115 x^2-86 x+20$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -5*x**2-6*x+4\nq = 14*x**2-14*x+5\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 17 x^2+17 x+14\\right| =-10$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(17*x**2+17*x+14), -10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\cos \\left(\\frac{31}{45}\\right)+i \\sin \\left(\\frac{31}{45}\\right)\\right)^12$", + "Output Answer": [ + "$\\cos \\left(\\frac{124}{15}\\right)+i \\sin \\left(\\frac{124}{15}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.cos((31/45))+1j*math.sin((31/45)))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2-7 x+10 y^2+5 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $3 \\left(x-\\frac{7}{6}\\right)^2+10 \\left(y+\\frac{1}{4}\\right)^2=\\frac{353}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{60} \\left(70-\\sqrt{12355}\\right) & -\\frac{1}{4} \\\\\n \\frac{1}{60} \\left(70+\\sqrt{12355}\\right) & -\\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{10}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{60} \\left(70-\\sqrt{12355}\\right)+\\frac{1}{60} \\left(70+\\sqrt{12355}\\right)\\right),-\\frac{1}{4}\\right\\}$\nArea Enclosed: $\\frac{353 \\pi }{24 \\sqrt{30}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2-7*x+10*y**2+5*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $3 x^2-10 x+7$", + "Output Answer": [ + "$x=\\frac{7}{3}\\lor x=1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(3*x**2-10*x+7, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{5} \\left(24 x^2-13 x+8\\right)$, $q(x) = \\frac{54 x^2}{5}-9 x-\\frac{48}{5}$", + "Output Answer": [ + "$\\frac{78 x^2}{5}-\\frac{58 x}{5}-8$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/5)*(24*x**2-13*x+8)\nq = ((54*x**2)/5)-9*x-(48/5)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(5+4 i) \\sqrt{3}$ and $y=5 \\sqrt{3}$", + "Output Answer": [ + "$(10+4 i) \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (5+4*i)*math.sqrt(3)\ny = 5*math.sqrt(3)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\sqrt{3} \\left(\\cos \\left(\\frac{131}{90}\\right)+i \\sin \\left(\\frac{131}{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$-288 \\sqrt{3} \\left(\\cos \\left(\\frac{131}{18}\\right)+i \\sin \\left(\\frac{131}{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*math.sqrt(3)*(math.cos((131/90))+1j*math.sin((131/90))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (2 x-9)^3, q(x) = 8 (x-1)^3$", + "Output Answer": [ + "$16 x^3-132 x^2+510 x-737$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (2*x-9)**3\nq = 8*(x-1)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{13+23}{2} (6-3)$.", + "Output Answer": [ + "$54$" + ], + "Output Program": [ + "try: \n print(((13+23)/2)*(6-3))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{25-3 i}{e}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{634}}{e}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{3}{25}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((25-3*i)/math.e)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-x^4-3 x^3+8 x^2-x-7$ when divided by $-x^4-4 x^3-2 x^2+6 x+1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**4-3*x**3+8*x**2-x-7\nq = -x**4-4*x**3-2*x**2+6*x+1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{8 \\left(\\cos \\left(\\frac{\\pi }{30}\\right)-i \\sin \\left(\\frac{\\pi }{30}\\right)\\right)}{\\sqrt{3}}\\right)^6$", + "Output Answer": [ + "$\\frac{262144}{27} \\left(\\frac{1}{4} \\left(1+\\sqrt{5}\\right)-i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((8*(math.cos((math.pi/30))-1j*math.sin((math.pi/30))))/(math.sqrt(3))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+6 x+8 y^2+2 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $9 \\left(x+\\frac{1}{3}\\right)^2+8 \\left(y+\\frac{1}{8}\\right)^2=\\frac{41}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{3} & \\frac{1}{24} \\left(-3-\\sqrt{41}\\right) \\\\\n -\\frac{1}{3} & \\frac{1}{24} \\left(\\sqrt{41}-3\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{3}$\nCenter: $\\left\\{-\\frac{1}{3},\\frac{1}{2} \\left(\\frac{1}{24} \\left(-3-\\sqrt{41}\\right)+\\frac{1}{24} \\left(\\sqrt{41}-3\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{41 \\pi }{48 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+6*x+8*y**2+2*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-6 x^2+5 x-1$ and $1-3 x$.", + "Output Answer": [ + "$3 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-6*x**2+5*x-1, 1-3*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{1296 x^2}{25}+\\frac{3456 x}{25}-\\frac{212}{5}}{\\frac{684 x^2}{5}+\\frac{7334 x}{25}-\\frac{8056}{25}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5}{18}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((1296*x**2)/25)+((3456*x)/25)-(212/5))/(((684*x**2)/5)+((7334*x)/25)-(8056/25))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-7 x^2-119 x-210$", + "Output Answer": [ + "$-7 (-x-15) (-x-2)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-7*x**2-119*x-210, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^5+2 x^4-8 x^3-2 x^2+2 x-8$ when divided by $7 x^4+2 x^3-4 x^2-5 x+3$.", + "Output Answer": [ + "$\\frac{22}{49}-\\frac{4 x}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**5+2*x**4-8*x**3-2*x**2+2*x-8\nq = 7*x**4+2*x**3-4*x**2-5*x+3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-5+4 i$ and $y=-3-2 i$", + "Output Answer": [ + "$-8+2 i$" + ], + "Output Program": [ + "i = 1j\nx = -5+4*i\ny = -3-2*i\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{7 x^2}{5}-\\frac{16 x}{5}$ and $\\frac{17 x^3}{5}-\\frac{23 x^2}{5}+\\frac{3 x}{5}+\\frac{3}{5}$.", + "Output Answer": [ + "$\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((7*x**2)/5)-((16*x)/5), ((17*x**3)/5)-((23*x**2)/5)+((3*x)/5)+(3/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{6-4}{(15-20)+11}$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "try: \n print(((6-4)/((15-20)+11)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-8 x^2+\\frac{19 x}{4}+\\frac{19}{4}$", + "Output Answer": [ + "$x=\\frac{1}{64} \\left(19-7 \\sqrt{57}\\right)\\lor x=\\frac{1}{64} \\left(19+7 \\sqrt{57}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-8*x**2+((19*x)/4)+(19/4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $6 x^2-48 x-390$", + "Output Answer": [ + "$6 (-x-5) (13-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(6*x**2-48*x-390, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{8}{3}+\\frac{26 i}{3}$ and $y=-7-\\frac{19 i}{3}$", + "Output Answer": [ + "$\\frac{29}{3}+15 i$" + ], + "Output Program": [ + "i = 1j\nx = (8/3)+((26*i)/3)\ny = -7-((19*i)/3)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^2-x+9$ when divided by $\\frac{5 x}{2}-\\frac{17}{2}$.", + "Output Answer": [ + "$\\frac{6 x}{5}+\\frac{92}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**2-x+9\nq = ((5*x)/2)-(17/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the fifth order series of the inverse of the following function around 5:\n$e^{-3 x^4}$", + "Output Answer": [ + "$-\\frac{(-1)^{3/4} \\sqrt[4]{x-1}}{\\sqrt[4]{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, math.e**(-3*x**4))\nprint(solve(f, x)[0].series(y, 5, 5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^5+7 x^4+7 x^3-3 x^2-1$ when divided by $-6 x^4+8 x^3+7 x^2+x$.", + "Output Answer": [ + "$\\frac{3 x}{2}+\\frac{5}{6}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**5+7*x**4+7*x**3-3*x**2-1\nq = -6*x**4+8*x**3+7*x**2+x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-10 x-9$ when divided by $-9 x-1$.", + "Output Answer": [ + "$\\frac{10}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -10*x-9\nq = -9*x-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{5 x^2}{\\sqrt{\\pi }}+\\frac{16 x}{\\sqrt{\\pi }}-\\frac{7}{\\sqrt{\\pi }}$ and $q(x) = \\frac{24 x^2}{\\sqrt{\\pi }}-\\frac{8 x}{\\sqrt{\\pi }}+\\frac{1}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{120 x^4}{\\pi }+\\frac{344 x^3}{\\pi }-\\frac{291 x^2}{\\pi }+\\frac{72 x}{\\pi }-\\frac{7}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((5*x**2)/(sqrt(pi)))+((16*x)/(sqrt(pi)))-(7/(sqrt(pi)))\nq = ((24*x**2)/(sqrt(pi)))-((8*x)/(sqrt(pi)))+(1/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 e x^2+3 e x-3 e$ and $q(x) = 3 e x^2+3 e x-e$", + "Output Answer": [ + "$12 e^2 x^4+21 e^2 x^3-4 e^2 x^2-12 e^2 x+3 e^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = 4*math.e*x**2+3*math.e*x-3*math.e\nq = 3*math.e*x**2+3*math.e*x-math.e\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2 e^{\\frac{4 i \\pi }{5}} \\pi$.", + "Output Answer": [ + "Norm: $2 \\pi$\nArgument: $\\frac{4 \\pi }{5}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2*math.e**((4*i*math.pi)/5)*math.pi\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -(x+8)^3, q(x) = 5-x$", + "Output Answer": [ + "$-x^3-24 x^2-193 x-507$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(x+8)**3\nq = 5-x\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-10 x-1}+\\sqrt{-5 x-12}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(-577+84 \\sqrt{41}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-10*x-1)+sqrt(-5*x-12), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^4+8 x^3+9 x^2+4 x+1$ when divided by $5 x^2+9 x-4$.", + "Output Answer": [ + "$\\frac{9 x^2}{5}-\\frac{41 x}{25}+\\frac{774}{125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**4+8*x**3+9*x**2+4*x+1\nq = 5*x**2+9*x-4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-6 x-10 y^2+4 y+9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x-\\frac{3}{5}\\right)^2-10 \\left(y-\\frac{1}{5}\\right)^2=-\\frac{38}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{5} & \\frac{1}{5} \\left(1-\\sqrt{57}\\right) \\\\\n \\frac{3}{5} & \\frac{1}{5} \\left(1+\\sqrt{57}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{3}$\nCenter: $\\left\\{\\frac{3}{5},\\frac{1}{2} \\left(\\frac{1}{5} \\left(1-\\sqrt{57}\\right)+\\frac{1}{5} \\left(1+\\sqrt{57}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{10} \\left(2+3 \\sqrt{2}\\right)-\\frac{x}{\\sqrt{2}},y=\\frac{x}{\\sqrt{2}}+\\frac{1}{10} \\left(2-3 \\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-6*x-10*y**2+4*y+9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^5-7 x^4+4 x^3-7 x^2-8 x+5$ when divided by $-2 x^3-6 x^2-9 x+8$.", + "Output Answer": [ + "$-4 x^2+\\frac{31 x}{2}-\\frac{61}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**5-7*x**4+4*x**3-7*x**2-8*x+5\nq = -2*x**3-6*x**2-9*x+8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{37 x^2}{3}-5 x+\\frac{10}{3}$ and $q(x) = 9 x^2+2 x+5$", + "Output Answer": [ + "$111 x^4-\\frac{61 x^3}{3}+\\frac{245 x^2}{3}-\\frac{55 x}{3}+\\frac{50}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((37*x**2)/3)-5*x+(10/3)\nq = 9*x**2+2*x+5\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 x^2-2 x-10$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(-1-i \\sqrt{59}\\right)\\lor x=\\frac{1}{6} \\left(-1+i \\sqrt{59}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*x**2-2*x-10, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $3 x^2-42 \\sqrt{3} x+297$", + "Output Answer": [ + "$-3 \\left(11 \\sqrt{3}-x\\right) \\left(x-3 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(3*x**2-42*sqrt(3)*x+297, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+5 x+6 y^2+7 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x+\\frac{5}{8}\\right)^2+6 \\left(y+\\frac{7}{12}\\right)^2=\\frac{365}{48}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{8}-\\frac{\\sqrt{365}}{24} & -\\frac{7}{12} \\\\\n \\frac{1}{24} \\left(\\sqrt{365}-15\\right) & -\\frac{7}{12} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{5}{8}-\\frac{\\sqrt{365}}{24}+\\frac{1}{24} \\left(\\sqrt{365}-15\\right)\\right),-\\frac{7}{12}\\right\\}$\nArea Enclosed: $\\frac{365 \\pi }{96 \\sqrt{6}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+5*x+6*y**2+7*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 20 x-14| =7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7}{20}\\right\\},\\left\\{x\\to \\frac{21}{20}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(20*x-14), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2+96 x+\\frac{1376}{49}$", + "Output Answer": [ + "$8 \\left(\\frac{86}{7}-x\\right) \\left(x+\\frac{2}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2+96*x+(1376/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-9-i$ and $y=9-9 i$", + "Output Answer": [ + "$-90+72 i$" + ], + "Output Program": [ + "i = 1j\nx = -9-i\ny = 9-9*i\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=1$, and $a_n=a_{n-1}+-3 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$\\frac{19}{2} (2-54 \\pi )$" + ], + "Output Program": [ + "import math\n\na = 1 # initial value\nd = -3*math.pi # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 1 # initial value\nd = -3*math.pi # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x-10}+\\sqrt{x+9}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{715}{49}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x-10)+sqrt(x+9), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-23 x-y+20=0$, $-9 x+2 y-19=0$", + "Output Answer": [ + "$x=\\frac{21}{55}$, $y=\\frac{617}{55}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-23*x-y+20, -9*x+2*y-19), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sinh (8 x+2)-\\cos \\left(8 x^3+9\\right)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sinh(8*x+2)-cos(8*x**3+9)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $6-2 x^2=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\sqrt{3}\\right\\},\\left\\{x\\to \\sqrt{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(6-2*x**2, x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{67}{91}$, and $a_n=a_{n-1}+-\\frac{39}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$-\\frac{61912}{91}$" + ], + "Output Program": [ + "a = -(67/91) # initial value\nd = -(39/7) # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(67/91) # initial value\nd = -(39/7) # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\pi x^2-2 \\pi$ and $q(x) = -3 \\pi x^2+3 \\pi x+2 \\pi$", + "Output Answer": [ + "$3 \\pi ^2 x^4-3 \\pi ^2 x^3+4 \\pi ^2 x^2-6 \\pi ^2 x-4 \\pi ^2$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -pi*x**2-2*pi\nq = -3*pi*x**2+3*pi*x+2*pi\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$18 x+22 y-11 z+8=0$, $17 x+23 y-13=0$, $-13 x-23 y+5 z+7=0$", + "Output Answer": [ + "$x=-\\frac{208}{303}$, $y=\\frac{325}{303}$, $z=\\frac{530}{303}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((18*x+22*y-11*z+8, 17*x+23*y-13, -13*x-23*y+5*z+7)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{1}{2}-x}+\\frac{5 \\sqrt{-x}}{\\sqrt{2}}=\\frac{13}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-4609+1040 \\sqrt{6}}{1058}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((1/2)-x)+((5*sqrt(-x))/(sqrt(2))), (13/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 2 x-16| =-5$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(2*x-16), -5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{63 x^2}{5}+\\frac{49 x}{5}+\\frac{27}{5}$", + "Output Answer": [ + "$\\frac{63}{5} \\left(x+\\frac{7}{18}\\right)^2+\\frac{629}{180}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((63*x**2)/5)+((49*x)/5)+(27/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 x^2+2 x+15$ and $q(x) = 6 x^2+12 x+6$", + "Output Answer": [ + "$12 x^4+36 x^3+126 x^2+192 x+90$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*x**2+2*x+15\nq = 6*x**2+12*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(7+16)-((8+25)-20)$.", + "Output Answer": [ + "$10$" + ], + "Output Program": [ + "try: \n print((7+16)-((8+25)-20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{69 x}{4}+\\frac{5}{2}\\right| =\\frac{43}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{32}{23}\\right\\},\\left\\{x\\to \\frac{76}{69}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((69*x)/4)+(5/2)), (43/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-54 t-\\frac{1}{\\sqrt{2}}-\\frac{189}{2}, x(t)=-6 \\sqrt{2} t-\\frac{21}{\\sqrt{2}}$", + "Output Answer": [ + "$y=\\frac{9 x}{\\sqrt{2}}-\\frac{1}{\\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -54*t-(1/(sqrt(2)))-(189/2)\nx_t = -6*sqrt(2)*t-(21/(sqrt(2)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sin (4-4 x)$ at the point $x=5$", + "Output Answer": [ + "$-\\sin (16) = 0.288$" + ], + "Output Program": [ + "import math\n\nx = 5\ntry: \n f = math.sin(4-4*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{9 x^2-10 x-15}{14 x^2-8 x+8}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(5-4 \\sqrt{10}\\right)\\right\\},\\left\\{x\\to \\frac{1}{9} \\left(5+4 \\sqrt{10}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((9*x**2-10*x-15)/(14*x**2-8*x+8)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $-\\sin ^{-1}\\left(7-\\frac{17 x}{2}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{17} (2 \\sin (y)+14)\\text{ if }-\\frac{\\pi }{2}\\leq y\\leq \\frac{\\pi }{2}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, -asin(7-((17*x)/2)))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $3 x^3-132 x^2+1899 x-8910$", + "Output Answer": [ + "$-3 (11-x) (15-x) (18-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(3*x**3-132*x**2+1899*x-8910, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -8 x^2-4 x+6$, $q(x) = 12 x^2+12 x-11$", + "Output Answer": [ + "$4 x^2+8 x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**2-4*x+6\nq = 12*x**2+12*x-11\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 x^2+13 x$ and $q(x) = -3 x^2+4 x+10$", + "Output Answer": [ + "$-6 x^4-31 x^3+72 x^2+130 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*x**2+13*x\nq = -3*x**2+4*x+10\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sqrt[3]{\\log \\left(-\\frac{14 x}{3}-\\frac{13}{3}\\right)}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{14} \\left(-13-3 e^{y^3}\\right)\\text{ if }y\\in \\mathbb{R}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, cbrt(log(-((14*x)/3)-(13/3))))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{13}{15}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$-\\frac{286}{15}$" + ], + "Output Program": [ + "a = -(13/15) # initial value\nd = 0 # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(13/15) # initial value\nd = 0 # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 x^2+5 x-4$ and $q(x) = -x^2-9 x-1$", + "Output Answer": [ + "$-4 x^4-41 x^3-45 x^2+31 x+4$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*x**2+5*x-4\nq = -x**2-9*x-1\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{11 x^2}{2}+3 x+\\frac{9}{2}$", + "Output Answer": [ + "$x=\\frac{3}{11} \\left(1-2 \\sqrt{3}\\right)\\lor x=\\frac{3}{11} \\left(1+2 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((11*x**2)/2)+3*x+(9/2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -(2 x+9)^3, q(x) = (x-7)^4$", + "Output Answer": [ + "$x^4-36 x^3+186 x^2-1858 x+1672$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(2*x+9)**3\nq = (x-7)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $6 \\sqrt{2} \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)+i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)$.", + "Output Answer": [ + "Norm: $6 \\sqrt{2 \\left(\\sin ^2\\left(\\frac{2 \\pi }{9}\\right)+\\cos ^2\\left(\\frac{2 \\pi }{9}\\right)\\right)}$\nArgument: $\\frac{2 \\pi }{9}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 6*math.sqrt(2)*(math.cos(((2*math.pi)/9))+i*math.sin(((2*math.pi)/9)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\log (5-2 x) \\cosh ^{-1}(-4 x-2)$", + "Output Answer": [ + "$x\\leq -\\frac{3}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = log(5-2*x)*acosh(-4*x-2)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{13 x^2+x-4}{11 x-12}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{26} \\left(-1-\\sqrt{209}\\right)\\right\\},\\left\\{x\\to \\frac{1}{26} \\left(-1+\\sqrt{209}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((13*x**2+x-4)/(11*x-12)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2+2 x+5 y^2+7 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $2 \\left(x+\\frac{1}{2}\\right)^2+5 \\left(y+\\frac{7}{10}\\right)^2=\\frac{159}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{20} \\left(-10-3 \\sqrt{106}\\right) & -\\frac{7}{10} \\\\\n \\frac{1}{20} \\left(3 \\sqrt{106}-10\\right) & -\\frac{7}{10} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{20} \\left(-10-3 \\sqrt{106}\\right)+\\frac{1}{20} \\left(3 \\sqrt{106}-10\\right)\\right),-\\frac{7}{10}\\right\\}$\nArea Enclosed: $\\frac{159 \\pi }{20 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2+2*x+5*y**2+7*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2+6 \\sqrt{2} x+14$", + "Output Answer": [ + "$\\left(7 \\sqrt{2}-x\\right) \\left(x+\\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2+6*sqrt(2)*x+14, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{25}{93}$, and $a_n=a_{n-1}+-\\frac{8}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$3 \\left(-\\frac{50}{93}-\\frac{40}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(25/93) # initial value\nd = -(8/(math.sqrt(3))) # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(25/93) # initial value\nd = -(8/(math.sqrt(3))) # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left((21+15)^2-19\\right)-(14-17)$.", + "Output Answer": [ + "$1280$" + ], + "Output Program": [ + "try: \n print(((21+15)**2-19)-(14-17))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{4 \\left(1014 t^2-5850 t+8675\\right)^2}{15625}, x(t)=\\frac{676 t^2}{25}-156 t+225$", + "Output Answer": [ + "$y=\\frac{9 x^2}{25}+\\frac{114 x}{25}+\\frac{361}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = ((4*(1014*t**2-5850*t+8675)**2)/15625)\nx_t = ((676*t**2)/25)-156*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 3 x^2+23 x+16\\right| =-7$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(3*x**2+23*x+16), -7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $5 x^2+20 \\sqrt{3} x+45$", + "Output Answer": [ + "$5 \\left(-x-3 \\sqrt{3}\\right) \\left(-x-\\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(5*x**2+20*sqrt(3)*x+45, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $7+\\frac{35 i}{4}$.", + "Output Answer": [ + "Norm: $\\frac{7 \\sqrt{41}}{4}$\nArgument: $\\tan ^{-1}\\left(\\frac{5}{4}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 7+((35*i)/4)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+\\frac{319 x}{7}+\\frac{111012}{49}$", + "Output Answer": [ + "$11 \\left(\\frac{116}{7}-x\\right) \\left(x+\\frac{87}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+((319*x)/7)+(111012/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x+3}+\\sqrt{7 x-9}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 480-276 \\sqrt{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x+3)+sqrt(7*x-9), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $10 x^2-\\frac{16 x}{3}+\\frac{19}{3}$", + "Output Answer": [ + "$10 \\left(x-\\frac{4}{15}\\right)^2+\\frac{253}{45}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (10*x**2-((16*x)/3)+(19/3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{4} \\left(t^2+30 t+237\\right)^2, x(t)=t^2+30 t+225$", + "Output Answer": [ + "$y=\\frac{x^2}{4}+6 x+36$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/4)*(t**2+30*t+237)**2\nx_t = t**2+30*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2-3 x-10 y^2-8 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(x-\\frac{3}{20}\\right)^2-10 \\left(y+\\frac{2}{5}\\right)^2=-\\frac{51}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{20} & \\frac{1}{20} \\left(-8-\\sqrt{510}\\right) \\\\\n \\frac{3}{20} & \\frac{1}{20} \\left(\\sqrt{510}-8\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{3}{20},\\frac{1}{2} \\left(\\frac{1}{20} \\left(-8-\\sqrt{510}\\right)+\\frac{1}{20} \\left(\\sqrt{510}-8\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-x-\\frac{1}{4},y=x-\\frac{11}{20}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2-3*x-10*y**2-8*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^6+5 x^5+5 x^4-4 x^3+2 x^2+9 x+5$ when divided by $2 x+8$.", + "Output Answer": [ + "$-\\frac{9 x^5}{2}+\\frac{41 x^4}{2}-\\frac{159 x^3}{2}+316 x^2-1263 x+\\frac{10113}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**6+5*x**5+5*x**4-4*x**3+2*x**2+9*x+5\nq = 2*x+8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{39 x}{4}-\\frac{37 y}{2}-17=0$, $-\\frac{9 x}{2}-\\frac{83 y}{4}-\\frac{11}{2}=0$", + "Output Answer": [ + "$x=-\\frac{4016}{1905}$, $y=\\frac{122}{635}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((39*x)/4)-((37*y)/2)-17, -((9*x)/2)-((83*y)/4)-(11/2)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{9}{2}$ and $3$.", + "Output Answer": [ + "$\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-(9/2), 3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x$ and $-\\frac{7}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x, -(7/2)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{13 x^2}{\\sqrt{3}}+\\frac{32 x}{\\sqrt{3}}+7 \\sqrt{3}}{\\sqrt{3} x^2+8 \\sqrt{3} x}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((13*x**2)/(sqrt(3)))+((32*x)/(sqrt(3)))+7*sqrt(3))/(sqrt(3)*x**2+8*sqrt(3)*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-128 t^2+480 t-451, x(t)=64 t^2-240 t+225$", + "Output Answer": [ + "$y=-2 x-1$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -128*t**2+480*t-451\nx_t = 64*t**2-240*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-8 \\left(\\cos \\left(\\frac{91}{90}\\right)+i \\sin \\left(\\frac{91}{90}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$64 \\left(\\cos \\left(\\frac{91}{45}\\right)+i \\sin \\left(\\frac{91}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-8*(math.cos((91/90))+1j*math.sin((91/90))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\sqrt{3} \\left(\\cos \\left(\\frac{1}{10}\\right)+i \\sin \\left(\\frac{1}{10}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-1594323 \\sqrt{3} \\left(\\cos \\left(\\frac{9}{10}\\right)+i \\sin \\left(\\frac{9}{10}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*math.sqrt(3)*(math.cos((1/10))+1j*math.sin((1/10))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{5 x^2+20 x+23}{22 x^2+16 x+21}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((5*x**2+20*x+23)/(22*x**2+16*x+21)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{15 x}{\\sqrt{2}}+\\frac{7 y}{\\sqrt{2}}-\\frac{11}{\\sqrt{2}}=0$, $\\frac{15 x}{\\sqrt{2}}-\\frac{3 y}{\\sqrt{2}}-\\frac{31}{\\sqrt{2}}=0$", + "Output Answer": [ + "$x=\\frac{5}{3}$, $y=-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((15*x)/(sqrt(2)))+((7*y)/(sqrt(2)))-(11/(sqrt(2))), ((15*x)/(sqrt(2)))-((3*y)/(sqrt(2)))-(31/(sqrt(2)))), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt[3]{-8 x-4} \\sqrt[3]{-5 x-1}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{2}\\right\\},\\left\\{x\\to -\\frac{1}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(cbrt(-8*x-4)*cbrt(-5*x-1), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^3-5 x^2+3 x-5$ when divided by $4$.", + "Output Answer": [ + "$\\frac{3 x^3}{4}-\\frac{5 x^2}{4}+\\frac{3 x}{4}-\\frac{5}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**3-5*x**2+3*x-5\nq = 4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -6 x, q(x) = (2 x+5)^2$", + "Output Answer": [ + "$4 x^2+14 x+25$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x\nq = (2*x+5)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{22+6 i}{\\pi }$ and $y=\\frac{1+13 i}{\\pi }$", + "Output Answer": [ + "$\\frac{56-292 i}{\\pi ^2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((22+6*i)/math.pi)\ny = ((1+13*i)/math.pi)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (4 x+5)^2, q(x) = 2 x-5$", + "Output Answer": [ + "$16 x^2+42 x+20$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (4*x+5)**2\nq = 2*x-5\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^4+8 x^3-5 x^2-2 x-1$ when divided by $-3 x^4-9 x^3+5 x^2+9 x+6$.", + "Output Answer": [ + "$-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**4+8*x**3-5*x**2-2*x-1\nq = -3*x**4-9*x**3+5*x**2+9*x+6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 \\sqrt{3} x^2+\\frac{16 x}{\\sqrt{3}}-\\sqrt{3}$ and $q(x) = \\frac{20 x^2}{\\sqrt{3}}+\\frac{14 x}{\\sqrt{3}}+6 \\sqrt{3}$", + "Output Answer": [ + "$-80 x^4+\\frac{152 x^3}{3}-\\frac{52 x^2}{3}+82 x-18$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*sqrt(3)*x**2+((16*x)/(sqrt(3)))-sqrt(3)\nq = ((20*x**2)/(sqrt(3)))+((14*x)/(sqrt(3)))+6*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3-15 x}+\\sqrt{5 x+1}=2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{\\sqrt{3}}{10}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3-15*x)+sqrt(5*x+1), 2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{1}{16} ((9-24)+21)^2-8\\right)^2+\\left(\\left(\\frac{1}{3}-8\\right)^2-19\\right)$.", + "Output Answer": [ + "$\\frac{10489}{144}$" + ], + "Output Program": [ + "try: \n print(((1/16)*((9-24)+21)**2-8)**2+(((1/3)-8)**2-19))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(7+9)+\\left(\\frac{12}{10}-23\\right)$.", + "Output Answer": [ + "$-\\frac{29}{5}$" + ], + "Output Program": [ + "try: \n print((7+9)+((12/10)-23))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2+\\frac{93 x}{2}-\\frac{513}{2}$", + "Output Answer": [ + "$2 \\left(\\frac{57}{4}-x\\right) (x-9)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2+((93*x)/2)-(513/2), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(9+9 i) \\log (2)$ and $y=(14+7 i) \\log (2)$", + "Output Answer": [ + "$\\frac{27}{35}+\\frac{9 i}{35}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (9+9*i)*math.log10(2)\ny = (14+7*i)*math.log10(2)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-7 \\sqrt{5} x-7 \\sqrt{5} y+2 \\sqrt{5}=0$, $-5 \\sqrt{5} x-11 \\sqrt{5} y=0$", + "Output Answer": [ + "$x=\\frac{11}{21}$, $y=-\\frac{5}{21}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-7*sqrt(5)*x-7*sqrt(5)*y+2*sqrt(5), -5*sqrt(5)*x-11*sqrt(5)*y), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2+x+2 y^2-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x+\\frac{1}{20}\\right)^2+2 y^2=\\frac{201}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{20} & -\\frac{\\sqrt{201}}{10} \\\\\n -\\frac{1}{20} & \\frac{\\sqrt{201}}{10} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{5}}$\nCenter: $\\left\\{-\\frac{1}{20},0\\right\\}$\nArea Enclosed: $\\frac{201 \\pi }{80 \\sqrt{5}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2+x+2*y**2-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{16 x^2}{\\sqrt{3}}+\\frac{16 x}{\\sqrt{3}}+4 \\sqrt{3}$ and $q(x) = 3 \\sqrt{3} x^2-\\frac{26 x}{\\sqrt{3}}+4 \\sqrt{3}$", + "Output Answer": [ + "$-48 x^4+\\frac{560 x^3}{3}-\\frac{500 x^2}{3}-40 x+48$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((16*x**2)/(sqrt(3)))+((16*x)/(sqrt(3)))+4*sqrt(3)\nq = 3*sqrt(3)*x**2-((26*x)/(sqrt(3)))+4*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$7 \\sqrt{2} x+11 \\sqrt{2} y+3 \\sqrt{2} z-7 \\sqrt{2}=0$, $-12 \\sqrt{2} x+6 \\sqrt{2} y-\\sqrt{2} z+3 \\sqrt{2}=0$, $-\\sqrt{2} x+11 \\sqrt{2} y-9 \\sqrt{2} z-17 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{595}{928}$, $y=\\frac{531}{928}$, $z=-\\frac{585}{464}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((7*sqrt(2)*x+11*sqrt(2)*y+3*sqrt(2)*z-7*sqrt(2), -12*sqrt(2)*x+6*sqrt(2)*y-sqrt(2)*z+3*sqrt(2), -sqrt(2)*x+11*sqrt(2)*y-9*sqrt(2)*z-17*sqrt(2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(7+22)+\\left(\\frac{13}{23}-3\\right)$.", + "Output Answer": [ + "$\\frac{611}{23}$" + ], + "Output Program": [ + "try: \n print((7+22)+((13/23)-3))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+x-y^2-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x+\\frac{1}{14}\\right)^2-y^2=\\frac{253}{28}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{14} \\left(-1-2 \\sqrt{506}\\right) & 0 \\\\\n \\frac{1}{14} \\left(2 \\sqrt{506}-1\\right) & 0 \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{14} \\left(-1-2 \\sqrt{506}\\right)+\\frac{1}{14} \\left(2 \\sqrt{506}-1\\right)\\right),0\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{7} x+\\frac{1}{2 \\sqrt{7}},y=-\\sqrt{7} x-\\frac{1}{2 \\sqrt{7}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+x-y**2-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2-2 x-480$", + "Output Answer": [ + "$2 (x-16) (x+15)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2-2*x-480, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{7}{4}-10 i$ and $y=4-2 i$", + "Output Answer": [ + "$-\\frac{9}{4}-8 i$" + ], + "Output Program": [ + "i = 1j\nx = (7/4)-10*i\ny = 4-2*i\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 \\sqrt{3} x^2-\\frac{17 x}{\\sqrt{3}}+\\frac{8}{\\sqrt{3}}$ and $q(x) = -7 \\sqrt{3} x^2-\\sqrt{3} x+3 \\sqrt{3}$", + "Output Answer": [ + "$-84 x^4+107 x^3-3 x^2-59 x+24$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*sqrt(3)*x**2-((17*x)/(sqrt(3)))+(8/(sqrt(3)))\nq = -7*sqrt(3)*x**2-sqrt(3)*x+3*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(-\\frac{\\sqrt{3}}{2}-\\frac{i}{2}\\right)\\right)^6$", + "Output Answer": [ + "$-117649$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(-((math.sqrt(3))/2)-(i/2)))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2+70 \\sqrt{3} x-\\frac{1885}{3}$", + "Output Answer": [ + "$-5 \\left(\\frac{13}{\\sqrt{3}}-x\\right) \\left(\\frac{29}{\\sqrt{3}}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2+70*sqrt(3)*x-(1885/3), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left((((20-23)-25)+19)^2+16\\right)+(24-15)$.", + "Output Answer": [ + "$106$" + ], + "Output Program": [ + "try: \n print(((((20-23)-25)+19)**2+16)+(24-15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\log \\left(4 x^3+3\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\sqrt[3]{-\\frac{1}{2}}\\right\\},\\left\\{x\\to -\\frac{1}{\\sqrt[3]{2}}\\right\\},\\left\\{x\\to -\\frac{(-1)^{2/3}}{\\sqrt[3]{2}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(log(4*x**3+3), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{4-5 i}{\\sqrt{2}}$ and $y=-\\frac{8+3 i}{\\sqrt{2}}$", + "Output Answer": [ + "$(-2-4 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((4-5*i)/(math.sqrt(2)))\ny = -((8+3*i)/(math.sqrt(2)))\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-23 x-19 y-15 z+7=0$, $13 x-19 y-15 z-12=0$, $-17 x+13 y+5 z+10=0$", + "Output Answer": [ + "$x=\\frac{19}{36}$, $y=\\frac{37}{360}$, $z=-\\frac{851}{1800}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-23*x-19*y-15*z+7, 13*x-19*y-15*z-12, -17*x+13*y+5*z+10)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 x^2-12 x+13$ and $q(x) = -3 x^2+12 x+11$", + "Output Answer": [ + "$12 x^4-12 x^3-227 x^2+24 x+143$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*x**2-12*x+13\nq = -3*x**2+12*x+11\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| x-23| =-1$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(x-23), -1), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 18-17 x| =-2$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(18-17*x), -2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=30 t+\\frac{1}{\\sqrt{2}}-105, x(t)=3 \\sqrt{2} t-\\frac{21}{\\sqrt{2}}$", + "Output Answer": [ + "$y=5 \\sqrt{2} x+\\frac{1}{\\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 30*t+(1/(sqrt(2)))-105\nx_t = 3*sqrt(2)*t-(21/(sqrt(2)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-2-4 i) \\sqrt{3}$ and $y=(6-6 i) \\sqrt{3}$", + "Output Answer": [ + "$(-8+2 i) \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-2-4*i)*math.sqrt(3)\ny = (6-6*i)*math.sqrt(3)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-460 x^3+351 x^2+408 x-315}{-506 x^2+807 x-315}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{40} \\left(-3-\\sqrt{1209}\\right)\\right\\},\\left\\{x\\to \\frac{1}{40} \\left(-3+\\sqrt{1209}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-460*x**3+351*x**2+408*x-315)/(-506*x**2+807*x-315)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{12-2 i}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $2 \\sqrt{\\frac{37}{\\pi }}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{1}{6}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((12-2*i)/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2-9 x-5 y^2-10 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x-\\frac{1}{2}\\right)^2-5 (y+1)^2=-\\frac{27}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & -1-\\sqrt{\\frac{21}{10}} \\\\\n \\frac{1}{2} & \\sqrt{\\frac{21}{10}}-1 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{14}}{3}$\nCenter: $\\left\\{\\frac{1}{2},-1\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{10} \\left(3 \\sqrt{5}-10\\right)-\\frac{3 x}{\\sqrt{5}},y=\\frac{3 x}{\\sqrt{5}}+\\frac{1}{10} \\left(-10-3 \\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2-9*x-5*y**2-10*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -13 x^2+x+12$, $q(x) = -3 x^2-x-3$", + "Output Answer": [ + "$9-16 x^2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -13*x**2+x+12\nq = -3*x**2-x-3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^3-4 x^2+5 x-5$ when divided by $-8 x^2+5 x+9$.", + "Output Answer": [ + "$x+\\frac{9}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**3-4*x**2+5*x-5\nq = -8*x**2+5*x+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{14}{39}$, and $a_n=a_{n-1}+-4 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$\\frac{21}{2} \\left(-\\frac{28}{39}-80 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(14/39) # initial value\nd = -4*math.sqrt(2) # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(14/39) # initial value\nd = -4*math.sqrt(2) # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=5$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$320$" + ], + "Output Program": [ + "a = 5 # initial value\nd = 6 # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 5 # initial value\nd = 6 # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2+7 x-2 y^2+6 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $\\left(x+\\frac{7}{2}\\right)^2-2 \\left(y-\\frac{3}{2}\\right)^2=\\frac{71}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{4} \\left(-14-\\sqrt{426}\\right) & \\frac{3}{2} \\\\\n \\frac{1}{4} \\left(\\sqrt{426}-14\\right) & \\frac{3}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{4} \\left(-14-\\sqrt{426}\\right)+\\frac{1}{4} \\left(\\sqrt{426}-14\\right)\\right),\\frac{3}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{2}}+\\frac{1}{4} \\left(6+7 \\sqrt{2}\\right),y=\\frac{1}{4} \\left(6-7 \\sqrt{2}\\right)-\\frac{x}{\\sqrt{2}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2+7*x-2*y**2+6*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^3-9 x^2+9 x-3$ when divided by $10 x+1$.", + "Output Answer": [ + "$\\frac{x^2}{2}-\\frac{19 x}{20}+\\frac{199}{200}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**3-9*x**2+9*x-3\nq = 10*x+1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left(\\frac{11}{9}+20\\right)+14\\right)+23\\right)^2+(21-9)$.", + "Output Answer": [ + "$\\frac{275548}{81}$" + ], + "Output Program": [ + "try: \n print(((((11/9)+20)+14)+23)**2+(21-9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\sqrt{3} x^2-\\frac{22 x}{\\sqrt{3}}+\\frac{8}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{145}{3 \\sqrt{3}}-\\sqrt{3} \\left(x+\\frac{11}{3}\\right)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-math.sqrt(3)*x**2-((22*x)/(math.sqrt(3)))+(8/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(-\\sin \\left(\\frac{17 \\pi }{90}\\right)+i \\cos \\left(\\frac{17 \\pi }{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$3125 \\left(-\\sin \\left(\\frac{\\pi }{18}\\right)-i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(-math.sin(((17*math.pi)/90))+1j*math.cos(((17*math.pi)/90))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2-290 x+\\frac{16215}{8}$", + "Output Answer": [ + "$10 \\left(x-\\frac{69}{4}\\right) \\left(x-\\frac{47}{4}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2-290*x+(16215/8), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{23}{21}$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$\\frac{15041}{21}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (23/21) # initial value\nd = 9 # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (23/21) # initial value\nd = 9 # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{126}-\\sqrt{44}}{\\sqrt{149}-\\sqrt{30}}$.", + "Output Answer": [ + "$\\frac{2 \\sqrt{11}-3 \\sqrt{14}}{\\sqrt{30}-\\sqrt{149}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(126)-sqrt(44))/(sqrt(149)-sqrt(30))))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(7-3)-10}{(((17-10)-19)+4)+19}$.", + "Output Answer": [ + "$-\\frac{6}{11}$" + ], + "Output Program": [ + "try: \n print((((7-3)-10)/((((17-10)-19)+4)+19)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $9 e^{-\\frac{59 i \\pi }{60}}$.", + "Output Answer": [ + "Norm: $9$\nArgument: $-\\frac{59 \\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 9*math.e**(-((59*i*math.pi)/60))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-5 x^2+10 x-\\frac{52}{5}$", + "Output Answer": [ + "$x=\\frac{1}{5} \\left(5-3 i \\sqrt{3}\\right)\\lor x=\\frac{1}{5} \\left(5+3 i \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-5*x**2+10*x-(52/5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2+5 \\sqrt{5} x+120$", + "Output Answer": [ + "$\\left(8 \\sqrt{5}-x\\right) \\left(x+3 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2+5*sqrt(5)*x+120, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\sin \\left(\\frac{\\pi }{90}\\right)+i \\cos \\left(\\frac{\\pi }{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$1977326743 \\left(-\\sin \\left(\\frac{11 \\pi }{90}\\right)-i \\cos \\left(\\frac{11 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.sin((math.pi/90))+1j*math.cos((math.pi/90))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt[3]{28}-25\\right)+\\left(\\sqrt[3]{15}-\\sqrt[3]{42}\\right)$.", + "Output Answer": [ + "$-25+2^{2/3} \\sqrt[3]{7}+\\sqrt[3]{15}-\\sqrt[3]{42}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((cbrt(28)-25)+(cbrt(15)-cbrt(42)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{34 x^2}{5}+\\frac{74 x}{5}-9$ and $q(x) = -\\frac{56 x}{5}-\\frac{68}{5}$", + "Output Answer": [ + "$\\frac{1904 x^3}{25}-\\frac{1832 x^2}{25}-\\frac{2512 x}{25}+\\frac{612}{5}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((34*x**2)/5)+((74*x)/5)-9\nq = -((56*x)/5)-(68/5)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-220 x^2-5 x+120}{605 x-440}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-220*x**2-5*x+120)/(605*x-440)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -3 x^2-2 x+13$ and $q(x) = -11 x^2+6 x+6$", + "Output Answer": [ + "$33 x^4+4 x^3-173 x^2+66 x+78$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -3*x**2-2*x+13\nq = -11*x**2+6*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^2-8 x+9$ when divided by $6 x^3-2 x^2+5 x+4$.", + "Output Answer": [ + "$0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**2-8*x+9\nq = 6*x**3-2*x**2+5*x+4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{10 x}{7}+\\frac{73}{7}}+\\sqrt{\\frac{97 x}{7}-\\frac{38}{7}}=\\frac{48}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{34903-32 \\sqrt{753181}}{5887}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((10*x)/7)+(73/7))+sqrt(((97*x)/7)-(38/7)), (48/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2+x+8 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-10 x^2+x+8 y=3$\nVertex: $\\left\\{\\frac{1}{20},\\frac{119}{320}\\right\\}$\nDirectrix: $y=\\frac{11}{64}$\nFocal Parameter: $\\frac{2}{5}$\nFocus: $\\left\\{\\frac{1}{20},\\frac{183}{320}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2+x+8*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-352 x^3+404 x^2+234 x-126}{-320 x^2-8 x+48}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{44} \\left(17-\\sqrt{2137}\\right)\\right\\},\\left\\{x\\to \\frac{1}{44} \\left(17+\\sqrt{2137}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-352*x**3+404*x**2+234*x-126)/(-320*x**2-8*x+48)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{4} (9 t+17)^2, x(t)=-\\frac{9 t}{2}-15$", + "Output Answer": [ + "$y=x^2+13 x+\\frac{169}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/4)*(9*t+17)**2\nx_t = -((9*t)/2)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{12 x-5}+\\sqrt{14 x+14}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(12*x-5)+sqrt(14*x+14), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(17-7)^2-9}{21-12}$.", + "Output Answer": [ + "$\\frac{91}{9}$" + ], + "Output Program": [ + "try: \n print((((17-7)**2-9)/(21-12)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{27 x^2}{7}+6 x+\\frac{37}{7}$", + "Output Answer": [ + "$\\frac{27}{7} \\left(x+\\frac{7}{9}\\right)^2+\\frac{62}{21}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((27*x**2)/7)+6*x+(37/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{44}{3}-\\frac{41 x}{3}}+\\sqrt{\\frac{13}{3}-\\frac{13 x}{3}}=\\frac{41}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-44085+41 \\sqrt{892697}}{1176}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((44/3)-((41*x)/3))+sqrt((13/3)-((13*x)/3)), (41/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{1}{8} (8 x+1)^3, q(x) = \\frac{1}{8} (12 x+17)^3$", + "Output Answer": [ + "$152 x^3+894 x^2+\\frac{2595 x}{2}+614$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(1/8)*(8*x+1)**3\nq = (1/8)*(12*x+17)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-x^2-4 x+1$ and $-2 x^3+3 x-2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-x**2-4*x+1, -2*x**3+3*x-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\sqrt{3} x^2+9 \\sqrt{3} x-5 \\sqrt{3}}{10 \\sqrt{3} x+2 \\sqrt{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(9-\\sqrt{61}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(9+\\sqrt{61}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-sqrt(3)*x**2+9*sqrt(3)*x-5*sqrt(3))/(10*sqrt(3)*x+2*sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{32 x}{5}-\\frac{49}{5}}+\\sqrt{\\frac{73 x}{5}+\\frac{51}{5}}=\\frac{52}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{263420-104 \\sqrt{5248699}}{8405}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((32*x)/5)-(49/5))+sqrt(((73*x)/5)+(51/5)), (52/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$5 x-25 y-8=0$, $-8 x+20 y+23=0$", + "Output Answer": [ + "$x=\\frac{83}{20}$, $y=\\frac{51}{100}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((5*x-25*y-8, -8*x+20*y+23), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = x^2+2 x+5$ and $q(x) = 6 x^2+4 x+6$", + "Output Answer": [ + "$6 x^4+16 x^3+44 x^2+32 x+30$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = x**2+2*x+5\nq = 6*x**2+4*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 e x (x+1)$, $q(x) = e \\left(5 x^2+3\\right)$", + "Output Answer": [ + "$9 e x^2+4 e x+3 e$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x\n\np = 4*math.e*x*(x+1)\nq = math.e*(5*x**2+3)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 6 x-5$ and $q(x) = -5 x^2+3 x+9$", + "Output Answer": [ + "$-30 x^3+43 x^2+39 x-45$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 6*x-5\nq = -5*x**2+3*x+9\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -6 x^2-x-9$, $q(x) = -2 \\left(x^2+6 x+5\\right)$", + "Output Answer": [ + "$-8 x^2-13 x-19$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**2-x-9\nq = -2*(x**2+6*x+5)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^4+5 x^3-6 x^2+9 x+6$ when divided by $3$.", + "Output Answer": [ + "$-\\frac{4 x^4}{3}+\\frac{5 x^3}{3}-2 x^2+3 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**4+5*x**3-6*x**2+9*x+6\nq = 3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-84 x^2+90 x+66}{36 x^2+90 x+36}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{11}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-84*x**2+90*x+66)/(36*x**2+90*x+36)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+3 x-6 y^2-6 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x+\\frac{1}{4}\\right)^2-6 \\left(y+\\frac{1}{2}\\right)^2=-\\frac{49}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{4} & \\frac{1}{12} \\left(-6-7 \\sqrt{6}\\right) \\\\\n -\\frac{1}{4} & \\frac{1}{12} \\left(7 \\sqrt{6}-6\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{-\\frac{1}{4},\\frac{1}{2} \\left(\\frac{1}{12} \\left(-6-7 \\sqrt{6}\\right)+\\frac{1}{12} \\left(7 \\sqrt{6}-6\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-x-\\frac{3}{4},y=x-\\frac{1}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+3*x-6*y**2-6*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -2 \\sqrt{2} x^2-5 \\sqrt{2} x-4 \\sqrt{2}$ and $q(x) = -7 \\sqrt{2} x^2-4 \\sqrt{2} x-10 \\sqrt{2}$", + "Output Answer": [ + "$28 x^4+86 x^3+136 x^2+132 x+80$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -2*sqrt(2)*x**2-5*sqrt(2)*x-4*sqrt(2)\nq = -7*sqrt(2)*x**2-4*sqrt(2)*x-10*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (x+5)^2, q(x) = -(7 x+5)^3$", + "Output Answer": [ + "$-343 x^3-734 x^2-515 x-100$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (x+5)**2\nq = -(7*x+5)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{23}{4}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$-\\frac{249}{2}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(23/4) # initial value\nd = -6 # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(23/4) # initial value\nd = -6 # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $5 x^2+35 x-1140$", + "Output Answer": [ + "$5 (-x-19) (12-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(5*x**2+35*x-1140, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((11-15)-9)+(((17+12)-14)+15)$.", + "Output Answer": [ + "$17$" + ], + "Output Program": [ + "try: \n print(((11-15)-9)+(((17+12)-14)+15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-10 x^2-11 x+\\frac{28}{3}}{-5 x^2+\\frac{17 x}{3}+\\frac{5}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{60} \\left(-33-\\sqrt{4449}\\right)\\right\\},\\left\\{x\\to \\frac{1}{60} \\left(-33+\\sqrt{4449}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-10*x**2-11*x+(28/3))/(-5*x**2+((17*x)/3)+(5/3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2+14 x+13$ and $q(x) = 3 x^2+11 x-8$", + "Output Answer": [ + "$-42 x^4-112 x^3+305 x^2+31 x-104$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2+14*x+13\nq = 3*x**2+11*x-8\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (3 x+8)^4, q(x) = -64 (x-1)^3$", + "Output Answer": [ + "$81 x^4+800 x^3+3648 x^2+5952 x+4160$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (3*x+8)**4\nq = -64*(x-1)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$23 x-21 y-13 z-21=0$, $20 x+16 y+14 z-13=0$, $-7 x+12 y+6 z-25=0$", + "Output Answer": [ + "$x=\\frac{2026}{827}$, $y=\\frac{18517}{1654}$, $z=-\\frac{25415}{1654}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((23*x-21*y-13*z-21, 20*x+16*y+14*z-13, -7*x+12*y+6*z-25)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 13 x^2-7 x+1$ and $q(x) = -x^2-7 x-6$", + "Output Answer": [ + "$-13 x^4-84 x^3-30 x^2+35 x-6$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 13*x**2-7*x+1\nq = -x**2-7*x-6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(((1-19)+23)^2+2\\right)+((18-22)+23)^2$.", + "Output Answer": [ + "$388$" + ], + "Output Program": [ + "try: \n print((((1-19)+23)**2+2)+((18-22)+23)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-252 t^2+1260 t-1577, x(t)=36 t^2-180 t+225$", + "Output Answer": [ + "$y=-7 x-2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -252*t**2+1260*t-1577\nx_t = 36*t**2-180*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+2 y^2+10 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 x^2+2 \\left(y+\\frac{5}{2}\\right)^2=\\frac{37}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n 0 & \\frac{1}{4} \\left(-10-\\sqrt{74}\\right) \\\\\n 0 & \\frac{1}{4} \\left(\\sqrt{74}-10\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{0,\\frac{1}{2} \\left(\\frac{1}{4} \\left(-10-\\sqrt{74}\\right)+\\frac{1}{4} \\left(\\sqrt{74}-10\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{37 \\pi }{4 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+2*y**2+10*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{23+15 i}{\\pi }$ and $y=-\\frac{18+12 i}{\\pi }$", + "Output Answer": [ + "$-\\frac{5+3 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((23+15*i)/math.pi)\ny = -((18+12*i)/math.pi)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{1}{11}$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$-\\frac{8022}{11}$" + ], + "Output Program": [ + "a = -(1/11) # initial value\nd = -8 # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(1/11) # initial value\nd = -8 # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (10, 2, \\frac{1}{5})$", + "Output Answer": [ + "$\\left\\{\\frac{51}{5},\\tan ^{-1}\\left(10 \\sqrt{26}\\right),\\tan ^{-1}\\left(\\frac{1}{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 10\ny = 2\nz = (1/5)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2+9 x-5 y^2+10 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(x+\\frac{9}{4}\\right)^2-5 (y-1)^2=\\frac{1}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{9}{4}-\\frac{\\sqrt{\\frac{7}{5}}}{4} & 1 \\\\\n \\frac{1}{20} \\left(\\sqrt{35}-45\\right) & 1 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{9}{4}-\\frac{\\sqrt{\\frac{7}{5}}}{4}+\\frac{1}{20} \\left(\\sqrt{35}-45\\right)\\right),1\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{2}{5}} x+\\frac{1}{20} \\left(20+9 \\sqrt{10}\\right),y=\\frac{1}{20} \\left(20-9 \\sqrt{10}\\right)-\\sqrt{\\frac{2}{5}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2+9*x-5*y**2+10*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^5-3 x^4-6 x^3-4 x^2+8 x-9$ when divided by $-4 x^4-8 x^3-3 x+6$.", + "Output Answer": [ + "$\\frac{5 x}{4}-\\frac{7}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**5-3*x**4-6*x**3-4*x**2+8*x-9\nq = -4*x**4-8*x**3-3*x+6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-23 x+10 y+2 z-22=0$, $-23 x+5 y+12 z-3=0$, $24 x+y+11 z+22=0$", + "Output Answer": [ + "$x=-\\frac{1798}{4135}$, $y=\\frac{5939}{4135}$, $z=-\\frac{4887}{4135}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-23*x+10*y+2*z-22, -23*x+5*y+12*z-3, 24*x+y+11*z+22)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\cos \\left(5 x^4+7\\right)$ at the point $x=2$", + "Output Answer": [ + "$\\cos (87) = 0.57$" + ], + "Output Program": [ + "import math\n\nx = 2\ntry: \n f = math.cos(5*x**4+7)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^6-8 x^5-7 x^4-3 x^3-x^2-2 x-6$ when divided by $-2 x^5+7 x^4-x^3+7 x^2+x+9$.", + "Output Answer": [ + "$-\\frac{3 x}{2}-\\frac{5}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**6-8*x**5-7*x**4-3*x**3-x**2-2*x-6\nq = -2*x**5+7*x**4-x**3+7*x**2+x+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(3+3 i) \\sqrt{5}$ and $y=(2+i) \\sqrt{5}$", + "Output Answer": [ + "$15+45 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (3+3*i)*math.sqrt(5)\ny = (2+i)*math.sqrt(5)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{96 x^2}{7}-\\frac{50}{7}$", + "Output Answer": [ + "$\\frac{96 x^2}{7}-\\frac{50}{7}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((96*x**2)/7)-(50/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(((25+3)+8)+24)+10}{11+4}$.", + "Output Answer": [ + "$\\frac{14}{3}$" + ], + "Output Program": [ + "try: \n print((((((25+3)+8)+24)+10)/(11+4)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\sqrt{2} \\left(-\\sin \\left(\\frac{\\pi }{9}\\right)-i \\cos \\left(\\frac{\\pi }{9}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$65536 \\sqrt{2} \\left(-\\sin \\left(\\frac{2 \\pi }{9}\\right)-i \\cos \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*math.sqrt(2)*(-math.sin((math.pi/9))-1j*math.cos((math.pi/9))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -11 x^2-14 x+12$, $q(x) = -2 \\left(5 x^2-3 x+6\\right)$", + "Output Answer": [ + "$-21 x^2-8 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -11*x**2-14*x+12\nq = -2*(5*x**2-3*x+6)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\tan \\left(\\tan \\left(1-6 x^4\\right)\\right)$ at the point $x=-4$", + "Output Answer": [ + "$-\\tan (\\tan (1535)) = -0.246$" + ], + "Output Program": [ + "import math\n\nx = -4\ntry: \n f = math.tan(math.tan(1-6*x**4))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{9}{4} (8 t+17)^2, x(t)=-8 t-15$", + "Output Answer": [ + "$y=\\frac{9 x^2}{4}-9 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (9/4)*(8*t+17)**2\nx_t = -8*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^5-10 x^4-9 x^3+7 x^2+8 x$ when divided by $-5 x^5-3 x^4+8 x^3-4 x^2-4 x+7$.", + "Output Answer": [ + "$-\\frac{6}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**5-10*x**4-9*x**3+7*x**2+8*x\nq = -5*x**5-3*x**4+8*x**3-4*x**2-4*x+7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\log \\left(4 x^3-5\\right)-\\tan \\left(\\frac{9}{2}-\\frac{9 x^2}{2}\\right)$ at the point $x=8$", + "Output Answer": [ + "$\\log (2043)+\\tan \\left(\\frac{567}{2}\\right) = 8.566$" + ], + "Output Program": [ + "import math\n\nx = 8\ntry: \n f = math.log(4*x**3-5)-math.tan((9/2)-((9*x**2)/2))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (5 x+9)^4, q(x) = -(7 x+1)^3$", + "Output Answer": [ + "$625 x^4+4157 x^3+12003 x^2+14559 x+6560$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (5*x+9)**4\nq = -(7*x+1)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{99 x}{4}-9\\right| =\\frac{5}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{31}{99}\\right\\},\\left\\{x\\to \\frac{41}{99}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((99*x)/4)-9), (5/4)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{64 x^2}{3}+5 x-3}{-13 x-\\frac{17}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{128} \\left(-15-3 \\sqrt{281}\\right)\\right\\},\\left\\{x\\to \\frac{1}{128} \\left(-15+3 \\sqrt{281}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((64*x**2)/3)+5*x-3)/(-13*x-(17/3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{58}{7}$, and $a_n=a_{n-1}+-\\frac{10}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$-12$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (58/7) # initial value\nd = -(10/3) # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (58/7) # initial value\nd = -(10/3) # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-10 \\left(\\cos \\left(\\frac{23}{15}\\right)+i \\sin \\left(\\frac{23}{15}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$100000000 \\left(\\cos \\left(\\frac{184}{15}\\right)+i \\sin \\left(\\frac{184}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-10*(math.cos((23/15))+1j*math.sin((23/15))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\left(\\cos \\left(\\frac{\\pi }{30}\\right)+i \\sin \\left(\\frac{\\pi }{30}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$65536 \\left(\\sin \\left(\\frac{7 \\pi }{30}\\right)+i \\cos \\left(\\frac{7 \\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*(math.cos((math.pi/30))+1j*math.sin((math.pi/30))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(6-22)^2-(19-11)^2$.", + "Output Answer": [ + "$192$" + ], + "Output Program": [ + "try: \n print((6-22)**2-(19-11)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=36 (2 t+11)^2, x(t)=-2 \\sqrt{2} t-11 \\sqrt{2}$", + "Output Answer": [ + "$y=18 x^2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 36*(2*t+11)**2\nx_t = -2*sqrt(2)*t-11*sqrt(2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2-6 x+140$", + "Output Answer": [ + "$2 (-x-10) (x-7)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2-6*x+140, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 x^2+13 x+10$ and $q(x) = -9 x^2+11 x+2$", + "Output Answer": [ + "$-45 x^4-62 x^3+63 x^2+136 x+20$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*x**2+13*x+10\nq = -9*x**2+11*x+2\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+5 x+2 y^2-2 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x+\\frac{5}{16}\\right)^2+2 \\left(y-\\frac{1}{2}\\right)^2=\\frac{105}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{16} & \\frac{1}{16} \\left(8-3 \\sqrt{35}\\right) \\\\\n -\\frac{5}{16} & \\frac{1}{16} \\left(8+3 \\sqrt{35}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{3}}{2}$\nCenter: $\\left\\{-\\frac{5}{16},\\frac{1}{2} \\left(\\frac{1}{16} \\left(8-3 \\sqrt{35}\\right)+\\frac{1}{16} \\left(8+3 \\sqrt{35}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{105 \\pi }{128}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+5*x+2*y**2-2*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\sqrt{5}, \\frac{1}{2}, \\sqrt{5})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{41}}{2},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{21}{5}}}{2}\\right),\\tan ^{-1}\\left(\\frac{1}{2 \\sqrt{5}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.sqrt(5)\ny = (1/2)\nz = math.sqrt(5)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2-24 x+144$", + "Output Answer": [ + "$8 (-x-6) (x-3)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2-24*x+144, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -14 x^2-3 x-20\\right| =22$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{2}\\right\\},\\left\\{x\\to \\frac{2}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-14*x**2-3*x-20), 22), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$10 x+18 y-17 z-25=0$, $21 x+17 y-4 z-5=0$, $-19 x-y+13 z-5=0$", + "Output Answer": [ + "$x=-\\frac{5}{6}$, $y=\\frac{1495}{1302}$, $z=-\\frac{485}{651}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((10*x+18*y-17*z-25, 21*x+17*y-4*z-5, -19*x-y+13*z-5)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-x^2+23 x-23}{9 x^2-7 x-21}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(23-\\sqrt{437}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(23+\\sqrt{437}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-x**2+23*x-23)/(9*x**2-7*x-21)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2+8 x+9 y^2-5 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $2 (x+2)^2+9 \\left(y-\\frac{5}{18}\\right)^2=\\frac{349}{36}$\nFoci: $\\left(\n\\begin{array}{cc}\n -2-\\frac{\\sqrt{\\frac{2443}{2}}}{18} & \\frac{5}{18} \\\\\n \\frac{1}{36} \\left(\\sqrt{4886}-72\\right) & \\frac{5}{18} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{7}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-2-\\frac{\\sqrt{\\frac{2443}{2}}}{18}+\\frac{1}{36} \\left(\\sqrt{4886}-72\\right)\\right),\\frac{5}{18}\\right\\}$\nArea Enclosed: $\\frac{349 \\pi }{108 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2+8*x+9*y**2-5*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\sqrt{2} \\left(\\cos \\left(\\frac{11}{6}\\right)+i \\sin \\left(\\frac{11}{6}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$2 \\left(\\cos \\left(\\frac{11}{3}\\right)+i \\sin \\left(\\frac{11}{3}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.sqrt(2)*(math.cos((11/6))+1j*math.sin((11/6))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^2+5 x-9$ when divided by $-4 x^2+\\frac{15 x}{2}+9$.", + "Output Answer": [ + "$\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**2+5*x-9\nq = -4*x**2+((15*x)/2)+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (10, 3, 4)$", + "Output Answer": [ + "$\\left\\{5 \\sqrt{5},\\tan ^{-1}\\left(\\frac{\\sqrt{109}}{4}\\right),\\tan ^{-1}\\left(\\frac{3}{10}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 10\ny = 3\nz = 4\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2-x+5 y^2+2 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(y+\\frac{1}{5}\\right)^2-4 \\left(x+\\frac{1}{8}\\right)^2=\\frac{331}{80}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{8} & \\frac{1}{40} \\left(-8-3 \\sqrt{331}\\right) \\\\\n -\\frac{1}{8} & \\frac{1}{40} \\left(3 \\sqrt{331}-8\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2}$\nCenter: $\\left\\{-\\frac{1}{8},\\frac{1}{2} \\left(\\frac{1}{40} \\left(-8-3 \\sqrt{331}\\right)+\\frac{1}{40} \\left(3 \\sqrt{331}-8\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{20} \\left(-4-\\sqrt{5}\\right)-\\frac{2 x}{\\sqrt{5}},y=\\frac{2 x}{\\sqrt{5}}+\\frac{1}{20} \\left(\\sqrt{5}-4\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2-x+5*y**2+2*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(23+15)-((((6-14)+9)+20)-9)$.", + "Output Answer": [ + "$26$" + ], + "Output Program": [ + "try: \n print((23+15)-((((6-14)+9)+20)-9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{31 x}{3}-\\frac{8 y}{3}-\\frac{64}{3}=0$, $-\\frac{32 x}{3}-\\frac{23 y}{3}-\\frac{20}{3}=0$", + "Output Answer": [ + "$x=\\frac{1312}{969}$, $y=-\\frac{2668}{969}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((31*x)/3)-((8*y)/3)-(64/3), -((32*x)/3)-((23*y)/3)-(20/3)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{19 x^2}{\\sqrt{3}}-\\frac{25 x}{\\sqrt{3}}-\\frac{13}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{19 \\left(x+\\frac{25}{38}\\right)^2}{\\sqrt{3}}-\\frac{121 \\sqrt{3}}{76}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((19*x**2)/(math.sqrt(3)))-((25*x)/(math.sqrt(3)))-(13/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 \\left(162 t^2-540 t+449\\right), x(t)=81 t^2-270 t+225$", + "Output Answer": [ + "$y=8 x-4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*(162*t**2-540*t+449)\nx_t = 81*t**2-270*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sin (3 x+6)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sin(3*x+6)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-10 x-6 y^2-6 y+10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x-\\frac{5}{6}\\right)^2-6 \\left(y+\\frac{1}{2}\\right)^2=-\\frac{22}{3}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{6} & \\frac{1}{6} \\left(-3-2 \\sqrt{22}\\right) \\\\\n \\frac{5}{6} & \\frac{1}{6} \\left(2 \\sqrt{22}-3\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{5}{6},\\frac{1}{2} \\left(\\frac{1}{6} \\left(-3-2 \\sqrt{22}\\right)+\\frac{1}{6} \\left(2 \\sqrt{22}-3\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{3}-x,y=x-\\frac{4}{3}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-10*x-6*y**2-6*y+10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{26 x}{5}-\\frac{48}{5}}+\\sqrt{\\frac{56 x}{5}+\\frac{51}{5}}=\\frac{59}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{67648-59 \\sqrt{1116559}}{1125}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((26*x)/5)-(48/5))+sqrt(((56*x)/5)+(51/5)), (59/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{101 x^2}{7}+4 x-10$", + "Output Answer": [ + "$-\\frac{101}{7} \\left(x-\\frac{14}{101}\\right)^2-\\frac{982}{101}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((101*x**2)/7)+4*x-10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{14-11 x}+\\sqrt{4-8 x}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-503+12 \\sqrt{1731}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(14-11*x)+sqrt(4-8*x), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^2+8 x-4$ when divided by $2 x-1$.", + "Output Answer": [ + "$3 x+\\frac{11}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**2+8*x-4\nq = 2*x-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2-10 x+5 y^2-5 y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(y-\\frac{1}{2}\\right)^2-7 \\left(x+\\frac{5}{7}\\right)^2=-\\frac{121}{28}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{7}-\\frac{11 \\sqrt{\\frac{3}{5}}}{7} & \\frac{1}{2} \\\\\n \\frac{11 \\sqrt{\\frac{3}{5}}}{7}-\\frac{5}{7} & \\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{3}{5}}$\nCenter: $\\left\\{-\\frac{5}{7},\\frac{1}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{7}{5}} x+\\frac{1}{14} \\left(7+2 \\sqrt{35}\\right),y=\\frac{1}{14} \\left(7-2 \\sqrt{35}\\right)-\\sqrt{\\frac{7}{5}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2-10*x+5*y**2-5*y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $(1-5 i) \\sqrt{3}$.", + "Output Answer": [ + "Norm: $\\sqrt{78}$\nArgument: $-\\tan ^{-1}(5)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (1-5*i)*math.sqrt(3)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $4 \\sqrt{5} x^2-4 \\sqrt{5} x$", + "Output Answer": [ + "$4 \\sqrt{5} \\left(x-\\frac{1}{2}\\right)^2-\\sqrt{5}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (4*math.sqrt(5)*x**2-4*math.sqrt(5)*x), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{713 t}{49}-72, x(t)=-\\frac{23 t}{7}-15$", + "Output Answer": [ + "$y=\\frac{31 x}{7}-\\frac{39}{7}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -((713*t)/49)-72\nx_t = -((23*t)/7)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3$ and $-\\frac{5 x^2}{2}-\\frac{7 x}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3, -((5*x**2)/2)-((7*x)/2)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{22-2 i}{\\pi }$ and $y=\\frac{4+3 i}{\\pi }$", + "Output Answer": [ + "$\\frac{94+58 i}{\\pi ^2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((22-2*i)/math.pi)\ny = ((4+3*i)/math.pi)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-7-\\frac{11 i}{2}$ and $y=-7+6 i$", + "Output Answer": [ + "$-14+\\frac{i}{2}$" + ], + "Output Program": [ + "i = 1j\nx = -7-((11*i)/2)\ny = -7+6*i\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3-\\frac{3 x}{2}$ and $1-\\frac{x}{2}$.", + "Output Answer": [ + "$\\frac{x}{2}-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3-((3*x)/2), 1-(x/2)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the first order series of the inverse of the following function around 1:\n$\\sqrt[3]{6} \\sqrt[3]{x}^2$", + "Output Answer": [ + "$-\\frac{1}{2} \\sqrt[3]{\\frac{5}{2}} 3^{2/3} \\left(x-5^{2/3} \\sqrt[3]{6}\\right)-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, cbrt(6)*cbrt(x)**2)\nprint(solve(f, x)[0].series(y, 1, 1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $6-x$ when divided by $-\\frac{28 x}{3}-8$.", + "Output Answer": [ + "$\\frac{3}{28}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6-x\nq = -((28*x)/3)-8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2 x-4$ and $-4 x^2+3 x+4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2*x-4, -4*x**2+3*x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $12 x^2-5 x-12$", + "Output Answer": [ + "$12 \\left(x-\\frac{5}{24}\\right)^2-\\frac{601}{48}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (12*x**2-5*x-12), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{1}{7}$, and $a_n=a_{n-1}+-\\frac{48}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$-\\frac{7326}{7}$" + ], + "Output Program": [ + "a = (1/7) # initial value\nd = -(48/7) # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (1/7) # initial value\nd = -(48/7) # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-18 \\sqrt{2} x-2 \\sqrt{2} y+7 \\sqrt{2} z+10 \\sqrt{2}=0$, $-5 \\sqrt{2} x+15 \\sqrt{2} y-5 \\sqrt{2} z+13 \\sqrt{2}=0$, $9 \\sqrt{2} x+4 \\sqrt{2} y+14 \\sqrt{2} z+12 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{1888}{5275}$, $y=-\\frac{1069}{1055}$, $z=-\\frac{4208}{5275}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-18*sqrt(2)*x-2*sqrt(2)*y+7*sqrt(2)*z+10*sqrt(2), -5*sqrt(2)*x+15*sqrt(2)*y-5*sqrt(2)*z+13*sqrt(2), 9*sqrt(2)*x+4*sqrt(2)*y+14*sqrt(2)*z+12*sqrt(2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 \\left(-x^2+x+3\\right)$, $q(x) = -6 x^2+9 x+8$", + "Output Answer": [ + "$-10 x^2+13 x+20$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*(-x**2+x+3)\nq = -6*x**2+9*x+8\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{79}-\\sqrt{81}\\right)-\\sqrt{174}$.", + "Output Answer": [ + "$-9+\\sqrt{79}-\\sqrt{174}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(79)-sqrt(81))-sqrt(174))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{29 x^2}{3}+7 x-\\frac{41}{3}$", + "Output Answer": [ + "$x=\\frac{1}{58} \\left(21-i \\sqrt{4315}\\right)\\lor x=\\frac{1}{58} \\left(21+i \\sqrt{4315}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((29*x**2)/3)+7*x-(41/3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-3 x^2+\\frac{15 x}{2}+\\frac{15}{2}}{21 x-19}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(5-\\sqrt{65}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(5+\\sqrt{65}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-3*x**2+((15*x)/2)+(15/2))/(21*x-19)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\sqrt{3} \\left(\\sin \\left(\\frac{11 \\pi }{45}\\right)-i \\cos \\left(\\frac{11 \\pi }{45}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$288 \\sqrt{3} \\left(-\\sin \\left(\\frac{2 \\pi }{9}\\right)+i \\cos \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*math.sqrt(3)*(math.sin(((11*math.pi)/45))-1j*math.cos(((11*math.pi)/45))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{7}, \\frac{1}{3}, \\frac{1}{\\sqrt{3}})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{205}}{21},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{58}{3}}}{7}\\right),\\tan ^{-1}\\left(\\frac{7}{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/7)\ny = (1/3)\nz = (1/(math.sqrt(3)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2-444 x+\\frac{102528}{25}$", + "Output Answer": [ + "$-12 \\left(\\frac{89}{5}-x\\right) \\left(x-\\frac{96}{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2-444*x+(102528/25), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 x^2-5 x-1$ and $q(x) = -10 x^2-6 x+9$", + "Output Answer": [ + "$-30 x^4+32 x^3+67 x^2-39 x-9$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*x**2-5*x-1\nq = -10*x**2-6*x+9\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{21 x}{\\sqrt{2}}-11 \\sqrt{2} y+\\frac{31}{\\sqrt{2}}=0$, $10 \\sqrt{2} x+\\frac{31 y}{\\sqrt{2}}-\\frac{23}{\\sqrt{2}}=0$", + "Output Answer": [ + "$x=-\\frac{455}{1091}$, $y=\\frac{1103}{1091}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((21*x)/(sqrt(2)))-11*sqrt(2)*y+(31/(sqrt(2))), 10*sqrt(2)*x+((31*y)/(sqrt(2)))-(23/(sqrt(2)))), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $6 \\sqrt{2}-6 \\sqrt{2} x^2$", + "Output Answer": [ + "$6 \\sqrt{2}-6 \\sqrt{2} x^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (6*math.sqrt(2)-6*math.sqrt(2)*x**2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2-8 x+4 y^2-10 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $3 \\left(x-\\frac{4}{3}\\right)^2+4 \\left(y-\\frac{5}{4}\\right)^2=\\frac{223}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{4}{3}-\\frac{\\sqrt{223}}{12} & \\frac{5}{4} \\\\\n \\frac{1}{12} \\left(16+\\sqrt{223}\\right) & \\frac{5}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{4}{3}-\\frac{\\sqrt{223}}{12}+\\frac{1}{12} \\left(16+\\sqrt{223}\\right)\\right),\\frac{5}{4}\\right\\}$\nArea Enclosed: $\\frac{223 \\pi }{24 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2-8*x+4*y**2-10*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left((((24-18)-25)-16)^2+8\\right)+\\left((17+6)^2-22\\right)$.", + "Output Answer": [ + "$1740$" + ], + "Output Program": [ + "try: \n print(((((24-18)-25)-16)**2+8)+((17+6)**2-22))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 x^2+11 x-7$", + "Output Answer": [ + "$\\frac{65}{8}-2 \\left(x-\\frac{11}{4}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*x**2+11*x-7), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $10 x^3+90 x^2-1620 x$", + "Output Answer": [ + "$-10 (-x-18) (x-9) x$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(10*x**3+90*x**2-1620*x, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x-1$ and $4 x^5-4 x^4+4 x^3-x^2-5 x-2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x-1, 4*x**5-4*x**4+4*x**3-x**2-5*x-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{76}{7}-\\frac{41 x}{7}\\right| =\\frac{51}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{25}{41}\\right\\},\\left\\{x\\to \\frac{127}{41}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs((76/7)-((41*x)/7)), (51/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4$ and $-2 x^3-5 x^2-x+2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4, -2*x**3-5*x**2-x+2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{16} (5-8 x)^2, q(x) = \\frac{81}{256} (7-5 x)^4$", + "Output Answer": [ + "$\\frac{50625 x^4}{256}-\\frac{70875 x^3}{64}+\\frac{298187 x^2}{128}-\\frac{139235 x}{64}+\\frac{194881}{256}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/16)*(5-8*x)**2\nq = (81/256)*(7-5*x)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-21 x^2+21 x+7}{-23 x^2+24 x-14}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(3-\\sqrt{21}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(3+\\sqrt{21}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-21*x**2+21*x+7)/(-23*x**2+24*x-14)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -2 x^2+5 x-4$, $q(x) = -2 x^2-6 x-1$", + "Output Answer": [ + "$-4 x^2-x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**2+5*x-4\nq = -2*x**2-6*x-1\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-8 \\left(\\cos \\left(\\frac{7}{30}\\right)+i \\sin \\left(\\frac{7}{30}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-8589934592 \\left(\\cos \\left(\\frac{77}{30}\\right)+i \\sin \\left(\\frac{77}{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-8*(math.cos((7/30))+1j*math.sin((7/30))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-9 \\left(\\cos \\left(\\frac{41}{45}\\right)+i \\sin \\left(\\frac{41}{45}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-31381059609 \\left(\\cos \\left(\\frac{451}{45}\\right)+i \\sin \\left(\\frac{451}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-9*(math.cos((41/45))+1j*math.sin((41/45))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\frac{\\sqrt[3]{-2 x^2-6}}{\\log (7 x-9)}$", + "Output Answer": [ + "$\\frac{9}{7}\\frac{10}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = ((cbrt(-2*x**2-6))/(log(7*x-9)))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2+60 \\sqrt{3} x+600$", + "Output Answer": [ + "$4 \\left(-x-10 \\sqrt{3}\\right) \\left(-x-5 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2+60*sqrt(3)*x+600, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+7 x+7 y^2-8 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $6 \\left(x+\\frac{7}{12}\\right)^2+7 \\left(y-\\frac{4}{7}\\right)^2=\\frac{1063}{168}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{84} \\left(-49-\\sqrt{1063}\\right) & \\frac{4}{7} \\\\\n \\frac{1}{84} \\left(\\sqrt{1063}-49\\right) & \\frac{4}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{84} \\left(-49-\\sqrt{1063}\\right)+\\frac{1}{84} \\left(\\sqrt{1063}-49\\right)\\right),\\frac{4}{7}\\right\\}$\nArea Enclosed: $\\frac{1063 \\pi }{168 \\sqrt{42}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+7*x+7*y**2-8*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-11 x^2-16 x+22}{8-15 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{11} \\left(-8-3 \\sqrt{34}\\right)\\right\\},\\left\\{x\\to \\frac{1}{11} \\left(-8+3 \\sqrt{34}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-11*x**2-16*x+22)/(8-15*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{16 x}{3}+\\frac{11}{3}}+\\sqrt{\\frac{41 x}{3}+6}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{25} \\left(1532-30 \\sqrt{2145}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((16*x)/3)+(11/3))+sqrt(((41*x)/3)+6), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2+2 x-9 y^2+4 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x+\\frac{1}{5}\\right)^2-9 \\left(y-\\frac{2}{9}\\right)^2=-\\frac{236}{45}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{5} & -\\frac{2}{45} \\left(\\sqrt{826}-5\\right) \\\\\n -\\frac{1}{5} & \\frac{2}{45} \\left(5+\\sqrt{826}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{14}{5}}$\nCenter: $\\left\\{-\\frac{1}{5},\\frac{1}{2} \\left(\\frac{2}{45} \\left(5+\\sqrt{826}\\right)-\\frac{2}{45} \\left(\\sqrt{826}-5\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{45} \\left(10-3 \\sqrt{5}\\right)-\\frac{\\sqrt{5} x}{3},y=\\frac{\\sqrt{5} x}{3}+\\frac{1}{45} \\left(10+3 \\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2+2*x-9*y**2+4*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left((25+6)^2-17\\right)-23\\right)+3\\right)+(11-21)$.", + "Output Answer": [ + "$914$" + ], + "Output Program": [ + "try: \n print(((((25+6)**2-17)-23)+3)+(11-21))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{7}{2}-\\frac{39 i}{4}$ and $y=\\frac{19}{4}-\\frac{i}{4}$", + "Output Answer": [ + "$\\frac{33}{4}-10 i$" + ], + "Output Program": [ + "i = 1j\nx = (7/2)-((39*i)/4)\ny = (19/4)-(i/4)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{88}{47}$, and $a_n=a_{n-1}+\\frac{3}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$4 \\left(\\frac{176}{47}+\\frac{21}{\\sqrt{5}}\\right)$" + ], + "Output Program": [ + "import math\n\na = (88/47) # initial value\nd = (3/(math.sqrt(5))) # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (88/47) # initial value\nd = (3/(math.sqrt(5))) # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 7 x^2+5 x-7\\right| =-3$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(7*x**2+5*x-7), -3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2$ and $5-4 x^2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2, 5-4*x**2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-6 x^2-25 x+25}{6 x^2+121 x-105}=0$", + "Output Answer": [ + "$\\{\\{x\\to -5\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-6*x**2-25*x+25)/(6*x**2+121*x-105)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-6 \\sqrt{2} \\left(-\\sin \\left(\\frac{23 \\pi }{180}\\right)-i \\cos \\left(\\frac{23 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $6 \\sqrt{2 \\left(\\sin ^2\\left(\\frac{23 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{23 \\pi }{180}\\right)\\right)}$\nArgument: $\\frac{67 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -6*math.sqrt(2)*(-math.sin(((23*math.pi)/180))-i*math.cos(((23*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\left(\\frac{1}{4} \\left(-1-\\sqrt{5}\\right)-i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)\\right)^8$", + "Output Answer": [ + "$1679616 \\left(\\frac{1}{4} \\left(\\sqrt{5}-1\\right)-i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*((1/4)*(-1-math.sqrt(5))-1j*math.sqrt((5/8)-((math.sqrt(5))/8))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{10 x^2}{\\sqrt{3}}+\\frac{13 x}{\\sqrt{3}}+5 \\sqrt{3}$", + "Output Answer": [ + "$x=-\\frac{1}{20} \\sqrt{3} \\left(-\\frac{13}{\\sqrt{3}}-\\sqrt{\\frac{769}{3}}\\right)\\lor x=-\\frac{1}{20} \\sqrt{3} \\left(\\sqrt{\\frac{769}{3}}-\\frac{13}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((10*x**2)/(sqrt(3)))+((13*x)/(sqrt(3)))+5*sqrt(3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2-22 \\sqrt{5} x-165$", + "Output Answer": [ + "$11 \\left(-x-\\sqrt{5}\\right) \\left(3 \\sqrt{5}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2-22*sqrt(5)*x-165, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\tan (2-2 x)$", + "Output Answer": [ + "$\\frac{2-2 x}{\\pi }+\\frac{1}{2}\\notin \\mathbb{Z}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = tan(2-2*x)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (7, 8, 6)$", + "Output Answer": [ + "$\\left\\{\\sqrt{149},\\tan ^{-1}\\left(\\frac{\\sqrt{113}}{6}\\right),\\tan ^{-1}\\left(\\frac{8}{7}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 7\ny = 8\nz = 6\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (3 x+5)^2, q(x) = (7-3 x)^4$", + "Output Answer": [ + "$81 x^4-756 x^3+2655 x^2-4086 x+2426$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (3*x+5)**2\nq = (7-3*x)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+9 y^2-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $3 x^2+9 y^2=10$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2 \\sqrt{5}}{3} & 0 \\\\\n \\frac{2 \\sqrt{5}}{3} & 0 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{3}}$\nCenter: $\\{0,0\\}$\nArea Enclosed: $\\frac{10 \\pi }{3 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+9*y**2-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{17 x^2}{\\sqrt{2}}-\\frac{3 x}{\\sqrt{2}}-8 \\sqrt{2}$ and $q(x) = -\\frac{15 x^2}{\\sqrt{2}}-\\frac{19 x}{\\sqrt{2}}-\\sqrt{2}$", + "Output Answer": [ + "$-\\frac{255 x^4}{2}-139 x^3+\\frac{263 x^2}{2}+155 x+16$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((17*x**2)/(sqrt(2)))-((3*x)/(sqrt(2)))-8*sqrt(2)\nq = -((15*x**2)/(sqrt(2)))-((19*x)/(sqrt(2)))-sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{44}{7}-\\frac{72 x}{7}}+\\sqrt{-8 x-\\frac{69}{7}}=\\frac{58}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{112} \\left(-26121+58 \\sqrt{198926}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((44/7)-((72*x)/7))+sqrt(-8*x-(69/7)), (58/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{14}{5}$ and $\\frac{19 x^2}{5}-\\frac{11 x}{5}-\\frac{18}{5}$.", + "Output Answer": [ + "$\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd((14/5), ((19*x**2)/5)-((11*x)/5)-(18/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{16 x^2}{\\sqrt{3}}-7 \\sqrt{3} x-\\frac{13}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{32} \\sqrt{3} \\left(7 \\sqrt{3}-\\sqrt{\\frac{1273}{3}}\\right)\\lor x=\\frac{1}{32} \\sqrt{3} \\left(7 \\sqrt{3}+\\sqrt{\\frac{1273}{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((16*x**2)/(sqrt(3)))-7*sqrt(3)*x-(13/(sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{1}{10} ((2+6)+13)\\right) (((24-15)-6)+15)$.", + "Output Answer": [ + "$\\frac{189}{5}$" + ], + "Output Program": [ + "try: \n print(((1/10)*((2+6)+13))*(((24-15)-6)+15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2-231 x+594$", + "Output Answer": [ + "$-11 (18-x) (x-3)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2-231*x+594, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2-\\frac{32 x}{7}-\\frac{1872}{49}$", + "Output Answer": [ + "$4 \\left(-x-\\frac{18}{7}\\right) \\left(\\frac{26}{7}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2-((32*x)/7)-(1872/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-6 i \\sqrt{2}$ and $y=(3-4 i) \\sqrt{2}$", + "Output Answer": [ + "$(-3-2 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -6*i*math.sqrt(2)\ny = (3-4*i)*math.sqrt(2)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{8 x^2}{5}-\\frac{64 x}{5}-\\frac{54}{5}$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(8-\\sqrt{91}\\right)\\lor x=\\frac{1}{2} \\left(8+\\sqrt{91}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((8*x**2)/5)-((64*x)/5)-(54/5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{\\sqrt[3]{3 x-5}}{\\left(7 x^2-8\\right)^5}$ at the point $x=1$", + "Output Answer": [ + "$\\sqrt[3]{2} = 1.26$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 1\ntry: \n f = ((np.cbrt(3*x-5))/((7*x**2-8)**5))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10-4 x}+\\sqrt{2-3 x}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -692+20 \\sqrt{1178}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10-4*x)+sqrt(2-3*x), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{61}{7}+\\frac{2 i}{7}$.", + "Output Answer": [ + "Norm: $\\frac{5 \\sqrt{149}}{7}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{2}{61}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(61/7)+((2*i)/7)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -24 x^2+11 x+11\\right| =15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{48} \\left(11-\\sqrt{2617}\\right)\\right\\},\\left\\{x\\to \\frac{1}{48} \\left(11+\\sqrt{2617}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-24*x**2+11*x+11), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-16 x^5-12 x^4-8 x^3+16 x^2-8$ and $-4 x^5-3 x^4-2 x^3+4 x^2-2$.", + "Output Answer": [ + "$4 x^5+3 x^4+2 x^3-4 x^2+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-16*x**5-12*x**4-8*x**3+16*x**2-8, -4*x**5-3*x**4-2*x**3+4*x**2-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -3 \\sqrt{3} x^2-8 \\sqrt{3} x+8 \\sqrt{3}$ and $q(x) = -2 \\sqrt{3} x^2-2 \\sqrt{3} x-\\sqrt{3}$", + "Output Answer": [ + "$18 x^4+66 x^3+9 x^2-24 x-24$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -3*sqrt(3)*x**2-8*sqrt(3)*x+8*sqrt(3)\nq = -2*sqrt(3)*x**2-2*sqrt(3)*x-sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x-8}+\\sqrt{7 x-4}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{9} \\left(97-5 \\sqrt{97}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x-8)+sqrt(7*x-4), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{3}{4}-\\frac{23 i}{4}$ and $y=\\frac{19}{2}-\\frac{35 i}{4}$", + "Output Answer": [ + "$-\\frac{691}{16}-\\frac{979 i}{16}$" + ], + "Output Program": [ + "i = 1j\nx = (3/4)-((23*i)/4)\ny = (19/2)-((35*i)/4)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 13 x+3| =-25$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(13*x+3), -25), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x+5}+\\sqrt{11 x-15}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(814-238 \\sqrt{10}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x+5)+sqrt(11*x-15), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{51}{92}$, and $a_n=a_{n-1}+-\\frac{16}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$-\\frac{148475}{92}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(51/92) # initial value\nd = -(16/3) # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(51/92) # initial value\nd = -(16/3) # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3 x+12}+\\sqrt{12 x-15}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{27} \\left(326-14 \\sqrt{385}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3*x+12)+sqrt(12*x-15), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $4 x-8 x^2$", + "Output Answer": [ + "$\\frac{1}{2}-8 \\left(x-\\frac{1}{4}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (4*x-8*x**2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{121 x^2+209 x-510}{187 x-255}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{34}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((121*x**2+209*x-510)/(187*x-255)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(-5-2 i) \\sqrt{3}$ and $y=(1+2 i) \\sqrt{3}$", + "Output Answer": [ + "$-4 \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-5-2*i)*math.sqrt(3)\ny = (1+2*i)*math.sqrt(3)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{97}{23}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$\\frac{7180}{23}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (97/23) # initial value\nd = 6 # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (97/23) # initial value\nd = 6 # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{2}{45}$, and $a_n=a_{n-1}+-\\frac{11}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$15 \\left(-\\frac{4}{45}-\\frac{319}{\\sqrt{5}}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(2/45) # initial value\nd = -(11/(math.sqrt(5))) # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(2/45) # initial value\nd = -(11/(math.sqrt(5))) # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $7 \\sqrt{3} x^2-8 \\sqrt{3} x+\\frac{11}{\\sqrt{3}}$", + "Output Answer": [ + "$7 \\sqrt{3} \\left(x-\\frac{4}{7}\\right)^2-\\frac{16 \\sqrt{3}}{7}+\\frac{11}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (7*math.sqrt(3)*x**2-8*math.sqrt(3)*x+(11/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((8+3)-20)-((((3+18)-23)-12)-20)$.", + "Output Answer": [ + "$25$" + ], + "Output Program": [ + "try: \n print(((8+3)-20)-((((3+18)-23)-12)-20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2+7 x-10 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-4 x^2+7 x-10 y=-8$\nVertex: $\\left\\{\\frac{7}{8},\\frac{177}{160}\\right\\}$\nDirectrix: $y=\\frac{277}{160}$\nFocal Parameter: $\\frac{5}{4}$\nFocus: $\\left\\{\\frac{7}{8},\\frac{77}{160}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2+7*x-10*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -6 x^2+3 x+3$ and $q(x) = 3 x^2-11 x-5$", + "Output Answer": [ + "$-18 x^4+75 x^3+6 x^2-48 x-15$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -6*x**2+3*x+3\nq = 3*x**2-11*x-5\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 20-x| =12$", + "Output Answer": [ + "$\\{\\{x\\to 8\\},\\{x\\to 32\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(20-x), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^4+2 x^3-3 x^2-3 x+4$ when divided by $3$.", + "Output Answer": [ + "$-\\frac{7 x^4}{3}+\\frac{2 x^3}{3}-x^2-x+\\frac{4}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**4+2*x**3-3*x**2-3*x+4\nq = 3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=2 \\left(250 t^2+1100 t+1211\\right)^2, x(t)=50 t^2+220 t+242$", + "Output Answer": [ + "$y=50 x^2+20 x+2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 2*(250*t**2+1100*t+1211)**2\nx_t = 50*t**2+220*t+242\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{15 x}{2}+\\frac{15}{2}}+\\sqrt{\\frac{19 x}{2}-8}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(1731-50 \\sqrt{1182}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((15*x)/2)+(15/2))+sqrt(((19*x)/2)-8), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-14 x^2+6 x-4$", + "Output Answer": [ + "$-14 \\left(x-\\frac{3}{14}\\right)^2-\\frac{47}{14}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-14*x**2+6*x-4), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x+\\frac{58}{5}}+\\sqrt{\\frac{47 x}{5}-\\frac{49}{5}}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{52124-26 \\sqrt{2580710}}{1369}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x+(58/5))+sqrt(((47*x)/5)-(49/5)), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 13 x-21| =-6$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(13*x-21), -6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{87 x^2}{7}+2 x+\\frac{22}{7}$, $q(x) = \\frac{89 x^2}{7}+6 x+\\frac{9}{7}$", + "Output Answer": [ + "$\\frac{2 x^2}{7}+8 x+\\frac{31}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((87*x**2)/7)+2*x+(22/7)\nq = ((89*x**2)/7)+6*x+(9/7)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-17 \\sqrt{2} x+7 \\sqrt{2} y-\\sqrt{2} z-3 \\sqrt{2}=0$, $3 \\sqrt{2} x-5 \\sqrt{2} y+16 \\sqrt{2} z+2 \\sqrt{2}=0$, $11 \\sqrt{2} x-10 \\sqrt{2} y-2 \\sqrt{2} z-12 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{582}{547}$, $y=-\\frac{1228}{547}$, $z=-\\frac{343}{547}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-17*sqrt(2)*x+7*sqrt(2)*y-sqrt(2)*z-3*sqrt(2), 3*sqrt(2)*x-5*sqrt(2)*y+16*sqrt(2)*z+2*sqrt(2), 11*sqrt(2)*x-10*sqrt(2)*y-2*sqrt(2)*z-12*sqrt(2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{82 x^3}{5}-\\frac{8637 x^2}{25}+\\frac{16519 x}{25}-\\frac{8094}{25}}{\\frac{3621}{25}-\\frac{4182 x}{25}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{6}{5}\\right\\},\\{x\\to 19\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((82*x**3)/5)-((8637*x**2)/25)+((16519*x)/25)-(8094/25))/((3621/25)-((4182*x)/25))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{2}-\\sqrt{19}$.", + "Output Answer": [ + "$\\sqrt{2}-\\sqrt{19}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(2)-sqrt(19))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\pi, 6, 4)$", + "Output Answer": [ + "$\\left\\{\\sqrt{52+\\pi ^2},\\tan ^{-1}\\left(\\frac{\\sqrt{36+\\pi ^2}}{4}\\right),\\tan ^{-1}\\left(\\frac{6}{\\pi }\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.pi\ny = 6\nz = 4\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -13 x^2-20 x-4\\right| =-2$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-13*x**2-20*x-4), -2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-6 x+y+1=0$, $3 x+19 y+10=0$", + "Output Answer": [ + "$x=\\frac{1}{13}$, $y=-\\frac{7}{13}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-6*x+y+1, 3*x+19*y+10), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 x^2+11 x-13$ and $q(x) = 5 x^2+5 x-11$", + "Output Answer": [ + "$-25 x^4+30 x^3+45 x^2-186 x+143$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -5*x**2+11*x-13\nq = 5*x**2+5*x-11\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{96 x^2}{7}+\\frac{40 x}{7}+\\frac{15}{7}$", + "Output Answer": [ + "$x=\\frac{1}{24} \\left(-5-i \\sqrt{65}\\right)\\lor x=\\frac{1}{24} \\left(-5+i \\sqrt{65}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((96*x**2)/7)+((40*x)/7)+(15/7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -8 \\sqrt{3} x^2-8 \\sqrt{3} x+3 \\sqrt{3}$ and $q(x) = 7 \\sqrt{3} x^2+8 \\sqrt{3}$", + "Output Answer": [ + "$-168 x^4-168 x^3-129 x^2-192 x+72$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -8*sqrt(3)*x**2-8*sqrt(3)*x+3*sqrt(3)\nq = 7*sqrt(3)*x**2+8*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-2 x^2+3 x+5 y^2+5 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(y+\\frac{1}{2}\\right)^2-2 \\left(x-\\frac{3}{4}\\right)^2=\\frac{57}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{4} & -\\frac{1}{2}-\\frac{\\sqrt{\\frac{399}{5}}}{4} \\\\\n \\frac{3}{4} & \\frac{1}{20} \\left(\\sqrt{1995}-10\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{2}}$\nCenter: $\\left\\{\\frac{3}{4},\\frac{1}{2} \\left(-\\frac{1}{2}-\\frac{\\sqrt{\\frac{399}{5}}}{4}+\\frac{1}{20} \\left(\\sqrt{1995}-10\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{20} \\left(3 \\sqrt{10}-10\\right)-\\sqrt{\\frac{2}{5}} x,y=\\sqrt{\\frac{2}{5}} x+\\frac{1}{20} \\left(-10-3 \\sqrt{10}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x**2+3*x+5*y**2+5*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{44}{97}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=28$.", + "Output Answer": [ + "$\\frac{1232}{97}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (44/97) # initial value\nd = 0 # second term\nn = 28 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (44/97) # initial value\nd = 0 # second term\nn = 28 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-e^{-\\frac{19 i \\pi }{30}} \\pi$.", + "Output Answer": [ + "Norm: $\\pi$\nArgument: $\\frac{11 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.e**(-((19*i*math.pi)/30))*math.pi\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2-165 \\sqrt{3} x+1782$", + "Output Answer": [ + "$11 \\left(6 \\sqrt{3}-x\\right) \\left(9 \\sqrt{3}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2-165*sqrt(3)*x+1782, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{2 (5 x+4)}{\\sqrt{3}}, q(x) = \\frac{1}{3} (3 x+2)^2$", + "Output Answer": [ + "$3 x^2+\\frac{10 x}{\\sqrt{3}}+4 x+\\frac{8}{\\sqrt{3}}+\\frac{4}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((2*(5*x+4))/(sqrt(3)))\nq = (1/3)*(3*x+2)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{43 x}{3}-\\frac{28}{3}}+\\sqrt{\\frac{19}{3}-4 x}=\\frac{16}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-18451+160 \\sqrt{9573}}{2883}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((43*x)/3)-(28/3))+sqrt((19/3)-4*x), (16/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+55 x+1144$", + "Output Answer": [ + "$-11 (-x-8) (13-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+55*x+1144, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{3}{2}$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$-\\frac{57}{2}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(3/2) # initial value\nd = -8 # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(3/2) # initial value\nd = -8 # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -2 x-18| =3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{21}{2}\\right\\},\\left\\{x\\to -\\frac{15}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-2*x-18), 3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2-6 x-5 y^2-2 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x-\\frac{1}{3}\\right)^2-5 \\left(y+\\frac{1}{5}\\right)^2=\\frac{54}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{3}-\\frac{2 \\sqrt{21}}{5} & -\\frac{1}{5} \\\\\n \\frac{1}{3}+\\frac{2 \\sqrt{21}}{5} & -\\frac{1}{5} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{14}{5}}$\nCenter: $\\left\\{\\frac{1}{3},-\\frac{1}{5}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3 x}{\\sqrt{5}}+\\frac{1}{5} \\left(-1-\\sqrt{5}\\right),y=\\frac{1}{5} \\left(\\sqrt{5}-1\\right)-\\frac{3 x}{\\sqrt{5}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2-6*x-5*y**2-2*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{22 x^2}{\\sqrt{3}}+8 \\sqrt{3} x-\\frac{13}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{22 \\left(x+\\frac{6}{11}\\right)^2}{\\sqrt{3}}-\\frac{24 \\sqrt{3}}{11}-\\frac{13}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((22*x**2)/(math.sqrt(3)))+8*math.sqrt(3)*x-(13/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-x^2-11 x+14$", + "Output Answer": [ + "$\\frac{177}{4}-\\left(x+\\frac{11}{2}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-x**2-11*x+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-10 x^2-12 x$", + "Output Answer": [ + "$x=-\\frac{6}{5}\\lor x=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-10*x**2-12*x, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-18 x-20 y+25=0$, $3 x-9 y-23=0$", + "Output Answer": [ + "$x=\\frac{685}{222}$, $y=-\\frac{113}{74}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-18*x-20*y+25, 3*x-9*y-23), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (9 x+8)^4, q(x) = (1-8 x)^4$", + "Output Answer": [ + "$10657 x^4+21280 x^3+31488 x^2+18400 x+4097$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (9*x+8)**4\nq = (1-8*x)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2+10 \\sqrt{2} x+1680$", + "Output Answer": [ + "$-5 \\left(-x-12 \\sqrt{2}\\right) \\left(14 \\sqrt{2}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2+10*sqrt(2)*x+1680, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2 x^2-2 x+5$ and $4 x^5-x^4+3 x^2+2 x-4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2*x**2-2*x+5, 4*x**5-x**4+3*x**2+2*x-4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=7+7 i$ and $y=8+\\frac{17 i}{3}$", + "Output Answer": [ + "$-1+\\frac{4 i}{3}$" + ], + "Output Program": [ + "i = 1j\nx = 7+7*i\ny = 8+((17*i)/3)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=64 (8 t+15)^2, x(t)=-8 t-15$", + "Output Answer": [ + "$y=64 x^2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 64*(8*t+15)**2\nx_t = -8*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-5 \\sqrt{2} \\left(\\cos \\left(\\frac{17}{45}\\right)+i \\sin \\left(\\frac{17}{45}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$2500 \\left(\\cos \\left(\\frac{68}{45}\\right)+i \\sin \\left(\\frac{68}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-5*math.sqrt(2)*(math.cos((17/45))+1j*math.sin((17/45))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 \\sqrt{5} x^2-5 \\sqrt{5}$ and $q(x) = -6 \\sqrt{5} x^2+5 \\sqrt{5} x+2 \\sqrt{5}$", + "Output Answer": [ + "$-60 x^4+50 x^3+170 x^2-125 x-50$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*sqrt(5)*x**2-5*sqrt(5)\nq = -6*sqrt(5)*x**2+5*sqrt(5)*x+2*sqrt(5)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{9 x^2}{2}+12 x+\\frac{17}{2}$", + "Output Answer": [ + "$x=-\\frac{4}{3}-\\frac{i}{3}\\lor x=-\\frac{4}{3}+\\frac{i}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((9*x**2)/2)+12*x+(17/2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2-200 x+960$", + "Output Answer": [ + "$-10 (8-x) (x-12)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2-200*x+960, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-13 x-12}+\\sqrt{7-9 x}=5$", + "Output Answer": [ + "$\\{\\{x\\to -1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-13*x-12)+sqrt(7-9*x), 5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-15 x^2-9$", + "Output Answer": [ + "$-15 x^2-9$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-15*x**2-9), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-x^2-3 x-3$ and $-x^4-2 x^3+4 x^2-4 x+1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-x**2-3*x-3, -x**4-2*x**3+4*x**2-4*x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^4-10 x^3+8 x^2-6 x$ when divided by $7-5 x$.", + "Output Answer": [ + "$x^3+\\frac{17 x^2}{5}+\\frac{79 x}{25}+\\frac{703}{125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**4-10*x**3+8*x**2-6*x\nq = 7-5*x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-22 x+23 y-24=0$, $17 x-11=0$", + "Output Answer": [ + "$x=\\frac{11}{17}$, $y=\\frac{650}{391}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-22*x+23*y-24, 17*x-11), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -9 x^2+\\frac{7 x}{2}+\\frac{27}{2}$ and $q(x) = -6 x^2-2 x+1$", + "Output Answer": [ + "$54 x^4-3 x^3-97 x^2-\\frac{47 x}{2}+\\frac{27}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -9*x**2+((7*x)/2)+(27/2)\nq = -6*x**2-2*x+1\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$3 x-4 y+4=0$, $-21 x+6 y-18=0$", + "Output Answer": [ + "$x=-\\frac{8}{11}$, $y=\\frac{5}{11}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((3*x-4*y+4, -21*x+6*y-18), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(-\\cos \\left(\\frac{\\pi }{15}\\right)+i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$3125 \\left(-\\frac{1}{2}+\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(-math.cos((math.pi/15))+1j*math.sin((math.pi/15))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6-\\frac{104 x}{7}}+\\sqrt{\\frac{15}{7}-7 x}=\\frac{79}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-944478+158 \\sqrt{31612406}}{21175}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6-((104*x)/7))+sqrt((15/7)-7*x), (79/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{21 x^2}{5}-\\frac{21 x}{5}-\\frac{47}{5}$ and $q(x) = \\frac{38 x^2}{5}+\\frac{12 x}{5}+\\frac{53}{5}$", + "Output Answer": [ + "$\\frac{798 x^4}{25}-\\frac{546 x^3}{25}-37 x^2-\\frac{1677 x}{25}-\\frac{2491}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((21*x**2)/5)-((21*x)/5)-(47/5)\nq = ((38*x**2)/5)+((12*x)/5)+(53/5)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 2 \\sqrt{5} x+3 \\sqrt{5}\\right| =\\sqrt{5}$", + "Output Answer": [ + "$\\{\\{x\\to -2\\},\\{x\\to -1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(2*sqrt(5)*x+3*sqrt(5)), sqrt(5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2-26 x+84$", + "Output Answer": [ + "$-2 (6-x) (x-7)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2-26*x+84, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$2 \\sqrt{2} e^{7 x+8} \\sqrt{-x}$", + "Output Answer": [ + "$0\\leq y\\leq \\frac{2 e^{15/2}}{\\sqrt{7}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(2*sqrt(2)*math.e**(7*x+8)*sqrt(-x), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{35 x^4}{4}-\\frac{7 x^3}{4}+\\frac{x^2}{2}+\\frac{53 x}{2}+15$ and $-\\frac{5 x^2}{2}-3 x-5$.", + "Output Answer": [ + "$\\frac{5 x^2}{4}+\\frac{3 x}{2}+\\frac{5}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((35*x**4)/4)-((7*x**3)/4)+((x**2)/2)+((53*x)/2)+15, -((5*x**2)/2)-3*x-5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2-3 x-10 y^2+4 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $\\left(x-\\frac{3}{2}\\right)^2-10 \\left(y-\\frac{1}{5}\\right)^2=-\\frac{23}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{2} & \\frac{1}{20} \\left(4-\\sqrt{506}\\right) \\\\\n \\frac{3}{2} & \\frac{1}{20} \\left(4+\\sqrt{506}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{11}$\nCenter: $\\left\\{\\frac{3}{2},\\frac{1}{2} \\left(\\frac{1}{20} \\left(4-\\sqrt{506}\\right)+\\frac{1}{20} \\left(4+\\sqrt{506}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{20} \\left(4+3 \\sqrt{10}\\right)-\\frac{x}{\\sqrt{10}},y=\\frac{x}{\\sqrt{10}}+\\frac{1}{20} \\left(4-3 \\sqrt{10}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-3*x-10*y**2+4*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{1}{36}$, and $a_n=a_{n-1}+\\frac{7}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$8 \\left(35 \\sqrt{3}-\\frac{1}{18}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(1/36) # initial value\nd = (7/(math.sqrt(3))) # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(1/36) # initial value\nd = (7/(math.sqrt(3))) # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(11-24)+\\left(\\left(\\left(\\frac{9}{14}+15\\right)+4\\right)-4\\right)^2$.", + "Output Answer": [ + "$\\frac{45413}{196}$" + ], + "Output Program": [ + "try: \n print((11-24)+((((9/14)+15)+4)-4)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\cos \\left(\\frac{\\pi }{9}\\right)-i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)^2$", + "Output Answer": [ + "$\\cos \\left(\\frac{2 \\pi }{9}\\right)+i \\sin \\left(\\frac{2 \\pi }{9}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-math.cos((math.pi/9))-1j*math.sin((math.pi/9)))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{682 x^3}{3}+\\frac{500 x^2}{3}-\\frac{760 x}{3}-\\frac{224}{3}}{\\frac{616}{3}-\\frac{682 x}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{11} \\left(-9-\\sqrt{37}\\right)\\right\\},\\left\\{x\\to \\frac{1}{11} \\left(-9+\\sqrt{37}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((682*x**3)/3)+((500*x**2)/3)-((760*x)/3)-(224/3))/((616/3)-((682*x)/3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(\\cos \\left(\\frac{2}{45}\\right)+i \\sin \\left(\\frac{2}{45}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$16 \\left(\\cos \\left(\\frac{8}{45}\\right)+i \\sin \\left(\\frac{8}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(math.cos((2/45))+1j*math.sin((2/45))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$1-\\sqrt[3]{4-7 x}$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = 1-cbrt(4-7*x)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -x^2+12 x-4$ and $q(x) = 5 x^2-6 x-11$", + "Output Answer": [ + "$-5 x^4+66 x^3-81 x^2-108 x+44$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -x**2+12*x-4\nq = 5*x**2-6*x-11\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{25}{3} e^{-\\frac{3 i \\pi }{5}}$.", + "Output Answer": [ + "Norm: $\\frac{25}{3}$\nArgument: $-\\frac{3 \\pi }{5}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (25/3)*math.e**(-((3*i*math.pi)/5))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-9 \\sqrt{2} x-4 \\sqrt{2} y-14 \\sqrt{2} z-17 \\sqrt{2}=0$, $11 \\sqrt{2} x+12 \\sqrt{2} y+13 \\sqrt{2} z+15 \\sqrt{2}=0$, $4 \\sqrt{2} x+9 \\sqrt{2} y-17 \\sqrt{2} z-10 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{1387}{1219}$, $y=\\frac{558}{1219}$, $z=-\\frac{748}{1219}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-9*sqrt(2)*x-4*sqrt(2)*y-14*sqrt(2)*z-17*sqrt(2), 11*sqrt(2)*x+12*sqrt(2)*y+13*sqrt(2)*z+15*sqrt(2), 4*sqrt(2)*x+9*sqrt(2)*y-17*sqrt(2)*z-10*sqrt(2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{56 x^4}{9}+\\frac{28 x^3}{9}-\\frac{14 x^2}{9}+\\frac{70 x}{9}-\\frac{98}{9}$ and $\\frac{4 x^4}{3}-\\frac{2 x^3}{3}+\\frac{x^2}{3}-\\frac{5 x}{3}+\\frac{7}{3}$.", + "Output Answer": [ + "$\\frac{4 x^4}{9}-\\frac{2 x^3}{9}+\\frac{x^2}{9}-\\frac{5 x}{9}+\\frac{7}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((56*x**4)/9)+((28*x**3)/9)-((14*x**2)/9)+((70*x)/9)-(98/9), ((4*x**4)/3)-((2*x**3)/3)+((x**2)/3)-((5*x)/3)+(7/3)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $9 x^3-45 x^2-729 x+3645$", + "Output Answer": [ + "$-9 (-x-9) (x-9) (x-5)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(9*x**3-45*x**2-729*x+3645, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 12 (2 x+1)^2, q(x) = 3 (5 x+2)^2$", + "Output Answer": [ + "$123 x^2+108 x+24$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 12*(2*x+1)**2\nq = 3*(5*x+2)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{22 x^2}{\\sqrt{3}}+\\frac{2 x}{\\sqrt{3}}-\\frac{35}{\\sqrt{3}}\\right| =-4 \\sqrt{3}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((22*x**2)/(sqrt(3)))+((2*x)/(sqrt(3)))-(35/(sqrt(3)))), -4*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $12 x^2-2 x+9$", + "Output Answer": [ + "$x=\\frac{1}{12} \\left(1-i \\sqrt{107}\\right)\\lor x=\\frac{1}{12} \\left(1+i \\sqrt{107}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(12*x**2-2*x+9, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 8 x-22| =2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5}{2}\\right\\},\\{x\\to 3\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(8*x-22), 2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $6 x^2+x+1$", + "Output Answer": [ + "$x=\\frac{1}{12} \\left(-1-i \\sqrt{23}\\right)\\lor x=\\frac{1}{12} \\left(-1+i \\sqrt{23}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(6*x**2+x+1, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((((12+7)-19)+8)+11)-((((18-16)-16)-15)+1)^2$.", + "Output Answer": [ + "$-765$" + ], + "Output Program": [ + "try: \n print(((((12+7)-19)+8)+11)-((((18-16)-16)-15)+1)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| x-8| =23$", + "Output Answer": [ + "$\\{\\{x\\to -15\\},\\{x\\to 31\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(x-8), 23), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{8} \\left(7 t^2-294 t+3061\\right)^2, x(t)=\\frac{t^2}{2}-21 t+\\frac{441}{2}$", + "Output Answer": [ + "$y=\\frac{49 x^2}{2}-91 x+\\frac{169}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/8)*(7*t**2-294*t+3061)**2\nx_t = ((t**2)/2)-21*t+(441/2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((3-2)+25) \\left(((12-18)-8)^2-17\\right)$.", + "Output Answer": [ + "$4654$" + ], + "Output Program": [ + "try: \n print(((3-2)+25)*(((12-18)-8)**2-17))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $-\\sqrt[3]{2 x-8} \\sqrt[3]{\\tanh \\left(2-7 x^4\\right)}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to 4\\},\\left\\{x\\to -\\sqrt[4]{\\frac{2}{7}}\\right\\},\\left\\{x\\to \\sqrt[4]{\\frac{2}{7}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(-cbrt(2*x-8)*cbrt(tanh*(2-7*x**4)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{8}{43}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$-\\frac{64}{43}$" + ], + "Output Program": [ + "a = -(8/43) # initial value\nd = 0 # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(8/43) # initial value\nd = 0 # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2-5 x+4 y^2-4 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(y-\\frac{1}{2}\\right)^2-7 \\left(x+\\frac{5}{14}\\right)^2=\\frac{115}{28}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{14} & \\frac{1}{2}-\\frac{\\sqrt{1265}}{28} \\\\\n -\\frac{5}{14} & \\frac{1}{28} \\left(14+\\sqrt{1265}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{11}{7}}$\nCenter: $\\left\\{-\\frac{5}{14},\\frac{1}{2} \\left(\\frac{1}{2}-\\frac{\\sqrt{1265}}{28}+\\frac{1}{28} \\left(14+\\sqrt{1265}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{28} \\left(14-5 \\sqrt{7}\\right)-\\frac{\\sqrt{7} x}{2},y=\\frac{\\sqrt{7} x}{2}+\\frac{1}{28} \\left(14+5 \\sqrt{7}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2-5*x+4*y**2-4*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{14}{25}$, and $a_n=a_{n-1}+-9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$-\\frac{3459}{25}$" + ], + "Output Program": [ + "a = -(14/25) # initial value\nd = -9 # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(14/25) # initial value\nd = -9 # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x-6$ and $-3$.", + "Output Answer": [ + "$3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x-6, -3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt[3]{2-6 x} \\tan ^{-1}(6-7 x)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3}\\right\\},\\left\\{x\\to \\frac{6}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(cbrt(2-6*x)*atan(6-7*x), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{11}{15}$, and $a_n=a_{n-1}+-\\frac{11}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{27}{2} \\left(\\frac{22}{15}-\\frac{286}{\\sqrt{5}}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (11/15) # initial value\nd = -(11/(math.sqrt(5))) # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (11/15) # initial value\nd = -(11/(math.sqrt(5))) # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{4 x^3-72 x^2+140 x-72}{-12 x^2+36 x-24}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(17-\\sqrt{217}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(17+\\sqrt{217}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((4*x**3-72*x**2+140*x-72)/(-12*x**2+36*x-24)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$4 x-25 y-14=0$, $-19 x+23 y-16=0$", + "Output Answer": [ + "$x=-\\frac{722}{383}$, $y=-\\frac{330}{383}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((4*x-25*y-14, -19*x+23*y-16), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^5+7 x^4-10 x^3+x^2+5 x-6$ when divided by $-3 x^5-3 x^4-5 x^3-6 x^2-9 x-2$.", + "Output Answer": [ + "$\\frac{4}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**5+7*x**4-10*x**3+x**2+5*x-6\nq = -3*x**5-3*x**4-5*x**3-6*x**2-9*x-2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $-\\tan ^{-1}\\left(\\sqrt[3]{7} \\sqrt[3]{x}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$-\\frac{1}{7} \\tan ^3(y)\\text{ if }0 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$-74$" + ], + "Output Program": [ + "a = -(1/2) # initial value\nd = -(5/2) # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(1/2) # initial value\nd = -(5/2) # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2 e^{1+\\frac{14 i \\pi }{15}}$.", + "Output Answer": [ + "Norm: $2 e$\nArgument: $\\frac{14 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2*math.e**(1+((14*i*math.pi)/15))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sin ^{-1}\\left(\\sqrt[3]{-\\frac{x}{2}-3}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$-2 \\sin ^3(y)-6\\text{ if }0 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$10 \\left(38 \\sqrt{2}-\\frac{89}{25}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(89/50) # initial value\nd = 2*math.sqrt(2) # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(89/50) # initial value\nd = 2*math.sqrt(2) # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -17 x-18| =2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{20}{17}\\right\\},\\left\\{x\\to -\\frac{16}{17}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-17*x-18), 2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{41}{7}-\\frac{87 x}{7}\\right| =13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{50}{87}\\right\\},\\left\\{x\\to \\frac{44}{29}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs((41/7)-((87*x)/7)), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{29 x^2}{3}-4 x+13$", + "Output Answer": [ + "$\\frac{29}{3} \\left(x-\\frac{6}{29}\\right)^2+\\frac{365}{29}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((29*x**2)/3)-4*x+13), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(((21+15)-5)^2+3\\right)+5\\right) \\left(\\left(\\left((16+24)^2+17\\right)+17\\right)+11\\right)$.", + "Output Answer": [ + "$1594005$" + ], + "Output Program": [ + "try: \n print(((((21+15)-5)**2+3)+5)*((((16+24)**2+17)+17)+11))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -2 x^2-7 x+10$, $q(x) = 4 \\left(x^2-3 x-3\\right)$", + "Output Answer": [ + "$2 x^2-19 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**2-7*x+10\nq = 4*(x**2-3*x-3)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$18 x+\\frac{65 y}{3}-19 z-\\frac{67}{3}=0$, $-25 x+\\frac{11 y}{3}+\\frac{55 z}{3}+\\frac{38}{3}=0$, $-14 x-14 y-\\frac{70 z}{3}-\\frac{70}{3}=0$", + "Output Answer": [ + "$x=-\\frac{4766}{21933}$, $y=\\frac{1433}{4874}$, $z=-\\frac{15295}{14622}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((18*x+((65*y)/3)-19*z-(67/3), -25*x+((11*y)/3)+((55*z)/3)+(38/3), -14*x-14*y-((70*z)/3)-(70/3))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{4} (1-5 t)^2, x(t)=5 t-15$", + "Output Answer": [ + "$y=\\frac{x^2}{4}+7 x+49$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/4)*(1-5*t)**2\nx_t = 5*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{25 x^2}{e}+\\frac{6 x}{e}+\\frac{10}{e}$ and $q(x) = \\frac{31 x^2}{e}+\\frac{11 x}{e}-\\frac{1}{e}$", + "Output Answer": [ + "$-\\frac{775 x^4}{e^2}-\\frac{89 x^3}{e^2}+\\frac{401 x^2}{e^2}+\\frac{104 x}{e^2}-\\frac{10}{e^2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -((25*x**2)/math.e)+((6*x)/math.e)+(10/math.e)\nq = ((31*x**2)/math.e)+((11*x)/math.e)-(1/math.e)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2+\\frac{904 x}{5}-1008$", + "Output Answer": [ + "$-8 \\left(x-\\frac{63}{5}\\right) (x-10)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2+((904*x)/5)-1008, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $10 x^2-\\frac{13 x}{3}-\\frac{14}{3}$", + "Output Answer": [ + "$x=\\frac{14}{15}\\lor x=-\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(10*x**2-((13*x)/3)-(14/3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left((13-14)^2-1\\right)-((10-25)-20)$.", + "Output Answer": [ + "$35$" + ], + "Output Program": [ + "try: \n print(((13-14)**2-1)-((10-25)-20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{3 x^2}{5}+\\frac{53 x}{5}+\\frac{66}{5}$", + "Output Answer": [ + "$\\frac{3601}{60}-\\frac{3}{5} \\left(x-\\frac{53}{6}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((3*x**2)/5)+((53*x)/5)+(66/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(2+12)+(21-8)$.", + "Output Answer": [ + "$27$" + ], + "Output Program": [ + "try: \n print((2+12)+(21-8))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $7 x^2+\\frac{25 x}{2}+\\frac{29}{2}$", + "Output Answer": [ + "$x=\\frac{1}{28} \\left(-25-3 i \\sqrt{111}\\right)\\lor x=\\frac{1}{28} \\left(-25+3 i \\sqrt{111}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(7*x**2+((25*x)/2)+(29/2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sinh \\left(\\sin ^{-1}(5-6 x)\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{6} \\left(5-\\sin \\left(\\sinh ^{-1}(y)\\right)\\right)\\text{ if }-\\sinh \\left(\\frac{\\pi }{2}\\right)\\leq y\\leq \\sinh \\left(\\frac{\\pi }{2}\\right)$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, sinh(asin(5-6*x)))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{1}{10} \\left(\\frac{1}{8} ((6+2)+19)\\right)-(((25-23)-15)-3)$.", + "Output Answer": [ + "$\\frac{1307}{80}$" + ], + "Output Program": [ + "try: \n print((1/10)*((1/8)*((6+2)+19))-(((25-23)-15)-3))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-12 x^2-10 x+10}{5 x^2+18 x+12}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(-5-\\sqrt{145}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(-5+\\sqrt{145}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-12*x**2-10*x+10)/(5*x**2+18*x+12)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^4+\\frac{13 x^3}{2}+x^2-\\frac{11 x}{2}+2$ when divided by $6 x+4$.", + "Output Answer": [ + "$\\frac{7 x^3}{6}+\\frac{11 x^2}{36}-\\frac{x}{27}-\\frac{289}{324}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**4+((13*x**3)/2)+x**2-((11*x)/2)+2\nq = 6*x+4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^6+3 x^5+6 x^4-9 x^3+3 x^2+9 x+7$ when divided by $4 x^2+2 x-9$.", + "Output Answer": [ + "$-x^4+\\frac{5 x^3}{4}-\\frac{11 x^2}{8}+\\frac{5 x}{4}-\\frac{95}{32}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**6+3*x**5+6*x**4-9*x**3+3*x**2+9*x+7\nq = 4*x**2+2*x-9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 4 x+11| =3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{2}\\right\\},\\{x\\to -2\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(4*x+11), 3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2-16 \\sqrt{2} x-336$", + "Output Answer": [ + "$2 \\left(-x-6 \\sqrt{2}\\right) \\left(14 \\sqrt{2}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2-16*sqrt(2)*x-336, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{34 x}{5}-\\frac{64}{5}}+\\sqrt{\\frac{32}{5}-\\frac{3 x}{5}}=\\frac{66}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-176052+264 \\sqrt{160678}}{4805}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((34*x)/5)-(64/5))+sqrt((32/5)-((3*x)/5)), (66/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{43 x}{3}-\\frac{20 y}{3}-21 z-\\frac{71}{3}=0$, $\\frac{53 x}{3}+21 y+11 z+18=0$, $-\\frac{70 y}{3}+\\frac{17 z}{3}-11=0$", + "Output Answer": [ + "$x=\\frac{92748}{106367}$, $y=-\\frac{87857}{106367}$, $z=-\\frac{155287}{106367}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((43*x)/3)-((20*y)/3)-21*z-(71/3), ((53*x)/3)+21*y+11*z+18, -((70*y)/3)+((17*z)/3)-11)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{8 x^2}{\\sqrt{3}}+\\frac{7 x}{\\sqrt{3}}-\\frac{7}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{16} \\left(-7-\\sqrt{273}\\right)\\lor x=\\frac{1}{16} \\left(\\sqrt{273}-7\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((8*x**2)/(sqrt(3)))+((7*x)/(sqrt(3)))-(7/(sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sqrt[3]{-\\frac{11 x}{2}-\\frac{9}{2}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{11} \\left(-2 y^3-9\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, cbrt(-((11*x)/2)-(9/2)))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+6 x-2 y^2+3 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x+\\frac{1}{3}\\right)^2-2 \\left(y-\\frac{3}{4}\\right)^2=\\frac{79}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{12} \\left(-4-\\sqrt{869}\\right) & \\frac{3}{4} \\\\\n \\frac{1}{12} \\left(\\sqrt{869}-4\\right) & \\frac{3}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{11}{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{12} \\left(-4-\\sqrt{869}\\right)+\\frac{1}{12} \\left(\\sqrt{869}-4\\right)\\right),\\frac{3}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3 x}{\\sqrt{2}}+\\frac{1}{4} \\left(3+2 \\sqrt{2}\\right),y=-\\frac{3 x}{\\sqrt{2}}-\\frac{1}{\\sqrt{2}}+\\frac{3}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+6*x-2*y**2+3*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-10 x-5}+\\sqrt{15-9 x}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -951+14 \\sqrt{4605}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-10*x-5)+sqrt(15-9*x), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{16 x}{3}+\\frac{10}{3}}+\\sqrt{\\frac{23 x}{3}-\\frac{29}{3}}=\\frac{37}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{147} \\left(54210-74 \\sqrt{518366}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((16*x)/3)+(10/3))+sqrt(((23*x)/3)-(29/3)), (37/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(\\cos \\left(\\frac{56}{45}\\right)+i \\sin \\left(\\frac{56}{45}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-40353607 \\left(\\cos \\left(\\frac{56}{5}\\right)+i \\sin \\left(\\frac{56}{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(math.cos((56/45))+1j*math.sin((56/45))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 13 x^2+12 x-25\\right| =-13$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(13*x**2+12*x-25), -13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-18 \\sqrt{2} x-9 \\sqrt{2} y-13 \\sqrt{2} z=0$, $12 \\sqrt{2} x-\\sqrt{2} y-2 \\sqrt{2} z-16 \\sqrt{2}=0$, $-16 \\sqrt{2} x-16 \\sqrt{2} z+14 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{1187}{1048}$, $y=-\\frac{248}{131}$, $z=-\\frac{135}{524}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-18*sqrt(2)*x-9*sqrt(2)*y-13*sqrt(2)*z, 12*sqrt(2)*x-sqrt(2)*y-2*sqrt(2)*z-16*sqrt(2), -16*sqrt(2)*x-16*sqrt(2)*z+14*sqrt(2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{7}{2} e^{-\\frac{79 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $\\frac{7}{2}$\nArgument: $-\\frac{79 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (7/2)*math.e**(-((79*i*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 x^2+4 x+1$", + "Output Answer": [ + "$\\frac{7}{3}-3 \\left(x-\\frac{2}{3}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*x**2+4*x+1), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{3}{8}$, and $a_n=a_{n-1}+\\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$\\frac{13}{2} \\left(\\frac{3}{4}+12 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\na = (3/8) # initial value\nd = math.sqrt(3) # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (3/8) # initial value\nd = math.sqrt(3) # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2-220 x+1170$", + "Output Answer": [ + "$10 (x-13) (x-9)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2-220*x+1170, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((((7-5)+19)+6)+25) (13+21)$.", + "Output Answer": [ + "$1768$" + ], + "Output Program": [ + "try: \n print(((((7-5)+19)+6)+25)*(13+21))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-8 x+14 y-z+5=0$, $24 x-17 y-15 z+20=0$, $-2 x-18 y+23 z+15=0$", + "Output Answer": [ + "$x=-\\frac{6395}{777}$, $y=-\\frac{1415}{259}$, $z=-\\frac{4385}{777}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-8*x+14*y-z+5, 24*x-17*y-15*z+20, -2*x-18*y+23*z+15)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2+7 x-7 y^2+6 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(x+\\frac{7}{4}\\right)^2-7 \\left(y-\\frac{3}{7}\\right)^2=\\frac{775}{56}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{7}{4}-\\frac{15 \\sqrt{31}}{28} & \\frac{3}{7} \\\\\n \\frac{15 \\sqrt{31}}{28}-\\frac{7}{4} & \\frac{3}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{7}}$\nCenter: $\\left\\{-\\frac{7}{4},\\frac{3}{7}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{2}{7}} x+\\frac{1}{28} \\left(12+7 \\sqrt{14}\\right),y=\\frac{1}{28} \\left(12-7 \\sqrt{14}\\right)-\\sqrt{\\frac{2}{7}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2+7*x-7*y**2+6*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((12+17)-11)-4) (24+7)$.", + "Output Answer": [ + "$434$" + ], + "Output Program": [ + "try: \n print((((12+17)-11)-4)*(24+7))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^5+3 x^4+8 x^3-4 x^2+3 x+4$ when divided by $-2$.", + "Output Answer": [ + "$2 x^5-\\frac{3 x^4}{2}-4 x^3+2 x^2-\\frac{3 x}{2}-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**5+3*x**4+8*x**3-4*x**2+3*x+4\nq = -2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt{x+4}+e^{4 x-4}$", + "Output Answer": [ + "$x\\geq -4$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sqrt(x+4)+math.e**(4*x-4)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2-6 x+8 y^2-3 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y-\\frac{3}{16}\\right)^2-10 \\left(x+\\frac{3}{10}\\right)^2=-\\frac{1379}{160}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{80} \\left(8+\\sqrt{1379}\\right) & \\frac{3}{16} \\\\\n \\frac{3}{80} \\left(\\sqrt{1379}-8\\right) & \\frac{3}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{3}{80} \\left(\\sqrt{1379}-8\\right)-\\frac{3}{80} \\left(8+\\sqrt{1379}\\right)\\right),\\frac{3}{16}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{5} x}{2}+\\frac{3}{80} \\left(5+4 \\sqrt{5}\\right),y=-\\frac{\\sqrt{5} x}{2}-\\frac{3}{80} \\left(4 \\sqrt{5}-5\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2-6*x+8*y**2-3*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{27 x^3}{7}+\\frac{138 x^2}{7}+\\frac{18 x}{7}-\\frac{165}{7}}{-\\frac{46 x^2}{7}+\\frac{389 x}{7}-\\frac{795}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(1-\\sqrt{397}\\right)\\right\\},\\left\\{x\\to \\frac{1}{18} \\left(1+\\sqrt{397}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((27*x**3)/7)+((138*x**2)/7)+((18*x)/7)-(165/7))/(-((46*x**2)/7)+((389*x)/7)-(795/7))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -64 (x+1)^3, q(x) = 9 (x-1)^2$", + "Output Answer": [ + "$-64 x^3-183 x^2-210 x-55$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -64*(x+1)**3\nq = 9*(x-1)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{\\cos \\left(\\frac{7 \\pi }{90}\\right)-i \\sin \\left(\\frac{7 \\pi }{90}\\right)}{\\sqrt{2}}\\right)^12$", + "Output Answer": [ + "$\\frac{1}{64} \\left(-\\cos \\left(\\frac{\\pi }{15}\\right)-i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((math.cos(((7*math.pi)/90))-1j*math.sin(((7*math.pi)/90)))/(math.sqrt(2))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{19 x^2}{2}+\\frac{17 x}{2}+10$", + "Output Answer": [ + "$x=\\frac{1}{38} \\left(17-3 \\sqrt{201}\\right)\\lor x=\\frac{1}{38} \\left(17+3 \\sqrt{201}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((19*x**2)/2)+((17*x)/2)+10, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{13}{4} e^{\\frac{7 i \\pi }{9}}$.", + "Output Answer": [ + "Norm: $\\frac{13}{4}$\nArgument: $-\\frac{2 \\pi }{9}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(13/4)*math.e**((7*i*math.pi)/9)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -9 x^2+21 x-7\\right| =7$", + "Output Answer": [ + "$\\left\\{\\{x\\to 0\\},\\left\\{x\\to \\frac{7}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-9*x**2+21*x-7), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^6-3 x^5-2 x^4+8 x^3+4 x^2-3 x-1$ when divided by $9 x^3+x^2+3 x+8$.", + "Output Answer": [ + "$x^3-\\frac{4 x^2}{9}-\\frac{41 x}{81}+\\frac{149}{729}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**6-3*x**5-2*x**4+8*x**3+4*x**2-3*x-1\nq = 9*x**3+x**2+3*x+8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 12 \\sqrt{2} x-4 \\sqrt{2}\\right| =6 \\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{6}\\right\\},\\left\\{x\\to \\frac{5}{6}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(12*sqrt(2)*x-4*sqrt(2)), 6*sqrt(2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $6 x^2-x-13$", + "Output Answer": [ + "$6 \\left(x-\\frac{1}{12}\\right)^2-\\frac{313}{24}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (6*x**2-x-13), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{14-4 i}{\\sqrt{\\pi }}$ and $y=\\frac{13+11 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{226+102 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((14-4*i)/(math.sqrt(math.pi)))\ny = ((13+11*i)/(math.sqrt(math.pi)))\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left((14-4)^2-7\\right) \\left(\\left(\\left(\\frac{9}{20}-5\\right)^2+14\\right)^2+8\\right)^2$.", + "Output Answer": [ + "$\\frac{3498782750680462653}{25600000000}$" + ], + "Output Program": [ + "try: \n print(((14-4)**2-7)*((((9/20)-5)**2+14)**2+8)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = x-7, q(x) = -8 (x-2)^3$", + "Output Answer": [ + "$-8 x^3+48 x^2-95 x+57$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x-7\nq = -8*(x-2)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-112 x^2-12 x+10}{-112 x^2-292 x-90}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-112*x**2-12*x+10)/(-112*x**2-292*x-90)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(6+20)+(6+21)$.", + "Output Answer": [ + "$53$" + ], + "Output Program": [ + "try: \n print((6+20)+(6+21))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=35 t-74, x(t)=7 t-15$", + "Output Answer": [ + "$y=5 x+1$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 35*t-74\nx_t = 7*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2-8 x+8 y^2-2 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $3 \\left(x-\\frac{4}{3}\\right)^2+8 \\left(y-\\frac{1}{8}\\right)^2=\\frac{299}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{4}{3}-\\frac{\\sqrt{1495}}{24} & \\frac{1}{8} \\\\\n \\frac{1}{24} \\left(32+\\sqrt{1495}\\right) & \\frac{1}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{5}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{4}{3}-\\frac{\\sqrt{1495}}{24}+\\frac{1}{24} \\left(32+\\sqrt{1495}\\right)\\right),\\frac{1}{8}\\right\\}$\nArea Enclosed: $\\frac{299 \\pi }{48 \\sqrt{6}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2-8*x+8*y**2-2*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(\\cos \\left(\\frac{19 \\pi }{90}\\right)-i \\sin \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$625 \\left(-\\cos \\left(\\frac{7 \\pi }{45}\\right)-i \\sin \\left(\\frac{7 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(math.cos(((19*math.pi)/90))-1j*math.sin(((19*math.pi)/90))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{63}{11}$, and $a_n=a_{n-1}+-3 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$\\frac{13}{2} \\left(-\\frac{126}{11}-36 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(63/11) # initial value\nd = -3*math.sqrt(2) # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(63/11) # initial value\nd = -3*math.sqrt(2) # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{2}{3} \\left(\\left(-\\frac{1}{2}+\\frac{i}{2}\\right) \\sqrt{\\frac{3}{2}}-\\frac{\\frac{1}{2}+\\frac{i}{2}}{\\sqrt{2}}\\right)$.", + "Output Answer": [ + "Norm: $\\frac{2}{3} \\sqrt{\\left(-\\frac{\\sqrt{\\frac{3}{2}}}{2}-\\frac{1}{2 \\sqrt{2}}\\right)^2+\\left(\\frac{\\sqrt{\\frac{3}{2}}}{2}-\\frac{1}{2 \\sqrt{2}}\\right)^2}$\nArgument: $\\tan ^{-1}\\left(\\frac{\\frac{1}{2 \\sqrt{2}}-\\frac{\\sqrt{\\frac{3}{2}}}{2}}{\\frac{\\sqrt{\\frac{3}{2}}}{2}+\\frac{1}{2 \\sqrt{2}}}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(2/3)*((-(1/2)+(i/2))*math.sqrt((3/2))-(((1/2)+(i/2))/(math.sqrt(2))))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-x^5-9 x^4-5 x^3-6 x^2-9 x-2$ when divided by $6 x^4-7 x^3-9 x^2+8 x+7$.", + "Output Answer": [ + "$-\\frac{x}{6}-\\frac{61}{36}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**5-9*x**4-5*x**3-6*x**2-9*x-2\nq = 6*x**4-7*x**3-9*x**2+8*x+7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{29}{11}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$-\\frac{116}{11}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(29/11) # initial value\nd = 0 # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(29/11) # initial value\nd = 0 # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{4 x}{\\sqrt{3}}+\\sqrt{3}\\right| =\\frac{17}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\{x\\to -5\\},\\left\\{x\\to \\frac{7}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((4*x)/(sqrt(3)))+sqrt(3)), (17/(sqrt(3)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(7+i) \\sqrt{2}$ and $y=(-6-4 i) \\sqrt{2}$", + "Output Answer": [ + "$(1-3 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (7+i)*math.sqrt(2)\ny = (-6-4*i)*math.sqrt(2)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=12 \\left(3 t^2-54 t+244\\right)^2, x(t)=3 t^2-54 t+243$", + "Output Answer": [ + "$y=12 x^2+24 x+12$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 12*(3*t**2-54*t+244)**2\nx_t = 3*t**2-54*t+243\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{\\sqrt{80}}-\\sqrt{116}$.", + "Output Answer": [ + "$2 \\left(\\sqrt[4]{5}-\\sqrt{29}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(sqrt(80))-sqrt(116))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=2 t-4 \\sqrt{2}-21, x(t)=\\sqrt{2} t-\\frac{21}{\\sqrt{2}}$", + "Output Answer": [ + "$y=\\sqrt{2} x-4 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 2*t-4*sqrt(2)-21\nx_t = sqrt(2)*t-(21/(sqrt(2)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 2 (x+2), q(x) = -(x+6)^3$", + "Output Answer": [ + "$-x^3-18 x^2-106 x-212$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*(x+2)\nq = -(x+6)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-12 x^2-11 x+11$", + "Output Answer": [ + "$\\frac{649}{48}-12 \\left(x+\\frac{11}{24}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-12*x**2-11*x+11), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{89}{49}$, and $a_n=a_{n-1}+-3 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$\\frac{15}{2} \\left(\\frac{178}{49}-42 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (89/49) # initial value\nd = -3*math.pi # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (89/49) # initial value\nd = -3*math.pi # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -17 x-3| =21$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{24}{17}\\right\\},\\left\\{x\\to \\frac{18}{17}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-17*x-3), 21), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$7 x+5 y-5 z-7=0$, $-5 x-11 y-22 z+18=0$, $-10 x+9 y-4 z-17=0$", + "Output Answer": [ + "$x=-\\frac{661}{3469}$, $y=\\frac{5847}{3469}$, $z=\\frac{65}{3469}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((7*x+5*y-5*z-7, -5*x-11*y-22*z+18, -10*x+9*y-4*z-17)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-6 x-14 y-19 z-12=0$, $-9 x-13 y-19 z+3=0$, $15 x-21 y-3 z-25=0$", + "Output Answer": [ + "$x=\\frac{1229}{192}$, $y=\\frac{269}{64}$, $z=-\\frac{23}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-6*x-14*y-19*z-12, -9*x-13*y-19*z+3, 15*x-21*y-3*z-25)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{41}{61}$, and $a_n=a_{n-1}+\\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{11}{2} \\left(10 \\sqrt{2}-\\frac{82}{61}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(41/61) # initial value\nd = math.sqrt(2) # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(41/61) # initial value\nd = math.sqrt(2) # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^3-19 x^2-15 x+5$ and $4 x-1$.", + "Output Answer": [ + "$4 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**3-19*x**2-15*x+5, 4*x-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^6+2 x^5-3 x^4+10 x^3+2 x^2-7 x+3$ when divided by $3 x^5+5 x^4-8 x^3-9 x^2+4 x+4$.", + "Output Answer": [ + "$\\frac{2 x}{3}-\\frac{4}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**6+2*x**5-3*x**4+10*x**3+2*x**2-7*x+3\nq = 3*x**5+5*x**4-8*x**3-9*x**2+4*x+4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -512 (x+1)^3, q(x) = (7 x+2)^3$", + "Output Answer": [ + "$-169 x^3-1242 x^2-1452 x-504$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -512*(x+1)**3\nq = (7*x+2)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 9 x^2-5 x+9$ and $q(x) = 8 x-11 x^2$", + "Output Answer": [ + "$-99 x^4+127 x^3-139 x^2+72 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 9*x**2-5*x+9\nq = 8*x-11*x**2\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^3-8 x^2+4 x+5$ when divided by $-5 x^3-2 x^2+x+5$.", + "Output Answer": [ + "$-\\frac{7}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**3-8*x**2+4*x+5\nq = -5*x**3-2*x**2+x+5\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 16 (2 x+1)^2, q(x) = (7 x+8)^3$", + "Output Answer": [ + "$343 x^3+1240 x^2+1408 x+528$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 16*(2*x+1)**2\nq = (7*x+8)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $15 \\frac{1}{1}+(10-4)$.", + "Output Answer": [ + "$21$" + ], + "Output Program": [ + "try: \n print(15*(1/1)+(10-4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-4 \\sqrt{2} x+12 \\sqrt{2} y-7 \\sqrt{2} z+7 \\sqrt{2}=0$, $2 \\sqrt{2} x-5 \\sqrt{2} y+7 \\sqrt{2} z+15 \\sqrt{2}=0$, $13 \\sqrt{2} x-11 \\sqrt{2} y+9 \\sqrt{2} z+\\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{64}{149}$, $y=-\\frac{450}{149}$, $z=-\\frac{659}{149}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-4*sqrt(2)*x+12*sqrt(2)*y-7*sqrt(2)*z+7*sqrt(2), 2*sqrt(2)*x-5*sqrt(2)*y+7*sqrt(2)*z+15*sqrt(2), 13*sqrt(2)*x-11*sqrt(2)*y+9*sqrt(2)*z+sqrt(2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{15 x-21 x^2}{4 x^2+16 x+22}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to 0\\},\\left\\{x\\to \\frac{5}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((15*x-21*x**2)/(4*x**2+16*x+22)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $x^5-9 x^4+3 x^3+4 x^2-x-5$ when divided by $-5 x-4$.", + "Output Answer": [ + "$-\\frac{x^4}{5}+\\frac{49 x^3}{25}-\\frac{271 x^2}{125}+\\frac{584 x}{625}-\\frac{1711}{3125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**5-9*x**4+3*x**3+4*x**2-x-5\nq = -5*x-4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $-\\sin \\left(\\frac{16}{3}-\\frac{4 x}{3}\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{4} (6 \\pi c_1+16)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\},\\left\\{x\\to \\fbox{$\\frac{1}{4} (3 (2 \\pi c_1+\\pi )+16)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(-sin((16/3)-((4*x)/3)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sin (4 x+9)$ at the point $x=-7$", + "Output Answer": [ + "$-\\sin (19) = -0.15$" + ], + "Output Program": [ + "import math\n\nx = -7\ntry: \n f = math.sin(4*x+9)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{x^2}{3}-\\frac{28 x}{3}+\\frac{35}{3}$", + "Output Answer": [ + "$77-\\frac{1}{3} (x+14)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((x**2)/3)-((28*x)/3)+(35/3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{26 x^5}{3}-7 x^4+6 x^3-\\frac{17 x^2}{3}-6 x-\\frac{4}{3}$ when divided by $\\frac{20 x^5}{3}-\\frac{28 x^4}{3}-6 x^3+\\frac{11 x^2}{3}-\\frac{11 x}{3}-\\frac{23}{3}$.", + "Output Answer": [ + "$\\frac{13}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((26*x**5)/3)-7*x**4+6*x**3-((17*x**2)/3)-6*x-(4/3)\nq = ((20*x**5)/3)-((28*x**4)/3)-6*x**3+((11*x**2)/3)-((11*x)/3)-(23/3)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{51 x^2}{4}-\\frac{39 x}{4}-2$", + "Output Answer": [ + "$-\\frac{51}{4} \\left(x+\\frac{13}{34}\\right)^2-\\frac{37}{272}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((51*x**2)/4)-((39*x)/4)-2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\sqrt{5} x^2+\\sqrt{5} x-\\sqrt{5}$", + "Output Answer": [ + "$-\\sqrt{5} \\left(x-\\frac{1}{2}\\right)^2-\\frac{3 \\sqrt{5}}{4}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-math.sqrt(5)*x**2+math.sqrt(5)*x-math.sqrt(5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3 x-13}+\\sqrt{10 x+10}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(1711-960 \\sqrt{2}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3*x-13)+sqrt(10*x+10), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{14}{3} \\left(\\cos \\left(\\frac{10}{9}\\right)+i \\sin \\left(\\frac{10}{9}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{289254654976 \\left(\\cos \\left(\\frac{100}{9}\\right)+i \\sin \\left(\\frac{100}{9}\\right)\\right)}{59049}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((14/3)*(math.cos((10/9))+1j*math.sin((10/9))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((10+19)-10) (((12+15)-5)+6)$.", + "Output Answer": [ + "$532$" + ], + "Output Program": [ + "try: \n print(((10+19)-10)*(((12+15)-5)+6))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{81} (891-80 t)^2, x(t)=\\frac{4 t}{3}-15$", + "Output Answer": [ + "$y=\\frac{400 x^2}{9}+\\frac{40 x}{3}+1$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/81)*(891-80*t)**2\nx_t = ((4*t)/3)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 12 x^2+9 x-2$, $q(x) = 6 x^2-13 x+12$", + "Output Answer": [ + "$18 x^2-4 x+10$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 12*x**2+9*x-2\nq = 6*x**2-13*x+12\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\left(\\frac{\\sqrt{3}}{2}-\\frac{i}{2}\\right)\\right)^10$", + "Output Answer": [ + "$1048576 \\left(\\frac{1}{2}+\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*(((math.sqrt(3))/2)-(i/2)))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(23-15)^2-((23-6)-18)$.", + "Output Answer": [ + "$65$" + ], + "Output Program": [ + "try: \n print((23-15)**2-((23-6)-18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{6-25 i}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{661}}{\\pi }$\nArgument: $-\\tan ^{-1}\\left(\\frac{25}{6}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((6-25*i)/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{22 x^2}{\\sqrt{3}}-\\frac{x}{\\sqrt{3}}+\\frac{17}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{22 \\left(x-\\frac{1}{44}\\right)^2}{\\sqrt{3}}+\\frac{1495}{88 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((22*x**2)/(math.sqrt(3)))-(x/(math.sqrt(3)))+(17/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-10 x-14}+\\sqrt{-5 x-3}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(-518+26 \\sqrt{346}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-10*x-14)+sqrt(-5*x-3), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $5 \\sqrt{2} \\left(-\\cos \\left(\\frac{29 \\pi }{180}\\right)-i \\sin \\left(\\frac{29 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $5 \\sqrt{2 \\left(\\sin ^2\\left(\\frac{29 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{29 \\pi }{180}\\right)\\right)}$\nArgument: $-\\frac{151 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 5*math.sqrt(2)*(-math.cos(((29*math.pi)/180))-i*math.sin(((29*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{10 \\left(\\cos \\left(\\frac{13 \\pi }{90}\\right)+i \\sin \\left(\\frac{13 \\pi }{90}\\right)\\right)}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $10 \\sqrt{\\frac{\\sin ^2\\left(\\frac{13 \\pi }{90}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{90}\\right)}{\\pi }}$\nArgument: $-\\frac{77 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((10*(math.cos(((13*math.pi)/90))+i*math.sin(((13*math.pi)/90))))/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\sqrt{5} e^{\\frac{67 i \\pi }{90}}$.", + "Output Answer": [ + "Norm: $\\sqrt{5}$\nArgument: $\\frac{67 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = math.sqrt(5)*math.e**((67*i*math.pi)/90)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{11+15 i}{\\sqrt{\\pi }}$ and $y=\\frac{14}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{11}{14}-\\frac{15 i}{14}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((11+15*i)/(math.sqrt(math.pi)))\ny = (14/(math.sqrt(math.pi)))\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=e^{4 x-1}$ at the point $x=3$", + "Output Answer": [ + "$e^{11} = 59874.1$" + ], + "Output Program": [ + "import math\n\nx = 3\ntry: \n f = math.e**(4*x-1)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2-2 x+2 y^2+10 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(y+\\frac{5}{2}\\right)^2-10 \\left(x+\\frac{1}{10}\\right)^2=\\frac{97}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{10} & -\\frac{5}{2}-\\frac{\\sqrt{291}}{5} \\\\\n -\\frac{1}{10} & \\frac{\\sqrt{291}}{5}-\\frac{5}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{6}{5}}$\nCenter: $\\left\\{-\\frac{1}{10},-\\frac{5}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{10} \\left(-25-\\sqrt{5}\\right)-\\sqrt{5} x,y=\\sqrt{5} x+\\frac{1}{10} \\left(\\sqrt{5}-25\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2-2*x+2*y**2+10*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-13 x-\\frac{10}{3}}+\\sqrt{-\\frac{22 x}{3}-\\frac{29}{3}}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{289} \\left(-2605+8 \\sqrt{77091}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-13*x-(10/3))+sqrt(-((22*x)/3)-(29/3)), 4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $1$ and $-4 x^3-2 x^2+3 x-5$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(1, -4*x**3-2*x**2+3*x-5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{60 x^2}{7}+\\frac{2 x}{7}+\\frac{15}{7}$", + "Output Answer": [ + "$x=\\frac{1}{60} \\left(1-\\sqrt{901}\\right)\\lor x=\\frac{1}{60} \\left(1+\\sqrt{901}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((60*x**2)/7)+((2*x)/7)+(15/7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\left(\\cos \\left(\\frac{8 \\pi }{45}\\right)+i \\sin \\left(\\frac{8 \\pi }{45}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$9 \\left(\\sin \\left(\\frac{13 \\pi }{90}\\right)+i \\cos \\left(\\frac{13 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*(math.cos(((8*math.pi)/45))+1j*math.sin(((8*math.pi)/45))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(\\cos \\left(\\frac{53}{45}\\right)+i \\sin \\left(\\frac{53}{45}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$3125 \\left(\\cos \\left(\\frac{53}{9}\\right)+i \\sin \\left(\\frac{53}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(math.cos((53/45))+1j*math.sin((53/45))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -13 x^2-5 x-14$ and $q(x) = 9 x^2-4 x-2$", + "Output Answer": [ + "$-117 x^4+7 x^3-80 x^2+66 x+28$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -13*x**2-5*x-14\nq = 9*x**2-4*x-2\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{75 x}{7}+\\frac{93}{7}}+\\sqrt{\\frac{81 x}{7}-\\frac{54}{7}}=\\frac{75}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{14} \\left(49093-75 \\sqrt{427881}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((75*x)/7)+(93/7))+sqrt(((81*x)/7)-(54/7)), (75/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(6+i) \\sqrt{3}$ and $y=(-6-2 i) \\sqrt{3}$", + "Output Answer": [ + "$-\\frac{19}{20}+\\frac{3 i}{20}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (6+i)*math.sqrt(3)\ny = (-6-2*i)*math.sqrt(3)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(-\\cos \\left(\\frac{\\pi }{45}\\right)-i \\sin \\left(\\frac{\\pi }{45}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$244140625 \\left(\\sin \\left(\\frac{7 \\pi }{30}\\right)+i \\cos \\left(\\frac{7 \\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(-math.cos((math.pi/45))-1j*math.sin((math.pi/45))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{40 x^2}{3}-\\frac{25 x}{3}-4$", + "Output Answer": [ + "$x=\\frac{1}{80} \\left(-25-i \\sqrt{1295}\\right)\\lor x=\\frac{1}{80} \\left(-25+i \\sqrt{1295}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((40*x**2)/3)-((25*x)/3)-4, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\log (-6 x-6)$", + "Output Answer": [ + "$y\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(log(-6*x-6), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$7 x-6 y-\\frac{49}{2}=0$, $-\\frac{5 x}{2}-9 y-\\frac{33}{2}=0$", + "Output Answer": [ + "$x=\\frac{81}{52}$, $y=-\\frac{707}{312}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((7*x-6*y-(49/2), -((5*x)/2)-9*y-(33/2)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{19 x^2+26 x-25}{\\sqrt{\\pi }}$, $q(x) = \\frac{-16 x^2-x-3}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{3 x^2}{\\sqrt{\\pi }}+\\frac{25 x}{\\sqrt{\\pi }}-\\frac{28}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((19*x**2+26*x-25)/(sqrt(pi)))\nq = ((-16*x**2-x-3)/(sqrt(pi)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-9 x^2+9 x-4$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(3-i \\sqrt{7}\\right)\\lor x=\\frac{1}{6} \\left(3+i \\sqrt{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-9*x**2+9*x-4, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x-4}+2 \\sqrt{3}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(106-28 \\sqrt{3}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x-4)+2*sqrt(3), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-21 x^3+23 x^2+301 x-456}{360-105 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(-7-\\sqrt{277}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(-7+\\sqrt{277}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-21*x**3+23*x**2+301*x-456)/(360-105*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-9 \\left(\\cos \\left(\\frac{1}{5}\\right)+i \\sin \\left(\\frac{1}{5}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$-59049 (\\cos (1)+i \\sin (1))$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-9*(math.cos((1/5))+1j*math.sin((1/5))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $3 x^2+14 x-5$", + "Output Answer": [ + "$-3 \\left(\\frac{1}{3}-x\\right) (x+5)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(3*x**2+14*x-5, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -13 x^2+11 x-4$ and $q(x) = -9 x^2+11 x+3$", + "Output Answer": [ + "$117 x^4-242 x^3+118 x^2-11 x-12$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -13*x**2+11*x-4\nq = -9*x**2+11*x+3\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-14-8 i) \\log (2)$ and $y=(13-5 i) \\log (2)$", + "Output Answer": [ + "$(-27-3 i) \\log (2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-14-8*i)*math.log10(2)\ny = (13-5*i)*math.log10(2)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{15} \\sqrt{x}+\\sqrt{6} \\sqrt{x}=1$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{\\left(\\sqrt{6}+\\sqrt{15}\\right)^2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(15)*sqrt(x)+sqrt(6)*sqrt(x), 1), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left((10-10)^2-9\\right)+5\\right)-12\\right) \\left(\\left(\\left((20-11)^2+12\\right)-5\\right)-1\\right)$.", + "Output Answer": [ + "$-1392$" + ], + "Output Program": [ + "try: \n print(((((10-10)**2-9)+5)-12)*((((20-11)**2+12)-5)-1))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -10 x^2+13 x-14$ and $q(x) = 7 x^2+15 x-3$", + "Output Answer": [ + "$-70 x^4-59 x^3+127 x^2-249 x+42$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -10*x**2+13*x-14\nq = 7*x**2+15*x-3\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{14 x^2}{\\sqrt{3}}+\\frac{23 x}{\\sqrt{3}}-\\sqrt{3}$", + "Output Answer": [ + "$\\frac{14 \\left(x+\\frac{23}{28}\\right)^2}{\\sqrt{3}}-\\sqrt{3}-\\frac{529}{56 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((14*x**2)/(math.sqrt(3)))+((23*x)/(math.sqrt(3)))-math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $6 x^2-\\frac{47 x}{4}-\\frac{41}{4}$", + "Output Answer": [ + "$x=\\frac{1}{48} \\left(47-\\sqrt{6145}\\right)\\lor x=\\frac{1}{48} \\left(47+\\sqrt{6145}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(6*x**2-((47*x)/4)-(41/4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-x-8 y^2+7 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x-\\frac{1}{10}\\right)^2-8 \\left(y-\\frac{7}{16}\\right)^2=\\frac{403}{160}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{80} \\left(8-13 \\sqrt{31}\\right) & \\frac{7}{16} \\\\\n \\frac{1}{80} \\left(8+13 \\sqrt{31}\\right) & \\frac{7}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{13}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{80} \\left(8-13 \\sqrt{31}\\right)+\\frac{1}{80} \\left(8+13 \\sqrt{31}\\right)\\right),\\frac{7}{16}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{2} \\sqrt{\\frac{5}{2}} x+\\frac{1}{80} \\left(35-2 \\sqrt{10}\\right),y=\\frac{1}{80} \\left(35+2 \\sqrt{10}\\right)-\\frac{1}{2} \\sqrt{\\frac{5}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-x-8*y**2+7*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $-\\sinh (4 x+3)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{4} \\sinh ^{-1}(y)-\\frac{3}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, -sinh(4*x+3))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $6 x^2+15 x-1$", + "Output Answer": [ + "$x=\\frac{1}{12} \\left(-15-\\sqrt{249}\\right)\\lor x=\\frac{1}{12} \\left(\\sqrt{249}-15\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(6*x**2+15*x-1, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$3 x-25 y-23 z-19=0$, $-7 x+17 y+12 z+4=0$, $-24 x+22 y-3 z+9=0$", + "Output Answer": [ + "$x=-\\frac{320}{67}$, $y=-\\frac{2376}{469}$, $z=\\frac{1903}{469}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((3*x-25*y-23*z-19, -7*x+17*y+12*z+4, -24*x+22*y-3*z+9)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{53}{90}$, and $a_n=a_{n-1}+-\\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{25}{2} \\left(-\\frac{53}{45}-24 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(53/90) # initial value\nd = -math.sqrt(3) # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(53/90) # initial value\nd = -math.sqrt(3) # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(22+16)^2-11}{4-20}$.", + "Output Answer": [ + "$-\\frac{1433}{16}$" + ], + "Output Program": [ + "try: \n print((((22+16)**2-11)/(4-20)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 13 x^2+x$ and $q(x) = 10 x^2-x-11$", + "Output Answer": [ + "$130 x^4-3 x^3-144 x^2-11 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 13*x**2+x\nq = 10*x**2-x-11\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $8 x^2+10 x-7$", + "Output Answer": [ + "$8 \\left(x+\\frac{5}{8}\\right)^2-\\frac{81}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (8*x**2+10*x-7), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{27 x}{\\sqrt{2}}+8 \\sqrt{2} y-2 \\sqrt{2} z-\\frac{21}{\\sqrt{2}}=0$, $3 \\sqrt{2} x-\\frac{21 y}{\\sqrt{2}}-\\frac{17 z}{\\sqrt{2}}-14 \\sqrt{2}=0$, $-\\frac{23 x}{\\sqrt{2}}+11 \\sqrt{2} y-\\frac{7 z}{\\sqrt{2}}-9 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{5205}{22399}$, $y=\\frac{9055}{22399}$, $z=-\\frac{3557}{1723}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((27*x)/(sqrt(2)))+8*sqrt(2)*y-2*sqrt(2)*z-(21/(sqrt(2))), 3*sqrt(2)*x-((21*y)/(sqrt(2)))-((17*z)/(sqrt(2)))-14*sqrt(2), -((23*x)/(sqrt(2)))+11*sqrt(2)*y-((7*z)/(sqrt(2)))-9*sqrt(2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 4-21 x| =-\\frac{39}{2}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(4-21*x), -(39/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{12 x^2}{7}+\\frac{79 x}{7}+13$", + "Output Answer": [ + "$\\frac{10609}{336}-\\frac{12}{7} \\left(x-\\frac{79}{24}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((12*x**2)/7)+((79*x)/7)+13), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{5}, 2, 9)$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{2126}}{5},\\tan ^{-1}\\left(\\frac{\\sqrt{101}}{45}\\right),\\tan ^{-1}(10)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/5)\ny = 2\nz = 9\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $x^5-2 x^4-7 x^3-3 x^2+2 x+2$ when divided by $-5 x^5-5 x^4+3 x^3-2 x^2-3 x-3$.", + "Output Answer": [ + "$-\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**5-2*x**4-7*x**3-3*x**2+2*x+2\nq = -5*x**5-5*x**4+3*x**3-2*x**2-3*x-3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $9 x^2+13 x-4$", + "Output Answer": [ + "$x=\\frac{1}{18} \\left(-13-\\sqrt{313}\\right)\\lor x=\\frac{1}{18} \\left(\\sqrt{313}-13\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(9*x**2+13*x-4, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3 x+\\frac{23}{2}}+\\sqrt{5 x+\\frac{53}{4}}=\\frac{49}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{32} \\left(9576-49 \\sqrt{36583}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3*x+(23/2))+sqrt(5*x+(53/4)), (49/4)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{4} (-15 t-91), x(t)=-\\frac{15 t}{4}-15$", + "Output Answer": [ + "$y=x-\\frac{31}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/4)*(-15*t-91)\nx_t = -((15*t)/4)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{16}{15}$, and $a_n=a_{n-1}+\\frac{13}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=12$.", + "Output Answer": [ + "$\\frac{4738}{35}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (16/15) # initial value\nd = (13/7) # second term\nn = 12 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (16/15) # initial value\nd = (13/7) # second term\nn = 12 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(9 \\left(\\cos \\left(\\frac{79}{90}\\right)+i \\sin \\left(\\frac{79}{90}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$43046721 \\left(\\cos \\left(\\frac{316}{45}\\right)+i \\sin \\left(\\frac{316}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((9*(math.cos((79/90))+1j*math.sin((79/90))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{17 x^2-25 x+4}{21 x^2-12 x+12}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{34} \\left(25-\\sqrt{353}\\right)\\right\\},\\left\\{x\\to \\frac{1}{34} \\left(25+\\sqrt{353}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((17*x**2-25*x+4)/(21*x**2-12*x+12)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $15 x^2-3 x+2$", + "Output Answer": [ + "$x=\\frac{1}{30} \\left(3-i \\sqrt{111}\\right)\\lor x=\\frac{1}{30} \\left(3+i \\sqrt{111}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(15*x**2-3*x+2, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{5-2 i}{\\sqrt{2}}$ and $y=\\frac{1+14 i}{\\sqrt{2}}$", + "Output Answer": [ + "$-\\frac{33}{2}-34 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((5-2*i)/(math.sqrt(2)))\ny = ((1+14*i)/(math.sqrt(2)))\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -21 x^2-7 x+16\\right| =23$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{42} \\left(-7-5 \\sqrt{133}\\right)\\right\\},\\left\\{x\\to \\frac{1}{42} \\left(-7+5 \\sqrt{133}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-21*x**2-7*x+16), 23), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -14 x^2-3 x-1$, $q(x) = -6 x^2+x-6$", + "Output Answer": [ + "$-20 x^2-2 x-7$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -14*x**2-3*x-1\nq = -6*x**2+x-6\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(((9-2)-20)+23)+3}{\\left(\\left((13+14)^2-12\\right)+8\\right)-13}$.", + "Output Answer": [ + "$\\frac{13}{712}$" + ], + "Output Program": [ + "try: \n print((((((9-2)-20)+23)+3)/((((13+14)**2-12)+8)-13)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-5 x^2+6 y^2-5 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y-\\frac{5}{12}\\right)^2-5 x^2=\\frac{265}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n 0 & \\frac{1}{12} \\left(5-\\sqrt{583}\\right) \\\\\n 0 & \\frac{1}{12} \\left(5+\\sqrt{583}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{11}{5}}$\nCenter: $\\left\\{0,\\frac{1}{2} \\left(\\frac{1}{12} \\left(5-\\sqrt{583}\\right)+\\frac{1}{12} \\left(5+\\sqrt{583}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{5}{12}-\\sqrt{\\frac{5}{6}} x,y=\\sqrt{\\frac{5}{6}} x+\\frac{5}{12}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-5*x**2+6*y**2-5*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{4-18}{((20+25)-7)-16}$.", + "Output Answer": [ + "$-\\frac{7}{11}$" + ], + "Output Program": [ + "try: \n print(((4-18)/(((20+25)-7)-16)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -3 \\sqrt{3} (x+4)^3, q(x) = -\\sqrt{3} (2 x+3)$", + "Output Answer": [ + "$-3 \\sqrt{3} x^3-36 \\sqrt{3} x^2-146 \\sqrt{3} x-195 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*sqrt(3)*(x+4)**3\nq = -sqrt(3)*(2*x+3)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{26 x^2}{\\sqrt{3}}+\\frac{x}{\\sqrt{3}}-\\frac{20}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{26 \\left(x-\\frac{1}{52}\\right)^2}{\\sqrt{3}}-\\frac{693 \\sqrt{3}}{104}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((26*x**2)/(math.sqrt(3)))+(x/(math.sqrt(3)))-(20/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $6 x^2+7 x+2$", + "Output Answer": [ + "$x=-\\frac{2}{3}\\lor x=-\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(6*x**2+7*x+2, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x+3$ and $-3 x^2-4 x+5$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x+3, -3*x**2-4*x+5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-x-9 y^2-6 y+7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x-\\frac{1}{16}\\right)^2-9 \\left(y+\\frac{1}{3}\\right)^2=-\\frac{255}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{16} & \\frac{1}{48} \\left(-16-17 \\sqrt{15}\\right) \\\\\n \\frac{1}{16} & \\frac{1}{48} \\left(17 \\sqrt{15}-16\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{17}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{16},\\frac{1}{2} \\left(\\frac{1}{48} \\left(-16-17 \\sqrt{15}\\right)+\\frac{1}{48} \\left(17 \\sqrt{15}-16\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{24} \\left(\\sqrt{2}-8\\right)-\\frac{2 \\sqrt{2} x}{3},y=\\frac{2 \\sqrt{2} x}{3}+\\frac{1}{24} \\left(-8-\\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-x-9*y**2-6*y+7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{16 x}{7}+\\frac{30}{7}}+\\sqrt{4 x-\\frac{95}{7}}=\\frac{95}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{126} \\left(50950-665 \\sqrt{5410}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((16*x)/7)+(30/7))+sqrt(4*x-(95/7)), (95/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{9 x^2}{\\sqrt{2}}+\\frac{7 x}{\\sqrt{2}}-\\frac{5}{\\sqrt{2}}}{-\\frac{29 x}{\\sqrt{2}}-\\frac{33}{\\sqrt{2}}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(-7-\\sqrt{229}\\right)\\right\\},\\left\\{x\\to \\frac{1}{18} \\left(-7+\\sqrt{229}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((9*x**2)/(sqrt(2)))+((7*x)/(sqrt(2)))-(5/(sqrt(2))))/(-((29*x)/(sqrt(2)))-(33/(sqrt(2))))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{15-8 i}{\\pi }$ and $y=-\\frac{12-20 i}{\\pi }$", + "Output Answer": [ + "$\\frac{20-396 i}{\\pi ^2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((15-8*i)/math.pi)\ny = -((12-20*i)/math.pi)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sin (2 x)$ at the point $x=-5$", + "Output Answer": [ + "$-\\sin (10) = 0.544$" + ], + "Output Program": [ + "import math\n\nx = -5\ntry: \n f = math.sin(2*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-12 x-14}+\\sqrt{-7 x-7}=2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{25} \\left(-111+4 \\sqrt{406}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-12*x-14)+sqrt(-7*x-7), 2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-13 x^2-10 x-1$", + "Output Answer": [ + "$x=\\frac{1}{13} \\left(-5-2 \\sqrt{3}\\right)\\lor x=\\frac{1}{13} \\left(2 \\sqrt{3}-5\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-13*x**2-10*x-1, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -9 x^2+3 x-6$ and $q(x) = -4 x^2+8 x-15$", + "Output Answer": [ + "$36 x^4-84 x^3+183 x^2-93 x+90$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -9*x**2+3*x-6\nq = -4*x**2+8*x-15\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -15 x^2-2 x+14$ and $q(x) = -6 x^2-11 x+10$", + "Output Answer": [ + "$90 x^4+177 x^3-212 x^2-174 x+140$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -15*x**2-2*x+14\nq = -6*x**2-11*x+10\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\left(\\frac{1}{4} \\left(-1-\\sqrt{5}\\right)-i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)\\right)^10$", + "Output Answer": [ + "$1024$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*((1/4)*(-1-math.sqrt(5))-1j*math.sqrt((5/8)-((math.sqrt(5))/8))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{10}{3}-\\frac{7 i}{3}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{149}}{3}$\nArgument: $\\tan ^{-1}\\left(\\frac{7}{10}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(10/3)-((7*i)/3)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{7 x-4}+\\sqrt{14 x+6}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(38-24 \\sqrt{2}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(7*x-4)+sqrt(14*x+6), 4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{26 x^2+10 x+9}{\\sqrt{3}}$, $q(x) = \\frac{7 x^2-10 x-11}{\\sqrt{3}}$", + "Output Answer": [ + "$11 \\sqrt{3} x^2+3 \\sqrt{3}-\\frac{11}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((26*x**2+10*x+9)/(sqrt(3)))\nq = ((7*x**2-10*x-11)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-4 x^2-86 \\sqrt{2} x-840$", + "Output Answer": [ + "$-4 \\left(-x-\\frac{15}{\\sqrt{2}}\\right) \\left(-x-14 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-4*x**2-86*sqrt(2)*x-840, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(1-2 i) \\sqrt{5}$ and $y=(-2+i) \\sqrt{5}$", + "Output Answer": [ + "$-\\frac{4}{5}+\\frac{3 i}{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (1-2*i)*math.sqrt(5)\ny = (-2+i)*math.sqrt(5)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{20+12}{16}+20\\right)-(18+22)$.", + "Output Answer": [ + "$-18$" + ], + "Output Program": [ + "try: \n print((((20+12)/16)+20)-(18+22))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{29 x}{\\sqrt{2}}+15 \\sqrt{2}\\right| =13 \\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{56}{29}\\right\\},\\left\\{x\\to -\\frac{4}{29}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((29*x)/(sqrt(2)))+15*sqrt(2)), 13*sqrt(2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-4 \\left(3 t^2+45 t+169\\right), x(t)=4 t^2+60 t+225$", + "Output Answer": [ + "$y=-3 x-1$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -4*(3*t**2+45*t+169)\nx_t = 4*t**2+60*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{19}{7} (4+8)$.", + "Output Answer": [ + "$\\frac{228}{7}$" + ], + "Output Program": [ + "try: \n print((19/7)*(4+8))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{21}{5}-\\frac{117 x}{5}\\right| =\\frac{68}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{47}{117}\\right\\},\\left\\{x\\to \\frac{89}{117}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs((21/5)-((117*x)/5)), (68/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\cosh \\left(\\sqrt{3-\\frac{17 x}{2}}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{17} \\left(6-2 \\cosh ^{-1}(y)^2\\right)\\text{ if }y>1$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, cosh(sqrt(3-((17*x)/2))))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{6 \\sqrt{5} x^2+9 \\sqrt{5} x-9 \\sqrt{5}}{3 \\sqrt{5}-9 \\sqrt{5} x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-3-\\sqrt{33}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(-3+\\sqrt{33}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((6*sqrt(5)*x**2+9*sqrt(5)*x-9*sqrt(5))/(3*sqrt(5)-9*sqrt(5)*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^5+4 x^4-7 x^3+9 x^2-9 x+6$ when divided by $-9 x^4-2 x^3-7 x^2-9 x+2$.", + "Output Answer": [ + "$-\\frac{5 x}{9}-\\frac{26}{81}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**5+4*x**4-7*x**3+9*x**2-9*x+6\nq = -9*x**4-2*x**3-7*x**2-9*x+2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2+6 x+2 y^2-9 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(y-\\frac{9}{4}\\right)^2-7 \\left(x-\\frac{3}{7}\\right)^2=\\frac{1055}{56}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{7} & -\\frac{3}{28} \\left(\\sqrt{1055}-21\\right) \\\\\n \\frac{3}{7} & \\frac{3}{28} \\left(21+\\sqrt{1055}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{7}}$\nCenter: $\\left\\{\\frac{3}{7},\\frac{1}{2} \\left(\\frac{3}{28} \\left(21+\\sqrt{1055}\\right)-\\frac{3}{28} \\left(\\sqrt{1055}-21\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3}{28} \\left(21+2 \\sqrt{14}\\right)-\\sqrt{\\frac{7}{2}} x,y=\\sqrt{\\frac{7}{2}} x-\\frac{3}{28} \\left(2 \\sqrt{14}-21\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2+6*x+2*y**2-9*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{3} \\left(8 x^2+4 x-7\\right)$, $q(x) = -\\sqrt{3} x (8 x+7)$", + "Output Answer": [ + "$-3 \\sqrt{3} x-7 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(3)*(8*x**2+4*x-7)\nq = -sqrt(3)*x*(8*x+7)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -8 x^2+10 x+5$ and $q(x) = -8 x^2+x+15$", + "Output Answer": [ + "$64 x^4-88 x^3-150 x^2+155 x+75$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -8*x**2+10*x+5\nq = -8*x**2+x+15\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2+57 x-54$", + "Output Answer": [ + "$3 (18-x) (x-1)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2+57*x-54, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-8 x^2+14 x-3$ and $1-4 x$.", + "Output Answer": [ + "$4 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-8*x**2+14*x-3, 1-4*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{(7 x-15)^3}{3 \\sqrt{3}}, q(x) = -\\frac{15 x+16}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{343 x^3}{3 \\sqrt{3}}+245 \\sqrt{3} x^2-530 \\sqrt{3} x+375 \\sqrt{3}-\\frac{16}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(((7*x-15)**3)/(3*sqrt(3)))\nq = -((15*x+16)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(2-4 i) \\sqrt{5}$ and $y=(4+2 i) \\sqrt{5}$", + "Output Answer": [ + "$-i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (2-4*i)*math.sqrt(5)\ny = (4+2*i)*math.sqrt(5)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=e^{5 x-9}$ at the point $x=-3$", + "Output Answer": [ + "$\\frac{1}{e^{24}} = 0.$" + ], + "Output Program": [ + "import math\n\nx = -3\ntry: \n f = math.e**(5*x-9)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2-7 x+2 y^2-3 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $3 \\left(x-\\frac{7}{6}\\right)^2+2 \\left(y-\\frac{3}{4}\\right)^2=\\frac{149}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{7}{6} & \\frac{1}{12} \\left(9-\\sqrt{149}\\right) \\\\\n \\frac{7}{6} & \\frac{1}{12} \\left(9+\\sqrt{149}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{3}}$\nCenter: $\\left\\{\\frac{7}{6},\\frac{1}{2} \\left(\\frac{1}{12} \\left(9-\\sqrt{149}\\right)+\\frac{1}{12} \\left(9+\\sqrt{149}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{149 \\pi }{24 \\sqrt{6}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2-7*x+2*y**2-3*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 18-23 x| =2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{16}{23}\\right\\},\\left\\{x\\to \\frac{20}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(18-23*x), 2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{25}{36}$, and $a_n=a_{n-1}+7 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$7 \\left(91 \\sqrt{2}-\\frac{25}{18}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(25/36) # initial value\nd = 7*math.sqrt(2) # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(25/36) # initial value\nd = 7*math.sqrt(2) # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{4 x}{3}+\\frac{8}{3}}+\\sqrt{\\frac{10 x}{3}-\\frac{8}{3}}=\\frac{16}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{27} \\left(968-32 \\sqrt{766}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((4*x)/3)+(8/3))+sqrt(((10*x)/3)-(8/3)), (16/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2-35 \\sqrt{2} x+180$", + "Output Answer": [ + "$-5 \\left(-x-9 \\sqrt{2}\\right) \\left(2 \\sqrt{2}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2-35*sqrt(2)*x+180, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $x^4-5 x^3+2 x-6$ when divided by $-x^3-5 x^2+8 x+10$.", + "Output Answer": [ + "$10-x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**4-5*x**3+2*x-6\nq = -x**3-5*x**2+8*x+10\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $7 x^2+\\frac{140 x}{\\sqrt{3}}-\\frac{3332}{3}$", + "Output Answer": [ + "$-7 \\left(-x-\\frac{34}{\\sqrt{3}}\\right) \\left(x-\\frac{14}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(7*x**2+((140*x)/(sqrt(3)))-(3332/3), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{4}{25} (x+12)^2, q(x) = 2 x-\\frac{38}{5}$", + "Output Answer": [ + "$\\frac{4 x^2}{25}+\\frac{146 x}{25}+\\frac{386}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (4/25)*(x+12)**2\nq = 2*x-(38/5)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{19}{2} \\left(-\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(-1-\\sqrt{5}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$\\frac{130321}{16} \\left(\\frac{1}{4} \\left(-1-\\sqrt{5}\\right)-i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((19/2)*(-math.sqrt((5/8)-((math.sqrt(5))/8))+(1/4)*1j*(-1-math.sqrt(5))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\left(\\cos \\left(\\frac{67}{45}\\right)+i \\sin \\left(\\frac{67}{45}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$216 \\left(\\cos \\left(\\frac{67}{15}\\right)+i \\sin \\left(\\frac{67}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*(math.cos((67/45))+1j*math.sin((67/45))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^6-7 x^5+x^4+2 x^3+9 x^2-8 x+2$ when divided by $8 x^3-4 x^2+9 x+6$.", + "Output Answer": [ + "$\\frac{9 x^3}{8}-\\frac{5 x^2}{16}-\\frac{83 x}{64}-\\frac{57}{64}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**6-7*x**5+x**4+2*x**3+9*x**2-8*x+2\nq = 8*x**3-4*x**2+9*x+6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(\\cos \\left(\\frac{2}{45}\\right)+i \\sin \\left(\\frac{2}{45}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$1024 \\left(\\cos \\left(\\frac{2}{9}\\right)+i \\sin \\left(\\frac{2}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(math.cos((2/45))+1j*math.sin((2/45))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-x^2-8 x+y^2+6 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $(y+3)^2-(x+4)^2=-10$\nFoci: $\\left(\n\\begin{array}{cc}\n -2 \\left(2+\\sqrt{5}\\right) & -3 \\\\\n 2 \\left(\\sqrt{5}-2\\right) & -3 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(2 \\left(\\sqrt{5}-2\\right)-2 \\left(2+\\sqrt{5}\\right)\\right),-3\\right\\}$\nAsymptotes: $\\{y=x+1,y=-x-7\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-x**2-8*x+y**2+6*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{9} \\left(8281 t^2+364 \\left(169+\\sqrt{3}\\right) t+8 \\left(14282+169 \\sqrt{3}\\right)\\right), x(t)=-\\frac{7 t}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=\\frac{169 x^2}{3}-\\frac{52 x}{3}+\\frac{4}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/9)*(8281*t**2+364*(169+sqrt(3))*t+8*(14282+169*sqrt(3)))\nx_t = -((7*t)/(sqrt(3)))-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-3 \\left(8 t^2-120 t+447\\right), x(t)=4 t^2-60 t+225$", + "Output Answer": [ + "$y=9-6 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -3*(8*t**2-120*t+447)\nx_t = 4*t**2-60*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2-3 x-2$ and $x+4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2-3*x-2, x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{7 x}{4}-\\frac{5}{4}}+\\frac{\\sqrt{13}}{2}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(918-60 \\sqrt{13}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((7*x)/4)-(5/4))+((sqrt(13))/2), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{11 x^2}{2}-\\frac{19 x}{2}+12}{\\frac{49 x}{2}+\\frac{31}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{22} \\left(-19-\\sqrt{1417}\\right)\\right\\},\\left\\{x\\to \\frac{1}{22} \\left(-19+\\sqrt{1417}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((11*x**2)/2)-((19*x)/2)+12)/(((49*x)/2)+(31/2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{23 x^2}{\\sqrt{3}}+6 \\sqrt{3} x+\\frac{17}{\\sqrt{3}}$ and $q(x) = -\\frac{11 x^2}{\\sqrt{3}}-\\frac{19 x}{\\sqrt{3}}+\\frac{7}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{253 x^4}{3}-\\frac{635 x^3}{3}-\\frac{368 x^2}{3}-\\frac{197 x}{3}+\\frac{119}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((23*x**2)/(sqrt(3)))+6*sqrt(3)*x+(17/(sqrt(3)))\nq = -((11*x**2)/(sqrt(3)))-((19*x)/(sqrt(3)))+(7/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{15 x^2}{\\sqrt{2}}-\\frac{13 x}{\\sqrt{2}}-3 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{6}{5}\\lor x=-\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((15*x**2)/(sqrt(2)))-((13*x)/(sqrt(2)))-3*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-4 x^2+23 x-22}{-12 x^2+13 x+21}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(23-\\sqrt{177}\\right)\\right\\},\\left\\{x\\to \\frac{1}{8} \\left(23+\\sqrt{177}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-4*x**2+23*x-22)/(-12*x**2+13*x+21)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{12}{5}$ and $-\\frac{1}{5}$.", + "Output Answer": [ + "$\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd((12/5), -(1/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{5}{14}$, and $a_n=a_{n-1}+-2$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$-\\frac{1053}{14}$" + ], + "Output Program": [ + "a = -(5/14) # initial value\nd = -2 # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(5/14) # initial value\nd = -2 # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^4+3 x^3+9 x^2-10 x-5$ when divided by $-7 x^2+8 x-1$.", + "Output Answer": [ + "$\\frac{2 x^2}{7}-\\frac{5 x}{49}-\\frac{495}{343}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**4+3*x**3+9*x**2-10*x-5\nq = -7*x**2+8*x-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-10 x^3-590 x^2-11600 x-76000$", + "Output Answer": [ + "$10 (-x-20) (x+19) (x+20)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-10*x**3-590*x**2-11600*x-76000, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-42 t-\\frac{145}{2}, x(t)=-8 t-15$", + "Output Answer": [ + "$y=\\frac{21 x}{4}+\\frac{25}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -42*t-(145/2)\nx_t = -8*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -16 x-10| =6$", + "Output Answer": [ + "$\\left\\{\\{x\\to -1\\},\\left\\{x\\to -\\frac{1}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-16*x-10), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{17 x^5}{2}-\\frac{x^4}{2}+\\frac{13 x^3}{2}+3 x^2-\\frac{9 x}{2}-9$ when divided by $-x^4+\\frac{7 x^3}{2}-9 x^2-6 x-\\frac{1}{2}$.", + "Output Answer": [ + "$-\\frac{17 x}{2}-\\frac{117}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((17*x**5)/2)-((x**4)/2)+((13*x**3)/2)+3*x**2-((9*x)/2)-9\nq = -x**4+((7*x**3)/2)-9*x**2-6*x-(1/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{2}{7}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{6}{7}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (2/7) # initial value\nd = 0 # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (2/7) # initial value\nd = 0 # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-8 x+2 y^2+4 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x-\\frac{4}{5}\\right)^2+2 (y+1)^2=\\frac{71}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{4}{5} & -1-\\frac{\\sqrt{\\frac{213}{2}}}{5} \\\\\n \\frac{4}{5} & \\frac{1}{10} \\left(\\sqrt{426}-10\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{5}}$\nCenter: $\\left\\{\\frac{4}{5},\\frac{1}{2} \\left(-1-\\frac{\\sqrt{\\frac{213}{2}}}{5}+\\frac{1}{10} \\left(\\sqrt{426}-10\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{71 \\pi }{5 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-8*x+2*y**2+4*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+x+4 y^2+10 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $7 \\left(x+\\frac{1}{14}\\right)^2+4 \\left(y+\\frac{5}{4}\\right)^2=\\frac{51}{7}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{14} & -\\frac{5}{4}-\\frac{3 \\sqrt{17}}{14} \\\\\n -\\frac{1}{14} & \\frac{3 \\sqrt{17}}{14}-\\frac{5}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{7}}$\nCenter: $\\left\\{-\\frac{1}{14},-\\frac{5}{4}\\right\\}$\nArea Enclosed: $\\frac{51 \\pi }{14 \\sqrt{7}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+x+4*y**2+10*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $11 x^2+10 x-9$", + "Output Answer": [ + "$11 \\left(x+\\frac{5}{11}\\right)^2-\\frac{124}{11}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (11*x**2+10*x-9), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((3+1)-24)-8)+\\left(15 \\frac{1}{1}+21\\right)$.", + "Output Answer": [ + "$8$" + ], + "Output Program": [ + "try: \n print((((3+1)-24)-8)+(15*(1/1)+21))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\sqrt{2} \\left(-\\sin \\left(\\frac{\\pi }{9}\\right)-i \\cos \\left(\\frac{\\pi }{9}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$5184 \\left(\\sin \\left(\\frac{\\pi }{18}\\right)-i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*math.sqrt(2)*(-math.sin((math.pi/9))-1j*math.cos((math.pi/9))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2+22 \\sqrt{2} x$", + "Output Answer": [ + "$11 x \\left(x+2 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2+22*sqrt(2)*x, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$3 x-\\sin ^{-1}(4 x+2)+3$", + "Output Answer": [ + "$-\\frac{3}{4}\\leq x\\leq -\\frac{1}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = 3*x-asin(4*x+2)+3\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11-15 x}+\\sqrt{8-14 x}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -5681+28 \\sqrt{41126}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11-15*x)+sqrt(8-14*x), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{14 x^2}{5}-\\frac{13 x}{5}+\\frac{14}{5}$", + "Output Answer": [ + "$x=\\frac{1}{28} \\left(13-i \\sqrt{615}\\right)\\lor x=\\frac{1}{28} \\left(13+i \\sqrt{615}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((14*x**2)/5)-((13*x)/5)+(14/5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{9 x^2}{\\sqrt{\\pi }}+\\frac{8 x}{\\sqrt{\\pi }}-\\frac{26}{\\sqrt{\\pi }}$ and $q(x) = -\\frac{24 x^2}{\\sqrt{\\pi }}+\\frac{23 x}{\\sqrt{\\pi }}-\\frac{22}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{216 x^4}{\\pi }-\\frac{399 x^3}{\\pi }+\\frac{1006 x^2}{\\pi }-\\frac{774 x}{\\pi }+\\frac{572}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((9*x**2)/(sqrt(pi)))+((8*x)/(sqrt(pi)))-(26/(sqrt(pi)))\nq = -((24*x**2)/(sqrt(pi)))+((23*x)/(sqrt(pi)))-(22/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2+\\frac{385 x}{\\sqrt{3}}+242$", + "Output Answer": [ + "$11 \\left(-x-\\frac{2}{\\sqrt{3}}\\right) \\left(-x-11 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2+((385*x)/(sqrt(3)))+242, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt[3]{135} \\left(\\sqrt[3]{187}-\\sqrt[3]{43}\\right)$.", + "Output Answer": [ + "$3 \\sqrt[3]{935}-3 \\sqrt[3]{215}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(cbrt(135)*(cbrt(187)-cbrt(43)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{4-15 x}{16 x^2+20 x+10}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{4}{15}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((4-15*x)/(16*x**2+20*x+10)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -21 x-15| =-12$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-21*x-15), -12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x-\\frac{17}{2}}+\\sqrt{13 x-\\frac{13}{2}}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(530-130 \\sqrt{14}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x-(17/2))+sqrt(13*x-(13/2)), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 11-2 x^2$ and $q(x) = -9 x^2-6 x-5$", + "Output Answer": [ + "$18 x^4+12 x^3-89 x^2-66 x-55$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 11-2*x**2\nq = -9*x**2-6*x-5\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 2 x^2+9 x+9$, $q(x) = 7 x^2+2 x+2$", + "Output Answer": [ + "$9 x^2+11 x+11$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**2+9*x+9\nq = 7*x**2+2*x+2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{15}{43}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$\\frac{111410}{43}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(15/43) # initial value\nd = 8 # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(15/43) # initial value\nd = 8 # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2-12 \\sqrt{2} x-1040$", + "Output Answer": [ + "$4 \\left(-x-10 \\sqrt{2}\\right) \\left(13 \\sqrt{2}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2-12*sqrt(2)*x-1040, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^3+5 x^2+2 x+7$ when divided by $3$.", + "Output Answer": [ + "$\\frac{4 x^3}{3}+\\frac{5 x^2}{3}+\\frac{2 x}{3}+\\frac{7}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**3+5*x**2+2*x+7\nq = 3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-13 x+24 y-15 z+18=0$, $10 x-13 y-9 z+13=0$, $9 x+11 y-4 z-16=0$", + "Output Answer": [ + "$x=\\frac{8397}{6352}$, $y=\\frac{5965}{6352}$, $z=\\frac{9889}{6352}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-13*x+24*y-15*z+18, 10*x-13*y-9*z+13, 9*x+11*y-4*z-16)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 9 \\sqrt{2} x-17 \\sqrt{2}\\right| =-9 \\sqrt{2}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(9*sqrt(2)*x-17*sqrt(2)), -9*sqrt(2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-10 x^2-14 x-5$", + "Output Answer": [ + "$x=-\\frac{7}{10}-\\frac{i}{10}\\lor x=-\\frac{7}{10}+\\frac{i}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-10*x**2-14*x-5, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 x^2-13 x-7$ and $q(x) = -2 x^2+5 x+6$", + "Output Answer": [ + "$-4 x^4+36 x^3-39 x^2-113 x-42$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*x**2-13*x-7\nq = -2*x**2+5*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{13}{97}$, and $a_n=a_{n-1}+12$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=28$.", + "Output Answer": [ + "$\\frac{440356}{97}$" + ], + "Output Program": [ + "a = (13/97) # initial value\nd = 12 # second term\nn = 28 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (13/97) # initial value\nd = 12 # second term\nn = 28 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$18 x+11 y+7 z-8=0$, $-20 x+y-17 z-22=0$, $16 x-19 y+23 z-4=0$", + "Output Answer": [ + "$x=\\frac{2917}{196}$, $y=-\\frac{2203}{196}$, $z=-\\frac{545}{28}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((18*x+11*y+7*z-8, -20*x+y-17*z-22, 16*x-19*y+23*z-4)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{33}{4} \\left(\\cos \\left(\\frac{2}{45}\\right)+i \\sin \\left(\\frac{2}{45}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-\\frac{46411484401953 \\left(\\cos \\left(\\frac{2}{5}\\right)+i \\sin \\left(\\frac{2}{5}\\right)\\right)}{262144}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(33/4)*(math.cos((2/45))+1j*math.sin((2/45))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-8 x-5 y^2+5 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x-\\frac{2}{3}\\right)^2-5 \\left(y-\\frac{1}{2}\\right)^2=-\\frac{79}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{2}{3} & \\frac{1}{60} \\left(30-\\sqrt{8690}\\right) \\\\\n \\frac{2}{3} & \\frac{1}{60} \\left(30+\\sqrt{8690}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{11}{6}}$\nCenter: $\\left\\{\\frac{2}{3},\\frac{1}{2} \\left(\\frac{1}{60} \\left(30-\\sqrt{8690}\\right)+\\frac{1}{60} \\left(30+\\sqrt{8690}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{30} \\left(15+4 \\sqrt{30}\\right)-\\sqrt{\\frac{6}{5}} x,y=\\sqrt{\\frac{6}{5}} x+\\frac{1}{30} \\left(15-4 \\sqrt{30}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-8*x-5*y**2+5*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -2 x-16| =12$", + "Output Answer": [ + "$\\{\\{x\\to -14\\},\\{x\\to -2\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-2*x-16), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -13 x^2-11 x-15$ and $q(x) = -11 x$", + "Output Answer": [ + "$143 x^3+121 x^2+165 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -13*x**2-11*x-15\nq = -11*x\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 21 x^2 \\log (2)-9 x \\log (2)-\\log (2)$ and $q(x) = 21 x^2 \\log (2)+14 x \\log (2)+20 \\log (2)$", + "Output Answer": [ + "$441 x^4 \\log ^2(2)+105 x^3 \\log ^2(2)+273 x^2 \\log ^2(2)-194 x \\log ^2(2)-20 \\log ^2(2)$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 21*x**2*log(2)-9*x*log(2)-log(2)\nq = 21*x**2*log(2)+14*x*log(2)+20*log(2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$7 x-15 y-12=0$, $9 x-3 y+4=0$", + "Output Answer": [ + "$x=-\\frac{16}{19}$, $y=-\\frac{68}{57}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((7*x-15*y-12, 9*x-3*y+4), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{-6 x-7}$ at the point $x=-5$", + "Output Answer": [ + "$\\sqrt{23} = 4.796$" + ], + "Output Program": [ + "import math\n\nx = -5\ntry: \n f = math.sqrt(-6*x-7)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x+\\frac{17}{2}}+\\sqrt{\\frac{13 x}{2}+10}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(2935-16 \\sqrt{33406}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x+(17/2))+sqrt(((13*x)/2)+10), 8), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{3}{5}$, and $a_n=a_{n-1}+-\\frac{36}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$-\\frac{696}{5}$" + ], + "Output Program": [ + "a = (3/5) # initial value\nd = -(36/7) # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (3/5) # initial value\nd = -(36/7) # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 (x+1)^2, q(x) = (6 x+5)^4$", + "Output Answer": [ + "$1296 x^4+4320 x^3+5404 x^2+3008 x+629$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*(x+1)**2\nq = (6*x+5)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((((13+15)+16)-24)-7)^2 \\left(\\frac{1}{10} ((3-24)+17)\\right)$.", + "Output Answer": [ + "$-\\frac{338}{5}$" + ], + "Output Program": [ + "try: \n print(((((13+15)+16)-24)-7)**2*((1/10)*((3-24)+17)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(-1+5 i) \\sqrt{3}$ and $y=\\frac{9-i}{\\sqrt{3}}$", + "Output Answer": [ + "$-4+46 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-1+5*i)*math.sqrt(3)\ny = ((9-i)/(math.sqrt(3)))\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$-\\frac{1000 x^3}{27}$", + "Output Answer": [ + "$\\frac{81 \\left(x-\\frac{8000}{27}\\right)^2}{32000000}-\\frac{9 \\left(x-\\frac{8000}{27}\\right)}{4000}-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, -((1000*x**3)/27))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x-7$ when divided by $2$.", + "Output Answer": [ + "$-3 x-\\frac{7}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x-7\nq = 2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^5+9 x^4-2 x^3-10 x^2+9 x+7$ when divided by $2 x^5-9 x^4-5 x^3+7 x^2+5 x+7$.", + "Output Answer": [ + "$-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**5+9*x**4-2*x**3-10*x**2+9*x+7\nq = 2*x**5-9*x**4-5*x**3+7*x**2+5*x+7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-12 x^2+14 x+9$", + "Output Answer": [ + "$x=\\frac{1}{12} \\left(7-\\sqrt{157}\\right)\\lor x=\\frac{1}{12} \\left(7+\\sqrt{157}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-12*x**2+14*x+9, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-437 x^2-125 x+238}{552 x^2-865 x+322}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{17}{19}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-437*x**2-125*x+238)/(552*x**2-865*x+322)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{198 x^2-273 x-441}{-88 x-84}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((198*x**2-273*x-441)/(-88*x-84)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{x^2}{\\sqrt{2}}-3 \\sqrt{2} x+3 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{3 \\sqrt{2}-\\sqrt{6}}{\\sqrt{2}}\\lor x=\\frac{3 \\sqrt{2}+\\sqrt{6}}{\\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((x**2)/(sqrt(2)))-3*sqrt(2)*x+3*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=2-9 (8 t+15)^2, x(t)=64 t^2+240 t+225$", + "Output Answer": [ + "$y=2-9 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 2-9*(8*t+15)**2\nx_t = 64*t**2+240*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-3+4 i) \\sqrt{5}$ and $y=(1+4 i) \\sqrt{5}$", + "Output Answer": [ + "$-4 \\sqrt{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-3+4*i)*math.sqrt(5)\ny = (1+4*i)*math.sqrt(5)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{7}{16}$, and $a_n=a_{n-1}+-9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$-\\frac{223}{4}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(7/16) # initial value\nd = -9 # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(7/16) # initial value\nd = -9 # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{71 x^2}{7}+\\frac{45 x}{7}+\\frac{74}{7}$", + "Output Answer": [ + "$x=\\frac{1}{142} \\left(45-\\sqrt{23041}\\right)\\lor x=\\frac{1}{142} \\left(45+\\sqrt{23041}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((71*x**2)/7)+((45*x)/7)+(74/7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$18 x+4 y-9 z+22=0$, $-16 x-4 y-17 z-18=0$, $25 x-2 y+3=0$", + "Output Answer": [ + "$x=-\\frac{346}{875}$, $y=-\\frac{241}{70}$, $z=\\frac{108}{875}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((18*x+4*y-9*z+22, -16*x-4*y-17*z-18, 25*x-2*y+3)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $3 \\sqrt{2} x^2-8 \\sqrt{2} x-6 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{3} \\left(4-\\sqrt{34}\\right)\\lor x=\\frac{1}{3} \\left(4+\\sqrt{34}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(3*sqrt(2)*x**2-8*sqrt(2)*x-6*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{22350 x^2}{49}-\\frac{19372 x}{49}+\\frac{3322}{49}}{\\frac{6750 x}{49}-\\frac{990}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{151}{149}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((22350*x**2)/49)-((19372*x)/49)+(3322/49))/(((6750*x)/49)-(990/49))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-x^2+9 x+3 y^2+y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(y+\\frac{1}{6}\\right)^2-\\left(x-\\frac{9}{2}\\right)^2=-\\frac{91}{6}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{9}{2}-\\frac{\\sqrt{182}}{3} & -\\frac{1}{6} \\\\\n \\frac{9}{2}+\\frac{\\sqrt{182}}{3} & -\\frac{1}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{3}}$\nCenter: $\\left\\{\\frac{9}{2},-\\frac{1}{6}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{3}}+\\frac{1}{6} \\left(-1-9 \\sqrt{3}\\right),y=\\frac{1}{6} \\left(9 \\sqrt{3}-1\\right)-\\frac{x}{\\sqrt{3}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-x**2+9*x+3*y**2+y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 1-14 x^2\\right| =25$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\sqrt{\\frac{13}{7}}\\right\\},\\left\\{x\\to \\sqrt{\\frac{13}{7}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(1-14*x**2), 25), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{4}, 7, 3)$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{929}}{4},\\tan ^{-1}\\left(\\frac{\\sqrt{785}}{12}\\right),\\tan ^{-1}(28)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/4)\ny = 7\nz = 3\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(\\cos \\left(\\frac{52}{45}\\right)+i \\sin \\left(\\frac{52}{45}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$177147 \\left(\\cos \\left(\\frac{572}{45}\\right)+i \\sin \\left(\\frac{572}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(math.cos((52/45))+1j*math.sin((52/45))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -3 x^2+9 x-6$ and $q(x) = -4 x^2+10 x-5$", + "Output Answer": [ + "$12 x^4-66 x^3+129 x^2-105 x+30$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -3*x**2+9*x-6\nq = -4*x**2+10*x-5\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-5 x^2+7 x-3$", + "Output Answer": [ + "$x=\\frac{1}{10} \\left(7-i \\sqrt{11}\\right)\\lor x=\\frac{1}{10} \\left(7+i \\sqrt{11}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-5*x**2+7*x-3, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^6-9 x^5+x^4-6 x^3+x^2-9 x-1$ when divided by $10-9 x$.", + "Output Answer": [ + "$-x^5-\\frac{x^4}{9}-\\frac{19 x^3}{81}+\\frac{296 x^2}{729}+\\frac{2231 x}{6561}+\\frac{81359}{59049}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**6-9*x**5+x**4-6*x**3+x**2-9*x-1\nq = 10-9*x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $9 x^2-4 x+10$", + "Output Answer": [ + "$9 \\left(x-\\frac{2}{9}\\right)^2+\\frac{86}{9}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (9*x**2-4*x+10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{4+6 i}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $2 \\sqrt{\\frac{13}{3}}$\nArgument: $\\tan ^{-1}\\left(\\frac{3}{2}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((4+6*i)/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-12 x^2-132 \\sqrt{2} x-432$", + "Output Answer": [ + "$12 \\left(-x-9 \\sqrt{2}\\right) \\left(x+2 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-12*x**2-132*sqrt(2)*x-432, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 x^2-13 x+2$ and $q(x) = 12 x-7 x^2$", + "Output Answer": [ + "$-21 x^4+127 x^3-170 x^2+24 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*x**2-13*x+2\nq = 12*x-7*x**2\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{60 x^2+38 x-238}{357-210 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((60*x**2+38*x-238)/(357-210*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -21 x-24| =-2$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-21*x-24), -2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -9 x^2-24 x-18\\right| =13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-4-\\sqrt{11}\\right)\\right\\},\\left\\{x\\to \\frac{1}{3} \\left(-4+\\sqrt{11}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-9*x**2-24*x-18), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{17 x^2}{2}+4 x+14$", + "Output Answer": [ + "$\\frac{17}{2} \\left(x+\\frac{4}{17}\\right)^2+\\frac{230}{17}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((17*x**2)/2)+4*x+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-8 x-22 y+7 z-10=0$, $12 x-y+16 z+7=0$, $6 x-3 y+4 z-7=0$", + "Output Answer": [ + "$x=\\frac{1222}{809}$, $y=-\\frac{1241}{809}$, $z=-\\frac{1348}{809}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-8*x-22*y+7*z-10, 12*x-y+16*z+7, 6*x-3*y+4*z-7)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{86 x}{7}-\\frac{60}{7}}+\\sqrt{\\frac{94 x}{7}+\\frac{5}{7}}=\\frac{55}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{112} \\left(135215-55 \\sqrt{6028545}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((86*x)/7)-(60/7))+sqrt(((94*x)/7)+(5/7)), (55/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{29 x}{\\sqrt{3}}+7 \\sqrt{3} y+8 \\sqrt{3} z+\\frac{35}{\\sqrt{3}}=0$, $\\frac{37 x}{\\sqrt{3}}+2 \\sqrt{3} y-7 \\sqrt{3} z+14 \\sqrt{3}=0$, $-2 \\sqrt{3} x-\\frac{37 y}{\\sqrt{3}}-\\frac{16 z}{\\sqrt{3}}+\\frac{5}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{18888}{2801}$, $y=-\\frac{52061}{8403}$, $z=\\frac{101768}{8403}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((29*x)/(sqrt(3)))+7*sqrt(3)*y+8*sqrt(3)*z+(35/(sqrt(3))), ((37*x)/(sqrt(3)))+2*sqrt(3)*y-7*sqrt(3)*z+14*sqrt(3), -2*sqrt(3)*x-((37*y)/(sqrt(3)))-((16*z)/(sqrt(3)))+(5/(sqrt(3))))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^6-3 x^4-5 x^3+9 x^2-4 x-1$ when divided by $-x^5-9 x^4+3 x^3+2 x^2-8 x-1$.", + "Output Answer": [ + "$54-6 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**6-3*x**4-5*x**3+9*x**2-4*x-1\nq = -x**5-9*x**4+3*x**3+2*x**2-8*x-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{15 x^6}{2}+4 x^5-\\frac{13 x^4}{2}-\\frac{5 x^3}{2}-\\frac{x^2}{2}-\\frac{5 x}{2}-\\frac{11}{2}$ when divided by $-\\frac{17 x^4}{2}+4 x^3+9 x^2+3 x+1$.", + "Output Answer": [ + "$\\frac{15 x^2}{17}-\\frac{16 x}{289}+\\frac{8219}{4913}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((15*x**6)/2)+4*x**5-((13*x**4)/2)-((5*x**3)/2)-((x**2)/2)-((5*x)/2)-(11/2)\nq = -((17*x**4)/2)+4*x**3+9*x**2+3*x+1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=15 t-5 \\sqrt{3}-78, x(t)=\\frac{5 t}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=3 \\sqrt{3} x-5 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 15*t-5*sqrt(3)-78\nx_t = ((5*t)/(sqrt(3)))-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{17}{5}-5 i$ and $y=\\frac{8}{5}+5 i$", + "Output Answer": [ + "$-\\frac{9}{5}$" + ], + "Output Program": [ + "i = 1j\nx = -(17/5)-5*i\ny = (8/5)+5*i\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^4-2 x^3-7 x^2+6 x+1$ when divided by $10 x-8$.", + "Output Answer": [ + "$-\\frac{7 x^3}{10}-\\frac{19 x^2}{25}-\\frac{327 x}{250}-\\frac{279}{625}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**4-2*x**3-7*x**2+6*x+1\nq = 10*x-8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((((22+21)-14)-8)+24)^2-(((3+21)+20)+23)$.", + "Output Answer": [ + "$1958$" + ], + "Output Program": [ + "try: \n print(((((22+21)-14)-8)+24)**2-(((3+21)+20)+23))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-8 x^2-7 x+5$", + "Output Answer": [ + "$x=\\frac{1}{16} \\left(-7-\\sqrt{209}\\right)\\lor x=\\frac{1}{16} \\left(\\sqrt{209}-7\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-8*x**2-7*x+5, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2-\\frac{143 x}{2}-825$", + "Output Answer": [ + "$-11 \\left(\\frac{25}{2}-x\\right) (x+6)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2-((143*x)/2)-825, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 21-2 x| =2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{19}{2}\\right\\},\\left\\{x\\to \\frac{23}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(21-2*x), 2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11-8 x}+\\sqrt{2-x}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(-243+4 \\sqrt{1603}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11-8*x)+sqrt(2-x), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{8}{11}$, and $a_n=a_{n-1}+-\\frac{1}{\\sqrt{2}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$\\frac{23}{2} \\left(-\\frac{16}{11}-11 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(8/11) # initial value\nd = -(1/(math.sqrt(2))) # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(8/11) # initial value\nd = -(1/(math.sqrt(2))) # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{17}{2}+\\frac{i}{2}$ and $y=-\\frac{7}{2}-\\frac{11 i}{2}$", + "Output Answer": [ + "$-\\frac{13}{17}+\\frac{18 i}{17}$" + ], + "Output Program": [ + "i = 1j\nx = (17/2)+(i/2)\ny = -(7/2)-((11*i)/2)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-15 x-1}+\\sqrt{8-9 x}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(-493+11 \\sqrt{1901}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-15*x-1)+sqrt(8-9*x), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2-7 x+8 y^2+y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y+\\frac{1}{16}\\right)^2-8 \\left(x+\\frac{7}{16}\\right)^2=-\\frac{5}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{16} \\left(-7-4 \\sqrt{10}\\right) & -\\frac{1}{16} \\\\\n \\frac{1}{16} \\left(4 \\sqrt{10}-7\\right) & -\\frac{1}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{16} \\left(-7-4 \\sqrt{10}\\right)+\\frac{1}{16} \\left(4 \\sqrt{10}-7\\right)\\right),-\\frac{1}{16}\\right\\}$\nAsymptotes: $\\left\\{y=x+\\frac{3}{8},y=-x-\\frac{1}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2-7*x+8*y**2+y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt[3]{100}-\\left(\\sqrt[3]{4}-\\sqrt[3]{42}\\right)$.", + "Output Answer": [ + "$-2^{2/3}+10^{2/3}+\\sqrt[3]{42}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(cbrt(100)-(cbrt(4)-cbrt(42)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-3 x+5 y^2+8 y+9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-3 x+5 y^2+8 y=-9$\nVertex: $\\left\\{\\frac{29}{15},-\\frac{4}{5}\\right\\}$\nDirectrix: $x=\\frac{107}{60}$\nFocal Parameter: $\\frac{3}{10}$\nFocus: $\\left\\{\\frac{25}{12},-\\frac{4}{5}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x+5*y**2+8*y+9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((14+4)+14)-((1+16)+24)$.", + "Output Answer": [ + "$-9$" + ], + "Output Program": [ + "try: \n print(((14+4)+14)-((1+16)+24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x^6-30 x^5+5 x^4+10 x^3+15 x^2-5 x$ and $x^5-5 x^4-4 x^3-2 x^2+x$.", + "Output Answer": [ + "$x^5-5 x^4-4 x^3-2 x^2+x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x**6-30*x**5+5*x**4+10*x**3+15*x**2-5*x, x**5-5*x**4-4*x**3-2*x**2+x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{7 x-3}+\\sqrt{12 x-7}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{4}{5} \\left(96-\\sqrt{8465}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(7*x-3)+sqrt(12*x-7), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{8 e^{\\frac{14 i \\pi }{45}}}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{8}{\\pi }$\nArgument: $\\frac{14 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((8*math.e**((14*i*math.pi)/45))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{3 \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)+i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)}{\\sqrt{2}}\\right)^7$", + "Output Answer": [ + "$-\\frac{2187 \\left(\\sin \\left(\\frac{\\pi }{18}\\right)-i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)}{8 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((3*(math.cos(((2*math.pi)/9))+1j*math.sin(((2*math.pi)/9))))/(math.sqrt(2))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\sqrt{2} \\left(\\cos \\left(\\frac{2 \\pi }{45}\\right)+i \\sin \\left(\\frac{2 \\pi }{45}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$4096 \\sqrt{2} \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)+i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*math.sqrt(2)*(math.cos(((2*math.pi)/45))+1j*math.sin(((2*math.pi)/45))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -14 \\sqrt{2} x-9 \\sqrt{2}\\right| =\\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{7}\\right\\},\\left\\{x\\to -\\frac{4}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-14*sqrt(2)*x-9*sqrt(2)), sqrt(2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+6 x-y^2+4 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x+\\frac{1}{2}\\right)^2-(y-2)^2=-\\frac{13}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{2} & 2-\\frac{\\sqrt{\\frac{91}{3}}}{2} \\\\\n -\\frac{1}{2} & \\frac{1}{6} \\left(12+\\sqrt{273}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{6}}$\nCenter: $\\left\\{-\\frac{1}{2},\\frac{1}{2} \\left(2-\\frac{\\sqrt{\\frac{91}{3}}}{2}+\\frac{1}{6} \\left(12+\\sqrt{273}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{2} \\left(4-\\sqrt{6}\\right)-\\sqrt{6} x,y=\\sqrt{6} x+\\frac{1}{2} \\left(4+\\sqrt{6}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+6*x-y**2+4*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $9 \\sqrt{2} x^2-8 \\sqrt{2} x-9 \\sqrt{2}$", + "Output Answer": [ + "$9 \\sqrt{2} \\left(x-\\frac{4}{9}\\right)^2-\\frac{97 \\sqrt{2}}{9}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (9*math.sqrt(2)*x**2-8*math.sqrt(2)*x-9*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $-\\tan (6-7 x)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{7} (\\pi c_1+6)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(-tan(6-7*x), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{14}{3}$, and $a_n=a_{n-1}+-4 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$3 \\left(\\frac{28}{3}-20 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (14/3) # initial value\nd = -4*math.sqrt(5) # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (14/3) # initial value\nd = -4*math.sqrt(5) # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(23+17)^2}{9-15}$.", + "Output Answer": [ + "$-\\frac{800}{3}$" + ], + "Output Program": [ + "try: \n print((((23+17)**2)/(9-15)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-2+2 i) \\sqrt{2}$ and $y=(-1+4 i) \\sqrt{2}$", + "Output Answer": [ + "$(-1-2 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-2+2*i)*math.sqrt(2)\ny = (-1+4*i)*math.sqrt(2)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$\\sin \\left(\\frac{5 x}{2}\\right)$", + "Output Answer": [ + "$\\frac{2 x}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, sin(((5*x)/2)))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{2 \\left(-\\cos \\left(\\frac{11 \\pi }{45}\\right)+i \\sin \\left(\\frac{11 \\pi }{45}\\right)\\right)}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $2 \\sqrt{\\frac{1}{3} \\left(\\sin ^2\\left(\\frac{11 \\pi }{45}\\right)+\\cos ^2\\left(\\frac{11 \\pi }{45}\\right)\\right)}$\nArgument: $\\frac{34 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((2*(-math.cos(((11*math.pi)/45))+i*math.sin(((11*math.pi)/45))))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^5+2 x^4-x^3-10 x^2-4 x-7$ when divided by $8 x^5-4 x^4+3 x^3+9 x^2+8 x-4$.", + "Output Answer": [ + "$-\\frac{9}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**5+2*x**4-x**3-10*x**2-4*x-7\nq = 8*x**5-4*x**4+3*x**3+9*x**2+8*x-4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x+7}+\\sqrt{11 x-1}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(2591-26 \\sqrt{8003}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x+7)+sqrt(11*x-1), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{21 x^2}{2}-\\frac{39 x}{4}-\\frac{5}{2}$ and $q(x) = \\frac{57 x^2}{4}-\\frac{27 x}{2}+\\frac{21}{2}$", + "Output Answer": [ + "$\\frac{1197 x^4}{8}-\\frac{4491 x^3}{16}+\\frac{825 x^2}{4}-\\frac{549 x}{8}-\\frac{105}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((21*x**2)/2)-((39*x)/4)-(5/2)\nq = ((57*x**2)/4)-((27*x)/2)+(21/2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -3 \\sqrt{3} x^3, q(x) = -\\sqrt{3} (x+5)$", + "Output Answer": [ + "$-3 \\sqrt{3} x^3-\\sqrt{3} x-5 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*sqrt(3)*x**3\nq = -sqrt(3)*(x+5)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^5+4 x^4-6 x^3+2 x^2-4 x-1$ when divided by $-9 x^2+7 x+9$.", + "Output Answer": [ + "$\\frac{5 x^3}{9}-\\frac{x^2}{81}+\\frac{884 x}{729}+\\frac{4649}{6561}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**5+4*x**4-6*x**3+2*x**2-4*x-1\nq = -9*x**2+7*x+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{9}{4} \\left(\\cos \\left(\\frac{53}{90}\\right)+i \\sin \\left(\\frac{53}{90}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{3486784401 \\left(\\cos \\left(\\frac{53}{9}\\right)+i \\sin \\left(\\frac{53}{9}\\right)\\right)}{1048576}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((9/4)*(math.cos((53/90))+1j*math.sin((53/90))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\sin \\left(\\frac{9 x}{2}\\right)$", + "Output Answer": [ + "$-1\\leq y\\leq 1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(sin(((9*x)/2)), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{64}{19}$, and $a_n=a_{n-1}+\\frac{7}{4}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$-\\frac{369}{76}$" + ], + "Output Program": [ + "a = -(64/19) # initial value\nd = (7/4) # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(64/19) # initial value\nd = (7/4) # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((((14+12)-22)+17)+17) \\left(((6-11)-8) \\frac{1}{1}\\right)$.", + "Output Answer": [ + "$-494$" + ], + "Output Program": [ + "try: \n print(((((14+12)-22)+17)+17)*(((6-11)-8)*(1/1)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x-4$ and $-4 x^2+4 x-\\frac{5}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x-4, -4*x**2+4*x-(5/2)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 1.061 x^2-4.261 x-14.956$, $q(x) = 10.28 x^2+3.018 x+10.195$", + "Output Answer": [ + "$11.341 x^2-1.243 x-4.761$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 1.061*x**2-4.261*x-14.956\nq = 10.28*x**2+3.018*x+10.195\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-9 \\sqrt{5} x-11 \\sqrt{5} y-6 \\sqrt{5}=0$, $3 \\sqrt{5} x+6 \\sqrt{5} y-3 \\sqrt{5}=0$", + "Output Answer": [ + "$x=-\\frac{23}{7}$, $y=\\frac{15}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-9*sqrt(5)*x-11*sqrt(5)*y-6*sqrt(5), 3*sqrt(5)*x+6*sqrt(5)*y-3*sqrt(5)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{17-7}{4}}{(22-13)+14}$.", + "Output Answer": [ + "$\\frac{5}{46}$" + ], + "Output Program": [ + "try: \n print((((17-7)/4)/((22-13)+14)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt[3]{98}+\\sqrt[3]{50}\\right) \\left(\\sqrt[3]{150}+\\sqrt[3]{2}\\right)$.", + "Output Answer": [ + "$2^{2/3} \\left(5^{2/3}+7^{2/3}+5 \\sqrt[3]{15}+\\sqrt[3]{3} 35^{2/3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint((cbrt(98)+cbrt(50))*(cbrt(150)+cbrt(2)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x+4}+\\sqrt{13 x-8}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(388-16 \\sqrt{487}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x+4)+sqrt(13*x-8), 4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-7 \\sqrt{2} x+5 \\sqrt{2} y-2 \\sqrt{2}=0$, $8 \\sqrt{2} x+6 \\sqrt{2} y-9 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{33}{82}$, $y=\\frac{79}{82}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-7*sqrt(2)*x+5*sqrt(2)*y-2*sqrt(2), 8*sqrt(2)*x+6*sqrt(2)*y-9*sqrt(2)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{1-15 x}+\\sqrt{8-14 x}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -2907+20 \\sqrt{21106}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(1-15*x)+sqrt(8-14*x), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-19 x+18 y-\\frac{61}{5}=0$, $-\\frac{58 x}{5}-\\frac{7 y}{5}+\\frac{71}{5}=0$", + "Output Answer": [ + "$x=\\frac{5963}{5885}$, $y=\\frac{10283}{5885}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-19*x+18*y-(61/5), -((58*x)/5)-((7*y)/5)+(71/5)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2+2 x+7 y^2-8 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $(x+1)^2+7 \\left(y-\\frac{4}{7}\\right)^2=\\frac{58}{7}$\nFoci: $\\left(\n\\begin{array}{cc}\n -1-\\frac{2 \\sqrt{87}}{7} & \\frac{4}{7} \\\\\n \\frac{2 \\sqrt{87}}{7}-1 & \\frac{4}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{6}{7}}$\nCenter: $\\left\\{-1,\\frac{4}{7}\\right\\}$\nArea Enclosed: $\\frac{58 \\pi }{7 \\sqrt{7}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2+2*x+7*y**2-8*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{9 x^2}{7}+x-\\frac{36}{7}$", + "Output Answer": [ + "$\\frac{9}{7} \\left(x+\\frac{7}{18}\\right)^2-\\frac{1345}{252}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((9*x**2)/7)+x-(36/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2$ and $-3 x^2-3 x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2, -3*x**2-3*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{253 x^2-747 x+504}{210-110 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{24}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((253*x**2-747*x+504)/(210-110*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-10 \\sqrt{2} x^2-7 \\sqrt{2} x+2 \\sqrt{2}$", + "Output Answer": [ + "$-10 \\sqrt{2} \\left(x+\\frac{7}{20}\\right)^2+2 \\sqrt{2}+\\frac{49}{20 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-10*math.sqrt(2)*x**2-7*math.sqrt(2)*x+2*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = x^2-8 x+5$ and $q(x) = 6 x+4$", + "Output Answer": [ + "$6 x^3-44 x^2-2 x+20$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = x**2-8*x+5\nq = 6*x+4\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $7 x^2-13 x+11$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(13-i \\sqrt{139}\\right)\\lor x=\\frac{1}{14} \\left(13+i \\sqrt{139}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(7*x**2-13*x+11, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{34}{5} \\left(\\sin \\left(\\frac{\\pi }{18}\\right)-i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{34}{5} \\sqrt{\\sin ^2\\left(\\frac{\\pi }{18}\\right)+\\cos ^2\\left(\\frac{\\pi }{18}\\right)}$\nArgument: $\\frac{5 \\pi }{9}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(34/5)*(math.sin((math.pi/18))-i*math.cos((math.pi/18)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-2 x^3+26 x^2+26 x-770$", + "Output Answer": [ + "$2 (-x-5) (7-x) (11-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-2*x**3+26*x**2+26*x-770, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $8 x^3-20 x^2+28 x-16$ and $4-4 x$.", + "Output Answer": [ + "$4 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(8*x**3-20*x**2+28*x-16, 4-4*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-3-\\frac{11 i}{2}$ and $y=4+5 i$", + "Output Answer": [ + "$-\\frac{79}{82}-\\frac{7 i}{41}$" + ], + "Output Program": [ + "i = 1j\nx = -3-((11*i)/2)\ny = 4+5*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$e^{-3 x^3-8}$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = math.e**(-3*x**3-8)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2-9 x-9 y^2+6 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x-\\frac{3}{2}\\right)^2-9 \\left(y-\\frac{1}{3}\\right)^2=\\frac{59}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{6} \\left(9-2 \\sqrt{59}\\right) & \\frac{1}{3} \\\\\n \\frac{1}{6} \\left(9+2 \\sqrt{59}\\right) & \\frac{1}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{6} \\left(9-2 \\sqrt{59}\\right)+\\frac{1}{6} \\left(9+2 \\sqrt{59}\\right)\\right),\\frac{1}{3}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{3}}+\\frac{1}{6} \\left(2-3 \\sqrt{3}\\right),y=\\frac{1}{6} \\left(2+3 \\sqrt{3}\\right)-\\frac{x}{\\sqrt{3}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2-9*x-9*y**2+6*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -13 x^2+3 x-13$ and $q(x) = 8 x-8$", + "Output Answer": [ + "$-104 x^3+128 x^2-128 x+104$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -13*x**2+3*x-13\nq = 8*x-8\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{42}{5}-\\frac{98 x}{25}$ and $-\\frac{14}{5}$.", + "Output Answer": [ + "$\\frac{14}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd((42/5)-((98*x)/25), -(14/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2+144 \\sqrt{3} x-1728$", + "Output Answer": [ + "$-9 \\left(x-8 \\sqrt{3}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2+144*sqrt(3)*x-1728, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2+4 x+4 y^2+2 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(y+\\frac{1}{4}\\right)^2-3 \\left(x-\\frac{2}{3}\\right)^2=-\\frac{49}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{12} \\left(8-7 \\sqrt{7}\\right) & -\\frac{1}{4} \\\\\n \\frac{1}{12} \\left(8+7 \\sqrt{7}\\right) & -\\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{7}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{12} \\left(8-7 \\sqrt{7}\\right)+\\frac{1}{12} \\left(8+7 \\sqrt{7}\\right)\\right),-\\frac{1}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{3} x}{2}-\\frac{1}{\\sqrt{3}}-\\frac{1}{4},y=\\frac{1}{12} \\left(4 \\sqrt{3}-3\\right)-\\frac{\\sqrt{3} x}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2+4*x+4*y**2+2*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $(13-13 i) \\log (2)$.", + "Output Answer": [ + "Norm: $13 \\sqrt{2} \\log (2)$\nArgument: $-\\frac{\\pi }{4}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (13-13*i)*math.log(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-7 x^2+\\frac{777 x}{5}-\\frac{8918}{25}$", + "Output Answer": [ + "$7 \\left(\\frac{13}{5}-x\\right) \\left(x-\\frac{98}{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-7*x**2+((777*x)/5)-(8918/25), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 (4 x+1)^2, q(x) = 125 (x+1)^3$", + "Output Answer": [ + "$125 x^3+439 x^2+407 x+129$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*(4*x+1)**2\nq = 125*(x+1)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{12 x^2+25 x}{4 x-16}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{25}{12}\\right\\},\\{x\\to 0\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((12*x**2+25*x)/(4*x-16)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{x}{2}-\\frac{17}{2}}+\\sqrt{3 x+3}=\\frac{23}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{50} \\left(3473-46 \\sqrt{2094}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((x/2)-(17/2))+sqrt(3*x+3), (23/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-23 x^2+21 x+16}{18 x^2-14 x-21}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{46} \\left(21-\\sqrt{1913}\\right)\\right\\},\\left\\{x\\to \\frac{1}{46} \\left(21+\\sqrt{1913}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-23*x**2+21*x+16)/(18*x**2-14*x-21)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\tan (3-8 x)$ at the point $x=-1$", + "Output Answer": [ + "$-\\tan (11) = 225.951$" + ], + "Output Program": [ + "import math\n\nx = -1\ntry: \n f = -math.tan(3-8*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 18 (2 x+1)^2, q(x) = 4$", + "Output Answer": [ + "$72 x^2+72 x+22$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 18*(2*x+1)**2\nq = 4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(-5+6 i) \\log (2)$ and $y=(1+6 i) \\log (2)$", + "Output Answer": [ + "$(-41-24 i) \\log ^2(2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-5+6*i)*math.log10(2)\ny = (1+6*i)*math.log10(2)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{23 x^2}{\\pi }-\\frac{37 x}{\\pi }-\\frac{44}{\\pi }$ and $q(x) = \\frac{21 x^2}{\\pi }+\\frac{44 x}{\\pi }+\\frac{34}{\\pi }$", + "Output Answer": [ + "$\\frac{483 x^4}{\\pi ^2}+\\frac{235 x^3}{\\pi ^2}-\\frac{1770 x^2}{\\pi ^2}-\\frac{3194 x}{\\pi ^2}-\\frac{1496}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((23*x**2)/pi)-((37*x)/pi)-(44/pi)\nq = ((21*x**2)/pi)+((44*x)/pi)+(34/pi)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{224 x^3-152 x^2-340 x-72}{384 x^2+400 x+76}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{28} \\left(13-\\sqrt{1177}\\right)\\right\\},\\left\\{x\\to \\frac{1}{28} \\left(13+\\sqrt{1177}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((224*x**3-152*x**2-340*x-72)/(384*x**2+400*x+76)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-9 \\left(\\cos \\left(\\frac{67}{90}\\right)+i \\sin \\left(\\frac{67}{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-31381059609 \\left(\\cos \\left(\\frac{737}{90}\\right)+i \\sin \\left(\\frac{737}{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-9*(math.cos((67/90))+1j*math.sin((67/90))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{11 x^2}{7}-\\frac{25 x}{7}-\\frac{52}{7}$", + "Output Answer": [ + "$\\frac{11}{7} \\left(x-\\frac{25}{22}\\right)^2-\\frac{2913}{308}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((11*x**2)/7)-((25*x)/7)-(52/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+4 y^2+6 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $6 x^2+4 \\left(y+\\frac{3}{4}\\right)^2=\\frac{49}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n 0 & \\frac{1}{12} \\left(-9-7 \\sqrt{3}\\right) \\\\\n 0 & \\frac{1}{12} \\left(7 \\sqrt{3}-9\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{3}}$\nCenter: $\\left\\{0,\\frac{1}{2} \\left(\\frac{1}{12} \\left(-9-7 \\sqrt{3}\\right)+\\frac{1}{12} \\left(7 \\sqrt{3}-9\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{49 \\pi }{8 \\sqrt{6}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+4*y**2+6*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-3 \\sqrt{3} \\left(\\cos \\left(\\frac{7 \\pi }{30}\\right)+i \\sin \\left(\\frac{7 \\pi }{30}\\right)\\right)$.", + "Output Answer": [ + "Norm: $3 \\sqrt{3 \\left(\\sin ^2\\left(\\frac{7 \\pi }{30}\\right)+\\cos ^2\\left(\\frac{7 \\pi }{30}\\right)\\right)}$\nArgument: $-\\frac{23 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -3*math.sqrt(3)*(math.cos(((7*math.pi)/30))+i*math.sin(((7*math.pi)/30)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 \\pi x^2-\\pi x$ and $q(x) = 4 \\pi x-\\pi x^2$", + "Output Answer": [ + "$-2 \\pi ^2 x^4+9 \\pi ^2 x^3-4 \\pi ^2 x^2$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*pi*x**2-pi*x\nq = 4*pi*x-pi*x**2\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x-3}+\\sqrt{14 x+5}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(397-6 \\sqrt{2995}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x-3)+sqrt(14*x+5), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 3.2 x^2-4.8 x-0.8$, $q(x) = -2.4 x^2+8.7 x+13.2$", + "Output Answer": [ + "$0.8 x^2+3.9 x+12.4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3.2*x**2-4.8*x-0.8\nq = -2.4*x**2+8.7*x+13.2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $9 x^2-\\frac{297 x}{\\sqrt{2}}+1197$", + "Output Answer": [ + "$-9 \\left(\\frac{19}{\\sqrt{2}}-x\\right) \\left(x-7 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(9*x**2-((297*x)/(sqrt(2)))+1197, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\cos ^{-1}(-2 x-1)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{2} (-\\cos (y)-1)\\text{ if }0\\leq y\\leq \\pi $}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, acos(-2*x-1))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x+9}+\\sqrt{9 x-14}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{49} \\left(1010-13 \\sqrt{3805}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x+9)+sqrt(9*x-14), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^6-6 x^5+x^4+5 x^3-x^2-9$ when divided by $-5 x-5$.", + "Output Answer": [ + "$\\frac{6 x^5}{5}-\\frac{x^3}{5}-\\frac{4 x^2}{5}+x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**6-6*x**5+x**4+5*x**3-x**2-9\nq = -5*x-5\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{25 x^2}{2}-10 x-6$", + "Output Answer": [ + "$-\\frac{25}{2} \\left(x+\\frac{2}{5}\\right)^2-4$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((25*x**2)/2)-10*x-6), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^6+3 x^5-9 x^4-5 x^3+8 x^2-3 x-10$ when divided by $9$.", + "Output Answer": [ + "$\\frac{x^6}{3}+\\frac{x^5}{3}-x^4-\\frac{5 x^3}{9}+\\frac{8 x^2}{9}-\\frac{x}{3}-\\frac{10}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**6+3*x**5-9*x**4-5*x**3+8*x**2-3*x-10\nq = 9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 11 x^2+14 x+10$, $q(x) = 15 x^2+x-9$", + "Output Answer": [ + "$26 x^2+15 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 11*x**2+14*x+10\nq = 15*x**2+x-9\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\cos \\left(\\frac{29}{30}\\right)+i \\sin \\left(\\frac{29}{30}\\right)\\right)^3$", + "Output Answer": [ + "$\\cos \\left(\\frac{29}{10}\\right)+i \\sin \\left(\\frac{29}{10}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.cos((29/30))+1j*math.sin((29/30)))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-10 x^2-2 x-2$ and $-2$.", + "Output Answer": [ + "$2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-10*x**2-2*x-2, -2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{29}{32}$, and $a_n=a_{n-1}+\\frac{33}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=28$.", + "Output Answer": [ + "$\\frac{98777}{40}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(29/32) # initial value\nd = (33/5) # second term\nn = 28 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(29/32) # initial value\nd = (33/5) # second term\nn = 28 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{17 x^2+38 x-13}{e}$, $q(x) = \\frac{-8 x^2+31 x-3}{e}$", + "Output Answer": [ + "$\\frac{9 x^2}{e}+\\frac{69 x}{e}-\\frac{16}{e}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x\n\np = ((17*x**2+38*x-13)/math.e)\nq = ((-8*x**2+31*x-3)/math.e)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{10 x^2}{3}-\\frac{31 x}{3}+5$", + "Output Answer": [ + "$x=\\frac{1}{20} \\left(-31-\\sqrt{1561}\\right)\\lor x=\\frac{1}{20} \\left(\\sqrt{1561}-31\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((10*x**2)/3)-((31*x)/3)+5, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^5-8 x^3+6 x^2+9 x+7$ when divided by $8 x^3+7 x^2-6 x+5$.", + "Output Answer": [ + "$-\\frac{x^2}{4}+\\frac{7 x}{32}-\\frac{353}{256}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**5-8*x**3+6*x**2+9*x+7\nq = 8*x**3+7*x**2-6*x+5\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-6 x+24 y-23=0$, $4 x-3 y+9=0$", + "Output Answer": [ + "$x=-\\frac{49}{26}$, $y=\\frac{19}{39}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-6*x+24*y-23, 4*x-3*y+9), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{21 \\left(\\sin \\left(\\frac{11 \\pi }{180}\\right)+i \\cos \\left(\\frac{11 \\pi }{180}\\right)\\right)}{e}$.", + "Output Answer": [ + "Norm: $\\frac{21 \\sqrt{\\sin ^2\\left(\\frac{11 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{11 \\pi }{180}\\right)}}{e}$\nArgument: $-\\frac{101 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((21*(math.sin(((11*math.pi)/180))+i*math.cos(((11*math.pi)/180))))/math.e)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{33 x}{2}+\\frac{79 y}{4}+6=0$, $\\frac{77 x}{4}-\\frac{9 y}{4}+\\frac{99}{4}=0$", + "Output Answer": [ + "$x=-\\frac{8037}{5489}$, $y=-\\frac{762}{499}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((33*x)/2)+((79*y)/4)+6, ((77*x)/4)-((9*y)/4)+(99/4)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$4 \\sqrt{5} y-6 \\sqrt{5}=0$, $10 \\sqrt{5} x+11 \\sqrt{5} y+6 \\sqrt{5}=0$", + "Output Answer": [ + "$x=-\\frac{9}{4}$, $y=\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((4*sqrt(5)*y-6*sqrt(5), 10*sqrt(5)*x+11*sqrt(5)*y+6*sqrt(5)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-17 x+21 y-2=0$, $-15 x-20 y-15=0$", + "Output Answer": [ + "$x=-\\frac{71}{131}$, $y=-\\frac{45}{131}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-17*x+21*y-2, -15*x-20*y-15), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{1+7}{(19+9)+9}$.", + "Output Answer": [ + "$\\frac{8}{37}$" + ], + "Output Program": [ + "try: \n print(((1+7)/((19+9)+9)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{11 x^2-5 x+21}{\\sqrt{3}}$, $q(x) = \\frac{21 x^2-9 x+13}{\\sqrt{3}}$", + "Output Answer": [ + "$7 \\sqrt{3} x^2+\\frac{11 x^2}{\\sqrt{3}}-3 \\sqrt{3} x-\\frac{5 x}{\\sqrt{3}}+7 \\sqrt{3}+\\frac{13}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((11*x**2-5*x+21)/(sqrt(3)))\nq = ((21*x**2-9*x+13)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{25 x^2}{\\sqrt{\\pi }}+\\frac{22 x}{\\sqrt{\\pi }}+\\frac{21}{\\sqrt{\\pi }}$ and $q(x) = -\\frac{3 x^2}{\\sqrt{\\pi }}+\\frac{23 x}{\\sqrt{\\pi }}+\\frac{1}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{75 x^4}{\\pi }-\\frac{641 x^3}{\\pi }+\\frac{418 x^2}{\\pi }+\\frac{505 x}{\\pi }+\\frac{21}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((25*x**2)/(sqrt(pi)))+((22*x)/(sqrt(pi)))+(21/(sqrt(pi)))\nq = -((3*x**2)/(sqrt(pi)))+((23*x)/(sqrt(pi)))+(1/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $13 x^2+3 x+3$", + "Output Answer": [ + "$13 \\left(x+\\frac{3}{26}\\right)^2+\\frac{147}{52}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (13*x**2+3*x+3), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{7 \\left(\\cos \\left(\\frac{1}{6}\\right)+i \\sin \\left(\\frac{1}{6}\\right)\\right)}{\\sqrt{3}}\\right)^6$", + "Output Answer": [ + "$\\frac{117649}{27} (\\cos (1)+i \\sin (1))$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((7*(math.cos((1/6))+1j*math.sin((1/6))))/(math.sqrt(3))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(18+24)+(25-8)$.", + "Output Answer": [ + "$59$" + ], + "Output Program": [ + "try: \n print((18+24)+(25-8))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $x^5-6 x^4+8 x^3+9 x^2+4 x$ when divided by $-10 x^2-8 x-8$.", + "Output Answer": [ + "$-\\frac{x^3}{10}+\\frac{17 x^2}{25}-\\frac{158 x}{125}-\\frac{541}{1250}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**5-6*x**4+8*x**3+9*x**2+4*x\nq = -10*x**2-8*x-8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\tanh (5-2 x)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = tanh(5-2*x)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(\\cos \\left(\\frac{143}{90}\\right)+i \\sin \\left(\\frac{143}{90}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$256 \\left(\\cos \\left(\\frac{572}{45}\\right)+i \\sin \\left(\\frac{572}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(math.cos((143/90))+1j*math.sin((143/90))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{16 x^2}{\\sqrt{3}}+2 \\sqrt{3} x-\\frac{13}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{16} \\left(-3-\\sqrt{217}\\right)\\lor x=\\frac{1}{16} \\left(\\sqrt{217}-3\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((16*x**2)/(sqrt(3)))+2*sqrt(3)*x-(13/(sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{2}{5} (13 t-86), x(t)=2 t-15$", + "Output Answer": [ + "$y=-\\frac{13 x}{5}-\\frac{23}{5}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -(2/5)*(13*t-86)\nx_t = 2*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\sqrt{5}, 6, 5)$", + "Output Answer": [ + "$\\left\\{\\sqrt{66},\\tan ^{-1}\\left(\\frac{\\sqrt{41}}{5}\\right),\\tan ^{-1}\\left(\\frac{6}{\\sqrt{5}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.sqrt(5)\ny = 6\nz = 5\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{31}{7}-12 x}+\\sqrt{\\frac{11}{7}-\\frac{5 x}{7}}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-8388+8 \\sqrt{754537}}{6241}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((31/7)-12*x)+sqrt((11/7)-((5*x)/7)), 4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 13 x^2-10 x-3$, $q(x) = -11 x^2-4 x+6$", + "Output Answer": [ + "$2 x^2-14 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 13*x**2-10*x-3\nq = -11*x**2-4*x+6\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{1}{16} ((25-25)+14)-13}{19+24}$.", + "Output Answer": [ + "$-\\frac{97}{344}$" + ], + "Output Program": [ + "try: \n print((((1/16)*((25-25)+14)-13)/(19+24)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $10 x^2+\\frac{9 x}{2}-\\frac{5}{2}$ when divided by $-4 x^2+\\frac{x}{2}+\\frac{7}{2}$.", + "Output Answer": [ + "$-\\frac{5}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x**2+((9*x)/2)-(5/2)\nq = -4*x**2+(x/2)+(7/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(\\cos \\left(\\frac{59}{45}\\right)+i \\sin \\left(\\frac{59}{45}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$16 \\left(\\cos \\left(\\frac{236}{45}\\right)+i \\sin \\left(\\frac{236}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(math.cos((59/45))+1j*math.sin((59/45))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{13-16 i}{\\sqrt{3}}$ and $y=-\\frac{14+6 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{1+22 i}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((13-16*i)/(math.sqrt(3)))\ny = -((14+6*i)/(math.sqrt(3)))\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^3+7 x^2-12 x+4$ and $-x^2-3 x+2$.", + "Output Answer": [ + "$x^2+3 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**3+7*x**2-12*x+4, -x**2-3*x+2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-15 x^2+\\frac{27 x}{2}-\\frac{9}{2}$", + "Output Answer": [ + "$-15 \\left(x-\\frac{9}{20}\\right)^2-\\frac{117}{80}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-15*x**2+((27*x)/2)-(9/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{11100 x^3}{49}-\\frac{11884 x^2}{49}+\\frac{25464 x}{49}-\\frac{5032}{49}}{\\frac{1800 x^2}{49}-\\frac{4008 x}{49}+\\frac{816}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{37} \\left(-24-\\sqrt{3314}\\right)\\right\\},\\left\\{x\\to \\frac{1}{37} \\left(-24+\\sqrt{3314}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((11100*x**3)/49)-((11884*x**2)/49)+((25464*x)/49)-(5032/49))/(((1800*x**2)/49)-((4008*x)/49)+(816/49))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left((12+17)^2+4\\right)^2-\\left((((23-9)-5)+23)^2-18\\right)$.", + "Output Answer": [ + "$713019$" + ], + "Output Program": [ + "try: \n print(((12+17)**2+4)**2-((((23-9)-5)+23)**2-18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 13-\\frac{11 x}{2}\\right| =\\frac{39}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{13}{11}\\right\\},\\left\\{x\\to \\frac{65}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(13-((11*x)/2)), (39/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5-2 x}+\\sqrt{10 x+1}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{36} \\left(62-5 \\sqrt{31}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5-2*x)+sqrt(10*x+1), 5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^2+2 x-5$ and $-5$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**2+2*x-5, -5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^4+7 x^3+2 x^2+7 x-4$ when divided by $9 x+3$.", + "Output Answer": [ + "$\\frac{5 x^3}{9}+\\frac{16 x^2}{27}+\\frac{2 x}{81}+\\frac{187}{243}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**4+7*x**3+2*x**2+7*x-4\nq = 9*x+3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-3 x^6-x^5-5 x^4-\\frac{17 x^3}{2}-\\frac{19 x^2}{2}+\\frac{x}{2}-9$ when divided by $1$.", + "Output Answer": [ + "$-3 x^6-x^5-5 x^4-\\frac{17 x^3}{2}-\\frac{19 x^2}{2}+\\frac{x}{2}-9$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x**6-x**5-5*x**4-((17*x**3)/2)-((19*x**2)/2)+(x/2)-9\nq = 1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{1}{81}$, and $a_n=a_{n-1}+\\frac{7}{\\sqrt{2}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$\\frac{23}{2} \\left(\\frac{2}{81}+77 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = (1/81) # initial value\nd = (7/(math.sqrt(2))) # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (1/81) # initial value\nd = (7/(math.sqrt(2))) # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((23+2)-1)+2)+(((24-1)+4)-6)$.", + "Output Answer": [ + "$47$" + ], + "Output Program": [ + "try: \n print((((23+2)-1)+2)+(((24-1)+4)-6))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=6+8 i$ and $y=-8+9 i$", + "Output Answer": [ + "$14-i$" + ], + "Output Program": [ + "i = 1j\nx = 6+8*i\ny = -8+9*i\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{17}{73}$, and $a_n=a_{n-1}+\\frac{12}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$2 \\left(\\frac{34}{73}+\\frac{36}{\\sqrt{5}}\\right)$" + ], + "Output Program": [ + "import math\n\na = (17/73) # initial value\nd = (12/(math.sqrt(5))) # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (17/73) # initial value\nd = (12/(math.sqrt(5))) # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-9 x^2+12 x-12$", + "Output Answer": [ + "$x=\\frac{2}{3} \\left(1-i \\sqrt{2}\\right)\\lor x=\\frac{2}{3} \\left(1+i \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-9*x**2+12*x-12, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{21 x^2}{\\sqrt{2}}+\\frac{19 x}{\\sqrt{2}}+10 \\sqrt{2}$", + "Output Answer": [ + "$x=-\\frac{-\\frac{19}{\\sqrt{2}}-\\sqrt{\\frac{2041}{2}}}{21 \\sqrt{2}}\\lor x=-\\frac{\\sqrt{\\frac{2041}{2}}-\\frac{19}{\\sqrt{2}}}{21 \\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((21*x**2)/(sqrt(2)))+((19*x)/(sqrt(2)))+10*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{\\sqrt{2}}-\\sqrt{8}$.", + "Output Answer": [ + "$\\sqrt[4]{2}-2 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(sqrt(2))-sqrt(8))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{47 x}{5}-12 y-\\frac{113}{5}=0$, $-8 x+\\frac{27 y}{5}+\\frac{67}{5}=0$", + "Output Answer": [ + "$x=\\frac{323}{1223}$, $y=-\\frac{7669}{3669}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((47*x)/5)-12*y-(113/5), -8*x+((27*y)/5)+(67/5)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 14 x^2+11 x-10$, $q(x) = 2 x^2+15 x-2$", + "Output Answer": [ + "$16 x^2+26 x-12$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 14*x**2+11*x-10\nq = 2*x**2+15*x-2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 15 x^2+17 x-1\\right| =-4$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(15*x**2+17*x-1), -4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{47}{12}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$-\\frac{235}{4}$" + ], + "Output Program": [ + "a = -(47/12) # initial value\nd = 0 # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(47/12) # initial value\nd = 0 # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -2 x^2-13$ and $q(x) = 6 x-13 x^2$", + "Output Answer": [ + "$26 x^4-12 x^3+169 x^2-78 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -2*x**2-13\nq = 6*x-13*x**2\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the third order series of the inverse of the following function around 3:\n$\\frac{\\sqrt[3]{x}}{\\sqrt[3]{5}}$", + "Output Answer": [ + "$5 (x-1)^3+15 (x-1)^2+15 (x-1)+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, ((cbrt(x))/(cbrt(5))))\nprint(solve(f, x)[0].series(y, 3, 3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{11-3 i}{\\sqrt{3}}$ and $y=\\frac{10-i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{1-2 i}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((11-3*i)/(math.sqrt(3)))\ny = ((10-i)/(math.sqrt(3)))\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2+20 x-\\frac{160}{9}$", + "Output Answer": [ + "$-10 \\left(\\frac{2}{3}-x\\right) \\left(x+\\frac{8}{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2+20*x-(160/9), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2+\\frac{26 x}{3}+\\frac{400}{3}$", + "Output Answer": [ + "$\\left(\\frac{50}{3}-x\\right) (x+8)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2+((26*x)/3)+(400/3), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-5 \\sqrt{3} \\left(\\cos \\left(\\frac{13}{10}\\right)+i \\sin \\left(\\frac{13}{10}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-158203125 \\sqrt{3} \\left(\\cos \\left(\\frac{117}{10}\\right)+i \\sin \\left(\\frac{117}{10}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-5*math.sqrt(3)*(math.cos((13/10))+1j*math.sin((13/10))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$-\\sin (7 x+3)$", + "Output Answer": [ + "$-1\\leq y\\leq 1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(-sin(7*x+3), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 15 x^2+4 x+4$ and $q(x) = 13 x^2+15 x+1$", + "Output Answer": [ + "$195 x^4+277 x^3+127 x^2+64 x+4$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 15*x**2+4*x+4\nq = 13*x**2+15*x+1\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 \\sqrt{3} x^2-\\frac{13 x}{\\sqrt{3}}+\\frac{11}{\\sqrt{3}}$ and $q(x) = \\frac{25 x^2}{\\sqrt{3}}+\\frac{25 x}{\\sqrt{3}}-6 \\sqrt{3}$", + "Output Answer": [ + "$125 x^4+\\frac{50 x^3}{3}-\\frac{320 x^2}{3}+\\frac{509 x}{3}-66$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*sqrt(3)*x**2-((13*x)/(sqrt(3)))+(11/(sqrt(3)))\nq = ((25*x**2)/(sqrt(3)))+((25*x)/(sqrt(3)))-6*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 16 (x-3)^4, q(x) = 5-6 x$", + "Output Answer": [ + "$16 x^4-192 x^3+864 x^2-1734 x+1301$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 16*(x-3)**4\nq = 5-6*x\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-17 x+11 y-15=0$, $11 x-22=0$", + "Output Answer": [ + "$x=2$, $y=\\frac{49}{11}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-17*x+11*y-15, 11*x-22), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{7}{8}-7}{24+11}$.", + "Output Answer": [ + "$-\\frac{7}{40}$" + ], + "Output Program": [ + "try: \n print((((7/8)-7)/(24+11)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 10 x^2+7 x+4$, $q(x) = -9 x^2+13 x+1$", + "Output Answer": [ + "$x^2+20 x+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x**2+7*x+4\nq = -9*x**2+13*x+1\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-10 x+9 y^2+2 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x-\\frac{5}{4}\\right)^2+9 \\left(y+\\frac{1}{9}\\right)^2=\\frac{373}{36}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{4}-\\frac{\\sqrt{1865}}{36} & -\\frac{1}{9} \\\\\n \\frac{1}{36} \\left(45+\\sqrt{1865}\\right) & -\\frac{1}{9} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{5}{4}-\\frac{\\sqrt{1865}}{36}+\\frac{1}{36} \\left(45+\\sqrt{1865}\\right)\\right),-\\frac{1}{9}\\right\\}$\nArea Enclosed: $\\frac{373 \\pi }{216}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-10*x+9*y**2+2*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-42 t-88, x(t)=-7 t-15$", + "Output Answer": [ + "$y=6 x+2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -42*t-88\nx_t = -7*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\sqrt{2} x^2+\\frac{3 x}{\\sqrt{2}}-\\frac{11}{\\sqrt{2}}$", + "Output Answer": [ + "$\\sqrt{2} \\left(x+\\frac{3}{4}\\right)^2-\\frac{97}{8 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (math.sqrt(2)*x**2+((3*x)/(math.sqrt(2)))-(11/(math.sqrt(2)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\log (5-4 x)$ at the point $x=-2$", + "Output Answer": [ + "$\\log (13) = 2.565$" + ], + "Output Program": [ + "import math\n\nx = -2\ntry: \n f = math.log(5-4*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-8 x+2 y^2+3 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 (x-1)^2+2 \\left(y+\\frac{3}{4}\\right)^2=\\frac{49}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n 1 & \\frac{1}{8} \\left(-6-7 \\sqrt{2}\\right) \\\\\n 1 & \\frac{1}{8} \\left(7 \\sqrt{2}-6\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{1,\\frac{1}{2} \\left(\\frac{1}{8} \\left(-6-7 \\sqrt{2}\\right)+\\frac{1}{8} \\left(7 \\sqrt{2}-6\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{49 \\pi }{16 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-8*x+2*y**2+3*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 12 x+15| =24$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{13}{4}\\right\\},\\left\\{x\\to \\frac{3}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(12*x+15), 24), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^3+8 x^2+8 x+\\frac{17}{2}$ when divided by $\\frac{5 x^2}{2}-\\frac{13 x}{2}+\\frac{5}{2}$.", + "Output Answer": [ + "$-\\frac{12 x}{5}-\\frac{76}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**3+8*x**2+8*x+(17/2)\nq = ((5*x**2)/2)-((13*x)/2)+(5/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{11 x^2}{\\sqrt{2}}+2 \\sqrt{2} x-4 \\sqrt{2}$ and $q(x) = \\frac{17 x^2}{\\sqrt{2}}-\\frac{7 x}{\\sqrt{2}}+\\frac{19}{\\sqrt{2}}$", + "Output Answer": [ + "$\\frac{187 x^4}{2}-\\frac{9 x^3}{2}+\\frac{45 x^2}{2}+66 x-76$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((11*x**2)/(sqrt(2)))+2*sqrt(2)*x-4*sqrt(2)\nq = ((17*x**2)/(sqrt(2)))-((7*x)/(sqrt(2)))+(19/(sqrt(2)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{67 x^2}{4}-\\frac{55 x}{4}-3\\right| =-\\frac{65}{4}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((67*x**2)/4)-((55*x)/4)-3), -(65/4)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -9 x^2+15 x-10$ and $q(x) = x^2+x$", + "Output Answer": [ + "$-9 x^4+6 x^3+5 x^2-10 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -9*x**2+15*x-10\nq = x**2+x\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{43}{50}$, and $a_n=a_{n-1}+-4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$-\\frac{1371}{25}$" + ], + "Output Program": [ + "a = (43/50) # initial value\nd = -4 # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (43/50) # initial value\nd = -4 # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{10 x^2}{9}+\\frac{2 x}{3}+\\frac{8}{9}$ and $-\\frac{5 x^2}{3}+x+\\frac{4}{3}$.", + "Output Answer": [ + "$\\frac{5 x^2}{9}-\\frac{x}{3}-\\frac{4}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((10*x**2)/9)+((2*x)/3)+(8/9), -((5*x**2)/3)+x+(4/3)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $10 x+9$ when divided by $2-6 x$.", + "Output Answer": [ + "$-\\frac{5}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x+9\nq = 2-6*x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^3-4 x^2+\\frac{9 x}{2}-\\frac{19}{2}$ when divided by $-\\frac{7 x}{2}-\\frac{11}{2}$.", + "Output Answer": [ + "$\\frac{12 x^2}{7}-\\frac{76 x}{49}+\\frac{395}{343}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**3-4*x**2+((9*x)/2)-(19/2)\nq = -((7*x)/2)-(11/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\sqrt{5} x^2+6 \\sqrt{5} x+4 \\sqrt{5}$", + "Output Answer": [ + "$x=-3-\\sqrt{5}\\lor x=\\sqrt{5}-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(sqrt(5)*x**2+6*sqrt(5)*x+4*sqrt(5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $11 x^3+\\frac{715 x^2}{2}+\\frac{8701 x}{4}-\\frac{99715}{8}$", + "Output Answer": [ + "$11 \\left(-x-\\frac{37}{2}\\right) \\left(-x-\\frac{35}{2}\\right) \\left(x-\\frac{7}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(11*x**3+((715*x**2)/2)+((8701*x)/4)-(99715/8), a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-3 \\sqrt{5} x^2-3 \\sqrt{5} x+5 \\sqrt{5}$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(-3-\\sqrt{69}\\right)\\lor x=\\frac{1}{6} \\left(\\sqrt{69}-3\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-3*sqrt(5)*x**2-3*sqrt(5)*x+5*sqrt(5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-125 x^3+20 x^2-229 x+312}{175 x^2+7 x-168}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-125*x**3+20*x**2-229*x+312)/(175*x**2+7*x-168)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(9+16)-\\left(\\frac{1}{19} ((11+9)+13)+5\\right)$.", + "Output Answer": [ + "$\\frac{347}{19}$" + ], + "Output Program": [ + "try: \n print((9+16)-((1/19)*((11+9)+13)+5))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-9 \\left(\\cos \\left(\\frac{131}{90}\\right)+i \\sin \\left(\\frac{131}{90}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$6561 \\left(\\cos \\left(\\frac{262}{45}\\right)+i \\sin \\left(\\frac{262}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-9*(math.cos((131/90))+1j*math.sin((131/90))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{13+7 i}{\\sqrt{\\pi }}$ and $y=\\frac{2-16 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{43}{130}+\\frac{111 i}{130}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((13+7*i)/(math.sqrt(math.pi)))\ny = ((2-16*i)/(math.sqrt(math.pi)))\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{28 x^3-\\frac{53 x^2}{3}-61 x-\\frac{46}{3}}{-\\frac{224 x}{3}-\\frac{64}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to -1\\},\\left\\{x\\to \\frac{23}{12}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((28*x**3-((53*x**2)/3)-61*x-(46/3))/(-((224*x)/3)-(64/3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 6 x^2+20 x-24\\right| =-9$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(6*x**2+20*x-24), -9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 11 x^2+11 x-12$ and $q(x) = -15 x^2-11 x-9$", + "Output Answer": [ + "$-165 x^4-286 x^3-40 x^2+33 x+108$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 11*x**2+11*x-12\nq = -15*x**2-11*x-9\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((22-19)+10)+5) \\left(\\left(\\left(\\frac{4}{4}-13\\right)^2-10\\right)+24\\right)^2$.", + "Output Answer": [ + "$449352$" + ], + "Output Program": [ + "try: \n print((((22-19)+10)+5)*((((4/4)-13)**2-10)+24)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\sqrt{3} (x-3), q(x) = \\sqrt{3} (x+4)$", + "Output Answer": [ + "$7 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -sqrt(3)*(x-3)\nq = sqrt(3)*(x+4)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{5 \\sqrt{2} x^2-15 \\sqrt{2} x-12 \\sqrt{2}}{11 \\sqrt{2} x+2 \\sqrt{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(15-\\sqrt{465}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(15+\\sqrt{465}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((5*sqrt(2)*x**2-15*sqrt(2)*x-12*sqrt(2))/(11*sqrt(2)*x+2*sqrt(2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{16} (169 t+402)^2, x(t)=-\\frac{13 t}{2}-15$", + "Output Answer": [ + "$y=\\frac{169 x^2}{4}-39 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/16)*(169*t+402)**2\nx_t = -((13*t)/2)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$13 x+20 y-14=0$, $-21 x-11 y+14=0$", + "Output Answer": [ + "$x=\\frac{126}{277}$, $y=\\frac{112}{277}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((13*x+20*y-14, -21*x-11*y+14), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$11 x-21 y-23=0$, $9 x+15 y+5=0$", + "Output Answer": [ + "$x=\\frac{40}{59}$, $y=-\\frac{131}{177}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((11*x-21*y-23, 9*x+15*y+5), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(7+4 i) \\sqrt{2}$ and $y=(2-i) \\sqrt{2}$", + "Output Answer": [ + "$(9+3 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (7+4*i)*math.sqrt(2)\ny = (2-i)*math.sqrt(2)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| x-18| =-18$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(x-18), -18), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| x+24| =16$", + "Output Answer": [ + "$\\{\\{x\\to -40\\},\\{x\\to -8\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(x+24), 16), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{6}{95}$, and $a_n=a_{n-1}+4 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$4 \\left(\\frac{12}{95}+28 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\na = (6/95) # initial value\nd = 4*math.sqrt(3) # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (6/95) # initial value\nd = 4*math.sqrt(3) # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{8 x^2-37 x-16}{\\pi }$, $q(x) = \\frac{20 x^2+18 x+37}{\\pi }$", + "Output Answer": [ + "$\\frac{28 x^2}{\\pi }-\\frac{19 x}{\\pi }+\\frac{21}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((8*x**2-37*x-16)/pi)\nq = ((20*x**2+18*x+37)/pi)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2-7 x-3 y^2-2 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x-\\frac{7}{6}\\right)^2-3 \\left(y+\\frac{1}{3}\\right)^2=\\frac{35}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{7}{6}-\\sqrt{\\frac{35}{6}} & -\\frac{1}{3} \\\\\n \\frac{7}{6}+\\sqrt{\\frac{35}{6}} & -\\frac{1}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{7}{6},-\\frac{1}{3}\\right\\}$\nAsymptotes: $\\left\\{y=x-\\frac{3}{2},y=\\frac{5}{6}-x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2-7*x-3*y**2-2*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(14+4)+\\frac{2}{19}$.", + "Output Answer": [ + "$\\frac{344}{19}$" + ], + "Output Program": [ + "try: \n print((14+4)+(2/19))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 4 \\sqrt{2} x^2+6 \\sqrt{2} x+\\sqrt{2}\\right| =\\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{2}\\right\\},\\{x\\to -1\\},\\left\\{x\\to -\\frac{1}{2}\\right\\},\\{x\\to 0\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(4*sqrt(2)*x**2+6*sqrt(2)*x+sqrt(2)), sqrt(2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{144 x^2+99 x+\\frac{27}{2}}{-344 x-\\frac{129}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((144*x**2+99*x+(27/2))/(-344*x-(129/2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 17 x^2+4 x+12\\right| =20$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{17} \\left(-1-\\sqrt{35}\\right)\\right\\},\\left\\{x\\to \\frac{2}{17} \\left(-1+\\sqrt{35}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(17*x**2+4*x+12), 20), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2+117 x+1026$", + "Output Answer": [ + "$9 (19-x) (x+6)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2+117*x+1026, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-21 x^2+2 x+2}{12 x-12}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{21} \\left(1-\\sqrt{43}\\right)\\right\\},\\left\\{x\\to \\frac{1}{21} \\left(1+\\sqrt{43}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-21*x**2+2*x+2)/(12*x-12)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{13}{85}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{118989}{85}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(13/85) # initial value\nd = 4 # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(13/85) # initial value\nd = 4 # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2+62 x+440$", + "Output Answer": [ + "$2 (-x-20) (-x-11)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2+62*x+440, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{171}+\\sqrt{19}\\right)+\\sqrt{193}$.", + "Output Answer": [ + "$4 \\sqrt{19}+\\sqrt{193}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(171)+sqrt(19))+sqrt(193))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{27 x}{4}-\\frac{11 y}{4}+\\frac{39}{4}=0$, $-\\frac{45 x}{2}+\\frac{25 y}{2}+\\frac{43}{4}=0$", + "Output Answer": [ + "$x=\\frac{2423}{2340}$, $y=\\frac{261}{260}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((27*x)/4)-((11*y)/4)+(39/4), -((45*x)/2)+((25*y)/2)+(43/4)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{7+26 i}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{5 \\sqrt{29}}{\\pi }$\nArgument: $\\tan ^{-1}\\left(\\frac{26}{7}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((7+26*i)/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{10 x^2}{\\sqrt{3}}+\\frac{13 x}{\\sqrt{3}}+\\frac{13}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{20} \\left(13-\\sqrt{689}\\right)\\lor x=\\frac{1}{20} \\left(13+\\sqrt{689}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((10*x**2)/(sqrt(3)))+((13*x)/(sqrt(3)))+(13/(sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -18 x^2+25 x-19\\right| =23$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{36} \\left(25-\\sqrt{913}\\right)\\right\\},\\left\\{x\\to \\frac{1}{36} \\left(25+\\sqrt{913}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-18*x**2+25*x-19), 23), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-11 \\sqrt{5} y+7 \\sqrt{5} z+\\sqrt{5}=0$, $-9 \\sqrt{5} x-7 \\sqrt{5} y+4 \\sqrt{5} z-7 \\sqrt{5}=0$, $2 \\sqrt{5} x+9 \\sqrt{5} y+2 \\sqrt{5}=0$", + "Output Answer": [ + "$x=-\\frac{467}{557}$, $y=-\\frac{20}{557}$, $z=-\\frac{111}{557}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-11*sqrt(5)*y+7*sqrt(5)*z+sqrt(5), -9*sqrt(5)*x-7*sqrt(5)*y+4*sqrt(5)*z-7*sqrt(5), 2*sqrt(5)*x+9*sqrt(5)*y+2*sqrt(5))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$-\\frac{9 x^5}{2}-\\log \\left(7 x^2-\\frac{9}{2}\\right)+9$", + "Output Answer": [ + "$x<-\\frac{3}{\\sqrt{14}}\\lor x>\\frac{3}{\\sqrt{14}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = -((9*x**5)/2)-log(7*x**2-(9/2))+9\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-5 x^2-x+11$", + "Output Answer": [ + "$x=\\frac{1}{10} \\left(-1-\\sqrt{221}\\right)\\lor x=\\frac{1}{10} \\left(\\sqrt{221}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-5*x**2-x+11, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -18 x-9| =20$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{29}{18}\\right\\},\\left\\{x\\to \\frac{11}{18}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-18*x-9), 20), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(1+23) ((3+9)-9)$.", + "Output Answer": [ + "$72$" + ], + "Output Program": [ + "try: \n print((1+23)*((3+9)-9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-9 x-\\frac{43}{3}}+\\sqrt{-\\frac{4 x}{3}-\\frac{13}{3}}=\\frac{44}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-62086+88 \\sqrt{196737}}{1587}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-9*x-(43/3))+sqrt(-((4*x)/3)-(13/3)), (44/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{22}{25}$, and $a_n=a_{n-1}+\\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$8 \\left(15 \\sqrt{5}-\\frac{44}{25}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(22/25) # initial value\nd = math.sqrt(5) # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(22/25) # initial value\nd = math.sqrt(5) # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{15 x^2}{2}+\\frac{97 x}{4}-\\frac{67}{4}}{\\frac{65 x^2}{4}-\\frac{77 x}{4}+\\frac{5}{4}}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to 1\\},\\left\\{x\\to \\frac{67}{30}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((15*x**2)/2)+((97*x)/4)-(67/4))/(((65*x**2)/4)-((77*x)/4)+(5/4))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-4 x-22 y+25=0$, $-14 x+20 y+17=0$", + "Output Answer": [ + "$x=\\frac{437}{194}$, $y=\\frac{141}{194}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-4*x-22*y+25, -14*x+20*y+17), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -2 \\left(7 x^2+3 x+4\\right)$, $q(x) = -2 x^2+6 x-13$", + "Output Answer": [ + "$-16 x^2-21$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*(7*x**2+3*x+4)\nq = -2*x**2+6*x-13\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{5} \\left(4 x^2-x+5\\right)$, $q(x) = \\sqrt{5} (3 x-4)$", + "Output Answer": [ + "$4 \\sqrt{5} x^2+2 \\sqrt{5} x+\\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(5)*(4*x**2-x+5)\nq = sqrt(5)*(3*x-4)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 10 x^2-6 x+13\\right| =14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(3-\\sqrt{19}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(3+\\sqrt{19}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(10*x**2-6*x+13), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{8}{24} (((19-17)-17)-4)$.", + "Output Answer": [ + "$-\\frac{19}{3}$" + ], + "Output Program": [ + "try: \n print((8/24)*(((19-17)-17)-4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $3 x+3-\\cos (3)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{y}{3}+\\frac{1}{3} (\\cos (3)-3)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, 3*x+3-cos(3))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{140 x^2-62 x-342}{220 x^2-226 x-306}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{19}{14}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((140*x**2-62*x-342)/(220*x**2-226*x-306)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{21-4 i}{\\pi }$ and $y=-\\frac{16-20 i}{\\pi }$", + "Output Answer": [ + "$-\\frac{5+16 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((21-4*i)/math.pi)\ny = -((16-20*i)/math.pi)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-4 x^2+64 x+68$", + "Output Answer": [ + "$-4 (-x-1) (17-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-4*x**2+64*x+68, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((8+3)+16)+((((4-16)-19)-10)+10)$.", + "Output Answer": [ + "$-4$" + ], + "Output Program": [ + "try: \n print(((8+3)+16)+((((4-16)-19)-10)+10))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{366 x^3}{25}+\\frac{3546 x^2}{25}-\\frac{1398 x}{25}-\\frac{516}{5}}{-\\frac{402 x}{25}-\\frac{804}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{122} \\left(19-\\sqrt{10853}\\right)\\right\\},\\left\\{x\\to \\frac{1}{122} \\left(19+\\sqrt{10853}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((366*x**3)/25)+((3546*x**2)/25)-((1398*x)/25)-(516/5))/(-((402*x)/25)-(804/5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -2 \\left(5 x^2-3 x+7\\right)$, $q(x) = 2 x^2-14 x+7$", + "Output Answer": [ + "$-8 x^2-8 x-7$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*(5*x**2-3*x+7)\nq = 2*x**2-14*x+7\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{13 x^2}{4}-\\frac{11 x}{2}-\\frac{3}{2}$", + "Output Answer": [ + "$\\frac{13}{4} \\left(x-\\frac{11}{13}\\right)^2-\\frac{199}{52}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((13*x**2)/4)-((11*x)/2)-(3/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 8 (3 x-1)^3, q(x) = 256 (2 x+1)^4$", + "Output Answer": [ + "$4096 x^4+8408 x^3+5928 x^2+2120 x+248$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*(3*x-1)**3\nq = 256*(2*x+1)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-1+3 i$ and $y=10+i$", + "Output Answer": [ + "$-\\frac{7}{101}+\\frac{31 i}{101}$" + ], + "Output Program": [ + "i = 1j\nx = -1+3*i\ny = 10+i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\log (x-21)}{\\log (4)}+\\frac{\\log (-9 x-12)}{\\log (4)}=\\frac{\\log (x-21)}{\\log (4)}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{13}{9}\\right\\},\\{x\\to 21\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(((log(x-21))/(log(4)))+((log(-9*x-12))/(log(4))), ((log(x-21))/(log(4)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $9 x^2+99 x-720$", + "Output Answer": [ + "$-9 (5-x) (x+16)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(9*x**2+99*x-720, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x+1}+\\sqrt{2 x+3}=3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{13}{72}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x+1)+sqrt(2*x+3), 3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-74 x^2-228 x-18}{-4 x-12}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{37}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-74*x**2-228*x-18)/(-4*x-12)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-4 x+22 y+6=0$, $-5 x+19 y+21=0$", + "Output Answer": [ + "$x=\\frac{174}{17}$, $y=\\frac{27}{17}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-4*x+22*y+6, -5*x+19*y+21), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{4} \\left(-31 x^2+2 x+33\\right)$, $q(x) = \\frac{23 x^2}{2}-\\frac{9 x}{4}-8$", + "Output Answer": [ + "$\\frac{15 x^2}{4}-\\frac{7 x}{4}+\\frac{1}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/4)*(-31*x**2+2*x+33)\nq = ((23*x**2)/2)-((9*x)/4)-8\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt[3]{50}+\\sqrt[3]{26}}{\\sqrt[3]{98}}$.", + "Output Answer": [ + "$\\frac{5^{2/3}+\\sqrt[3]{13}}{7^{2/3}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((cbrt(50)+cbrt(26))/(cbrt(98))))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{5} \\left(x^2-x+3\\right)$, $q(x) = -\\sqrt{5} \\left(7 x^2+6 x+2\\right)$", + "Output Answer": [ + "$-6 \\sqrt{5} x^2-7 \\sqrt{5} x+\\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(5)*(x**2-x+3)\nq = -sqrt(5)*(7*x**2+6*x+2)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\sqrt{2} x^2-3 \\sqrt{2} x-7 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(-3-i \\sqrt{19}\\right)\\lor x=\\frac{1}{2} \\left(-3+i \\sqrt{19}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-sqrt(2)*x**2-3*sqrt(2)*x-7*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^6-4 x^5+2 x^4+3 x^3-5 x^2+5 x-1$ when divided by $7 x^5+3 x^4-9 x^2-6 x-5$.", + "Output Answer": [ + "$-x-\\frac{1}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**6-4*x**5+2*x**4+3*x**3-5*x**2+5*x-1\nq = 7*x**5+3*x**4-9*x**2-6*x-5\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-11 x+15 y+18=0$, $2 x-25 y-19=0$", + "Output Answer": [ + "$x=\\frac{33}{49}$, $y=-\\frac{173}{245}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-11*x+15*y+18, 2*x-25*y-19), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2-9 x+3 y^2-7 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(y-\\frac{7}{6}\\right)^2-7 \\left(x+\\frac{9}{14}\\right)^2=\\frac{67}{21}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{9}{14} & \\frac{7}{6}-\\frac{\\sqrt{670}}{21} \\\\\n -\\frac{9}{14} & \\frac{7}{6}+\\frac{\\sqrt{670}}{21} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{10}{7}}$\nCenter: $\\left\\{-\\frac{9}{14},\\frac{7}{6}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{42} \\left(49-9 \\sqrt{21}\\right)-\\sqrt{\\frac{7}{3}} x,y=\\sqrt{\\frac{7}{3}} x+\\frac{1}{42} \\left(49+9 \\sqrt{21}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2-9*x+3*y**2-7*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $1-\\cosh (x+4)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$-\\cosh ^{-1}(1-y)-4\\text{ if }y\\leq 0$}\\right\\},\\left\\{x\\to \\fbox{$\\cosh ^{-1}(1-y)-4\\text{ if }y\\leq 0$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, 1-cosh(x+4))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 1-5 x, q(x) = (1-8 x)^2$", + "Output Answer": [ + "$64 x^2-21 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 1-5*x\nq = (1-8*x)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-7 x^3-210 x^2-1232 x+3360$", + "Output Answer": [ + "$-7 (-x-20) (2-x) (x+12)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-7*x**3-210*x**2-1232*x+3360, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-45 x^3+510 x^2-30 x-45}{45 x^2-195 x+60}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(11-\\sqrt{133}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(11+\\sqrt{133}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-45*x**3+510*x**2-30*x-45)/(45*x**2-195*x+60)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-2+9 i$ and $y=-5-10 i$", + "Output Answer": [ + "$-\\frac{16}{25}-\\frac{13 i}{25}$" + ], + "Output Program": [ + "i = 1j\nx = -2+9*i\ny = -5-10*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{54}{29}$, and $a_n=a_{n-1}+\\frac{16}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$\\frac{9}{2} \\left(\\frac{108}{29}+\\frac{128}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\na = (54/29) # initial value\nd = (16/(math.sqrt(3))) # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (54/29) # initial value\nd = (16/(math.sqrt(3))) # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{14}{3} \\left(14 t^2+60 t+63\\right), x(t)=49 t^2+210 t+225$", + "Output Answer": [ + "$y=6-\\frac{4 x}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -(14/3)*(14*t**2+60*t+63)\nx_t = 49*t**2+210*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$(-8 x-6)^2$", + "Output Answer": [ + "$y\\geq 0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range((-8*x-6)**2, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-14 x-14}+\\sqrt{14-3 x}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{121} \\left(-920+12 \\sqrt{4130}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-14*x-14)+sqrt(14-3*x), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{3}{2} \\left(\\cos \\left(\\frac{19 \\pi }{90}\\right)+i \\sin \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-\\frac{2187}{128} \\left(-\\sin \\left(\\frac{\\pi }{45}\\right)-i \\cos \\left(\\frac{\\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(3/2)*(math.cos(((19*math.pi)/90))+1j*math.sin(((19*math.pi)/90))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-14 x-15}+\\sqrt{-12 x-3}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -110+4 \\sqrt{741}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-14*x-15)+sqrt(-12*x-3), 4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -3 x^2-16 x-16\\right| =18$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-8-\\sqrt{70}\\right)\\right\\},\\left\\{x\\to \\frac{1}{3} \\left(-8+\\sqrt{70}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-3*x**2-16*x-16), 18), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=3 \\left(9 t^2+162 t+730\\right)^2, x(t)=3 t^2+54 t+243$", + "Output Answer": [ + "$y=27 x^2+18 x+3$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 3*(9*t**2+162*t+730)**2\nx_t = 3*t**2+54*t+243\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 t-\\frac{14}{\\sqrt{3}}+\\frac{26}{3}, x(t)=-4 \\sqrt{3} t-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=-\\frac{x}{\\sqrt{3}}-\\frac{14}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*t-(14/(sqrt(3)))+(26/3)\nx_t = -4*sqrt(3)*t-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 15 x^2-3 x-6$ and $q(x) = 13 x^2-2 x-13$", + "Output Answer": [ + "$195 x^4-69 x^3-267 x^2+51 x+78$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 15*x**2-3*x-6\nq = 13*x**2-2*x-13\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{28 x^2}{\\sqrt{3}}+\\frac{34 x}{\\sqrt{3}}+\\frac{16}{\\sqrt{3}}}{-7 \\sqrt{3} x^2+5 \\sqrt{3} x+\\frac{22}{\\sqrt{3}}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((28*x**2)/(sqrt(3)))+((34*x)/(sqrt(3)))+(16/(sqrt(3))))/(-7*sqrt(3)*x**2+5*sqrt(3)*x+(22/(sqrt(3))))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -2 \\sqrt{3} x-5 \\sqrt{3}\\right| =-\\frac{5}{\\sqrt{3}}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-2*sqrt(3)*x-5*sqrt(3)), -(5/(sqrt(3)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{21 x^2}{2}+\\frac{13 x}{4}+\\frac{29}{2}}{\\frac{67}{4}-5 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{84} \\left(13-\\sqrt{9913}\\right)\\right\\},\\left\\{x\\to \\frac{1}{84} \\left(13+\\sqrt{9913}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((21*x**2)/2)+((13*x)/4)+(29/2))/((67/4)-5*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\sqrt{2} e^{-\\frac{i \\pi }{15}}$.", + "Output Answer": [ + "Norm: $\\sqrt{2}$\nArgument: $\\frac{14 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.sqrt(2)*math.e**(-((i*math.pi)/15))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{47}{5} \\left(\\cos \\left(\\frac{22}{15}\\right)+i \\sin \\left(\\frac{22}{15}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$\\frac{23811286661761 \\left(\\cos \\left(\\frac{176}{15}\\right)+i \\sin \\left(\\frac{176}{15}\\right)\\right)}{390625}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(47/5)*(math.cos((22/15))+1j*math.sin((22/15))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-12 x+21 y+11=0$, $17 x+11 y+2=0$", + "Output Answer": [ + "$x=\\frac{79}{489}$, $y=-\\frac{211}{489}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-12*x+21*y+11, 17*x+11*y+2), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$3 x-3 y-19=0$, $-19 x-16 y-15=0$", + "Output Answer": [ + "$x=\\frac{37}{15}$, $y=-\\frac{58}{15}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((3*x-3*y-19, -19*x-16*y-15), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{73}{11}$, and $a_n=a_{n-1}+-4 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$5 \\left(-\\frac{146}{11}-36 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(73/11) # initial value\nd = -4*math.sqrt(2) # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(73/11) # initial value\nd = -4*math.sqrt(2) # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(11-8 i) \\log (2)$ and $y=(10-14 i) \\log (2)$", + "Output Answer": [ + "$\\frac{3}{4}+\\frac{i}{4}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (11-8*i)*math.log10(2)\ny = (10-14*i)*math.log10(2)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x-9}+3=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{153}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x-9)+3, 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -2 x^2+9 x-7\\right| =9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(9-\\sqrt{97}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(9+\\sqrt{97}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-2*x**2+9*x-7), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{89}{99}$, and $a_n=a_{n-1}+-\\frac{17}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=17$.", + "Output Answer": [ + "$-\\frac{112931}{99}$" + ], + "Output Program": [ + "a = (89/99) # initial value\nd = -(17/2) # second term\nn = 17 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (89/99) # initial value\nd = -(17/2) # second term\nn = 17 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\sqrt{3} \\left(\\cos \\left(\\frac{1}{6}\\right)+i \\sin \\left(\\frac{1}{6}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$248832 \\left(\\cos \\left(\\frac{5}{3}\\right)+i \\sin \\left(\\frac{5}{3}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*math.sqrt(3)*(math.cos((1/6))+1j*math.sin((1/6))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2+\\frac{864 x}{7}-\\frac{61248}{49}$", + "Output Answer": [ + "$-12 \\left(-x-\\frac{116}{7}\\right) \\left(x-\\frac{44}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2+((864*x)/7)-(61248/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 x^2-4 x-7$ and $q(x) = -8 x^2-4 x-6$", + "Output Answer": [ + "$-32 x^4+16 x^3+48 x^2+52 x+42$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*x**2-4*x-7\nq = -8*x**2-4*x-6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\sqrt{2} \\left(\\cos \\left(\\frac{17}{9}\\right)+i \\sin \\left(\\frac{17}{9}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$98 \\left(\\cos \\left(\\frac{34}{9}\\right)+i \\sin \\left(\\frac{34}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*math.sqrt(2)*(math.cos((17/9))+1j*math.sin((17/9))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2 \\sqrt{3} \\left(\\cos \\left(\\frac{13 \\pi }{180}\\right)+i \\sin \\left(\\frac{13 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $2 \\sqrt{3 \\left(\\sin ^2\\left(\\frac{13 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{180}\\right)\\right)}$\nArgument: $\\frac{13 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2*math.sqrt(3)*(math.cos(((13*math.pi)/180))+i*math.sin(((13*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{5 x}{2}+\\frac{9}{2}}+\\sqrt{9 x-\\frac{35}{4}}=\\frac{13}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{104} \\left(511-2 \\sqrt{41158}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((5*x)/2)+(9/2))+sqrt(9*x-(35/4)), (13/4)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\left(\\left(\\frac{25}{15}-17\\right)^2-18\\right)-14}{(((6+21)-18)+17)+18}$.", + "Output Answer": [ + "$\\frac{457}{99}$" + ], + "Output Program": [ + "try: \n print((((((25/15)-17)**2-18)-14)/((((6+21)-18)+17)+18)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-5 \\sqrt{2} e^{\\frac{4 i \\pi }{45}}$.", + "Output Answer": [ + "Norm: $5 \\sqrt{2}$\nArgument: $-\\frac{41 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -5*math.sqrt(2)*math.e**((4*i*math.pi)/45)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -10 x^2+7 x+4$, $q(x) = 2 \\left(3 x^2+x+3\\right)$", + "Output Answer": [ + "$-4 x^2+9 x+10$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -10*x**2+7*x+4\nq = 2*(3*x**2+x+3)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (3 x+8)^2, q(x) = 8-2 x$", + "Output Answer": [ + "$9 x^2+46 x+72$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (3*x+8)**2\nq = 8-2*x\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-12 x^2+2 x+15$", + "Output Answer": [ + "$x=\\frac{1}{12} \\left(1-\\sqrt{181}\\right)\\lor x=\\frac{1}{12} \\left(1+\\sqrt{181}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-12*x**2+2*x+15, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -12 x-\\frac{23}{4}\\right| =-\\frac{59}{4}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-12*x-(23/4)), -(59/4)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^5-4 x^4+9 x^2+3 x-2$ when divided by $5 x-9$.", + "Output Answer": [ + "$-\\frac{9 x^4}{5}-\\frac{101 x^3}{25}-\\frac{909 x^2}{125}-\\frac{7056 x}{625}-\\frac{61629}{3125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**5-4*x**4+9*x**2+3*x-2\nq = 5*x-9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^5+3 x^4-9 x^3-x^2+6 x-5$ when divided by $-4$.", + "Output Answer": [ + "$-\\frac{9 x^5}{4}-\\frac{3 x^4}{4}+\\frac{9 x^3}{4}+\\frac{x^2}{4}-\\frac{3 x}{2}+\\frac{5}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**5+3*x**4-9*x**3-x**2+6*x-5\nq = -4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x-9 y^2+9 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $8 x-9 y^2+9 y=-1$\nVertex: $\\left\\{-\\frac{13}{32},\\frac{1}{2}\\right\\}$\nDirectrix: $x=-\\frac{181}{288}$\nFocal Parameter: $\\frac{4}{9}$\nFocus: $\\left\\{-\\frac{53}{288},\\frac{1}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x-9*y**2+9*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2 e \\left(-\\sin \\left(\\frac{\\pi }{45}\\right)+i \\cos \\left(\\frac{\\pi }{45}\\right)\\right)$.", + "Output Answer": [ + "Norm: $2 e \\sqrt{\\sin ^2\\left(\\frac{\\pi }{45}\\right)+\\cos ^2\\left(\\frac{\\pi }{45}\\right)}$\nArgument: $\\frac{47 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2*math.e*(-math.sin((math.pi/45))+i*math.cos((math.pi/45)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^6-10 x^5-\\frac{23 x^4}{5}-5 x^3-\\frac{27 x^2}{5}-\\frac{4 x}{5}+10$ when divided by $-\\frac{17 x}{5}-6$.", + "Output Answer": [ + "$\\frac{45 x^5}{17}-\\frac{500 x^4}{289}+\\frac{21647 x^3}{4913}-\\frac{526585 x^2}{83521}+\\frac{18052617 x}{1419857}-\\frac{535899082}{24137569}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**6-10*x**5-((23*x**4)/5)-5*x**3-((27*x**2)/5)-((4*x)/5)+10\nq = -((17*x)/5)-6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+3 x+5 y^2-6 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $3 \\left(x+\\frac{1}{2}\\right)^2+5 \\left(y-\\frac{3}{5}\\right)^2=\\frac{111}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{10} \\left(-5-\\sqrt{74}\\right) & \\frac{3}{5} \\\\\n \\frac{1}{10} \\left(\\sqrt{74}-5\\right) & \\frac{3}{5} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{10} \\left(-5-\\sqrt{74}\\right)+\\frac{1}{10} \\left(\\sqrt{74}-5\\right)\\right),\\frac{3}{5}\\right\\}$\nArea Enclosed: $\\frac{37}{20} \\sqrt{\\frac{3}{5}} \\pi$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+3*x+5*y**2-6*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{35}{3}-\\frac{29 x}{3}}+\\sqrt{\\frac{20}{3}-2 x}=\\frac{22}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-15905+132 \\sqrt{12194}}{1587}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((35/3)-((29*x)/3))+sqrt((20/3)-2*x), (22/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-9 x^2-12 x+6$ and $3 x^2+4 x-2$.", + "Output Answer": [ + "$3 x^2+4 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-9*x**2-12*x+6, 3*x**2+4*x-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -12 x^2-10 x-15$, $q(x) = 2 \\left(2 x^2+x-6\\right)$", + "Output Answer": [ + "$-8 x^2-8 x-27$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -12*x**2-10*x-15\nq = 2*(2*x**2+x-6)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $5 x^2+\\frac{13 x}{2}+10$", + "Output Answer": [ + "$5 \\left(x+\\frac{13}{20}\\right)^2+\\frac{631}{80}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (5*x**2+((13*x)/2)+10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\log (6 x+9) \\tan (2 x+4)$ at the point $x=1$", + "Output Answer": [ + "$\\log (15) \\tan (6) = -0.788$" + ], + "Output Program": [ + "import math\n\nx = 1\ntry: \n f = math.log(6*x+9)*math.tan(2*x+4)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-9 x^3-144 x^2+1413 x+13860$", + "Output Answer": [ + "$9 (-x-7) (x-11) (x+20)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-9*x**3-144*x**2+1413*x+13860, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{50}{33}$, and $a_n=a_{n-1}+-4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=28$.", + "Output Answer": [ + "$-\\frac{48496}{33}$" + ], + "Output Program": [ + "a = (50/33) # initial value\nd = -4 # second term\nn = 28 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (50/33) # initial value\nd = -4 # second term\nn = 28 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sqrt[3]{-4 x-4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-y^3-4\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, cbrt(-4*x-4))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{83}{60}$, and $a_n=a_{n-1}+\\frac{39}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$\\frac{72524}{105}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (83/60) # initial value\nd = (39/7) # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (83/60) # initial value\nd = (39/7) # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 e x^2-4 e x$ and $q(x) = -2 e x^2+e x+2 e$", + "Output Answer": [ + "$8 e^2 x^4+4 e^2 x^3-12 e^2 x^2-8 e^2 x$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -4*math.e*x**2-4*math.e*x\nq = -2*math.e*x**2+math.e*x+2*math.e\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{11}{3} (2 x-1), q(x) = \\frac{1}{81} (8-23 x)^4$", + "Output Answer": [ + "$\\frac{279841 x^4}{81}-\\frac{389344 x^3}{81}+\\frac{67712 x^2}{27}-\\frac{46510 x}{81}+\\frac{3799}{81}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (11/3)*(2*x-1)\nq = (1/81)*(8-23*x)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-190 x^2-336 x+288}{20 x^2+38 x-24}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{12}{19}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-190*x**2-336*x+288)/(20*x**2+38*x-24)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{13 x^2}{2}+6 x+6$", + "Output Answer": [ + "$x=\\frac{2}{13} \\left(3-4 \\sqrt{3}\\right)\\lor x=\\frac{2}{13} \\left(3+4 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((13*x**2)/2)+6*x+6, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{3} (3-10 x)^2, q(x) = \\frac{1}{9} (7 x+3)^4$", + "Output Answer": [ + "$\\frac{2401 x^4}{9}+\\frac{1372 x^3}{3}+\\frac{982 x^2}{3}+64 x+12$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/3)*(3-10*x)**2\nq = (1/9)*(7*x+3)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(4-23) (((1+15)+21)-9)$.", + "Output Answer": [ + "$-532$" + ], + "Output Program": [ + "try: \n print((4-23)*(((1+15)+21)-9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2+24 \\sqrt{2} x+\\frac{51}{2}$", + "Output Answer": [ + "$-3 \\left(x-\\frac{17}{\\sqrt{2}}\\right) \\left(x+\\frac{1}{\\sqrt{2}}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2+24*sqrt(2)*x+(51/2), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -14 \\sqrt{2} x^2-\\frac{31 x}{\\sqrt{2}}+7 \\sqrt{2}\\right| =0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{56} \\left(-31-3 \\sqrt{281}\\right)\\right\\},\\left\\{x\\to \\frac{1}{56} \\left(-31+3 \\sqrt{281}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-14*sqrt(2)*x**2-((31*x)/(sqrt(2)))+7*sqrt(2)), 0), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-3 e^{1+\\frac{41 i \\pi }{45}}$.", + "Output Answer": [ + "Norm: $3 e$\nArgument: $-\\frac{4 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -3*math.e**(1+((41*i*math.pi)/45))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{25 x^2}{\\sqrt{3}}-\\frac{14 x}{\\sqrt{3}}-\\frac{14}{\\sqrt{3}}$ and $q(x) = -3 \\sqrt{3} x^2-8 \\sqrt{3} x+\\frac{7}{\\sqrt{3}}$", + "Output Answer": [ + "$75 x^4+242 x^3+\\frac{287 x^2}{3}+\\frac{238 x}{3}-\\frac{98}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((25*x**2)/(sqrt(3)))-((14*x)/(sqrt(3)))-(14/(sqrt(3)))\nq = -3*sqrt(3)*x**2-8*sqrt(3)*x+(7/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{11 \\left(-\\sin \\left(\\frac{2 \\pi }{9}\\right)+i \\cos \\left(\\frac{2 \\pi }{9}\\right)\\right)}{\\sqrt{2}}\\right)^2$", + "Output Answer": [ + "$\\frac{121}{2} \\left(-\\sin \\left(\\frac{\\pi }{18}\\right)-i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((11*(-math.sin(((2*math.pi)/9))+1j*math.cos(((2*math.pi)/9))))/(math.sqrt(2))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{4 \\left(\\sin \\left(\\frac{\\pi }{45}\\right)-i \\cos \\left(\\frac{\\pi }{45}\\right)\\right)}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $4 \\sqrt{\\frac{1}{3} \\left(\\sin ^2\\left(\\frac{\\pi }{45}\\right)+\\cos ^2\\left(\\frac{\\pi }{45}\\right)\\right)}$\nArgument: $-\\frac{43 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((4*(math.sin((math.pi/45))-i*math.cos((math.pi/45))))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x+1$ and $-3 x^5-x^4-5 x^3+x^2-3 x+2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x+1, -3*x**5-x**4-5*x**3+x**2-3*x+2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 11 x^2-5 x-9$ and $q(x) = -4 x^2+9 x-5$", + "Output Answer": [ + "$-44 x^4+119 x^3-64 x^2-56 x+45$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 11*x**2-5*x-9\nq = -4*x**2+9*x-5\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2+3 x+7 y^2-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 y^2-3 \\left(x-\\frac{1}{2}\\right)^2=\\frac{33}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & -\\sqrt{\\frac{55}{14}} \\\\\n \\frac{1}{2} & \\sqrt{\\frac{55}{14}} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{10}{3}}$\nCenter: $\\left\\{\\frac{1}{2},0\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{\\frac{3}{7}}}{2}-\\sqrt{\\frac{3}{7}} x,y=\\sqrt{\\frac{3}{7}} x-\\frac{\\sqrt{\\frac{3}{7}}}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2+3*x+7*y**2-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{2 x^2}{\\sqrt{3}}-5 \\sqrt{3} x-2 \\sqrt{3}\\right| =-\\frac{10}{\\sqrt{3}}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((2*x**2)/(sqrt(3)))-5*sqrt(3)*x-2*sqrt(3)), -(10/(sqrt(3)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{4}}{\\sqrt{140}-\\sqrt{38}}$.", + "Output Answer": [ + "$\\frac{2}{2 \\sqrt{35}-\\sqrt{38}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(4))/(sqrt(140)-sqrt(38))))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $10 x^2+4 x-12$", + "Output Answer": [ + "$10 \\left(x+\\frac{1}{5}\\right)^2-\\frac{62}{5}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (10*x**2+4*x-12), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-19 x^2-246 x-216}{-361 x^2+19 x+342}=0$", + "Output Answer": [ + "$\\{\\{x\\to -12\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-19*x**2-246*x-216)/(-361*x**2+19*x+342)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-16 x^2+12 x+10$ and $-4 x-2$.", + "Output Answer": [ + "$4 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-16*x**2+12*x+10, -4*x-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(9 \\left(\\cos \\left(\\frac{49}{90}\\right)+i \\sin \\left(\\frac{49}{90}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$43046721 \\left(\\cos \\left(\\frac{196}{45}\\right)+i \\sin \\left(\\frac{196}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((9*(math.cos((49/90))+1j*math.sin((49/90))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{17}{14}$, and $a_n=a_{n-1}+\\frac{9}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$3 \\left(\\frac{17}{7}+9 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\na = (17/14) # initial value\nd = (9/(math.sqrt(5))) # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (17/14) # initial value\nd = (9/(math.sqrt(5))) # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=3-\\frac{7 i}{2}$ and $y=\\frac{19}{2}-\\frac{i}{2}$", + "Output Answer": [ + "$-\\frac{13}{2}-3 i$" + ], + "Output Program": [ + "i = 1j\nx = 3-((7*i)/2)\ny = (19/2)-(i/2)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((18+19)+19)+9)-\\left(\\left(\\frac{\\frac{9}{18}}{20}-17\\right)-1\\right)$.", + "Output Answer": [ + "$\\frac{3319}{40}$" + ], + "Output Program": [ + "try: \n print((((18+19)+19)+9)-((((9/18)/20)-17)-1))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 (\\cos (1)+i \\sin (1))\\right)^10$", + "Output Answer": [ + "$59049 (\\cos (10)+i \\sin (10))$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(math.cos(1)+1j*math.sin(1)))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{1}{3}$, and $a_n=a_{n-1}+\\frac{17}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$7 \\left(\\frac{221}{\\sqrt{5}}-\\frac{2}{3}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(1/3) # initial value\nd = (17/(math.sqrt(5))) # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(1/3) # initial value\nd = (17/(math.sqrt(5))) # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-21 x-5 y+6 z-11=0$, $12 x-12 y-16 z-22=0$, $-11 x+4 y-20 z-20=0$", + "Output Answer": [ + "$x=-\\frac{31}{59}$, $y=-\\frac{2497}{2242}$, $z=-\\frac{4187}{4484}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-21*x-5*y+6*z-11, 12*x-12*y-16*z-22, -11*x+4*y-20*z-20)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $6 x^2-\\frac{108 x}{5}-\\frac{3402}{5}$", + "Output Answer": [ + "$-6 (-x-9) \\left(x-\\frac{63}{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(6*x**2-((108*x)/5)-(3402/5), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $6 x^5-9 x^4-12 x^3-12 x^2+15 x-3$ and $-2 x^5+3 x^4+4 x^3+4 x^2-5 x+1$.", + "Output Answer": [ + "$2 x^5-3 x^4-4 x^3-4 x^2+5 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(6*x**5-9*x**4-12*x**3-12*x**2+15*x-3, -2*x**5+3*x**4+4*x**3+4*x**2-5*x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\cos \\left(\\frac{5}{18}\\right)+i \\sin \\left(\\frac{5}{18}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$823543 \\left(\\cos \\left(\\frac{35}{18}\\right)+i \\sin \\left(\\frac{35}{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.cos((5/18))+1j*math.sin((5/18))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{16 e^{-\\frac{5 i \\pi }{12}}}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\frac{16}{\\sqrt{3}}$\nArgument: $-\\frac{5 \\pi }{12}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((16*math.e**(-((5*i*math.pi)/12)))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\sqrt{2} x^2-\\frac{13 x}{\\sqrt{2}}+10 \\sqrt{2}$ and $q(x) = \\frac{11 x^2}{\\sqrt{2}}-2 \\sqrt{2} x+4 \\sqrt{2}$", + "Output Answer": [ + "$-11 x^4-\\frac{135 x^3}{2}+128 x^2-92 x+80$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -sqrt(2)*x**2-((13*x)/(sqrt(2)))+10*sqrt(2)\nq = ((11*x**2)/(sqrt(2)))-2*sqrt(2)*x+4*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\sqrt{2} \\left(\\cos \\left(\\frac{31}{45}\\right)+i \\sin \\left(\\frac{31}{45}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$373248 \\left(\\cos \\left(\\frac{62}{15}\\right)+i \\sin \\left(\\frac{62}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*math.sqrt(2)*(math.cos((31/45))+1j*math.sin((31/45))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -3 x^2-3 x+11$, $q(x) = 2 x^2+15 x-12$", + "Output Answer": [ + "$-x^2+12 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x**2-3*x+11\nq = 2*x**2+15*x-12\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(18+18)-((((6+24)+3)-16)+25)$.", + "Output Answer": [ + "$-6$" + ], + "Output Program": [ + "try: \n print((18+18)-((((6+24)+3)-16)+25))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{5 x}{\\sqrt{3}}+\\sqrt{3} y-8 \\sqrt{3}=0$, $11 \\sqrt{3} x+\\frac{2 y}{\\sqrt{3}}-\\frac{7}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{27}{109}$, $y=\\frac{827}{109}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((5*x)/(sqrt(3)))+sqrt(3)*y-8*sqrt(3), 11*sqrt(3)*x+((2*y)/(sqrt(3)))-(7/(sqrt(3)))), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2-126 x-360$", + "Output Answer": [ + "$-9 (-x-10) (-x-4)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2-126*x-360, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{21 x^2}{2}-\\frac{7 x}{2}+13$", + "Output Answer": [ + "$x=\\frac{1}{42} \\left(7-i \\sqrt{2135}\\right)\\lor x=\\frac{1}{42} \\left(7+i \\sqrt{2135}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((21*x**2)/2)-((7*x)/2)+13, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$18 x+7 y-19 z-13=0$, $21 x+7 y+7 z+7=0$, $-16 x-22 y-22 z+24=0$", + "Output Answer": [ + "$x=-\\frac{23}{25}$, $y=\\frac{63}{26}$, $z=-\\frac{431}{650}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((18*x+7*y-19*z-13, 21*x+7*y+7*z+7, -16*x-22*y-22*z+24)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{2-6 i}{\\sqrt{3}}$ and $y=\\frac{10+8 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{7}{41}-\\frac{19 i}{41}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((2-6*i)/(math.sqrt(3)))\ny = ((10+8*i)/(math.sqrt(3)))\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-180 t^2+900 t-1117, x(t)=36 t^2-180 t+225$", + "Output Answer": [ + "$y=8-5 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -180*t**2+900*t-1117\nx_t = 36*t**2-180*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (8 x+1)^3, q(x) = 0$", + "Output Answer": [ + "$512 x^3+192 x^2+24 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (8*x+1)**3\nq = 0\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{13}{2}+2 i$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{185}}{2}$\nArgument: $\\tan ^{-1}\\left(\\frac{4}{13}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (13/2)+2*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$18 x-8 y+20 z-22=0$, $-20 x-17 y-23 z+17=0$, $-17 x-18 y-23 z-21=0$", + "Output Answer": [ + "$x=\\frac{9873}{779}$, $y=\\frac{17}{779}$, $z=-\\frac{8022}{779}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((18*x-8*y+20*z-22, -20*x-17*y-23*z+17, -17*x-18*y-23*z-21)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{8+3 i}{\\sqrt{2}}$ and $y=-\\frac{9-9 i}{\\sqrt{2}}$", + "Output Answer": [ + "$\\frac{17-6 i}{\\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((8+3*i)/(math.sqrt(2)))\ny = -((9-9*i)/(math.sqrt(2)))\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{1}{10} ((16+19)-17)+\\frac{1}{12} \\left(\\frac{19-13}{2}-3\\right)$.", + "Output Answer": [ + "$\\frac{9}{5}$" + ], + "Output Program": [ + "try: \n print((1/10)*((16+19)-17)+(1/12)*(((19-13)/2)-3))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $7 \\sqrt{3}-\\frac{13 x^2}{\\sqrt{3}}$", + "Output Answer": [ + "$7 \\sqrt{3}-\\frac{13 x^2}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (7*math.sqrt(3)-((13*x**2)/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{23}{89}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{106225}{89}$" + ], + "Output Program": [ + "a = -(23/89) # initial value\nd = 4 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(23/89) # initial value\nd = 4 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(\\cos \\left(\\frac{89}{45}\\right)+i \\sin \\left(\\frac{89}{45}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$177147 \\left(\\cos \\left(\\frac{979}{45}\\right)+i \\sin \\left(\\frac{979}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(math.cos((89/45))+1j*math.sin((89/45))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-4 \\sqrt{5} x^2-11 \\sqrt{5} x-6 \\sqrt{5}}{-10 \\sqrt{5} x-4 \\sqrt{5}}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to -2\\},\\left\\{x\\to -\\frac{3}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-4*sqrt(5)*x**2-11*sqrt(5)*x-6*sqrt(5))/(-10*sqrt(5)*x-4*sqrt(5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\sqrt{3} x-12 \\sqrt{3}\\right| =-7 \\sqrt{3}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-sqrt(3)*x-12*sqrt(3)), -7*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left((12+10)^2-20\\right)-25\\right)-(((5-2)+16)-12)$.", + "Output Answer": [ + "$432$" + ], + "Output Program": [ + "try: \n print((((12+10)**2-20)-25)-(((5-2)+16)-12))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $12 x^2-21 x+9$ and $3-3 x$.", + "Output Answer": [ + "$3 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(12*x**2-21*x+9, 3-3*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-110 x^2-32 x+462}{-275 x^2+657 x-252}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{11}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-110*x**2-32*x+462)/(-275*x**2+657*x-252)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-10 x^2-15 x+5$", + "Output Answer": [ + "$x=\\frac{1}{4} \\left(-3-\\sqrt{17}\\right)\\lor x=\\frac{1}{4} \\left(\\sqrt{17}-3\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-10*x**2-15*x+5, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{3 x}{5}-\\frac{66}{5}\\right| =7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{101}{3}\\right\\},\\left\\{x\\to -\\frac{31}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((3*x)/5)-(66/5)), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt[3]{64}+\\sqrt[3]{23}\\right) \\sqrt[3]{42}$.", + "Output Answer": [ + "$\\sqrt[3]{42} \\left(4+\\sqrt[3]{23}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint((cbrt(64)+cbrt(23))*cbrt(42))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(\\cos \\left(\\frac{13}{90}\\right)+i \\sin \\left(\\frac{13}{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-2048 \\left(\\cos \\left(\\frac{143}{90}\\right)+i \\sin \\left(\\frac{143}{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(math.cos((13/90))+1j*math.sin((13/90))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{55}{4}$, and $a_n=a_{n-1}+\\frac{7}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$\\frac{23}{2} \\left(\\frac{55}{2}+\\frac{154}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (55/4) # initial value\nd = (7/(math.sqrt(3))) # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (55/4) # initial value\nd = (7/(math.sqrt(3))) # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 23 x-\\frac{25}{2}\\right| =\\frac{35}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{23}\\right\\},\\left\\{x\\to \\frac{30}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(23*x-(25/2)), (35/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{51 x^2}{4}-\\frac{55 x}{4}+\\frac{19}{4}}{\\frac{31}{4}-\\frac{41 x}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{102} \\left(-55-\\sqrt{6901}\\right)\\right\\},\\left\\{x\\to \\frac{1}{102} \\left(-55+\\sqrt{6901}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((51*x**2)/4)-((55*x)/4)+(19/4))/((31/4)-((41*x)/2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $15 x^4-5 x^3-5 x^2-5 x$ and $-3 x^3+x^2+x+1$.", + "Output Answer": [ + "$3 x^3-x^2-x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(15*x**4-5*x**3-5*x**2-5*x, -3*x**3+x**2+x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{13-17 i}{\\sqrt{3}}$ and $y=-\\frac{9+10 i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{53}{181}+\\frac{283 i}{181}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((13-17*i)/(math.sqrt(3)))\ny = -((9+10*i)/(math.sqrt(3)))\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-12 x^2+4 x-12$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(1-i \\sqrt{35}\\right)\\lor x=\\frac{1}{6} \\left(1+i \\sqrt{35}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-12*x**2+4*x-12, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $7 x^2+161 \\sqrt{2} x+1848$", + "Output Answer": [ + "$7 \\left(x+11 \\sqrt{2}\\right) \\left(x+12 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(7*x**2+161*sqrt(2)*x+1848, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$-\\sqrt{8 x+6} \\cot (5 x+4)$", + "Output Answer": [ + "$\\frac{5 x+4}{\\pi }\\notin \\mathbb{Z}\\land x\\geq -\\frac{3}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = -sqrt(8*x+6)*cot(5*x+4)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-x^2-3 x+4 y^2+3 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(y+\\frac{3}{8}\\right)^2-\\left(x+\\frac{3}{2}\\right)^2=-\\frac{107}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{2}-\\frac{\\sqrt{535}}{8} & -\\frac{3}{8} \\\\\n \\frac{1}{8} \\left(\\sqrt{535}-12\\right) & -\\frac{3}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{3}{2}-\\frac{\\sqrt{535}}{8}+\\frac{1}{8} \\left(\\sqrt{535}-12\\right)\\right),-\\frac{3}{8}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{2}+\\frac{3}{8},y=-\\frac{x}{2}-\\frac{9}{8}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-x**2-3*x+4*y**2+3*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -5 \\sqrt{5} x-6 \\sqrt{5}\\right| =-3 \\sqrt{5}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-5*sqrt(5)*x-6*sqrt(5)), -3*sqrt(5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{7-19}{2+10}$.", + "Output Answer": [ + "$-1$" + ], + "Output Program": [ + "try: \n print(((7-19)/(2+10)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-9 \\sqrt{2} x^2+4 \\sqrt{2} x-7 \\sqrt{2}$", + "Output Answer": [ + "$-9 \\sqrt{2} \\left(x-\\frac{2}{9}\\right)^2-\\frac{59 \\sqrt{2}}{9}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-9*math.sqrt(2)*x**2+4*math.sqrt(2)*x-7*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 13 x^2-13 x-14$, $q(x) = -4 x^2+2 x+7$", + "Output Answer": [ + "$9 x^2-11 x-7$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 13*x**2-13*x-14\nq = -4*x**2+2*x+7\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-2 e \\left(-\\sin \\left(\\frac{13 \\pi }{180}\\right)+i \\cos \\left(\\frac{13 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $2 e \\sqrt{\\sin ^2\\left(\\frac{13 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{180}\\right)}$\nArgument: $-\\frac{77 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -2*math.e*(-math.sin(((13*math.pi)/180))+i*math.cos(((13*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-9 x^2+5 x-10$", + "Output Answer": [ + "$-9 \\left(x-\\frac{5}{18}\\right)^2-\\frac{335}{36}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-9*x**2+5*x-10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-1+3 i) \\sqrt{5}$ and $y=(-1+i) \\sqrt{5}$", + "Output Answer": [ + "$2 i \\sqrt{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-1+3*i)*math.sqrt(5)\ny = (-1+i)*math.sqrt(5)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{81}{4} (4 x+3)^4, q(x) = \\frac{(x+11)^3}{2 \\sqrt{2}}$", + "Output Answer": [ + "$5184 x^4+\\frac{x^3}{2 \\sqrt{2}}+15552 x^3+\\frac{33 x^2}{2 \\sqrt{2}}+17496 x^2+\\frac{363 x}{2 \\sqrt{2}}+8748 x+\\frac{1331}{2 \\sqrt{2}}+\\frac{6561}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (81/4)*(4*x+3)**4\nq = (((x+11)**3)/(2*sqrt(2)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{25 x}{2}-\\frac{5}{2}}+\\sqrt{\\frac{27 x}{2}+\\frac{1}{2}}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 2597-20 \\sqrt{16835}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((25*x)/2)-(5/2))+sqrt(((27*x)/2)+(1/2)), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{14 x^2}{3}+\\frac{5 x}{3}+\\frac{25}{3}$ and $q(x) = -7 x^2+\\frac{43 x}{3}+\\frac{22}{3}$", + "Output Answer": [ + "$-\\frac{98 x^4}{3}+\\frac{497 x^3}{9}-\\frac{2 x^2}{9}+\\frac{395 x}{3}+\\frac{550}{9}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((14*x**2)/3)+((5*x)/3)+(25/3)\nq = -7*x**2+((43*x)/3)+(22/3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{4 x}{\\sqrt{3}}+\\frac{25}{\\sqrt{3}}\\right| =9 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\{x\\to -13\\},\\left\\{x\\to \\frac{1}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((4*x)/(sqrt(3)))+(25/(sqrt(3)))), 9*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt{\\frac{28}{5}-\\frac{18 x}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{14}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(sqrt((28/5)-((18*x)/5)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $11-8 x$", + "Output Answer": [ + "$x=\\frac{11}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(11-8*x, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 5 x, q(x) = 2 x+3$", + "Output Answer": [ + "$7 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x\nq = 2*x+3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{44 x^2}{3}+13 x-\\frac{22}{3}$", + "Output Answer": [ + "$x=\\frac{1}{88} \\left(39-i \\sqrt{2351}\\right)\\lor x=\\frac{1}{88} \\left(39+i \\sqrt{2351}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((44*x**2)/3)+13*x-(22/3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-2 \\left(-5 t+\\sqrt{5}+35\\right), x(t)=\\sqrt{5} t-7 \\sqrt{5}$", + "Output Answer": [ + "$y=2 \\sqrt{5} x-2 \\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -2*(-5*t+sqrt(5)+35)\nx_t = sqrt(5)*t-7*sqrt(5)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{17+22 i}{e}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{773}}{e}$\nArgument: $\\tan ^{-1}\\left(\\frac{22}{17}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((17+22*i)/math.e)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-9 x-1}+\\sqrt{6-2 x}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(-1380+22 \\sqrt{2570}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-9*x-1)+sqrt(6-2*x), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{16 x^2}{5}-\\frac{29 x}{5}+\\frac{24}{5}$", + "Output Answer": [ + "$x=\\frac{1}{32} \\left(29-i \\sqrt{695}\\right)\\lor x=\\frac{1}{32} \\left(29+i \\sqrt{695}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((16*x**2)/5)-((29*x)/5)+(24/5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-4 x^2+4 x-\\frac{31}{4}$", + "Output Answer": [ + "$-4 \\left(x-\\frac{1}{2}\\right)^2-\\frac{27}{4}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-4*x**2+4*x-(31/4)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2+12 x-40$", + "Output Answer": [ + "$4 (x-2) (x+5)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2+12*x-40, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $3 x^2-52 x+185$", + "Output Answer": [ + "$3 \\left(x-\\frac{37}{3}\\right) (x-5)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(3*x**2-52*x+185, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{4 t}{3}-5 \\sqrt{3}-\\frac{104}{3}, x(t)=\\frac{t}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=\\frac{4 x}{\\sqrt{3}}-5 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = ((4*t)/3)-5*sqrt(3)-(104/3)\nx_t = (t/(sqrt(3)))-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{5}}{\\sqrt{159}}$.", + "Output Answer": [ + "$\\sqrt{\\frac{5}{159}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(5))/(sqrt(159))))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-21 x-17 y+5=0$, $-4 x-19 y-6=0$", + "Output Answer": [ + "$x=\\frac{197}{331}$, $y=-\\frac{146}{331}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-21*x-17*y+5, -4*x-19*y-6), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{34 x^2}{5}+\\frac{44 x}{5}+\\frac{47}{5}$", + "Output Answer": [ + "$x=\\frac{1}{34} \\left(22-\\sqrt{2082}\\right)\\lor x=\\frac{1}{34} \\left(22+\\sqrt{2082}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((34*x**2)/5)+((44*x)/5)+(47/5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 x^2-14 x+10$ and $q(x) = -10 x^2-6 x-4$", + "Output Answer": [ + "$-30 x^4+122 x^3-28 x^2-4 x-40$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*x**2-14*x+10\nq = -10*x**2-6*x-4\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2-14 \\sqrt{2} x+24$", + "Output Answer": [ + "$2 \\left(x-6 \\sqrt{2}\\right) \\left(x-\\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2-14*sqrt(2)*x+24, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{x}{2}-\\frac{5}{2}$ and $\\frac{3 x^5}{2}+4 x^4+x^3-\\frac{x^2}{2}+x+4$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd((x/2)-(5/2), ((3*x**5)/2)+4*x**4+x**3-((x**2)/2)+x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{17 x}{7}-\\frac{29 y}{7}-\\frac{100}{7}=0$, $\\frac{76 x}{7}+\\frac{13 y}{7}-\\frac{132}{7}=0$", + "Output Answer": [ + "$x=\\frac{5128}{1983}$, $y=-\\frac{9844}{1983}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((17*x)/7)-((29*y)/7)-(100/7), ((76*x)/7)+((13*y)/7)-(132/7)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{10+11 i}{\\sqrt{3}}$ and $y=\\frac{5+9 i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{5+2 i}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((10+11*i)/(math.sqrt(3)))\ny = ((5+9*i)/(math.sqrt(3)))\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2+4 x+6 y^2-8 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y-\\frac{2}{3}\\right)^2-4 \\left(x-\\frac{1}{2}\\right)^2=\\frac{2}{3}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & \\frac{1}{6} \\left(4-\\sqrt{10}\\right) \\\\\n \\frac{1}{2} & \\frac{1}{6} \\left(4+\\sqrt{10}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{2}}$\nCenter: $\\left\\{\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{6} \\left(4-\\sqrt{10}\\right)+\\frac{1}{6} \\left(4+\\sqrt{10}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{6} \\left(4+\\sqrt{6}\\right)-\\sqrt{\\frac{2}{3}} x,y=\\sqrt{\\frac{2}{3}} x+\\frac{1}{6} \\left(4-\\sqrt{6}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2+4*x+6*y**2-8*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{16 \\left(\\cos \\left(\\frac{3 \\pi }{20}\\right)-i \\sin \\left(\\frac{3 \\pi }{20}\\right)\\right)}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{16 \\sqrt{\\sin ^2\\left(\\frac{3 \\pi }{20}\\right)+\\cos ^2\\left(\\frac{3 \\pi }{20}\\right)}}{\\pi }$\nArgument: $\\frac{17 \\pi }{20}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((16*(math.cos(((3*math.pi)/20))-i*math.sin(((3*math.pi)/20))))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{16}{27} \\left(175 t^2-910 t+1174\\right)^2, x(t)=\\frac{100 t^2}{3}-\\frac{520 t}{3}+\\frac{676}{3}$", + "Output Answer": [ + "$y=\\frac{49 x^2}{3}-56 x+48$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (16/27)*(175*t**2-910*t+1174)**2\nx_t = ((100*t**2)/3)-((520*t)/3)+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{31 i}{4}\\right)^11$", + "Output Answer": [ + "$\\frac{25408476896404831 i}{4194304}$" + ], + "Output Program": [ + "i = 1j\nprint((-((31*i)/4))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 3 x^2+4 x+8$, $q(x) = -7 x^2-5 x+10$", + "Output Answer": [ + "$-4 x^2-x+18$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**2+4*x+8\nq = -7*x**2-5*x+10\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10 x+5}+\\sqrt{13 x-7}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(4544-28 \\sqrt{25885}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10*x+5)+sqrt(13*x-7), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{27 x^2}{2}+4 x-3$", + "Output Answer": [ + "$x=\\frac{1}{27} \\left(-4-\\sqrt{178}\\right)\\lor x=\\frac{1}{27} \\left(\\sqrt{178}-4\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((27*x**2)/2)+4*x-3, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x-2$ and $-x^3+x^2+4 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x-2, -x**3+x**2+4*x-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-18 x^2-19 x}{-24 x^2-5 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{19}{18}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-18*x**2-19*x)/(-24*x**2-5*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(9 \\left(\\sin \\left(\\frac{7 \\pi }{90}\\right)-i \\cos \\left(\\frac{7 \\pi }{90}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$3486784401 \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((9*(math.sin(((7*math.pi)/90))-1j*math.cos(((7*math.pi)/90))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{9 x}{2}-\\frac{27}{2}}+\\sqrt{12 x+8}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{75} \\left(863-56 \\sqrt{129}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((9*x)/2)-(27/2))+sqrt(12*x+8), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\frac{e^3}{\\sqrt{-7 x-2}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{-2 y^2-e^6}{7 y^2}\\text{ if }y>0$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, ((math.e**3)/(sqrt(-7*x-2))))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(-\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-8 \\left(\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(-math.cos(((2*math.pi)/9))-1j*math.sin(((2*math.pi)/9))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-8 x^4-6 x^3+12 x^2+23 x+6$ and $-2 x^2-4 x-3$.", + "Output Answer": [ + "$2 x^2+4 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-8*x**4-6*x**3+12*x**2+23*x+6, -2*x**2-4*x-3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-3 x^5+6 x^4-x^3+5 x^2+9 x+7$ when divided by $8 x-7$.", + "Output Answer": [ + "$-\\frac{3 x^4}{8}+\\frac{27 x^3}{64}+\\frac{125 x^2}{512}+\\frac{3435 x}{4096}+\\frac{60909}{32768}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x**5+6*x**4-x**3+5*x**2+9*x+7\nq = 8*x-7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-6 x-7}+\\sqrt{4-5 x}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{10721}{-1111-20 \\sqrt{3059}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-6*x-7)+sqrt(4-5*x), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-8 x^3+120 x^2+2376 x-33592$", + "Output Answer": [ + "$8 (-x-17) (x-19) (x-13)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-8*x**3+120*x**2+2376*x-33592, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 (2 x+3)^2, q(x) = -2 x-5$", + "Output Answer": [ + "$16 x^2+46 x+31$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*(2*x+3)**2\nq = -2*x-5\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -7 x^2-15 x-9$ and $q(x) = 13 x^2-14 x-10$", + "Output Answer": [ + "$-91 x^4-97 x^3+163 x^2+276 x+90$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -7*x**2-15*x-9\nq = 13*x**2-14*x-10\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -3 \\sqrt{3} (3 x-4)^3, q(x) = 3 \\sqrt{3} (2 x-3)^3$", + "Output Answer": [ + "$-57 \\sqrt{3} x^3+216 \\sqrt{3} x^2-270 \\sqrt{3} x+111 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*sqrt(3)*(3*x-4)**3\nq = 3*sqrt(3)*(2*x-3)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-12 x-\\frac{27}{2}}+\\sqrt{14}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{24} \\left(-343+48 \\sqrt{14}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-12*x-(27/2))+sqrt(14), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{3}{2}-\\frac{27 x}{2}}+\\sqrt{-\\frac{3 x}{2}-1}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{48} \\left(-835+13 \\sqrt{1437}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((3/2)-((27*x)/2))+sqrt(-((3*x)/2)-1), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $12 e^{-\\frac{i \\pi }{6}} \\log (2)$.", + "Output Answer": [ + "Norm: $12 \\log (2)$\nArgument: $-\\frac{\\pi }{6}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 12*math.e**(-((i*math.pi)/6))*math.log(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 22 x-22| =19$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{22}\\right\\},\\left\\{x\\to \\frac{41}{22}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(22*x-22), 19), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\left(\\frac{7 x}{5}+8\\right)^4$ at the point $x=5$", + "Output Answer": [ + "$50625 = 50625.$" + ], + "Output Program": [ + "x = 5\ntry: \n f = (((7*x)/5)+8)**4\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{930 x^2}{49}+\\frac{1179 x}{49}+\\frac{4692}{49}}{\\frac{14628}{49}-\\frac{4929 x}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{17}{10}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((930*x**2)/49)+((1179*x)/49)+(4692/49))/((14628/49)-((4929*x)/49))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sin (6 x+3) \\cos (x+6)$ at the point $x=7$", + "Output Answer": [ + "$\\cos (13) \\sin (45) = 0.772$" + ], + "Output Program": [ + "import math\n\nx = 7\ntry: \n f = math.sin(6*x+3)*math.cos(x+6)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{15 x}{4}-\\frac{43}{4}}+\\sqrt{\\frac{25 x}{4}+\\frac{5}{4}}=\\frac{21}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{40} \\left(1572-105 \\sqrt{191}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((15*x)/4)-(43/4))+sqrt(((25*x)/4)+(5/4)), (21/4)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{1}{4}+\\frac{13 i}{4}$ and $y=-\\frac{3}{2}-\\frac{27 i}{4}$", + "Output Answer": [ + "$-\\frac{7}{4}-\\frac{7 i}{2}$" + ], + "Output Program": [ + "i = 1j\nx = -(1/4)+((13*i)/4)\ny = -(3/2)-((27*i)/4)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{2 \\left(15 x^2-5 x-13\\right)}{e}$, $q(x) = \\frac{7 x^2+x+32}{e}$", + "Output Answer": [ + "$\\frac{37 x^2}{e}-\\frac{9 x}{e}+\\frac{6}{e}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x\n\np = ((2*(15*x**2-5*x-13))/math.e)\nq = ((7*x**2+x+32)/math.e)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^4+5 x^3-6 x^2+x-3$ when divided by $-2 x^2+6 x+7$.", + "Output Answer": [ + "$4 x^2+\\frac{19 x}{2}+\\frac{91}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**4+5*x**3-6*x**2+x-3\nq = -2*x**2+6*x+7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt[3]{-4 x-4} \\tan ^{-1}\\left(4-7 x^4\\right)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = cbrt(-4*x-4)*atan(4-7*x**4)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x-9}+\\sqrt{9 x-7}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{25} \\left(99-4 \\sqrt{311}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x-9)+sqrt(9*x-7), 4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-18 x+18 y+7 z-10=0$, $-5 x+7 y+z-22=0$, $5 x+5 y+19 z-18=0$", + "Output Answer": [ + "$x=\\frac{1508}{231}$, $y=\\frac{1900}{231}$, $z=-\\frac{226}{77}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-18*x+18*y+7*z-10, -5*x+7*y+z-22, 5*x+5*y+19*z-18)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2+13 x+11$ and $q(x) = -12 x^2-13 x+6$", + "Output Answer": [ + "$168 x^4+26 x^3-385 x^2-65 x+66$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2+13*x+11\nq = -12*x**2-13*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{89 x}{4}+\\frac{35}{2}\\right| =-\\frac{9}{2}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((89*x)/4)+(35/2)), -(9/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{71 x^2}{7}-\\frac{81 x}{7}-\\frac{94}{7}}{-\\frac{57 x^2}{7}+\\frac{76 x}{7}+\\frac{72}{7}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((71*x**2)/7)-((81*x)/7)-(94/7))/(-((57*x**2)/7)+((76*x)/7)+(72/7))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x+3$ and $3 x^2+2 x+2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x+3, 3*x**2+2*x+2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-14 x-14}+\\sqrt{-12 x-7}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -322+7 \\sqrt{2093}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-14*x-14)+sqrt(-12*x-7), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-3 x-21 y+15 z-8=0$, $-19 x-9 y-8 z+6=0$, $-21 x+15 y+17 z-2=0$", + "Output Answer": [ + "$x=\\frac{525}{2887}$, $y=-\\frac{863}{8661}$, $z=\\frac{1242}{2887}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-3*x-21*y+15*z-8, -19*x-9*y-8*z+6, -21*x+15*y+17*z-2)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $(2+5 i) \\log (2)$.", + "Output Answer": [ + "Norm: $\\sqrt{29} \\log (2)$\nArgument: $\\tan ^{-1}\\left(\\frac{5}{2}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (2+5*i)*math.log(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-10 x-\\frac{5 y}{2}-\\frac{47 z}{4}-\\frac{69}{4}=0$, $-17 x+19 y-\\frac{95 z}{4}-\\frac{21}{4}=0$, $4 x+\\frac{25 y}{2}-\\frac{11 z}{4}-\\frac{3}{2}=0$", + "Output Answer": [ + "$x=\\frac{122769}{41536}$, $y=-\\frac{33771}{20768}$, $z=-\\frac{37773}{10384}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-10*x-((5*y)/2)-((47*z)/4)-(69/4), -17*x+19*y-((95*z)/4)-(21/4), 4*x+((25*y)/2)-((11*z)/4)-(3/2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{6} \\sqrt[3]{4 x+1}$ at the point $x=0$", + "Output Answer": [ + "$\\sqrt{6} = 2.449$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 0\ntry: \n f = math.sqrt(6)*np.cbrt(4*x+1)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $5 x^3-140 x^2+1060 x-1600$", + "Output Answer": [ + "$5 (10-x) (16-x) (x-2)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(5*x**3-140*x**2+1060*x-1600, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{74}}{\\sqrt{\\sqrt{92}}}$.", + "Output Answer": [ + "$\\frac{\\sqrt{37}}{\\sqrt[4]{23}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(74))/(sqrt(sqrt(92)))))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-16 \\sqrt{2} x^2+17 \\sqrt{2} x+\\frac{11}{\\sqrt{2}}}{17 \\sqrt{2}-7 \\sqrt{2} x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{32} \\left(17-\\sqrt{641}\\right)\\right\\},\\left\\{x\\to \\frac{1}{32} \\left(17+\\sqrt{641}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-16*sqrt(2)*x**2+17*sqrt(2)*x+(11/(sqrt(2))))/(17*sqrt(2)-7*sqrt(2)*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 (1-2 x)^2, q(x) = -x-7$", + "Output Answer": [ + "$16 x^2-17 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*(1-2*x)**2\nq = -x-7\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -12 x^2+13 x+2$, $q(x) = -x^2+7 x-5$", + "Output Answer": [ + "$-13 x^2+20 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -12*x**2+13*x+2\nq = -x**2+7*x-5\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 14 \\left(x^2+1\\right)$, $q(x) = 2 \\left(-6 x^2+7 x+7\\right)$", + "Output Answer": [ + "$2 x^2+14 x+28$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 14*(x**2+1)\nq = 2*(-6*x**2+7*x+7)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{13}{5} e^{\\frac{103 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $\\frac{13}{5}$\nArgument: $-\\frac{77 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(13/5)*math.e**((103*i*math.pi)/180)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^3-2 x+1$ when divided by $9$.", + "Output Answer": [ + "$\\frac{7 x^3}{9}-\\frac{2 x}{9}+\\frac{1}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**3-2*x+1\nq = 9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(15+23)-(((9+21)+25)-15)$.", + "Output Answer": [ + "$-2$" + ], + "Output Program": [ + "try: \n print((15+23)-(((9+21)+25)-15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\tan (5 x+2) \\tan (9 x+2)$ at the point $x=9$", + "Output Answer": [ + "$\\tan (47) \\tan (83) = -0.483$" + ], + "Output Program": [ + "import math\n\nx = 9\ntry: \n f = math.tan(5*x+2)*math.tan(9*x+2)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $5 x^2-\\frac{95 x}{2}+\\frac{1725}{16}$", + "Output Answer": [ + "$-5 \\left(\\frac{23}{4}-x\\right) \\left(x-\\frac{15}{4}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(5*x**2-((95*x)/2)+(1725/16), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $3 x^2-6 \\sqrt{5} x-360$", + "Output Answer": [ + "$3 \\left(-x-4 \\sqrt{5}\\right) \\left(6 \\sqrt{5}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(3*x**2-6*sqrt(5)*x-360, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{3 x^2}{2}-\\frac{x}{2}-13$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(1-\\sqrt{313}\\right)\\lor x=\\frac{1}{6} \\left(1+\\sqrt{313}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((3*x**2)/2)-(x/2)-13, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$21 x+24 y+3=0$, $-2 x+4 y+8=0$", + "Output Answer": [ + "$x=\\frac{15}{11}$, $y=-\\frac{29}{22}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((21*x+24*y+3, -2*x+4*y+8), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{256 x^2+32 x-195}{16 x^2-285 x+221}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{15}{16}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((256*x**2+32*x-195)/(16*x**2-285*x+221)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x^2+5 x+1$ and $2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x**2+5*x+1, 2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$11 x-13 y+7 z+17=0$, $8 x-6 y+22 z+24=0$, $-22 x+19 y-16 z+23=0$", + "Output Answer": [ + "$x=\\frac{6443}{613}$, $y=\\frac{5429}{613}$, $z=-\\frac{1531}{613}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((11*x-13*y+7*z+17, 8*x-6*y+22*z+24, -22*x+19*y-16*z+23)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{15-i}{\\sqrt{3}}$ and $y=\\frac{17-7 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{2-6 i}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((15-i)/(math.sqrt(3)))\ny = ((17-7*i)/(math.sqrt(3)))\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{11}{5} \\left(\\cos \\left(\\frac{32}{45}\\right)+i \\sin \\left(\\frac{32}{45}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{25937424601 \\left(\\cos \\left(\\frac{64}{9}\\right)+i \\sin \\left(\\frac{64}{9}\\right)\\right)}{9765625}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((11/5)*(math.cos((32/45))+1j*math.sin((32/45))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $5 x^2-15 \\sqrt{3} x+30$", + "Output Answer": [ + "$-5 \\left(\\sqrt{3}-x\\right) \\left(x-2 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(5*x**2-15*sqrt(3)*x+30, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4$ and $-x^4-x^3+4 x^2+x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4, -x**4-x**3+4*x**2+x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{49 x^2}{4}-12 x-\\frac{21}{4}$", + "Output Answer": [ + "$x=\\frac{1}{49} \\left(24-\\sqrt{1605}\\right)\\lor x=\\frac{1}{49} \\left(24+\\sqrt{1605}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((49*x**2)/4)-12*x-(21/4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((22+13)-18)-13) ((15-14)-9)$.", + "Output Answer": [ + "$-32$" + ], + "Output Program": [ + "try: \n print((((22+13)-18)-13)*((15-14)-9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 x^2-2 x+4$", + "Output Answer": [ + "$\\frac{13}{3}-3 \\left(x+\\frac{1}{3}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*x**2-2*x+4), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the seventh order series of the inverse of the following function around 7:\n$\\frac{1}{16 x^2}$", + "Output Answer": [ + "$\\frac{1}{4 \\sqrt{x}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, (1/(16*x**2)))\nprint(solve(f, x)[0].series(y, 7, 6))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{13 x-\\frac{32}{5}}+\\sqrt{\\frac{67 x}{5}-13}=\\frac{43}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(122199-43 \\sqrt{8073205}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(13*x-(32/5))+sqrt(((67*x)/5)-13), (43/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{9 x-4}{\\sqrt{2}}, q(x) = \\sqrt{2} (5-2 x)$", + "Output Answer": [ + "$-2 \\sqrt{2} x+\\frac{9 x}{\\sqrt{2}}+3 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((9*x-4)/(sqrt(2)))\nq = sqrt(2)*(5-2*x)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $10 x^2-x+1$", + "Output Answer": [ + "$10 \\left(x-\\frac{1}{20}\\right)^2+\\frac{39}{40}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (10*x**2-x+1), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{7 \\left(\\cos \\left(\\frac{11}{10}\\right)+i \\sin \\left(\\frac{11}{10}\\right)\\right)}{\\sqrt{3}}\\right)^7$", + "Output Answer": [ + "$-\\frac{823543 \\left(\\cos \\left(\\frac{77}{10}\\right)+i \\sin \\left(\\frac{77}{10}\\right)\\right)}{27 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((7*(math.cos((11/10))+1j*math.sin((11/10))))/(math.sqrt(3))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{13 x}{7}-\\frac{61}{7}}+\\sqrt{\\frac{60 x}{7}+\\frac{18}{7}}=\\frac{48}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{142201-96 \\sqrt{515994}}{15463}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((13*x)/7)-(61/7))+sqrt(((60*x)/7)+(18/7)), (48/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 16 \\sqrt{2} x-\\frac{5}{\\sqrt{2}}\\right| =\\frac{9}{\\sqrt{2}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{8}\\right\\},\\left\\{x\\to \\frac{7}{16}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(16*sqrt(2)*x-(5/(sqrt(2)))), (9/(sqrt(2)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((16+24)+2)+22)+(9-11)$.", + "Output Answer": [ + "$62$" + ], + "Output Program": [ + "try: \n print((((16+24)+2)+22)+(9-11))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(-5+14 i) \\log (2)$ and $y=(-8-2 i) \\log (2)$", + "Output Answer": [ + "$(-13+12 i) \\log (2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-5+14*i)*math.log10(2)\ny = (-8-2*i)*math.log10(2)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{75 x^2}{7}-\\frac{85 x}{7}-\\frac{8}{7}$", + "Output Answer": [ + "$x=\\frac{1}{30} \\left(17-\\sqrt{385}\\right)\\lor x=\\frac{1}{30} \\left(17+\\sqrt{385}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((75*x**2)/7)-((85*x)/7)-(8/7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{13 \\left(\\cos \\left(\\frac{7}{9}\\right)+i \\sin \\left(\\frac{7}{9}\\right)\\right)}{\\sqrt{2}}\\right)^10$", + "Output Answer": [ + "$\\frac{137858491849}{32} \\left(\\cos \\left(\\frac{70}{9}\\right)+i \\sin \\left(\\frac{70}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((13*(math.cos((7/9))+1j*math.sin((7/9))))/(math.sqrt(2))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(7+17)-(((7+22)-13)-14)$.", + "Output Answer": [ + "$22$" + ], + "Output Program": [ + "try: \n print((7+17)-(((7+22)-13)-14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\log (8) \\tan (9 x)$ at the point $x=6$", + "Output Answer": [ + "$-\\log (8) \\tan (54) = -1.401$" + ], + "Output Program": [ + "import math\n\nx = 6\ntry: \n f = -math.log(8)*math.tan(9*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{7+5 i}{\\sqrt{2}}$ and $y=(-4+5 i) \\sqrt{2}$", + "Output Answer": [ + "$53-15 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((7+5*i)/(math.sqrt(2)))\ny = (-4+5*i)*math.sqrt(2)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $5 x^2+13 x+4$", + "Output Answer": [ + "$x=\\frac{1}{10} \\left(-13-\\sqrt{89}\\right)\\lor x=\\frac{1}{10} \\left(\\sqrt{89}-13\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(5*x**2+13*x+4, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-3 \\sqrt{2} x-6 \\sqrt{2} y+8 \\sqrt{2}=0$, $17 \\sqrt{2} x-\\frac{9 y}{\\sqrt{2}}-6 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{48}{77}$, $y=\\frac{236}{231}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-3*sqrt(2)*x-6*sqrt(2)*y+8*sqrt(2), 17*sqrt(2)*x-((9*y)/(sqrt(2)))-6*sqrt(2)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{4 x^2-18 x-24}{12 x+24}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(9-\\sqrt{177}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(9+\\sqrt{177}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((4*x**2-18*x-24)/(12*x+24)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{7 x^2}{2}+\\frac{29 x}{2}+10$ and $q(x) = \\frac{x^2}{2}-\\frac{29 x}{2}+\\frac{17}{2}$", + "Output Answer": [ + "$\\frac{7 x^4}{4}-\\frac{87 x^3}{2}-\\frac{351 x^2}{2}-\\frac{87 x}{4}+85$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((7*x**2)/2)+((29*x)/2)+10\nq = ((x**2)/2)-((29*x)/2)+(17/2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -3 x-7| =10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{17}{3}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-3*x-7), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 49 x^2, q(x) = (7 x+1)^4$", + "Output Answer": [ + "$2401 x^4+1372 x^3+343 x^2+28 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 49*x**2\nq = (7*x+1)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-8 \\left(\\cos \\left(\\frac{\\pi }{18}\\right)-i \\sin \\left(\\frac{\\pi }{18}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-2097152 \\left(\\sin \\left(\\frac{\\pi }{9}\\right)-i \\cos \\left(\\frac{\\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-8*(math.cos((math.pi/18))-1j*math.sin((math.pi/18))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$-\\sin ^{-1}(5-5 x)$", + "Output Answer": [ + "$\\frac{4}{5}\\leq x\\leq \\frac{6}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = -asin(5-5*x)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\frac{16+2}{16}+1\\right)+24\\right)+\\frac{1}{6} \\left(\\frac{14-9}{12}+8\\right)$.", + "Output Answer": [ + "$\\frac{991}{36}$" + ], + "Output Program": [ + "try: \n print(((((16+2)/16)+1)+24)+(1/6)*(((14-9)/12)+8))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+3 x-10 y^2-9 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x+\\frac{3}{16}\\right)^2-10 \\left(y+\\frac{9}{20}\\right)^2=-\\frac{1239}{160}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{16} & -\\frac{3}{80} \\left(12+\\sqrt{1239}\\right) \\\\\n -\\frac{3}{16} & \\frac{3}{80} \\left(\\sqrt{1239}-12\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2}$\nCenter: $\\left\\{-\\frac{3}{16},\\frac{1}{2} \\left(\\frac{3}{80} \\left(\\sqrt{1239}-12\\right)-\\frac{3}{80} \\left(12+\\sqrt{1239}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\frac{2 x}{\\sqrt{5}}-\\frac{3}{40} \\left(6+\\sqrt{5}\\right),y=\\frac{2 x}{\\sqrt{5}}+\\frac{3}{40} \\left(\\sqrt{5}-6\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+3*x-10*y**2-9*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left(\\frac{10}{6}-11\\right)+9\\right)+25\\right)-((19+21)+18)$.", + "Output Answer": [ + "$-\\frac{100}{3}$" + ], + "Output Program": [ + "try: \n print(((((10/6)-11)+9)+25)-((19+21)+18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $13 x$", + "Output Answer": [ + "$x=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(13*x, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (7 x+5)^3, q(x) = (3-8 x)^2$", + "Output Answer": [ + "$343 x^3+799 x^2+477 x+134$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (7*x+5)**3\nq = (3-8*x)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -10 x^2-5 x+13$ and $q(x) = -15 x^2+3 x-3$", + "Output Answer": [ + "$150 x^4+45 x^3-180 x^2+54 x-39$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -10*x**2-5*x+13\nq = -15*x**2+3*x-3\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\sqrt{2} \\left(-\\cos \\left(\\frac{\\pi }{45}\\right)+i \\sin \\left(\\frac{\\pi }{45}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$32 \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-math.sqrt(2)*(-math.cos((math.pi/45))+1j*math.sin((math.pi/45))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{16}{7}+4 i$ and $y=-\\frac{23}{7}-9 i$", + "Output Answer": [ + "$-\\frac{82}{173}+\\frac{14 i}{173}$" + ], + "Output Program": [ + "i = 1j\nx = (16/7)+4*i\ny = -(23/7)-9*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $e^{\\sqrt{-3 x-2}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{3} \\left(-\\log ^2(y)-2\\right)\\text{ if }y>1$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, math.e**(sqrt(-3*x-2)))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2-22 \\sqrt{3} x+\\frac{176}{3}$", + "Output Answer": [ + "$11 \\left(\\frac{2}{\\sqrt{3}}-x\\right) \\left(x+\\frac{8}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2-22*sqrt(3)*x+(176/3), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $6 x^4+4 x^3+7 x^2-4 x+20$ and $3 x^2-4 x+4$.", + "Output Answer": [ + "$3 x^2-4 x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(6*x**4+4*x**3+7*x**2-4*x+20, 3*x**2-4*x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 x^2+7 x-11$ and $q(x) = -7 x^2+15 x+6$", + "Output Answer": [ + "$28 x^4-109 x^3+158 x^2-123 x-66$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*x**2+7*x-11\nq = -7*x**2+15*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{10 x^2+20 x+1}{\\sqrt{3}}$, $q(x) = \\frac{17 x^2-13 x-2}{\\sqrt{3}}$", + "Output Answer": [ + "$9 \\sqrt{3} x^2+\\frac{7 x}{\\sqrt{3}}-\\frac{1}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((10*x**2+20*x+1)/(sqrt(3)))\nq = ((17*x**2-13*x-2)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\sqrt{2}, \\frac{1}{3}, 6)$", + "Output Answer": [ + "$\\left\\{\\frac{7 \\sqrt{7}}{3},\\tan ^{-1}\\left(\\frac{\\sqrt{19}}{18}\\right),\\tan ^{-1}\\left(\\frac{1}{3 \\sqrt{2}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.sqrt(2)\ny = (1/3)\nz = 6\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2+5 x+2 y^2-5 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(y-\\frac{5}{4}\\right)^2-10 \\left(x-\\frac{1}{4}\\right)^2=-\\frac{7}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{4}-\\sqrt{\\frac{21}{10}} & \\frac{5}{4} \\\\\n \\frac{1}{4}+\\sqrt{\\frac{21}{10}} & \\frac{5}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{6}$\nCenter: $\\left\\{\\frac{1}{4},\\frac{5}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{5} x+\\frac{1}{4} \\left(5-\\sqrt{5}\\right),y=\\frac{1}{4} \\left(5+\\sqrt{5}\\right)-\\sqrt{5} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2+5*x+2*y**2-5*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (7 x+9)^4, q(x) = -(x-8)^3$", + "Output Answer": [ + "$2401 x^4+12347 x^3+23838 x^2+20220 x+7073$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (7*x+9)**4\nq = -(x-8)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{x^2}{\\sqrt{2}}+15 \\sqrt{2} x+\\frac{27}{\\sqrt{2}}\\right| =\\frac{11}{\\sqrt{2}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 15-\\sqrt{241}\\right\\},\\left\\{x\\to 15+\\sqrt{241}\\right\\},\\left\\{x\\to 15-\\sqrt{263}\\right\\},\\left\\{x\\to 15+\\sqrt{263}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((x**2)/(sqrt(2)))+15*sqrt(2)*x+(27/(sqrt(2)))), (11/(sqrt(2)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+3 x+10 y^2+y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $9 \\left(x+\\frac{1}{6}\\right)^2+10 \\left(y+\\frac{1}{20}\\right)^2=\\frac{371}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{6}-\\frac{\\sqrt{371}}{60} & -\\frac{1}{20} \\\\\n \\frac{1}{60} \\left(\\sqrt{371}-10\\right) & -\\frac{1}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{10}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{1}{6}-\\frac{\\sqrt{371}}{60}+\\frac{1}{60} \\left(\\sqrt{371}-10\\right)\\right),-\\frac{1}{20}\\right\\}$\nArea Enclosed: $\\frac{371 \\pi }{120 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+3*x+10*y**2+y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=16 (13-7 t)^2, x(t)=7 t-15$", + "Output Answer": [ + "$y=16 x^2+64 x+64$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 16*(13-7*t)**2\nx_t = 7*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x-8$ and $-2$.", + "Output Answer": [ + "$2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x-8, -2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{19 x}{5}-1}+\\sqrt{\\frac{68 x}{5}+\\frac{64}{5}}=\\frac{34}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{83667-136 \\sqrt{278083}}{12005}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((19*x)/5)-1)+sqrt(((68*x)/5)+(64/5)), (34/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{\\log \\left(x^5+2\\right)}{\\tan ^{-1}(6 x+9)}$ at the point $x=3$", + "Output Answer": [ + "$\\frac{\\log (245)}{\\tan ^{-1}(27)} = 3.587$" + ], + "Output Program": [ + "import math\n\nx = 3\ntry: \n f = ((math.log(x**5+2))/(math.atan(6*x+9)))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $7 x^2+x-12$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(-1-\\sqrt{337}\\right)\\lor x=\\frac{1}{14} \\left(\\sqrt{337}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(7*x**2+x-12, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-374 x^3-244 x^2+688 x+350}{102 x^2-258 x-600}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{22} \\left(9-\\sqrt{389}\\right)\\right\\},\\left\\{x\\to \\frac{1}{22} \\left(9+\\sqrt{389}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-374*x**3-244*x**2+688*x+350)/(102*x**2-258*x-600)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{31}{5}-2 i$ and $y=\\frac{16}{5}+\\frac{49 i}{5}$", + "Output Answer": [ + "$3-\\frac{59 i}{5}$" + ], + "Output Program": [ + "i = 1j\nx = (31/5)-2*i\ny = (16/5)+((49*i)/5)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 8 x^2+20 x+17\\right| =24$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-5-\\sqrt{39}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(-5+\\sqrt{39}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(8*x**2+20*x+17), 24), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^6-6 x^5+6 x^4+6 x^3-5 x^2+x+5$ when divided by $-2 x^4-2 x^3+8 x^2-x-1$.", + "Output Answer": [ + "$\\frac{9 x^2}{2}-\\frac{3 x}{2}+\\frac{33}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**6-6*x**5+6*x**4+6*x**3-5*x**2+x+5\nq = -2*x**4-2*x**3+8*x**2-x-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$4 x+6 y+24=0$, $-5 x+5 y-7=0$", + "Output Answer": [ + "$x=-\\frac{81}{25}$, $y=-\\frac{46}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((4*x+6*y+24, -5*x+5*y-7), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(-\\sin \\left(\\frac{\\pi }{30}\\right)-i \\cos \\left(\\frac{\\pi }{30}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$3125 \\left(-\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(-math.sin((math.pi/30))-1j*math.cos((math.pi/30))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^3+5 x^2+2 x-4$ when divided by $-8 x-2$.", + "Output Answer": [ + "$-\\frac{7 x^2}{8}-\\frac{13 x}{32}-\\frac{19}{128}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**3+5*x**2+2*x-4\nq = -8*x-2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $10 x^6-x^5-x^4+3 x^3+10 x^2-7 x+9$ when divided by $-4 x^5-x^4-9 x^3+2 x^2+8 x-3$.", + "Output Answer": [ + "$\\frac{7}{8}-\\frac{5 x}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x**6-x**5-x**4+3*x**3+10*x**2-7*x+9\nq = -4*x**5-x**4-9*x**3+2*x**2+8*x-3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((19+17)+3)+\\left((((1+11)-21)-5)^2-12\\right)$.", + "Output Answer": [ + "$223$" + ], + "Output Program": [ + "try: \n print(((19+17)+3)+((((1+11)-21)-5)**2-12))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x+12}+\\sqrt{13 x-13}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{81} \\left(3557-112 \\sqrt{754}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x+12)+sqrt(13*x-13), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-2 x^2-4 x+12$", + "Output Answer": [ + "$x=-1-\\sqrt{7}\\lor x=\\sqrt{7}-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-2*x**2-4*x+12, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2+4 x+3 y^2+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 y^2-4 \\left(x-\\frac{1}{2}\\right)^2=-9$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} \\left(1-\\sqrt{21}\\right) & 0 \\\\\n \\frac{1}{2} \\left(1+\\sqrt{21}\\right) & 0 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{2} \\left(1-\\sqrt{21}\\right)+\\frac{1}{2} \\left(1+\\sqrt{21}\\right)\\right),0\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2 x}{\\sqrt{3}}-\\frac{1}{\\sqrt{3}},y=\\frac{1}{\\sqrt{3}}-\\frac{2 x}{\\sqrt{3}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2+4*x+3*y**2+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{62 x}{3}+\\frac{58}{3}\\right| =\\frac{44}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{51}{31}\\right\\},\\left\\{x\\to -\\frac{7}{31}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((62*x)/3)+(58/3)), (44/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x^2-4 x+5$ and $1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x**2-4*x+5, 1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{32}{5}+\\frac{i}{5}$.", + "Output Answer": [ + "Norm: $\\sqrt{41}$\nArgument: $\\tan ^{-1}\\left(\\frac{1}{32}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (32/5)+(i/5)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (3-4 x)^2, q(x) = (2 x+3)^3$", + "Output Answer": [ + "$8 x^3+52 x^2+30 x+36$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (3-4*x)**2\nq = (2*x+3)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9 x-6}+\\sqrt{14 x+7}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{25} \\left(1062-98 \\sqrt{111}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9*x-6)+sqrt(14*x+7), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{19 x^2}{2}-4 x-8$ and $q(x) = -\\frac{x^2}{2}+11 x+6$", + "Output Answer": [ + "$\\frac{19 x^4}{4}-\\frac{205 x^3}{2}-97 x^2-112 x-48$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((19*x**2)/2)-4*x-8\nq = -((x**2)/2)+11*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{1+10 i}{\\sqrt{2}}$.", + "Output Answer": [ + "Norm: $\\sqrt{\\frac{101}{2}}$\nArgument: $\\tan ^{-1}(10)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((1+10*i)/(math.sqrt(2)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{5 \\sqrt{2} x^2-10 \\sqrt{2} x-5 \\sqrt{2}}{7 \\sqrt{2} x-2 \\sqrt{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 1-\\sqrt{2}\\right\\},\\left\\{x\\to 1+\\sqrt{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((5*sqrt(2)*x**2-10*sqrt(2)*x-5*sqrt(2))/(7*sqrt(2)*x-2*sqrt(2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{18}{12}-((((5-11)+8)-6)-25)$.", + "Output Answer": [ + "$\\frac{61}{2}$" + ], + "Output Program": [ + "try: \n print((18/12)-((((5-11)+8)-6)-25))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-18 (t+2), x(t)=-6 t-15$", + "Output Answer": [ + "$y=3 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -18*(t+2)\nx_t = -6*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{9 x^2}{\\sqrt{2}}+2 \\sqrt{2} x+\\frac{7}{\\sqrt{2}}$", + "Output Answer": [ + "$\\frac{9 \\left(x+\\frac{2}{9}\\right)^2}{\\sqrt{2}}-\\frac{2 \\sqrt{2}}{9}+\\frac{7}{\\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((9*x**2)/(math.sqrt(2)))+2*math.sqrt(2)*x+(7/(math.sqrt(2)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4096 x^4, q(x) = -(3 x+8)^3$", + "Output Answer": [ + "$4096 x^4-27 x^3-216 x^2-576 x-512$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4096*x**4\nq = -(3*x+8)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{18 x^2}{5}+\\frac{46 x}{5}-10$", + "Output Answer": [ + "$x=\\frac{1}{18} \\left(23-i \\sqrt{371}\\right)\\lor x=\\frac{1}{18} \\left(23+i \\sqrt{371}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((18*x**2)/5)+((46*x)/5)-10, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $8 x^2+9 x+6$", + "Output Answer": [ + "$8 \\left(x+\\frac{9}{16}\\right)^2+\\frac{111}{32}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (8*x**2+9*x+6), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-6 \\sqrt{5} x-6 \\sqrt{5} y-\\sqrt{5}=0$, $\\sqrt{5} x+5 \\sqrt{5} y+10 \\sqrt{5}=0$", + "Output Answer": [ + "$x=\\frac{55}{24}$, $y=-\\frac{59}{24}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-6*sqrt(5)*x-6*sqrt(5)*y-sqrt(5), sqrt(5)*x+5*sqrt(5)*y+10*sqrt(5)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -6 x^2+14 x-9$, $q(x) = -13 x^2-x-1$", + "Output Answer": [ + "$-19 x^2+13 x-10$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**2+14*x-9\nq = -13*x**2-x-1\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-2 x^2+8 x+9 y^2-8 y+7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(y-\\frac{4}{9}\\right)^2-2 (x-2)^2=-\\frac{119}{9}$\nFoci: $\\left(\n\\begin{array}{cc}\n 2-\\frac{\\sqrt{\\frac{1309}{2}}}{9} & \\frac{4}{9} \\\\\n \\frac{1}{18} \\left(36+\\sqrt{2618}\\right) & \\frac{4}{9} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{11}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(2-\\frac{\\sqrt{\\frac{1309}{2}}}{9}+\\frac{1}{18} \\left(36+\\sqrt{2618}\\right)\\right),\\frac{4}{9}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{2} x}{3}-\\frac{2}{9} \\left(3 \\sqrt{2}-2\\right),y=\\frac{2}{9} \\left(2+3 \\sqrt{2}\\right)-\\frac{\\sqrt{2} x}{3}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x**2+8*x+9*y**2-8*y+7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{3}{2}$, and $a_n=a_{n-1}+-2 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{3}{2} (-3-4 \\pi )$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(3/2) # initial value\nd = -2*math.pi # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(3/2) # initial value\nd = -2*math.pi # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{15}{2} e^{-\\frac{28 i \\pi }{45}}$.", + "Output Answer": [ + "Norm: $\\frac{15}{2}$\nArgument: $\\frac{17 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(15/2)*math.e**(-((28*i*math.pi)/45))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{100 x^2}{7}+15 x-1$", + "Output Answer": [ + "$x=\\frac{1}{40} \\left(21-\\sqrt{329}\\right)\\lor x=\\frac{1}{40} \\left(21+\\sqrt{329}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((100*x**2)/7)+15*x-1, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2-7 x-10 y^2+8 y+10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Circle\nEquation: $-10 \\left(x+\\frac{7}{20}\\right)^2-10 \\left(y-\\frac{2}{5}\\right)^2=-\\frac{513}{40}$\nRadius: $\\frac{3 \\sqrt{57}}{20}$\nCircumference: $\\frac{3 \\sqrt{57} \\pi }{10}$\nCenter: $\\left\\{-\\frac{7}{20},\\frac{2}{5}\\right\\}$\nArea Enclosed: $\\frac{513 \\pi }{400}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2-7*x-10*y**2+8*y+10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^4+2 x^3-4 x^2+8 x-4$ when divided by $-3 x^4+10 x^3+7 x^2+9 x-2$.", + "Output Answer": [ + "$-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**4+2*x**3-4*x**2+8*x-4\nq = -3*x**4+10*x**3+7*x**2+9*x-2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{23 x^2}{\\sqrt{3}}-\\frac{32 x}{\\sqrt{3}}-\\frac{4}{\\sqrt{3}}}{\\frac{19 x^2}{\\sqrt{3}}+10 \\sqrt{3} x+8 \\sqrt{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{23} \\left(16-2 \\sqrt{87}\\right)\\right\\},\\left\\{x\\to \\frac{1}{23} \\left(16+2 \\sqrt{87}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((23*x**2)/(sqrt(3)))-((32*x)/(sqrt(3)))-(4/(sqrt(3))))/(((19*x**2)/(sqrt(3)))+10*sqrt(3)*x+8*sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-3$ and $y=-8+10 i$", + "Output Answer": [ + "$\\frac{6}{41}+\\frac{15 i}{82}$" + ], + "Output Program": [ + "i = 1j\nx = -3\ny = -8+10*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x+10}+\\sqrt{9 x+1}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{8} \\left(18-\\sqrt{259}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x+10)+sqrt(9*x+1), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^6-5 x^5-4 x^4-x^3-2 x^2$ and $2 x^5-5 x^4-4 x^3-x^2-2 x$.", + "Output Answer": [ + "$2 x^5-5 x^4-4 x^3-x^2-2 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**6-5*x**5-4*x**4-x**3-2*x**2, 2*x**5-5*x**4-4*x**3-x**2-2*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{4}{49}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$\\frac{8780}{49}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(4/49) # initial value\nd = 4 # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(4/49) # initial value\nd = 4 # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^5-5 x^4+9 x^3-9 x^2-4 x-6$ when divided by $7 x^5-10 x^4-7 x^3-3 x^2-x-1$.", + "Output Answer": [ + "$\\frac{6}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**5-5*x**4+9*x**3-9*x**2-4*x-6\nq = 7*x**5-10*x**4-7*x**3-3*x**2-x-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (2, \\frac{1}{7}, \\frac{1}{5})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{4974}}{35},\\tan ^{-1}\\left(\\frac{5 \\sqrt{197}}{7}\\right),\\tan ^{-1}\\left(\\frac{1}{14}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 2\ny = (1/7)\nz = (1/5)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\sqrt{3} x^2+3 \\sqrt{3} x-8 \\sqrt{3}$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(-3-\\sqrt{41}\\right)\\lor x=\\frac{1}{2} \\left(\\sqrt{41}-3\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(sqrt(3)*x**2+3*sqrt(3)*x-8*sqrt(3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -8 x^2-3 x-5\\right| =11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(-3-\\sqrt{201}\\right)\\right\\},\\left\\{x\\to \\frac{1}{16} \\left(-3+\\sqrt{201}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-8*x**2-3*x-5), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(-3+i) \\sqrt{2}$ and $y=(4+i) \\sqrt{2}$", + "Output Answer": [ + "$-26+2 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-3+i)*math.sqrt(2)\ny = (4+i)*math.sqrt(2)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2 x^5+2 x^4+7 x^3-x^2+25 x+25$ and $x^3+x^2+x+5$.", + "Output Answer": [ + "$x^3+x^2+x+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2*x**5+2*x**4+7*x**3-x**2+25*x+25, x**3+x**2+x+5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 7 x^2-7 x+8$ and $q(x) = -10 x^2+6 x-9$", + "Output Answer": [ + "$-70 x^4+112 x^3-185 x^2+111 x-72$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 7*x**2-7*x+8\nq = -10*x**2+6*x-9\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{19 x^2}{5}+\\frac{538 x}{25}-\\frac{528}{25}$ and $\\frac{19 x}{5}-\\frac{24}{5}$.", + "Output Answer": [ + "$\\frac{19 x}{25}-\\frac{24}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((19*x**2)/5)+((538*x)/25)-(528/25), ((19*x)/5)-(24/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2-10 x+4 y^2-8 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 (y-1)^2-3 \\left(x+\\frac{5}{3}\\right)^2=\\frac{2}{3}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{3} & 1-\\frac{\\sqrt{\\frac{7}{2}}}{3} \\\\\n -\\frac{5}{3} & \\frac{1}{6} \\left(6+\\sqrt{14}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{3}}$\nCenter: $\\left\\{-\\frac{5}{3},\\frac{1}{2} \\left(1-\\frac{\\sqrt{\\frac{7}{2}}}{3}+\\frac{1}{6} \\left(6+\\sqrt{14}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{6} \\left(6-5 \\sqrt{3}\\right)-\\frac{\\sqrt{3} x}{2},y=\\frac{\\sqrt{3} x}{2}+\\frac{1}{6} \\left(6+5 \\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2-10*x+4*y**2-8*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 \\pi x^2-\\pi x$ and $q(x) = \\pi x+2 \\pi$", + "Output Answer": [ + "$3 \\pi ^2 x^3+5 \\pi ^2 x^2-2 \\pi ^2 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*pi*x**2-pi*x\nq = pi*x+2*pi\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -2 x^2+4 x-2$ and $q(x) = -12 x^2+6 x-9$", + "Output Answer": [ + "$24 x^4-60 x^3+66 x^2-48 x+18$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -2*x**2+4*x-2\nq = -12*x**2+6*x-9\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{43}{14}$, and $a_n=a_{n-1}+-7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$-\\frac{337}{2}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(43/14) # initial value\nd = -7 # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(43/14) # initial value\nd = -7 # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -(3 x-8)^3, q(x) = (2 x+1)^4$", + "Output Answer": [ + "$16 x^4+5 x^3+240 x^2-568 x+513$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(3*x-8)**3\nq = (2*x+1)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = e \\left(-2 x^2+2 x-5\\right)$, $q(x) = -e x (5 x+1)$", + "Output Answer": [ + "$-7 e x^2+e x-5 e$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x\n\np = math.e*(-2*x**2+2*x-5)\nq = -math.e*x*(5*x+1)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-8 \\left(-\\cos \\left(\\frac{\\pi }{15}\\right)+i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-512 \\left(\\frac{1}{4} \\left(-1-\\sqrt{5}\\right)+i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-8*(-math.cos((math.pi/15))+1j*math.sin((math.pi/15))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -13 x^2+6 x-3$ and $q(x) = 8 x^2-2 x-15$", + "Output Answer": [ + "$-104 x^4+74 x^3+159 x^2-84 x+45$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -13*x**2+6*x-3\nq = 8*x**2-2*x-15\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-23 x^2-6 x+3}{-5 x^2+19 x+19}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{23} \\left(-3-\\sqrt{78}\\right)\\right\\},\\left\\{x\\to \\frac{1}{23} \\left(-3+\\sqrt{78}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-23*x**2-6*x+3)/(-5*x**2+19*x+19)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = x^2+x-4$, $q(x) = 12 x^2+6 x-11$", + "Output Answer": [ + "$13 x^2+7 x-15$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**2+x-4\nq = 12*x**2+6*x-11\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{52}{7}+\\frac{68 i}{7}$ and $y=7-\\frac{25 i}{7}$", + "Output Answer": [ + "$-\\frac{101}{7}+\\frac{93 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = -(52/7)+((68*i)/7)\ny = 7-((25*i)/7)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{x^2}{4}-10 x+\\frac{59}{4}$ and $q(x) = -3 x^2-\\frac{9 x}{4}-\\frac{37}{4}$", + "Output Answer": [ + "$\\frac{3 x^4}{4}+\\frac{489 x^3}{16}-\\frac{311 x^2}{16}+\\frac{949 x}{16}-\\frac{2183}{16}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((x**2)/4)-10*x+(59/4)\nq = -3*x**2-((9*x)/4)-(37/4)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-x^3+3 x^2-7 x-10$ when divided by $-9 x^3-5 x^2+1$.", + "Output Answer": [ + "$\\frac{1}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**3+3*x**2-7*x-10\nq = -9*x**3-5*x**2+1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{2016 t^2-8736 t+9455}{3 \\sqrt{3}}, x(t)=48 t^2-208 t+\\frac{676}{3}$", + "Output Answer": [ + "$y=\\sqrt{3}-\\frac{14 x}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -((2016*t**2-8736*t+9455)/(3*sqrt(3)))\nx_t = 48*t**2-208*t+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-11 x+16 y-4=0$, $25 x+10 y-9=0$", + "Output Answer": [ + "$x=\\frac{52}{255}$, $y=\\frac{199}{510}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-11*x+16*y-4, 25*x+10*y-9), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{43 x^2}{4}-\\frac{41 x}{4}-8$, $q(x) = -\\frac{27 x^2}{4}+\\frac{9 x}{2}+2$", + "Output Answer": [ + "$4 x^2-\\frac{23 x}{4}-6$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((43*x**2)/4)-((41*x)/4)-8\nq = -((27*x**2)/4)+((9*x)/2)+2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 11 x^2-13 x-11$ and $q(x) = 5 x^2-11 x-3$", + "Output Answer": [ + "$55 x^4-186 x^3+55 x^2+160 x+33$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 11*x**2-13*x-11\nq = 5*x**2-11*x-3\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{820 x^3}{7}-\\frac{418 x^2}{49}+\\frac{5188 x}{49}-\\frac{438}{49}}{-200 x^2-\\frac{760 x}{7}+\\frac{528}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{164} \\left(-13-\\sqrt{24113}\\right)\\right\\},\\left\\{x\\to \\frac{1}{164} \\left(-13+\\sqrt{24113}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((820*x**3)/7)-((418*x**2)/49)+((5188*x)/49)-(438/49))/(-200*x**2-((760*x)/7)+(528/49))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{4} (17 x+6)^2, q(x) = -(3 x+2)^3$", + "Output Answer": [ + "$-27 x^3+\\frac{73 x^2}{4}+15 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/4)*(17*x+6)**2\nq = -(3*x+2)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{10-12}{(25-24)+4}$.", + "Output Answer": [ + "$-\\frac{2}{5}$" + ], + "Output Program": [ + "try: \n print(((10-12)/((25-24)+4)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-6 x^2+108 x+240$", + "Output Answer": [ + "$6 (20-x) (x+2)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-6*x**2+108*x+240, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{7-11 x}+\\sqrt{-2 x-13}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{81} \\left(-2017+26 \\sqrt{2305}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(7-11*x)+sqrt(-2*x-13), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-x^3-6 x^2-7 x-10$ when divided by $-9 x-8$.", + "Output Answer": [ + "$\\frac{x^2}{9}+\\frac{46 x}{81}+\\frac{199}{729}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**3-6*x**2-7*x-10\nq = -9*x-8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{6}{41}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$\\frac{62376}{41}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (6/41) # initial value\nd = 6 # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (6/41) # initial value\nd = 6 # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x-\\frac{11}{2}}+\\sqrt{3 x-5}=\\frac{29}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(4203-116 \\sqrt{1255}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x-(11/2))+sqrt(3*x-5), (29/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{841 t^2}{8}+435 t-\\frac{907}{2}, x(t)=\\frac{841 t^2}{16}-\\frac{435 t}{2}+225$", + "Output Answer": [ + "$y=-2 x-\\frac{7}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -((841*t**2)/8)+435*t-(907/2)\nx_t = ((841*t**2)/16)-((435*t)/2)+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the first order series of the inverse of the following function around 1:\n$\\tanh ^{-1}\\left(\\frac{x}{5}\\right)$", + "Output Answer": [ + "$\\frac{24}{5} \\left(x-\\tanh ^{-1}\\left(\\frac{1}{5}\\right)\\right)+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, atanh(x/5))\nprint(solve(f, x)[0].series(y, 1, 1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 x^2+1$ and $q(x) = 8 x^2-2 x-8$", + "Output Answer": [ + "$32 x^4-8 x^3-24 x^2-2 x-8$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*x**2+1\nq = 8*x**2-2*x-8\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=3 \\left(192 t^2+16 \\left(\\sqrt{3}-108\\right) t-72 \\sqrt{3}+3889\\right), x(t)=2 \\sqrt{3} t-9 \\sqrt{3}$", + "Output Answer": [ + "$y=48 x^2+24 x+3$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 3*(192*t**2+16*(sqrt(3)-108)*t-72*sqrt(3)+3889)\nx_t = 2*sqrt(3)*t-9*sqrt(3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4$ and $-x^4-2 x^3+2 x^2+2 x+2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4, -x**4-2*x**3+2*x**2+2*x+2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-11 x^2+10 x+12$", + "Output Answer": [ + "$\\frac{157}{11}-11 \\left(x-\\frac{5}{11}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-11*x**2+10*x+12), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{25} (11 x+36)^2, q(x) = \\frac{4}{25} (5 x+12)^2$", + "Output Answer": [ + "$\\frac{221 x^2}{25}+\\frac{1272 x}{25}+\\frac{1872}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/25)*(11*x+36)**2\nq = (4/25)*(5*x+12)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 14 x^2-3 x+10$ and $q(x) = -3 x^2-8 x-12$", + "Output Answer": [ + "$-42 x^4-103 x^3-174 x^2-44 x-120$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 14*x**2-3*x+10\nq = -3*x**2-8*x-12\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -729, q(x) = -9 x$", + "Output Answer": [ + "$-9 x-729$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -729\nq = -9*x\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{57}{13}$, and $a_n=a_{n-1}+4 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$\\frac{7}{2} \\left(24 \\sqrt{5}-\\frac{114}{13}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(57/13) # initial value\nd = 4*math.sqrt(5) # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(57/13) # initial value\nd = 4*math.sqrt(5) # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{23}{26}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$-\\frac{161}{26}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(23/26) # initial value\nd = 0 # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(23/26) # initial value\nd = 0 # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{57}{68}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$-\\frac{855}{34}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(57/68) # initial value\nd = 0 # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(57/68) # initial value\nd = 0 # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+4 x-9 y^2-4 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x+\\frac{2}{9}\\right)^2-9 \\left(y+\\frac{2}{9}\\right)^2=9$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{9}-\\sqrt{2} & -\\frac{2}{9} \\\\\n \\sqrt{2}-\\frac{2}{9} & -\\frac{2}{9} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{-\\frac{2}{9},-\\frac{2}{9}\\right\\}$\nAsymptotes: $\\left\\{y=x,y=-x-\\frac{4}{9}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+4*x-9*y**2-4*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{46}{5} \\left(\\cos \\left(\\frac{31 \\pi }{180}\\right)+i \\sin \\left(\\frac{31 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{46}{5} \\sqrt{\\sin ^2\\left(\\frac{31 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{31 \\pi }{180}\\right)}$\nArgument: $-\\frac{149 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(46/5)*(math.cos(((31*math.pi)/180))+i*math.sin(((31*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -2 \\sqrt{5} \\left(x^2+2 x-1\\right)$, $q(x) = -2 \\sqrt{5} \\left(3 x^2-3 x+1\\right)$", + "Output Answer": [ + "$2 \\sqrt{5} x-8 \\sqrt{5} x^2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*sqrt(5)*(x**2+2*x-1)\nq = -2*sqrt(5)*(3*x**2-3*x+1)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2 \\sqrt{2} \\left(-\\sin \\left(\\frac{29 \\pi }{180}\\right)-i \\cos \\left(\\frac{29 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $2 \\sqrt{2 \\left(\\sin ^2\\left(\\frac{29 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{29 \\pi }{180}\\right)\\right)}$\nArgument: $-\\frac{119 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2*math.sqrt(2)*(-math.sin(((29*math.pi)/180))-i*math.cos(((29*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{13 x}{3}-\\frac{35}{3}}+\\sqrt{11 x-\\frac{8}{3}}=\\frac{41}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{600} \\left(37853-123 \\sqrt{73121}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((13*x)/3)-(35/3))+sqrt(11*x-(8/3)), (41/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$24 x+23 y+\\frac{5}{2}=0$, $7 x-\\frac{25 y}{2}-24=0$", + "Output Answer": [ + "$x=\\frac{2083}{1844}$, $y=-\\frac{1187}{922}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((24*x+23*y+(5/2), 7*x-((25*y)/2)-24), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$x-20 y+8=0$, $-9 x-4 y-5=0$", + "Output Answer": [ + "$x=-\\frac{33}{46}$, $y=\\frac{67}{184}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((x-20*y+8, -9*x-4*y-5), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $7 x+10 y^2+8 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $7 x+10 y^2+8 y=3$\nVertex: $\\left\\{\\frac{23}{35},-\\frac{2}{5}\\right\\}$\nDirectrix: $x=\\frac{233}{280}$\nFocal Parameter: $\\frac{7}{20}$\nFocus: $\\left\\{\\frac{27}{56},-\\frac{2}{5}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x+10*y**2+8*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\left(\\cos \\left(\\frac{37}{45}\\right)+i \\sin \\left(\\frac{37}{45}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$2176782336 \\left(\\cos \\left(\\frac{148}{15}\\right)+i \\sin \\left(\\frac{148}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*(math.cos((37/45))+1j*math.sin((37/45))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{75 x^2}{7}-\\frac{40 x}{7}-\\frac{50}{7}$", + "Output Answer": [ + "$x=\\frac{1}{15} \\left(4-\\sqrt{166}\\right)\\lor x=\\frac{1}{15} \\left(4+\\sqrt{166}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((75*x**2)/7)-((40*x)/7)-(50/7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 7 \\sqrt{2} x^2-3 \\sqrt{2} x-\\sqrt{2}$ and $q(x) = -7 \\sqrt{2} x^2$", + "Output Answer": [ + "$-98 x^4+42 x^3+14 x^2$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 7*sqrt(2)*x**2-3*sqrt(2)*x-sqrt(2)\nq = -7*sqrt(2)*x**2\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 3 \\left(4 x^2-3 x+4\\right)$, $q(x) = -9 x^2+9 x+7$", + "Output Answer": [ + "$3 x^2+19$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*(4*x**2-3*x+4)\nq = -9*x**2+9*x+7\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{5 x^2}{\\sqrt{\\pi }}-\\frac{6 x}{\\sqrt{\\pi }}-\\frac{20}{\\sqrt{\\pi }}$ and $q(x) = -\\frac{2 x^2}{\\sqrt{\\pi }}-\\frac{9}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{10 x^4}{\\pi }+\\frac{12 x^3}{\\pi }+\\frac{85 x^2}{\\pi }+\\frac{54 x}{\\pi }+\\frac{180}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((5*x**2)/(sqrt(pi)))-((6*x)/(sqrt(pi)))-(20/(sqrt(pi)))\nq = -((2*x**2)/(sqrt(pi)))-(9/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{66 x^2}{5}+\\frac{52 x}{5}+\\frac{23}{5}$", + "Output Answer": [ + "$x=\\frac{1}{66} \\left(-26-i \\sqrt{842}\\right)\\lor x=\\frac{1}{66} \\left(-26+i \\sqrt{842}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((66*x**2)/5)+((52*x)/5)+(23/5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^5+4 x^4-3 x^3+8 x^2+10 x+9$ when divided by $-8 x^4-8 x^3-8 x+9$.", + "Output Answer": [ + "$-\\frac{x}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**5+4*x**4-3*x**3+8*x**2+10*x+9\nq = -8*x**4-8*x**3-8*x+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x+9}+\\sqrt{12 x+13}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(2845-26 \\sqrt{10441}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x+9)+sqrt(12*x+13), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x+12}+\\sqrt{\\frac{21 x}{2}-\\frac{29}{2}}=\\frac{27}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{722} \\left(18781-54 \\sqrt{51974}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x+12)+sqrt(((21*x)/2)-(29/2)), (27/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(25-8)+\\left(\\left(\\frac{21}{21}-15\\right)-11\\right)$.", + "Output Answer": [ + "$-8$" + ], + "Output Program": [ + "try: \n print((25-8)+(((21/21)-15)-11))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^6+6 x^5-3 x^4-9 x^2-x-9$ when divided by $-5 x^5-6 x^4+6 x^3-8 x^2-2 x+7$.", + "Output Answer": [ + "$\\frac{8 x}{5}-\\frac{78}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**6+6*x**5-3*x**4-9*x**2-x-9\nq = -5*x**5-6*x**4+6*x**3-8*x**2-2*x+7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2-55 \\sqrt{3} x-132$", + "Output Answer": [ + "$11 \\left(-x-\\sqrt{3}\\right) \\left(x+4 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2-55*sqrt(3)*x-132, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 x^2+13 x+2$ and $q(x) = 13 x-12$", + "Output Answer": [ + "$65 x^3+109 x^2-130 x-24$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*x**2+13*x+2\nq = 13*x-12\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-8 x^2-24 x-6}{-3 x^2+15 x-3}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-3-\\sqrt{6}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(-3+\\sqrt{6}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-8*x**2-24*x-6)/(-3*x**2+15*x-3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 8 x^2+x+13$ and $q(x) = -4 x^2+5 x-6$", + "Output Answer": [ + "$-32 x^4+36 x^3-95 x^2+59 x-78$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 8*x**2+x+13\nq = -4*x**2+5*x-6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -(x+4)^3, q(x) = (7-9 x)^4$", + "Output Answer": [ + "$6561 x^4-20413 x^3+23802 x^2-12396 x+2337$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(x+4)**3\nq = (7-9*x)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{29 x^2}{2}-12 x}{-\\frac{x}{2}-\\frac{11}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to 0\\},\\left\\{x\\to \\frac{24}{29}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((29*x**2)/2)-12*x)/(-(x/2)-(11/2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2+4 x+3 y^2-3 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x+\\frac{2}{5}\\right)^2+3 \\left(y-\\frac{1}{2}\\right)^2=\\frac{91}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{5} & \\frac{1}{2}-\\frac{\\sqrt{\\frac{91}{6}}}{5} \\\\\n -\\frac{2}{5} & \\frac{1}{30} \\left(15+\\sqrt{546}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{5}}$\nCenter: $\\left\\{-\\frac{2}{5},\\frac{1}{2} \\left(\\frac{1}{2}-\\frac{\\sqrt{\\frac{91}{6}}}{5}+\\frac{1}{30} \\left(15+\\sqrt{546}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{91 \\pi }{20 \\sqrt{15}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2+4*x+3*y**2-3*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-5 x^3+95 x^2-80 x-180$", + "Output Answer": [ + "$5 (18-x) (x-2) (x+1)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-5*x**3+95*x**2-80*x-180, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-5 \\left(\\sin \\left(\\frac{2 \\pi }{15}\\right)-i \\cos \\left(\\frac{2 \\pi }{15}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$25 \\left(-\\sin \\left(\\frac{7 \\pi }{30}\\right)-i \\cos \\left(\\frac{7 \\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-5*(math.sin(((2*math.pi)/15))-1j*math.cos(((2*math.pi)/15))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{64} \\left(1573 t^2+8580 t+11716\\right)^2, x(t)=\\frac{121 t^2}{4}+165 t+225$", + "Output Answer": [ + "$y=\\frac{169 x^2}{4}+26 x+4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/64)*(1573*t**2+8580*t+11716)**2\nx_t = ((121*t**2)/4)+165*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2-14 x}+\\sqrt{\\frac{29}{2}-5 x}=\\frac{11}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{324} \\left(-2749+22 \\sqrt{15418}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2-14*x)+sqrt((29/2)-5*x), (11/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11 x-8}+\\sqrt{12 x-7}=3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{176}{103+3 \\sqrt{1169}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11*x-8)+sqrt(12*x-7), 3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\sqrt{2} \\left(\\sin \\left(\\frac{7 \\pi }{30}\\right)+i \\cos \\left(\\frac{7 \\pi }{30}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$64 \\left(\\frac{1}{4} \\left(-1-\\sqrt{5}\\right)-i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.sqrt(2)*(math.sin(((7*math.pi)/30))+1j*math.cos(((7*math.pi)/30))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{34 t}{9}+93, x(t)=-\\frac{2 t}{3}-15$", + "Output Answer": [ + "$y=8-\\frac{17 x}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = ((34*t)/9)+93\nx_t = -((2*t)/3)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 x^2-\\frac{27 x}{7}+\\frac{36}{7}$", + "Output Answer": [ + "$\\frac{2745}{392}-2 \\left(x+\\frac{27}{28}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*x**2-((27*x)/7)+(36/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{13-5 x}+\\sqrt{4-x}=3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{8} \\left(-3+\\sqrt{73}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(13-5*x)+sqrt(4-x), 3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 \\sqrt{2} x^2-7 \\sqrt{2} x-3 \\sqrt{2}$", + "Output Answer": [ + "$-3 \\sqrt{2} \\left(x+\\frac{7}{6}\\right)^2-3 \\sqrt{2}+\\frac{49}{6 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*math.sqrt(2)*x**2-7*math.sqrt(2)*x-3*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{73}{51}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$\\frac{1460}{51}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (73/51) # initial value\nd = 0 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (73/51) # initial value\nd = 0 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(((5+15)+8)^2+3\\right)+2\\right)-(18+10)^2$.", + "Output Answer": [ + "$5$" + ], + "Output Program": [ + "try: \n print(((((5+15)+8)**2+3)+2)-(18+10)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{8 x^3-42 x^2-194 x+144}{32 x-256}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(-11-\\sqrt{265}\\right)\\right\\},\\left\\{x\\to \\frac{1}{8} \\left(-11+\\sqrt{265}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((8*x**3-42*x**2-194*x+144)/(32*x-256)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{21}{32}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{513}{32}$" + ], + "Output Program": [ + "a = -(21/32) # initial value\nd = 6 # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(21/32) # initial value\nd = 6 # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -x^2+6 x+7$ and $q(x) = -15 x^2+3 x+10$", + "Output Answer": [ + "$15 x^4-93 x^3-97 x^2+81 x+70$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -x**2+6*x+7\nq = -15*x**2+3*x+10\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{5 x}{7}+\\frac{2}{7}}+\\sqrt{\\frac{61 x}{7}-\\frac{11}{7}}=\\frac{50}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{21262-25 \\sqrt{207971}}{2744}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((5*x)/7)+(2/7))+sqrt(((61*x)/7)-(11/7)), (50/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{(50 t+5593)^2}{2401}, x(t)=-\\frac{t}{7}-15$", + "Output Answer": [ + "$y=\\frac{2500 x^2}{49}-100 x+49$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (((50*t+5593)**2)/2401)\nx_t = -(t/7)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $7 x^2-11 x+6$", + "Output Answer": [ + "$7 \\left(x-\\frac{11}{14}\\right)^2+\\frac{47}{28}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (7*x**2-11*x+6), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\cos (7 x+2)$ at the point $x=0$", + "Output Answer": [ + "$\\cos (2) = -0.416$" + ], + "Output Program": [ + "import math\n\nx = 0\ntry: \n f = math.cos(7*x+2)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$7 x-19 y-1=0$, $3 x-23 y+11=0$", + "Output Answer": [ + "$x=\\frac{29}{13}$, $y=\\frac{10}{13}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((7*x-19*y-1, 3*x-23*y+11), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{54 x^2}{7}-\\frac{69 x}{7}-\\frac{68}{7}$", + "Output Answer": [ + "$-\\frac{54}{7} \\left(x+\\frac{23}{36}\\right)^2-\\frac{1103}{168}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((54*x**2)/7)-((69*x)/7)-(68/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{59}{93}$, and $a_n=a_{n-1}+\\frac{21}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$\\frac{18167}{93}$" + ], + "Output Program": [ + "a = (59/93) # initial value\nd = (21/5) # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (59/93) # initial value\nd = (21/5) # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{71}{17}$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$-\\frac{6830}{17}$" + ], + "Output Program": [ + "a = -(71/17) # initial value\nd = -8 # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(71/17) # initial value\nd = -8 # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{31}{4} \\left(\\sin \\left(\\frac{\\pi }{90}\\right)-i \\cos \\left(\\frac{\\pi }{90}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{31}{4} \\sqrt{\\sin ^2\\left(\\frac{\\pi }{90}\\right)+\\cos ^2\\left(\\frac{\\pi }{90}\\right)}$\nArgument: $\\frac{23 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(31/4)*(math.sin((math.pi/90))-i*math.cos((math.pi/90)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $x^6-8 x^5-7 x^4+7 x^3+7 x^2+5 x-6$ when divided by $-8 x^5-2 x^4-8 x^3+2 x^2+7 x+5$.", + "Output Answer": [ + "$\\frac{33}{32}-\\frac{x}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**6-8*x**5-7*x**4+7*x**3+7*x**2+5*x-6\nq = -8*x**5-2*x**4-8*x**3+2*x**2+7*x+5\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{29}{4}+\\frac{15 i}{4}$ and $y=\\frac{7}{4}-\\frac{19 i}{2}$", + "Output Answer": [ + "$\\frac{11}{2}+\\frac{53 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = (29/4)+((15*i)/4)\ny = (7/4)-((19*i)/2)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$7 x-\\frac{2 y}{3}-\\frac{11}{3}=0$, $\\frac{49 x}{3}-23 y+\\frac{32}{3}=0$", + "Output Answer": [ + "$x=\\frac{823}{1351}$, $y=\\frac{173}{193}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((7*x-((2*y)/3)-(11/3), ((49*x)/3)-23*y+(32/3)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{9}{8}$, and $a_n=a_{n-1}+4 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{11}{2} \\left(\\frac{9}{4}+40 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (9/8) # initial value\nd = 4*math.sqrt(5) # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (9/8) # initial value\nd = 4*math.sqrt(5) # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{1}{343} (31 x-2)^3, q(x) = \\frac{9}{49} (15-7 x)^2$", + "Output Answer": [ + "$-\\frac{29791 x^3}{343}+\\frac{8853 x^2}{343}-\\frac{13602 x}{343}+\\frac{14183}{343}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(1/343)*(31*x-2)**3\nq = (9/49)*(15-7*x)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-2 \\sqrt{2} x^2-8 \\sqrt{2} x+5 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(-4-\\sqrt{26}\\right)\\lor x=\\frac{1}{2} \\left(\\sqrt{26}-4\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-2*sqrt(2)*x**2-8*sqrt(2)*x+5*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-6 x-5 y+20=0$, $-x+23 y+15=0$", + "Output Answer": [ + "$x=\\frac{535}{143}$, $y=-\\frac{70}{143}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-6*x-5*y+20, -x+23*y+15), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 24-x| =14$", + "Output Answer": [ + "$\\{\\{x\\to 10\\},\\{x\\to 38\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(24-x), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2-9 x+8 y^2-8 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y-\\frac{1}{2}\\right)^2-6 \\left(x+\\frac{3}{4}\\right)^2=-\\frac{51}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{8} \\left(-6-\\sqrt{119}\\right) & \\frac{1}{2} \\\\\n \\frac{1}{8} \\left(\\sqrt{119}-6\\right) & \\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{7}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{8} \\left(-6-\\sqrt{119}\\right)+\\frac{1}{8} \\left(\\sqrt{119}-6\\right)\\right),\\frac{1}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{3} x}{2}+\\frac{1}{8} \\left(4+3 \\sqrt{3}\\right),y=\\frac{1}{8} \\left(4-3 \\sqrt{3}\\right)-\\frac{\\sqrt{3} x}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2-9*x+8*y**2-8*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^2-x-4$ and $-x^2+3 x-4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**2-x-4, -x**2+3*x-4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$20 x-6 y-8 z-17=0$, $-24 x+22 y+24 z+8=0$, $-16 x-13 y-18 z+3=0$", + "Output Answer": [ + "$x=\\frac{373}{524}$, $y=\\frac{569}{131}$, $z=-\\frac{472}{131}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((20*x-6*y-8*z-17, -24*x+22*y+24*z+8, -16*x-13*y-18*z+3)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{2-8 i}{\\sqrt{3}}$ and $y=-\\frac{7-10 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{94}{149}+\\frac{36 i}{149}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((2-8*i)/(math.sqrt(3)))\ny = -((7-10*i)/(math.sqrt(3)))\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -6 x^2+8 x-12$ and $q(x) = -13 x^2-5 x+15$", + "Output Answer": [ + "$78 x^4-74 x^3+26 x^2+180 x-180$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -6*x**2+8*x-12\nq = -13*x**2-5*x+15\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{153 x^2+439 x+220}{63 x^2+347 x+460}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{11}{17}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((153*x**2+439*x+220)/(63*x**2+347*x+460)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{9 \\left(\\cos \\left(\\frac{59}{30}\\right)+i \\sin \\left(\\frac{59}{30}\\right)\\right)}{\\sqrt{2}}\\right)^9$", + "Output Answer": [ + "$\\frac{387420489 \\left(\\cos \\left(\\frac{177}{10}\\right)+i \\sin \\left(\\frac{177}{10}\\right)\\right)}{16 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((9*(math.cos((59/30))+1j*math.sin((59/30))))/(math.sqrt(2))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{28}{3} \\left(\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)\\right)^9$", + "Output Answer": [ + "$\\frac{10578455953408}{19683}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(28/3)*((1/2)-((1j*math.sqrt(3))/2)))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{3-13 i}{\\sqrt{2}}$.", + "Output Answer": [ + "Norm: $\\sqrt{89}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{13}{3}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((3-13*i)/(math.sqrt(2)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(24-21)+20}{24+20}$.", + "Output Answer": [ + "$\\frac{23}{44}$" + ], + "Output Program": [ + "try: \n print((((24-21)+20)/(24+20)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{52 x^2+232 x-480}{48 x+288}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{20}{13}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((52*x**2+232*x-480)/(48*x+288)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{1}{(-9 x-6)^3}+\\cos (8 x+7)$ at the point $x=-6$", + "Output Answer": [ + "$\\frac{1}{110592}+\\cos (41) = -0.987$" + ], + "Output Program": [ + "import math\n\nx = -6\ntry: \n f = (1/((-9*x-6)**3))+math.cos(8*x+7)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^4-8 x^3-2 x^2+4 x+9$ when divided by $-4 x^4-x^3+2 x^2+3 x-10$.", + "Output Answer": [ + "$-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**4-8*x**3-2*x**2+4*x+9\nq = -4*x**4-x**3+2*x**2+3*x-10\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-4 \\sqrt{2} \\left(\\sin \\left(\\frac{\\pi }{60}\\right)-i \\cos \\left(\\frac{\\pi }{60}\\right)\\right)$.", + "Output Answer": [ + "Norm: $4 \\sqrt{2 \\left(\\sin ^2\\left(\\frac{\\pi }{60}\\right)+\\cos ^2\\left(\\frac{\\pi }{60}\\right)\\right)}$\nArgument: $\\frac{31 \\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -4*math.sqrt(2)*(math.sin((math.pi/60))-i*math.cos((math.pi/60)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+5 x+6 y^2-2 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x+\\frac{5}{8}\\right)^2+6 \\left(y-\\frac{1}{6}\\right)^2=\\frac{563}{48}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{8}-\\frac{\\sqrt{563}}{24} & \\frac{1}{6} \\\\\n \\frac{1}{24} \\left(\\sqrt{563}-15\\right) & \\frac{1}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{5}{8}-\\frac{\\sqrt{563}}{24}+\\frac{1}{24} \\left(\\sqrt{563}-15\\right)\\right),\\frac{1}{6}\\right\\}$\nArea Enclosed: $\\frac{563 \\pi }{96 \\sqrt{6}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+5*x+6*y**2-2*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2+12 \\sqrt{2} x+448$", + "Output Answer": [ + "$2 \\left(14 \\sqrt{2}-x\\right) \\left(x+8 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2+12*sqrt(2)*x+448, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{16 x^2}{\\sqrt{3}}-5 \\sqrt{3} x-\\frac{13}{\\sqrt{3}}$ and $q(x) = -\\frac{19 x^2}{\\sqrt{3}}-\\frac{17 x}{\\sqrt{3}}+\\frac{2}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{304 x^4}{3}+\\frac{13 x^3}{3}+178 x^2+\\frac{191 x}{3}-\\frac{26}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((16*x**2)/(sqrt(3)))-5*sqrt(3)*x-(13/(sqrt(3)))\nq = -((19*x**2)/(sqrt(3)))-((17*x)/(sqrt(3)))+(2/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-5 \\sqrt{3} x^2-9 \\sqrt{3} x-7 \\sqrt{3}$", + "Output Answer": [ + "$-5 \\sqrt{3} \\left(x+\\frac{9}{10}\\right)^2-\\frac{59 \\sqrt{3}}{20}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-5*math.sqrt(3)*x**2-9*math.sqrt(3)*x-7*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{88 x^2}{3}+\\frac{394 x}{3}-325}{\\frac{56 x^2}{3}+\\frac{362 x}{3}+25}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{39}{22}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((88*x**2)/3)+((394*x)/3)-325)/(((56*x**2)/3)+((362*x)/3)+25)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((13-3)+6)+8)-((((11+23)-2)+23)+12)$.", + "Output Answer": [ + "$-43$" + ], + "Output Program": [ + "try: \n print((((13-3)+6)+8)-((((11+23)-2)+23)+12))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=4-5 i$ and $y=3-7 i$", + "Output Answer": [ + "$1+2 i$" + ], + "Output Program": [ + "i = 1j\nx = 4-5*i\ny = 3-7*i\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2+2 x-7 y^2+8 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x+\\frac{1}{5}\\right)^2-7 \\left(y-\\frac{4}{7}\\right)^2=-\\frac{283}{35}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{5} & -\\frac{2}{35} \\left(\\sqrt{849}-10\\right) \\\\\n -\\frac{1}{5} & \\frac{2}{35} \\left(10+\\sqrt{849}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{3}{5}}$\nCenter: $\\left\\{-\\frac{1}{5},\\frac{1}{2} \\left(\\frac{2}{35} \\left(10+\\sqrt{849}\\right)-\\frac{2}{35} \\left(\\sqrt{849}-10\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{35} \\left(20-\\sqrt{35}\\right)-\\sqrt{\\frac{5}{7}} x,y=\\sqrt{\\frac{5}{7}} x+\\frac{1}{35} \\left(20+\\sqrt{35}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2+2*x-7*y**2+8*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^6-2 x^5-2 x^4+10 x^3+x-8$ when divided by $3 x^3-9 x^2-6 x-7$.", + "Output Answer": [ + "$\\frac{7 x^3}{3}+\\frac{19 x^2}{3}+23 x+\\frac{814}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**6-2*x**5-2*x**4+10*x**3+x-8\nq = 3*x**3-9*x**2-6*x-7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$3 x-4 y-4 z+24=0$, $18 x-8 y-16 z-21=0$, $11 x-19 y-13 z-13=0$", + "Output Answer": [ + "$x=\\frac{715}{23}$, $y=-\\frac{1599}{184}$, $z=\\frac{6993}{184}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((3*x-4*y-4*z+24, 18*x-8*y-16*z-21, 11*x-19*y-13*z-13)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 x^2-12 x+6$ and $q(x) = 12 x^2+6 x+8$", + "Output Answer": [ + "$-48 x^4-168 x^3-32 x^2-60 x+48$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*x**2-12*x+6\nq = 12*x**2+6*x+8\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-5 i$ and $y=4-10 i$", + "Output Answer": [ + "$\\frac{25}{58}-\\frac{5 i}{29}$" + ], + "Output Program": [ + "i = 1j\nx = -5*i\ny = 4-10*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $6 x^2-42 x-\\frac{4836}{49}$", + "Output Answer": [ + "$-6 \\left(\\frac{62}{7}-x\\right) \\left(x+\\frac{13}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(6*x**2-42*x-(4836/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the fourth order series of the inverse of the following function around 4:\n$\\sqrt{\\frac{13}{3}} \\sqrt{-x}$", + "Output Answer": [ + "$-\\frac{3}{13} \\left(x-\\sqrt{13}\\right)^2-\\frac{6 \\left(x-\\sqrt{13}\\right)}{\\sqrt{13}}-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, sqrt((13/3))*sqrt(-x))\nprint(solve(f, x)[0].series(y, 4, 4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^6+2 x^5-x^4-4 x^3-5 x^2+8 x+5$ when divided by $9 x^5+x^4-6 x^2+3 x+7$.", + "Output Answer": [ + "$\\frac{22}{81}-\\frac{4 x}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**6+2*x**5-x**4-4*x**3-5*x**2+8*x+5\nq = 9*x**5+x**4-6*x**2+3*x+7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{5 x}{2}-4}+\\sqrt{15 x+13}=\\frac{13}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{250} \\left(843-26 \\sqrt{274}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((5*x)/2)-4)+sqrt(15*x+13), (13/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{34}{99}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$\\frac{35560}{99}$" + ], + "Output Program": [ + "a = -(34/99) # initial value\nd = 4 # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(34/99) # initial value\nd = 4 # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(2+4 i) \\sqrt{3}$ and $y=-\\frac{8}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{8}{\\sqrt{3}}+(2+4 i) \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (2+4*i)*math.sqrt(3)\ny = -(8/(math.sqrt(3)))\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -15 x^2-5 x+3$ and $q(x) = -4 x^2-15 x-10$", + "Output Answer": [ + "$60 x^4+245 x^3+213 x^2+5 x-30$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -15*x**2-5*x+3\nq = -4*x**2-15*x-10\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\cos \\left(3 x+\\frac{3}{2}\\right)$ at the point $x=9$", + "Output Answer": [ + "$\\cos \\left(\\frac{57}{2}\\right) = -0.975$" + ], + "Output Program": [ + "import math\n\nx = 9\ntry: \n f = math.cos(3*x+(3/2))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{85 x^2}{7}-\\frac{34 x}{7}+6$", + "Output Answer": [ + "$x=\\frac{1}{85} \\left(-17-\\sqrt{3859}\\right)\\lor x=\\frac{1}{85} \\left(\\sqrt{3859}-17\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((85*x**2)/7)-((34*x)/7)+6, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{41}{25}$, and $a_n=a_{n-1}+-7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$-\\frac{35889}{25}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (41/25) # initial value\nd = -7 # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (41/25) # initial value\nd = -7 # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $12 x^6-2 x^5+22 x^4+6 x^3+4 x^2+10 x-4$ and $3 x^4+x^3+3 x^2+2 x-1$.", + "Output Answer": [ + "$3 x^4+x^3+3 x^2+2 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(12*x**6-2*x**5+22*x**4+6*x**3+4*x**2+10*x-4, 3*x**4+x**3+3*x**2+2*x-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{67 x}{7}+\\frac{101 y}{7}+\\frac{97}{7}=0$, $\\frac{62 x}{7}-\\frac{170 y}{7}+\\frac{10}{7}=0$", + "Output Answer": [ + "$x=\\frac{4375}{1282}$, $y=\\frac{1671}{1282}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((67*x)/7)+((101*y)/7)+(97/7), ((62*x)/7)-((170*y)/7)+(10/7)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-10 x+3 y^2+7 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $6 \\left(x-\\frac{5}{6}\\right)^2+3 \\left(y+\\frac{7}{6}\\right)^2=\\frac{61}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{6} & -\\frac{7}{6}-\\frac{\\sqrt{\\frac{61}{6}}}{2} \\\\\n \\frac{5}{6} & \\frac{1}{12} \\left(\\sqrt{366}-14\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{\\frac{5}{6},\\frac{1}{2} \\left(-\\frac{7}{6}-\\frac{\\sqrt{\\frac{61}{6}}}{2}+\\frac{1}{12} \\left(\\sqrt{366}-14\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{61 \\pi }{12 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-10*x+3*y**2+7*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-2-\\frac{19 i}{2}$ and $y=-\\frac{17}{2}-\\frac{17 i}{4}$", + "Output Answer": [ + "$-\\frac{187}{8}+\\frac{357 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = -2-((19*i)/2)\ny = -(17/2)-((17*i)/4)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{13 e^{\\frac{11 i \\pi }{180}}}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\frac{13}{\\sqrt{3}}$\nArgument: $-\\frac{169 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((13*math.e**((11*i*math.pi)/180))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{11}{5} (12 t+41), x(t)=-\\frac{22 t}{5}-15$", + "Output Answer": [ + "$y=6 x-\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -(11/5)*(12*t+41)\nx_t = -((22*t)/5)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^5-2 x^4-\\frac{5 x^3}{3}+\\frac{13 x^2}{3}-x$ and $3 x^4-2 x^3-\\frac{5 x^2}{3}+\\frac{13 x}{3}-1$.", + "Output Answer": [ + "$3 x^4-2 x^3-\\frac{5 x^2}{3}+\\frac{13 x}{3}-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**5-2*x**4-((5*x**3)/3)+((13*x**2)/3)-x, 3*x**4-2*x**3-((5*x**2)/3)+((13*x)/3)-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 8 x-22| =8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7}{4}\\right\\},\\left\\{x\\to \\frac{15}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(8*x-22), 8), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{3} \\left(-37 x^2-34 x-45\\right)$, $q(x) = \\frac{1}{3} \\left(6 x^2+11 x-29\\right)$", + "Output Answer": [ + "$-\\frac{31 x^2}{3}-\\frac{23 x}{3}-\\frac{74}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/3)*(-37*x**2-34*x-45)\nq = (1/3)*(6*x**2+11*x-29)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2+22 x-165$", + "Output Answer": [ + "$-11 (3-x) (x+5)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2+22*x-165, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{83}{32}$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{103329}{32}$" + ], + "Output Program": [ + "a = (83/32) # initial value\nd = 9 # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (83/32) # initial value\nd = 9 # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{4898 x^2}{25}+\\frac{15318 x}{25}+\\frac{11872}{25}}{\\frac{7584 x^2}{25}+\\frac{11384 x}{25}+\\frac{896}{25}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{53}{31}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((4898*x**2)/25)+((15318*x)/25)+(11872/25))/(((7584*x**2)/25)+((11384*x)/25)+(896/25))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 x^2+8 x+1$ and $q(x) = 5 x-1$", + "Output Answer": [ + "$20 x^3+36 x^2-3 x-1$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*x**2+8*x+1\nq = 5*x-1\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-9 x^2+15 x+5$", + "Output Answer": [ + "$\\frac{45}{4}-9 \\left(x-\\frac{5}{6}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-9*x**2+15*x+5), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{31}{30}$, and $a_n=a_{n-1}+5 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$11 \\left(\\frac{31}{15}+105 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (31/30) # initial value\nd = 5*math.sqrt(2) # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (31/30) # initial value\nd = 5*math.sqrt(2) # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $2 x^2+12 x-1$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(-6-\\sqrt{38}\\right)\\lor x=\\frac{1}{2} \\left(\\sqrt{38}-6\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(2*x**2+12*x-1, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((23+18)+24)+7)+(((1+12)+3)+10)$.", + "Output Answer": [ + "$98$" + ], + "Output Program": [ + "try: \n print((((23+18)+24)+7)+(((1+12)+3)+10))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 x^2-11 x+7$", + "Output Answer": [ + "$x=-\\frac{7}{3}\\lor x=\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*x**2-11*x+7, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\sqrt{3} \\left(\\cos \\left(\\frac{53}{90}\\right)+i \\sin \\left(\\frac{53}{90}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-24 \\sqrt{3} \\left(\\cos \\left(\\frac{53}{30}\\right)+i \\sin \\left(\\frac{53}{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*math.sqrt(3)*(math.cos((53/90))+1j*math.sin((53/90))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $6 \\sqrt{5} x^2-5 \\sqrt{5} x-6 \\sqrt{5}$", + "Output Answer": [ + "$x=-\\frac{2}{3}\\lor x=\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(6*sqrt(5)*x**2-5*sqrt(5)*x-6*sqrt(5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2-\\frac{459 x}{2}-1368$", + "Output Answer": [ + "$-9 \\left(x+\\frac{19}{2}\\right) (x+16)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2-((459*x)/2)-1368, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{23}{13}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$-\\frac{483}{13}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(23/13) # initial value\nd = 0 # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(23/13) # initial value\nd = 0 # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^6+18 x^5-18 x^4-7 x^3+15 x^2-29 x+10$ and $-2 x^5+4 x^4+x^3-x^2+5 x-2$.", + "Output Answer": [ + "$2 x^5-4 x^4-x^3+x^2-5 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**6+18*x**5-18*x**4-7*x**3+15*x**2-29*x+10, -2*x**5+4*x**4+x**3-x**2+5*x-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-x^6+6 x^5+3 x^4-3 x^3-7 x^2+9 x-2$ when divided by $x^5-6 x^4+7 x^3+x^2+9 x+1$.", + "Output Answer": [ + "$-x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**6+6*x**5+3*x**4-3*x**3-7*x**2+9*x-2\nq = x**5-6*x**4+7*x**3+x**2+9*x+1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $9 x+3$ and $-3$.", + "Output Answer": [ + "$3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(9*x+3, -3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-8 x^2+9 x+10$", + "Output Answer": [ + "$\\frac{401}{32}-8 \\left(x-\\frac{9}{16}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-8*x**2+9*x+10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-7 x+12 y-17=0$, $-13 x-21 y-22=0$", + "Output Answer": [ + "$x=-\\frac{207}{101}$, $y=\\frac{67}{303}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-7*x+12*y-17, -13*x-21*y-22), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 x^2+15 x+2$ and $q(x) = 2 x^2-14$", + "Output Answer": [ + "$6 x^4+30 x^3-38 x^2-210 x-28$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*x**2+15*x+2\nq = 2*x**2-14\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-6 x-y^2+2 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x-\\frac{1}{2}\\right)^2-(y-1)^2=\\frac{7}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{6} \\left(3-7 \\sqrt{3}\\right) & 1 \\\\\n \\frac{1}{6} \\left(3+7 \\sqrt{3}\\right) & 1 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{7}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{6} \\left(3-7 \\sqrt{3}\\right)+\\frac{1}{6} \\left(3+7 \\sqrt{3}\\right)\\right),1\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{6} x+\\frac{1}{2} \\left(2-\\sqrt{6}\\right),y=\\frac{1}{2} \\left(2+\\sqrt{6}\\right)-\\sqrt{6} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-6*x-y**2+2*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2-x+2 y^2+7 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(y+\\frac{7}{4}\\right)^2-7 \\left(x+\\frac{1}{14}\\right)^2=\\frac{509}{56}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{14} & -\\frac{7}{4}-\\frac{3 \\sqrt{509}}{28} \\\\\n -\\frac{1}{14} & \\frac{3 \\sqrt{509}}{28}-\\frac{7}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{7}}$\nCenter: $\\left\\{-\\frac{1}{14},-\\frac{7}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{28} \\left(-49-\\sqrt{14}\\right)-\\sqrt{\\frac{7}{2}} x,y=\\sqrt{\\frac{7}{2}} x+\\frac{1}{28} \\left(\\sqrt{14}-49\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2-x+2*y**2+7*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{74 x^2}{5}+\\frac{66 x}{5}-\\frac{29}{5}$", + "Output Answer": [ + "$x=\\frac{1}{74} \\left(33-i \\sqrt{1057}\\right)\\lor x=\\frac{1}{74} \\left(33+i \\sqrt{1057}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((74*x**2)/5)+((66*x)/5)-(29/5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2-3 x-7 y^2+y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x-\\frac{1}{6}\\right)^2-7 \\left(y-\\frac{1}{14}\\right)^2=\\frac{129}{14}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{42} \\left(7-4 \\sqrt{258}\\right) & \\frac{1}{14} \\\\\n \\frac{1}{42} \\left(7+4 \\sqrt{258}\\right) & \\frac{1}{14} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{4}{\\sqrt{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{42} \\left(7-4 \\sqrt{258}\\right)+\\frac{1}{42} \\left(7+4 \\sqrt{258}\\right)\\right),\\frac{1}{14}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3 x}{\\sqrt{7}}+\\frac{1}{14} \\left(1-\\sqrt{7}\\right),y=\\frac{1}{14} \\left(1+\\sqrt{7}\\right)-\\frac{3 x}{\\sqrt{7}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2-3*x-7*y**2+y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{4 x}{\\sqrt{3}}+\\frac{29 y}{\\sqrt{3}}+10 \\sqrt{3} z-8 \\sqrt{3}=0$, $\\frac{19 x}{\\sqrt{3}}+\\frac{10 y}{\\sqrt{3}}+14 \\sqrt{3} z-\\frac{26}{\\sqrt{3}}=0$, $-\\frac{7 x}{\\sqrt{3}}+\\frac{38 y}{\\sqrt{3}}-\\frac{32 z}{\\sqrt{3}}-\\frac{19}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{12613}{12601}$, $y=\\frac{8653}{12601}$, $z=\\frac{69}{25202}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((4*x)/(sqrt(3)))+((29*y)/(sqrt(3)))+10*sqrt(3)*z-8*sqrt(3), ((19*x)/(sqrt(3)))+((10*y)/(sqrt(3)))+14*sqrt(3)*z-(26/(sqrt(3))), -((7*x)/(sqrt(3)))+((38*y)/(sqrt(3)))-((32*z)/(sqrt(3)))-(19/(sqrt(3))))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $5 x^2+10 \\sqrt{2} x-1430$", + "Output Answer": [ + "$-5 \\left(-x-13 \\sqrt{2}\\right) \\left(x-11 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(5*x**2+10*sqrt(2)*x-1430, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -(3 x+1)^3, q(x) = 9 (3 x+1)^2$", + "Output Answer": [ + "$-27 x^3+54 x^2+45 x+8$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(3*x+1)**3\nq = 9*(3*x+1)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $3 x^2-75 x+462$", + "Output Answer": [ + "$3 (11-x) (14-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(3*x**2-75*x+462, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-2 x-2 y^2+3 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-2 x-2 y^2+3 y=4$\nVertex: $\\left\\{-\\frac{23}{16},\\frac{3}{4}\\right\\}$\nDirectrix: $x=-\\frac{19}{16}$\nFocal Parameter: $\\frac{1}{2}$\nFocus: $\\left\\{-\\frac{27}{16},\\frac{3}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x-2*y**2+3*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9 x-5}+\\sqrt{14 x-11}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{25} \\left(751-8 \\sqrt{8209}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9*x-5)+sqrt(14*x-11), 8), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-i \\sqrt{3}$ and $y=(-2-5 i) \\sqrt{3}$", + "Output Answer": [ + "$(-2-6 i) \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -i*math.sqrt(3)\ny = (-2-5*i)*math.sqrt(3)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{49 x}{2}+4 y-21=0$, $-\\frac{69 x}{4}+20 y+\\frac{29}{4}=0$", + "Output Answer": [ + "$x=-\\frac{449}{421}$, $y=-\\frac{4319}{3368}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((49*x)/2)+4*y-21, -((69*x)/4)+20*y+(29/4)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\left(\\cos \\left(\\frac{37}{90}\\right)+i \\sin \\left(\\frac{37}{90}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$36 \\left(\\cos \\left(\\frac{37}{45}\\right)+i \\sin \\left(\\frac{37}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*(math.cos((37/90))+1j*math.sin((37/90))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$19 x+6 y+5=0$, $-11 x+y-8=0$", + "Output Answer": [ + "$x=-\\frac{53}{85}$, $y=\\frac{97}{85}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((19*x+6*y+5, -11*x+y-8), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sin ^{-1}(1-5 x)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{5} (1-\\sin (y))\\text{ if }-\\frac{\\pi }{2}\\leq y\\leq \\frac{\\pi }{2}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, asin(1-5*x))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((17+10)-12)+13)+((25+18)+2)$.", + "Output Answer": [ + "$73$" + ], + "Output Program": [ + "try: \n print((((17+10)-12)+13)+((25+18)+2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 \\sqrt{3} x^2+\\frac{14 x}{\\sqrt{3}}+8 \\sqrt{3}$", + "Output Answer": [ + "$-3 \\sqrt{3} \\left(x-\\frac{7}{9}\\right)^2+8 \\sqrt{3}+\\frac{49}{9 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*math.sqrt(3)*x**2+((14*x)/(math.sqrt(3)))+8*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $4 x^2-2 x+5$", + "Output Answer": [ + "$4 \\left(x-\\frac{1}{4}\\right)^2+\\frac{19}{4}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (4*x**2-2*x+5), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^2+4 x+\\frac{13}{3}$ when divided by $-\\frac{13}{3}$.", + "Output Answer": [ + "$-\\frac{18 x^2}{13}-\\frac{12 x}{13}-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**2+4*x+(13/3)\nq = -(13/3)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-9 x^2-8 x+14$", + "Output Answer": [ + "$x=\\frac{1}{9} \\left(-4-\\sqrt{142}\\right)\\lor x=\\frac{1}{9} \\left(\\sqrt{142}-4\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-9*x**2-8*x+14, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{42}{5}-\\frac{21 i}{5}$.", + "Output Answer": [ + "Norm: $\\frac{21}{\\sqrt{5}}$\nArgument: $-\\tan ^{-1}\\left(\\frac{1}{2}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (42/5)-((21*i)/5)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{14 x^2}{3}-8 x-2$", + "Output Answer": [ + "$x=\\frac{1}{7} \\left(6-\\sqrt{57}\\right)\\lor x=\\frac{1}{7} \\left(6+\\sqrt{57}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((14*x**2)/3)-8*x-2, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-7 x+4 y^2-5 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $6 \\left(x-\\frac{7}{12}\\right)^2+4 \\left(y-\\frac{5}{8}\\right)^2=\\frac{365}{48}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{7}{12} & \\frac{5}{8}-\\frac{\\sqrt{365}}{24} \\\\\n \\frac{7}{12} & \\frac{1}{24} \\left(15+\\sqrt{365}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{3}}$\nCenter: $\\left\\{\\frac{7}{12},\\frac{1}{2} \\left(\\frac{5}{8}-\\frac{\\sqrt{365}}{24}+\\frac{1}{24} \\left(15+\\sqrt{365}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{365 \\pi }{96 \\sqrt{6}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-7*x+4*y**2-5*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2-\\frac{486 x}{7}+\\frac{1440}{7}$", + "Output Answer": [ + "$-9 (-x-10) \\left(\\frac{16}{7}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2-((486*x)/7)+(1440/7), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+6 x+4 y^2+2 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $3 (x+1)^2+4 \\left(y+\\frac{1}{4}\\right)^2=\\frac{41}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n -1-\\frac{\\sqrt{\\frac{41}{3}}}{4} & -\\frac{1}{4} \\\\\n \\frac{\\sqrt{\\frac{41}{3}}}{4}-1 & -\\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{2}$\nCenter: $\\left\\{-1,-\\frac{1}{4}\\right\\}$\nArea Enclosed: $\\frac{41 \\pi }{8 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+6*x+4*y**2+2*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\cosh ^{-1}(6-9 x)$", + "Output Answer": [ + "$y\\geq 0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(acosh(6-9*x), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $4 x^2-x+8$", + "Output Answer": [ + "$4 \\left(x-\\frac{1}{8}\\right)^2+\\frac{127}{16}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (4*x**2-x+8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(8 \\left(\\cos \\left(\\frac{5}{3}\\right)+i \\sin \\left(\\frac{5}{3}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$134217728 (\\cos (15)+i \\sin (15))$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((8*(math.cos((5/3))+1j*math.sin((5/3))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{13}{19}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$\\frac{195}{19}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (13/19) # initial value\nd = 0 # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (13/19) # initial value\nd = 0 # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -7 x^2-8 x-2$ and $q(x) = -10 x^2+11 x+6$", + "Output Answer": [ + "$70 x^4+3 x^3-110 x^2-70 x-12$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -7*x**2-8*x-2\nq = -10*x**2+11*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-2 x-3 y^2+5 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(x-\\frac{1}{4}\\right)^2-3 \\left(y-\\frac{5}{6}\\right)^2=\\frac{1}{6}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{12} \\left(3-\\sqrt{14}\\right) & \\frac{5}{6} \\\\\n \\frac{1}{12} \\left(3+\\sqrt{14}\\right) & \\frac{5}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{12} \\left(3-\\sqrt{14}\\right)+\\frac{1}{12} \\left(3+\\sqrt{14}\\right)\\right),\\frac{5}{6}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2 x}{\\sqrt{3}}+\\frac{1}{6} \\left(5-\\sqrt{3}\\right),y=\\frac{1}{6} \\left(5+\\sqrt{3}\\right)-\\frac{2 x}{\\sqrt{3}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-2*x-3*y**2+5*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^6-9 x^5+2 x^4+5 x^3-4 x^2+2 x+7$ when divided by $6 x^4+10 x^3+6 x^2+3 x+9$.", + "Output Answer": [ + "$-\\frac{5 x^2}{6}-\\frac{x}{9}+\\frac{73}{54}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**6-9*x**5+2*x**4+5*x**3-4*x**2+2*x+7\nq = 6*x**4+10*x**3+6*x**2+3*x+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\log \\left(e^{x+\\frac{17}{2}}\\right)-1$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to y-\\frac{15}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, log(math.e**(x+(17/2)))-1)\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$19 x+y+21=0$, $-14 x-22 y-4=0$", + "Output Answer": [ + "$x=-\\frac{229}{202}$, $y=\\frac{109}{202}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((19*x+y+21, -14*x-22*y-4), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $5 x^2+\\frac{40 x}{3}-\\frac{2}{3}$", + "Output Answer": [ + "$5 \\left(x+\\frac{4}{3}\\right)^2-\\frac{86}{9}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (5*x**2+((40*x)/3)-(2/3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{238 x^3+138 x^2-384 x-216}{70 x^2+132 x+54}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{17} \\left(6-4 \\sqrt{15}\\right)\\right\\},\\left\\{x\\to \\frac{1}{17} \\left(6+4 \\sqrt{15}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((238*x**3+138*x**2-384*x-216)/(70*x**2+132*x+54)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{13+6 i}{\\sqrt{\\pi }}$ and $y=\\frac{10+3 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{3+3 i}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((13+6*i)/(math.sqrt(math.pi)))\ny = ((10+3*i)/(math.sqrt(math.pi)))\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{9+i}{\\sqrt{3}}$ and $y=\\frac{2-5 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{13}{29}-\\frac{47 i}{29}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((9+i)/(math.sqrt(3)))\ny = ((2-5*i)/(math.sqrt(3)))\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2+\\frac{100 x}{3}-\\frac{2200}{3}$", + "Output Answer": [ + "$-4 (10-x) \\left(x+\\frac{55}{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2+((100*x)/3)-(2200/3), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\pi, 10, \\sqrt{2})$", + "Output Answer": [ + "$\\left\\{\\sqrt{102+\\pi ^2},\\tan ^{-1}\\left(\\sqrt{\\frac{1}{2} \\left(100+\\pi ^2\\right)}\\right),\\tan ^{-1}\\left(\\frac{10}{\\pi }\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.pi\ny = 10\nz = math.sqrt(2)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $5 \\sqrt{2} x-\\frac{17 x^2}{\\sqrt{2}}$", + "Output Answer": [ + "$\\frac{25}{17 \\sqrt{2}}-\\frac{17 \\left(x-\\frac{5}{17}\\right)^2}{\\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (5*math.sqrt(2)*x-((17*x**2)/(math.sqrt(2)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-12 x^2-\\frac{18 x}{5}+\\frac{71}{5}$", + "Output Answer": [ + "$x=\\frac{1}{60} \\left(-9-\\sqrt{4341}\\right)\\lor x=\\frac{1}{60} \\left(\\sqrt{4341}-9\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-12*x**2-((18*x)/5)+(71/5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(8 \\left(\\cos \\left(\\frac{8}{15}\\right)+i \\sin \\left(\\frac{8}{15}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$262144 \\left(\\cos \\left(\\frac{16}{5}\\right)+i \\sin \\left(\\frac{16}{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((8*(math.cos((8/15))+1j*math.sin((8/15))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{59 x}{4}-\\frac{41}{4}\\right| =\\frac{91}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{132}{59}\\right\\},\\left\\{x\\to \\frac{50}{59}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((59*x)/4)-(41/4)), (91/4)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{34 x^2}{7}+3 x-8}{-\\frac{57 x^2}{7}-\\frac{106 x}{7}+18}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{68} \\left(-21-\\sqrt{8057}\\right)\\right\\},\\left\\{x\\to \\frac{1}{68} \\left(-21+\\sqrt{8057}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((34*x**2)/7)+3*x-8)/(-((57*x**2)/7)-((106*x)/7)+18)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $8 x^4+16 x^3+16 x^2-4 x+12$ and $2 x^4+4 x^3+4 x^2-x+3$.", + "Output Answer": [ + "$2 x^4+4 x^3+4 x^2-x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(8*x**4+16*x**3+16*x**2-4*x+12, 2*x**4+4*x**3+4*x**2-x+3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2-7 x-9 y^2-2 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $\\left(x-\\frac{7}{2}\\right)^2-9 \\left(y+\\frac{1}{9}\\right)^2=\\frac{545}{36}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{18} \\left(63-5 \\sqrt{218}\\right) & -\\frac{1}{9} \\\\\n \\frac{1}{18} \\left(63+5 \\sqrt{218}\\right) & -\\frac{1}{9} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{10}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{18} \\left(63-5 \\sqrt{218}\\right)+\\frac{1}{18} \\left(63+5 \\sqrt{218}\\right)\\right),-\\frac{1}{9}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{3}-\\frac{23}{18},y=\\frac{19}{18}-\\frac{x}{3}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-7*x-9*y**2-2*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (10, 4, 5)$", + "Output Answer": [ + "$\\left\\{\\sqrt{141},\\tan ^{-1}\\left(\\frac{2 \\sqrt{29}}{5}\\right),\\tan ^{-1}\\left(\\frac{2}{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 10\ny = 4\nz = 5\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$2 \\sqrt{2} x-7 \\sqrt{2} y-9 \\sqrt{2} z-9 \\sqrt{2}=0$, $-11 \\sqrt{2} x-10 \\sqrt{2} y-13 \\sqrt{2} z+14 \\sqrt{2}=0$, $\\sqrt{2} x-\\sqrt{2} y-2 \\sqrt{2} z-2 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{27}{14}$, $y=-\\frac{27}{14}$, $z=\\frac{13}{14}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((2*sqrt(2)*x-7*sqrt(2)*y-9*sqrt(2)*z-9*sqrt(2), -11*sqrt(2)*x-10*sqrt(2)*y-13*sqrt(2)*z+14*sqrt(2), sqrt(2)*x-sqrt(2)*y-2*sqrt(2)*z-2*sqrt(2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 22-7 x| =18$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{4}{7}\\right\\},\\left\\{x\\to \\frac{40}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(22-7*x), 18), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{73 x}{7}+\\frac{172 y}{7}-20=0$, $\\frac{129 x}{7}-\\frac{123 y}{7}-\\frac{104}{7}=0$", + "Output Answer": [ + "$x=\\frac{35108}{13209}$, $y=\\frac{25652}{13209}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((73*x)/7)+((172*y)/7)-20, ((129*x)/7)-((123*y)/7)-(104/7)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-6 x^3-19 x^2-2 x+20$ and $-3 x^2-2 x+4$.", + "Output Answer": [ + "$3 x^2+2 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-6*x**3-19*x**2-2*x+20, -3*x**2-2*x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{192 x^2}{25}+\\frac{336 x}{25}+\\frac{24}{5}$ and $\\frac{16 x}{5}+\\frac{8}{5}$.", + "Output Answer": [ + "$\\frac{16 x}{25}+\\frac{8}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((192*x**2)/25)+((336*x)/25)+(24/5), ((16*x)/5)+(8/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{1}{e^{9/2}}$ at the point $x=6$", + "Output Answer": [ + "$\\frac{1}{e^{9/2}} = 0.011$" + ], + "Output Program": [ + "import math\n\nx = 6\ntry: \n f = (1/(math.e**(9/2)))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-12 \\log (2) \\left(-\\sin \\left(\\frac{\\pi }{9}\\right)-i \\cos \\left(\\frac{\\pi }{9}\\right)\\right)$.", + "Output Answer": [ + "Norm: $12 \\log (2) \\sqrt{\\sin ^2\\left(\\frac{\\pi }{9}\\right)+\\cos ^2\\left(\\frac{\\pi }{9}\\right)}$\nArgument: $\\frac{7 \\pi }{18}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -12*math.log(2)*(-math.sin((math.pi/9))-i*math.cos((math.pi/9)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x+4 y^2-10 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $6 x+4 y^2-10 y=2$\nVertex: $\\left\\{\\frac{11}{8},\\frac{5}{4}\\right\\}$\nDirectrix: $x=\\frac{7}{4}$\nFocal Parameter: $\\frac{3}{4}$\nFocus: $\\left\\{1,\\frac{5}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x+4*y**2-10*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-14 x+24 y-20 z+13=0$, $5 x+22 y-12 z+2=0$, $-18 x+21 y-14 z+7=0$", + "Output Answer": [ + "$x=\\frac{42}{593}$, $y=\\frac{757}{1186}$, $z=\\frac{3241}{2372}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-14*x+24*y-20*z+13, 5*x+22*y-12*z+2, -18*x+21*y-14*z+7)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -9 x^2+x-15\\right| =-7$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-9*x**2+x-15), -7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{20 x^2}{\\sqrt{3}}+\\frac{23 x}{\\sqrt{3}}-\\frac{2}{\\sqrt{3}}$ and $q(x) = -\\frac{13 x^2}{\\sqrt{3}}+2 \\sqrt{3} x-\\frac{8}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{260 x^4}{3}-\\frac{179 x^3}{3}+\\frac{4 x^2}{3}-\\frac{196 x}{3}+\\frac{16}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((20*x**2)/(sqrt(3)))+((23*x)/(sqrt(3)))-(2/(sqrt(3)))\nq = -((13*x**2)/(sqrt(3)))+2*sqrt(3)*x-(8/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 \\sqrt{3} x^2-8 \\sqrt{3} x-\\sqrt{3}$ and $q(x) = 2 \\sqrt{3} x^2+4 \\sqrt{3} x-5 \\sqrt{3}$", + "Output Answer": [ + "$-24 x^4-96 x^3-42 x^2+108 x+15$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*sqrt(3)*x**2-8*sqrt(3)*x-sqrt(3)\nq = 2*sqrt(3)*x**2+4*sqrt(3)*x-5*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 9 \\sqrt{3} x^2-\\sqrt{3} x+5 \\sqrt{3}\\right| =6 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(1-\\sqrt{37}\\right)\\right\\},\\left\\{x\\to \\frac{1}{18} \\left(1+\\sqrt{37}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(9*sqrt(3)*x**2-sqrt(3)*x+5*sqrt(3)), 6*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (6 x+7)^4, q(x) = 0$", + "Output Answer": [ + "$1296 x^4+6048 x^3+10584 x^2+8232 x+2401$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (6*x+7)**4\nq = 0\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$6 x-\\frac{50 y}{7}-\\frac{16}{7}=0$, $\\frac{22 x}{7}+10 y+\\frac{78}{7}=0$", + "Output Answer": [ + "$x=-\\frac{139}{202}$, $y=-\\frac{907}{1010}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((6*x-((50*y)/7)-(16/7), ((22*x)/7)+10*y+(78/7)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $12 x^2-7 x+1$", + "Output Answer": [ + "$x=\\frac{1}{4}\\lor x=\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(12*x**2-7*x+1, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 x^2+4 x-3$", + "Output Answer": [ + "$-3 \\left(x-\\frac{2}{3}\\right)^2-\\frac{5}{3}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*x**2+4*x-3), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^4+6 x^3+6 x^2-x-3$ when divided by $-5 x^3+2 x^2-3 x+1$.", + "Output Answer": [ + "$x-\\frac{4}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**4+6*x**3+6*x**2-x-3\nq = -5*x**3+2*x**2-3*x+1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{14-25}{((((19+1)-21)-15)-15)^2}$.", + "Output Answer": [ + "$-\\frac{11}{961}$" + ], + "Output Program": [ + "try: \n print(((14-25)/(((((19+1)-21)-15)-15)**2)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$4 x-\\frac{97 y}{5}-\\frac{14 z}{5}+\\frac{1}{5}=0$, $-\\frac{67 x}{5}+\\frac{23 y}{5}-\\frac{72 z}{5}-\\frac{7}{5}=0$, $11 x-\\frac{36 y}{5}+\\frac{63 z}{5}+1=0$", + "Output Answer": [ + "$x=-\\frac{10918}{64235}$, $y=-\\frac{71}{2215}$, $z=\\frac{3257}{64235}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((4*x-((97*y)/5)-((14*z)/5)+(1/5), -((67*x)/5)+((23*y)/5)-((72*z)/5)-(7/5), 11*x-((36*y)/5)+((63*z)/5)+1)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-6 x^2+72 x+168$", + "Output Answer": [ + "$6 (-x-2) (x-14)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-6*x**2+72*x+168, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x-5}+\\sqrt{14 x+14}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(89-3 \\sqrt{273}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x-5)+sqrt(14*x+14), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3$ and $-4 x^5+x^4+x^3+x^2-x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3, -4*x**5+x**4+x**3+x**2-x-3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{8 \\sqrt{3} x^2-\\frac{31 x}{\\sqrt{3}}+\\frac{8}{\\sqrt{3}}}{-\\frac{28 x^2}{\\sqrt{3}}+\\frac{31 x}{\\sqrt{3}}-\\frac{41}{\\sqrt{3}}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{48} \\left(31-\\sqrt{193}\\right)\\right\\},\\left\\{x\\to \\frac{1}{48} \\left(31+\\sqrt{193}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((8*sqrt(3)*x**2-((31*x)/(sqrt(3)))+(8/(sqrt(3))))/(-((28*x**2)/(sqrt(3)))+((31*x)/(sqrt(3)))-(41/(sqrt(3))))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{56}{67}$, and $a_n=a_{n-1}+1$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=12$.", + "Output Answer": [ + "$\\frac{5094}{67}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (56/67) # initial value\nd = 1 # second term\nn = 12 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (56/67) # initial value\nd = 1 # second term\nn = 12 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-4 x^2+3 x+7$", + "Output Answer": [ + "$x=\\frac{7}{4}\\lor x=-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-4*x**2+3*x+7, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\sqrt{2} e^{-\\frac{i \\pi }{60}}$.", + "Output Answer": [ + "Norm: $\\sqrt{2}$\nArgument: $\\frac{59 \\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.sqrt(2)*math.e**(-((i*math.pi)/60))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\left(-\\sin \\left(\\frac{4 \\pi }{45}\\right)+i \\cos \\left(\\frac{4 \\pi }{45}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-2187 \\left(\\cos \\left(\\frac{11 \\pi }{90}\\right)+i \\sin \\left(\\frac{11 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*(-math.sin(((4*math.pi)/45))+1j*math.cos(((4*math.pi)/45))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$e^{4 x+8} \\sinh ^{-1}\\left(7 x^3+2\\right)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = math.e**(4*x+8)*asinh(7*x**3+2)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{11}{93}$, and $a_n=a_{n-1}+\\frac{8}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$11 \\left(\\frac{168}{\\sqrt{5}}-\\frac{22}{93}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(11/93) # initial value\nd = (8/(math.sqrt(5))) # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(11/93) # initial value\nd = (8/(math.sqrt(5))) # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^6+\\frac{3 x^5}{2}+\\frac{5 x^4}{2}-\\frac{17 x^3}{2}+\\frac{9 x^2}{2}-9 x-\\frac{9}{2}$ when divided by $-6 x^5+7 x^4-3 x^3+x^2+4 x+4$.", + "Output Answer": [ + "$-\\frac{5 x}{6}-\\frac{11}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**6+((3*x**5)/2)+((5*x**4)/2)-((17*x**3)/2)+((9*x**2)/2)-9*x-(9/2)\nq = -6*x**5+7*x**4-3*x**3+x**2+4*x+4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{6 \\sqrt{3} x^2-8 \\sqrt{3} x-2 \\sqrt{3}}{12 \\sqrt{3} x+4 \\sqrt{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(2-\\sqrt{7}\\right)\\right\\},\\left\\{x\\to \\frac{1}{3} \\left(2+\\sqrt{7}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((6*sqrt(3)*x**2-8*sqrt(3)*x-2*sqrt(3))/(12*sqrt(3)*x+4*sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -3 x-5, q(x) = 512 (x-1)^3$", + "Output Answer": [ + "$512 x^3-1536 x^2+1533 x-517$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x-5\nq = 512*(x-1)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 10 x+23| =-25$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(10*x+23), -25), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((17-7)+1)-\\left(\\frac{5+18}{24}-15\\right)$.", + "Output Answer": [ + "$\\frac{601}{24}$" + ], + "Output Program": [ + "try: \n print(((17-7)+1)-(((5+18)/24)-15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{26 x}{5}-1}+\\sqrt{\\frac{x}{5}+\\frac{34}{5}}=\\frac{28}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-24865+56 \\sqrt{98281}}{3645}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((26*x)/5)-1)+sqrt((x/5)+(34/5)), (28/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{17}{3}-\\frac{14 i}{3}$ and $y=\\frac{22}{3}+2 i$", + "Output Answer": [ + "$\\frac{29}{52}-\\frac{41 i}{52}$" + ], + "Output Program": [ + "i = 1j\nx = (17/3)-((14*i)/3)\ny = (22/3)+2*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-3-\\frac{66 i}{7}$.", + "Output Answer": [ + "Norm: $\\frac{3 \\sqrt{533}}{7}$\nArgument: $\\tan ^{-1}\\left(\\frac{22}{7}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -3-((66*i)/7)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2-24 x-\\frac{25}{2}$", + "Output Answer": [ + "$-2 \\left(-x-\\frac{1}{2}\\right) \\left(x-\\frac{25}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2-24*x-(25/2), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x+9}+\\sqrt{7 x+1}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 1308-60 \\sqrt{473}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x+9)+sqrt(7*x+1), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{16 x}{3}+\\frac{4}{3}}+\\sqrt{13 x-\\frac{11}{3}}=\\frac{23}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{69} \\left(1310-4 \\sqrt{88251}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((16*x)/3)+(4/3))+sqrt(13*x-(11/3)), (23/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{82 x^2}{7}-\\frac{103 x}{7}+2$", + "Output Answer": [ + "$x=\\frac{1}{164} \\left(-103-3 \\sqrt{1689}\\right)\\lor x=\\frac{1}{164} \\left(3 \\sqrt{1689}-103\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((82*x**2)/7)-((103*x)/7)+2, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{19}{4}+\\frac{39 i}{4}$ and $y=\\frac{15}{4}+9 i$", + "Output Answer": [ + "$\\frac{373}{507}+\\frac{141 i}{169}$" + ], + "Output Program": [ + "i = 1j\nx = -(19/4)+((39*i)/4)\ny = (15/4)+9*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 81, q(x) = (8-9 x)^2$", + "Output Answer": [ + "$81 x^2-144 x+145$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 81\nq = (8-9*x)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -3 e x^2+4 e x+4 e$ and $q(x) = 5 e x^2-5 e x+4 e$", + "Output Answer": [ + "$-15 e^2 x^4+35 e^2 x^3-12 e^2 x^2-4 e^2 x+16 e^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -3*math.e*x**2+4*math.e*x+4*math.e\nq = 5*math.e*x**2-5*math.e*x+4*math.e\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{2-16 i}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $2 \\sqrt{\\frac{65}{\\pi }}$\nArgument: $\\pi -\\tan ^{-1}(8)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((2-16*i)/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 x^2+5$ and $q(x) = 2 x^2+6 x+11$", + "Output Answer": [ + "$6 x^4+18 x^3+43 x^2+30 x+55$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*x**2+5\nq = 2*x**2+6*x+11\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((18+3)-19)-((19-15)+4)$.", + "Output Answer": [ + "$-6$" + ], + "Output Program": [ + "try: \n print(((18+3)-19)-((19-15)+4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 4 x+10| =5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{15}{4}\\right\\},\\left\\{x\\to -\\frac{5}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(4*x+10), 5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9-\\frac{75 x}{7}}+\\sqrt{\\frac{37}{7}-\\frac{46 x}{7}}=2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{841} \\left(-2634+12 \\sqrt{72359}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9-((75*x)/7))+sqrt((37/7)-((46*x)/7)), 2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-6 x^2-\\frac{12 x}{5}+\\frac{5226}{5}$", + "Output Answer": [ + "$-6 \\left(-x-\\frac{67}{5}\\right) (13-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-6*x**2-((12*x)/5)+(5226/5), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^5+\\frac{9 x^4}{2}+3 x^3-\\frac{17 x^2}{2}+x+4$ when divided by $-\\frac{3}{2}$.", + "Output Answer": [ + "$\\frac{16 x^5}{3}-3 x^4-2 x^3+\\frac{17 x^2}{3}-\\frac{2 x}{3}-\\frac{8}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**5+((9*x**4)/2)+3*x**3-((17*x**2)/2)+x+4\nq = -(3/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-21 x+16 y+24 z+20=0$, $-14 x+22 y-14 z-17=0$, $8 x-25 y+3 z+1=0$", + "Output Answer": [ + "$x=-\\frac{1146}{2255}$, $y=-\\frac{461}{1804}$, $z=-\\frac{9991}{9020}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-21*x+16*y+24*z+20, -14*x+22*y-14*z-17, 8*x-25*y+3*z+1)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10 x-6}+\\sqrt{15 x-14}=3$", + "Output Answer": [ + "$\\{\\{x\\to 1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10*x-6)+sqrt(15*x-14), 3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\frac{1}{4} \\left(1+\\sqrt{5}\\right)+i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)\\right)^9$", + "Output Answer": [ + "$40353607 \\left(\\frac{1}{4} \\left(1+\\sqrt{5}\\right)-i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*((1/4)*(1+math.sqrt(5))+1j*math.sqrt((5/8)-((math.sqrt(5))/8))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\sqrt{5} e^{-\\frac{14 i \\pi }{45}}$.", + "Output Answer": [ + "Norm: $\\sqrt{5}$\nArgument: $-\\frac{14 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = math.sqrt(5)*math.e**(-((14*i*math.pi)/45))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\sqrt{2} \\left(\\cos \\left(\\frac{17 \\pi }{90}\\right)-i \\sin \\left(\\frac{17 \\pi }{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$1562500000 \\sqrt{2} \\left(\\cos \\left(\\frac{7 \\pi }{90}\\right)-i \\sin \\left(\\frac{7 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*math.sqrt(2)*(math.cos(((17*math.pi)/90))-1j*math.sin(((17*math.pi)/90))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{6 x+3}+e^{-8 x-3}$ at the point $x=0$", + "Output Answer": [ + "$\\sqrt[3]{3}+\\frac{1}{e^3} = 1.492$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 0\ntry: \n f = np.cbrt(6*x+3)+math.e**(-8*x-3)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $6 \\log (2) \\left(-\\cos \\left(\\frac{7 \\pi }{36}\\right)-i \\sin \\left(\\frac{7 \\pi }{36}\\right)\\right)$.", + "Output Answer": [ + "Norm: $6 \\log (2) \\sqrt{\\sin ^2\\left(\\frac{7 \\pi }{36}\\right)+\\cos ^2\\left(\\frac{7 \\pi }{36}\\right)}$\nArgument: $-\\frac{29 \\pi }{36}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 6*math.log(2)*(-math.cos(((7*math.pi)/36))-i*math.sin(((7*math.pi)/36)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2-x+3 y^2+4 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(y+\\frac{2}{3}\\right)^2-9 \\left(x+\\frac{1}{18}\\right)^2=-\\frac{169}{36}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{2} & -\\frac{2}{3} \\\\\n \\frac{25}{18} & -\\frac{2}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2$\nCenter: $\\left\\{-\\frac{1}{18},-\\frac{2}{3}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{3} x+\\frac{1}{18} \\left(\\sqrt{3}-12\\right),y=\\frac{1}{18} \\left(-12-\\sqrt{3}\\right)-\\sqrt{3} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2-x+3*y**2+4*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\sqrt{2} \\left(\\cos \\left(\\frac{47}{90}\\right)+i \\sin \\left(\\frac{47}{90}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$324 \\left(\\cos \\left(\\frac{94}{45}\\right)+i \\sin \\left(\\frac{94}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*math.sqrt(2)*(math.cos((47/90))+1j*math.sin((47/90))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{79}{69}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{711}{23}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (79/69) # initial value\nd = 0 # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (79/69) # initial value\nd = 0 # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=108 \\left(40 t^2-180 t+203\\right)^2, x(t)=48 t^2-216 t+243$", + "Output Answer": [ + "$y=75 x^2+90 x+27$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 108*(40*t**2-180*t+203)**2\nx_t = 48*t**2-216*t+243\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((((5-18)-18)-18)+11)-(15+21)$.", + "Output Answer": [ + "$-74$" + ], + "Output Program": [ + "try: \n print(((((5-18)-18)-18)+11)-(15+21))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\log (5 x-9)$", + "Output Answer": [ + "$y\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(log(5*x-9), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{53}{19}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$\\frac{1392}{19}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(53/19) # initial value\nd = 6 # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(53/19) # initial value\nd = 6 # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(17-8)^2}{\\left(((9+8)-10)^2+13\\right)+2}$.", + "Output Answer": [ + "$\\frac{81}{64}$" + ], + "Output Program": [ + "try: \n print((((17-8)**2)/((((9+8)-10)**2+13)+2)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{25}{3} \\left(-\\cos \\left(\\frac{2 \\pi }{45}\\right)+i \\sin \\left(\\frac{2 \\pi }{45}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$\\frac{244140625}{729} \\left(\\sin \\left(\\frac{7 \\pi }{30}\\right)-i \\cos \\left(\\frac{7 \\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((25/3)*(-math.cos(((2*math.pi)/45))+1j*math.sin(((2*math.pi)/45))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-5 x-2 y+1=0$, $15 x-22 y+1=0$", + "Output Answer": [ + "$x=\\frac{1}{7}$, $y=\\frac{1}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-5*x-2*y+1, 15*x-22*y+1), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{29 x^2}{5}+\\frac{69 x}{5}+7$", + "Output Answer": [ + "$x=\\frac{1}{58} \\left(69-\\sqrt{8821}\\right)\\lor x=\\frac{1}{58} \\left(69+\\sqrt{8821}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((29*x**2)/5)+((69*x)/5)+7, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{13 e^{-\\frac{47 i \\pi }{180}}}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{13}{\\pi }$\nArgument: $\\frac{133 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((13*math.e**(-((47*i*math.pi)/180)))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -343 x^3, q(x) = -(5 x-7)^3$", + "Output Answer": [ + "$-468 x^3+525 x^2-735 x+343$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -343*x**3\nq = -(5*x-7)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-3-6 i$ and $y=\\frac{13}{2}+\\frac{13 i}{4}$", + "Output Answer": [ + "$\\frac{7}{2}-\\frac{11 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = -3-6*i\ny = (13/2)+((13*i)/4)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-e^{1+\\frac{43 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $e$\nArgument: $-\\frac{137 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.e**(1+((43*i*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$19 x+6 y+6 z+16=0$, $25 x-13 y-22 z+5=0$, $4 x-6 y+15 z+25=0$", + "Output Answer": [ + "$x=-\\frac{2404}{3193}$, $y=\\frac{2699}{3193}$, $z=-\\frac{3601}{3193}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((19*x+6*y+6*z+16, 25*x-13*y-22*z+5, 4*x-6*y+15*z+25)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^5-4 x^4+8 x^3+4 x^2+5 x$ when divided by $-8 x^3-2 x^2-6 x+8$.", + "Output Answer": [ + "$x^2+\\frac{x}{4}-\\frac{29}{16}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**5-4*x**4+8*x**3+4*x**2+5*x\nq = -8*x**3-2*x**2-6*x+8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{45 x^5}{4}+\\frac{79 x^4}{4}+\\frac{81 x^3}{4}+\\frac{33 x^2}{4}+\\frac{3 x}{2}-1$ and $-\\frac{9 x^3}{2}-\\frac{5 x^2}{2}-\\frac{3 x}{2}+\\frac{1}{2}$.", + "Output Answer": [ + "$\\frac{9 x^3}{4}+\\frac{5 x^2}{4}+\\frac{3 x}{4}-\\frac{1}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((45*x**5)/4)+((79*x**4)/4)+((81*x**3)/4)+((33*x**2)/4)+((3*x)/2)-1, -((9*x**3)/2)-((5*x**2)/2)-((3*x)/2)+(1/2)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $6 x^2-\\frac{342 x}{7}-\\frac{56940}{49}$", + "Output Answer": [ + "$-6 \\left(\\frac{130}{7}-x\\right) \\left(x+\\frac{73}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(6*x**2-((342*x)/7)-(56940/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{5-4 i}{\\sqrt{2}}$.", + "Output Answer": [ + "Norm: $\\sqrt{\\frac{41}{2}}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{4}{5}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((5-4*i)/(math.sqrt(2)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $14 x^2-x+14$", + "Output Answer": [ + "$14 \\left(x-\\frac{1}{28}\\right)^2+\\frac{783}{56}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (14*x**2-x+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^6+x^5+2 x^4-3 x^3-7 x^2+9 x+7$ when divided by $x-8$.", + "Output Answer": [ + "$4 x^5+33 x^4+266 x^3+2125 x^2+16993 x+135953$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**6+x**5+2*x**4-3*x**3-7*x**2+9*x+7\nq = x-8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2-\\frac{176 x}{7}-\\frac{1200}{49}$", + "Output Answer": [ + "$-4 \\left(\\frac{50}{7}-x\\right) \\left(x+\\frac{6}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2-((176*x)/7)-(1200/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{21 x^2}{4}-\\frac{9 x}{4}-\\frac{11}{4}$", + "Output Answer": [ + "$x=\\frac{1}{42} \\left(9-\\sqrt{1005}\\right)\\lor x=\\frac{1}{42} \\left(9+\\sqrt{1005}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((21*x**2)/4)-((9*x)/4)-(11/4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{2-9 i}{\\sqrt{2}}$.", + "Output Answer": [ + "Norm: $\\sqrt{\\frac{85}{2}}$\nArgument: $-\\tan ^{-1}\\left(\\frac{9}{2}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((2-9*i)/(math.sqrt(2)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{25+11 i}{\\pi }$ and $y=-\\frac{12+22 i}{\\pi }$", + "Output Answer": [ + "$-\\frac{58+682 i}{\\pi ^2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((25+11*i)/math.pi)\ny = -((12+22*i)/math.pi)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{5 \\sqrt{5} x-11 \\sqrt{5} x^2}{-10 \\sqrt{5} x^2-10 \\sqrt{5} x-9 \\sqrt{5}}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to 0\\},\\left\\{x\\to \\frac{5}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((5*sqrt(5)*x-11*sqrt(5)*x**2)/(-10*sqrt(5)*x**2-10*sqrt(5)*x-9*sqrt(5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{20 x^2}{\\sqrt{3}}-\\frac{4 x}{\\sqrt{3}}-\\frac{25}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{20 \\left(x-\\frac{1}{10}\\right)^2}{\\sqrt{3}}-\\frac{42 \\sqrt{3}}{5}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((20*x**2)/(math.sqrt(3)))-((4*x)/(math.sqrt(3)))-(25/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((25-18)+25)-((1-21)-14)$.", + "Output Answer": [ + "$66$" + ], + "Output Program": [ + "try: \n print(((25-18)+25)-((1-21)-14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{7 t}{2}-110, x(t)=-\\frac{t}{2}-15$", + "Output Answer": [ + "$y=7 x-5$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -((7*t)/2)-110\nx_t = -(t/2)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^2+10 x-3$ when divided by $-6 x^2-6 x-8$.", + "Output Answer": [ + "$\\frac{4}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**2+10*x-3\nq = -6*x**2-6*x-8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the fourth order series of the inverse of the following function around 4:\n$-\\frac{\\sqrt[3]{x}}{\\sqrt[3]{5}}$", + "Output Answer": [ + "$-5 (x-1)^3-15 (x-1)^2-15 (x-1)-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, -((cbrt(x))/(cbrt(5))))\nprint(solve(f, x)[0].series(y, 4, 4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(2+2 i) \\pi$ and $y=2 \\pi$", + "Output Answer": [ + "$(4+4 i) \\pi ^2$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (2+2*i)*math.pi\ny = 2*math.pi\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^3+5 x^2-8 x-8$ when divided by $9$.", + "Output Answer": [ + "$\\frac{2 x^3}{9}+\\frac{5 x^2}{9}-\\frac{8 x}{9}-\\frac{8}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**3+5*x**2-8*x-8\nq = 9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-11 x-8}+\\sqrt{-10 x-15}=3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -182+6 \\sqrt{905}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-11*x-8)+sqrt(-10*x-15), 3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\sqrt{7 x^2+7}$", + "Output Answer": [ + "$y\\geq \\sqrt{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(sqrt(7*x**2+7), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -9 \\sqrt{2} x^2-5 \\sqrt{2} x-8 \\sqrt{2}$ and $q(x) = -10 \\sqrt{2} x^2+5 \\sqrt{2} x+2 \\sqrt{2}$", + "Output Answer": [ + "$180 x^4+10 x^3+74 x^2-100 x-32$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -9*sqrt(2)*x**2-5*sqrt(2)*x-8*sqrt(2)\nq = -10*sqrt(2)*x**2+5*sqrt(2)*x+2*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2+5 x+5 y^2-8 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(y-\\frac{4}{5}\\right)^2-6 \\left(x-\\frac{5}{12}\\right)^2=\\frac{979}{120}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{12} & \\frac{4}{5}-\\frac{11 \\sqrt{89}}{60} \\\\\n \\frac{5}{12} & \\frac{4}{5}+\\frac{11 \\sqrt{89}}{60} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{11}{6}}$\nCenter: $\\left\\{\\frac{5}{12},\\frac{4}{5}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{60} \\left(48+5 \\sqrt{30}\\right)-\\sqrt{\\frac{6}{5}} x,y=\\sqrt{\\frac{6}{5}} x+\\frac{1}{60} \\left(48-5 \\sqrt{30}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2+5*x+5*y**2-8*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{13-12 x}+\\sqrt{-3 x-2}=6$", + "Output Answer": [ + "$\\{\\{x\\to -1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(13-12*x)+sqrt(-3*x-2), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{13 \\left(144 t^2+624 t+673\\right)}{3 \\sqrt{3}}, x(t)=48 t^2+208 t+\\frac{676}{3}$", + "Output Answer": [ + "$y=\\frac{13}{\\sqrt{3}}-\\frac{13 x}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -((13*(144*t**2+624*t+673))/(3*sqrt(3)))\nx_t = 48*t**2+208*t+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\left(\\left(\\frac{i}{4}+\\frac{i \\sqrt{5}}{4}-\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right) \\pi \\right)$.", + "Output Answer": [ + "Norm: $\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}+\\left(\\frac{1}{4}+\\frac{\\sqrt{5}}{4}\\right)^2} \\pi$\nArgument: $\\tan ^{-1}\\left(\\frac{-\\frac{1}{4}-\\frac{\\sqrt{5}}{4}}{\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(((i/4)+((i*math.sqrt(5))/4)-math.sqrt((5/8)-((math.sqrt(5))/8)))*math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2-x+y^2+5 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $\\left(y+\\frac{5}{2}\\right)^2-6 \\left(x+\\frac{1}{12}\\right)^2=-\\frac{43}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{12} \\left(-1-\\sqrt{301}\\right) & -\\frac{5}{2} \\\\\n \\frac{1}{12} \\left(\\sqrt{301}-1\\right) & -\\frac{5}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{7}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{12} \\left(-1-\\sqrt{301}\\right)+\\frac{1}{12} \\left(\\sqrt{301}-1\\right)\\right),-\\frac{5}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{6} x+\\frac{1}{12} \\left(\\sqrt{6}-30\\right),y=\\frac{1}{12} \\left(-30-\\sqrt{6}\\right)-\\sqrt{6} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2-x+y**2+5*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{7}{2} e^{-\\frac{9 i \\pi }{10}}$.", + "Output Answer": [ + "Norm: $\\frac{7}{2}$\nArgument: $-\\frac{9 \\pi }{10}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (7/2)*math.e**(-((9*i*math.pi)/10))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=x^4+\\sqrt[3]{-2 x-4}$ at the point $x=-7$", + "Output Answer": [ + "$2401+\\sqrt[3]{10} = 2403.15$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = -7\ntry: \n f = x**4+np.cbrt(-2*x-4)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (6, 3, 6)$", + "Output Answer": [ + "$\\left\\{9,\\tan ^{-1}\\left(\\frac{\\sqrt{5}}{2}\\right),\\tan ^{-1}\\left(\\frac{1}{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 6\ny = 3\nz = 6\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(3-i) \\sqrt{2}$ and $y=(6-7 i) \\sqrt{2}$", + "Output Answer": [ + "$\\frac{5}{17}+\\frac{3 i}{17}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (3-i)*math.sqrt(2)\ny = (6-7*i)*math.sqrt(2)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -x^2+2 x-13$ and $q(x) = -7 x^2-12 x-11$", + "Output Answer": [ + "$7 x^4-2 x^3+78 x^2+134 x+143$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -x**2+2*x-13\nq = -7*x**2-12*x-11\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-10 x^2+5 x-1$", + "Output Answer": [ + "$-10 \\left(x-\\frac{1}{4}\\right)^2-\\frac{3}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-10*x**2+5*x-1), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{172 x^3+\\frac{1575 x^2}{4}-\\frac{245 x}{4}-\\frac{481}{4}}{60 x^2+\\frac{1003 x}{4}+259}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{86} \\left(1-\\sqrt{2237}\\right)\\right\\},\\left\\{x\\to \\frac{1}{86} \\left(1+\\sqrt{2237}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((172*x**3+((1575*x**2)/4)-((245*x)/4)-(481/4))/(60*x**2+((1003*x)/4)+259)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{57}{7}$, and $a_n=a_{n-1}+7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{18738}{7}$" + ], + "Output Program": [ + "a = (57/7) # initial value\nd = 7 # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (57/7) # initial value\nd = 7 # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{13 e^{\\frac{29 i \\pi }{180}}}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\frac{13}{\\sqrt{3}}$\nArgument: $-\\frac{151 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((13*math.e**((29*i*math.pi)/180))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^6+7 x^5-6 x^4+x^3+2 x^2-7 x+3$ when divided by $x^5+3 x^4-4 x^3-7 x^2+2 x-9$.", + "Output Answer": [ + "$25-6 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**6+7*x**5-6*x**4+x**3+2*x**2-7*x+3\nq = x**5+3*x**4-4*x**3-7*x**2+2*x-9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{40 x^2}{\\sqrt{3}}+12 \\sqrt{3} x-\\frac{34}{\\sqrt{3}}}{-\\frac{40 x^2}{\\sqrt{3}}+\\frac{11 x}{\\sqrt{3}}-\\sqrt{3}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((40*x**2)/(sqrt(3)))+12*sqrt(3)*x-(34/(sqrt(3))))/(-((40*x**2)/(sqrt(3)))+((11*x)/(sqrt(3)))-sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^3-2 x^2-x+9$ when divided by $7$.", + "Output Answer": [ + "$\\frac{2 x^3}{7}-\\frac{2 x^2}{7}-\\frac{x}{7}+\\frac{9}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**3-2*x**2-x+9\nq = 7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2-18 \\sqrt{3} x-\\frac{320}{3}$", + "Output Answer": [ + "$-2 \\left(-x-\\frac{5}{\\sqrt{3}}\\right) \\left(x-\\frac{32}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2-18*sqrt(3)*x-(320/3), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^6+9 x^5-9 x^4+x^3-8 x^2+x-10$ when divided by $5 x+9$.", + "Output Answer": [ + "$\\frac{2 x^5}{5}+\\frac{27 x^4}{25}-\\frac{468 x^3}{125}+\\frac{4337 x^2}{625}-\\frac{44033 x}{3125}+\\frac{399422}{15625}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**6+9*x**5-9*x**4+x**3-8*x**2+x-10\nq = 5*x+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{((23+6)-25)-11}{24+8}$.", + "Output Answer": [ + "$-\\frac{7}{32}$" + ], + "Output Program": [ + "try: \n print(((((23+6)-25)-11)/(24+8)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{15 x^2+x-3}{12 x^2-21 x-7}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{30} \\left(-1-\\sqrt{181}\\right)\\right\\},\\left\\{x\\to \\frac{1}{30} \\left(-1+\\sqrt{181}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((15*x**2+x-3)/(12*x**2-21*x-7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{20+20 i}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{20 \\sqrt{2}}{\\pi }$\nArgument: $\\frac{\\pi }{4}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((20+20*i)/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{37}{51}$, and $a_n=a_{n-1}+-\\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$7 \\left(-\\frac{74}{51}-13 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(37/51) # initial value\nd = -math.sqrt(2) # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(37/51) # initial value\nd = -math.sqrt(2) # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-7-i$ and $y=9+6 i$", + "Output Answer": [ + "$-\\frac{23}{39}+\\frac{11 i}{39}$" + ], + "Output Program": [ + "i = 1j\nx = -7-i\ny = 9+6*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-3 \\left(192 t^2-720 t+677\\right), x(t)=64 t^2-240 t+225$", + "Output Answer": [ + "$y=-9 x-6$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -3*(192*t**2-720*t+677)\nx_t = 64*t**2-240*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{1}{2} \\left(\\cos \\left(\\frac{14}{9}\\right)+i \\sin \\left(\\frac{14}{9}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$\\frac{1}{256} \\left(\\cos \\left(\\frac{112}{9}\\right)+i \\sin \\left(\\frac{112}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((1/2)*(math.cos((14/9))+1j*math.sin((14/9))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{9 x^2-16 x+7}{1-2 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7}{9}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((9*x**2-16*x+7)/(1-2*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=4$, and $a_n=a_{n-1}+-\\frac{6}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$\\frac{9}{2} \\left(8-\\frac{48}{\\sqrt{5}}\\right)$" + ], + "Output Program": [ + "import math\n\na = 4 # initial value\nd = -(6/(math.sqrt(5))) # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 4 # initial value\nd = -(6/(math.sqrt(5))) # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^5-5 x^4+9 x^3-6 x^2+2 x-2$ when divided by $-6 x^5+6 x^4+9 x^3-3 x^2-7 x-3$.", + "Output Answer": [ + "$-\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**5-5*x**4+9*x**3-6*x**2+2*x-2\nq = -6*x**5+6*x**4+9*x**3-3*x**2-7*x-3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{15+14 i}{\\sqrt{3}}$ and $y=-\\frac{16+11 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{1-3 i}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((15+14*i)/(math.sqrt(3)))\ny = -((16+11*i)/(math.sqrt(3)))\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(\\cos \\left(\\frac{17}{30}\\right)+i \\sin \\left(\\frac{17}{30}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-343 \\left(\\cos \\left(\\frac{17}{10}\\right)+i \\sin \\left(\\frac{17}{10}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(math.cos((17/30))+1j*math.sin((17/30))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 17 x+6| =19$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{25}{17}\\right\\},\\left\\{x\\to \\frac{13}{17}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(17*x+6), 19), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{1}{15} (((4+1)+7)+23)-((19-11)-25)^2$.", + "Output Answer": [ + "$-\\frac{860}{3}$" + ], + "Output Program": [ + "try: \n print((1/15)*(((4+1)+7)+23)-((19-11)-25)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{62 x^2}{3}+\\frac{28 x}{3}-\\frac{7}{3}}{-\\frac{4 x^2}{3}+21 x+8}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{62} \\left(-14-3 \\sqrt{70}\\right)\\right\\},\\left\\{x\\to \\frac{1}{62} \\left(-14+3 \\sqrt{70}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((62*x**2)/3)+((28*x)/3)-(7/3))/(-((4*x**2)/3)+21*x+8)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-8+\\frac{7 i}{2}$ and $y=\\frac{11}{2}-\\frac{7 i}{2}$", + "Output Answer": [ + "$-\\frac{127}{4}+\\frac{189 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = -8+((7*i)/2)\ny = (11/2)-((7*i)/2)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{3 x^2}{5}+\\frac{11 x}{5}-\\frac{56}{5}$ and $q(x) = -\\frac{44 x^2}{5}+\\frac{59 x}{5}+\\frac{56}{5}$", + "Output Answer": [ + "$-\\frac{132 x^4}{25}-\\frac{307 x^3}{25}+\\frac{3281 x^2}{25}-\\frac{2688 x}{25}-\\frac{3136}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((3*x**2)/5)+((11*x)/5)-(56/5)\nq = -((44*x**2)/5)+((59*x)/5)+(56/5)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\frac{17+1}{20}+2\\right)+6\\right) \\left(((8+12)-19)^2+8\\right)$.", + "Output Answer": [ + "$\\frac{801}{10}$" + ], + "Output Program": [ + "try: \n print(((((17+1)/20)+2)+6)*(((8+12)-19)**2+8))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2+7 x+6$ and $q(x) = 10 x^2$", + "Output Answer": [ + "$-140 x^4+70 x^3+60 x^2$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2+7*x+6\nq = 10*x**2\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-12 x^2+120 \\sqrt{2} x+936$", + "Output Answer": [ + "$12 \\left(-x-3 \\sqrt{2}\\right) \\left(x-13 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-12*x**2+120*sqrt(2)*x+936, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{15}{4} \\left(\\sin \\left(\\frac{8 \\pi }{45}\\right)-i \\cos \\left(\\frac{8 \\pi }{45}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$\\frac{3375}{64} \\left(-\\cos \\left(\\frac{\\pi }{30}\\right)-i \\sin \\left(\\frac{\\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((15/4)*(math.sin(((8*math.pi)/45))-1j*math.cos(((8*math.pi)/45))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$6 \\sqrt{5} y-2 \\sqrt{5}=0$, $11 \\sqrt{5} x+7 \\sqrt{5}=0$", + "Output Answer": [ + "$x=-\\frac{7}{11}$, $y=\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((6*sqrt(5)*y-2*sqrt(5), 11*sqrt(5)*x+7*sqrt(5)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{8528 x^2}{25}+\\frac{9344 x}{25}-44}{-\\frac{6888 x^2}{25}+260 x-\\frac{748}{25}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{25}{26}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((8528*x**2)/25)+((9344*x)/25)-44)/(-((6888*x**2)/25)+260*x-(748/25))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^3-7 x^2+5 x+9$ when divided by $8 x^2-9 x+7$.", + "Output Answer": [ + "$\\frac{7 x}{8}+\\frac{7}{64}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**3-7*x**2+5*x+9\nq = 8*x**2-9*x+7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+5 x+8 y^2-y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $6 \\left(x+\\frac{5}{12}\\right)^2+8 \\left(y-\\frac{1}{16}\\right)^2=\\frac{775}{96}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{48} \\left(4+\\sqrt{31}\\right) & \\frac{1}{16} \\\\\n \\frac{5}{48} \\left(\\sqrt{31}-4\\right) & \\frac{1}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{5}{48} \\left(\\sqrt{31}-4\\right)-\\frac{5}{48} \\left(4+\\sqrt{31}\\right)\\right),\\frac{1}{16}\\right\\}$\nArea Enclosed: $\\frac{775 \\pi }{384 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+5*x+8*y**2-y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2+6 x+2 y^2+7 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(y+\\frac{7}{4}\\right)^2-7 \\left(x-\\frac{3}{7}\\right)^2=\\frac{551}{56}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{7} & -\\frac{7}{4}-\\frac{3 \\sqrt{551}}{28} \\\\\n \\frac{3}{7} & \\frac{3 \\sqrt{551}}{28}-\\frac{7}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{7}}$\nCenter: $\\left\\{\\frac{3}{7},-\\frac{7}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{28} \\left(6 \\sqrt{14}-49\\right)-\\sqrt{\\frac{7}{2}} x,y=\\sqrt{\\frac{7}{2}} x+\\frac{1}{28} \\left(-49-6 \\sqrt{14}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2+6*x+2*y**2+7*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^6+\\frac{6 x^5}{5}-\\frac{47 x^4}{5}+5 x^3+\\frac{x^2}{5}+\\frac{27 x}{5}-\\frac{9}{5}$ when divided by $\\frac{32 x^5}{5}-\\frac{26 x^4}{5}-\\frac{27 x^3}{5}+5 x^2-\\frac{34 x}{5}+\\frac{22}{5}$.", + "Output Answer": [ + "$-\\frac{15 x}{16}-\\frac{147}{256}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**6+((6*x**5)/5)-((47*x**4)/5)+5*x**3+((x**2)/5)+((27*x)/5)-(9/5)\nq = ((32*x**5)/5)-((26*x**4)/5)-((27*x**3)/5)+5*x**2-((34*x)/5)+(22/5)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{15}{7}-\\frac{18 i}{7}$ and $y=\\frac{6}{7}+\\frac{38 i}{7}$", + "Output Answer": [ + "$\\frac{594}{49}-\\frac{678 i}{49}$" + ], + "Output Program": [ + "i = 1j\nx = -(15/7)-((18*i)/7)\ny = (6/7)+((38*i)/7)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^5+6 x^4+3 x^3+7 x^2-x+2$ when divided by $-10 x^4-7 x^3-6 x-2$.", + "Output Answer": [ + "$\\frac{3}{100}-\\frac{9 x}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**5+6*x**4+3*x**3+7*x**2-x+2\nq = -10*x**4-7*x**3-6*x-2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 x^2-2 x+4$ and $q(x) = 7 x^2+7 x+6$", + "Output Answer": [ + "$21 x^4+7 x^3+32 x^2+16 x+24$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*x**2-2*x+4\nq = 7*x**2+7*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{9} (x-21)^2, q(x) = 27 (2 x+1)^3$", + "Output Answer": [ + "$216 x^3+\\frac{2917 x^2}{9}+\\frac{472 x}{3}+76$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/9)*(x-21)**2\nq = 27*(2*x+1)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-5 x-10 y^2-7 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-5 x-10 y^2-7 y=-3$\nVertex: $\\left\\{\\frac{169}{200},-\\frac{7}{20}\\right\\}$\nDirectrix: $x=\\frac{97}{100}$\nFocal Parameter: $\\frac{1}{4}$\nFocus: $\\left\\{\\frac{18}{25},-\\frac{7}{20}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-5*x-10*y**2-7*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -2 \\sqrt{3}, q(x) = \\frac{16}{9} (2-7 x)^4$", + "Output Answer": [ + "$\\frac{38416 x^4}{9}-\\frac{43904 x^3}{9}+\\frac{6272 x^2}{3}-\\frac{3584 x}{9}-2 \\sqrt{3}+\\frac{256}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*sqrt(3)\nq = (16/9)*(2-7*x)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt[3]{5-2 x} \\csc (7 x+8)$", + "Output Answer": [ + "$\\frac{7 x+8}{\\pi }\\notin \\mathbb{Z}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = cbrt(5-2*x)*csc(7*x+8)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $3 \\sqrt{5} x^2+4 \\sqrt{5} x-3 \\sqrt{5}$", + "Output Answer": [ + "$x=\\frac{1}{3} \\left(-2-\\sqrt{13}\\right)\\lor x=\\frac{1}{3} \\left(\\sqrt{13}-2\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(3*sqrt(5)*x**2+4*sqrt(5)*x-3*sqrt(5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (10, 10, \\frac{1}{\\sqrt{3}})$", + "Output Answer": [ + "$\\left\\{\\sqrt{\\frac{601}{3}},\\tan ^{-1}\\left(10 \\sqrt{6}\\right),\\frac{\\pi }{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 10\ny = 10\nz = (1/(math.sqrt(3)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{120 x^2}{7}+\\frac{5822 x}{49}+\\frac{6724}{49}}{\\frac{1620 x}{49}+\\frac{8856}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{41}{28}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((120*x**2)/7)+((5822*x)/49)+(6724/49))/(((1620*x)/49)+(8856/49))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2-264 x+1344$", + "Output Answer": [ + "$12 (x-14) (x-8)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2-264*x+1344, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-13 x-7}+\\sqrt{8-9 x}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(-1361+55 \\sqrt{593}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-13*x-7)+sqrt(8-9*x), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{12}{25} \\left(27 t^2-225 t+460\\right), x(t)=\\frac{324 t^2}{25}-108 t+225$", + "Output Answer": [ + "$y=x-\\frac{21}{5}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (12/25)*(27*t**2-225*t+460)\nx_t = ((324*t**2)/25)-108*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4.92 x^2-9.95 x+1.42$, $q(x) = -4.5 x^2+7.63 x+8.$", + "Output Answer": [ + "$0.42 x^2-2.32 x+9.42$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4.92*x**2-9.95*x+1.42\nq = -4.5*x**2+7.63*x+8.\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+x+10 y^2+2 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x+\\frac{1}{16}\\right)^2+10 \\left(y+\\frac{1}{10}\\right)^2=\\frac{1621}{160}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{80} \\left(-5-\\sqrt{1621}\\right) & -\\frac{1}{10} \\\\\n \\frac{1}{80} \\left(\\sqrt{1621}-5\\right) & -\\frac{1}{10} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{80} \\left(-5-\\sqrt{1621}\\right)+\\frac{1}{80} \\left(\\sqrt{1621}-5\\right)\\right),-\\frac{1}{10}\\right\\}$\nArea Enclosed: $\\frac{1621 \\pi }{640 \\sqrt{5}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+x+10*y**2+2*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{11 x^5}{3}+\\frac{64 x^4}{9}+\\frac{52 x^3}{9}+\\frac{65 x^2}{9}-\\frac{106 x}{9}+\\frac{16}{3}$ and $\\frac{11 x^4}{3}+\\frac{8 x^3}{3}+\\frac{4 x^2}{3}-\\frac{11 x}{3}+2$.", + "Output Answer": [ + "$\\frac{11 x^4}{9}+\\frac{8 x^3}{9}+\\frac{4 x^2}{9}-\\frac{11 x}{9}+\\frac{2}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((11*x**5)/3)+((64*x**4)/9)+((52*x**3)/9)+((65*x**2)/9)-((106*x)/9)+(16/3), ((11*x**4)/3)+((8*x**3)/3)+((4*x**2)/3)-((11*x)/3)+2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2+16 \\sqrt{3} x-384$", + "Output Answer": [ + "$-4 \\left(4 \\sqrt{3}-x\\right) \\left(x+8 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2+16*sqrt(3)*x-384, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 14 \\sqrt{3} x-6 \\sqrt{3}\\right| =8 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{7}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(14*sqrt(3)*x-6*sqrt(3)), 8*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -5 \\sqrt{2} x^2+11 \\sqrt{2} x-11 \\sqrt{2}\\right| =16 \\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(11-\\sqrt{221}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(11+\\sqrt{221}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-5*sqrt(2)*x**2+11*sqrt(2)*x-11*sqrt(2)), 16*sqrt(2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=3 \\sqrt{3} \\left(18 t^2-108 t+161\\right), x(t)=27 t^2-162 t+243$", + "Output Answer": [ + "$y=2 \\sqrt{3} x-3 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 3*sqrt(3)*(18*t**2-108*t+161)\nx_t = 27*t**2-162*t+243\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{110 x^2+5 x-255}{231 x^2+368 x+17}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((110*x**2+5*x-255)/(231*x**2+368*x+17)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $4 \\sqrt{5} x^2-2 \\sqrt{5} x-2 \\sqrt{5}$", + "Output Answer": [ + "$x=-\\frac{1}{2}\\lor x=1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(4*sqrt(5)*x**2-2*sqrt(5)*x-2*sqrt(5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-5 x^2-15 x+16}{-20 x^2-9 x+24}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(-15-\\sqrt{545}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(-15+\\sqrt{545}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-5*x**2-15*x+16)/(-20*x**2-9*x+24)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (3 x+4)^4, q(x) = 7-4 x$", + "Output Answer": [ + "$81 x^4+432 x^3+864 x^2+764 x+263$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (3*x+4)**4\nq = 7-4*x\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{12 x^2-59 x-140}{\\frac{81 x}{2}-270}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((12*x**2-59*x-140)/(((81*x)/2)-270)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10 x+\\frac{17}{2}}+\\sqrt{2}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{20} \\left(187-40 \\sqrt{2}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10*x+(17/2))+sqrt(2), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -6 x^2+5 x-12$ and $q(x) = 5 x^2-3 x+14$", + "Output Answer": [ + "$-30 x^4+43 x^3-159 x^2+106 x-168$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -6*x**2+5*x-12\nq = 5*x**2-3*x+14\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2-44 x-1540$", + "Output Answer": [ + "$11 (-x-10) (14-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2-44*x-1540, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{9}{5} \\left(x^2-3 x+8\\right)$, $q(x) = \\frac{2}{5} \\left(22 x^2-8 x+19\\right)$", + "Output Answer": [ + "$7 x^2+\\frac{11 x}{5}-\\frac{34}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(9/5)*(x**2-3*x+8)\nq = (2/5)*(22*x**2-8*x+19)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{13}{5}-\\frac{33 i}{5}$ and $y=\\frac{32}{5}-\\frac{44 i}{5}$", + "Output Answer": [ + "$-\\frac{1868}{25}-\\frac{484 i}{25}$" + ], + "Output Program": [ + "i = 1j\nx = -(13/5)-((33*i)/5)\ny = (32/5)-((44*i)/5)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{10}{3}+\\frac{16 i}{3}$ and $y=5-9 i$", + "Output Answer": [ + "$-\\frac{47}{159}+\\frac{85 i}{159}$" + ], + "Output Program": [ + "i = 1j\nx = (10/3)+((16*i)/3)\ny = 5-9*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x^5-2 x^4-6 x^3-4 x^2-6 x+6$ and $2 x^5-x^4-3 x^3-2 x^2-3 x+3$.", + "Output Answer": [ + "$2 x^5-x^4-3 x^3-2 x^2-3 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x**5-2*x**4-6*x**3-4*x**2-6*x+6, 2*x**5-x**4-3*x**3-2*x**2-3*x+3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 15 x^2-6 x-10$, $q(x) = -x^2-12 x-1$", + "Output Answer": [ + "$14 x^2-18 x-11$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 15*x**2-6*x-10\nq = -x**2-12*x-1\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2-2 x+1$ and $2 x^2+x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2-2*x+1, 2*x**2+x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=9 (7 t+37)^2, x(t)=-3 t-15$", + "Output Answer": [ + "$y=49 x^2-84 x+36$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 9*(7*t+37)**2\nx_t = -3*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{6}{7} \\left(\\cos \\left(\\frac{\\pi }{180}\\right)+i \\sin \\left(\\frac{\\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{6}{7} \\sqrt{\\sin ^2\\left(\\frac{\\pi }{180}\\right)+\\cos ^2\\left(\\frac{\\pi }{180}\\right)}$\nArgument: $\\frac{\\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (6/7)*(math.cos((math.pi/180))+i*math.sin((math.pi/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{10}{\\sqrt{3}}-6 \\sqrt{3} x\\right| =14 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{16}{9}\\right\\},\\left\\{x\\to \\frac{26}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs((10/(sqrt(3)))-6*sqrt(3)*x), 14*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{13 \\sqrt{3} x^2-\\frac{x}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}}{\\frac{25 x^2}{\\sqrt{3}}+\\frac{4 x}{\\sqrt{3}}-\\frac{7}{\\sqrt{3}}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{78} \\left(1-\\sqrt{4057}\\right)\\right\\},\\left\\{x\\to \\frac{1}{78} \\left(1+\\sqrt{4057}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((13*sqrt(3)*x**2-(x/(sqrt(3)))-(26/(sqrt(3))))/(((25*x**2)/(sqrt(3)))+((4*x)/(sqrt(3)))-(7/(sqrt(3))))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{33 x^2}{\\sqrt{2}}-15 \\sqrt{2} x-15 \\sqrt{2}\\right| =0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((33*x**2)/(sqrt(2)))-15*sqrt(2)*x-15*sqrt(2)), 0), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{25}{49} (37-6 t)^2, x(t)=\\frac{15 t}{7}-15$", + "Output Answer": [ + "$y=4 x^2+\\frac{100 x}{7}+\\frac{625}{49}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (25/49)*(37-6*t)**2\nx_t = ((15*t)/7)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^4+x^3-9 x^2+10 x-6$ when divided by $7 x^2+7 x-2$.", + "Output Answer": [ + "$-x^2+\\frac{8 x}{7}-\\frac{19}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**4+x**3-9*x**2+10*x-6\nq = 7*x**2+7*x-2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\sqrt{2} \\left(\\sin \\left(\\frac{\\pi }{18}\\right)+i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$885842380864 \\left(-\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*math.sqrt(2)*(math.sin((math.pi/18))+1j*math.cos((math.pi/18))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5-15 x}+\\sqrt{7-4 x}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{121} \\left(-2758+120 \\sqrt{383}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5-15*x)+sqrt(7-4*x), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2+i$.", + "Output Answer": [ + "Norm: $\\sqrt{5}$\nArgument: $\\tan ^{-1}\\left(\\frac{1}{2}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2+i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((18-11)+25)+(9-11)$.", + "Output Answer": [ + "$30$" + ], + "Output Program": [ + "try: \n print(((18-11)+25)+(9-11))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $e^{-\\frac{107 i \\pi }{180}} \\log (2)$.", + "Output Answer": [ + "Norm: $\\log (2)$\nArgument: $-\\frac{107 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = math.e**(-((107*i*math.pi)/180))*math.log(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{24 x^2-40 x+14}{42 x^2+5 x-13}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7}{6}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((24*x**2-40*x+14)/(42*x**2+5*x-13)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{3} (3 x-2), q(x) = -\\frac{8 (x-2)^3}{3 \\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{8 x^3}{3 \\sqrt{3}}+\\frac{16 x^2}{\\sqrt{3}}+3 \\sqrt{3} x-\\frac{32 x}{\\sqrt{3}}-2 \\sqrt{3}+\\frac{64}{3 \\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(3)*(3*x-2)\nq = -((8*(x-2)**3)/(3*sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{17 x^4}{2}-4 x^3+4 x^2-\\frac{19 x}{2}-9$ when divided by $\\frac{15 x^2}{2}+7 x-8$.", + "Output Answer": [ + "$\\frac{17 x^2}{15}-\\frac{358 x}{225}+\\frac{10892}{3375}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((17*x**4)/2)-4*x**3+4*x**2-((19*x)/2)-9\nq = ((15*x**2)/2)+7*x-8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+x+7 y^2+5 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $3 \\left(x+\\frac{1}{6}\\right)^2+7 \\left(y+\\frac{5}{14}\\right)^2=\\frac{335}{42}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{42} \\left(-7-2 \\sqrt{670}\\right) & -\\frac{5}{14} \\\\\n \\frac{1}{42} \\left(2 \\sqrt{670}-7\\right) & -\\frac{5}{14} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{42} \\left(-7-2 \\sqrt{670}\\right)+\\frac{1}{42} \\left(2 \\sqrt{670}-7\\right)\\right),-\\frac{5}{14}\\right\\}$\nArea Enclosed: $\\frac{335 \\pi }{42 \\sqrt{21}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+x+7*y**2+5*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2 x^4-6 x+8$ and $-x^4-3 x+4$.", + "Output Answer": [ + "$x^4+3 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2*x**4-6*x+8, -x**4-3*x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=3 \\left(-20 t+\\sqrt{3}-45\\right), x(t)=-4 \\sqrt{3} t-9 \\sqrt{3}$", + "Output Answer": [ + "$y=5 \\sqrt{3} x+3 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 3*(-20*t+sqrt(3)-45)\nx_t = -4*sqrt(3)*t-9*sqrt(3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 x^2-10 x-7$ and $q(x) = -6 x^2-7 x+9$", + "Output Answer": [ + "$30 x^4+95 x^3+67 x^2-41 x-63$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -5*x**2-10*x-7\nq = -6*x**2-7*x+9\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{215}{2}-\\frac{93 t}{16}, x(t)=\\frac{3 t}{4}-15$", + "Output Answer": [ + "$y=-\\frac{31 x}{4}-\\frac{35}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (215/2)-((93*t)/16)\nx_t = ((3*t)/4)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -2 \\left(5 x^2+x+6\\right)$, $q(x) = 7 x^2+9 x-13$", + "Output Answer": [ + "$-3 x^2+7 x-25$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*(5*x**2+x+6)\nq = 7*x**2+9*x-13\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{3} \\left(8 x^2+5 x+3\\right)$, $q(x) = \\sqrt{3} \\left(-7 x^2+2 x+2\\right)$", + "Output Answer": [ + "$\\sqrt{3} x^2+7 \\sqrt{3} x+5 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(3)*(8*x**2+5*x+3)\nq = sqrt(3)*(-7*x**2+2*x+2)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{33}{4} \\left(\\sin \\left(\\frac{7 \\pi }{30}\\right)+i \\cos \\left(\\frac{7 \\pi }{30}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{1531578985264449 \\left(-\\frac{1}{2}+\\frac{i \\sqrt{3}}{2}\\right)}{1048576}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(33/4)*(math.sin(((7*math.pi)/30))+1j*math.cos(((7*math.pi)/30))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{27 x^2}{e}+\\frac{35 x}{e}-\\frac{33}{e}$ and $q(x) = -\\frac{15 x^2}{e}+\\frac{4 x}{e}+\\frac{5}{e}$", + "Output Answer": [ + "$-\\frac{405 x^4}{e^2}-\\frac{417 x^3}{e^2}+\\frac{770 x^2}{e^2}+\\frac{43 x}{e^2}-\\frac{165}{e^2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = ((27*x**2)/math.e)+((35*x)/math.e)-(33/math.e)\nq = -((15*x**2)/math.e)+((4*x)/math.e)+(5/math.e)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{17}{2} \\left(\\sin \\left(\\frac{19 \\pi }{90}\\right)+i \\cos \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$\\frac{582622237229761 \\left(-\\sin \\left(\\frac{\\pi }{30}\\right)-i \\cos \\left(\\frac{\\pi }{30}\\right)\\right)}{4096}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(17/2)*(math.sin(((19*math.pi)/90))+1j*math.cos(((19*math.pi)/90))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{16-10 i}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $2 \\sqrt{\\frac{89}{3}}$\nArgument: $-\\tan ^{-1}\\left(\\frac{5}{8}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((16-10*i)/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\sqrt{2} x^2-4 \\sqrt{2} x+8 \\sqrt{2}$", + "Output Answer": [ + "$x=2 \\left(-1-\\sqrt{3}\\right)\\lor x=2 \\left(\\sqrt{3}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-sqrt(2)*x**2-4*sqrt(2)*x+8*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{19 x^5}{2}-\\frac{19 x^4}{2}-\\frac{3 x^3}{2}-\\frac{9 x^2}{2}+8 x+\\frac{19}{2}$ when divided by $5 x^5+\\frac{x^4}{2}-\\frac{9 x^3}{2}-\\frac{17 x^2}{2}+\\frac{19 x}{2}+6$.", + "Output Answer": [ + "$-\\frac{19}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((19*x**5)/2)-((19*x**4)/2)-((3*x**3)/2)-((9*x**2)/2)+8*x+(19/2)\nq = 5*x**5+((x**4)/2)-((9*x**3)/2)-((17*x**2)/2)+((19*x)/2)+6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x-4$ and $2 x+1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x-4, 2*x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-7 \\sqrt{2} x+\\frac{29 y}{\\sqrt{2}}-17 \\sqrt{2} z+\\frac{11}{\\sqrt{2}}=0$, $\\frac{11 x}{\\sqrt{2}}+16 \\sqrt{2} y-\\frac{23 z}{\\sqrt{2}}-4 \\sqrt{2}=0$, $-\\frac{7 x}{\\sqrt{2}}+10 \\sqrt{2} y-\\frac{23 z}{\\sqrt{2}}=0$", + "Output Answer": [ + "$x=\\frac{1466}{387}$, $y=-\\frac{647}{129}$, $z=-\\frac{2134}{387}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-7*sqrt(2)*x+((29*y)/(sqrt(2)))-17*sqrt(2)*z+(11/(sqrt(2))), ((11*x)/(sqrt(2)))+16*sqrt(2)*y-((23*z)/(sqrt(2)))-4*sqrt(2), -((7*x)/(sqrt(2)))+10*sqrt(2)*y-((23*z)/(sqrt(2))))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((18-21)+15)+((6-20)-4)$.", + "Output Answer": [ + "$-6$" + ], + "Output Program": [ + "try: \n print(((18-21)+15)+((6-20)-4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(8 \\left(\\cos \\left(\\frac{91}{90}\\right)+i \\sin \\left(\\frac{91}{90}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$64 \\left(\\cos \\left(\\frac{91}{45}\\right)+i \\sin \\left(\\frac{91}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((8*(math.cos((91/90))+1j*math.sin((91/90))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{20}{5}+13}{(6+11)-17}$.", + "Output Answer": [ + "$\\text{ComplexInfinity}$" + ], + "Output Program": [ + "try: \n print((((20/5)+13)/((6+11)-17)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((6+21)-24)-6)^2+((5+5)-18)$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "try: \n print((((6+21)-24)-6)**2+((5+5)-18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{5 x^2}{e}+\\frac{9 x}{e}+\\frac{35}{e}$ and $q(x) = -\\frac{11 x^2}{e}+\\frac{32 x}{e}+\\frac{36}{e}$", + "Output Answer": [ + "$\\frac{55 x^4}{e^2}-\\frac{259 x^3}{e^2}-\\frac{277 x^2}{e^2}+\\frac{1444 x}{e^2}+\\frac{1260}{e^2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -((5*x**2)/math.e)+((9*x)/math.e)+(35/math.e)\nq = -((11*x**2)/math.e)+((32*x)/math.e)+(36/math.e)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-400 x^2+380 x-70}{10-40 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7}{10}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-400*x**2+380*x-70)/(10-40*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-368 x^2+187 x+48}{128 x^2-8 x-6}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{16}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-368*x**2+187*x+48)/(128*x**2-8*x-6)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{11 x^2}{4}+\\frac{33 x}{4}-\\frac{35}{4}$ and $q(x) = -\\frac{15 x^2}{4}-\\frac{51 x}{4}-1$", + "Output Answer": [ + "$\\frac{165 x^4}{16}+\\frac{33 x^3}{8}-\\frac{557 x^2}{8}+\\frac{1653 x}{16}+\\frac{35}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((11*x**2)/4)+((33*x)/4)-(35/4)\nq = -((15*x**2)/4)-((51*x)/4)-1\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{4 x}{\\sqrt{3}}-\\frac{14}{\\sqrt{3}}\\right| =\\frac{16}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{15}{2}\\right\\},\\left\\{x\\to \\frac{1}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((4*x)/(sqrt(3)))-(14/(sqrt(3)))), (16/(sqrt(3)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{71 x^2}{5}+\\frac{53 x}{5}+14$ and $q(x) = \\frac{38 x^2}{5}-6 x+\\frac{41}{5}$", + "Output Answer": [ + "$-\\frac{2698 x^4}{25}+\\frac{4144 x^3}{25}-\\frac{1841 x^2}{25}+\\frac{73 x}{25}+\\frac{574}{5}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((71*x**2)/5)+((53*x)/5)+14\nq = ((38*x**2)/5)-6*x+(41/5)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{67}{31}$, and $a_n=a_{n-1}+-3 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$11 \\left(\\frac{134}{31}-63 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = (67/31) # initial value\nd = -3*math.sqrt(2) # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (67/31) # initial value\nd = -3*math.sqrt(2) # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(\\cos \\left(\\frac{113}{90}\\right)+i \\sin \\left(\\frac{113}{90}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$2187 \\left(\\cos \\left(\\frac{791}{90}\\right)+i \\sin \\left(\\frac{791}{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(math.cos((113/90))+1j*math.sin((113/90))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-6 x-9 y^2-4 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x-\\frac{3}{8}\\right)^2-9 \\left(y+\\frac{2}{9}\\right)^2=\\frac{265}{72}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{8}-\\frac{\\sqrt{4505}}{72} & -\\frac{2}{9} \\\\\n \\frac{1}{72} \\left(27+\\sqrt{4505}\\right) & -\\frac{2}{9} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{17}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{3}{8}-\\frac{\\sqrt{4505}}{72}+\\frac{1}{72} \\left(27+\\sqrt{4505}\\right)\\right),-\\frac{2}{9}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2 \\sqrt{2} x}{3}+\\frac{1}{36} \\left(-8-9 \\sqrt{2}\\right),y=\\frac{1}{36} \\left(9 \\sqrt{2}-8\\right)-\\frac{2 \\sqrt{2} x}{3}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-6*x-9*y**2-4*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{7-3 x^2}$ at the point $x=2$", + "Output Answer": [ + "$-\\sqrt[3]{5} = -1.71$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 2\ntry: \n f = np.cbrt(7-3*x**2)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-5 x+6 y^2-6 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-5 x+6 y^2-6 y=-4$\nVertex: $\\left\\{\\frac{1}{2},\\frac{1}{2}\\right\\}$\nDirectrix: $x=\\frac{7}{24}$\nFocal Parameter: $\\frac{5}{12}$\nFocus: $\\left\\{\\frac{17}{24},\\frac{1}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-5*x+6*y**2-6*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^5+2 x^4+2 x^3-5 x+9$ when divided by $4 x^4+5 x^3-2 x^2+7 x-10$.", + "Output Answer": [ + "$2 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**5+2*x**4+2*x**3-5*x+9\nq = 4*x**4+5*x**3-2*x**2+7*x-10\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{21 x}{4}+\\frac{65 y}{4}+\\frac{41 z}{2}-\\frac{5}{2}=0$, $22 x+\\frac{15 y}{4}+\\frac{75 z}{4}+19=0$, $-\\frac{11 x}{2}+19 y-\\frac{57 z}{4}+\\frac{25}{2}=0$", + "Output Answer": [ + "$x=-\\frac{1003012}{656611}$, $y=-\\frac{294522}{656611}$, $z=\\frac{570406}{656611}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((21*x)/4)+((65*y)/4)+((41*z)/2)-(5/2), 22*x+((15*y)/4)+((75*z)/4)+19, -((11*x)/2)+19*y-((57*z)/4)+(25/2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 (4-3 x)^2, q(x) = -\\frac{1}{8} (6 x+11)^3$", + "Output Answer": [ + "$-27 x^3-\\frac{225 x^2}{2}-\\frac{1473 x}{4}-\\frac{819}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*(4-3*x)**2\nq = -(1/8)*(6*x+11)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{19}{3} \\left(\\cos \\left(\\frac{34}{45}\\right)+i \\sin \\left(\\frac{34}{45}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-\\frac{322687697779 \\left(\\cos \\left(\\frac{34}{5}\\right)+i \\sin \\left(\\frac{34}{5}\\right)\\right)}{19683}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(19/3)*(math.cos((34/45))+1j*math.sin((34/45))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{11+i}{\\sqrt{2}}$ and $y=\\frac{8-11 i}{\\sqrt{2}}$", + "Output Answer": [ + "$-\\frac{19-10 i}{\\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((11+i)/(math.sqrt(2)))\ny = ((8-11*i)/(math.sqrt(2)))\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{7}{9}$, and $a_n=a_{n-1}+-3 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$5 \\left(-\\frac{14}{9}-27 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(7/9) # initial value\nd = -3*math.sqrt(3) # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(7/9) # initial value\nd = -3*math.sqrt(3) # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^5-6 x^4+7 x^3-8 x^2+9 x+6$ when divided by $-10 x^2+4 x-6$.", + "Output Answer": [ + "$-\\frac{7 x^3}{10}+\\frac{8 x^2}{25}-\\frac{19 x}{125}+\\frac{342}{625}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**5-6*x**4+7*x**3-8*x**2+9*x+6\nq = -10*x**2+4*x-6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{2} (8-9 x)^2, q(x) = -\\sqrt{2} (3 x+4)$", + "Output Answer": [ + "$\\frac{81 x^2}{2}-3 \\sqrt{2} x-72 x-4 \\sqrt{2}+32$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/2)*(8-9*x)**2\nq = -sqrt(2)*(3*x+4)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{13 x^3}{2}+4 x^2-8 x-\\frac{3}{2}$ when divided by $\\frac{3 x^3}{2}+\\frac{13 x^2}{2}+\\frac{x}{2}+2$.", + "Output Answer": [ + "$-\\frac{13}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((13*x**3)/2)+4*x**2-8*x-(3/2)\nq = ((3*x**3)/2)+((13*x**2)/2)+(x/2)+2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{82 x^2}{5}+\\frac{82 x}{5}-\\frac{37}{5}}{-22 x-\\frac{94}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{82} \\left(-41-\\sqrt{4715}\\right)\\right\\},\\left\\{x\\to \\frac{1}{82} \\left(-41+\\sqrt{4715}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((82*x**2)/5)+((82*x)/5)-(37/5))/(-22*x-(94/5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3$ and $-3 x^4+2 x^3+x^2-4 x+4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3, -3*x**4+2*x**3+x**2-4*x+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(7+6 i) \\sqrt{2}$ and $y=(-1-i) \\sqrt{2}$", + "Output Answer": [ + "$(6+5 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (7+6*i)*math.sqrt(2)\ny = (-1-i)*math.sqrt(2)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -12 x^2+22 x+1\\right| =-23$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-12*x**2+22*x+1), -23), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x-5 y^2+8 y+10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $x-5 y^2+8 y=-10$\nVertex: $\\left\\{-\\frac{66}{5},\\frac{4}{5}\\right\\}$\nDirectrix: $x=-\\frac{53}{4}$\nFocal Parameter: $\\frac{1}{10}$\nFocus: $\\left\\{-\\frac{263}{20},\\frac{4}{5}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x-5*y**2+8*y+10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{16}{7}-\\frac{8 i}{7}$ and $y=-\\frac{54}{7}-\\frac{4 i}{7}$", + "Output Answer": [ + "$10-\\frac{4 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = (16/7)-((8*i)/7)\ny = -(54/7)-((4*i)/7)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{6 x^2-4 x-15}{20-9 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(2-\\sqrt{94}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(2+\\sqrt{94}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((6*x**2-4*x-15)/(20-9*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^6+7 x^5+7 x^4-9 x^3-6 x^2+4 x+9$ when divided by $-x^5+9 x^4-2 x^3+7 x^2-8 x$.", + "Output Answer": [ + "$8 x+65$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**6+7*x**5+7*x**4-9*x**3-6*x**2+4*x+9\nq = -x**5+9*x**4-2*x**3+7*x**2-8*x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-11 x-9}+\\sqrt{-11 x-6}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{44305}{8624}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-11*x-9)+sqrt(-11*x-6), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$8 x-15 y+6=0$, $22 x-19 y-19=0$", + "Output Answer": [ + "$x=\\frac{399}{178}$, $y=\\frac{142}{89}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((8*x-15*y+6, 22*x-19*y-19), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2-132 x+1064$", + "Output Answer": [ + "$-4 (14-x) (x-19)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2-132*x+1064, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$14 x+8 y+18 z+17=0$, $19 x-12 y-6 z-22=0$, $-25 x+25 y-23 z=0$", + "Output Answer": [ + "$x=\\frac{3353}{6905}$, $y=-\\frac{7163}{13810}$, $z=-\\frac{3015}{2762}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((14*x+8*y+18*z+17, 19*x-12*y-6*z-22, -25*x+25*y-23*z)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{55}{52}$, and $a_n=a_{n-1}+-\\frac{43}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$-\\frac{4747}{52}$" + ], + "Output Program": [ + "a = -(55/52) # initial value\nd = -(43/5) # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(55/52) # initial value\nd = -(43/5) # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{6 x^2-6 x-7}{\\sqrt{\\pi }}$, $q(x) = -\\frac{2 \\left(5 x^2-13 x+11\\right)}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{4 x^2}{\\sqrt{\\pi }}+\\frac{20 x}{\\sqrt{\\pi }}-\\frac{29}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((6*x**2-6*x-7)/(sqrt(pi)))\nq = -((2*(5*x**2-13*x+11))/(sqrt(pi)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{399 x^2}{2}+\\frac{7 x}{2}-350}{\\frac{225}{2}-\\frac{171 x}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{4}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((399*x**2)/2)+((7*x)/2)-350)/((225/2)-((171*x)/2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^4-4 x^3-x^2+x+7$ when divided by $8 x^2-10 x-6$.", + "Output Answer": [ + "$-\\frac{9 x^2}{8}-\\frac{61 x}{32}-\\frac{429}{128}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**4-4*x**3-x**2+x+7\nq = 8*x**2-10*x-6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-7 \\sqrt{5} x+\\sqrt{5} y+2 \\sqrt{5} z+6 \\sqrt{5}=0$, $4 \\sqrt{5} x-5 \\sqrt{5} y-8 \\sqrt{5} z+8 \\sqrt{5}=0$, $-7 \\sqrt{5} x+11 \\sqrt{5} y+4 \\sqrt{5} z+5 \\sqrt{5}=0$", + "Output Answer": [ + "$x=\\frac{281}{209}$, $y=-\\frac{56}{209}$, $z=\\frac{769}{418}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-7*sqrt(5)*x+sqrt(5)*y+2*sqrt(5)*z+6*sqrt(5), 4*sqrt(5)*x-5*sqrt(5)*y-8*sqrt(5)*z+8*sqrt(5), -7*sqrt(5)*x+11*sqrt(5)*y+4*sqrt(5)*z+5*sqrt(5))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $20 x^6-7 x^5-23 x^4-9 x^3+19 x^2+5 x$ and $5 x^4-3 x^3-5 x^2-x+5$.", + "Output Answer": [ + "$5 x^4-3 x^3-5 x^2-x+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(20*x**6-7*x**5-23*x**4-9*x**3+19*x**2+5*x, 5*x**4-3*x**3-5*x**2-x+5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{4 x^2}{5}-\\frac{32 x}{5}+\\frac{12}{5}$ when divided by $\\frac{38 x}{5}+\\frac{27}{5}$.", + "Output Answer": [ + "$-\\frac{2 x}{19}-\\frac{277}{361}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((4*x**2)/5)-((32*x)/5)+(12/5)\nq = ((38*x)/5)+(27/5)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-2+2 i$ and $y=-\\frac{26}{3}-\\frac{20 i}{3}$", + "Output Answer": [ + "$\\frac{9}{269}-\\frac{69 i}{269}$" + ], + "Output Program": [ + "i = 1j\nx = -2+2*i\ny = -(26/3)-((20*i)/3)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{89 x^2}{7}+\\frac{11 x}{7}-\\frac{57}{7}$", + "Output Answer": [ + "$\\frac{89}{7} \\left(x+\\frac{11}{178}\\right)^2-\\frac{20413}{2492}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((89*x**2)/7)+((11*x)/7)-(57/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $15 x^2-x+11$", + "Output Answer": [ + "$15 \\left(x-\\frac{1}{30}\\right)^2+\\frac{659}{60}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (15*x**2-x+11), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{29 x}{7}+\\frac{67}{7}}+\\sqrt{\\frac{80 x}{7}-\\frac{12}{7}}=\\frac{76}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{657787-304 \\sqrt{3859519}}{18207}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((29*x)/7)+(67/7))+sqrt(((80*x)/7)-(12/7)), (76/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{25}{4} \\left(32 t^2-240 t+451\\right)^2, x(t)=16 t^2-120 t+225$", + "Output Answer": [ + "$y=25 x^2+25 x+\\frac{25}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (25/4)*(32*t**2-240*t+451)**2\nx_t = 16*t**2-120*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\sqrt{2} \\left(-\\cos \\left(\\frac{19 \\pi }{90}\\right)-i \\sin \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$26873856 \\left(\\sin \\left(\\frac{17 \\pi }{90}\\right)-i \\cos \\left(\\frac{17 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*math.sqrt(2)*(-math.cos(((19*math.pi)/90))-1j*math.sin(((19*math.pi)/90))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $8 e^{-\\frac{11 i \\pi }{15}}$.", + "Output Answer": [ + "Norm: $8$\nArgument: $-\\frac{11 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 8*math.e**(-((11*i*math.pi)/15))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{35}{4}-\\frac{13 i}{2}$ and $y=-\\frac{5}{4}-2 i$", + "Output Answer": [ + "$-\\frac{33}{16}+\\frac{205 i}{8}$" + ], + "Output Program": [ + "i = 1j\nx = -(35/4)-((13*i)/2)\ny = -(5/4)-2*i\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-23 x+19 z+18=0$, $-23 x-21 y-12 z+13=0$, $-x-7 y+8 z-22=0$", + "Output Answer": [ + "$x=\\frac{2149}{1208}$, $y=-\\frac{17069}{8456}$, $z=\\frac{1457}{1208}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-23*x+19*z+18, -23*x-21*y-12*z+13, -x-7*y+8*z-22)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=6-10 i$ and $y=8-8 i$", + "Output Answer": [ + "$14-18 i$" + ], + "Output Program": [ + "i = 1j\nx = 6-10*i\ny = 8-8*i\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+2 x-5 y^2-8 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(x+\\frac{1}{4}\\right)^2-5 \\left(y+\\frac{4}{5}\\right)^2=-\\frac{39}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{4} & -\\frac{4}{5}-\\frac{3 \\sqrt{39}}{20} \\\\\n -\\frac{1}{4} & \\frac{3 \\sqrt{39}}{20}-\\frac{4}{5} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2}$\nCenter: $\\left\\{-\\frac{1}{4},-\\frac{4}{5}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{10} \\left(-8-\\sqrt{5}\\right)-\\frac{2 x}{\\sqrt{5}},y=\\frac{2 x}{\\sqrt{5}}+\\frac{1}{10} \\left(\\sqrt{5}-8\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+2*x-5*y**2-8*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 2 \\sqrt{2} (1-2 x), q(x) = 4 (x-4)^4$", + "Output Answer": [ + "$4 x^4-64 x^3+384 x^2-4 \\sqrt{2} x-1024 x+2 \\sqrt{2}+1024$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*sqrt(2)*(1-2*x)\nq = 4*(x-4)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-4 \\sqrt{2} x-8 \\sqrt{2} y=0$, $16 \\sqrt{2} x-13 \\sqrt{2} y-2 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{4}{45}$, $y=-\\frac{2}{45}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-4*sqrt(2)*x-8*sqrt(2)*y, 16*sqrt(2)*x-13*sqrt(2)*y-2*sqrt(2)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{21 \\left(\\cos \\left(\\frac{3 \\pi }{20}\\right)-i \\sin \\left(\\frac{3 \\pi }{20}\\right)\\right)}{e}$.", + "Output Answer": [ + "Norm: $\\frac{21 \\sqrt{\\sin ^2\\left(\\frac{3 \\pi }{20}\\right)+\\cos ^2\\left(\\frac{3 \\pi }{20}\\right)}}{e}$\nArgument: $-\\frac{3 \\pi }{20}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((21*(math.cos(((3*math.pi)/20))-i*math.sin(((3*math.pi)/20))))/math.e)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{38 x}{\\sqrt{3}}-\\frac{32}{\\sqrt{3}}\\right| =9 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{59}{38}\\right\\},\\left\\{x\\to -\\frac{5}{38}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((38*x)/(sqrt(3)))-(32/(sqrt(3)))), 9*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(23-8 t)^2, x(t)=8 t-15$", + "Output Answer": [ + "$y=x^2-16 x+64$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (23-8*t)**2\nx_t = 8*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2-\\frac{56 x}{\\sqrt{3}}-768$", + "Output Answer": [ + "$-4 \\left(\\frac{32}{\\sqrt{3}}-x\\right) \\left(x+6 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2-((56*x)/(sqrt(3)))-768, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^2+3 x-3$ and $-x^4+x^3-2 x^2-x-2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**2+3*x-3, -x**4+x**3-2*x**2-x-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{1}{12}$, and $a_n=a_{n-1}+3 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$\\frac{5}{2} \\left(\\frac{1}{6}+12 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (1/12) # initial value\nd = 3*math.sqrt(3) # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (1/12) # initial value\nd = 3*math.sqrt(3) # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -9 x^2-2 x+7\\right| =11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-1-\\sqrt{163}\\right)\\right\\},\\left\\{x\\to \\frac{1}{9} \\left(-1+\\sqrt{163}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-9*x**2-2*x+7), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{2 \\sqrt{2} x^2-16 \\sqrt{2} x-8 \\sqrt{2}}{6 \\sqrt{2} x+7 \\sqrt{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 4-2 \\sqrt{5}\\right\\},\\left\\{x\\to 4+2 \\sqrt{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((2*sqrt(2)*x**2-16*sqrt(2)*x-8*sqrt(2))/(6*sqrt(2)*x+7*sqrt(2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{8 x^2-25 x+39}{e}$, $q(x) = \\frac{18 x^2+19 x+23}{e}$", + "Output Answer": [ + "$\\frac{26 x^2}{e}-\\frac{6 x}{e}+\\frac{62}{e}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x\n\np = ((8*x**2-25*x+39)/math.e)\nq = ((18*x**2+19*x+23)/math.e)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(\\cos \\left(\\frac{22}{15}\\right)+i \\sin \\left(\\frac{22}{15}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$282475249 \\left(\\cos \\left(\\frac{44}{3}\\right)+i \\sin \\left(\\frac{44}{3}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(math.cos((22/15))+1j*math.sin((22/15))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-x^2+6 x+11$", + "Output Answer": [ + "$x=3-2 \\sqrt{5}\\lor x=3+2 \\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-x**2+6*x+11, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$17 x-3 y+5 z+16=0$, $-3 x+17 y-z+20=0$, $-13 x-12 y-14 z-10=0$", + "Output Answer": [ + "$x=-\\frac{2610}{1439}$, $y=-\\frac{1972}{1439}$, $z=\\frac{3086}{1439}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((17*x-3*y+5*z+16, -3*x+17*y-z+20, -13*x-12*y-14*z-10)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-2 e^{\\frac{i \\pi }{30}}$.", + "Output Answer": [ + "Norm: $2$\nArgument: $-\\frac{29 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -2*math.e**((i*math.pi)/30)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{53}{6}$, and $a_n=a_{n-1}+-\\frac{9}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=12$.", + "Output Answer": [ + "$-403$" + ], + "Output Program": [ + "a = -(53/6) # initial value\nd = -(9/2) # second term\nn = 12 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(53/6) # initial value\nd = -(9/2) # second term\nn = 12 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-2.-3.9 i$ and $y=-3.9-0.8 i$", + "Output Answer": [ + "$4.68\\, +16.81 i$" + ], + "Output Program": [ + "i = 1j\nx = -2.-3.9*i\ny = -3.9-0.8*i\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2+9 x+7 y^2+y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(y+\\frac{1}{14}\\right)^2-7 \\left(x-\\frac{9}{14}\\right)^2=-\\frac{55}{7}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{14} \\left(9-2 \\sqrt{110}\\right) & -\\frac{1}{14} \\\\\n \\frac{1}{14} \\left(9+2 \\sqrt{110}\\right) & -\\frac{1}{14} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{14} \\left(9-2 \\sqrt{110}\\right)+\\frac{1}{14} \\left(9+2 \\sqrt{110}\\right)\\right),-\\frac{1}{14}\\right\\}$\nAsymptotes: $\\left\\{y=x-\\frac{5}{7},y=\\frac{4}{7}-x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2+9*x+7*y**2+y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(-\\cos \\left(\\frac{19 \\pi }{90}\\right)+i \\sin \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$4096 \\left(-\\sin \\left(\\frac{7 \\pi }{30}\\right)+i \\cos \\left(\\frac{7 \\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(-math.cos(((19*math.pi)/90))+1j*math.sin(((19*math.pi)/90))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-11 \\sqrt{2} x-2 \\sqrt{2} y=0$, $10 \\sqrt{2} x-10 \\sqrt{2} y-\\frac{5}{\\sqrt{2}}=0$", + "Output Answer": [ + "$x=\\frac{1}{26}$, $y=-\\frac{11}{52}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-11*sqrt(2)*x-2*sqrt(2)*y, 10*sqrt(2)*x-10*sqrt(2)*y-(5/(sqrt(2)))), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4$ and $2 x^4+2 x^3+3 x^2-2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4, 2*x**4+2*x**3+3*x**2-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-19 x-23 y+11=0$, $2 x-14 y+7=0$", + "Output Answer": [ + "$x=-\\frac{7}{312}$, $y=\\frac{155}{312}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-19*x-23*y+11, 2*x-14*y+7), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -22 x^2-4 x+12\\right| =14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{13}{11}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-22*x**2-4*x+12), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{16 \\left(\\cos \\left(\\frac{41}{45}\\right)+i \\sin \\left(\\frac{41}{45}\\right)\\right)}{\\sqrt{3}}\\right)^10$", + "Output Answer": [ + "$\\frac{1099511627776}{243} \\left(\\cos \\left(\\frac{82}{9}\\right)+i \\sin \\left(\\frac{82}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((16*(math.cos((41/45))+1j*math.sin((41/45))))/(math.sqrt(3))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-2 x^2-11 x-3}{15 x^2-4 x+22}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-11-\\sqrt{97}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(-11+\\sqrt{97}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-2*x**2-11*x-3)/(15*x**2-4*x+22)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$e^{-3 x/2}$", + "Output Answer": [ + "$\\frac{\\left(x-e^{9/2}\\right)^2}{3 e^9}-\\frac{2 \\left(x-e^{9/2}\\right)}{3 e^{9/2}}-3$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, math.e**(-3*x/2))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{2 x^5}{5}-\\frac{11 x^4}{5}-\\frac{12 x^3}{5}-4 x^2+\\frac{47 x}{5}-\\frac{17}{5}$ when divided by $-8 x^3+\\frac{x^2}{5}-\\frac{29 x}{5}+6$.", + "Output Answer": [ + "$\\frac{x^2}{20}+\\frac{221 x}{800}+\\frac{8661}{32000}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((2*x**5)/5)-((11*x**4)/5)-((12*x**3)/5)-4*x**2+((47*x)/5)-(17/5)\nq = -8*x**3+((x**2)/5)-((29*x)/5)+6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-9-i$ and $y=-8+9 i$", + "Output Answer": [ + "$81-73 i$" + ], + "Output Program": [ + "i = 1j\nx = -9-i\ny = -8+9*i\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-11 \\sqrt{2} x-\\sqrt{2} y+15 \\sqrt{2} z-14 \\sqrt{2}=0$, $-12 \\sqrt{2} x+14 \\sqrt{2} y-11 \\sqrt{2} z-17 \\sqrt{2}=0$, $-13 \\sqrt{2} x+8 \\sqrt{2} y+3 \\sqrt{2} z+13 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{6498}{319}$, $y=-\\frac{9173}{319}$, $z=-\\frac{5079}{319}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-11*sqrt(2)*x-sqrt(2)*y+15*sqrt(2)*z-14*sqrt(2), -12*sqrt(2)*x+14*sqrt(2)*y-11*sqrt(2)*z-17*sqrt(2), -13*sqrt(2)*x+8*sqrt(2)*y+3*sqrt(2)*z+13*sqrt(2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^4+5 x^3+x^2-9 x+6$ when divided by $-2$.", + "Output Answer": [ + "$-\\frac{9 x^4}{2}-\\frac{5 x^3}{2}-\\frac{x^2}{2}+\\frac{9 x}{2}-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**4+5*x**3+x**2-9*x+6\nq = -2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-5 x^2-4 x-3$ and $-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-5*x**2-4*x-3, -1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\left(\\left((21+13)^2+16\\right)^2-23\\right)-17}{24+13}$.", + "Output Answer": [ + "$\\frac{1373544}{37}$" + ], + "Output Program": [ + "try: \n print((((((21+13)**2+16)**2-23)-17)/(24+13)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{12+12 i}{\\sqrt{\\pi }}$ and $y=\\frac{12+3 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{108+180 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((12+12*i)/(math.sqrt(math.pi)))\ny = ((12+3*i)/(math.sqrt(math.pi)))\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left((12-5)^2-18\\right)-15\\right)-1\\right) ((16+13)+1)$.", + "Output Answer": [ + "$450$" + ], + "Output Program": [ + "try: \n print(((((12-5)**2-18)-15)-1)*((16+13)+1))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=9 t+10, x(t)=-9 t-15$", + "Output Answer": [ + "$y=-x-5$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 9*t+10\nx_t = -9*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(-\\sin \\left(\\frac{11 \\pi }{90}\\right)-i \\cos \\left(\\frac{11 \\pi }{90}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$256 \\left(\\sin \\left(\\frac{\\pi }{90}\\right)-i \\cos \\left(\\frac{\\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(-math.sin(((11*math.pi)/90))-1j*math.cos(((11*math.pi)/90))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{67}{3}$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$3762$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (67/3) # initial value\nd = 9 # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (67/3) # initial value\nd = 9 # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{17 x}{3}+\\frac{44}{3}}+\\sqrt{\\frac{38 x}{3}-4}=\\frac{17}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{19423-34 \\sqrt{304882}}{1323}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((17*x)/3)+(44/3))+sqrt(((38*x)/3)-4), (17/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{38 x^3+250 x^2+170 x+22}{-266 x-154}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -3-2 \\sqrt{2}\\right\\},\\left\\{x\\to -3+2 \\sqrt{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((38*x**3+250*x**2+170*x+22)/(-266*x-154)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(\\frac{1}{4} \\left(1+\\sqrt{5}\\right)+i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)\\right)^6$", + "Output Answer": [ + "$729 \\left(\\frac{1}{4} \\left(-1-\\sqrt{5}\\right)-i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*((1/4)*(1+math.sqrt(5))+1j*math.sqrt((5/8)-((math.sqrt(5))/8))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{25 x^2}{\\sqrt{3}}+\\frac{7 x}{\\sqrt{3}}-\\frac{8}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{25 \\left(x-\\frac{7}{50}\\right)^2}{\\sqrt{3}}-\\frac{751}{100 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((25*x**2)/(math.sqrt(3)))+((7*x)/(math.sqrt(3)))-(8/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 2 x+21| =11$", + "Output Answer": [ + "$\\{\\{x\\to -16\\},\\{x\\to -5\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(2*x+21), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -3 \\sqrt{3} (x-2)^3, q(x) = 5625 (x-1)^4$", + "Output Answer": [ + "$5625 x^4-3 \\sqrt{3} x^3-22500 x^3+18 \\sqrt{3} x^2+33750 x^2-36 \\sqrt{3} x-22500 x+24 \\sqrt{3}+5625$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*sqrt(3)*(x-2)**3\nq = 5625*(x-1)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 5 x-15| =-4$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(5*x-15), -4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\sqrt{3} x^2+9 \\sqrt{3} x-6 \\sqrt{3}}{12 \\sqrt{3} x^2-11 \\sqrt{3} x+14 \\sqrt{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(9-\\sqrt{57}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(9+\\sqrt{57}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-sqrt(3)*x**2+9*sqrt(3)*x-6*sqrt(3))/(12*sqrt(3)*x**2-11*sqrt(3)*x+14*sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^3+\\frac{7 x^2}{2}+\\frac{3 x}{2}+10$ when divided by $5 x^2+2 x-2$.", + "Output Answer": [ + "$\\frac{4 x}{5}+\\frac{19}{50}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**3+((7*x**2)/2)+((3*x)/2)+10\nq = 5*x**2+2*x-2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{5}{16}-23\\right)+\\frac{1}{2} \\left(\\frac{1}{12} (3-6)^2+19\\right)^2$.", + "Output Answer": [ + "$\\frac{5515}{32}$" + ], + "Output Program": [ + "try: \n print(((5/16)-23)+(1/2)*((1/12)*(3-6)**2+19)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\log (2-x)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 2-e^y\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, log(2-x))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(16-15)+((17-25)-16)^2$.", + "Output Answer": [ + "$577$" + ], + "Output Program": [ + "try: \n print((16-15)+((17-25)-16)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-14 x^2+5 x+11$", + "Output Answer": [ + "$x=\\frac{1}{28} \\left(5-\\sqrt{641}\\right)\\lor x=\\frac{1}{28} \\left(5+\\sqrt{641}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-14*x**2+5*x+11, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\tan \\left(3 x^3+4\\right)-\\cos (6-5 x)$ at the point $x=0$", + "Output Answer": [ + "$-\\cos (6)+\\tan (4) = 0.198$" + ], + "Output Program": [ + "import math\n\nx = 0\ntry: \n f = math.tan(3*x**3+4)-math.cos(6-5*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{\\left(104544 t^2+498960 t+595301\\right)^2}{117649}, x(t)=\\frac{1936 t^2}{49}+\\frac{1320 t}{7}+225$", + "Output Answer": [ + "$y=\\frac{2916 x^2}{49}-\\frac{108 x}{49}+\\frac{1}{49}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (((104544*t**2+498960*t+595301)**2)/117649)\nx_t = ((1936*t**2)/49)+((1320*t)/7)+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{32}{61}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{96}{61}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (32/61) # initial value\nd = 0 # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (32/61) # initial value\nd = 0 # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{29}{4}-\\frac{27 i}{4}$ and $y=-\\frac{9}{4}+\\frac{3 i}{2}$", + "Output Answer": [ + "$5-\\frac{21 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = (29/4)-((27*i)/4)\ny = -(9/4)+((3*i)/2)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(9-17)+\\frac{1}{25} \\left(\\frac{1}{17} \\left(\\frac{9}{19}+4\\right)\\right)$.", + "Output Answer": [ + "$-\\frac{759}{95}$" + ], + "Output Program": [ + "try: \n print((9-17)+(1/25)*((1/17)*((9/19)+4)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\cos ^{-1}(-7)$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = acos(-7)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{7}{50}$, and $a_n=a_{n-1}+7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{4207}{2}$" + ], + "Output Program": [ + "a = (7/50) # initial value\nd = 7 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (7/50) # initial value\nd = 7 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{46 x}{3}+\\frac{28}{3}\\right| =\\frac{61}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{89}{46}\\right\\},\\left\\{x\\to \\frac{33}{46}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((46*x)/3)+(28/3)), (61/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-9 \\left(-256 t^2+32 \\left(\\sqrt{3}-36\\right) t+72 \\sqrt{3}-1299\\right), x(t)=-4 \\sqrt{3} t-9 \\sqrt{3}$", + "Output Answer": [ + "$y=48 x^2+72 x+27$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -9*(-256*t**2+32*(sqrt(3)-36)*t+72*sqrt(3)-1299)\nx_t = -4*sqrt(3)*t-9*sqrt(3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(2-2 i) \\pi$ and $y=(-2-i) \\pi$", + "Output Answer": [ + "$(4-i) \\pi$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (2-2*i)*math.pi\ny = (-2-i)*math.pi\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(((10+16)+20)^2+2\\right)+17\\right) (20-14)$.", + "Output Answer": [ + "$12810$" + ], + "Output Program": [ + "try: \n print(((((10+16)+20)**2+2)+17)*(20-14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{1}{3}+\\frac{4 i}{3}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{17}}{3}$\nArgument: $\\tan ^{-1}(4)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (1/3)+((4*i)/3)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -12 x^2-6 x-4\\right| =22$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{2}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-12*x**2-6*x-4), 22), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{12 x+6}+\\sqrt{12 x+12}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{239}{1200}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(12*x+6)+sqrt(12*x+12), 5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 6 x-20| =24$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{2}{3}\\right\\},\\left\\{x\\to \\frac{22}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(6*x-20), 24), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2$ and $4 x^2+5 x-4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2, 4*x**2+5*x-4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-7 x^2+2 x+13$", + "Output Answer": [ + "$\\frac{92}{7}-7 \\left(x-\\frac{1}{7}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-7*x**2+2*x+13), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{10+13 i}{\\sqrt{2}}$ and $y=\\frac{10+3 i}{\\sqrt{2}}$", + "Output Answer": [ + "$5 i \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((10+13*i)/(math.sqrt(2)))\ny = ((10+3*i)/(math.sqrt(2)))\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x^2$ and $-4 x^5+x^4-x^3-5 x^2-4 x+1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x**2, -4*x**5+x**4-x**3-5*x**2-4*x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$3 \\sqrt{2} x-7 \\sqrt{2} y-12 \\sqrt{2}=0$, $3 \\sqrt{2} x+3 \\sqrt{2} y+9 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{9}{10}$, $y=-\\frac{21}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((3*sqrt(2)*x-7*sqrt(2)*y-12*sqrt(2), 3*sqrt(2)*x+3*sqrt(2)*y+9*sqrt(2)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-12 x^2+13 x+14$", + "Output Answer": [ + "$\\frac{841}{48}-12 \\left(x-\\frac{13}{24}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-12*x**2+13*x+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $9 x^3+162 x^2+\\frac{2637 x}{4}+\\frac{2025}{4}$", + "Output Answer": [ + "$-9 \\left(-x-\\frac{9}{2}\\right) (x+1) \\left(x+\\frac{25}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(9*x**3+162*x**2+((2637*x)/4)+(2025/4), a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{1}{12} (((17+20)-19)-17)\\right) \\left(\\frac{1}{11} ((7+6)-9)+21\\right)$.", + "Output Answer": [ + "$\\frac{235}{132}$" + ], + "Output Program": [ + "try: \n print(((1/12)*(((17+20)-19)-17))*((1/11)*((7+6)-9)+21))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\tan (9 x+4)$", + "Output Answer": [ + "$\\frac{9 x+4}{\\pi }+\\frac{1}{2}\\notin \\mathbb{Z}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = tan(9*x+4)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{13 x}{3}-\\frac{32}{3}}+\\sqrt{6 x-12}=\\frac{5}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{15} \\left(167-6 \\sqrt{470}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((13*x)/3)-(32/3))+sqrt(6*x-12), (5/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{55}{91}$, and $a_n=a_{n-1}+\\frac{17}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$13 \\left(\\frac{110}{91}+\\frac{425}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (55/91) # initial value\nd = (17/(math.sqrt(3))) # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (55/91) # initial value\nd = (17/(math.sqrt(3))) # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-18 x-16 y+6 z+16=0$, $-x+2 y+6 z+9=0$, $-16 x+y+4 z-2=0$", + "Output Answer": [ + "$x=-\\frac{439}{811}$, $y=\\frac{730}{811}$, $z=-\\frac{1533}{811}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-18*x-16*y+6*z+16, -x+2*y+6*z+9, -16*x+y+4*z-2)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 6 x-10 x^2\\right| =-11$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(6*x-10*x**2), -11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{14 \\left(\\cos \\left(\\frac{101}{90}\\right)+i \\sin \\left(\\frac{101}{90}\\right)\\right)}{\\sqrt{3}}\\right)^6$", + "Output Answer": [ + "$\\frac{7529536}{27} \\left(\\cos \\left(\\frac{101}{15}\\right)+i \\sin \\left(\\frac{101}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((14*(math.cos((101/90))+1j*math.sin((101/90))))/(math.sqrt(3))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-3 i \\pi$ and $y=(-2+i) \\pi$", + "Output Answer": [ + "$(3+6 i) \\pi ^2$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -3*i*math.pi\ny = (-2+i)*math.pi\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $6 x^5-3 x^4-6 x^3+6 x^2+9 x$ and $2 x^4-x^3-2 x^2+2 x+3$.", + "Output Answer": [ + "$2 x^4-x^3-2 x^2+2 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(6*x**5-3*x**4-6*x**3+6*x**2+9*x, 2*x**4-x**3-2*x**2+2*x+3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{6-x^2}$ at the point $x=2$", + "Output Answer": [ + "$\\sqrt{2} = 1.414$" + ], + "Output Program": [ + "import math\n\nx = 2\ntry: \n f = math.sqrt(6-x**2)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{32}{5} \\left(-\\sin \\left(\\frac{17 \\pi }{90}\\right)-i \\cos \\left(\\frac{17 \\pi }{90}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$\\frac{1024}{25} \\left(-\\sin \\left(\\frac{11 \\pi }{90}\\right)+i \\cos \\left(\\frac{11 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((32/5)*(-math.sin(((17*math.pi)/90))-1j*math.cos(((17*math.pi)/90))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{13 x^2}{\\sqrt{3}}+\\frac{10 x}{\\sqrt{3}}-\\frac{14}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{13} \\left(-5-3 \\sqrt{23}\\right)\\lor x=\\frac{1}{13} \\left(3 \\sqrt{23}-5\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((13*x**2)/(sqrt(3)))+((10*x)/(sqrt(3)))-(14/(sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{3 x^2}{\\sqrt{2}}+3 \\sqrt{2} x+3 \\sqrt{2}$", + "Output Answer": [ + "$\\frac{3 (x+1)^2}{\\sqrt{2}}+3 \\sqrt{2}-\\frac{3}{\\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((3*x**2)/(math.sqrt(2)))+3*math.sqrt(2)*x+3*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{100}{7}$, and $a_n=a_{n-1}+-\\frac{19}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$\\frac{1202}{35}$" + ], + "Output Program": [ + "a = (100/7) # initial value\nd = -(19/5) # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (100/7) # initial value\nd = -(19/5) # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(\\cos \\left(\\frac{17 \\pi }{90}\\right)+i \\sin \\left(\\frac{17 \\pi }{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$1024 \\left(-\\cos \\left(\\frac{\\pi }{18}\\right)+i \\sin \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(math.cos(((17*math.pi)/90))+1j*math.sin(((17*math.pi)/90))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-3 x+19 y-8=0$, $12 x+22 y-6=0$", + "Output Answer": [ + "$x=-\\frac{31}{147}$, $y=\\frac{19}{49}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-3*x+19*y-8, 12*x+22*y-6), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$3 x-16 y+18 z+14=0$, $-4 x-22 y-7 z-14=0$, $-10 x-20 y+11 z-7=0$", + "Output Answer": [ + "$x=-\\frac{3164}{2745}$, $y=-\\frac{343}{1830}$, $z=-\\frac{413}{549}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((3*x-16*y+18*z+14, -4*x-22*y-7*z-14, -10*x-20*y+11*z-7)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{27 x}{2}-1}+\\sqrt{-\\frac{3 x}{2}-\\frac{17}{2}}=\\frac{23}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{192} \\left(-2525+23 \\sqrt{2345}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((27*x)/2)-1)+sqrt(-((3*x)/2)-(17/2)), (23/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $12 x^3-3 x^2+9 x$ and $-3 x$.", + "Output Answer": [ + "$3 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(12*x**3-3*x**2+9*x, -3*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\sqrt{5} x+11 \\sqrt{5}\\right| =-2 \\sqrt{5}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(sqrt(5)*x+11*sqrt(5)), -2*sqrt(5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10 x-14}+\\sqrt{10 x+2}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{56281}{9000}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10*x-14)+sqrt(10*x+2), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{5 x^2-22 x+5}{-9 x-18}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(11-4 \\sqrt{6}\\right)\\right\\},\\left\\{x\\to \\frac{1}{5} \\left(11+4 \\sqrt{6}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((5*x**2-22*x+5)/(-9*x-18)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 x^2-7 x+3$ and $q(x) = 6-9 x^2$", + "Output Answer": [ + "$45 x^4+63 x^3-57 x^2-42 x+18$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -5*x**2-7*x+3\nq = 6-9*x**2\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{36 x}{7}+\\frac{29}{7}}+\\sqrt{\\frac{66 x}{7}+\\frac{12}{7}}=\\frac{29}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{525} \\left(7446-29 \\sqrt{64151}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((36*x)/7)+(29/7))+sqrt(((66*x)/7)+(12/7)), (29/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 23 x^2+3 x-3\\right| =12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{46} \\left(-3-\\sqrt{1389}\\right)\\right\\},\\left\\{x\\to \\frac{1}{46} \\left(-3+\\sqrt{1389}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(23*x**2+3*x-3), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 \\sqrt{2} x^2-8 \\sqrt{2} x-\\sqrt{2}$ and $q(x) = 7 \\sqrt{2} x^2+9 \\sqrt{2} x+3 \\sqrt{2}$", + "Output Answer": [ + "$28 x^4-76 x^3-146 x^2-66 x-6$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*sqrt(2)*x**2-8*sqrt(2)*x-sqrt(2)\nq = 7*sqrt(2)*x**2+9*sqrt(2)*x+3*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{14 x-15}+\\sqrt{14 x+14}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1891}{1134}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(14*x-15)+sqrt(14*x+14), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2 e \\left(-\\sin \\left(\\frac{\\pi }{15}\\right)-i \\cos \\left(\\frac{\\pi }{15}\\right)\\right)$.", + "Output Answer": [ + "Norm: $2 e \\sqrt{\\sin ^2\\left(\\frac{\\pi }{15}\\right)+\\cos ^2\\left(\\frac{\\pi }{15}\\right)}$\nArgument: $-\\frac{17 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2*math.e*(-math.sin((math.pi/15))-i*math.cos((math.pi/15)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{11 x}{4}+\\frac{27 y}{4}-\\frac{91 z}{4}-\\frac{33}{2}=0$, $\\frac{27 x}{2}+\\frac{11 y}{2}+\\frac{23 z}{4}+\\frac{29}{4}=0$, $-3 x+3 y-\\frac{5 z}{4}+\\frac{45}{2}=0$", + "Output Answer": [ + "$x=\\frac{233793}{87400}$, $y=-\\frac{497897}{87400}$, $z=-\\frac{1203}{575}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((11*x)/4)+((27*y)/4)-((91*z)/4)-(33/2), ((27*x)/2)+((11*y)/2)+((23*z)/4)+(29/4), -3*x+3*y-((5*z)/4)+(45/2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $12 x^2-\\frac{11 x}{2}-14$", + "Output Answer": [ + "$12 \\left(x-\\frac{11}{48}\\right)^2-\\frac{2809}{192}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (12*x**2-((11*x)/2)-14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^4+4 x^3-2 x^2+9$ when divided by $6 x^4-x^3-3 x^2+4 x+4$.", + "Output Answer": [ + "$-\\frac{5}{6}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**4+4*x**3-2*x**2+9\nq = 6*x**4-x**3-3*x**2+4*x+4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{102 x}{7}+\\frac{16 y}{7}+\\frac{74 z}{7}+\\frac{134}{7}=0$, $\\frac{173 x}{7}-\\frac{151 y}{7}-\\frac{96 z}{7}-\\frac{36}{7}=0$, $\\frac{69 x}{7}+5 y-\\frac{130 z}{7}+\\frac{92}{7}=0$", + "Output Answer": [ + "$x=-\\frac{135687}{136354}$, $y=-\\frac{173781}{136354}$, $z=-\\frac{22309}{136354}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((102*x)/7)+((16*y)/7)+((74*z)/7)+(134/7), ((173*x)/7)-((151*y)/7)-((96*z)/7)-(36/7), ((69*x)/7)+5*y-((130*z)/7)+(92/7))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-2 e^{-\\frac{13 i \\pi }{18}}$.", + "Output Answer": [ + "Norm: $2$\nArgument: $\\frac{5 \\pi }{18}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -2*math.e**(-((13*i*math.pi)/18))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{20}{17}$, and $a_n=a_{n-1}+-\\frac{19}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$-\\frac{18205}{34}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(20/17) # initial value\nd = -(19/2) # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(20/17) # initial value\nd = -(19/2) # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\sqrt{3} \\left(-\\cos \\left(\\frac{13 \\pi }{90}\\right)-i \\sin \\left(\\frac{13 \\pi }{90}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$3456 \\sqrt{3} \\left(\\cos \\left(\\frac{\\pi }{90}\\right)+i \\sin \\left(\\frac{\\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*math.sqrt(3)*(-math.cos(((13*math.pi)/90))-1j*math.sin(((13*math.pi)/90))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=3 \\left(27 t^2-6 \\left(81+\\sqrt{3}\\right) t+54 \\sqrt{3}+2188\\right), x(t)=\\sqrt{3} t-9 \\sqrt{3}$", + "Output Answer": [ + "$y=27 x^2-18 x+3$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 3*(27*t**2-6*(81+sqrt(3))*t+54*sqrt(3)+2188)\nx_t = sqrt(3)*t-9*sqrt(3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^5-x^4+9 x^3+7 x^2-6 x-2$ when divided by $8 x^2+2 x-7$.", + "Output Answer": [ + "$-\\frac{x^3}{4}-\\frac{x^2}{16}+\\frac{59 x}{64}+\\frac{151}{256}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**5-x**4+9*x**3+7*x**2-6*x-2\nq = 8*x**2+2*x-7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{182 x^2+41 x+2}{-247 x^2+105 x+22}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{14}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((182*x**2+41*x+2)/(-247*x**2+105*x+22)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $6 x^2+141 x+819$", + "Output Answer": [ + "$6 \\left(x+\\frac{21}{2}\\right) (x+13)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(6*x**2+141*x+819, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -2 e x-3 e$ and $q(x) = -4 e x^2-4 e x$", + "Output Answer": [ + "$8 e^2 x^3+20 e^2 x^2+12 e^2 x$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -2*math.e*x-3*math.e\nq = -4*math.e*x**2-4*math.e*x\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-15 x-6}+\\sqrt{-14 x-14}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -1413+308 \\sqrt{21}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-15*x-6)+sqrt(-14*x-14), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 x^2+13 x-7$", + "Output Answer": [ + "$x=\\frac{7}{6}\\lor x=1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*x**2+13*x-7, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 13 x^2-9 x-2$, $q(x) = 2 x^2+6 x-11$", + "Output Answer": [ + "$15 x^2-3 x-13$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 13*x**2-9*x-2\nq = 2*x**2+6*x-11\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2+4 x+10 y^2-2 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(y-\\frac{1}{10}\\right)^2-9 \\left(x-\\frac{2}{9}\\right)^2=-\\frac{121}{90}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{2}{9}-\\frac{11 \\sqrt{19}}{90} & \\frac{1}{10} \\\\\n \\frac{2}{9}+\\frac{11 \\sqrt{19}}{90} & \\frac{1}{10} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{19}{10}}$\nCenter: $\\left\\{\\frac{2}{9},\\frac{1}{10}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3 x}{\\sqrt{10}}+\\frac{1}{30} \\left(3-2 \\sqrt{10}\\right),y=\\frac{1}{30} \\left(3+2 \\sqrt{10}\\right)-\\frac{3 x}{\\sqrt{10}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2+4*x+10*y**2-2*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (5-3 x)^4, q(x) = (7 x+3)^3$", + "Output Answer": [ + "$81 x^4-197 x^3+1791 x^2-1311 x+652$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (5-3*x)**4\nq = (7*x+3)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+6 x-2 y^2-2 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x+\\frac{3}{8}\\right)^2-2 \\left(y+\\frac{1}{2}\\right)^2=\\frac{77}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{8} \\left(-3-\\sqrt{385}\\right) & -\\frac{1}{2} \\\\\n \\frac{1}{8} \\left(\\sqrt{385}-3\\right) & -\\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{5}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{8} \\left(-3-\\sqrt{385}\\right)+\\frac{1}{8} \\left(\\sqrt{385}-3\\right)\\right),-\\frac{1}{2}\\right\\}$\nAsymptotes: $\\left\\{y=2 x+\\frac{1}{4},y=-2 x-\\frac{5}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+6*x-2*y**2-2*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10 x+6}+\\sqrt{14 x-12}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(744-11 \\sqrt{4439}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10*x+6)+sqrt(14*x-12), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{2}{5} \\left(17 x^2+8 x-6\\right)$, $q(x) = \\frac{1}{5} \\left(-28 x^2+51 x+73\\right)$", + "Output Answer": [ + "$\\frac{6 x^2}{5}+\\frac{67 x}{5}+\\frac{61}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (2/5)*(17*x**2+8*x-6)\nq = (1/5)*(-28*x**2+51*x+73)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 14 x-2| =12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{7}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(14*x-2), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-7 x-2 y^2+7 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x-\\frac{7}{16}\\right)^2-2 \\left(y-\\frac{7}{4}\\right)^2=\\frac{77}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{16} \\left(7-\\sqrt{385}\\right) & \\frac{7}{4} \\\\\n \\frac{1}{16} \\left(7+\\sqrt{385}\\right) & \\frac{7}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{5}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{16} \\left(7-\\sqrt{385}\\right)+\\frac{1}{16} \\left(7+\\sqrt{385}\\right)\\right),\\frac{7}{4}\\right\\}$\nAsymptotes: $\\left\\{y=2 x+\\frac{7}{8},y=\\frac{21}{8}-2 x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-7*x-2*y**2+7*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sin (x+1)$ at the point $x=6$", + "Output Answer": [ + "$\\sin (7) = 0.657$" + ], + "Output Program": [ + "import math\n\nx = 6\ntry: \n f = math.sin(x+1)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{4}{27} \\left(64 t^2-832 t+2713\\right)^2, x(t)=\\frac{16 t^2}{3}-\\frac{208 t}{3}+\\frac{676}{3}$", + "Output Answer": [ + "$y=\\frac{64 x^2}{3}+32 x+12$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (4/27)*(64*t**2-832*t+2713)**2\nx_t = ((16*t**2)/3)-((208*t)/3)+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=2-7 i$ and $y=-3+8 i$", + "Output Answer": [ + "$-1+i$" + ], + "Output Program": [ + "i = 1j\nx = 2-7*i\ny = -3+8*i\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-11 x^2+8 x+8$", + "Output Answer": [ + "$x=\\frac{2}{11} \\left(2-\\sqrt{26}\\right)\\lor x=\\frac{2}{11} \\left(2+\\sqrt{26}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-11*x**2+8*x+8, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{((14+5)+12)+25}{((22+4)-13)+13}$.", + "Output Answer": [ + "$\\frac{28}{13}$" + ], + "Output Program": [ + "try: \n print(((((14+5)+12)+25)/(((22+4)-13)+13)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(5-20)+\\left(\\left((21+13)^2+12\\right)+10\\right)$.", + "Output Answer": [ + "$1163$" + ], + "Output Program": [ + "try: \n print((5-20)+(((21+13)**2+12)+10))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{23}{44}$, and $a_n=a_{n-1}+3$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$\\frac{13515}{44}$" + ], + "Output Program": [ + "a = -(23/44) # initial value\nd = 3 # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(23/44) # initial value\nd = 3 # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-10 x^2-110 x-300$", + "Output Answer": [ + "$-10 (x+5) (x+6)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-10*x**2-110*x-300, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (3, 3, \\frac{1}{7})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{883}}{7},\\tan ^{-1}\\left(21 \\sqrt{2}\\right),\\frac{\\pi }{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 3\ny = 3\nz = (1/7)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-10 x^2-130 \\sqrt{5} x-1800$", + "Output Answer": [ + "$10 \\left(-x-4 \\sqrt{5}\\right) \\left(x+9 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-10*x**2-130*sqrt(5)*x-1800, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$\\frac{1}{2^{2/3} \\sqrt[3]{x}}$", + "Output Answer": [ + "$-48 \\left(x+\\frac{1}{2}\\right)^2-12 \\left(x+\\frac{1}{2}\\right)-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, (1/(2**(2/3)*cbrt(x))))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{1}{98} (-210 x-210)=0$", + "Output Answer": [ + "$\\{\\{x\\to -1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve((1/98)*(-210*x-210), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $9 x^6+24 x^5+21 x^4-8 x^3-24 x^2-5 x+3$ and $3 x^4+5 x^3+3 x^2-4 x-3$.", + "Output Answer": [ + "$3 x^4+5 x^3+3 x^2-4 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(9*x**6+24*x**5+21*x**4-8*x**3-24*x**2-5*x+3, 3*x**4+5*x**3+3*x**2-4*x-3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{256}{625} (x-10)^4, q(x) = \\frac{1}{25} (34 x+9)^2$", + "Output Answer": [ + "$\\frac{256 x^4}{625}-\\frac{2048 x^3}{125}+292 x^2-\\frac{40348 x}{25}+\\frac{102481}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (256/625)*(x-10)**4\nq = (1/25)*(34*x+9)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^4+9 x^3-7 x^2+5 x+3$ when divided by $10 x+9$.", + "Output Answer": [ + "$\\frac{3 x^3}{5}+\\frac{9 x^2}{25}-\\frac{128 x}{125}+\\frac{1777}{1250}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**4+9*x**3-7*x**2+5*x+3\nq = 10*x+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{x^2}{3}-9 x+\\frac{20}{3}$", + "Output Answer": [ + "$\\frac{809}{12}-\\frac{1}{3} \\left(x+\\frac{27}{2}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((x**2)/3)-9*x+(20/3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$8 \\sqrt{3} x+11 \\sqrt{3} y-3 \\sqrt{3} z+3 \\sqrt{3}=0$, $10 \\sqrt{3} x+4 \\sqrt{3} y+\\sqrt{3} z+8 \\sqrt{3}=0$, $-9 \\sqrt{3} x+13 \\sqrt{3} y-6 \\sqrt{3} z+5 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{220}{233}$, $y=-\\frac{637}{233}$, $z=-\\frac{1516}{233}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((8*sqrt(3)*x+11*sqrt(3)*y-3*sqrt(3)*z+3*sqrt(3), 10*sqrt(3)*x+4*sqrt(3)*y+sqrt(3)*z+8*sqrt(3), -9*sqrt(3)*x+13*sqrt(3)*y-6*sqrt(3)*z+5*sqrt(3))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $13 e^{-\\frac{67 i \\pi }{90}} \\log (2)$.", + "Output Answer": [ + "Norm: $13 \\log (2)$\nArgument: $-\\frac{67 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 13*math.e**(-((67*i*math.pi)/90))*math.log(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\sqrt{5}, \\sqrt{5}, \\frac{1}{\\sqrt{2}})$", + "Output Answer": [ + "$\\left\\{\\sqrt{\\frac{21}{2}},\\tan ^{-1}\\left(2 \\sqrt{5}\\right),\\frac{\\pi }{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.sqrt(5)\ny = math.sqrt(5)\nz = (1/(math.sqrt(2)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(\\cos \\left(\\frac{5}{9}\\right)+i \\sin \\left(\\frac{5}{9}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$49 \\left(\\cos \\left(\\frac{10}{9}\\right)+i \\sin \\left(\\frac{10}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(math.cos((5/9))+1j*math.sin((5/9))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{55 x^2}{4}-\\frac{27 x}{4}-\\frac{13}{4}\\right| =-\\frac{29}{4}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((55*x**2)/4)-((27*x)/4)-(13/4)), -(29/4)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x^3+2 x^2-3 x+3$ and $4 x^3+2 x^2-3 x+3$.", + "Output Answer": [ + "$4 x^3+2 x^2-3 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x**3+2*x**2-3*x+3, 4*x**3+2*x**2-3*x+3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(\\cos \\left(\\frac{83}{90}\\right)+i \\sin \\left(\\frac{83}{90}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$64 \\left(\\cos \\left(\\frac{83}{30}\\right)+i \\sin \\left(\\frac{83}{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(math.cos((83/90))+1j*math.sin((83/90))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{34 x^2}{\\pi }-\\frac{19 x}{\\pi }-\\frac{17}{\\pi }$ and $q(x) = -\\frac{13 x^2}{\\pi }-\\frac{17 x}{\\pi }+\\frac{16}{\\pi }$", + "Output Answer": [ + "$\\frac{442 x^4}{\\pi ^2}+\\frac{825 x^3}{\\pi ^2}-\\frac{15 x}{\\pi ^2}-\\frac{272}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((34*x**2)/pi)-((19*x)/pi)-(17/pi)\nq = -((13*x**2)/pi)-((17*x)/pi)+(16/pi)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x-2$ and $3 x^2+2 x+3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x-2, 3*x**2+2*x+3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\tan ^{-1}(2 x+6)$", + "Output Answer": [ + "$-\\frac{\\pi }{2} 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2+23 \\sqrt{2} x-260$", + "Output Answer": [ + "$\\left(10 \\sqrt{2}-x\\right) \\left(x-13 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2+23*sqrt(2)*x-260, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x+6}+\\sqrt{6 x+6}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(605-44 \\sqrt{183}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x+6)+sqrt(6*x+6), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{13}{2} \\left(\\cos \\left(\\frac{13}{45}\\right)+i \\sin \\left(\\frac{13}{45}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$\\frac{815730721}{256} \\left(\\cos \\left(\\frac{104}{45}\\right)+i \\sin \\left(\\frac{104}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((13/2)*(math.cos((13/45))+1j*math.sin((13/45))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{x^2}{\\sqrt{2}}-\\frac{5 x}{\\sqrt{2}}+3 \\sqrt{2}$", + "Output Answer": [ + "$-\\frac{\\left(x+\\frac{5}{2}\\right)^2}{\\sqrt{2}}+3 \\sqrt{2}+\\frac{25}{4 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((x**2)/(math.sqrt(2)))-((5*x)/(math.sqrt(2)))+3*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{15-4 x}+\\sqrt{8 x+1}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(29-4 \\sqrt{61}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(15-4*x)+sqrt(8*x+1), 4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$7 x+22 y-z-7=0$, $8 x-6 y+19 z+22=0$, $25 x-6 y+20 z-20=0$", + "Output Answer": [ + "$x=\\frac{8873}{3393}$, $y=-\\frac{1415}{2262}$, $z=-\\frac{8335}{3393}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((7*x+22*y-z-7, 8*x-6*y+19*z+22, 25*x-6*y+20*z-20)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=81-54 t, x(t)=9 t-15$", + "Output Answer": [ + "$y=-6 x-9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 81-54*t\nx_t = 9*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2-4 x+3$ and $2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2-4*x+3, 2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $4 \\sqrt{5} x^2+5 \\sqrt{5} x-5 \\sqrt{5}$", + "Output Answer": [ + "$4 \\sqrt{5} \\left(x+\\frac{5}{8}\\right)^2-\\frac{105 \\sqrt{5}}{16}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (4*math.sqrt(5)*x**2+5*math.sqrt(5)*x-5*math.sqrt(5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-9 x+6 y^2+y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x-\\frac{9}{10}\\right)^2+6 \\left(y+\\frac{1}{12}\\right)^2=\\frac{1571}{120}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{60} \\left(54-\\sqrt{1571}\\right) & -\\frac{1}{12} \\\\\n \\frac{1}{60} \\left(54+\\sqrt{1571}\\right) & -\\frac{1}{12} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{6}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{60} \\left(54-\\sqrt{1571}\\right)+\\frac{1}{60} \\left(54+\\sqrt{1571}\\right)\\right),-\\frac{1}{12}\\right\\}$\nArea Enclosed: $\\frac{1571 \\pi }{120 \\sqrt{30}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-9*x+6*y**2+y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 x^2+13 x-13$, $q(x) = x (9 x-4)$", + "Output Answer": [ + "$18 x^2+9 x-13$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**2+13*x-13\nq = x*(9*x-4)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-12 x^2-2 x+19}{-4 x-24}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(-1-\\sqrt{229}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(-1+\\sqrt{229}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-12*x**2-2*x+19)/(-4*x-24)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-x^2-7 x+y^2-3 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $\\left(y-\\frac{3}{2}\\right)^2-\\left(x+\\frac{7}{2}\\right)^2=-7$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{7}{2}-\\sqrt{14} & \\frac{3}{2} \\\\\n \\sqrt{14}-\\frac{7}{2} & \\frac{3}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{-\\frac{7}{2},\\frac{3}{2}\\right\\}$\nAsymptotes: $\\{y=x+5,y=-x-2\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-x**2-7*x+y**2-3*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-10 \\left(-\\frac{\\sqrt{3}}{2}+\\frac{i}{2}\\right)\\right)^6$", + "Output Answer": [ + "$-1000000$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-10*(-((math.sqrt(3))/2)+(i/2)))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-14 x^2-\\frac{29 x}{3}-14$", + "Output Answer": [ + "$-14 \\left(x+\\frac{29}{84}\\right)^2-\\frac{6215}{504}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-14*x**2-((29*x)/3)-14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x-8}+\\sqrt{9 x-10}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{25} \\left(2207-52 \\sqrt{1481}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x-8)+sqrt(9*x-10), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{19 x^2}{2}+\\frac{19 x}{2}-\\frac{5}{2}$", + "Output Answer": [ + "$\\frac{19}{2} \\left(x+\\frac{1}{2}\\right)^2-\\frac{39}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((19*x**2)/2)+((19*x)/2)-(5/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 \\sqrt{3} (x+1), q(x) = -\\frac{512 (x+1)^3}{3 \\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{512 x^3}{3 \\sqrt{3}}-\\frac{512 x^2}{\\sqrt{3}}+4 \\sqrt{3} x-\\frac{512 x}{\\sqrt{3}}+4 \\sqrt{3}-\\frac{512}{3 \\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*sqrt(3)*(x+1)\nq = -((512*(x+1)**3)/(3*sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-7 x^2+24 x+15}{-15 x^2-3 x-21}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(12-\\sqrt{249}\\right)\\right\\},\\left\\{x\\to \\frac{1}{7} \\left(12+\\sqrt{249}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-7*x**2+24*x+15)/(-15*x**2-3*x-21)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-10 \\left(\\cos \\left(\\frac{3}{10}\\right)+i \\sin \\left(\\frac{3}{10}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$100000000 \\left(\\cos \\left(\\frac{12}{5}\\right)+i \\sin \\left(\\frac{12}{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-10*(math.cos((3/10))+1j*math.sin((3/10))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -7 \\sqrt{3} x^2+5 \\sqrt{3} x+6 \\sqrt{3}$ and $q(x) = 4 \\sqrt{3} x^2+6 \\sqrt{3} x+7 \\sqrt{3}$", + "Output Answer": [ + "$-84 x^4-66 x^3+15 x^2+213 x+126$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -7*sqrt(3)*x**2+5*sqrt(3)*x+6*sqrt(3)\nq = 4*sqrt(3)*x**2+6*sqrt(3)*x+7*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{x^2-7 x+7}{-19 x^2+3 x-10}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(7-\\sqrt{21}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(7+\\sqrt{21}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((x**2-7*x+7)/(-19*x**2+3*x-10)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\left(\\sin \\left(\\frac{\\pi }{18}\\right)-i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$64 \\left(-\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*(math.sin((math.pi/18))-1j*math.cos((math.pi/18))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $15 x^2+8 x-13$", + "Output Answer": [ + "$x=\\frac{1}{15} \\left(-4-\\sqrt{211}\\right)\\lor x=\\frac{1}{15} \\left(\\sqrt{211}-4\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(15*x**2+8*x-13, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2-\\frac{47 x}{2}-\\frac{1309}{16}$", + "Output Answer": [ + "$\\left(-x-\\frac{77}{4}\\right) \\left(x+\\frac{17}{4}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2-((47*x)/2)-(1309/16), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(4+16) (11-9)$.", + "Output Answer": [ + "$40$" + ], + "Output Program": [ + "try: \n print((4+16)*(11-9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4096 (t-2)^2, x(t)=8 t-15$", + "Output Answer": [ + "$y=64 x^2-128 x+64$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4096*(t-2)**2\nx_t = 8*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{1}{(5 x+1)^5}$ at the point $x=1$", + "Output Answer": [ + "$\\frac{1}{7776} = 0.$" + ], + "Output Program": [ + "x = 1\ntry: \n f = (1/((5*x+1)**5))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+8 x-9 y^2-10 y+9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x+\\frac{4}{7}\\right)^2-9 \\left(y+\\frac{5}{9}\\right)^2=-\\frac{598}{63}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{4}{7} & -\\frac{5}{9}-\\frac{4 \\sqrt{598}}{63} \\\\\n -\\frac{4}{7} & \\frac{4 \\sqrt{598}}{63}-\\frac{5}{9} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{4}{\\sqrt{7}}$\nCenter: $\\left\\{-\\frac{4}{7},-\\frac{5}{9}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{63} \\left(-35-12 \\sqrt{7}\\right)-\\frac{\\sqrt{7} x}{3},y=\\frac{\\sqrt{7} x}{3}+\\frac{1}{63} \\left(12 \\sqrt{7}-35\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+8*x-9*y**2-10*y+9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\sqrt{2} \\left(\\cos \\left(\\frac{17}{10}\\right)+i \\sin \\left(\\frac{17}{10}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$34012224 \\left(\\cos \\left(\\frac{102}{5}\\right)+i \\sin \\left(\\frac{102}{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*math.sqrt(2)*(math.cos((17/10))+1j*math.sin((17/10))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-5 \\sqrt{3} \\left(\\cos \\left(\\frac{101}{90}\\right)+i \\sin \\left(\\frac{101}{90}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$31640625 \\left(\\cos \\left(\\frac{404}{45}\\right)+i \\sin \\left(\\frac{404}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-5*math.sqrt(3)*(math.cos((101/90))+1j*math.sin((101/90))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $3 x^2+54 x+195$", + "Output Answer": [ + "$3 (x+5) (x+13)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(3*x**2+54*x+195, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-25 x+9 y-17 z+8=0$, $-21 x+13 y+3 z+5=0$, $-4 x-8 y-22 z+15=0$", + "Output Answer": [ + "$x=\\frac{1647}{728}$, $y=\\frac{2549}{728}$, $z=-\\frac{365}{364}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-25*x+9*y-17*z+8, -21*x+13*y+3*z+5, -4*x-8*y-22*z+15)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{11}{83}$, and $a_n=a_{n-1}+-2 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{27}{2} \\left(\\frac{22}{83}-52 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (11/83) # initial value\nd = -2*math.pi # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (11/83) # initial value\nd = -2*math.pi # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 2 x+20| =13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{33}{2}\\right\\},\\left\\{x\\to -\\frac{7}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(2*x+20), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $8 x^2+92 x-936$", + "Output Answer": [ + "$8 \\left(x-\\frac{13}{2}\\right) (x+18)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(8*x**2+92*x-936, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(22+19)-\\frac{9}{4}$.", + "Output Answer": [ + "$\\frac{155}{4}$" + ], + "Output Program": [ + "try: \n print((22+19)-(9/4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $14 x^2+14$", + "Output Answer": [ + "$14 x^2+14$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (14*x**2+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{21}{4}-\\frac{29 x}{2}}+\\sqrt{-\\frac{29 x}{4}-9}=\\frac{21}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{6}{29} \\left(-211+7 \\sqrt{789}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((21/4)-((29*x)/2))+sqrt(-((29*x)/4)-9), (21/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-12 x^2+2 x+15$", + "Output Answer": [ + "$\\frac{181}{12}-12 \\left(x-\\frac{1}{12}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-12*x**2+2*x+15), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $5 e^{\\frac{i \\pi }{30}}$.", + "Output Answer": [ + "Norm: $5$\nArgument: $\\frac{\\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 5*math.e**((i*math.pi)/30)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\sqrt{2} e^{-\\frac{7 i \\pi }{10}}$.", + "Output Answer": [ + "Norm: $\\sqrt{2}$\nArgument: $\\tan ^{-1}\\left(\\frac{\\Im\\left(e^{-\\frac{7 i \\pi }{10}}\\right)}{\\Re\\left(e^{-\\frac{7 i \\pi }{10}}\\right)}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.sqrt(2)*math.e**(-((7*i*math.pi)/10))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5-9 x}+\\sqrt{8-9 x}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{6044}{1521}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5-9*x)+sqrt(8-9*x), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{14-9 x}+\\sqrt{14-3 x}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{10}{3} \\left(-10+\\sqrt{89}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(14-9*x)+sqrt(14-3*x), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{13 x}{5}+\\frac{73}{5}}+\\sqrt{\\frac{56 x}{5}-10}=\\frac{62}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{291681-124 \\sqrt{3817102}}{9245}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((13*x)/5)+(73/5))+sqrt(((56*x)/5)-10), (62/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{5}}, 8, \\frac{1}{7})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{\\frac{15734}{5}}}{7},\\tan ^{-1}\\left(7 \\sqrt{\\frac{321}{5}}\\right),\\tan ^{-1}\\left(8 \\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(5)))\ny = 8\nz = (1/7)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=2-4 i$ and $y=9+3 i$", + "Output Answer": [ + "$\\frac{1}{15}-\\frac{7 i}{15}$" + ], + "Output Program": [ + "i = 1j\nx = 2-4*i\ny = 9+3*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^6+3 x^5+x^4+10 x^2-8 x-3$ when divided by $6 x^5-2 x^4+6 x^3-5 x^2-5 x+9$.", + "Output Answer": [ + "$\\frac{5}{18}-\\frac{2 x}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**6+3*x**5+x**4+10*x**2-8*x-3\nq = 6*x**5-2*x**4+6*x**3-5*x**2-5*x+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4-\\frac{21 x}{5}$ and $x+\\frac{14}{5}$.", + "Output Answer": [ + "$\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4-((21*x)/5), x+(14/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $8 x^2-14 x+10$", + "Output Answer": [ + "$8 \\left(x-\\frac{7}{8}\\right)^2+\\frac{31}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (8*x**2-14*x+10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\tan ^{-1}(5-2 x)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{5}{2}-\\frac{\\tan (y)}{2}\\text{ if }-\\frac{\\pi }{2} 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$12 \\left(-\\frac{17}{4}-23 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(17/8) # initial value\nd = -math.pi # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(17/8) # initial value\nd = -math.pi # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^5+9 x^4-2 x^3-7 x^2-3 x-4$ when divided by $-5 x^4+8 x^3-6 x^2+4 x-1$.", + "Output Answer": [ + "$\\frac{9 x}{5}+\\frac{27}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**5+9*x**4-2*x**3-7*x**2-3*x-4\nq = -5*x**4+8*x**3-6*x**2+4*x-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-5+i) \\sqrt{2}$ and $y=(3-5 i) \\sqrt{2}$", + "Output Answer": [ + "$-\\frac{10}{17}-\\frac{11 i}{17}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-5+i)*math.sqrt(2)\ny = (3-5*i)*math.sqrt(2)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+2 x-8 y^2-5 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x+\\frac{1}{9}\\right)^2-8 \\left(y+\\frac{5}{16}\\right)^2=-\\frac{1345}{288}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{9} & \\frac{1}{144} \\left(-45-\\sqrt{22865}\\right) \\\\\n -\\frac{1}{9} & \\frac{1}{144} \\left(\\sqrt{22865}-45\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{17}}{3}$\nCenter: $\\left\\{-\\frac{1}{9},\\frac{1}{2} \\left(\\frac{1}{144} \\left(-45-\\sqrt{22865}\\right)+\\frac{1}{144} \\left(\\sqrt{22865}-45\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{48} \\left(-15-4 \\sqrt{2}\\right)-\\frac{3 x}{2 \\sqrt{2}},y=\\frac{3 x}{2 \\sqrt{2}}+\\frac{1}{48} \\left(4 \\sqrt{2}-15\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+2*x-8*y**2-5*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\left(((14+6)+3)^2-5\\right)+22}{(((8-2)-16)-2)+24}$.", + "Output Answer": [ + "$\\frac{91}{2}$" + ], + "Output Program": [ + "try: \n print((((((14+6)+3)**2-5)+22)/((((8-2)-16)-2)+24)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{(19-46 x)^4}{2401}, q(x) = \\frac{1}{49} (12 x+29)^2$", + "Output Answer": [ + "$\\frac{4477456 x^4}{2401}-\\frac{7397536 x^3}{2401}+\\frac{4590312 x^2}{2401}-\\frac{1227952 x}{2401}+\\frac{171530}{2401}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (((19-46*x)**4)/2401)\nq = (1/49)*(12*x+29)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{1}{28}$, and $a_n=a_{n-1}+-2 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$3 \\left(\\frac{1}{14}-10 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (1/28) # initial value\nd = -2*math.pi # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (1/28) # initial value\nd = -2*math.pi # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{16}{23}$, and $a_n=a_{n-1}+-\\frac{13}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$-\\frac{4677}{46}$" + ], + "Output Program": [ + "a = -(16/23) # initial value\nd = -(13/2) # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(16/23) # initial value\nd = -(13/2) # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt{-8 x^4-7}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{\\sqrt[4]{-7}}{2^{3/4}}\\right\\},\\left\\{x\\to -\\frac{i \\sqrt[4]{-7}}{2^{3/4}}\\right\\},\\left\\{x\\to \\frac{i \\sqrt[4]{-7}}{2^{3/4}}\\right\\},\\left\\{x\\to \\frac{\\sqrt[4]{-7}}{2^{3/4}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(sqrt(-8*x**4-7), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{36}{5}+5 i$ and $y=7+2 i$", + "Output Answer": [ + "$\\frac{202}{5}+\\frac{247 i}{5}$" + ], + "Output Program": [ + "i = 1j\nx = (36/5)+5*i\ny = 7+2*i\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $2 \\sqrt{3} x^2+\\frac{10 x}{\\sqrt{3}}-\\frac{20}{\\sqrt{3}}$", + "Output Answer": [ + "$2 \\sqrt{3} \\left(x+\\frac{5}{6}\\right)^2-\\frac{145}{6 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (2*math.sqrt(3)*x**2+((10*x)/(math.sqrt(3)))-(20/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $-\\tan (4-2 x)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{2} (\\pi c_1+4)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(-tan(4-2*x), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\sin \\left(\\frac{9 x}{2}+\\frac{3}{2}\\right)$ at the point $x=-4$", + "Output Answer": [ + "$\\sin \\left(\\frac{33}{2}\\right) = -0.712$" + ], + "Output Program": [ + "import math\n\nx = -4\ntry: \n f = -math.sin(((9*x)/2)+(3/2))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-12 x^2+288 x-1716$", + "Output Answer": [ + "$-12 (11-x) (13-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-12*x**2+288*x-1716, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{37}{5}-\\frac{36}{125} (2 t+75)^2, x(t)=\\frac{4 t^2}{25}+12 t+225$", + "Output Answer": [ + "$y=\\frac{37}{5}-\\frac{36 x}{5}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (37/5)-(36/125)*(2*t+75)**2\nx_t = ((4*t**2)/25)+12*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\left(\\cos \\left(\\frac{2 \\pi }{45}\\right)+i \\sin \\left(\\frac{2 \\pi }{45}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-16384 \\left(\\sin \\left(\\frac{17 \\pi }{90}\\right)+i \\cos \\left(\\frac{17 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*(math.cos(((2*math.pi)/45))+1j*math.sin(((2*math.pi)/45))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $10 \\sqrt{5} | x| =3 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{10}\\right\\},\\left\\{x\\to \\frac{3}{10}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(10*sqrt(5)*abs(x), 3*sqrt(5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-9 x-4$ and $2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-9*x-4, 2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-24 x-22 y-11=0$, $-15 x+24 y-8=0$", + "Output Answer": [ + "$x=-\\frac{220}{453}$, $y=\\frac{9}{302}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-24*x-22*y-11, -15*x+24*y-8), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-3 x-2 y-19 z+23=0$, $9 x+24 y+5 z+14=0$, $13 x+6 y+11 z-16=0$", + "Output Answer": [ + "$x=\\frac{1521}{2134}$, $y=-\\frac{2355}{2134}$, $z=\\frac{2591}{2134}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-3*x-2*y-19*z+23, 9*x+24*y+5*z+14, 13*x+6*y+11*z-16)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=2 t+33, x(t)=-t-15$", + "Output Answer": [ + "$y=3-2 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 2*t+33\nx_t = -t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-7 (7 t+15)^2, x(t)=49 t^2+210 t+225$", + "Output Answer": [ + "$y=-7 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -7*(7*t+15)**2\nx_t = 49*t**2+210*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{39 x}{7}+\\frac{48 y}{7}-18=0$, $-\\frac{150 x}{7}+\\frac{121 y}{7}-\\frac{22}{7}=0$", + "Output Answer": [ + "$x=\\frac{4730}{3973}$, $y=\\frac{6586}{3973}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((39*x)/7)+((48*y)/7)-18, -((150*x)/7)+((121*y)/7)-(22/7)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-8 x+5 y+13=0$, $-17 x+5 y+11=0$", + "Output Answer": [ + "$x=-\\frac{2}{9}$, $y=-\\frac{133}{45}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-8*x+5*y+13, -17*x+5*y+11), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{43 x^2}{5}+\\frac{57 x}{5}-\\frac{53}{5}$", + "Output Answer": [ + "$x=\\frac{1}{86} \\left(-57-\\sqrt{12365}\\right)\\lor x=\\frac{1}{86} \\left(\\sqrt{12365}-57\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((43*x**2)/5)+((57*x)/5)-(53/5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 x^2+7 x-10$ and $q(x) = -10 x^2+6 x-12$", + "Output Answer": [ + "$-30 x^4-52 x^3+106 x^2-144 x+120$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*x**2+7*x-10\nq = -10*x**2+6*x-12\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{x^2}{3}-\\frac{7 x}{3}-\\frac{4}{3}$ and $-\\frac{10 x^2}{3}-4 x-2$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((x**2)/3)-((7*x)/3)-(4/3), -((10*x**2)/3)-4*x-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8-10 x}+\\sqrt{7}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(-84+13 \\sqrt{7}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8-10*x)+sqrt(7), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 20-6 x| =-25$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(20-6*x), -25), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{25}{4}+7 i$ and $y=\\frac{1}{2}-\\frac{7 i}{4}$", + "Output Answer": [ + "$-\\frac{23}{4}+\\frac{21 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = -(25/4)+7*i\ny = (1/2)-((7*i)/4)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2 x^4-4 x^3-13 x^2-11 x-5$ and $2 x^2+2 x+1$.", + "Output Answer": [ + "$2 x^2+2 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2*x**4-4*x**3-13*x**2-11*x-5, 2*x**2+2*x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{21-4}{15}+17\\right)+\\left(((10+6)+22)^2-25\\right)$.", + "Output Answer": [ + "$\\frac{21557}{15}$" + ], + "Output Program": [ + "try: \n print((((21-4)/15)+17)+(((10+6)+22)**2-25))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^4+8 x^3-6 x^2-7 x-5$ when divided by $7 x^2-8 x^3$.", + "Output Answer": [ + "$-x-\\frac{15}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**4+8*x**3-6*x**2-7*x-5\nq = 7*x**2-8*x**3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-x^3+x^2+9 x+7$ when divided by $-x^3-5 x^2+9 x+5$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**3+x**2+9*x+7\nq = -x**3-5*x**2+9*x+5\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 \\pi x^2-4 \\pi x-\\pi$ and $q(x) = 4 \\pi x^2-2 \\pi x-4 \\pi$", + "Output Answer": [ + "$16 \\pi ^2 x^4-24 \\pi ^2 x^3-12 \\pi ^2 x^2+18 \\pi ^2 x+4 \\pi ^2$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*pi*x**2-4*pi*x-pi\nq = 4*pi*x**2-2*pi*x-4*pi\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-60 x^2+154 x+242}{-500 x-550}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{11}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-60*x**2+154*x+242)/(-500*x-550)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-5 \\sqrt{2} \\left(\\sin \\left(\\frac{\\pi }{18}\\right)-i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$2500 \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)+i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-5*math.sqrt(2)*(math.sin((math.pi/18))-1j*math.cos((math.pi/18))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{5} \\left(19 x^2-46 x-42\\right)$, $q(x) = \\frac{71 x^2}{5}-3 x+8$", + "Output Answer": [ + "$18 x^2-\\frac{61 x}{5}-\\frac{2}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/5)*(19*x**2-46*x-42)\nq = ((71*x**2)/5)-3*x+8\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{53}{20}$, and $a_n=a_{n-1}+-4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$-\\frac{13689}{10}$" + ], + "Output Program": [ + "a = -(53/20) # initial value\nd = -4 # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(53/20) # initial value\nd = -4 # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{3}}, \\sqrt{2}, \\frac{1}{4})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{\\frac{115}{3}}}{4},\\tan ^{-1}\\left(4 \\sqrt{\\frac{7}{3}}\\right),\\tan ^{-1}\\left(\\sqrt{6}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(3)))\ny = math.sqrt(2)\nz = (1/4)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{2 x}{\\sqrt{3}}-\\frac{5}{\\sqrt{3}}\\right| =\\frac{16}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{11}{2}\\right\\},\\left\\{x\\to \\frac{21}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((2*x)/(sqrt(3)))-(5/(sqrt(3)))), (16/(sqrt(3)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{112 x^3-370 x^2+\\frac{6628 x}{25}+\\frac{86}{25}}{\\frac{544 x}{5}-\\frac{2924}{25}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{35} \\left(39-2 \\sqrt{389}\\right)\\right\\},\\left\\{x\\to \\frac{1}{35} \\left(39+2 \\sqrt{389}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((112*x**3-370*x**2+((6628*x)/25)+(86/25))/(((544*x)/5)-(2924/25))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-13 x^2-13 x$", + "Output Answer": [ + "$\\frac{13}{4}-13 \\left(x+\\frac{1}{2}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-13*x**2-13*x), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-13 x-4}+\\sqrt{-11 x-12}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-292+5 \\sqrt{3351}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-13*x-4)+sqrt(-11*x-12), 5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2+2 x+y^2-4 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $(y-2)^2-6 \\left(x-\\frac{1}{6}\\right)^2=-\\frac{1}{6}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{6} \\left(1-\\sqrt{7}\\right) & 2 \\\\\n \\frac{1}{6} \\left(1+\\sqrt{7}\\right) & 2 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{7}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{6} \\left(1-\\sqrt{7}\\right)+\\frac{1}{6} \\left(1+\\sqrt{7}\\right)\\right),2\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{6} x-\\frac{1}{\\sqrt{6}}+2,y=-\\sqrt{6} x+\\frac{1}{\\sqrt{6}}+2\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2+2*x+y**2-4*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2+7 x+15$ and $q(x) = -11 x^2-7 x+3$", + "Output Answer": [ + "$154 x^4+21 x^3-256 x^2-84 x+45$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2+7*x+15\nq = -11*x**2-7*x+3\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -13 x^2+14 x-10$ and $q(x) = -6 x^2-11 x-1$", + "Output Answer": [ + "$78 x^4+59 x^3-81 x^2+96 x+10$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -13*x**2+14*x-10\nq = -6*x**2-11*x-1\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-408 x^2-381 x+\\frac{495}{2}}{-324 x-\\frac{891}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{15}{34}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-408*x**2-381*x+(495/2))/(-324*x-(891/2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 (x-1)^2, q(x) = (7 x+4)^3$", + "Output Answer": [ + "$343 x^3+597 x^2+318 x+73$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*(x-1)**2\nq = (7*x+4)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\sqrt{5-7 x} \\tan (4 x)$ at the point $x=0$", + "Output Answer": [ + "$0 = 0.$" + ], + "Output Program": [ + "import math\n\nx = 0\ntry: \n f = -math.sqrt(5-7*x)*math.tan(4*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{8 x-8}$ at the point $x=-7$", + "Output Answer": [ + "$-4 = -4.$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = -7\ntry: \n f = np.cbrt(8*x-8)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(-1+i) \\pi$ and $y=(1+i) \\pi$", + "Output Answer": [ + "$2 i \\pi$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-1+i)*math.pi\ny = (1+i)*math.pi\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 (\\cos (2)+i \\sin (2))\\right)^11$", + "Output Answer": [ + "$1977326743 (\\cos (22)+i \\sin (22))$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.cos(2)+1j*math.sin(2)))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{37 x}{2}-10\\right| =23$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{26}{37}\\right\\},\\left\\{x\\to \\frac{66}{37}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((37*x)/2)-10), 23), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-5 x^5+28 x^4-11 x^3-24 x^2+21 x-5$ and $-5 x^4+3 x^3+4 x^2-4 x+1$.", + "Output Answer": [ + "$5 x^4-3 x^3-4 x^2+4 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-5*x**5+28*x**4-11*x**3-24*x**2+21*x-5, -5*x**4+3*x**3+4*x**2-4*x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $5 x^3+\\frac{245 x^2}{2}+470 x-\\frac{1995}{2}$", + "Output Answer": [ + "$-5 (-x-19) \\left(x-\\frac{3}{2}\\right) (x+7)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(5*x**3+((245*x**2)/2)+470*x-(1995/2), a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -2 \\left(5 x^2-5 x+4\\right)$, $q(x) = -14 x^2-14 x+13$", + "Output Answer": [ + "$-24 x^2-4 x+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*(5*x**2-5*x+4)\nq = -14*x**2-14*x+13\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(9 \\left(-\\sin \\left(\\frac{7 \\pi }{45}\\right)+i \\cos \\left(\\frac{7 \\pi }{45}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$81 \\left(-\\sin \\left(\\frac{17 \\pi }{90}\\right)-i \\cos \\left(\\frac{17 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((9*(-math.sin(((7*math.pi)/45))+1j*math.cos(((7*math.pi)/45))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (2, 3, 3)$", + "Output Answer": [ + "$\\left\\{\\sqrt{22},\\tan ^{-1}\\left(\\frac{\\sqrt{13}}{3}\\right),\\tan ^{-1}\\left(\\frac{3}{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 2\ny = 3\nz = 3\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{67 x^2}{7}-\\frac{18 x}{7}+\\frac{10}{7}$", + "Output Answer": [ + "$x=\\frac{1}{67} \\left(-9-\\sqrt{751}\\right)\\lor x=\\frac{1}{67} \\left(\\sqrt{751}-9\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((67*x**2)/7)-((18*x)/7)+(10/7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{6 \\sqrt{2} x^2+16 \\sqrt{2} x-16 \\sqrt{2}}{10 \\sqrt{2} x^2+3 \\sqrt{2} x+2 \\sqrt{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-4-2 \\sqrt{10}\\right)\\right\\},\\left\\{x\\to \\frac{1}{3} \\left(-4+2 \\sqrt{10}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((6*sqrt(2)*x**2+16*sqrt(2)*x-16*sqrt(2))/(10*sqrt(2)*x**2+3*sqrt(2)*x+2*sqrt(2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{9 x^2}{\\sqrt{\\pi }}+\\frac{17 x}{\\sqrt{\\pi }}+\\frac{21}{\\sqrt{\\pi }}$ and $q(x) = \\frac{x^2}{\\sqrt{\\pi }}-\\frac{18 x}{\\sqrt{\\pi }}+\\frac{22}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{9 x^4}{\\pi }-\\frac{145 x^3}{\\pi }-\\frac{87 x^2}{\\pi }-\\frac{4 x}{\\pi }+\\frac{462}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((9*x**2)/(sqrt(pi)))+((17*x)/(sqrt(pi)))+(21/(sqrt(pi)))\nq = ((x**2)/(sqrt(pi)))-((18*x)/(sqrt(pi)))+(22/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{3}{10}$, and $a_n=a_{n-1}+-\\frac{1}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$-48$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (3/10) # initial value\nd = -(1/2) # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (3/10) # initial value\nd = -(1/2) # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x+6}+\\sqrt{8 x-1}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(373-12 \\sqrt{631}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x+6)+sqrt(8*x-1), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2-3 x+2 y^2-4 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 (y-1)^2-4 \\left(x+\\frac{3}{8}\\right)^2=\\frac{87}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{8} & 1-\\frac{3 \\sqrt{29}}{8} \\\\\n -\\frac{3}{8} & 1+\\frac{3 \\sqrt{29}}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{2}}$\nCenter: $\\left\\{-\\frac{3}{8},1\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{8} \\left(8-3 \\sqrt{2}\\right)-\\sqrt{2} x,y=\\sqrt{2} x+\\frac{1}{8} \\left(8+3 \\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2-3*x+2*y**2-4*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{475 x^3+158 x^2-759 x-420}{-209 x^2-220 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{25} \\left(9-\\sqrt{606}\\right)\\right\\},\\left\\{x\\to \\frac{1}{25} \\left(9+\\sqrt{606}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((475*x**3+158*x**2-759*x-420)/(-209*x**2-220*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{2} \\left(-21 x^2-28 x+9\\right)$, $q(x) = \\frac{1}{2} \\left(27 x^2+19 x-15\\right)$", + "Output Answer": [ + "$3 x^2-\\frac{9 x}{2}-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/2)*(-21*x**2-28*x+9)\nq = (1/2)*(27*x**2+19*x-15)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $5 x^2-3 x+10$", + "Output Answer": [ + "$x=\\frac{1}{10} \\left(3-i \\sqrt{191}\\right)\\lor x=\\frac{1}{10} \\left(3+i \\sqrt{191}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(5*x**2-3*x+10, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$e^{5 x+1}+\\sin (6-4 x)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = math.e**(5*x+1)+sin(6-4*x)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-21$, and $a_n=a_{n-1}+\\frac{18}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$5 \\left(\\frac{162}{\\sqrt{5}}-42\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -21 # initial value\nd = (18/(math.sqrt(5))) # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -21 # initial value\nd = (18/(math.sqrt(5))) # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-23 x-15 y+2=0$, $-12 x-20 y+6=0$", + "Output Answer": [ + "$x=-\\frac{5}{28}$, $y=\\frac{57}{140}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-23*x-15*y+2, -12*x-20*y+6), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{x^2}{3}-7 x+\\frac{11}{3}$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(21-\\sqrt{397}\\right)\\lor x=\\frac{1}{2} \\left(21+\\sqrt{397}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((x**2)/3)-7*x+(11/3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-7 x^2+91 x-280$", + "Output Answer": [ + "$-7 (5-x) (8-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-7*x**2+91*x-280, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2+\\frac{15 x}{2}$", + "Output Answer": [ + "$-\\left(\\left(-x-\\frac{15}{2}\\right) x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2+((15*x)/2), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-x^2+10 x+6 y^2-8 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y-\\frac{2}{3}\\right)^2-(x-5)^2=-\\frac{76}{3}$\nFoci: $\\left(\n\\begin{array}{cc}\n 5-\\frac{\\sqrt{266}}{3} & \\frac{2}{3} \\\\\n 5+\\frac{\\sqrt{266}}{3} & \\frac{2}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{6}}$\nCenter: $\\left\\{5,\\frac{2}{3}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{6}}+\\frac{1}{6} \\left(4-5 \\sqrt{6}\\right),y=\\frac{1}{6} \\left(4+5 \\sqrt{6}\\right)-\\frac{x}{\\sqrt{6}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-x**2+10*x+6*y**2-8*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $6 e^{\\frac{17 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $6$\nArgument: $\\frac{17 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 6*math.e**((17*i*math.pi)/180)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2 x-2$ and $-2 x^3-2 x^2+3 x-5$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2*x-2, -2*x**3-2*x**2+3*x-5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2+25 \\sqrt{2} x+360$", + "Output Answer": [ + "$5 \\left(9 \\sqrt{2}-x\\right) \\left(x+4 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2+25*sqrt(2)*x+360, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{2 x}{3}-\\frac{8}{3}$ and $x^5+\\frac{7 x^4}{3}+\\frac{2 x^3}{3}+\\frac{11 x^2}{3}-\\frac{7 x}{3}+\\frac{8}{3}$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((2*x)/3)-(8/3), x**5+((7*x**4)/3)+((2*x**3)/3)+((11*x**2)/3)-((7*x)/3)+(8/3)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=64-\\frac{1728 t}{49}, x(t)=\\frac{54 t}{7}-15$", + "Output Answer": [ + "$y=-\\frac{32 x}{7}-\\frac{32}{7}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 64-((1728*t)/49)\nx_t = ((54*t)/7)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-6 x^2-36 \\sqrt{3} x+990$", + "Output Answer": [ + "$-6 \\left(-x-11 \\sqrt{3}\\right) \\left(5 \\sqrt{3}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-6*x**2-36*sqrt(3)*x+990, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{15}{2} \\left(-\\cos \\left(\\frac{7 \\pi }{30}\\right)+i \\sin \\left(\\frac{7 \\pi }{30}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$\\frac{3375}{8} \\left(\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(1+\\sqrt{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((15/2)*(-math.cos(((7*math.pi)/30))+1j*math.sin(((7*math.pi)/30))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-9 x+9 y^2-y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-9 x+9 y^2-y=7$\nVertex: $\\left\\{-\\frac{253}{324},\\frac{1}{18}\\right\\}$\nDirectrix: $x=-\\frac{167}{162}$\nFocal Parameter: $\\frac{1}{2}$\nFocus: $\\left\\{-\\frac{43}{81},\\frac{1}{18}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x+9*y**2-y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 10 \\sqrt{3} x+12 \\sqrt{3}\\right| =9 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{21}{10}\\right\\},\\left\\{x\\to -\\frac{3}{10}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(10*sqrt(3)*x+12*sqrt(3)), 9*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{36 x^2}{7}+\\frac{44 x}{7}+\\frac{93}{7}$", + "Output Answer": [ + "$x=\\frac{1}{18} \\left(11-\\sqrt{958}\\right)\\lor x=\\frac{1}{18} \\left(11+\\sqrt{958}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((36*x**2)/7)+((44*x)/7)+(93/7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\left(-21 x^2+x+21\\right) \\log (2)$, $q(x) = -\\left(\\left(20 x^2+11 x+4\\right) \\log (2)\\right)$", + "Output Answer": [ + "$-41 x^2 \\log (2)-10 x \\log (2)+17 \\log (2)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (-21*x**2+x+21)*log(2)\nq = -((20*x**2+11*x+4)*log(2))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\sqrt{3}, \\sqrt{5}, \\pi)$", + "Output Answer": [ + "$\\left\\{\\sqrt{8+\\pi ^2},\\tan ^{-1}\\left(\\frac{2 \\sqrt{2}}{\\pi }\\right),\\tan ^{-1}\\left(\\sqrt{\\frac{5}{3}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.sqrt(3)\ny = math.sqrt(5)\nz = math.pi\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2+252 \\sqrt{2} x-3528$", + "Output Answer": [ + "$-9 \\left(14 \\sqrt{2}-x\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2+252*sqrt(2)*x-3528, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| x+\\frac{11}{2}\\right| =\\frac{29}{2}$", + "Output Answer": [ + "$\\{\\{x\\to -20\\},\\{x\\to 9\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(x+(11/2)), (29/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-2+i) \\sqrt{5}$ and $y=(-3+3 i) \\sqrt{5}$", + "Output Answer": [ + "$\\frac{1}{2}+\\frac{i}{6}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-2+i)*math.sqrt(5)\ny = (-3+3*i)*math.sqrt(5)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{36}{5} \\left(-\\sin \\left(\\frac{43 \\pi }{180}\\right)+i \\cos \\left(\\frac{43 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{36}{5} \\sqrt{\\sin ^2\\left(\\frac{43 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{43 \\pi }{180}\\right)}$\nArgument: $\\frac{133 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (36/5)*(-math.sin(((43*math.pi)/180))+i*math.cos(((43*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -9 x^2-\\frac{27 x}{2}$ and $q(x) = 11 x^2+\\frac{21 x}{2}-\\frac{13}{2}$", + "Output Answer": [ + "$-99 x^4-243 x^3-\\frac{333 x^2}{4}+\\frac{351 x}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -9*x**2-((27*x)/2)\nq = 11*x**2+((21*x)/2)-(13/2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-11 x^2+4 x+25}{15-20 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{11} \\left(2-3 \\sqrt{31}\\right)\\right\\},\\left\\{x\\to \\frac{1}{11} \\left(2+3 \\sqrt{31}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-11*x**2+4*x+25)/(15-20*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(4-10) \\left(\\left(\\frac{13}{13}-17\\right)^2-20\\right)$.", + "Output Answer": [ + "$-1416$" + ], + "Output Program": [ + "try: \n print((4-10)*(((13/13)-17)**2-20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\sqrt{3} x^2+7 \\sqrt{3} x-\\sqrt{3}$", + "Output Answer": [ + "$\\sqrt{3} \\left(x+\\frac{7}{2}\\right)^2-\\frac{53 \\sqrt{3}}{4}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (math.sqrt(3)*x**2+7*math.sqrt(3)*x-math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{71 x^2}{5}-\\frac{52 x}{5}-\\frac{67}{5}$", + "Output Answer": [ + "$x=\\frac{1}{71} \\left(-26-i \\sqrt{4081}\\right)\\lor x=\\frac{1}{71} \\left(-26+i \\sqrt{4081}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((71*x**2)/5)-((52*x)/5)-(67/5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $8 x^2+8 x-2$ and $2$.", + "Output Answer": [ + "$2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(8*x**2+8*x-2, 2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{-11 x^2-8 x-2}{\\sqrt{\\pi }}$, $q(x) = \\frac{-11 x^2-14 x-12}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{22 x^2}{\\sqrt{\\pi }}-\\frac{22 x}{\\sqrt{\\pi }}-\\frac{14}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((-11*x**2-8*x-2)/(sqrt(pi)))\nq = ((-11*x**2-14*x-12)/(sqrt(pi)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (3-2 x)^4, q(x) = -(9 x+7)^3$", + "Output Answer": [ + "$16 x^4-825 x^3-1485 x^2-1539 x-262$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (3-2*x)**4\nq = -(9*x+7)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 \\sqrt{3} x^2+\\frac{13 x}{\\sqrt{3}}+\\frac{4}{\\sqrt{3}}$ and $q(x) = -\\frac{x^2}{\\sqrt{3}}+\\frac{16 x}{\\sqrt{3}}+\\frac{7}{\\sqrt{3}}$", + "Output Answer": [ + "$4 x^4-\\frac{205 x^3}{3}+40 x^2+\\frac{155 x}{3}+\\frac{28}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*sqrt(3)*x**2+((13*x)/(sqrt(3)))+(4/(sqrt(3)))\nq = -((x**2)/(sqrt(3)))+((16*x)/(sqrt(3)))+(7/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 x^2+14 x+5$ and $q(x) = x^2-5 x-14$", + "Output Answer": [ + "$3 x^4-x^3-107 x^2-221 x-70$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*x**2+14*x+5\nq = x**2-5*x-14\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2+30 x+72$", + "Output Answer": [ + "$-2 (-x-3) (x+12)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2+30*x+72, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{9 x^2-23 x-34}{e}$, $q(x) = \\frac{-40 x^2+20 x-39}{e}$", + "Output Answer": [ + "$-\\frac{31 x^2}{e}-\\frac{3 x}{e}-\\frac{73}{e}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x\n\np = ((9*x**2-23*x-34)/math.e)\nq = ((-40*x**2+20*x-39)/math.e)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 x^2+10 x-14$", + "Output Answer": [ + "$-2 \\left(x-\\frac{5}{2}\\right)^2-\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*x**2+10*x-14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\tan (1)$ at the point $x=-4$", + "Output Answer": [ + "$-\\tan (1) = -1.557$" + ], + "Output Program": [ + "import math\n\nx = -4\ntry: \n f = -math.tan(1)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{5 x^4}{4}-\\frac{31 x^3}{4}-\\frac{53 x^2}{4}-15 x-8$ and $\\frac{x^3}{2}-\\frac{7 x^2}{2}-\\frac{5 x}{2}-4$.", + "Output Answer": [ + "$\\frac{x^3}{4}-\\frac{7 x^2}{4}-\\frac{5 x}{4}-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((5*x**4)/4)-((31*x**3)/4)-((53*x**2)/4)-15*x-8, ((x**3)/2)-((7*x**2)/2)-((5*x)/2)-4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{3 x}{5}+\\frac{2}{5}$ and $-\\frac{8 x^2}{5}+2 x-\\frac{14}{5}$.", + "Output Answer": [ + "$\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((3*x)/5)+(2/5), -((8*x**2)/5)+2*x-(14/5)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^6+x^5-x^4-6 x^3+5 x^2+4 x-7$ when divided by $-9 x^4+6 x^3-7 x^2-4$.", + "Output Answer": [ + "$\\frac{7 x^2}{9}+\\frac{11 x}{27}-\\frac{2}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**6+x**5-x**4-6*x**3+5*x**2+4*x-7\nq = -9*x**4+6*x**3-7*x**2-4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $1$ and $x^4-3 x^3-3 x^2-4 x-2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(1, x**4-3*x**3-3*x**2-4*x-2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 x^2+3 x+4$, $q(x) = 10 x-9$", + "Output Answer": [ + "$9 x^2+13 x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**2+3*x+4\nq = 10*x-9\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{7 x^2-19 x+5}{23 x+3}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{14} \\left(19-\\sqrt{221}\\right)\\right\\},\\left\\{x\\to \\frac{1}{14} \\left(19+\\sqrt{221}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((7*x**2-19*x+5)/(23*x+3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{7}{13}$, and $a_n=a_{n-1}+3 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$\\frac{9}{2} \\left(\\frac{14}{13}+24 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (7/13) # initial value\nd = 3*math.sqrt(2) # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (7/13) # initial value\nd = 3*math.sqrt(2) # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-14 x^2+5 x-13$", + "Output Answer": [ + "$-14 \\left(x-\\frac{5}{28}\\right)^2-\\frac{703}{56}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-14*x**2+5*x-13), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2+8 x+2 y^2-10 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(y-\\frac{5}{2}\\right)^2-8 \\left(x-\\frac{1}{2}\\right)^2=\\frac{13}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & \\frac{5}{2}-\\frac{\\sqrt{65}}{4} \\\\\n \\frac{1}{2} & \\frac{1}{4} \\left(10+\\sqrt{65}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{2}$\nCenter: $\\left\\{\\frac{1}{2},\\frac{1}{2} \\left(\\frac{5}{2}-\\frac{\\sqrt{65}}{4}+\\frac{1}{4} \\left(10+\\sqrt{65}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{7}{2}-2 x,y=2 x+\\frac{3}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2+8*x+2*y**2-10*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\cos \\left(\\frac{49}{45}\\right)+i \\sin \\left(\\frac{49}{45}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$117649 \\left(\\cos \\left(\\frac{98}{15}\\right)+i \\sin \\left(\\frac{98}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.cos((49/45))+1j*math.sin((49/45))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x^4+9 x^3-6 x^2+4 x-8$ and $-3 x^3+3 x^2+4$.", + "Output Answer": [ + "$3 x^3-3 x^2-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x**4+9*x**3-6*x**2+4*x-8, -3*x**3+3*x**2+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{27}{2}-\\frac{25 x}{2}\\right| =\\frac{43}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{16}{25}\\right\\},\\left\\{x\\to \\frac{14}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs((27/2)-((25*x)/2)), (43/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^6+x^5-2 x^4+8 x^3+3 x^2+5 x+1$ when divided by $-5 x^5+5 x^4+3 x^3-4 x^2+3 x$.", + "Output Answer": [ + "$-\\frac{3 x}{5}-\\frac{4}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**6+x**5-2*x**4+8*x**3+3*x**2+5*x+1\nq = -5*x**5+5*x**4+3*x**3-4*x**2+3*x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{3}{7}-10 i$ and $y=-1+\\frac{62 i}{7}$", + "Output Answer": [ + "$\\frac{4}{7}-\\frac{132 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = -(3/7)-10*i\ny = -1+((62*i)/7)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -3 x^2-12 x+5$, $q(x) = 11 x^2-12 x-6$", + "Output Answer": [ + "$8 x^2-24 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x**2-12*x+5\nq = 11*x**2-12*x-6\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x+3}+\\sqrt{9 x+13}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(595-22 \\sqrt{709}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x+3)+sqrt(9*x+13), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{39}{19}$, and $a_n=a_{n-1}+\\frac{16}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$7 \\left(\\frac{208}{\\sqrt{3}}-\\frac{78}{19}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(39/19) # initial value\nd = (16/(math.sqrt(3))) # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(39/19) # initial value\nd = (16/(math.sqrt(3))) # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $11 x^2-8 x-4$", + "Output Answer": [ + "$x=\\frac{2}{11} \\left(2-\\sqrt{15}\\right)\\lor x=\\frac{2}{11} \\left(2+\\sqrt{15}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(11*x**2-8*x-4, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -24 x-3| =0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-24*x-3), 0), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{7 x}{\\sqrt{2}}-\\frac{31 y}{\\sqrt{2}}-\\frac{19 z}{\\sqrt{2}}-13 \\sqrt{2}=0$, $-8 \\sqrt{2} x-\\frac{15 y}{\\sqrt{2}}+\\frac{35 z}{\\sqrt{2}}-\\frac{17}{\\sqrt{2}}=0$, $11 \\sqrt{2} x+17 \\sqrt{2} y-2 \\sqrt{2} z-\\frac{3}{\\sqrt{2}}=0$", + "Output Answer": [ + "$x=\\frac{4658}{991}$, $y=-\\frac{5517}{1982}$, $z=\\frac{2857}{1982}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((7*x)/(sqrt(2)))-((31*y)/(sqrt(2)))-((19*z)/(sqrt(2)))-13*sqrt(2), -8*sqrt(2)*x-((15*y)/(sqrt(2)))+((35*z)/(sqrt(2)))-(17/(sqrt(2))), 11*sqrt(2)*x+17*sqrt(2)*y-2*sqrt(2)*z-(3/(sqrt(2))))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-2 e^{1-\\frac{73 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $2 e$\nArgument: $\\frac{107 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -2*math.e**(1-((73*i*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$3 x-21 y+3=0$, $-14 x-y+9=0$", + "Output Answer": [ + "$x=\\frac{62}{99}$, $y=\\frac{23}{99}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((3*x-21*y+3, -14*x-y+9), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(18-22)-\\left(\\frac{14}{21}+19\\right)$.", + "Output Answer": [ + "$-\\frac{71}{3}$" + ], + "Output Program": [ + "try: \n print((18-22)-((14/21)+19))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-15 x^4-19 x^3+x^2-15 x$ and $-5 x^2+2 x-3$.", + "Output Answer": [ + "$5 x^2-2 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-15*x**4-19*x**3+x**2-15*x, -5*x**2+2*x-3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{3}{7}$, and $a_n=a_{n-1}+-9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$-\\frac{2295}{7}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(3/7) # initial value\nd = -9 # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(3/7) # initial value\nd = -9 # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{71}{47}$, and $a_n=a_{n-1}+-1$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=17$.", + "Output Answer": [ + "$-\\frac{7599}{47}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(71/47) # initial value\nd = -1 # second term\nn = 17 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(71/47) # initial value\nd = -1 # second term\nn = 17 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=1$, and $a_n=a_{n-1}+-9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$-1690$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 1 # initial value\nd = -9 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = 1 # initial value\nd = -9 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-8 \\sqrt{3} x^2-6 \\sqrt{3} x-\\frac{8}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{8} \\left(-3+i \\sqrt{\\frac{37}{3}}\\right)\\lor x=\\frac{1}{8} \\left(-3-i \\sqrt{\\frac{37}{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-8*sqrt(3)*x**2-6*sqrt(3)*x-(8/(sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $12 x^2-16 x-20$ and $-3 x^2+4 x+5$.", + "Output Answer": [ + "$3 x^2-4 x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(12*x**2-16*x-20, -3*x**2+4*x+5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $6 \\sqrt{2} x^2+\\frac{15 x}{\\sqrt{2}}+2 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{12} \\left(-\\frac{15}{2}-\\frac{\\sqrt{33}}{2}\\right)\\lor x=\\frac{1}{12} \\left(\\frac{\\sqrt{33}}{2}-\\frac{15}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(6*sqrt(2)*x**2+((15*x)/(sqrt(2)))+2*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(8 t+117)^2, x(t)=-t-15$", + "Output Answer": [ + "$y=64 x^2+48 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (8*t+117)**2\nx_t = -t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{56 x}{5}-\\frac{37}{5}}+\\sqrt{\\frac{71 x}{5}+\\frac{6}{5}}=\\frac{43}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{231598-86 \\sqrt{7129399}}{1125}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((56*x)/5)-(37/5))+sqrt(((71*x)/5)+(6/5)), (43/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{4 x^2}{\\sqrt{3}}+8 \\sqrt{3} x+\\frac{25}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{4 (x+3)^2}{\\sqrt{3}}-12 \\sqrt{3}+\\frac{25}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((4*x**2)/(math.sqrt(3)))+8*math.sqrt(3)*x+(25/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(6-1)^2 \\frac{9+4}{20}$.", + "Output Answer": [ + "$\\frac{65}{4}$" + ], + "Output Program": [ + "try: \n print((6-1)**2*((9+4)/20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{3}{7}$, and $a_n=a_{n-1}+5$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$\\frac{956}{7}$" + ], + "Output Program": [ + "a = -(3/7) # initial value\nd = 5 # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(3/7) # initial value\nd = 5 # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt{\\frac{11 x}{3}+1}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(sqrt(((11*x)/3)+1), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\left(\\sin \\left(\\frac{13 \\pi }{90}\\right)+i \\cos \\left(\\frac{13 \\pi }{90}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-2187 \\left(\\sin \\left(\\frac{\\pi }{90}\\right)+i \\cos \\left(\\frac{\\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*(math.sin(((13*math.pi)/90))+1j*math.cos(((13*math.pi)/90))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 x^2+x-2$", + "Output Answer": [ + "$-3 \\left(x-\\frac{1}{6}\\right)^2-\\frac{23}{12}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*x**2+x-2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $-\\tan ^{-1}(3 x+1)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$-\\frac{\\tan (y)}{3}-\\frac{1}{3}\\text{ if }-\\frac{\\pi }{2} 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(3+21)-((23+9)-4)$.", + "Output Answer": [ + "$-4$" + ], + "Output Program": [ + "try: \n print((3+21)-((23+9)-4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $12 x^6-26 x^5-11 x^4+18 x^3+23 x^2-12 x-9$ and $-4 x^4+2 x^3+3 x^2+x-3$.", + "Output Answer": [ + "$4 x^4-2 x^3-3 x^2-x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(12*x**6-26*x**5-11*x**4+18*x**3+23*x**2-12*x-9, -4*x**4+2*x**3+3*x**2+x-3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+3 x+5 y^2+10 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x+\\frac{3}{16}\\right)^2+5 (y+1)^2=\\frac{361}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{16} & -1-\\frac{19 \\sqrt{\\frac{3}{5}}}{16} \\\\\n -\\frac{3}{16} & \\frac{19 \\sqrt{\\frac{3}{5}}}{16}-1 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{3}{2}}}{2}$\nCenter: $\\left\\{-\\frac{3}{16},-1\\right\\}$\nArea Enclosed: $\\frac{361 \\pi }{64 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+3*x+5*y**2+10*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-10 x^2+11 x-9$", + "Output Answer": [ + "$x=\\frac{1}{20} \\left(11-i \\sqrt{239}\\right)\\lor x=\\frac{1}{20} \\left(11+i \\sqrt{239}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-10*x**2+11*x-9, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-7+6 i$ and $y=-8+5 i$", + "Output Answer": [ + "$1+i$" + ], + "Output Program": [ + "i = 1j\nx = -7+6*i\ny = -8+5*i\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\pi x^2+2 \\pi x-\\pi$ and $q(x) = -4 \\pi x^2+4 \\pi x-3 \\pi$", + "Output Answer": [ + "$-4 \\pi ^2 x^4-4 \\pi ^2 x^3+9 \\pi ^2 x^2-10 \\pi ^2 x+3 \\pi ^2$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = pi*x**2+2*pi*x-pi\nq = -4*pi*x**2+4*pi*x-3*pi\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\sqrt{3} \\left(\\frac{1}{4} \\left(\\sqrt{5}-1\\right)-i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)\\right)^8$", + "Output Answer": [ + "$20736 \\left(\\frac{1}{4} \\left(-1-\\sqrt{5}\\right)+i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*math.sqrt(3)*((1/4)*(math.sqrt(5)-1)-1j*math.sqrt((5/8)+((math.sqrt(5))/8))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{3}{4}-9 i$ and $y=-\\frac{7}{4}-\\frac{27 i}{4}$", + "Output Answer": [ + "$\\frac{5}{2}-\\frac{9 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = (3/4)-9*i\ny = -(7/4)-((27*i)/4)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{1-3 i}{\\pi }$ and $y=\\frac{11 i}{\\pi }$", + "Output Answer": [ + "$-\\frac{1-14 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((1-3*i)/math.pi)\ny = ((11*i)/math.pi)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-12 x^2+14 x-3$", + "Output Answer": [ + "$\\frac{13}{12}-12 \\left(x-\\frac{7}{12}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-12*x**2+14*x-3), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 4 x-2| =17$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{15}{4}\\right\\},\\left\\{x\\to \\frac{19}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(4*x-2), 17), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{130 x}{7}+7 y+\\frac{37}{7}=0$, $-22 x+\\frac{74 y}{7}-\\frac{124}{7}=0$", + "Output Answer": [ + "$x=-\\frac{1469}{2861}$, $y=\\frac{1737}{2861}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((130*x)/7)+7*y+(37/7), -22*x+((74*y)/7)-(124/7)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5-10 x$ and $2 x-1$.", + "Output Answer": [ + "$2 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5-10*x, 2*x-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{3}{28}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$\\frac{57}{28}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (3/28) # initial value\nd = 0 # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (3/28) # initial value\nd = 0 # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x+\\frac{34}{3}}+\\sqrt{14 x+\\frac{22}{3}}=\\frac{41}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{25683-164 \\sqrt{10310}}{1521}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x+(34/3))+sqrt(14*x+(22/3)), (41/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{19 x^2}{7}-15 x-13$ and $q(x) = -\\frac{40 x^2}{7}+\\frac{64 x}{7}+\\frac{20}{7}$", + "Output Answer": [ + "$-\\frac{760 x^4}{49}+\\frac{5416 x^3}{49}-\\frac{2700 x^2}{49}-\\frac{1132 x}{7}-\\frac{260}{7}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((19*x**2)/7)-15*x-13\nq = -((40*x**2)/7)+((64*x)/7)+(20/7)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $2 \\sqrt{x}+\\sqrt{8 x+8}=6$", + "Output Answer": [ + "$\\{\\{x\\to 1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(2*sqrt(x)+sqrt(8*x+8), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2-69 x-270$", + "Output Answer": [ + "$-3 (x+5) (x+18)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2-69*x-270, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^6+10 x^5-2 x^4-9 x^2+2 x+7$ when divided by $5 x^2+4 x+9$.", + "Output Answer": [ + "$-\\frac{7 x^4}{5}+\\frac{78 x^3}{25}-\\frac{47 x^2}{125}-\\frac{3322 x}{625}+\\frac{9778}{3125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**6+10*x**5-2*x**4-9*x**2+2*x+7\nq = 5*x**2+4*x+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{1}{4}+\\frac{13 i}{2}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{677}}{4}$\nArgument: $\\pi -\\tan ^{-1}(26)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(1/4)+((13*i)/2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{13 x^6}{2}+\\frac{17 x^5}{2}+\\frac{x^4}{2}+7 x^3+x^2+3 x+3$ when divided by $-4 x^4+5 x^3+\\frac{15 x^2}{2}-\\frac{17 x}{2}+8$.", + "Output Answer": [ + "$-\\frac{13 x^2}{8}-\\frac{133 x}{32}-\\frac{1071}{128}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((13*x**6)/2)+((17*x**5)/2)+((x**4)/2)+7*x**3+x**2+3*x+3\nq = -4*x**4+5*x**3+((15*x**2)/2)-((17*x)/2)+8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^4-9 x^2+9 x+6$ when divided by $-4 x^3-8 x^2-1$.", + "Output Answer": [ + "$\\frac{9 x}{4}-\\frac{9}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**4-9*x**2+9*x+6\nq = -4*x**3-8*x**2-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-5 x^2-4$", + "Output Answer": [ + "$x=\\frac{2 i}{\\sqrt{5}}\\lor x=-\\frac{2 i}{\\sqrt{5}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-5*x**2-4, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $\\frac{6400}{3}-12 x^2$", + "Output Answer": [ + "$-12 \\left(x-\\frac{40}{3}\\right) \\left(x+\\frac{40}{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq((6400/3)-12*x**2, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 3 x^2+14 x+1$, $q(x) = -15 x^2-x-13$", + "Output Answer": [ + "$-12 x^2+13 x-12$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**2+14*x+1\nq = -15*x**2-x-13\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2+144 x-540$", + "Output Answer": [ + "$-12 (3-x) (x+15)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2+144*x-540, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -8 \\sqrt{2} x^2+\\sqrt{2} x-8 \\sqrt{2}$ and $q(x) = -8 \\sqrt{2} x^2-9 \\sqrt{2} x+6 \\sqrt{2}$", + "Output Answer": [ + "$128 x^4+128 x^3+14 x^2+156 x-96$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -8*sqrt(2)*x**2+sqrt(2)*x-8*sqrt(2)\nq = -8*sqrt(2)*x**2-9*sqrt(2)*x+6*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{21+17 i}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{730}}{\\pi }$\nArgument: $\\tan ^{-1}\\left(\\frac{17}{21}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((21+17*i)/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-x-5 y+10=0$, $-23 x+8 y-4=0$", + "Output Answer": [ + "$x=\\frac{20}{41}$, $y=\\frac{78}{41}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-x-5*y+10, -23*x+8*y-4), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-16 x^2-10 x+8}{12 x^2+x-16}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(-5-3 \\sqrt{17}\\right)\\right\\},\\left\\{x\\to \\frac{1}{16} \\left(-5+3 \\sqrt{17}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-16*x**2-10*x+8)/(12*x**2+x-16)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{24 x^2}{\\pi }-\\frac{34 x}{\\pi }+\\frac{7}{\\pi }$ and $q(x) = \\frac{17 x^2}{\\pi }+\\frac{27 x}{\\pi }-\\frac{4}{\\pi }$", + "Output Answer": [ + "$-\\frac{408 x^4}{\\pi ^2}-\\frac{1226 x^3}{\\pi ^2}-\\frac{703 x^2}{\\pi ^2}+\\frac{325 x}{\\pi ^2}-\\frac{28}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((24*x**2)/pi)-((34*x)/pi)+(7/pi)\nq = ((17*x**2)/pi)+((27*x)/pi)-(4/pi)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8-x}+\\sqrt{2} \\sqrt{-x}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -683+30 \\sqrt{466}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8-x)+sqrt(2)*sqrt(-x), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9-5 x}+\\sqrt{-3 x-1}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -67+6 \\sqrt{119}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9-5*x)+sqrt(-3*x-1), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-23 x^2-13 x+1}{16 x^2-x+6}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{46} \\left(-13-3 \\sqrt{29}\\right)\\right\\},\\left\\{x\\to \\frac{1}{46} \\left(-13+3 \\sqrt{29}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-23*x**2-13*x+1)/(16*x**2-x+6)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{19}{29}$, and $a_n=a_{n-1}+-5 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$\\frac{13}{2} \\left(\\frac{38}{29}-60 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (19/29) # initial value\nd = -5*math.sqrt(3) # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (19/29) # initial value\nd = -5*math.sqrt(3) # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{4+21}{7-20}$.", + "Output Answer": [ + "$-\\frac{25}{13}$" + ], + "Output Program": [ + "try: \n print(((4+21)/(7-20)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{81}{256} (4 x+7)^4, q(x) = -\\frac{1}{8} (6 x+1)^3$", + "Output Answer": [ + "$81 x^4+540 x^3+\\frac{11799 x^2}{8}+\\frac{27747 x}{16}+\\frac{194449}{256}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (81/256)*(4*x+7)**4\nq = -(1/8)*(6*x+1)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{656 x^2}{3}+\\frac{4718 x}{9}+\\frac{2714}{9}}{-\\frac{896 x^2}{3}-\\frac{2240 x}{9}+\\frac{322}{9}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{59}{41}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((656*x**2)/3)+((4718*x)/9)+(2714/9))/(-((896*x**2)/3)-((2240*x)/9)+(322/9))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{67}{13}$, and $a_n=a_{n-1}+-7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$-\\frac{4268}{13}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (67/13) # initial value\nd = -7 # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (67/13) # initial value\nd = -7 # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sin (2 x+5)$ at the point $x=6$", + "Output Answer": [ + "$\\sin (17) = -0.961$" + ], + "Output Program": [ + "import math\n\nx = 6\ntry: \n f = math.sin(2*x+5)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=6$, and $a_n=a_{n-1}+\\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$8 (12+15 \\pi )$" + ], + "Output Program": [ + "import math\n\na = 6 # initial value\nd = math.pi # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 6 # initial value\nd = math.pi # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$23 x-5 y-5 z+13=0$, $19 x+3 y+2 z+3=0$, $-14 x-17 y-22 z+18=0$", + "Output Answer": [ + "$x=-\\frac{401}{1281}$, $y=\\frac{268}{427}$, $z=\\frac{682}{1281}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((23*x-5*y-5*z+13, 19*x+3*y+2*z+3, -14*x-17*y-22*z+18)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{4} (10 t+17)^2, x(t)=-5 t-15$", + "Output Answer": [ + "$y=x^2+13 x+\\frac{169}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/4)*(10*t+17)**2\nx_t = -5*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-8 \\left(-\\sin \\left(\\frac{\\pi }{90}\\right)-i \\cos \\left(\\frac{\\pi }{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$-32768 \\left(-\\sin \\left(\\frac{\\pi }{18}\\right)-i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-8*(-math.sin((math.pi/90))-1j*math.cos((math.pi/90))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 14 \\sqrt{2}-\\frac{25 x}{\\sqrt{2}}\\right| =-12 \\sqrt{2}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(14*sqrt(2)-((25*x)/(sqrt(2)))), -12*sqrt(2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -19 x^2-2 x+12\\right| =20$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{19} \\left(-1-\\sqrt{609}\\right)\\right\\},\\left\\{x\\to \\frac{1}{19} \\left(-1+\\sqrt{609}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-19*x**2-2*x+12), 20), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2-4 x+4 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $2 x^2-4 x+4 y=7$\nVertex: $\\left\\{1,\\frac{9}{4}\\right\\}$\nDirectrix: $y=\\frac{11}{4}$\nFocal Parameter: $1$\nFocus: $\\left\\{1,\\frac{7}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2-4*x+4*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{21}{4} \\left(-\\sin \\left(\\frac{4 \\pi }{45}\\right)-i \\cos \\left(\\frac{4 \\pi }{45}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-\\frac{1801088541 \\left(\\cos \\left(\\frac{11 \\pi }{90}\\right)-i \\sin \\left(\\frac{11 \\pi }{90}\\right)\\right)}{16384}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(21/4)*(-math.sin(((4*math.pi)/45))-1j*math.cos(((4*math.pi)/45))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-36 t^2-540 t-2027, x(t)=4 t^2+60 t+225$", + "Output Answer": [ + "$y=-9 x-2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -36*t**2-540*t-2027\nx_t = 4*t**2+60*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(6-9)-6}{3+15}$.", + "Output Answer": [ + "$-\\frac{1}{2}$" + ], + "Output Program": [ + "try: \n print((((6-9)-6)/(3+15)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{21 x}{2}-\\frac{9}{2}}+\\sqrt{-\\frac{13 x}{2}-2}=2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(-39+6 \\sqrt{34}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((21*x)/2)-(9/2))+sqrt(-((13*x)/2)-2), 2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-6 i \\log (2)$ and $y=(10+8 i) \\log (2)$", + "Output Answer": [ + "$(48-60 i) \\log ^2(2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -6*i*math.log10(2)\ny = (10+8*i)*math.log10(2)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $3 x^2-3 x-13$", + "Output Answer": [ + "$3 \\left(x-\\frac{1}{2}\\right)^2-\\frac{55}{4}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (3*x**2-3*x-13), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-3 \\sqrt{5} x^2+10 \\sqrt{5} x+\\sqrt{5}}{6 \\sqrt{5} x^2+4 \\sqrt{5} x-\\sqrt{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(5-2 \\sqrt{7}\\right)\\right\\},\\left\\{x\\to \\frac{1}{3} \\left(5+2 \\sqrt{7}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-3*sqrt(5)*x**2+10*sqrt(5)*x+sqrt(5))/(6*sqrt(5)*x**2+4*sqrt(5)*x-sqrt(5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{\\frac{1-7}{5}}{18}-4\\right)-(((3+4)+2)+23)$.", + "Output Answer": [ + "$-\\frac{541}{15}$" + ], + "Output Program": [ + "try: \n print(((((1-7)/5)/18)-4)-(((3+4)+2)+23))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{74}{99}$, and $a_n=a_{n-1}+-\\frac{9}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$15 \\left(-\\frac{148}{99}-\\frac{261}{\\sqrt{5}}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(74/99) # initial value\nd = -(9/(math.sqrt(5))) # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(74/99) # initial value\nd = -(9/(math.sqrt(5))) # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((10+15)+3) \\frac{15-13}{14}$.", + "Output Answer": [ + "$4$" + ], + "Output Program": [ + "try: \n print(((10+15)+3)*((15-13)/14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{16-3}{22-12}$.", + "Output Answer": [ + "$\\frac{13}{10}$" + ], + "Output Program": [ + "try: \n print(((16-3)/(22-12)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-12 x^2+432 x-3888$", + "Output Answer": [ + "$-12 (18-x)^2$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-12*x**2+432*x-3888, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{69}{7}+\\frac{66 i}{7}$ and $y=\\frac{12}{7}+\\frac{22 i}{7}$", + "Output Answer": [ + "$\\frac{570}{157}-\\frac{363 i}{314}$" + ], + "Output Program": [ + "i = 1j\nx = (69/7)+((66*i)/7)\ny = (12/7)+((22*i)/7)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{34 x^2}{5}+14 x-\\frac{71}{5}$", + "Output Answer": [ + "$-\\frac{34}{5} \\left(x-\\frac{35}{34}\\right)^2-\\frac{1189}{170}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((34*x**2)/5)+14*x-(71/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-18 x^2+\\frac{15 x}{2}-6}{-7 x^2+11 x-\\frac{13}{2}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-18*x**2+((15*x)/2)-6)/(-7*x**2+11*x-(13/2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-x^3+9 x+4$ when divided by $7 x^2-x-2$.", + "Output Answer": [ + "$-\\frac{x}{7}-\\frac{1}{49}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**3+9*x+4\nq = 7*x**2-x-2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-8-10 i$ and $y=-\\frac{13}{2}+\\frac{3 i}{2}$", + "Output Answer": [ + "$\\frac{74}{89}+\\frac{154 i}{89}$" + ], + "Output Program": [ + "i = 1j\nx = -8-10*i\ny = -(13/2)+((3*i)/2)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{79}{26}$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$-\\frac{782}{13}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(79/26) # initial value\nd = -8 # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(79/26) # initial value\nd = -8 # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-10 x-11 y-\\frac{42}{5}=0$, $-\\frac{28 x}{5}-11 y+\\frac{42}{5}=0$", + "Output Answer": [ + "$x=-\\frac{42}{11}$, $y=\\frac{1638}{605}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-10*x-11*y-(42/5), -((28*x)/5)-11*y+(42/5)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{95 x^2}{7}+\\frac{44 x}{7}+\\frac{67}{7}$", + "Output Answer": [ + "$x=\\frac{1}{95} \\left(-22-i \\sqrt{5881}\\right)\\lor x=\\frac{1}{95} \\left(-22+i \\sqrt{5881}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((95*x**2)/7)+((44*x)/7)+(67/7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3 x-1}+\\sqrt{3 x+11}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{269}{300}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3*x-1)+sqrt(3*x+11), 5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\sqrt{2} \\left(\\cos \\left(\\frac{4}{3}\\right)+i \\sin \\left(\\frac{4}{3}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$125000 (\\cos (8)+i \\sin (8))$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*math.sqrt(2)*(math.cos((4/3))+1j*math.sin((4/3))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-165 x^2-174 x+96}{96-240 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{16}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-165*x**2-174*x+96)/(96-240*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{40}{73}$, and $a_n=a_{n-1}+4 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$\\frac{7}{2} \\left(24 \\sqrt{2}-\\frac{80}{73}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(40/73) # initial value\nd = 4*math.sqrt(2) # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(40/73) # initial value\nd = 4*math.sqrt(2) # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{25 x^5}{2}-\\frac{45 x^4}{2}-\\frac{35 x^3}{2}+\\frac{45 x^2}{2}-\\frac{35 x}{2}+25$ and $-\\frac{5 x^5}{2}+\\frac{9 x^4}{2}+\\frac{7 x^3}{2}-\\frac{9 x^2}{2}+\\frac{7 x}{2}-5$.", + "Output Answer": [ + "$\\frac{5 x^5}{2}-\\frac{9 x^4}{2}-\\frac{7 x^3}{2}+\\frac{9 x^2}{2}-\\frac{7 x}{2}+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((25*x**5)/2)-((45*x**4)/2)-((35*x**3)/2)+((45*x**2)/2)-((35*x)/2)+25, -((5*x**5)/2)+((9*x**4)/2)+((7*x**3)/2)-((9*x**2)/2)+((7*x)/2)-5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 2 \\sqrt{3} x^2-3 \\sqrt{3} x-\\frac{32}{\\sqrt{3}}\\right| =12 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(9-\\sqrt{1713}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(9+\\sqrt{1713}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(2*sqrt(3)*x**2-3*sqrt(3)*x-(32/(sqrt(3)))), 12*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{\\left(169 t^2-1950 t+4725\\right)^2}{15625}, x(t)=\\frac{169 t^2}{25}-78 t+225$", + "Output Answer": [ + "$y=\\frac{x^2}{25}-\\frac{72 x}{25}+\\frac{1296}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (((169*t**2-1950*t+4725)**2)/15625)\nx_t = ((169*t**2)/25)-78*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((24-2)-15)-((11+8)+13)$.", + "Output Answer": [ + "$-25$" + ], + "Output Program": [ + "try: \n print(((24-2)-15)-((11+8)+13))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -24 x^2+12 x+23\\right| =0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(3-7 \\sqrt{3}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(3+7 \\sqrt{3}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-24*x**2+12*x+23), 0), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\sqrt{2} x^2-\\frac{11 x}{\\sqrt{2}}-5 \\sqrt{2}$ and $q(x) = 3 \\sqrt{2} x^2+8 \\sqrt{2} x-7 \\sqrt{2}$", + "Output Answer": [ + "$6 x^4-17 x^3-132 x^2-3 x+70$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = sqrt(2)*x**2-((11*x)/(sqrt(2)))-5*sqrt(2)\nq = 3*sqrt(2)*x**2+8*sqrt(2)*x-7*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{36}{35}$, and $a_n=a_{n-1}+2 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$15 \\left(58 \\sqrt{2}-\\frac{72}{35}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(36/35) # initial value\nd = 2*math.sqrt(2) # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(36/35) # initial value\nd = 2*math.sqrt(2) # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{53 y}{3}-\\frac{65}{3}=0$, $-\\frac{53 x}{3}-14 y-20=0$", + "Output Answer": [ + "$x=-\\frac{450}{2809}$, $y=-\\frac{65}{53}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((53*y)/3)-(65/3), -((53*x)/3)-14*y-20), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-14 x^2-10 x+4$", + "Output Answer": [ + "$x=\\frac{2}{7}\\lor x=-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-14*x**2-10*x+4, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 \\sqrt{3} x^2+7 \\sqrt{3} x-6 \\sqrt{3}$", + "Output Answer": [ + "$x=\\frac{1}{12} \\left(7-i \\sqrt{95}\\right)\\lor x=\\frac{1}{12} \\left(7+i \\sqrt{95}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*sqrt(3)*x**2+7*sqrt(3)*x-6*sqrt(3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{1}{2}-\\frac{13 x}{2}}+\\sqrt{-6 x-\\frac{19}{2}}=\\frac{17}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-7185+34 \\sqrt{44566}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((1/2)-((13*x)/2))+sqrt(-6*x-(19/2)), (17/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x+\\frac{68}{5}}+\\sqrt{\\frac{34 x}{5}-\\frac{52}{5}}=\\frac{27}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{15} \\left(1793-6 \\sqrt{86910}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x+(68/5))+sqrt(((34*x)/5)-(52/5)), (27/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 6-3 x$, $q(x) = 5 x^2+14 x+4$", + "Output Answer": [ + "$5 x^2+11 x+10$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6-3*x\nq = 5*x**2+14*x+4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 5 x-20| =17$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{5}\\right\\},\\left\\{x\\to \\frac{37}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(5*x-20), 17), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-12 x+13 y-17=0$, $13 x+15 y+19=0$", + "Output Answer": [ + "$x=-\\frac{502}{349}$, $y=-\\frac{7}{349}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-12*x+13*y-17, 13*x+15*y+19), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $7 x^3+238 x^2+\\frac{8757 x}{4}+2772$", + "Output Answer": [ + "$-7 \\left(-x-\\frac{33}{2}\\right) \\left(x+\\frac{3}{2}\\right) (x+16)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(7*x**3+238*x**2+((8757*x)/4)+2772, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^6-4 x^5+x^4+6 x^3+9 x^2-8 x-3$ when divided by $9 x^4-7 x^3+7 x^2+2 x-4$.", + "Output Answer": [ + "$\\frac{2 x^2}{9}-\\frac{22 x}{81}-\\frac{199}{729}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**6-4*x**5+x**4+6*x**3+9*x**2-8*x-3\nq = 9*x**4-7*x**3+7*x**2+2*x-4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{51 x^2}{7}+\\frac{55 x}{7}+\\frac{93}{7}$", + "Output Answer": [ + "$\\frac{51}{7} \\left(x+\\frac{55}{102}\\right)^2+\\frac{15947}{1428}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((51*x**2)/7)+((55*x)/7)+(93/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{22+15}{19}}{18+16}$.", + "Output Answer": [ + "$\\frac{37}{646}$" + ], + "Output Program": [ + "try: \n print((((22+15)/19)/(18+16)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=2 \\sqrt{5} \\left(40 t^2+140 t+123\\right), x(t)=80 t^2+280 t+245$", + "Output Answer": [ + "$y=\\sqrt{5} x+\\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 2*sqrt(5)*(40*t**2+140*t+123)\nx_t = 80*t**2+280*t+245\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{3} \\left(x^2+x+1\\right)$, $q(x) = -\\sqrt{3} \\left(x^2-7 x+2\\right)$", + "Output Answer": [ + "$8 \\sqrt{3} x-\\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(3)*(x**2+x+1)\nq = -sqrt(3)*(x**2-7*x+2)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $x^2+2 x-5$", + "Output Answer": [ + "$(x+1)^2-6$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (x**2+2*x-5), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-3+i) \\pi$ and $y=(-2-2 i) \\pi$", + "Output Answer": [ + "$(-1+3 i) \\pi$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-3+i)*math.pi\ny = (-2-2*i)*math.pi\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11 x-14}+\\sqrt{12 x-15}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 576-10 \\sqrt{3297}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11*x-14)+sqrt(12*x-15), 5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{38 x}{3}-\\frac{1}{3}}+\\sqrt{-\\frac{25 x}{3}-\\frac{25}{3}}=\\frac{32}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{507} \\left(-63576+320 \\sqrt{37469}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((38*x)/3)-(1/3))+sqrt(-((25*x)/3)-(25/3)), (32/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{4}{81} (5 t+111)^2, x(t)=-\\frac{2 t}{3}-15$", + "Output Answer": [ + "$y=\\frac{25 x^2}{9}+\\frac{10 x}{9}+\\frac{1}{9}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (4/81)*(5*t+111)**2\nx_t = -((2*t)/3)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-7 x+9 y+21=0$, $x+9 y+21=0$", + "Output Answer": [ + "$x=0$, $y=-\\frac{7}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-7*x+9*y+21, x+9*y+21), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^5-7 x^4-3 x^3+10 x^2-8 x+7$ when divided by $4 x^4-3 x^3+7 x^2+10 x+5$.", + "Output Answer": [ + "$-\\frac{x}{2}-\\frac{17}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**5-7*x**4-3*x**3+10*x**2-8*x+7\nq = 4*x**4-3*x**3+7*x**2+10*x+5\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-2 \\sqrt{2} x^2+16 \\sqrt{2} x+5 \\sqrt{2}}{8 \\sqrt{2} x+12 \\sqrt{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(8-\\sqrt{74}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(8+\\sqrt{74}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-2*sqrt(2)*x**2+16*sqrt(2)*x+5*sqrt(2))/(8*sqrt(2)*x+12*sqrt(2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{9}{24} ((8+6)+19)$.", + "Output Answer": [ + "$\\frac{99}{8}$" + ], + "Output Program": [ + "try: \n print((9/24)*((8+6)+19))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{5}{44}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$\\frac{2665}{44}$" + ], + "Output Program": [ + "a = (5/44) # initial value\nd = 6 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (5/44) # initial value\nd = 6 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 11 \\sqrt{3} x+8 \\sqrt{3}\\right| =10 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{18}{11}\\right\\},\\left\\{x\\to \\frac{2}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11*sqrt(3)*x+8*sqrt(3)), 10*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{5-17 i}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\sqrt{\\frac{314}{3}}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{17}{5}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((5-17*i)/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{12 x^4}{5}-x^3+4 x^2+\\frac{6 x}{5}-\\frac{2}{5}$ when divided by $\\frac{42 x}{5}-\\frac{46}{5}$.", + "Output Answer": [ + "$-\\frac{2 x^3}{7}-\\frac{127 x^2}{294}+\\frac{19 x}{6174}+\\frac{18959}{129654}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((12*x**4)/5)-x**3+4*x**2+((6*x)/5)-(2/5)\nq = ((42*x)/5)-(46/5)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\sqrt{3} \\left(\\cos \\left(\\frac{53}{45}\\right)+i \\sin \\left(\\frac{53}{45}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$1728 \\left(\\cos \\left(\\frac{106}{15}\\right)+i \\sin \\left(\\frac{106}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*math.sqrt(3)*(math.cos((53/45))+1j*math.sin((53/45))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{6-4}{8}+13}{(22+17)-3}$.", + "Output Answer": [ + "$\\frac{53}{144}$" + ], + "Output Program": [ + "try: \n print(((((6-4)/8)+13)/((22+17)-3)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$23 x+3 y-12=0$, $20 x+5 y-7=0$", + "Output Answer": [ + "$x=\\frac{39}{55}$, $y=-\\frac{79}{55}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((23*x+3*y-12, 20*x+5*y-7), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-4 x+4 y^2+y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-4 x+4 y^2+y=6$\nVertex: $\\left\\{-\\frac{97}{64},-\\frac{1}{8}\\right\\}$\nDirectrix: $x=-\\frac{113}{64}$\nFocal Parameter: $\\frac{1}{2}$\nFocus: $\\left\\{-\\frac{81}{64},-\\frac{1}{8}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x+4*y**2+y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{1}{2}$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$153$" + ], + "Output Program": [ + "a = (1/2) # initial value\nd = 10 # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (1/2) # initial value\nd = 10 # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{13}{2}-6 x}+\\sqrt{-\\frac{7 x}{2}-6}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{25} \\left(-1737+14 \\sqrt{14114}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((13/2)-6*x)+sqrt(-((7*x)/2)-6), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt[3]{194}-\\left(\\sqrt[3]{141}+\\sqrt[3]{4}\\right)$.", + "Output Answer": [ + "$-2^{2/3}-\\sqrt[3]{141}+\\sqrt[3]{194}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(cbrt(194)-(cbrt(141)+cbrt(4)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -3 \\sqrt{3} x^2+\\frac{16 x}{\\sqrt{3}}-\\frac{13}{\\sqrt{3}}\\right| =8 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(8-\\sqrt{163}\\right)\\right\\},\\left\\{x\\to \\frac{1}{9} \\left(8+\\sqrt{163}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-3*sqrt(3)*x**2+((16*x)/(sqrt(3)))-(13/(sqrt(3)))), 8*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-6 t+4 \\sqrt{3}+54, x(t)=\\sqrt{3} t-9 \\sqrt{3}$", + "Output Answer": [ + "$y=4 \\sqrt{3}-2 \\sqrt{3} x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -6*t+4*sqrt(3)+54\nx_t = sqrt(3)*t-9*sqrt(3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{47 x}{4}-\\frac{19}{2}}+\\sqrt{\\frac{7}{2}-11 x}=\\frac{43}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{36} \\left(-168883+172 \\sqrt{962923}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((47*x)/4)-(19/2))+sqrt((7/2)-11*x), (43/4)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^5-4 x^4+\\frac{2 x^3}{3}+\\frac{11 x^2}{3}-3 x-9$ when divided by $\\frac{25 x^2}{3}+\\frac{2 x}{3}-\\frac{8}{3}$.", + "Output Answer": [ + "$\\frac{24 x^3}{25}-\\frac{348 x^2}{625}+\\frac{6746 x}{15625}+\\frac{88783}{390625}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**5-4*x**4+((2*x**3)/3)+((11*x**2)/3)-3*x-9\nq = ((25*x**2)/3)+((2*x)/3)-(8/3)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^5+8 x^4+6 x^3-8 x^2-9 x+9$ when divided by $-4 x^2-7 x+7$.", + "Output Answer": [ + "$-2 x^3+\\frac{3 x^2}{2}-\\frac{61 x}{8}+\\frac{575}{32}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**5+8*x**4+6*x**3-8*x**2-9*x+9\nq = -4*x**2-7*x+7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{35 x}{4}+\\frac{27}{4}}+\\sqrt{\\frac{55 x}{4}+\\frac{15}{2}}=\\frac{9}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{40} \\left(723-9 \\sqrt{6585}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((35*x)/4)+(27/4))+sqrt(((55*x)/4)+(15/2)), (9/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^4-x^3+6 x^2+8 x+3$ when divided by $9 x^3+7 x^2-6 x+6$.", + "Output Answer": [ + "$\\frac{2 x}{9}-\\frac{23}{81}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**4-x**3+6*x**2+8*x+3\nq = 9*x**3+7*x**2-6*x+6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-9 \\left(\\cos \\left(\\frac{31}{90}\\right)+i \\sin \\left(\\frac{31}{90}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$531441 \\left(\\cos \\left(\\frac{31}{15}\\right)+i \\sin \\left(\\frac{31}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-9*(math.cos((31/90))+1j*math.sin((31/90))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((8-13)-13)+(8+16)$.", + "Output Answer": [ + "$6$" + ], + "Output Program": [ + "try: \n print(((8-13)-13)+(8+16))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 5 \\sqrt{5}-6 \\sqrt{5} x\\right| =0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5}{6}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(5*sqrt(5)-6*sqrt(5)*x), 0), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\cos \\left(\\frac{\\pi }{15}\\right)-i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)^10$", + "Output Answer": [ + "$-\\frac{1}{2}+\\frac{i \\sqrt{3}}{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-math.cos((math.pi/15))-1j*math.sin((math.pi/15)))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((15-25)+2)-7)^2+\\frac{1}{24} ((13-7)-17)$.", + "Output Answer": [ + "$\\frac{5389}{24}$" + ], + "Output Program": [ + "try: \n print((((15-25)+2)-7)**2+(1/24)*((13-7)-17))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=9 (18-5 t)^2, x(t)=5 t-15$", + "Output Answer": [ + "$y=9 x^2-54 x+81$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 9*(18-5*t)**2\nx_t = 5*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-3 e^{-1+\\frac{29 i \\pi }{90}}$.", + "Output Answer": [ + "Norm: $\\frac{3}{e}$\nArgument: $-\\frac{61 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -3*math.e**(-1+((29*i*math.pi)/90))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 \\left(96 t^2-360 t+337\\right), x(t)=64 t^2-240 t+225$", + "Output Answer": [ + "$y=6 x-2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*(96*t**2-360*t+337)\nx_t = 64*t**2-240*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{137}{2}-36 t, x(t)=8 t-15$", + "Output Answer": [ + "$y=1-\\frac{9 x}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (137/2)-36*t\nx_t = 8*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-5 x^2-15 x+7$", + "Output Answer": [ + "$\\frac{73}{4}-5 \\left(x+\\frac{3}{2}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-5*x**2-15*x+7), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{8}{79}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$-\\frac{72}{79}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(8/79) # initial value\nd = 0 # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(8/79) # initial value\nd = 0 # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\log (9)-\\tan (3-3 x)$", + "Output Answer": [ + "$\\frac{3-3 x}{\\pi }+\\frac{1}{2}\\notin \\mathbb{Z}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = log(9)-tan(3-3*x)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{175 x^2}{3}-\\frac{920 x}{9}+5}{\\frac{850 x}{9}+170}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{21}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((175*x**2)/3)-((920*x)/9)+5)/(((850*x)/9)+170)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2+135 \\sqrt{2} x-648$", + "Output Answer": [ + "$-9 \\left(x-12 \\sqrt{2}\\right) \\left(x-3 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2+135*sqrt(2)*x-648, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $4 \\sqrt{2} \\left(\\frac{\\sqrt{3}}{2}-\\frac{i}{2}\\right)$.", + "Output Answer": [ + "Norm: $4 \\sqrt{2}$\nArgument: $-\\frac{\\pi }{6}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 4*math.sqrt(2)*(((math.sqrt(3))/2)-(i/2))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{5 x^2-26 x+20}{e}$, $q(x) = \\frac{-39 x^2-38 x+3}{e}$", + "Output Answer": [ + "$-\\frac{34 x^2}{e}-\\frac{64 x}{e}+\\frac{23}{e}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x\n\np = ((5*x**2-26*x+20)/math.e)\nq = ((-39*x**2-38*x+3)/math.e)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\left(\\sin \\left(\\frac{4 \\pi }{45}\\right)+i \\cos \\left(\\frac{4 \\pi }{45}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$36 \\left(-\\cos \\left(\\frac{8 \\pi }{45}\\right)+i \\sin \\left(\\frac{8 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*(math.sin(((4*math.pi)/45))+1j*math.cos(((4*math.pi)/45))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $7 x^3+126 x^2+483 x-616$", + "Output Answer": [ + "$7 (-x-11) (-x-8) (x-1)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(7*x**3+126*x**2+483*x-616, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^5-6 x^4+8 x^3+4 x^2+x+1$ when divided by $-2 x^2+x+1$.", + "Output Answer": [ + "$x^3+\\frac{7 x^2}{2}-\\frac{7 x}{4}-\\frac{9}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**5-6*x**4+8*x**3+4*x**2+x+1\nq = -2*x**2+x+1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\sqrt{5}$ and $y=4 \\sqrt{5}$", + "Output Answer": [ + "$-5 \\sqrt{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -math.sqrt(5)\ny = 4*math.sqrt(5)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$-\\cos \\left(7-6 x^3\\right) \\csc (6-x)$", + "Output Answer": [ + "$\\frac{6-x}{\\pi }\\notin \\mathbb{Z}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = -cos(7-6*x**3)*csc(6-x)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{13}{4} \\left(\\cos \\left(\\frac{7 \\pi }{45}\\right)+i \\sin \\left(\\frac{7 \\pi }{45}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$\\frac{4826809 \\left(-\\cos \\left(\\frac{\\pi }{15}\\right)+i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)}{4096}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(13/4)*(math.cos(((7*math.pi)/45))+1j*math.sin(((7*math.pi)/45))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{5}, 10, \\sqrt{3})$", + "Output Answer": [ + "$\\left\\{\\frac{4 \\sqrt{161}}{5},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{2501}{3}}}{5}\\right),\\tan ^{-1}(50)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/5)\ny = 10\nz = math.sqrt(3)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{145}}{\\sqrt{175}}$.", + "Output Answer": [ + "$\\sqrt{\\frac{29}{35}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(145))/(sqrt(175))))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-2 x-10 y^2+9 y+10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x-\\frac{1}{6}\\right)^2-10 \\left(y-\\frac{9}{20}\\right)^2=-\\frac{1423}{120}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{6} & \\frac{1}{60} \\left(27-2 \\sqrt{2846}\\right) \\\\\n \\frac{1}{6} & \\frac{1}{60} \\left(27+2 \\sqrt{2846}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{\\frac{1}{6},\\frac{1}{2} \\left(\\frac{1}{60} \\left(27-2 \\sqrt{2846}\\right)+\\frac{1}{60} \\left(27+2 \\sqrt{2846}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{60} \\left(27+2 \\sqrt{15}\\right)-\\sqrt{\\frac{3}{5}} x,y=\\sqrt{\\frac{3}{5}} x+\\frac{1}{60} \\left(27-2 \\sqrt{15}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-2*x-10*y**2+9*y+10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (4-7 x)^4, q(x) = (7-2 x)^4$", + "Output Answer": [ + "$2417 x^4-5712 x^3+5880 x^2-4536 x+2657$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (4-7*x)**4\nq = (7-2*x)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{23}{4}+\\frac{19 i}{2}$ and $y=2+\\frac{i}{2}$", + "Output Answer": [ + "$-\\frac{27}{17}+\\frac{175 i}{34}$" + ], + "Output Program": [ + "i = 1j\nx = -(23/4)+((19*i)/2)\ny = 2+(i/2)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{107}-\\sqrt{48}$.", + "Output Answer": [ + "$\\sqrt{107}-4 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(107)-sqrt(48))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-22 x-17 y-5=0$, $-19 x-17 y+4=0$", + "Output Answer": [ + "$x=-3$, $y=\\frac{61}{17}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-22*x-17*y-5, -19*x-17*y+4), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{16 x^3}{5}+\\frac{6 x^2}{5}+4 x-\\frac{6}{5}$ when divided by $x^2-\\frac{14 x}{5}+\\frac{9}{5}$.", + "Output Answer": [ + "$\\frac{16 x}{5}+\\frac{254}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((16*x**3)/5)+((6*x**2)/5)+4*x-(6/5)\nq = x**2-((14*x)/5)+(9/5)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{49}{75}$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$\\frac{28304}{15}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(49/75) # initial value\nd = 10 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(49/75) # initial value\nd = 10 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-12 x-12}+\\sqrt{-4 x-4}=3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(-26+9 \\sqrt{3}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-12*x-12)+sqrt(-4*x-4), 3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\sqrt{3} \\left(\\cos \\left(\\frac{71}{90}\\right)+i \\sin \\left(\\frac{71}{90}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$254803968 \\left(\\cos \\left(\\frac{71}{9}\\right)+i \\sin \\left(\\frac{71}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*math.sqrt(3)*(math.cos((71/90))+1j*math.sin((71/90))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{3+4 i}{\\sqrt{2}}$ and $y=\\frac{1+11 i}{\\sqrt{2}}$", + "Output Answer": [ + "$-\\frac{4+15 i}{\\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((3+4*i)/(math.sqrt(2)))\ny = ((1+11*i)/(math.sqrt(2)))\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-17 x^2+5 x-18}{-25 x-13}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-17*x**2+5*x-18)/(-25*x-13)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{93 x}{4}-\\frac{7 y}{2}-\\frac{37 z}{2}-\\frac{29}{2}=0$, $\\frac{x}{4}+\\frac{43 y}{4}+\\frac{43 z}{2}-23=0$, $20 x+\\frac{21 y}{4}+\\frac{11 z}{4}+\\frac{37}{2}=0$", + "Output Answer": [ + "$x=-\\frac{352486}{280809}$, $y=\\frac{262550}{280809}$, $z=\\frac{173224}{280809}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((93*x)/4)-((7*y)/2)-((37*z)/2)-(29/2), (x/4)+((43*y)/4)+((43*z)/2)-23, 20*x+((21*y)/4)+((11*z)/4)+(37/2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x+4$ and $3 x^2-x-4$.", + "Output Answer": [ + "$x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x+4, 3*x**2-x-4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{29 x^2}{3}+\\frac{28 x}{3}-\\frac{26}{3}$", + "Output Answer": [ + "$-\\frac{29}{3} \\left(x-\\frac{14}{29}\\right)^2-\\frac{186}{29}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((29*x**2)/3)+((28*x)/3)-(26/3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)+i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)^7$", + "Output Answer": [ + "$\\sin \\left(\\frac{\\pi }{18}\\right)-i \\cos \\left(\\frac{\\pi }{18}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.cos(((2*math.pi)/9))+1j*math.sin(((2*math.pi)/9)))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{84}{25}$, and $a_n=a_{n-1}+-10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$-\\frac{90018}{25}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(84/25) # initial value\nd = -10 # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(84/25) # initial value\nd = -10 # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{4 x^2}{\\sqrt{3}}+8 \\sqrt{3} x-\\frac{1}{\\sqrt{3}}$ and $q(x) = -3 \\sqrt{3} x^2+\\frac{14 x}{\\sqrt{3}}-\\sqrt{3}$", + "Output Answer": [ + "$-12 x^4-\\frac{160 x^3}{3}+111 x^2-\\frac{86 x}{3}+1$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((4*x**2)/(sqrt(3)))+8*sqrt(3)*x-(1/(sqrt(3)))\nq = -3*sqrt(3)*x**2+((14*x)/(sqrt(3)))-sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\sqrt{6 x^4+4}$", + "Output Answer": [ + "$y\\geq 2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(sqrt(6*x**4+4), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-8 i$ and $y=7-8 i$", + "Output Answer": [ + "$-64-56 i$" + ], + "Output Program": [ + "i = 1j\nx = -8*i\ny = 7-8*i\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-24 e^{-1+\\frac{49 i \\pi }{90}}$.", + "Output Answer": [ + "Norm: $\\frac{24}{e}$\nArgument: $-\\frac{41 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -24*math.e**(-1+((49*i*math.pi)/90))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-21 x+19 y-10 z+24=0$, $x-5 y+17 z-13=0$, $-x-5 y+24 z-8=0$", + "Output Answer": [ + "$x=-\\frac{161}{4}$, $y=-\\frac{1461}{28}$, $z=-\\frac{171}{14}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-21*x+19*y-10*z+24, x-5*y+17*z-13, -x-5*y+24*z-8)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-2 x^2-2 x+2 y^2+4 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 (y+1)^2-2 \\left(x+\\frac{1}{2}\\right)^2=\\frac{23}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{2} & -1-\\sqrt{\\frac{23}{2}} \\\\\n -\\frac{1}{2} & \\sqrt{\\frac{23}{2}}-1 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{-\\frac{1}{2},-1\\right\\}$\nAsymptotes: $\\left\\{y=-x-\\frac{3}{2},y=x-\\frac{1}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x**2-2*x+2*y**2+4*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left((13-1)^2+13\\right)^2+11\\right)-1\\right)-\\left(\\left(((10-9)+20)^2-24\\right)+2\\right)^2$.", + "Output Answer": [ + "$-150902$" + ], + "Output Program": [ + "try: \n print(((((13-1)**2+13)**2+11)-1)-((((10-9)+20)**2-24)+2)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((11-9)-24)+(10+6)$.", + "Output Answer": [ + "$-6$" + ], + "Output Program": [ + "try: \n print(((11-9)-24)+(10+6))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{9 x^2}{2}-\\frac{93 x}{4}+16}{24 x-\\frac{45}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(31-\\sqrt{449}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(31+\\sqrt{449}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((9*x**2)/2)-((93*x)/4)+16)/(24*x-(45/2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5-\\frac{25 x}{2}$ and $5$.", + "Output Answer": [ + "$\\frac{5}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5-((25*x)/2), 5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2-3 x+\\frac{35}{16}$", + "Output Answer": [ + "$-\\left(\\left(\\frac{7}{4}-x\\right) \\left(x-\\frac{5}{4}\\right)\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2-3*x+(35/16), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-11 x+15 y+9=0$, $-6 x+19 y+10=0$", + "Output Answer": [ + "$x=\\frac{3}{17}$, $y=-\\frac{8}{17}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-11*x+15*y+9, -6*x+19*y+10), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-36 x^2+134 x+126}{-117 x^2-136 x-35}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{9}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-36*x**2+134*x+126)/(-117*x**2-136*x-35)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{5} \\left(32 x^2-70 x-13\\right)$, $q(x) = -\\frac{32 x^2}{5}-7 x+\\frac{56}{5}$", + "Output Answer": [ + "$\\frac{43}{5}-21 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/5)*(32*x**2-70*x-13)\nq = -((32*x**2)/5)-7*x+(56/5)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(3+3 i) \\sqrt{3}$ and $y=(4-i) \\sqrt{3}$", + "Output Answer": [ + "$(-1+4 i) \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (3+3*i)*math.sqrt(3)\ny = (4-i)*math.sqrt(3)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{-4 x-4}$ at the point $x=3$", + "Output Answer": [ + "$-2 \\sqrt[3]{2} = -2.52$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 3\ntry: \n f = np.cbrt(-4*x-4)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{177}-\\left(\\sqrt{79}+41\\right)$.", + "Output Answer": [ + "$-41-\\sqrt{79}+\\sqrt{177}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(177)-(sqrt(79)+41))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^4+4 x^3+8 x^2-1$ when divided by $7 x^3+4 x^2-10 x-8$.", + "Output Answer": [ + "$\\frac{3 x}{7}+\\frac{16}{49}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**4+4*x**3+8*x**2-1\nq = 7*x**3+4*x**2-10*x-8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{152 x}{7}-\\frac{9 y}{7}+\\frac{61}{7}=0$, $-\\frac{62 x}{7}-\\frac{19 y}{7}+\\frac{107}{7}=0$", + "Output Answer": [ + "$x=\\frac{98}{1165}$, $y=\\frac{6241}{1165}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((152*x)/7)-((9*y)/7)+(61/7), -((62*x)/7)-((19*y)/7)+(107/7)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-16 x^4-4 x^3-16 x^2+7 x-10$ and $-4 x^2-4 x-5$.", + "Output Answer": [ + "$4 x^2+4 x+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-16*x**4-4*x**3-16*x**2+7*x-10, -4*x**2-4*x-5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 x^2+5 x-3$ and $q(x) = -10 x^2-2 x-12$", + "Output Answer": [ + "$40 x^4-42 x^3+68 x^2-54 x+36$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*x**2+5*x-3\nq = -10*x**2-2*x-12\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^5-3 x^4-10 x^3+2 x^2+x-9$ when divided by $9 x-8$.", + "Output Answer": [ + "$x^4+\\frac{5 x^3}{9}-\\frac{50 x^2}{81}-\\frac{238 x}{729}-\\frac{1175}{6561}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**5-3*x**4-10*x**3+2*x**2+x-9\nq = 9*x-8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x+1}+\\sqrt{10 x+2}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(170-7 \\sqrt{493}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x+1)+sqrt(10*x+2), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{7 \\left(\\cos \\left(\\frac{151}{90}\\right)+i \\sin \\left(\\frac{151}{90}\\right)\\right)}{\\sqrt{3}}\\right)^2$", + "Output Answer": [ + "$\\frac{49}{3} \\left(\\cos \\left(\\frac{151}{45}\\right)+i \\sin \\left(\\frac{151}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((7*(math.cos((151/90))+1j*math.sin((151/90))))/(math.sqrt(3))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{4}, \\frac{1}{7}, \\sqrt{3})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{2417}}{28},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{65}{3}}}{28}\\right),\\tan ^{-1}\\left(\\frac{4}{7}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/4)\ny = (1/7)\nz = math.sqrt(3)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2+2 x+3$ and $2 x^2-4 x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2+2*x+3, 2*x**2-4*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{18-16}{7}+8\\right)+\\left(\\frac{16}{13}+8\\right)$.", + "Output Answer": [ + "$\\frac{1594}{91}$" + ], + "Output Program": [ + "try: \n print((((18-16)/7)+8)+((16/13)+8))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-13 x+3 y+15=0$, $14 x-14 y-20=0$", + "Output Answer": [ + "$x=\\frac{15}{14}$, $y=-\\frac{5}{14}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-13*x+3*y+15, 14*x-14*y-20), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{17}{38}$, and $a_n=a_{n-1}+-10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$-\\frac{3403}{2}$" + ], + "Output Program": [ + "a = (17/38) # initial value\nd = -10 # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (17/38) # initial value\nd = -10 # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $11 x^2+2 x+2$", + "Output Answer": [ + "$11 \\left(x+\\frac{1}{11}\\right)^2+\\frac{21}{11}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (11*x**2+2*x+2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $8 x^2-6 x-10$", + "Output Answer": [ + "$8 \\left(x-\\frac{3}{8}\\right)^2-\\frac{89}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (8*x**2-6*x-10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{43 x^2}{7}-\\frac{31 x}{7}-\\frac{67}{7}$", + "Output Answer": [ + "$x=\\frac{1}{86} \\left(31-\\sqrt{12485}\\right)\\lor x=\\frac{1}{86} \\left(31+\\sqrt{12485}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((43*x**2)/7)-((31*x)/7)-(67/7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 6 x^2-8 x+13$ and $q(x) = -11 x^2-15 x+8$", + "Output Answer": [ + "$-66 x^4-2 x^3+25 x^2-259 x+104$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 6*x**2-8*x+13\nq = -11*x**2-15*x+8\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=2$, and $a_n=a_{n-1}+-4 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$7 \\left(4-52 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\na = 2 # initial value\nd = -4*math.sqrt(3) # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 2 # initial value\nd = -4*math.sqrt(3) # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{59 x^2}{4}+\\frac{23 x}{4}-\\frac{13}{2}$", + "Output Answer": [ + "$\\frac{59}{4} \\left(x+\\frac{23}{118}\\right)^2-\\frac{6665}{944}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((59*x**2)/4)+((23*x)/4)-(13/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\sqrt{5}, \\sqrt{3}, \\frac{1}{\\sqrt{3}})$", + "Output Answer": [ + "$\\left\\{\\frac{5}{\\sqrt{3}},\\tan ^{-1}\\left(2 \\sqrt{6}\\right),\\tan ^{-1}\\left(\\sqrt{\\frac{3}{5}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.sqrt(5)\ny = math.sqrt(3)\nz = (1/(math.sqrt(3)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{8 (7 x-4)^3}{3 \\sqrt{3}}, q(x) = \\frac{16}{9} (5 x+6)^4$", + "Output Answer": [ + "$\\frac{10000 x^4}{9}-\\frac{2744 x^3}{3 \\sqrt{3}}+\\frac{16000 x^3}{3}+\\frac{1568 x^2}{\\sqrt{3}}+9600 x^2-\\frac{896 x}{\\sqrt{3}}+7680 x+\\frac{512}{3 \\sqrt{3}}+2304$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((8*(7*x-4)**3)/(3*sqrt(3)))\nq = (16/9)*(5*x+6)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^4+12 x^2+9 x+6$ and $x^4+4 x^2+3 x+2$.", + "Output Answer": [ + "$x^4+4 x^2+3 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**4+12*x**2+9*x+6, x**4+4*x**2+3*x+2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2+3 \\sqrt{2} x+56$", + "Output Answer": [ + "$-\\left(\\left(-x-4 \\sqrt{2}\\right) \\left(7 \\sqrt{2}-x\\right)\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2+3*sqrt(2)*x+56, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\sqrt{3} \\left(\\cos \\left(\\frac{17 \\pi }{90}\\right)-i \\sin \\left(\\frac{17 \\pi }{90}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\sqrt{3 \\left(\\sin ^2\\left(\\frac{17 \\pi }{90}\\right)+\\cos ^2\\left(\\frac{17 \\pi }{90}\\right)\\right)}$\nArgument: $-\\frac{17 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = math.sqrt(3)*(math.cos(((17*math.pi)/90))-i*math.sin(((17*math.pi)/90)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-14 x^2-3 x$", + "Output Answer": [ + "$\\frac{9}{56}-14 \\left(x+\\frac{3}{28}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-14*x**2-3*x), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{143}+\\sqrt{66}}{\\sqrt{58}}$.", + "Output Answer": [ + "$\\sqrt{\\frac{33}{29}}+\\sqrt{\\frac{143}{58}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(143)+sqrt(66))/(sqrt(58))))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt{2 x^5+5}-\\log \\left(\\frac{3 x}{2}-5\\right)$", + "Output Answer": [ + "$x>\\frac{10}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sqrt(2*x**5+5)-log(((3*x)/2)-5)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{21 x^2-2 x-17}{17 x+15}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{21} \\left(1-\\sqrt{358}\\right)\\right\\},\\left\\{x\\to \\frac{1}{21} \\left(1+\\sqrt{358}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((21*x**2-2*x-17)/(17*x+15)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{14 x^3}{3}+3 x^2+\\frac{4 x}{3}-\\frac{10}{3}$ when divided by $\\frac{19 x}{3}+\\frac{22}{3}$.", + "Output Answer": [ + "$-\\frac{14 x^2}{19}+\\frac{479 x}{361}-\\frac{9094}{6859}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((14*x**3)/3)+3*x**2+((4*x)/3)-(10/3)\nq = ((19*x)/3)+(22/3)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^4-5 x^3-7 x^2+9 x-9$ when divided by $9-x$.", + "Output Answer": [ + "$-4 x^3-31 x^2-272 x-2457$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**4-5*x**3-7*x**2+9*x-9\nq = 9-x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-7-3 i$ and $y=-4+6 i$", + "Output Answer": [ + "$\\frac{5}{26}+\\frac{27 i}{26}$" + ], + "Output Program": [ + "i = 1j\nx = -7-3*i\ny = -4+6*i\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-5 x+6 y^2-3 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x-\\frac{5}{8}\\right)^2+6 \\left(y-\\frac{1}{4}\\right)^2=\\frac{127}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{24} \\left(15-\\sqrt{381}\\right) & \\frac{1}{4} \\\\\n \\frac{1}{24} \\left(15+\\sqrt{381}\\right) & \\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{24} \\left(15-\\sqrt{381}\\right)+\\frac{1}{24} \\left(15+\\sqrt{381}\\right)\\right),\\frac{1}{4}\\right\\}$\nArea Enclosed: $\\frac{127 \\pi }{32 \\sqrt{6}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-5*x+6*y**2-3*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{91 x}{4}-12 y+\\frac{13 z}{2}-\\frac{25}{4}=0$, $12 x-\\frac{15 y}{2}-7 z+\\frac{55}{4}=0$, $\\frac{17 x}{2}-\\frac{y}{4}-\\frac{51 z}{4}+\\frac{1}{4}=0$", + "Output Answer": [ + "$x=-\\frac{85748}{91609}$, $y=\\frac{167935}{183218}$, $z=-\\frac{114031}{183218}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((91*x)/4)-12*y+((13*z)/2)-(25/4), 12*x-((15*y)/2)-7*z+(55/4), ((17*x)/2)-(y/4)-((51*z)/4)+(1/4))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-3 (t+13), x(t)=-t-15$", + "Output Answer": [ + "$y=3 x+6$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -3*(t+13)\nx_t = -t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-5 x^2-7 x+5 y^2+9 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(y+\\frac{9}{10}\\right)^2-5 \\left(x+\\frac{7}{10}\\right)^2=-\\frac{7}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{10} \\left(-7-2 \\sqrt{14}\\right) & -\\frac{9}{10} \\\\\n \\frac{1}{10} \\left(2 \\sqrt{14}-7\\right) & -\\frac{9}{10} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{10} \\left(-7-2 \\sqrt{14}\\right)+\\frac{1}{10} \\left(2 \\sqrt{14}-7\\right)\\right),-\\frac{9}{10}\\right\\}$\nAsymptotes: $\\left\\{y=x-\\frac{1}{5},y=-x-\\frac{8}{5}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-5*x**2-7*x+5*y**2+9*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $12 x^3+132 x^2-120 x-2400$", + "Output Answer": [ + "$-12 (-x-5) (x-4) (x+10)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(12*x**3+132*x**2-120*x-2400, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$4 x+5 y-18=0$, $20 x-11 y-19=0$", + "Output Answer": [ + "$x=\\frac{293}{144}$, $y=\\frac{71}{36}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((4*x+5*y-18, 20*x-11*y-19), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $x^2-6 x-5$", + "Output Answer": [ + "$x=3-\\sqrt{14}\\lor x=3+\\sqrt{14}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(x**2-6*x-5, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(4-19)-(13-5)$.", + "Output Answer": [ + "$-23$" + ], + "Output Program": [ + "try: \n print((4-19)-(13-5))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{4 \\left(-\\sin \\left(\\frac{7 \\pi }{45}\\right)-i \\cos \\left(\\frac{7 \\pi }{45}\\right)\\right)}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $4 \\sqrt{\\frac{1}{3} \\left(\\sin ^2\\left(\\frac{7 \\pi }{45}\\right)+\\cos ^2\\left(\\frac{7 \\pi }{45}\\right)\\right)}$\nArgument: $\\frac{31 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((4*(-math.sin(((7*math.pi)/45))-i*math.cos(((7*math.pi)/45))))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{5}}, \\frac{1}{\\sqrt{3}}, \\sqrt{3})$", + "Output Answer": [ + "$\\left\\{\\sqrt{\\frac{53}{15}},\\tan ^{-1}\\left(\\frac{2 \\sqrt{\\frac{2}{5}}}{3}\\right),\\tan ^{-1}\\left(\\sqrt{\\frac{5}{3}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(5)))\ny = (1/(math.sqrt(3)))\nz = math.sqrt(3)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{3 x}{7}+\\frac{61}{7}}+\\sqrt{\\frac{71 x}{7}+\\frac{31}{7}}=\\frac{87}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{287193-87 \\sqrt{3629485}}{16184}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((3*x)/7)+(61/7))+sqrt(((71*x)/7)+(31/7)), (87/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x^6+x^5-8 x^4+7 x^3+10 x^2-9 x+3$ and $-x^4-4 x^3-x^2+2 x-1$.", + "Output Answer": [ + "$x^4+4 x^3+x^2-2 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x**6+x**5-8*x**4+7*x**3+10*x**2-9*x+3, -x**4-4*x**3-x**2+2*x-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{23}{5} \\left(\\cos \\left(\\frac{3}{2}\\right)+i \\sin \\left(\\frac{3}{2}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$\\frac{279841}{625} (\\cos (6)+i \\sin (6))$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(23/5)*(math.cos((3/2))+1j*math.sin((3/2))))**4)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $3 x^3-36 x^2-669 x+8190$", + "Output Answer": [ + "$-3 (-x-15) (13-x) (14-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(3*x**3-36*x**2-669*x+8190, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 x^2+x+14$ and $q(x) = 6 x^2+6 x+3$", + "Output Answer": [ + "$30 x^4+36 x^3+105 x^2+87 x+42$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*x**2+x+14\nq = 6*x**2+6*x+3\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+6 x+9 y^2-7 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x+\\frac{3}{4}\\right)^2+9 \\left(y-\\frac{7}{18}\\right)^2=\\frac{245}{18}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{36} \\left(-27-35 \\sqrt{2}\\right) & \\frac{7}{18} \\\\\n \\frac{1}{36} \\left(35 \\sqrt{2}-27\\right) & \\frac{7}{18} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{36} \\left(-27-35 \\sqrt{2}\\right)+\\frac{1}{36} \\left(35 \\sqrt{2}-27\\right)\\right),\\frac{7}{18}\\right\\}$\nArea Enclosed: $\\frac{245 \\pi }{108}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+6*x+9*y**2-7*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\cos (\\cos (2))$", + "Output Answer": [ + "$y=\\cos (\\cos (2))$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(cos(cos(2)), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (x+1)^2, q(x) = \\frac{1}{81} (17 x+15)^4$", + "Output Answer": [ + "$\\frac{83521 x^4}{81}+\\frac{98260 x^3}{27}+\\frac{14453 x^2}{3}+\\frac{8506 x}{3}+626$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (x+1)**2\nq = (1/81)*(17*x+15)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^3+7 x^2+10 x-1$ when divided by $-7 x^2+9 x+3$.", + "Output Answer": [ + "$\\frac{9 x}{7}+\\frac{32}{49}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**3+7*x**2+10*x-1\nq = -7*x**2+9*x+3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^3-10 x^2-\\frac{29 x}{3}+\\frac{16}{3}$ when divided by $5 x^3-\\frac{16 x^2}{3}+\\frac{19 x}{3}-\\frac{25}{3}$.", + "Output Answer": [ + "$\\frac{8}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**3-10*x**2-((29*x)/3)+(16/3)\nq = 5*x**3-((16*x**2)/3)+((19*x)/3)-(25/3)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -8 x^2+11 x+4$ and $q(x) = 6 x^2-7 x+4$", + "Output Answer": [ + "$-48 x^4+122 x^3-85 x^2+16 x+16$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -8*x**2+11*x+4\nq = 6*x**2-7*x+4\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5$ and $-4 x^2-2 x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5, -4*x**2-2*x-3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^6-x^5+3 x^4-10 x^2+2 x+3$ when divided by $-5 x^3+9 x^2-9 x-4$.", + "Output Answer": [ + "$\\frac{9 x^3}{5}+\\frac{86 x^2}{25}+\\frac{294 x}{125}-\\frac{2124}{625}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**6-x**5+3*x**4-10*x**2+2*x+3\nq = -5*x**3+9*x**2-9*x-4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{13+19}{\\frac{15}{10}+15}$.", + "Output Answer": [ + "$\\frac{64}{33}$" + ], + "Output Program": [ + "try: \n print(((13+19)/((15/10)+15)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 6 x^2-6 x+9\\right| =25$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(3-\\sqrt{105}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(3+\\sqrt{105}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(6*x**2-6*x+9), 25), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-3 (7 t+38), x(t)=-3 t-15$", + "Output Answer": [ + "$y=7 x-9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -3*(7*t+38)\nx_t = -3*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{15}{2}-8 x}+\\sqrt{-7 x-10}=\\frac{25}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-9305+150 \\sqrt{3830}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((15/2)-8*x)+sqrt(-7*x-10), (25/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{3 \\sqrt{3} x^2+10 \\sqrt{3} x+3 \\sqrt{3}}{\\sqrt{3}-\\sqrt{3} x}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to -3\\},\\left\\{x\\to -\\frac{1}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((3*sqrt(3)*x**2+10*sqrt(3)*x+3*sqrt(3))/(sqrt(3)-sqrt(3)*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sin (5-9 x) \\cos (9-8 x)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sin(5-9*x)*cos(9-8*x)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(14+8 i) \\log (2)$ and $y=(-13-9 i) \\log (2)$", + "Output Answer": [ + "$(1-i) \\log (2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (14+8*i)*math.log10(2)\ny = (-13-9*i)*math.log10(2)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-3 \\sqrt{5} x-7 \\sqrt{5} y-2 \\sqrt{5} z-5 \\sqrt{5}=0$, $-5 \\sqrt{5} x+\\sqrt{5} y+9 \\sqrt{5} z=0$, $-9 \\sqrt{5} x-10 \\sqrt{5} y+3 \\sqrt{5} z-10 \\sqrt{5}=0$", + "Output Answer": [ + "$x=-\\frac{29}{13}$, $y=\\frac{8}{13}$, $z=-\\frac{17}{13}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-3*sqrt(5)*x-7*sqrt(5)*y-2*sqrt(5)*z-5*sqrt(5), -5*sqrt(5)*x+sqrt(5)*y+9*sqrt(5)*z, -9*sqrt(5)*x-10*sqrt(5)*y+3*sqrt(5)*z-10*sqrt(5))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=324 t^2-1620 t+2026, x(t)=36 t^2-180 t+225$", + "Output Answer": [ + "$y=9 x+1$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 324*t**2-1620*t+2026\nx_t = 36*t**2-180*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 12 x^2+7 x+4$ and $q(x) = -10 x^2-9 x+4$", + "Output Answer": [ + "$-120 x^4-178 x^3-55 x^2-8 x+16$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 12*x**2+7*x+4\nq = -10*x**2-9*x+4\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{5 x^2}{2}-14 x-11$ and $q(x) = -6 x^2+\\frac{9 x}{2}+11$", + "Output Answer": [ + "$15 x^4+\\frac{291 x^3}{4}-\\frac{49 x^2}{2}-\\frac{407 x}{2}-121$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((5*x**2)/2)-14*x-11\nq = -6*x**2+((9*x)/2)+11\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((24-23)-17) (((19+19)-5)-18)$.", + "Output Answer": [ + "$-240$" + ], + "Output Program": [ + "try: \n print(((24-23)-17)*(((19+19)-5)-18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-15 x-\\frac{47 y}{2}-\\frac{37 z}{2}+\\frac{1}{2}=0$, $-18 x-\\frac{5 y}{2}-\\frac{5 z}{2}-14=0$, $3 x-\\frac{43 y}{2}-6 z+\\frac{41}{2}=0$", + "Output Answer": [ + "$x=-\\frac{26861}{32022}$, $y=\\frac{5284}{5337}$, $z=-\\frac{2938}{5337}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-15*x-((47*y)/2)-((37*z)/2)+(1/2), -18*x-((5*y)/2)-((5*z)/2)-14, 3*x-((43*y)/2)-6*z+(41/2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(\\cos \\left(\\frac{53}{30}\\right)+i \\sin \\left(\\frac{53}{30}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$125 \\left(\\cos \\left(\\frac{53}{10}\\right)+i \\sin \\left(\\frac{53}{10}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(math.cos((53/30))+1j*math.sin((53/30))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2+2 x+y^2-9 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $\\left(y-\\frac{9}{2}\\right)^2-8 \\left(x-\\frac{1}{8}\\right)^2=\\frac{217}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{8} & -\\frac{3}{8} \\left(\\sqrt{217}-12\\right) \\\\\n \\frac{1}{8} & \\frac{3}{8} \\left(12+\\sqrt{217}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2 \\sqrt{2}}$\nCenter: $\\left\\{\\frac{1}{8},\\frac{1}{2} \\left(\\frac{3}{8} \\left(12+\\sqrt{217}\\right)-\\frac{3}{8} \\left(\\sqrt{217}-12\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{4} \\left(18+\\sqrt{2}\\right)-2 \\sqrt{2} x,y=2 \\sqrt{2} x+\\frac{1}{4} \\left(18-\\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2+2*x+y**2-9*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 x^2, q(x) = -27 (x-1)^3$", + "Output Answer": [ + "$-27 x^3+85 x^2-81 x+27$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**2\nq = -27*(x-1)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2 x^2-13 x-20$ and $-2 x-5$.", + "Output Answer": [ + "$2 x+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2*x**2-13*x-20, -2*x-5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-x+7 y^2+4 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $6 \\left(x-\\frac{1}{12}\\right)^2+7 \\left(y+\\frac{2}{7}\\right)^2=\\frac{1447}{168}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{84} \\left(7-\\sqrt{1447}\\right) & -\\frac{2}{7} \\\\\n \\frac{1}{84} \\left(7+\\sqrt{1447}\\right) & -\\frac{2}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{84} \\left(7-\\sqrt{1447}\\right)+\\frac{1}{84} \\left(7+\\sqrt{1447}\\right)\\right),-\\frac{2}{7}\\right\\}$\nArea Enclosed: $\\frac{1447 \\pi }{168 \\sqrt{42}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-x+7*y**2+4*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^6+2 x^5-9 x^4-2 x^3+4 x^2+4 x-4$ when divided by $-9 x^3+3 x^2-10 x+8$.", + "Output Answer": [ + "$-\\frac{2 x^3}{3}-\\frac{4 x^2}{9}+\\frac{43 x}{27}+\\frac{53}{81}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**6+2*x**5-9*x**4-2*x**3+4*x**2+4*x-4\nq = -9*x**3+3*x**2-10*x+8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 6 \\sqrt{3} x^2+5 \\sqrt{3} x+8 \\sqrt{3}$ and $q(x) = -4 \\sqrt{3} x^2+\\sqrt{3} x+\\sqrt{3}$", + "Output Answer": [ + "$-72 x^4-42 x^3-63 x^2+39 x+24$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 6*sqrt(3)*x**2+5*sqrt(3)*x+8*sqrt(3)\nq = -4*sqrt(3)*x**2+sqrt(3)*x+sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+3 x-y^2+9 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x+\\frac{3}{16}\\right)^2-\\left(y-\\frac{9}{2}\\right)^2=-\\frac{511}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{16} & -\\frac{3}{16} \\left(\\sqrt{511}-24\\right) \\\\\n -\\frac{3}{16} & \\frac{3}{16} \\left(24+\\sqrt{511}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2 \\sqrt{2}}$\nCenter: $\\left\\{-\\frac{3}{16},\\frac{1}{2} \\left(\\frac{3}{16} \\left(24+\\sqrt{511}\\right)-\\frac{3}{16} \\left(\\sqrt{511}-24\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-2 \\sqrt{2} x-\\frac{3}{8} \\left(\\sqrt{2}-12\\right),y=2 \\sqrt{2} x+\\frac{3}{8} \\left(12+\\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+3*x-y**2+9*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((((16-10)+9)+19)+21)^2+\\left(\\frac{1}{9} ((16-9)+4)+23\\right)$.", + "Output Answer": [ + "$\\frac{27443}{9}$" + ], + "Output Program": [ + "try: \n print(((((16-10)+9)+19)+21)**2+((1/9)*((16-9)+4)+23))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2+9 x+324$", + "Output Answer": [ + "$3 (12-x) (x+9)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2+9*x+324, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -15 x^2+11 x-14$ and $q(x) = 10 x^2-5 x-4$", + "Output Answer": [ + "$-150 x^4+185 x^3-135 x^2+26 x+56$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -15*x**2+11*x-14\nq = 10*x**2-5*x-4\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{33 x^2}{\\pi }-\\frac{35 x}{\\pi }+\\frac{29}{\\pi }$ and $q(x) = \\frac{41 x^2}{\\pi }-\\frac{17 x}{\\pi }-\\frac{1}{\\pi }$", + "Output Answer": [ + "$\\frac{1353 x^4}{\\pi ^2}-\\frac{1996 x^3}{\\pi ^2}+\\frac{1751 x^2}{\\pi ^2}-\\frac{458 x}{\\pi ^2}-\\frac{29}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((33*x**2)/pi)-((35*x)/pi)+(29/pi)\nq = ((41*x**2)/pi)-((17*x)/pi)-(1/pi)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $14 x^2+11 x-10$", + "Output Answer": [ + "$x=\\frac{1}{28} \\left(-11-\\sqrt{681}\\right)\\lor x=\\frac{1}{28} \\left(\\sqrt{681}-11\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(14*x**2+11*x-10, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $e^{\\frac{3 i \\pi }{5}} \\pi$.", + "Output Answer": [ + "Norm: $\\pi$\nArgument: $\\frac{3 \\pi }{5}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = math.e**((3*i*math.pi)/5)*math.pi\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$2 x+15 y-8=0$, $-5 x+8 y+10=0$", + "Output Answer": [ + "$x=\\frac{214}{91}$, $y=\\frac{20}{91}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((2*x+15*y-8, -5*x+8*y+10), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2-48 \\sqrt{5} x+280$", + "Output Answer": [ + "$-8 \\left(-x-7 \\sqrt{5}\\right) \\left(\\sqrt{5}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2-48*sqrt(5)*x+280, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -2 x^2+13 x-12$ and $q(x) = -15 x^2-10 x+7$", + "Output Answer": [ + "$30 x^4-175 x^3+36 x^2+211 x-84$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -2*x**2+13*x-12\nq = -15*x**2-10*x+7\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$16 y-\\frac{72}{7}=0$, $-\\frac{88 x}{7}+\\frac{81 y}{7}-\\frac{99}{7}=0$", + "Output Answer": [ + "$x=-\\frac{657}{1232}$, $y=\\frac{9}{14}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((16*y-(72/7), -((88*x)/7)+((81*y)/7)-(99/7)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(-\\sin \\left(\\frac{19 \\pi }{90}\\right)-i \\cos \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-1977326743 \\left(\\cos \\left(\\frac{8 \\pi }{45}\\right)+i \\sin \\left(\\frac{8 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(-math.sin(((19*math.pi)/90))-1j*math.cos(((19*math.pi)/90))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-5 \\sqrt{2} x^2+7 \\sqrt{2} x-4 \\sqrt{2}$", + "Output Answer": [ + "$-5 \\sqrt{2} \\left(x-\\frac{7}{10}\\right)^2-4 \\sqrt{2}+\\frac{49}{10 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-5*math.sqrt(2)*x**2+7*math.sqrt(2)*x-4*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\left(-11 x^2+17 x-21\\right) \\log (2)$, $q(x) = \\left(19 x^2+8 x+6\\right) \\log (2)$", + "Output Answer": [ + "$8 x^2 \\log (2)+25 x \\log (2)-15 \\log (2)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (-11*x**2+17*x-21)*log(2)\nq = (19*x**2+8*x+6)*log(2)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $14 e^{-\\frac{i \\pi }{3}} \\log (2)$.", + "Output Answer": [ + "Norm: $14 \\log (2)$\nArgument: $-\\frac{\\pi }{3}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 14*math.e**(-((i*math.pi)/3))*math.log(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{11907 t^2}{64}-\\frac{8505 t}{8}-1520, x(t)=\\frac{441 t^2}{16}+\\frac{315 t}{2}+225$", + "Output Answer": [ + "$y=-\\frac{27 x}{4}-\\frac{5}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -((11907*t**2)/64)-((8505*t)/8)-1520\nx_t = ((441*t**2)/16)+((315*t)/2)+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-6 x+13 y-25=0$, $17 x-10 y+12=0$", + "Output Answer": [ + "$x=\\frac{94}{161}$, $y=\\frac{353}{161}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-6*x+13*y-25, 17*x-10*y+12), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{27} \\left(1331 t^2-6292 t+7427\\right)^2, x(t)=\\frac{121 t^2}{3}-\\frac{572 t}{3}+\\frac{676}{3}$", + "Output Answer": [ + "$y=\\frac{121 x^2}{3}-22 x+3$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/27)*(1331*t**2-6292*t+7427)**2\nx_t = ((121*t**2)/3)-((572*t)/3)+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^5-x^3+10 x^2-4 x-8$ when divided by $2 x^5-6 x^4+8 x^3+x^2-8 x-8$.", + "Output Answer": [ + "$\\frac{9}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**5-x**3+10*x**2-4*x-8\nq = 2*x**5-6*x**4+8*x**3+x**2-8*x-8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2-5 x-5 y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $x^2-5 x-5 y=-2$\nVertex: $\\left\\{\\frac{5}{2},-\\frac{17}{20}\\right\\}$\nDirectrix: $y=-\\frac{21}{10}$\nFocal Parameter: $\\frac{5}{2}$\nFocus: $\\left\\{\\frac{5}{2},\\frac{2}{5}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-5*x-5*y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2-4 x$ and $-x^4+5 x^3-5 x^2-5 x+1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2-4*x, -x**4+5*x**3-5*x**2-5*x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6-\\frac{27 x}{2}}+\\sqrt{\\frac{27 x}{4}+\\frac{35}{4}}=\\frac{7}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{243} \\left(-82+28 \\sqrt{46}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6-((27*x)/2))+sqrt(((27*x)/4)+(35/4)), (7/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 11 x^2-9 x+17\\right| =-4$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11*x**2-9*x+17), -4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{39 x^2}{5}+\\frac{12 x}{5}+\\frac{14}{5}$ and $q(x) = -\\frac{38 x^2}{5}+\\frac{37 x}{5}-\\frac{46}{5}$", + "Output Answer": [ + "$-\\frac{1482 x^4}{25}+\\frac{987 x^3}{25}-\\frac{1882 x^2}{25}-\\frac{34 x}{25}-\\frac{644}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((39*x**2)/5)+((12*x)/5)+(14/5)\nq = -((38*x**2)/5)+((37*x)/5)-(46/5)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=9-4 i$ and $y=1+5 i$", + "Output Answer": [ + "$8-9 i$" + ], + "Output Program": [ + "i = 1j\nx = 9-4*i\ny = 1+5*i\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{55 x}{7}-\\frac{19}{7}}+\\sqrt{\\frac{74 x}{7}-\\frac{50}{7}}=\\frac{61}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{484132-122 \\sqrt{15323222}}{2527}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((55*x)/7)-(19/7))+sqrt(((74*x)/7)-(50/7)), (61/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-7 x^2-84 x-252$", + "Output Answer": [ + "$7 (-x-6) (x+6)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-7*x**2-84*x-252, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-3 x^3+21 x^2+120 x+132$", + "Output Answer": [ + "$-3 (x-11) (x+2)^2$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-3*x**3+21*x**2+120*x+132, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 x^2+15 x+7$", + "Output Answer": [ + "$\\frac{281}{8}-2 \\left(x-\\frac{15}{4}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*x**2+15*x+7), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{1}{9} ((18-21)-14)}{(18-6)-5}$.", + "Output Answer": [ + "$-\\frac{17}{63}$" + ], + "Output Program": [ + "try: \n print((((1/9)*((18-21)-14))/((18-6)-5)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 8-13 x| =1$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7}{13}\\right\\},\\left\\{x\\to \\frac{9}{13}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(8-13*x), 1), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((8+5)-25)+16)+((((12-7)+12)+10)-9)$.", + "Output Answer": [ + "$22$" + ], + "Output Program": [ + "try: \n print((((8+5)-25)+16)+((((12-7)+12)+10)-9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2-2 x-8 y^2-7 y+7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(x-\\frac{1}{2}\\right)^2-8 \\left(y+\\frac{7}{16}\\right)^2=-\\frac{257}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & \\frac{1}{16} \\left(-7-\\sqrt{1285}\\right) \\\\\n \\frac{1}{2} & \\frac{1}{16} \\left(\\sqrt{1285}-7\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{5}$\nCenter: $\\left\\{\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{16} \\left(-7-\\sqrt{1285}\\right)+\\frac{1}{16} \\left(\\sqrt{1285}-7\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\frac{x}{2}-\\frac{3}{16},y=\\frac{x}{2}-\\frac{11}{16}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2-2*x-8*y**2-7*y+7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 14 \\sqrt{2}-16 \\sqrt{2} x\\right| =16 \\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{8}\\right\\},\\left\\{x\\to \\frac{15}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(14*sqrt(2)-16*sqrt(2)*x), 16*sqrt(2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{9 x}{5}+\\frac{9}{5}}+\\sqrt{\\frac{61 x}{5}+13}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{19719-33 \\sqrt{183485}}{1352}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((9*x)/5)+(9/5))+sqrt(((61*x)/5)+13), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-13 x^2-275 x-\\frac{3422}{9}}{-14 x-\\frac{826}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{58}{39}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-13*x**2-275*x-(3422/9))/(-14*x-(826/3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+7 x-9 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $9 x^2+7 x-9 y=-8$\nVertex: $\\left\\{-\\frac{7}{18},\\frac{239}{324}\\right\\}$\nDirectrix: $y=\\frac{79}{162}$\nFocal Parameter: $\\frac{1}{2}$\nFocus: $\\left\\{-\\frac{7}{18},\\frac{80}{81}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+7*x-9*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{5}{2} (3 t-7), x(t)=5 t-15$", + "Output Answer": [ + "$y=-\\frac{3 x}{2}-5$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -(5/2)*(3*t-7)\nx_t = 5*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-3 e^{-\\frac{37 i \\pi }{90}} \\pi$.", + "Output Answer": [ + "Norm: $3 \\pi$\nArgument: $\\frac{53 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -3*math.e**(-((37*i*math.pi)/90))*math.pi\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $x^4+x^3+9 x^2-8 x+5$ when divided by $-3$.", + "Output Answer": [ + "$-\\frac{x^4}{3}-\\frac{x^3}{3}-3 x^2+\\frac{8 x}{3}-\\frac{5}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**4+x**3+9*x**2-8*x+5\nq = -3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{31}{15}$, and $a_n=a_{n-1}+-3 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$\\frac{21}{2} \\left(-\\frac{62}{15}-60 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\na = -(31/15) # initial value\nd = -3*math.pi # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(31/15) # initial value\nd = -3*math.pi # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{64}{81}$, and $a_n=a_{n-1}+-\\frac{13}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$15 \\left(-\\frac{128}{81}-\\frac{377}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(64/81) # initial value\nd = -(13/(math.sqrt(3))) # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(64/81) # initial value\nd = -(13/(math.sqrt(3))) # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-2 \\sqrt{3} x^2+\\sqrt{3} x+\\sqrt{3}$", + "Output Answer": [ + "$x=-\\frac{1}{2}\\lor x=1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-2*sqrt(3)*x**2+sqrt(3)*x+sqrt(3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -(5 x-2)^3, q(x) = 0$", + "Output Answer": [ + "$-125 x^3+150 x^2-60 x+8$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(5*x-2)**3\nq = 0\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^4+\\frac{17 x^3}{2}+5 x^2-7 x+7$ when divided by $8$.", + "Output Answer": [ + "$x^4+\\frac{17 x^3}{16}+\\frac{5 x^2}{8}-\\frac{7 x}{8}+\\frac{7}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**4+((17*x**3)/2)+5*x**2-7*x+7\nq = 8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-4 x-10 y^2-7 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x-\\frac{1}{4}\\right)^2-10 \\left(y+\\frac{7}{20}\\right)^2=\\frac{11}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{4}-\\frac{3 \\sqrt{11}}{40} & -\\frac{7}{20} \\\\\n \\frac{1}{4}+\\frac{3 \\sqrt{11}}{40} & -\\frac{7}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{5}}$\nCenter: $\\left\\{\\frac{1}{4},-\\frac{7}{20}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2 x}{\\sqrt{5}}+\\frac{1}{20} \\left(-7-2 \\sqrt{5}\\right),y=\\frac{1}{20} \\left(2 \\sqrt{5}-7\\right)-\\frac{2 x}{\\sqrt{5}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-4*x-10*y**2-7*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{11 x^2+9 x-16}{18 x^2-23 x-19}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{22} \\left(-9-\\sqrt{785}\\right)\\right\\},\\left\\{x\\to \\frac{1}{22} \\left(-9+\\sqrt{785}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((11*x**2+9*x-16)/(18*x**2-23*x-19)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{7}, 5, \\sqrt{5})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{1471}}{7},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{1226}{5}}}{7}\\right),\\tan ^{-1}(35)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/7)\ny = 5\nz = math.sqrt(5)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{27 x}{5}-7}+\\sqrt{\\frac{64 x}{5}-7}=\\frac{24}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{52416-48 \\sqrt{755753}}{6845}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((27*x)/5)-7)+sqrt(((64*x)/5)-7), (24/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sixth order series of the inverse of the following function around 6:\n$-\\tan ^{-1}\\left(\\frac{7 x}{2}\\right)$", + "Output Answer": [ + "$-\\frac{4 x^5}{105}-\\frac{2 x^3}{21}-\\frac{2 x}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, -atan((7*x)/2))\nprint(solve(f, x)[0].series(y, 6, 6))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((((8+15)+23)+17)-16)+((((24+16)+9)+9)+6)^2$.", + "Output Answer": [ + "$4143$" + ], + "Output Program": [ + "try: \n print(((((8+15)+23)+17)-16)+((((24+16)+9)+9)+6)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-5 x^2-9 x-13$", + "Output Answer": [ + "$x=\\frac{1}{10} \\left(-9-i \\sqrt{179}\\right)\\lor x=\\frac{1}{10} \\left(-9+i \\sqrt{179}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-5*x**2-9*x-13, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{35 x}{3}+12 y+3 z-\\frac{5}{3}=0$, $-25 x+22 y+\\frac{32 z}{3}-\\frac{7}{3}=0$, $-\\frac{53 x}{3}-21 y+\\frac{26 z}{3}+24=0$", + "Output Answer": [ + "$x=\\frac{10679}{15823}$, $y=\\frac{11267}{15823}$, $z=\\frac{5252}{15823}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((35*x)/3)+12*y+3*z-(5/3), -25*x+22*y+((32*z)/3)-(7/3), -((53*x)/3)-21*y+((26*z)/3)+24)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-10 \\sqrt{2} x^2+3 \\sqrt{2} x-7 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{20} \\left(3-i \\sqrt{271}\\right)\\lor x=\\frac{1}{20} \\left(3+i \\sqrt{271}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-10*sqrt(2)*x**2+3*sqrt(2)*x-7*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-6 \\sqrt{2} \\left(32 t^2-176 t+243\\right), x(t)=32 t^2-176 t+242$", + "Output Answer": [ + "$y=-6 \\sqrt{2} x-6 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -6*sqrt(2)*(32*t**2-176*t+243)\nx_t = 32*t**2-176*t+242\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{16 x^2}{3}-\\frac{28 x}{3}-10$ and $q(x) = -\\frac{14 x^2}{3}+\\frac{28 x}{3}+\\frac{10}{3}$", + "Output Answer": [ + "$-\\frac{224 x^4}{9}+\\frac{280 x^3}{3}-\\frac{68 x^2}{3}-\\frac{1120 x}{9}-\\frac{100}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((16*x**2)/3)-((28*x)/3)-10\nq = -((14*x**2)/3)+((28*x)/3)+(10/3)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -11.957 x^2-9.702 x-4.897$, $q(x) = 5.999 x^2+1.722 x-7.279$", + "Output Answer": [ + "$-5.958 x^2-7.98 x-12.176$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -11.957*x**2-9.702*x-4.897\nq = 5.999*x**2+1.722*x-7.279\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 14 x+5| =23$", + "Output Answer": [ + "$\\left\\{\\{x\\to -2\\},\\left\\{x\\to \\frac{9}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(14*x+5), 23), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(\\frac{\\sqrt{3}}{2}+\\frac{i}{2}\\right)\\right)^7$", + "Output Answer": [ + "$-128 \\left(-\\frac{\\sqrt{3}}{2}-\\frac{i}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(((math.sqrt(3))/2)+(i/2)))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -3 x-6| =7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{13}{3}\\right\\},\\left\\{x\\to \\frac{1}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-3*x-6), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\tan (8-x)$ at the point $x=8$", + "Output Answer": [ + "$0 = 0.$" + ], + "Output Program": [ + "import math\n\nx = 8\ntry: \n f = -math.tan(8-x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{3}{34}$, and $a_n=a_{n-1}+\\frac{35}{4}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$\\frac{101859}{68}$" + ], + "Output Program": [ + "a = (3/34) # initial value\nd = (35/4) # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (3/34) # initial value\nd = (35/4) # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{9-6 i}{\\sqrt{\\pi }}$ and $y=\\frac{10-4 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{1+2 i}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((9-6*i)/(math.sqrt(math.pi)))\ny = ((10-4*i)/(math.sqrt(math.pi)))\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\sqrt{3}, \\frac{1}{2}, \\frac{1}{4})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{53}}{4},\\tan ^{-1}\\left(2 \\sqrt{13}\\right),\\tan ^{-1}\\left(\\frac{1}{2 \\sqrt{3}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.sqrt(3)\ny = (1/2)\nz = (1/4)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{21 x^2}{2}+\\frac{47 x}{4}-\\frac{17}{4}$", + "Output Answer": [ + "$\\frac{21}{2} \\left(x+\\frac{47}{84}\\right)^2-\\frac{5065}{672}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((21*x**2)/2)+((47*x)/4)-(17/4)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{43 x^2}{3}+\\frac{28 x}{3}+2$", + "Output Answer": [ + "$x=\\frac{1}{43} \\left(-14-i \\sqrt{62}\\right)\\lor x=\\frac{1}{43} \\left(-14+i \\sqrt{62}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((43*x**2)/3)+((28*x)/3)+2, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{97}{100}$, and $a_n=a_{n-1}+\\frac{65}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$\\frac{19209}{20}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(97/100) # initial value\nd = (65/7) # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(97/100) # initial value\nd = (65/7) # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{5}{3}+\\frac{4 i}{3}$ and $y=\\frac{1}{3}+\\frac{26 i}{3}$", + "Output Answer": [ + "$\\frac{109}{677}-\\frac{126 i}{677}$" + ], + "Output Program": [ + "i = 1j\nx = (5/3)+((4*i)/3)\ny = (1/3)+((26*i)/3)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{7}{2}-\\frac{15 i}{2}$ and $y=\\frac{15}{2}+\\frac{3 i}{2}$", + "Output Answer": [ + "$11-6 i$" + ], + "Output Program": [ + "i = 1j\nx = (7/2)-((15*i)/2)\ny = (15/2)+((3*i)/2)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-11 x^3+33 x^2+968 x+2640$", + "Output Answer": [ + "$11 (12-x) (x+4) (x+5)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-11*x**3+33*x**2+968*x+2640, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-8 x^2+11 x+6$", + "Output Answer": [ + "$x=\\frac{1}{16} \\left(11-\\sqrt{313}\\right)\\lor x=\\frac{1}{16} \\left(11+\\sqrt{313}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-8*x**2+11*x+6, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{18 x^2+8 x-\\frac{43}{2}}{20-\\frac{5 x}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(-4-\\sqrt{403}\\right)\\right\\},\\left\\{x\\to \\frac{1}{18} \\left(-4+\\sqrt{403}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((18*x**2+8*x-(43/2))/(20-((5*x)/2))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2-9 x+3 y^2+10 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(y+\\frac{5}{3}\\right)^2-10 \\left(x+\\frac{9}{20}\\right)^2=-\\frac{203}{120}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{60} \\left(-27-\\sqrt{2639}\\right) & -\\frac{5}{3} \\\\\n \\frac{1}{60} \\left(\\sqrt{2639}-27\\right) & -\\frac{5}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{13}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{60} \\left(-27-\\sqrt{2639}\\right)+\\frac{1}{60} \\left(\\sqrt{2639}-27\\right)\\right),-\\frac{5}{3}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{10}{3}} x+\\frac{1}{60} \\left(9 \\sqrt{30}-100\\right),y=\\frac{1}{60} \\left(-100-9 \\sqrt{30}\\right)-\\sqrt{\\frac{10}{3}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2-9*x+3*y**2+10*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\sqrt{5} x^2+3 \\sqrt{5} x-8 \\sqrt{5}}{\\sqrt{5} x+10 \\sqrt{5}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-sqrt(5)*x**2+3*sqrt(5)*x-8*sqrt(5))/(sqrt(5)*x+10*sqrt(5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^2+3 x+2$ when divided by $6-10 x$.", + "Output Answer": [ + "$\\frac{x}{5}-\\frac{9}{50}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**2+3*x+2\nq = 6-10*x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\sin (9 x+1)$", + "Output Answer": [ + "$-1\\leq y\\leq 1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(sin(9*x+1), x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2-8 x-2 y^2+2 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x-\\frac{4}{9}\\right)^2-2 \\left(y-\\frac{1}{2}\\right)^2=\\frac{5}{18}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{18} \\left(8-\\sqrt{55}\\right) & \\frac{1}{2} \\\\\n \\frac{1}{18} \\left(8+\\sqrt{55}\\right) & \\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{11}{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{18} \\left(8-\\sqrt{55}\\right)+\\frac{1}{18} \\left(8+\\sqrt{55}\\right)\\right),\\frac{1}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3 x}{\\sqrt{2}}+\\frac{1}{6} \\left(3-4 \\sqrt{2}\\right),y=\\frac{1}{6} \\left(3+4 \\sqrt{2}\\right)-\\frac{3 x}{\\sqrt{2}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2-8*x-2*y**2+2*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^2+6 x+4$ when divided by $\\frac{9}{2}$.", + "Output Answer": [ + "$\\frac{10 x^2}{9}+\\frac{4 x}{3}+\\frac{8}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**2+6*x+4\nq = (9/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{160}-\\sqrt{39}\\right)-\\sqrt{57}$.", + "Output Answer": [ + "$4 \\sqrt{10}-\\sqrt{39}-\\sqrt{57}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(160)-sqrt(39))-sqrt(57))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{21}{23}$, and $a_n=a_{n-1}+\\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$\\frac{13}{2} \\left(12 \\pi -\\frac{42}{23}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(21/23) # initial value\nd = math.pi # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(21/23) # initial value\nd = math.pi # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{11 x}{5}+\\frac{14}{5}}+\\sqrt{\\frac{58 x}{5}+\\frac{73}{5}}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5852-10 \\sqrt{400865}}{2209}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((11*x)/5)+(14/5))+sqrt(((58*x)/5)+(73/5)), 5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $9 x^2+\\frac{333 x}{7}-\\frac{270}{7}$", + "Output Answer": [ + "$9 \\left(x-\\frac{5}{7}\\right) (x+6)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(9*x**2+((333*x)/7)-(270/7), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{27 x}{2}-11}+\\sqrt{-\\frac{19 x}{2}-\\frac{17}{2}}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(-5185+15 \\sqrt{115261}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((27*x)/2)-11)+sqrt(-((19*x)/2)-(17/2)), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $6 x^2+\\frac{468 x}{7}+\\frac{4752}{49}$", + "Output Answer": [ + "$-6 \\left(-x-\\frac{66}{7}\\right) \\left(x+\\frac{12}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(6*x**2+((468*x)/7)+(4752/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3 x-2}+\\sqrt{14 x+3}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{11} \\left(91-5 \\sqrt{187}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3*x-2)+sqrt(14*x+3), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((24-7)+10)-5)+\\left(\\frac{1}{24} ((10+12)+19)+7\\right)$.", + "Output Answer": [ + "$\\frac{737}{24}$" + ], + "Output Program": [ + "try: \n print((((24-7)+10)-5)+((1/24)*((10+12)+19)+7))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$-\\left(-7 x-\\frac{1}{2}\\right)^3 \\sin ^{-1}(5 x+8)$", + "Output Answer": [ + "$-\\frac{9}{5}\\leq x\\leq -\\frac{7}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = -(-7*x-(1/2))**3*asin(5*x+8)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-7 y^2+10 y+9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 x^2-7 \\left(y-\\frac{5}{7}\\right)^2=-\\frac{88}{7}$\nFoci: $\\left(\n\\begin{array}{cc}\n 0 & \\frac{1}{7} \\left(5-11 \\sqrt{2}\\right) \\\\\n 0 & \\frac{1}{7} \\left(5+11 \\sqrt{2}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{11}}{2}$\nCenter: $\\left\\{0,\\frac{1}{2} \\left(\\frac{1}{7} \\left(5-11 \\sqrt{2}\\right)+\\frac{1}{7} \\left(5+11 \\sqrt{2}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{5}{7}-\\frac{2 x}{\\sqrt{7}},y=\\frac{2 x}{\\sqrt{7}}+\\frac{5}{7}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-7*y**2+10*y+9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^6+5 x^5-x^4+5 x^3+x^2-8 x-6$ when divided by $-x^5-6 x^4+3 x^3-3 x^2+9 x+9$.", + "Output Answer": [ + "$7-2 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**6+5*x**5-x**4+5*x**3+x**2-8*x-6\nq = -x**5-6*x**4+3*x**3-3*x**2+9*x+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{27}{5}-\\frac{12 i}{5}$ and $y=\\frac{44}{5}+\\frac{41 i}{5}$", + "Output Answer": [ + "$-\\frac{1680}{3617}+\\frac{579 i}{3617}$" + ], + "Output Program": [ + "i = 1j\nx = -(27/5)-((12*i)/5)\ny = (44/5)+((41*i)/5)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+4 x-9 y^2+3 y+10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x+\\frac{2}{3}\\right)^2-9 \\left(y-\\frac{1}{6}\\right)^2=-\\frac{107}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{3} & \\frac{1}{18} \\left(3-2 \\sqrt{321}\\right) \\\\\n -\\frac{2}{3} & \\frac{1}{18} \\left(3+2 \\sqrt{321}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2$\nCenter: $\\left\\{-\\frac{2}{3},\\frac{1}{2} \\left(\\frac{1}{18} \\left(3-2 \\sqrt{321}\\right)+\\frac{1}{18} \\left(3+2 \\sqrt{321}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{18} \\left(3-4 \\sqrt{3}\\right)-\\frac{x}{\\sqrt{3}},y=\\frac{x}{\\sqrt{3}}+\\frac{1}{18} \\left(3+4 \\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+4*x-9*y**2+3*y+10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $7 x^2-140 \\sqrt{2} x+\\frac{2457}{2}$", + "Output Answer": [ + "$7 \\left(\\frac{13}{\\sqrt{2}}-x\\right) \\left(\\frac{27}{\\sqrt{2}}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(7*x**2-140*sqrt(2)*x+(2457/2), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-3 \\sqrt{3} e^{-\\frac{113 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $3 \\sqrt{3}$\nArgument: $\\frac{67 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -3*math.sqrt(3)*math.e**(-((113*i*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $13 x^2+13 x+7$", + "Output Answer": [ + "$x=\\frac{1}{26} \\left(-13-i \\sqrt{195}\\right)\\lor x=\\frac{1}{26} \\left(-13+i \\sqrt{195}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(13*x**2+13*x+7, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{93}{98}$, and $a_n=a_{n-1}+\\frac{1}{4}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$\\frac{1851}{196}$" + ], + "Output Program": [ + "a = (93/98) # initial value\nd = (1/4) # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (93/98) # initial value\nd = (1/4) # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2-57 x-54$", + "Output Answer": [ + "$-3 (x+1) (x+18)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2-57*x-54, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the first order series of the inverse of the following function around 1:\n$\\log \\left(\\frac{21 x}{5}\\right)$", + "Output Answer": [ + "$x+1-\\log (7)+\\log (5)-\\log (3)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, log(((21*x)/5)))\nprint(solve(f, x)[0].series(y, 1, 1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -9 x-1| =18$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{19}{9}\\right\\},\\left\\{x\\to \\frac{17}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-9*x-1), 18), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 14 x^2-14 x-5$, $q(x) = 9 x^2-6 x+6$", + "Output Answer": [ + "$23 x^2-20 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 14*x**2-14*x-5\nq = 9*x**2-6*x+6\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -16 x-2| =25$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{27}{16}\\right\\},\\left\\{x\\to \\frac{23}{16}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-16*x-2), 25), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$-1024 x^{10}$", + "Output Answer": [ + "$\\frac{9 (x+1048576)^2}{109951162777600}+\\frac{x+1048576}{5242880}-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, -1024*x**10)\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-12 x^6+\\frac{75 x^4}{2}+\\frac{39 x^3}{2}-\\frac{31 x^2}{2}-\\frac{145 x}{4}-18$ and $-3 x^4-3 x^3+3 x^2+\\frac{9 x}{2}+4$.", + "Output Answer": [ + "$\\frac{3 x^4}{2}+\\frac{3 x^3}{2}-\\frac{3 x^2}{2}-\\frac{9 x}{4}-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-12*x**6+((75*x**4)/2)+((39*x**3)/2)-((31*x**2)/2)-((145*x)/4)-18, -3*x**4-3*x**3+3*x**2+((9*x)/2)+4))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{52}{5}$, and $a_n=a_{n-1}+2 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$10 \\left(38 \\pi -\\frac{104}{5}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(52/5) # initial value\nd = 2*math.pi # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(52/5) # initial value\nd = 2*math.pi # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{94}{93}$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$\\frac{178580}{93}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (94/93) # initial value\nd = 10 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (94/93) # initial value\nd = 10 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{143 x^2-194 x-120}{-143 x^2+38 x+48}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{20}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((143*x**2-194*x-120)/(-143*x**2+38*x+48)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 7 x-8, q(x) = 4 x+3$", + "Output Answer": [ + "$11 x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x-8\nq = 4*x+3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 19 x^2+9 x-18\\right| =23$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{38} \\left(-9-\\sqrt{3197}\\right)\\right\\},\\left\\{x\\to \\frac{1}{38} \\left(-9+\\sqrt{3197}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(19*x**2+9*x-18), 23), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (3 x-1)^3, q(x) = 16 (3-2 x)^4$", + "Output Answer": [ + "$256 x^4-1509 x^3+3429 x^2-3447 x+1295$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (3*x-1)**3\nq = 16*(3-2*x)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-12 x^2-5 x+8$", + "Output Answer": [ + "$\\frac{409}{48}-12 \\left(x+\\frac{5}{24}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-12*x**2-5*x+8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 23 x-20| =18$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{23}\\right\\},\\left\\{x\\to \\frac{38}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(23*x-20), 18), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sqrt[3]{\\tan ^{-1}\\left(7 x+\\frac{13}{2}\\right)}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{\\tan \\left(y^3\\right)}{7}-\\frac{13}{14}\\text{ if }-\\sqrt[3]{\\frac{\\pi }{2}} 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2+364 x+2752$", + "Output Answer": [ + "$-12 (-x-16) \\left(x+\\frac{43}{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2+364*x+2752, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{4 \\left(-\\cos \\left(\\frac{2 \\pi }{45}\\right)+i \\sin \\left(\\frac{2 \\pi }{45}\\right)\\right)}{\\sqrt{3}}\\right)^9$", + "Output Answer": [ + "$-\\frac{262144 \\left(\\frac{1}{4} \\left(1-\\sqrt{5}\\right)+i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)}{81 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((4*(-math.cos(((2*math.pi)/45))+1j*math.sin(((2*math.pi)/45))))/(math.sqrt(3))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{82}{5}-\\frac{3 x}{5}\\right| =\\frac{109}{5}$", + "Output Answer": [ + "$\\left\\{\\{x\\to -9\\},\\left\\{x\\to \\frac{191}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs((82/5)-((3*x)/5)), (109/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -13 x^2-x+9$ and $q(x) = 8 x^2-15 x-1$", + "Output Answer": [ + "$-104 x^4+187 x^3+100 x^2-134 x-9$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -13*x**2-x+9\nq = 8*x**2-15*x-1\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{28}{5} \\left(-\\cos \\left(\\frac{37 \\pi }{180}\\right)+i \\sin \\left(\\frac{37 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{28}{5} \\sqrt{\\sin ^2\\left(\\frac{37 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{37 \\pi }{180}\\right)}$\nArgument: $\\frac{143 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (28/5)*(-math.cos(((37*math.pi)/180))+i*math.sin(((37*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $-\\cot (1) \\tanh (6 x+7)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{6} (i \\pi c_1-7)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(-cot(1)*tanh*(6*x+7), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{27 x}{2}-\\frac{9}{2}}+\\sqrt{-10 x-\\frac{21}{2}}=\\frac{19}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{98} \\left(-16799+114 \\sqrt{21058}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((27*x)/2)-(9/2))+sqrt(-10*x-(21/2)), (19/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{5 x^2}{\\sqrt{2}}+\\frac{11 x}{\\sqrt{2}}+2 \\sqrt{2}$", + "Output Answer": [ + "$\\frac{5 \\left(x+\\frac{11}{10}\\right)^2}{\\sqrt{2}}+2 \\sqrt{2}-\\frac{121}{20 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((5*x**2)/(math.sqrt(2)))+((11*x)/(math.sqrt(2)))+2*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 e x^2-4 e x-e$ and $q(x) = 5 e x-2 e x^2$", + "Output Answer": [ + "$10 e^2 x^4-17 e^2 x^3-18 e^2 x^2-5 e^2 x$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -5*math.e*x**2-4*math.e*x-math.e\nq = 5*math.e*x-2*math.e*x**2\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{6}{7}$, and $a_n=a_{n-1}+-10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$-\\frac{1014}{7}$" + ], + "Output Program": [ + "a = (6/7) # initial value\nd = -10 # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (6/7) # initial value\nd = -10 # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^6+5 x^5-5 x^4+4 x^3+x+8$ when divided by $-10 x^2+3 x-5$.", + "Output Answer": [ + "$\\frac{3 x^4}{5}-\\frac{8 x^3}{25}+\\frac{13 x^2}{125}-\\frac{261 x}{1250}-\\frac{1433}{12500}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**6+5*x**5-5*x**4+4*x**3+x+8\nq = -10*x**2+3*x-5\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 10 x-2$ and $q(x) = -11 x^2-15 x-8$", + "Output Answer": [ + "$-110 x^3-128 x^2-50 x+16$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 10*x-2\nq = -11*x**2-15*x-8\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{10 x}{3}+2}+\\sqrt{\\frac{32 x}{3}+\\frac{28}{3}}=\\frac{31}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{726} \\left(19455-124 \\sqrt{18857}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((10*x)/3)+2)+sqrt(((32*x)/3)+(28/3)), (31/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-x^2+19 x+18}{-13 x^2-21 x+17}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(19-\\sqrt{433}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(19+\\sqrt{433}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-x**2+19*x+18)/(-13*x**2-21*x+17)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2-5 x+2 y^2-9 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(y-\\frac{9}{4}\\right)^2-8 \\left(x+\\frac{5}{16}\\right)^2=\\frac{331}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{16} & \\frac{9}{4}-\\frac{\\sqrt{1655}}{16} \\\\\n -\\frac{5}{16} & \\frac{1}{16} \\left(36+\\sqrt{1655}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{2}$\nCenter: $\\left\\{-\\frac{5}{16},\\frac{1}{2} \\left(\\frac{9}{4}-\\frac{\\sqrt{1655}}{16}+\\frac{1}{16} \\left(36+\\sqrt{1655}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{13}{8}-2 x,y=2 x+\\frac{23}{8}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2-5*x+2*y**2-9*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{28}{39}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$\\frac{616}{39}$" + ], + "Output Program": [ + "a = (28/39) # initial value\nd = 0 # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (28/39) # initial value\nd = 0 # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 7 x^2+12 x+14$ and $q(x) = 2 x^2+12 x+11$", + "Output Answer": [ + "$14 x^4+108 x^3+249 x^2+300 x+154$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 7*x**2+12*x+14\nq = 2*x**2+12*x+11\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (8, 3, 7)$", + "Output Answer": [ + "$\\left\\{\\sqrt{122},\\tan ^{-1}\\left(\\frac{\\sqrt{73}}{7}\\right),\\tan ^{-1}\\left(\\frac{3}{8}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 8\ny = 3\nz = 7\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{1+3 i}{\\sqrt{2}}$ and $y=-\\frac{9+2 i}{\\sqrt{2}}$", + "Output Answer": [ + "$-\\frac{8-i}{\\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((1+3*i)/(math.sqrt(2)))\ny = -((9+2*i)/(math.sqrt(2)))\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{1-4 i}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $\\sqrt{\\frac{17}{\\pi }}$\nArgument: $\\pi -\\tan ^{-1}(4)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((1-4*i)/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -17 x-1| =14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{15}{17}\\right\\},\\left\\{x\\to \\frac{13}{17}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-17*x-1), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3$ and $3 x^4+4 x^3+3 x^2-2 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3, 3*x**4+4*x**3+3*x**2-2*x-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{64} \\left(-1587 t^2-8280 t-10768\\right), x(t)=\\frac{529 t^2}{16}+\\frac{345 t}{2}+225$", + "Output Answer": [ + "$y=\\frac{1}{2}-\\frac{3 x}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/64)*(-1587*t**2-8280*t-10768)\nx_t = ((529*t**2)/16)+((345*t)/2)+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 13-18 x| =-25$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(13-18*x), -25), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $5 x^2-\\frac{150 x}{7}-\\frac{1080}{49}$", + "Output Answer": [ + "$-5 \\left(-x-\\frac{6}{7}\\right) \\left(x-\\frac{36}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(5*x**2-((150*x)/7)-(1080/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{7-16 i}{\\sqrt{3}}$ and $y=-\\frac{17-10 i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{10+6 i}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((7-16*i)/(math.sqrt(3)))\ny = -((17-10*i)/(math.sqrt(3)))\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-11 x-8}+\\sqrt{9-5 x}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(-1619+14 \\sqrt{11614}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-11*x-8)+sqrt(9-5*x), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{10 e^{-\\frac{8 i \\pi }{9}}}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $\\frac{10}{\\sqrt{\\pi }}$\nArgument: $-\\frac{8 \\pi }{9}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((10*math.e**(-((8*i*math.pi)/9)))/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2+108 x+704$", + "Output Answer": [ + "$-4 (-x-11) (x+16)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2+108*x+704, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(20+18)-3}{11-20}$.", + "Output Answer": [ + "$-\\frac{35}{9}$" + ], + "Output Program": [ + "try: \n print((((20+18)-3)/(11-20)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2-x+9 y^2+6 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(y+\\frac{1}{3}\\right)^2-9 \\left(x+\\frac{1}{18}\\right)^2=-\\frac{109}{36}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{18} \\left(-1-\\sqrt{218}\\right) & -\\frac{1}{3} \\\\\n \\frac{1}{18} \\left(\\sqrt{218}-1\\right) & -\\frac{1}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{18} \\left(-1-\\sqrt{218}\\right)+\\frac{1}{18} \\left(\\sqrt{218}-1\\right)\\right),-\\frac{1}{3}\\right\\}$\nAsymptotes: $\\left\\{y=x-\\frac{5}{18},y=-x-\\frac{7}{18}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2-x+9*y**2+6*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(9 \\left(\\cos \\left(\\frac{137}{90}\\right)+i \\sin \\left(\\frac{137}{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$31381059609 \\left(\\cos \\left(\\frac{1507}{90}\\right)+i \\sin \\left(\\frac{1507}{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((9*(math.cos((137/90))+1j*math.sin((137/90))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $8 \\sqrt{2} x^2+2 \\sqrt{2} x-6 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{3}{4}\\lor x=-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(8*sqrt(2)*x**2+2*sqrt(2)*x-6*sqrt(2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-21 x^2-5}{9-13 x}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-21*x**2-5)/(9-13*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x+13}+\\sqrt{8 x+6}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(67-4 \\sqrt{282}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x+13)+sqrt(8*x+6), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1100 t^2-5720 t+7439}{3 \\sqrt{3}}, x(t)=\\frac{100 t^2}{3}-\\frac{520 t}{3}+\\frac{676}{3}$", + "Output Answer": [ + "$y=\\frac{11 x}{\\sqrt{3}}+\\frac{1}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = ((1100*t**2-5720*t+7439)/(3*sqrt(3)))\nx_t = ((100*t**2)/3)-((520*t)/3)+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{45 x}{7}+\\frac{6}{7}}+\\sqrt{14 x-\\frac{8}{7}}=\\frac{41}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{245577-82 \\sqrt{7764918}}{19663}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((45*x)/7)+(6/7))+sqrt(14*x-(8/7)), (41/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{((23+24)+16)-17}{(((11-10)-17)+17)-12}$.", + "Output Answer": [ + "$-\\frac{46}{11}$" + ], + "Output Program": [ + "try: \n print(((((23+24)+16)-17)/((((11-10)-17)+17)-12)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{2+3 i}{\\sqrt{\\pi }}$ and $y=\\frac{7-6 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{4}{85}+\\frac{33 i}{85}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((2+3*i)/(math.sqrt(math.pi)))\ny = ((7-6*i)/(math.sqrt(math.pi)))\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{31 x}{2}-20 y+\\frac{29}{2}=0$, $21 x+12 y+\\frac{13}{2}=0$", + "Output Answer": [ + "$x=-\\frac{152}{117}$, $y=\\frac{1621}{936}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((31*x)/2)-20*y+(29/2), 21*x+12*y+(13/2)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{6}{24}-23\\right)+((11-14)+6)$.", + "Output Answer": [ + "$-\\frac{79}{4}$" + ], + "Output Program": [ + "try: \n print(((6/24)-23)+((11-14)+6))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -8 x^2+2 x-9$ and $q(x) = -11 x^2+10 x+6$", + "Output Answer": [ + "$88 x^4-102 x^3+71 x^2-78 x-54$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -8*x**2+2*x-9\nq = -11*x**2+10*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=144 t^2+720 t+907, x(t)=36 t^2+180 t+225$", + "Output Answer": [ + "$y=4 x+7$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 144*t**2+720*t+907\nx_t = 36*t**2+180*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{41}{13}$, and $a_n=a_{n-1}+-4 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$\\frac{19}{2} \\left(\\frac{82}{13}-72 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\na = (41/13) # initial value\nd = -4*math.sqrt(3) # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (41/13) # initial value\nd = -4*math.sqrt(3) # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-4 x^2-\\frac{160 x}{\\sqrt{3}}-532$", + "Output Answer": [ + "$-4 \\left(x+\\frac{19}{\\sqrt{3}}\\right) \\left(x+7 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-4*x**2-((160*x)/(sqrt(3)))-532, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^6-4 x^5-8 x^4-6 x^3+6 x^2+5 x+4$ when divided by $5-9 x$.", + "Output Answer": [ + "$x^5+x^4+\\frac{13 x^3}{9}+\\frac{119 x^2}{81}+\\frac{109 x}{729}-\\frac{3100}{6561}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**6-4*x**5-8*x**4-6*x**3+6*x**2+5*x+4\nq = 5-9*x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{31 x^2}{\\pi }+\\frac{6 x}{\\pi }-\\frac{33}{\\pi }$ and $q(x) = \\frac{11 x^2}{\\pi }-\\frac{37 x}{\\pi }+\\frac{28}{\\pi }$", + "Output Answer": [ + "$\\frac{341 x^4}{\\pi ^2}-\\frac{1081 x^3}{\\pi ^2}+\\frac{283 x^2}{\\pi ^2}+\\frac{1389 x}{\\pi ^2}-\\frac{924}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((31*x**2)/pi)+((6*x)/pi)-(33/pi)\nq = ((11*x**2)/pi)-((37*x)/pi)+(28/pi)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^4-9 x^3+5 x^2-\\frac{9 x}{2}+3$ when divided by $-\\frac{19 x^4}{2}-3 x^3-\\frac{13 x^2}{2}+\\frac{11 x}{2}-\\frac{13}{2}$.", + "Output Answer": [ + "$\\frac{18}{19}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**4-9*x**3+5*x**2-((9*x)/2)+3\nq = -((19*x**4)/2)-3*x**3-((13*x**2)/2)+((11*x)/2)-(13/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{104}{7}-\\frac{103 x}{7}}+\\sqrt{\\frac{3 x}{7}+\\frac{96}{7}}=\\frac{79}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-309082+2607 \\sqrt{5179}}{39326}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((104/7)-((103*x)/7))+sqrt(((3*x)/7)+(96/7)), (79/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^2-3 x-5$ when divided by $-7$.", + "Output Answer": [ + "$\\frac{9 x^2}{7}+\\frac{3 x}{7}+\\frac{5}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**2-3*x-5\nq = -7\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{31 x^5}{5}+\\frac{22 x^4}{5}+5 x^3+\\frac{11 x^2}{5}+3 x-\\frac{12}{5}$ when divided by $-\\frac{22 x^5}{5}-\\frac{31 x^4}{5}-\\frac{6 x^3}{5}+\\frac{24 x^2}{5}+\\frac{49 x}{5}+\\frac{3}{5}$.", + "Output Answer": [ + "$-\\frac{31}{22}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((31*x**5)/5)+((22*x**4)/5)+5*x**3+((11*x**2)/5)+3*x-(12/5)\nq = -((22*x**5)/5)-((31*x**4)/5)-((6*x**3)/5)+((24*x**2)/5)+((49*x)/5)+(3/5)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{17}{2} \\left(\\cos \\left(\\frac{1}{2}\\right)+i \\sin \\left(\\frac{1}{2}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-\\frac{4913}{8} \\left(\\cos \\left(\\frac{3}{2}\\right)+i \\sin \\left(\\frac{3}{2}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(17/2)*(math.cos((1/2))+1j*math.sin((1/2))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{7}{2}+3 i$ and $y=-\\frac{1}{2}+6 i$", + "Output Answer": [ + "$3+9 i$" + ], + "Output Program": [ + "i = 1j\nx = (7/2)+3*i\ny = -(1/2)+6*i\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{25 x^2}{2}+4 x-7$", + "Output Answer": [ + "$-\\frac{25}{2} \\left(x-\\frac{4}{25}\\right)^2-\\frac{167}{25}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((25*x**2)/2)+4*x-7), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -7 x^2+12 x+15$ and $q(x) = -14 x^2+11 x-8$", + "Output Answer": [ + "$98 x^4-245 x^3-22 x^2+69 x-120$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -7*x**2+12*x+15\nq = -14*x**2+11*x-8\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{4}{625} (575-333 t)^2, x(t)=\\frac{37 t}{5}-15$", + "Output Answer": [ + "$y=\\frac{324 x^2}{25}+\\frac{288 x}{5}+64$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (4/625)*(575-333*t)**2\nx_t = ((37*t)/5)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{19+13 i}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{530}}{\\pi }$\nArgument: $\\tan ^{-1}\\left(\\frac{13}{19}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((19+13*i)/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $x^6+4 x^5+3 x^4-x^3-7 x^2-6 x-4$ when divided by $3 x^5+9 x^4+4 x^3+6 x^2+3 x+3$.", + "Output Answer": [ + "$\\frac{x}{3}+\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**6+4*x**5+3*x**4-x**3-7*x**2-6*x-4\nq = 3*x**5+9*x**4+4*x**3+6*x**2+3*x+3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\sqrt{2}$ and $y=(6-7 i) \\sqrt{2}$", + "Output Answer": [ + "$(-7+7 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -math.sqrt(2)\ny = (6-7*i)*math.sqrt(2)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=40$, and $a_n=a_{n-1}+\\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$2 (80+3 \\pi )$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 40 # initial value\nd = math.pi # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = 40 # initial value\nd = math.pi # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 \\sqrt{5} x^2-4 \\sqrt{5} x+2 \\sqrt{5}$ and $q(x) = 2 \\sqrt{5} x^2+4 \\sqrt{5} x+2 \\sqrt{5}$", + "Output Answer": [ + "$40 x^4+40 x^3-20 x^2+20$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*sqrt(5)*x**2-4*sqrt(5)*x+2*sqrt(5)\nq = 2*sqrt(5)*x**2+4*sqrt(5)*x+2*sqrt(5)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$24 x+12 y-24 z+24=0$, $22 x-11 y-20 z+8=0$, $4 x-10 y+13 z-19=0$", + "Output Answer": [ + "$x=\\frac{6}{25}$, $y=-\\frac{96}{175}$, $z=\\frac{169}{175}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((24*x+12*y-24*z+24, 22*x-11*y-20*z+8, 4*x-10*y+13*z-19)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\left(\\cos \\left(\\frac{19}{18}\\right)+i \\sin \\left(\\frac{19}{18}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$512 \\left(\\cos \\left(\\frac{19}{2}\\right)+i \\sin \\left(\\frac{19}{2}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*(math.cos((19/18))+1j*math.sin((19/18))))**9)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$17 x+21 y-22 z+6=0$, $21 x-19 y+17 z+6=0$, $-11 x-24 y+10 z+18=0$", + "Output Answer": [ + "$x=-\\frac{706}{3685}$, $y=\\frac{5444}{3685}$, $z=\\frac{5656}{3685}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((17*x+21*y-22*z+6, 21*x-19*y+17*z+6, -11*x-24*y+10*z+18)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{29 x}{3}-\\frac{26}{3}}+\\sqrt{\\frac{44}{3}-\\frac{19 x}{3}}=\\frac{20}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-213+4 \\sqrt{2735}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((29*x)/3)-(26/3))+sqrt((44/3)-((19*x)/3)), (20/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(11-24)+(3-14)$.", + "Output Answer": [ + "$-24$" + ], + "Output Program": [ + "try: \n print((11-24)+(3-14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{8 x^2+18 x+2}{20 x^2+x-24}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(-9-\\sqrt{65}\\right)\\right\\},\\left\\{x\\to \\frac{1}{8} \\left(-9+\\sqrt{65}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((8*x**2+18*x+2)/(20*x**2+x-24)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $4-10 x$", + "Output Answer": [ + "$x=\\frac{2}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(4-10*x, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(((12-20)+15)+10)-24}{(((22-2)-14)+12)^2}$.", + "Output Answer": [ + "$-\\frac{7}{324}$" + ], + "Output Program": [ + "try: \n print((((((12-20)+15)+10)-24)/((((22-2)-14)+12)**2)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-2 \\sqrt{3} x+9 \\sqrt{3} y-5 \\sqrt{3} z+13 \\sqrt{3}=0$, $-8 \\sqrt{3} x+3 \\sqrt{3} y+2 \\sqrt{3} z-14 \\sqrt{3}=0$, $-13 \\sqrt{3} x+2 \\sqrt{3} y+13 \\sqrt{3} z+\\sqrt{3}=0$", + "Output Answer": [ + "$x=-\\frac{206}{47}$, $y=-\\frac{212}{47}$, $z=-\\frac{177}{47}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-2*sqrt(3)*x+9*sqrt(3)*y-5*sqrt(3)*z+13*sqrt(3), -8*sqrt(3)*x+3*sqrt(3)*y+2*sqrt(3)*z-14*sqrt(3), -13*sqrt(3)*x+2*sqrt(3)*y+13*sqrt(3)*z+sqrt(3))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=1$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$-825$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 1 # initial value\nd = -8 # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = 1 # initial value\nd = -8 # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{14 x^2}{\\pi }-\\frac{x}{\\pi }-\\frac{24}{\\pi }$ and $q(x) = -\\frac{30 x^2}{\\pi }-\\frac{37 x}{\\pi }+\\frac{17}{\\pi }$", + "Output Answer": [ + "$-\\frac{420 x^4}{\\pi ^2}-\\frac{488 x^3}{\\pi ^2}+\\frac{995 x^2}{\\pi ^2}+\\frac{871 x}{\\pi ^2}-\\frac{408}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((14*x**2)/pi)-(x/pi)-(24/pi)\nq = -((30*x**2)/pi)-((37*x)/pi)+(17/pi)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(15-12)^2 \\left(\\left(((5-25)+1)^2+14\\right)+4\\right)$.", + "Output Answer": [ + "$3411$" + ], + "Output Program": [ + "try: \n print((15-12)**2*((((5-25)+1)**2+14)+4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{13}{3}+\\frac{28 i}{3}$ and $y=-3+\\frac{29 i}{3}$", + "Output Answer": [ + "$-\\frac{695}{9}-\\frac{629 i}{9}$" + ], + "Output Program": [ + "i = 1j\nx = -(13/3)+((28*i)/3)\ny = -3+((29*i)/3)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{21 x^2}{2}-\\frac{11 x}{4}-\\frac{7}{4}$ and $q(x) = \\frac{5 x^2}{2}+5 x+\\frac{7}{2}$", + "Output Answer": [ + "$\\frac{105 x^4}{4}+\\frac{365 x^3}{8}+\\frac{149 x^2}{8}-\\frac{147 x}{8}-\\frac{49}{8}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((21*x**2)/2)-((11*x)/4)-(7/4)\nq = ((5*x**2)/2)+5*x+(7/2)\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 7 x-10| =-22$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(7*x-10), -22), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{20 x}{3}-\\frac{20}{3}}+\\sqrt{15 x-\\frac{25}{3}}=\\frac{37}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{375} \\left(17872-148 \\sqrt{12021}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((20*x)/3)-(20/3))+sqrt(15*x-(25/3)), (37/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{94}{57}$, and $a_n=a_{n-1}+-5$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$-\\frac{118436}{57}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(94/57) # initial value\nd = -5 # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(94/57) # initial value\nd = -5 # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{2 \\left(7 x^2+12 x+10\\right)}{\\sqrt{3}}$, $q(x) = -\\frac{20 x^2+23 x+4}{\\sqrt{3}}$", + "Output Answer": [ + "$-2 \\sqrt{3} x^2+8 \\sqrt{3} x-\\frac{23 x}{\\sqrt{3}}+\\frac{16}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((2*(7*x**2+12*x+10))/(sqrt(3)))\nq = -((20*x**2+23*x+4)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2-2 \\sqrt{2} x+35$", + "Output Answer": [ + "$-2 \\left(x-\\frac{5}{\\sqrt{2}}\\right) \\left(x+\\frac{7}{\\sqrt{2}}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2-2*sqrt(2)*x+35, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 10 x^2+13 x\\right| =15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{20} \\left(-13-\\sqrt{769}\\right)\\right\\},\\left\\{x\\to \\frac{1}{20} \\left(-13+\\sqrt{769}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(10*x**2+13*x), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{41}{5}-\\frac{49 x}{5}}+\\sqrt{\\frac{14}{5}-\\frac{24 x}{5}}=\\frac{39}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-107658+78 \\sqrt{1751446}}{3125}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((41/5)-((49*x)/5))+sqrt((14/5)-((24*x)/5)), (39/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{\\frac{\\frac{4}{13}}{20}}{21}+22\\right)+((7-24)+4)$.", + "Output Answer": [ + "$\\frac{12286}{1365}$" + ], + "Output Program": [ + "try: \n print(((((4/13)/20)/21)+22)+((7-24)+4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(\\cos \\left(\\frac{1}{18}\\right)+i \\sin \\left(\\frac{1}{18}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$13841287201 \\left(\\cos \\left(\\frac{2}{3}\\right)+i \\sin \\left(\\frac{2}{3}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(math.cos((1/18))+1j*math.sin((1/18))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2+7 x-9 y^2+7 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(x+\\frac{7}{20}\\right)^2-9 \\left(y-\\frac{7}{18}\\right)^2=-\\frac{1489}{360}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{7}{20} & \\frac{1}{180} \\left(70-\\sqrt{28291}\\right) \\\\\n -\\frac{7}{20} & \\frac{1}{180} \\left(70+\\sqrt{28291}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{19}{10}}$\nCenter: $\\left\\{-\\frac{7}{20},\\frac{1}{2} \\left(\\frac{1}{180} \\left(70-\\sqrt{28291}\\right)+\\frac{1}{180} \\left(70+\\sqrt{28291}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\frac{\\sqrt{10} x}{3}-\\frac{7}{180} \\left(3 \\sqrt{10}-10\\right),y=\\frac{\\sqrt{10} x}{3}+\\frac{7}{180} \\left(10+3 \\sqrt{10}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2+7*x-9*y**2+7*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2+28 x+102$", + "Output Answer": [ + "$2 (17-x) (x+3)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2+28*x+102, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-4 x+21 y-4=0$, $17 x-11 y-9=0$", + "Output Answer": [ + "$x=\\frac{233}{313}$, $y=\\frac{104}{313}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-4*x+21*y-4, 17*x-11*y-9), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{27 x^2}{4}-\\frac{19 x}{4}+\\frac{15}{2}$", + "Output Answer": [ + "$x=\\frac{1}{54} \\left(19-i \\sqrt{2879}\\right)\\lor x=\\frac{1}{54} \\left(19+i \\sqrt{2879}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((27*x**2)/4)-((19*x)/4)+(15/2), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{170 x^2+488 x+192}{-204 x^2-470 x-176}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{12}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((170*x**2+488*x+192)/(-204*x**2-470*x-176)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{1}{9}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$-\\frac{328}{9}$" + ], + "Output Program": [ + "a = -(1/9) # initial value\nd = -6 # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(1/9) # initial value\nd = -6 # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{74 x^2}{5}-\\frac{87 x}{5}-\\frac{24}{5}}{\\frac{112 x}{5}-\\frac{77}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{148} \\left(87-\\sqrt{14673}\\right)\\right\\},\\left\\{x\\to \\frac{1}{148} \\left(87+\\sqrt{14673}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((74*x**2)/5)-((87*x)/5)-(24/5))/(((112*x)/5)-(77/5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 13-7 x$ and $q(x) = 13 x^2+5 x+4$", + "Output Answer": [ + "$-91 x^3+134 x^2+37 x+52$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 13-7*x\nq = 13*x**2+5*x+4\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $15$ and $5$.", + "Output Answer": [ + "$5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(15, 5))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{2}}, \\sqrt{5}, 2)$", + "Output Answer": [ + "$\\left\\{\\sqrt{\\frac{19}{2}},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{11}{2}}}{2}\\right),\\tan ^{-1}\\left(\\sqrt{10}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(2)))\ny = math.sqrt(5)\nz = 2\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{4} (167-42 t)^2, x(t)=4 t-15$", + "Output Answer": [ + "$y=\\frac{441 x^2}{16}-\\frac{399 x}{8}+\\frac{361}{16}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/4)*(167-42*t)**2\nx_t = 4*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-4 e^{\\frac{19 i \\pi }{30}}$.", + "Output Answer": [ + "Norm: $4$\nArgument: $-\\frac{11 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -4*math.e**((19*i*math.pi)/30)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\cos \\left(e^{4 x+8}\\right)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = cos(math.e**(4*x+8))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-6 x+\\frac{73 y}{3}-\\frac{31 z}{3}-\\frac{28}{3}=0$, $-7 x+\\frac{y}{3}+\\frac{31 z}{3}-\\frac{35}{3}=0$, $-10 x+\\frac{2 y}{3}-\\frac{22 z}{3}+\\frac{20}{3}=0$", + "Output Answer": [ + "$x=-\\frac{484}{8311}$, $y=\\frac{13641}{16622}$, $z=\\frac{17671}{16622}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-6*x+((73*y)/3)-((31*z)/3)-(28/3), -7*x+(y/3)+((31*z)/3)-(35/3), -10*x+((2*y)/3)-((22*z)/3)+(20/3))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\left(245 t^2+1050 t+1119\\right)^2, x(t)=49 t^2+210 t+225$", + "Output Answer": [ + "$y=25 x^2-60 x+36$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (245*t**2+1050*t+1119)**2\nx_t = 49*t**2+210*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x^2+4 x-3$ and $2 x^4+x^3-5 x^2-5 x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x**2+4*x-3, 2*x**4+x**3-5*x**2-5*x-3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2+\\frac{212 x}{3}+280$", + "Output Answer": [ + "$-4 \\left(-x-\\frac{35}{3}\\right) (x+6)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2+((212*x)/3)+280, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{729}{8} (x+2)^3, q(x) = 2 x-7$", + "Output Answer": [ + "$-\\frac{729 x^3}{8}-\\frac{2187 x^2}{4}-\\frac{2183 x}{2}-736$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(729/8)*(x+2)**3\nq = 2*x-7\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+5 x-2 y^2-6 y+7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x+\\frac{5}{16}\\right)^2-2 \\left(y+\\frac{3}{2}\\right)^2=-\\frac{343}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{16} & -\\frac{3}{2}-\\frac{7 \\sqrt{35}}{16} \\\\\n -\\frac{5}{16} & \\frac{7 \\sqrt{35}}{16}-\\frac{3}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{2}$\nCenter: $\\left\\{-\\frac{5}{16},-\\frac{3}{2}\\right\\}$\nAsymptotes: $\\left\\{y=-2 x-\\frac{17}{8},y=2 x-\\frac{7}{8}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+5*x-2*y**2-6*y+7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{5 \\left(\\frac{1}{4}-\\frac{\\sqrt{5}}{4}-i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\frac{5}{\\sqrt{\\frac{3}{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}+\\left(\\frac{1}{4}-\\frac{\\sqrt{5}}{4}\\right)^2}}}$\nArgument: $\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}}{\\frac{\\sqrt{5}}{4}-\\frac{1}{4}}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((5*((1/4)-((math.sqrt(5))/4)-i*math.sqrt((5/8)+((math.sqrt(5))/8))))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{230 x^3+252 x^2-98 x}{91-299 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{5}\\right\\},\\{x\\to 0\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((230*x**3+252*x**2-98*x)/(91-299*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 x^2-14 x+6$", + "Output Answer": [ + "$\\frac{67}{3}-3 \\left(x+\\frac{7}{3}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*x**2-14*x+6), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^6+6 x^5+10 x^4-3 x^3-3 x^2-3$ when divided by $x^4+9 x^3+x^2-7 x+3$.", + "Output Answer": [ + "$6 x^2-48 x+436$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**6+6*x**5+10*x**4-3*x**3-3*x**2-3\nq = x**4+9*x**3+x**2-7*x+3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{24 x^4}{5}-\\frac{38 x^3}{5}+9 x^2+9 x+\\frac{8}{5}$ when divided by $-10 x^4+10 x^3-\\frac{17 x^2}{5}+7 x+\\frac{17}{5}$.", + "Output Answer": [ + "$-\\frac{12}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((24*x**4)/5)-((38*x**3)/5)+9*x**2+9*x+(8/5)\nq = -10*x**4+10*x**3-((17*x**2)/5)+7*x+(17/5)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{68}{7}+5 i$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{5849}}{7}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{35}{68}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(68/7)+5*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^4+7 x^3+9 x^2-4 x+5$ when divided by $-8 x^2-9 x-5$.", + "Output Answer": [ + "$-\\frac{3 x^2}{8}-\\frac{29 x}{64}-\\frac{195}{512}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**4+7*x**3+9*x**2-4*x+5\nq = -8*x**2-9*x-5\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-1+\\frac{19 i}{2}$ and $y=\\frac{9}{2}-\\frac{17 i}{4}$", + "Output Answer": [ + "$\\frac{287}{8}+47 i$" + ], + "Output Program": [ + "i = 1j\nx = -1+((19*i)/2)\ny = (9/2)-((17*i)/4)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-4 x^2+7 x+18}{12 x-8}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(7-\\sqrt{337}\\right)\\right\\},\\left\\{x\\to \\frac{1}{8} \\left(7+\\sqrt{337}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-4*x**2+7*x+18)/(12*x-8)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt[3]{87}-\\sqrt[3]{54}\\right) \\left(\\sqrt[3]{38}+\\sqrt[3]{48}\\right)$.", + "Output Answer": [ + "$\\left(2 \\sqrt[3]{6}+\\sqrt[3]{38}\\right) \\left(\\sqrt[3]{87}-3 \\sqrt[3]{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint((cbrt(87)-cbrt(54))*(cbrt(38)+cbrt(48)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{10 x^2}{3}-x+\\frac{7}{3}$", + "Output Answer": [ + "$x=\\frac{7}{10}\\lor x=-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((10*x**2)/3)-x+(7/3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-6 x^5-x^4+8 x^2+4 x+3$ and $-3 x^3+x^2+x+3$.", + "Output Answer": [ + "$3 x^3-x^2-x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-6*x**5-x**4+8*x**2+4*x+3, -3*x**3+x**2+x+3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^6+6 x^5+10 x^4+4 x^3+2 x^2-3 x-4$ when divided by $-5 x^4+2 x^3-5 x^2+3 x-6$.", + "Output Answer": [ + "$\\frac{7 x^2}{5}-\\frac{16 x}{25}-\\frac{457}{125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**6+6*x**5+10*x**4+4*x**3+2*x**2-3*x-4\nq = -5*x**4+2*x**3-5*x**2+3*x-6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x-15}+\\sqrt{6 x-6}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 1322-22 \\sqrt{3570}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x-15)+sqrt(6*x-6), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{10+15 i}{\\sqrt{3}}$ and $y=-\\frac{10-8 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{23 i}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((10+15*i)/(math.sqrt(3)))\ny = -((10-8*i)/(math.sqrt(3)))\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\log (-5 x-3)-\\sqrt{3-5 x}$", + "Output Answer": [ + "$x<-\\frac{3}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = log(-5*x-3)-sqrt(3-5*x)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{104 x}{7}+23 y+\\frac{145 z}{7}+24=0$, $-\\frac{58 x}{7}+\\frac{78 y}{7}-\\frac{51 z}{7}-\\frac{111}{7}=0$, $\\frac{81 x}{7}+\\frac{152 y}{7}-24 z+\\frac{103}{7}=0$", + "Output Answer": [ + "$x=-\\frac{8358567}{3871697}$, $y=-\\frac{4379239}{3871697}$, $z=-\\frac{5618473}{3871697}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((104*x)/7)+23*y+((145*z)/7)+24, -((58*x)/7)+((78*y)/7)-((51*z)/7)-(111/7), ((81*x)/7)+((152*y)/7)-24*z+(103/7))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+4 x-10 y^2+10 y+10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x+\\frac{1}{3}\\right)^2-10 \\left(y-\\frac{1}{2}\\right)^2=-\\frac{71}{6}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{3} & \\frac{1}{30} \\left(15-2 \\sqrt{710}\\right) \\\\\n -\\frac{1}{3} & \\frac{1}{30} \\left(15+2 \\sqrt{710}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{-\\frac{1}{3},\\frac{1}{2} \\left(\\frac{1}{30} \\left(15-2 \\sqrt{710}\\right)+\\frac{1}{30} \\left(15+2 \\sqrt{710}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\sqrt{\\frac{3}{5}} x-\\frac{1}{\\sqrt{15}}+\\frac{1}{2},y=\\sqrt{\\frac{3}{5}} x+\\frac{1}{30} \\left(15+2 \\sqrt{15}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+4*x-10*y**2+10*y+10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{96 x^2+180 x-231}{-84 x-231}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((96*x**2+180*x-231)/(-84*x-231)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 6 \\sqrt{5} x^2+5 \\sqrt{5} x-7 \\sqrt{5}\\right| =9 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(-5-\\sqrt{409}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(-5+\\sqrt{409}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(6*sqrt(5)*x**2+5*sqrt(5)*x-7*sqrt(5)), 9*sqrt(5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((14+12)+8) (7+2)$.", + "Output Answer": [ + "$306$" + ], + "Output Program": [ + "try: \n print(((14+12)+8)*(7+2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{2} \\left(-9 x^2+x+10\\right)$, $q(x) = -\\sqrt{2} \\left(9 x^2+10 x+3\\right)$", + "Output Answer": [ + "$-18 \\sqrt{2} x^2-9 \\sqrt{2} x+7 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(2)*(-9*x**2+x+10)\nq = -sqrt(2)*(9*x**2+10*x+3)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{59}{5}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$\\frac{954}{5}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (59/5) # initial value\nd = 8 # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (59/5) # initial value\nd = 8 # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-3 x^5+2 x^3+7 x^2-9 x+8$ when divided by $-10 x^5-9 x^4-7 x^2+x-4$.", + "Output Answer": [ + "$\\frac{3}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x**5+2*x**3+7*x**2-9*x+8\nq = -10*x**5-9*x**4-7*x**2+x-4\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+9 x+9 y^2+5 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x+\\frac{9}{16}\\right)^2+9 \\left(y+\\frac{5}{18}\\right)^2=\\frac{2369}{288}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{144} \\left(-81-\\sqrt{2369}\\right) & -\\frac{5}{18} \\\\\n \\frac{1}{144} \\left(\\sqrt{2369}-81\\right) & -\\frac{5}{18} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{144} \\left(-81-\\sqrt{2369}\\right)+\\frac{1}{144} \\left(\\sqrt{2369}-81\\right)\\right),-\\frac{5}{18}\\right\\}$\nArea Enclosed: $\\frac{2369 \\pi }{1728 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+9*x+9*y**2+5*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left((22+18)^2+12\\right)-20\\right)+(3+19)$.", + "Output Answer": [ + "$1614$" + ], + "Output Program": [ + "try: \n print((((22+18)**2+12)-20)+(3+19))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{9}{62}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$\\frac{27}{31}$" + ], + "Output Program": [ + "a = (9/62) # initial value\nd = 0 # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (9/62) # initial value\nd = 0 # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2-3 x+3 y^2-4 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $9 \\left(x-\\frac{1}{6}\\right)^2+3 \\left(y-\\frac{2}{3}\\right)^2=\\frac{67}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{6} & \\frac{2}{3}-\\frac{\\sqrt{\\frac{67}{6}}}{3} \\\\\n \\frac{1}{6} & \\frac{1}{18} \\left(12+\\sqrt{402}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{\\frac{1}{6},\\frac{1}{2} \\left(\\frac{2}{3}-\\frac{\\sqrt{\\frac{67}{6}}}{3}+\\frac{1}{18} \\left(12+\\sqrt{402}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{67 \\pi }{36 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2-3*x+3*y**2-4*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11-\\frac{40 x}{3}}+\\sqrt{\\frac{34}{3}-\\frac{10 x}{3}}=\\frac{28}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{270} \\left(-3929+56 \\sqrt{4063}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11-((40*x)/3))+sqrt((34/3)-((10*x)/3)), (28/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{2 x^2+5 x+16}{\\sqrt{2}}$, $q(x) = \\frac{6 x^2+20 x+5}{\\sqrt{2}}$", + "Output Answer": [ + "$4 \\sqrt{2} x^2+10 \\sqrt{2} x+\\frac{5 x}{\\sqrt{2}}+8 \\sqrt{2}+\\frac{5}{\\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((2*x**2+5*x+16)/(sqrt(2)))\nq = ((6*x**2+20*x+5)/(sqrt(2)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{7 e^{\\frac{29 i \\pi }{45}}}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\frac{7}{\\sqrt{3}}$\nArgument: $\\frac{29 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((7*math.e**((29*i*math.pi)/45))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 x^2-7 x-7$ and $q(x) = -8 x^2-8 x+3$", + "Output Answer": [ + "$32 x^4+88 x^3+100 x^2+35 x-21$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*x**2-7*x-7\nq = -8*x**2-8*x+3\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-36 x^2-292 x-456}{-45 x-95}=0$", + "Output Answer": [ + "$\\{\\{x\\to -6\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-36*x**2-292*x-456)/(-45*x-95)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^5+x^4-4 x^3-7 x^2-7 x-6$ when divided by $8 x^5+7 x^4+x^3-8 x-5$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**5+x**4-4*x**3-7*x**2-7*x-6\nq = 8*x**5+7*x**4+x**3-8*x-5\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^2+9 x+7$ when divided by $-7 x^2-4 x+3$.", + "Output Answer": [ + "$-\\frac{8}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**2+9*x+7\nq = -7*x**2-4*x+3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(10+6 i) \\log (2)$ and $y=(10+2 i) \\log (2)$", + "Output Answer": [ + "$(88+80 i) \\log ^2(2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (10+6*i)*math.log10(2)\ny = (10+2*i)*math.log10(2)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{13 x-8}+\\sqrt{2}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{13} \\left(26-8 \\sqrt{2}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(13*x-8)+sqrt(2), 4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 3.466 x^2-10.75 x-10.652$, $q(x) = 11.696 x^2-1.195 x-9.52$", + "Output Answer": [ + "$15.162 x^2-11.945 x-20.172$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3.466*x**2-10.75*x-10.652\nq = 11.696*x**2-1.195*x-9.52\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 24 x^2+17 x+19\\right| =24$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{48} \\left(-17-\\sqrt{769}\\right)\\right\\},\\left\\{x\\to \\frac{1}{48} \\left(-17+\\sqrt{769}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(24*x**2+17*x+19), 24), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{1}{2} e^{-\\frac{11 i \\pi }{15}}$.", + "Output Answer": [ + "Norm: $\\frac{1}{2}$\nArgument: $\\frac{4 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(1/2)*math.e**(-((11*i*math.pi)/15))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{167}{7}-\\frac{75 x}{7}\\right| =\\frac{11}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{52}{25}\\right\\},\\left\\{x\\to \\frac{178}{75}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs((167/7)-((75*x)/7)), (11/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\sqrt{2} \\left(\\cos \\left(\\frac{19}{45}\\right)+i \\sin \\left(\\frac{19}{45}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$16 \\sqrt{2} \\left(\\cos \\left(\\frac{19}{15}\\right)+i \\sin \\left(\\frac{19}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*math.sqrt(2)*(math.cos((19/45))+1j*math.sin((19/45))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2+4 x+4$ and $4 x^3+2 x^2+4 x+1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2+4*x+4, 4*x**3+2*x**2+4*x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{18 \\sqrt{2} x^2-17 \\sqrt{2} x-11 \\sqrt{2}}{14 \\sqrt{2}-9 \\sqrt{2} x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{36} \\left(17-\\sqrt{1081}\\right)\\right\\},\\left\\{x\\to \\frac{1}{36} \\left(17+\\sqrt{1081}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((18*sqrt(2)*x**2-17*sqrt(2)*x-11*sqrt(2))/(14*sqrt(2)-9*sqrt(2)*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-23 x-11 y+8 z-11=0$, $-x+12 y-13 z+5=0$, $-15 x+24 y+z+20=0$", + "Output Answer": [ + "$x=-\\frac{1609}{8360}$, $y=-\\frac{7811}{8360}$, $z=-\\frac{3871}{8360}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-23*x-11*y+8*z-11, -x+12*y-13*z+5, -15*x+24*y+z+20)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{7 x^2}{3}-3 x-14$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(-9-i \\sqrt{1095}\\right)\\lor x=\\frac{1}{14} \\left(-9+i \\sqrt{1095}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((7*x**2)/3)-3*x-14, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$7 \\sqrt{2} x-\\frac{y}{\\sqrt{2}}+14 \\sqrt{2} z-9 \\sqrt{2}=0$, $\\frac{21 x}{\\sqrt{2}}+\\frac{11 y}{\\sqrt{2}}-8 \\sqrt{2} z+\\frac{35}{\\sqrt{2}}=0$, $11 \\sqrt{2} x-15 \\sqrt{2} y+\\frac{13 z}{\\sqrt{2}}+15 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{31639}{28509}$, $y=\\frac{20420}{28509}$, $z=\\frac{34876}{28509}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((7*sqrt(2)*x-(y/(sqrt(2)))+14*sqrt(2)*z-9*sqrt(2), ((21*x)/(sqrt(2)))+((11*y)/(sqrt(2)))-8*sqrt(2)*z+(35/(sqrt(2))), 11*sqrt(2)*x-15*sqrt(2)*y+((13*z)/(sqrt(2)))+15*sqrt(2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4$ and $-x^3+x^2-2 x+1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4, -x**3+x**2-2*x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x^3-16 x^2-4 x+4$ and $-x^3+4 x^2+x-1$.", + "Output Answer": [ + "$x^3-4 x^2-x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x**3-16*x**2-4*x+4, -x**3+4*x**2+x-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 11 x^2+10 x-11$ and $q(x) = 6 x^2-4 x-3$", + "Output Answer": [ + "$66 x^4+16 x^3-139 x^2+14 x+33$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 11*x**2+10*x-11\nq = 6*x**2-4*x-3\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2+8 x-12$ and $q(x) = -x^2-6 x+6$", + "Output Answer": [ + "$14 x^4+76 x^3-120 x^2+120 x-72$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2+8*x-12\nq = -x**2-6*x+6\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{5 x+4}+\\frac{1}{(-3 x-3)^2}$ at the point $x=-6$", + "Output Answer": [ + "$\\frac{1}{225}-\\sqrt[3]{26} = -2.958$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = -6\ntry: \n f = np.cbrt(5*x+4)+(1/((-3*x-3)**2))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-171 x^2-495 x-306}{-247 x^2+197 x+374}=0$", + "Output Answer": [ + "$\\{\\{x\\to -2\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-171*x**2-495*x-306)/(-247*x**2+197*x+374)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-12 x-8}+\\sqrt{-8 x-3}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5}{2} \\left(-13+\\sqrt{157}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-12*x-8)+sqrt(-8*x-3), 5), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -12 x^2-14 x+9$, $q(x) = -11 x^2+10 x-12$", + "Output Answer": [ + "$-23 x^2-4 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -12*x**2-14*x+9\nq = -11*x**2+10*x-12\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{5+14 i}{\\sqrt{3}}$ and $y=\\frac{8-3 i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{2}{73}-\\frac{127 i}{73}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((5+14*i)/(math.sqrt(3)))\ny = ((8-3*i)/(math.sqrt(3)))\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{8 x}{3}-\\frac{2}{3}$ and $-\\frac{7 x^5}{3}-\\frac{8 x^4}{3}+\\frac{2 x^3}{3}-\\frac{2 x^2}{3}+\\frac{10 x}{3}-\\frac{13}{3}$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((8*x)/3)-(2/3), -((7*x**5)/3)-((8*x**4)/3)+((2*x**3)/3)-((2*x**2)/3)+((10*x)/3)-(13/3)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -7 x^2+9 x-1$, $q(x) = -5 x^2+5 x+8$", + "Output Answer": [ + "$-12 x^2+14 x+7$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**2+9*x-1\nq = -5*x**2+5*x+8\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 21 x-11| =15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{4}{21}\\right\\},\\left\\{x\\to \\frac{26}{21}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(21*x-11), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-8 x^3-16 x^2+2440 x+2448$", + "Output Answer": [ + "$-8 (-x-18) (-x-1) (x-17)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-8*x**3-16*x**2+2440*x+2448, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{14 x}{\\sqrt{3}}-3 \\sqrt{3} y-\\frac{17 z}{\\sqrt{3}}+\\frac{17}{\\sqrt{3}}=0$, $-\\frac{29 x}{\\sqrt{3}}-\\frac{23 y}{\\sqrt{3}}-\\frac{8 z}{\\sqrt{3}}-13 \\sqrt{3}=0$, $11 \\sqrt{3} x+\\frac{20 y}{\\sqrt{3}}-\\frac{25 z}{\\sqrt{3}}-\\frac{7}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{36763}{4432}$, $y=-\\frac{55009}{4432}$, $z=\\frac{3279}{4432}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((14*x)/(sqrt(3)))-3*sqrt(3)*y-((17*z)/(sqrt(3)))+(17/(sqrt(3))), -((29*x)/(sqrt(3)))-((23*y)/(sqrt(3)))-((8*z)/(sqrt(3)))-13*sqrt(3), 11*sqrt(3)*x+((20*y)/(sqrt(3)))-((25*z)/(sqrt(3)))-(7/(sqrt(3))))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $8$ when divided by $5-3 x$.", + "Output Answer": [ + "$0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8\nq = 5-3*x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-10 x^2+2 x+2}{17-16 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(1-\\sqrt{21}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(1+\\sqrt{21}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-10*x**2+2*x+2)/(17-16*x)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-360 x^2-465 x-150}{-120 x^2-275 x-130}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-360*x**2-465*x-150)/(-120*x**2-275*x-130)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\sqrt{3}-5 \\sqrt{3} x^2$", + "Output Answer": [ + "$\\sqrt{3}-5 \\sqrt{3} x^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (math.sqrt(3)-5*math.sqrt(3)*x**2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x-8}+\\sqrt{11 x-7}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(339-28 \\sqrt{130}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x-8)+sqrt(11*x-7), 10), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{20}{3} \\left(\\cos \\left(\\frac{6}{5}\\right)+i \\sin \\left(\\frac{6}{5}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$\\frac{204800000000000 \\left(\\cos \\left(\\frac{66}{5}\\right)+i \\sin \\left(\\frac{66}{5}\\right)\\right)}{177147}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((20/3)*(math.cos((6/5))+1j*math.sin((6/5))))**11)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $-\\sin \\left(\\frac{11}{2}-\\frac{13 x}{2}\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{13} (4 \\pi c_1+11)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\},\\left\\{x\\to \\fbox{$\\frac{1}{13} (2 (2 \\pi c_1+\\pi )+11)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(-sin((11/2)-((13*x)/2)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $2 \\sqrt{2} x^2$", + "Output Answer": [ + "$x=0\\lor x=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(2*sqrt(2)*x**2, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 11 \\sqrt{3} x-11 \\sqrt{3}\\right| =2 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{9}{11}\\right\\},\\left\\{x\\to \\frac{13}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11*sqrt(3)*x-11*sqrt(3)), 2*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$16 \\sqrt{2} x-5 \\sqrt{2} y+15 \\sqrt{2}=0$, $-14 \\sqrt{2} x-2 \\sqrt{2} y-2 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{20}{51}$, $y=\\frac{89}{51}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((16*sqrt(2)*x-5*sqrt(2)*y+15*sqrt(2), -14*sqrt(2)*x-2*sqrt(2)*y-2*sqrt(2)), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{34}{5} \\left(\\cos \\left(\\frac{1}{3}\\right)+i \\sin \\left(\\frac{1}{3}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-\\frac{52523350144 \\left(\\cos \\left(\\frac{7}{3}\\right)+i \\sin \\left(\\frac{7}{3}\\right)\\right)}{78125}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(34/5)*(math.cos((1/3))+1j*math.sin((1/3))))**7)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{11 x^2}{3}+\\frac{31 x}{3}+\\frac{13}{3}$", + "Output Answer": [ + "$x=\\frac{1}{22} \\left(31-\\sqrt{1533}\\right)\\lor x=\\frac{1}{22} \\left(31+\\sqrt{1533}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((11*x**2)/3)+((31*x)/3)+(13/3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-12 x+14 y+13 z+7=0$, $-4 x-10 y-3 z-22=0$, $-16 x-10 y-2 z-4=0$", + "Output Answer": [ + "$x=\\frac{911}{440}$, $y=-\\frac{559}{110}$, $z=\\frac{753}{110}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-12*x+14*y+13*z+7, -4*x-10*y-3*z-22, -16*x-10*y-2*z-4)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4-14 x}+\\sqrt{11-12 x}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-215+40 \\sqrt{29}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4-14*x)+sqrt(11-12*x), 4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{16+10 i}{\\sqrt{3}}$ and $y=(-3+4 i) \\sqrt{3}$", + "Output Answer": [ + "$88-34 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((16+10*i)/(math.sqrt(3)))\ny = (-3+4*i)*math.sqrt(3)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{3}{7}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{9}{7}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (3/7) # initial value\nd = 0 # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (3/7) # initial value\nd = 0 # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-5 x-11}+\\sqrt{7}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(-54+12 \\sqrt{7}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-5*x-11)+sqrt(7), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-9 x^2-2 x+\\frac{43}{3}$", + "Output Answer": [ + "$\\frac{130}{9}-9 \\left(x+\\frac{1}{9}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-9*x**2-2*x+(43/3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^2+6 x+10$ when divided by $-3$.", + "Output Answer": [ + "$-\\frac{8 x^2}{3}-2 x-\\frac{10}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**2+6*x+10\nq = -3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{16} \\left(825 t^2+4950 t+7429\\right)^2, x(t)=25 t^2+150 t+225$", + "Output Answer": [ + "$y=\\frac{1089 x^2}{16}+\\frac{33 x}{2}+1$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/16)*(825*t**2+4950*t+7429)**2\nx_t = 25*t**2+150*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-23 x+7 y+8=0$, $-2 x-y-24=0$", + "Output Answer": [ + "$x=-\\frac{160}{37}$, $y=-\\frac{568}{37}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-23*x+7*y+8, -2*x-y-24), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-2 e^{-\\frac{7 i \\pi }{15}}$.", + "Output Answer": [ + "Norm: $2$\nArgument: $\\frac{8 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -2*math.e**(-((7*i*math.pi)/15))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{3 x^2-3}-\\tan \\left(3-x^3\\right)$ at the point $x=-8$", + "Output Answer": [ + "$3 \\sqrt{21}-\\tan (515) = 13.973$" + ], + "Output Program": [ + "import math\n\nx = -8\ntry: \n f = math.sqrt(3*x**2-3)-math.tan(3-x**3)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2 x^2+8 x-8$ and $2-x$.", + "Output Answer": [ + "$x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2*x**2+8*x-8, 2-x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 (2 t+27)^2, x(t)=-t-15$", + "Output Answer": [ + "$y=16 x^2+48 x+36$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*(2*t+27)**2\nx_t = -t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 7 x-5, q(x) = 9 x^2$", + "Output Answer": [ + "$9 x^2+7 x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x-5\nq = 9*x**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{37}{5} \\left(-\\sin \\left(\\frac{7 \\pi }{45}\\right)-i \\cos \\left(\\frac{7 \\pi }{45}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$\\frac{1369}{25} \\left(-\\sin \\left(\\frac{17 \\pi }{90}\\right)+i \\cos \\left(\\frac{17 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(37/5)*(-math.sin(((7*math.pi)/45))-1j*math.cos(((7*math.pi)/45))))**2)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2-3 x+5 y^2+9 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(y+\\frac{9}{10}\\right)^2-10 \\left(x+\\frac{3}{20}\\right)^2=\\frac{393}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{20} & -\\frac{3}{20} \\left(6+\\sqrt{131}\\right) \\\\\n -\\frac{3}{20} & \\frac{3}{20} \\left(\\sqrt{131}-6\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{2}}$\nCenter: $\\left\\{-\\frac{3}{20},\\frac{1}{2} \\left(\\frac{3}{20} \\left(\\sqrt{131}-6\\right)-\\frac{3}{20} \\left(6+\\sqrt{131}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\sqrt{2} x-\\frac{3}{20} \\left(6+\\sqrt{2}\\right),y=\\sqrt{2} x+\\frac{3}{20} \\left(\\sqrt{2}-6\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2-3*x+5*y**2+9*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-x^4-4 x^3+7 x^2-3 x+2$ when divided by $3 x^2-7 x-1$.", + "Output Answer": [ + "$-\\frac{x^2}{3}-\\frac{19 x}{9}-\\frac{73}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**4-4*x**3+7*x**2-3*x+2\nq = 3*x**2-7*x-1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $5 x^2-\\frac{515 x}{3}+\\frac{4370}{3}$", + "Output Answer": [ + "$-5 (19-x) \\left(x-\\frac{46}{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(5*x**2-((515*x)/3)+(4370/3), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{21 x}{5}-\\frac{37}{5}\\right| =\\frac{99}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{136}{21}\\right\\},\\left\\{x\\to \\frac{62}{21}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((21*x)/5)-(37/5)), (99/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{1}{14} ((9+3)-13)-14\\right) (24-21)^2$.", + "Output Answer": [ + "$-\\frac{1773}{14}$" + ], + "Output Program": [ + "try: \n print(((1/14)*((9+3)-13)-14)*(24-21)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^6+4 x^5+7 x^4+7 x^3-2 x+9$ when divided by $-9 x^5+x^4+x^3-8 x^2-3 x-2$.", + "Output Answer": [ + "$-\\frac{7 x}{9}-\\frac{43}{81}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**6+4*x**5+7*x**4+7*x**3-2*x+9\nq = -9*x**5+x**4+x**3-8*x**2-3*x-2\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4-14 x}+\\sqrt{-3 x-2}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{121} \\left(-546+48 \\sqrt{67}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4-14*x)+sqrt(-3*x-2), 6), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -e x (2 x+1)$, $q(x) = e \\left(-4 x^2+3 x+4\\right)$", + "Output Answer": [ + "$-6 e x^2+2 e x+4 e$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x\n\np = -math.e*x*(2*x+1)\nq = math.e*(-4*x**2+3*x+4)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $7 x$ when divided by $10 x+3$.", + "Output Answer": [ + "$\\frac{7}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x\nq = 10*x+3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 \\left(8 t^2-60 t+111\\right)^2, x(t)=16 t^2-120 t+225$", + "Output Answer": [ + "$y=x^2-6 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*(8*t**2-60*t+111)**2\nx_t = 16*t**2-120*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{56 x^2}{5}+12 x+\\frac{112}{5}}{8 x^2+\\frac{x}{5}-\\frac{46}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{28} \\left(15-\\sqrt{1793}\\right)\\right\\},\\left\\{x\\to \\frac{1}{28} \\left(15+\\sqrt{1793}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((56*x**2)/5)+12*x+(112/5))/(8*x**2+(x/5)-(46/5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2-8 x+10 y^2-3 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(y-\\frac{3}{20}\\right)^2-10 \\left(x+\\frac{2}{5}\\right)^2=\\frac{45}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{5} & \\frac{3}{20} \\left(1-5 \\sqrt{2}\\right) \\\\\n -\\frac{2}{5} & \\frac{3}{20} \\left(1+5 \\sqrt{2}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{-\\frac{2}{5},\\frac{1}{2} \\left(\\frac{3}{20} \\left(1-5 \\sqrt{2}\\right)+\\frac{3}{20} \\left(1+5 \\sqrt{2}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-x-\\frac{1}{4},y=x+\\frac{11}{20}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2-8*x+10*y**2-3*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11 x+\\frac{21}{2}}+\\sqrt{13}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{22} \\left(37-16 \\sqrt{13}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11*x+(21/2))+sqrt(13), 4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{20 x^3}{9}-\\frac{187 x^2}{9}-\\frac{577 x}{9}+\\frac{638}{9}}{\\frac{754}{9}-\\frac{65 x}{9}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(-9-\\sqrt{257}\\right)\\right\\},\\left\\{x\\to \\frac{1}{8} \\left(-9+\\sqrt{257}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((20*x**3)/9)-((187*x**2)/9)-((577*x)/9)+(638/9))/((754/9)-((65*x)/9))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{4}{3} \\left(11 t+3 \\sqrt{3}-26\\right), x(t)=\\frac{11 t}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=\\frac{4 x}{\\sqrt{3}}+4 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (4/3)*(11*t+3*sqrt(3)-26)\nx_t = ((11*t)/(sqrt(3)))-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{7}{30}$, and $a_n=a_{n-1}+\\frac{27}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$\\frac{62543}{210}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(7/30) # initial value\nd = (27/7) # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(7/30) # initial value\nd = (27/7) # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3$ and $-4 x^3+x^2+5 x+3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3, -4*x**3+x**2+5*x+3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((6-14)+17)-((((24+4)+8)+23)-23)$.", + "Output Answer": [ + "$-27$" + ], + "Output Program": [ + "try: \n print(((6-14)+17)-((((24+4)+8)+23)-23))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{9 e^{\\frac{169 i \\pi }{180}}}{\\sqrt{2}}$.", + "Output Answer": [ + "Norm: $\\frac{9}{\\sqrt{2}}$\nArgument: $-\\frac{11 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((9*math.e**((169*i*math.pi)/180))/(math.sqrt(2)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-9 x^2+15 x-9$ and $-3$.", + "Output Answer": [ + "$3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-9*x**2+15*x-9, -3))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-12 x-7 y-15=0$, $23 x-24 y+24=0$", + "Output Answer": [ + "$x=-\\frac{528}{449}$, $y=-\\frac{57}{449}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-12*x-7*y-15, 23*x-24*y+24), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(24-23)+(25+20)$.", + "Output Answer": [ + "$46$" + ], + "Output Program": [ + "try: \n print((24-23)+(25+20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $x^4-\\frac{7 x^3}{5}+9 x^2-\\frac{6 x}{5}+\\frac{18}{5}$ when divided by $\\frac{33 x}{5}+9$.", + "Output Answer": [ + "$\\frac{5 x^3}{33}-\\frac{152 x^2}{363}+\\frac{2575 x}{1331}-\\frac{41287}{14641}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**4-((7*x**3)/5)+9*x**2-((6*x)/5)+(18/5)\nq = ((33*x)/5)+9\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=9+3 i$ and $y=\\frac{13}{2}-\\frac{5 i}{4}$", + "Output Answer": [ + "$\\frac{249}{4}+\\frac{33 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = 9+3*i\ny = (13/2)-((5*i)/4)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (5 x+9)^3, q(x) = (x+9)^2$", + "Output Answer": [ + "$125 x^3+676 x^2+1233 x+810$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (5*x+9)**3\nq = (x+9)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{179}-\\left(\\sqrt{94}+\\sqrt{32}\\right)$.", + "Output Answer": [ + "$-4 \\sqrt{2}-\\sqrt{94}+\\sqrt{179}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(179)-(sqrt(94)+sqrt(32)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{18}+\\sqrt{33}}{\\sqrt{135}}$.", + "Output Answer": [ + "$\\frac{1}{15} \\left(\\sqrt{30}+\\sqrt{55}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(18)+sqrt(33))/(sqrt(135))))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{432 x^2}{25}-\\frac{1254 x}{5}-\\frac{7802}{25}}{-\\frac{4968 x}{25}-\\frac{5727}{25}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{47}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((432*x**2)/25)-((1254*x)/5)-(7802/25))/(-((4968*x)/25)-(5727/25))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2-3840$", + "Output Answer": [ + "$12 \\left(-x-8 \\sqrt{5}\\right) \\left(8 \\sqrt{5}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2-3840, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-7 x^2+16 x-2}{-16 x-21}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(8-5 \\sqrt{2}\\right)\\right\\},\\left\\{x\\to \\frac{1}{7} \\left(8+5 \\sqrt{2}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-7*x**2+16*x-2)/(-16*x-21)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 4 x^2-x-8\\right| =12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(1-\\sqrt{321}\\right)\\right\\},\\left\\{x\\to \\frac{1}{8} \\left(1+\\sqrt{321}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(4*x**2-x-8), 12), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all roots of the following function: $(5-4 x) (4 x+3)^3=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{4}\\right\\},\\left\\{x\\to -\\frac{3}{4}\\right\\},\\left\\{x\\to -\\frac{3}{4}\\right\\},\\left\\{x\\to \\frac{5}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve((5-4*x)*(4*x+3)**3, x)\n print(soln)\nexcept: ...\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 13 x^2-7 x-13$ and $q(x) = -11 x^2-x-10$", + "Output Answer": [ + "$-143 x^4+64 x^3+20 x^2+83 x+130$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 13*x**2-7*x-13\nq = -11*x**2-x-10\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x+6}+\\sqrt{15 x+9}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(159-27 \\sqrt{29}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x+6)+sqrt(15*x+9), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(-\\cos \\left(\\frac{\\pi }{15}\\right)-i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$4096 \\left(\\frac{1}{4} \\left(-1-\\sqrt{5}\\right)+i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(-math.cos((math.pi/15))-1j*math.sin((math.pi/15))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $2 x^2+14 x+10$", + "Output Answer": [ + "$2 \\left(x+\\frac{7}{2}\\right)^2-\\frac{29}{2}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (2*x**2+14*x+10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2-10 x-y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-7 x^2-10 x-y=2$\nVertex: $\\left\\{-\\frac{5}{7},\\frac{11}{7}\\right\\}$\nDirectrix: $y=\\frac{45}{28}$\nFocal Parameter: $\\frac{1}{14}$\nFocus: $\\left\\{-\\frac{5}{7},\\frac{43}{28}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2-10*x-y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{96 y}{5}+\\frac{54 z}{5}-\\frac{11}{5}=0$, $12 x+\\frac{23 y}{5}-\\frac{6 z}{5}+\\frac{26}{5}=0$, $\\frac{22 x}{5}-\\frac{18 y}{5}+\\frac{3 z}{5}+\\frac{38}{5}=0$", + "Output Answer": [ + "$x=-\\frac{33805}{38532}$, $y=\\frac{7972}{9633}$, $z=-\\frac{73261}{57798}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((96*y)/5)+((54*z)/5)-(11/5), 12*x+((23*y)/5)-((6*z)/5)+(26/5), ((22*x)/5)-((18*y)/5)+((3*z)/5)+(38/5))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=1+5 i$ and $y=-5+10 i$", + "Output Answer": [ + "$6-5 i$" + ], + "Output Program": [ + "i = 1j\nx = 1+5*i\ny = -5+10*i\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sqrt[3]{x+5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to y^3-5\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, cbrt(x+5))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 3 x+1, q(x) = (7 x-1)^3$", + "Output Answer": [ + "$343 x^3-147 x^2+24 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x+1\nq = (7*x-1)**3\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$19 x-y-1=0$, $-16 x-3 y+15=0$", + "Output Answer": [ + "$x=\\frac{18}{73}$, $y=\\frac{269}{73}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((19*x-y-1, -16*x-3*y+15), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8 x-2}+\\sqrt{14 x+\\frac{17}{2}}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{36} \\left(3655-104 \\sqrt{1147}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8*x-2)+sqrt(14*x+(17/2)), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{51 x^2}{5}+\\frac{43 x}{5}+\\frac{73}{5}\\right| =-\\frac{46}{5}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((51*x**2)/5)+((43*x)/5)+(73/5)), -(46/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{425 x^2}{4}+\\frac{823 x}{4}+\\frac{111}{2}}{-17 x^2+122 x-185}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{6}{25}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((425*x**2)/4)+((823*x)/4)+(111/2))/(-17*x**2+122*x-185)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sin (6-8 x)$ at the point $x=-9$", + "Output Answer": [ + "$\\sin (78) = 0.514$" + ], + "Output Program": [ + "import math\n\nx = -9\ntry: \n f = math.sin(6-8*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((23-22)-11)-25) \\left((14-5)^2+15\\right)$.", + "Output Answer": [ + "$-3360$" + ], + "Output Program": [ + "try: \n print((((23-22)-11)-25)*((14-5)**2+15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(\\cos \\left(\\frac{11}{9}\\right)+i \\sin \\left(\\frac{11}{9}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$9765625 \\left(\\cos \\left(\\frac{110}{9}\\right)+i \\sin \\left(\\frac{110}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(math.cos((11/9))+1j*math.sin((11/9))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{61 x^2}{7}-\\frac{52 x}{7}-\\frac{46}{7}$", + "Output Answer": [ + "$\\frac{61}{7} \\left(x-\\frac{26}{61}\\right)^2-\\frac{3482}{427}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((61*x**2)/7)-((52*x)/7)-(46/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-12 x^2-48 x+924$", + "Output Answer": [ + "$12 (7-x) (x+11)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-12*x**2-48*x+924, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 5 x-8| =21$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{13}{5}\\right\\},\\left\\{x\\to \\frac{29}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(5*x-8), 21), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(1+\\sqrt{5}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$-1048576$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(math.sqrt((5/8)-((math.sqrt(5))/8))+(1/4)*1j*(1+math.sqrt(5))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2+126 x+184$", + "Output Answer": [ + "$-9 \\left(x-\\frac{46}{3}\\right) \\left(x+\\frac{4}{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2+126*x+184, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{6}{11}$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$-\\frac{14934}{11}$" + ], + "Output Program": [ + "a = (6/11) # initial value\nd = -8 # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (6/11) # initial value\nd = -8 # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{2 x^2}{\\sqrt{3}}-\\frac{14 x}{\\sqrt{3}}+\\sqrt{3}$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(7-\\sqrt{43}\\right)\\lor x=\\frac{1}{2} \\left(7+\\sqrt{43}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((2*x**2)/(sqrt(3)))-((14*x)/(sqrt(3)))+sqrt(3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{81}{68}$, and $a_n=a_{n-1}+-7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$-\\frac{36075}{68}$" + ], + "Output Program": [ + "a = (81/68) # initial value\nd = -7 # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (81/68) # initial value\nd = -7 # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(3-15)-(((11+16)+3)-7)$.", + "Output Answer": [ + "$-35$" + ], + "Output Program": [ + "try: \n print((3-15)-(((11+16)+3)-7))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (5 x+2)^2, q(x) = \\frac{25}{9} (4-5 x)^2$", + "Output Answer": [ + "$\\frac{850 x^2}{9}-\\frac{820 x}{9}+\\frac{436}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (5*x+2)**2\nq = (25/9)*(4-5*x)**2\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\tan (8-x)$ at the point $x=-8$", + "Output Answer": [ + "$\\tan (16) = 0.301$" + ], + "Output Program": [ + "import math\n\nx = -8\ntry: \n f = math.tan(8-x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^5-x^4+9 x^3+9 x^2-x+6$ when divided by $8 x^5-x^4+x^3-4 x^2+5 x+3$.", + "Output Answer": [ + "$-\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**5-x**4+9*x**3+9*x**2-x+6\nq = 8*x**5-x**4+x**3-4*x**2+5*x+3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x^6-14 x^5+16 x^4-15 x^3-3 x^2-2 x-6$ and $2 x^4-3 x^3+5 x^2-2 x+2$.", + "Output Answer": [ + "$2 x^4-3 x^3+5 x^2-2 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x**6-14*x**5+16*x**4-15*x**3-3*x**2-2*x-6, 2*x**4-3*x**3+5*x**2-2*x+2))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x-4}+\\sqrt{\\frac{17 x}{2}+3}=\\frac{29}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{162} \\left(20773-116 \\sqrt{27766}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x-4)+sqrt(((17*x)/2)+3), (29/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{17}{50}$, and $a_n=a_{n-1}+-3 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$10 \\left(\\frac{17}{25}-57 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (17/50) # initial value\nd = -3*math.sqrt(3) # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (17/50) # initial value\nd = -3*math.sqrt(3) # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\left(252 t^2+1260 t+1577\\right)^2, x(t)=36 t^2+180 t+225$", + "Output Answer": [ + "$y=49 x^2+28 x+4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (252*t**2+1260*t+1577)**2\nx_t = 36*t**2+180*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{35}{47}$, and $a_n=a_{n-1}+\\frac{2}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$3 \\left(\\frac{70}{47}+\\frac{10}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (35/47) # initial value\nd = (2/(math.sqrt(3))) # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (35/47) # initial value\nd = (2/(math.sqrt(3))) # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=6-6 i$ and $y=-9$", + "Output Answer": [ + "$-3-6 i$" + ], + "Output Program": [ + "i = 1j\nx = 6-6*i\ny = -9\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-7+\\frac{35 i}{4}$ and $y=\\frac{33}{4}-\\frac{7 i}{4}$", + "Output Answer": [ + "$\\frac{5}{4}+7 i$" + ], + "Output Program": [ + "i = 1j\nx = -7+((35*i)/4)\ny = (33/4)-((7*i)/4)\nprint(x+y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-9 x^2-15 x+13$", + "Output Answer": [ + "$\\frac{77}{4}-9 \\left(x+\\frac{5}{6}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-9*x**2-15*x+13), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2+\\frac{380 x}{7}+\\frac{11385}{49}$", + "Output Answer": [ + "$-5 \\left(x-\\frac{99}{7}\\right) \\left(x+\\frac{23}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2+((380*x)/7)+(11385/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\sqrt{2} x^2+7 \\sqrt{2} x+3 \\sqrt{2}$", + "Output Answer": [ + "$-\\sqrt{2} \\left(x-\\frac{7}{2}\\right)^2+3 \\sqrt{2}+\\frac{49}{2 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-math.sqrt(2)*x**2+7*math.sqrt(2)*x+3*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -x^2-4 x-9$ and $q(x) = -8 x^2-2 x-9$", + "Output Answer": [ + "$8 x^4+34 x^3+89 x^2+54 x+81$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -x**2-4*x-9\nq = -8*x**2-2*x-9\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{11}{3} \\left(\\cos \\left(\\frac{7}{18}\\right)+i \\sin \\left(\\frac{7}{18}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-\\frac{1331}{27} \\left(\\cos \\left(\\frac{7}{6}\\right)+i \\sin \\left(\\frac{7}{6}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(11/3)*(math.cos((7/18))+1j*math.sin((7/18))))**3)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{3}, 4, \\frac{1}{2})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{589}}{6},\\tan ^{-1}\\left(\\frac{2 \\sqrt{145}}{3}\\right),\\tan ^{-1}(12)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/3)\ny = 4\nz = (1/2)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\sin (9 x+1)$ at the point $x=-7$", + "Output Answer": [ + "$\\sin (62) = -0.739$" + ], + "Output Program": [ + "import math\n\nx = -7\ntry: \n f = -math.sin(9*x+1)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left(\\frac{12}{3}-5\\right)-7\\right)-4\\right)+((((10+13)+13)-9)-19)$.", + "Output Answer": [ + "$-4$" + ], + "Output Program": [ + "try: \n print(((((12/3)-5)-7)-4)+((((10+13)+13)-9)-19))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{x+4}+\\tan (9 x)$ at the point $x=-2$", + "Output Answer": [ + "$\\sqrt{2}-\\tan (18) = 2.552$" + ], + "Output Program": [ + "import math\n\nx = -2\ntry: \n f = math.sqrt(x+4)+math.tan(9*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8 x+11}+\\sqrt{11 x+3}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(521-6 \\sqrt{7419}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8*x+11)+sqrt(11*x+3), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^4-3 x^3-6 x^2+3 x+8$ when divided by $-5 x$.", + "Output Answer": [ + "$-\\frac{3 x^3}{5}+\\frac{3 x^2}{5}+\\frac{6 x}{5}-\\frac{3}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**4-3*x**3-6*x**2+3*x+8\nq = -5*x\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $6 \\sqrt{3} x^2+7 \\sqrt{3} x+8 \\sqrt{3}$", + "Output Answer": [ + "$6 \\sqrt{3} \\left(x+\\frac{7}{12}\\right)^2+8 \\sqrt{3}-\\frac{49}{8 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (6*math.sqrt(3)*x**2+7*math.sqrt(3)*x+8*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{67}{95}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{42537}{95}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (67/95) # initial value\nd = 8 # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (67/95) # initial value\nd = 8 # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^4-7 x^3-4 x^2+3$ when divided by $-7 x^4-6 x^3-4 x^2-x+6$.", + "Output Answer": [ + "$\\frac{9}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**4-7*x**3-4*x**2+3\nq = -7*x**4-6*x**3-4*x**2-x+6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{2} \\left(-3 x^2+7 x+10\\right)$, $q(x) = \\sqrt{2} \\left(7 x^2-10 x+10\\right)$", + "Output Answer": [ + "$4 \\sqrt{2} x^2-3 \\sqrt{2} x+20 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(2)*(-3*x**2+7*x+10)\nq = sqrt(2)*(7*x**2-10*x+10)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{17}{4}-8 i$ and $y=\\frac{15}{2}-\\frac{27 i}{4}$", + "Output Answer": [ + "$\\frac{458}{543}-\\frac{167 i}{543}$" + ], + "Output Program": [ + "i = 1j\nx = (17/4)-8*i\ny = (15/2)-((27*i)/4)\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2-2 x+9 y^2-5 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(y-\\frac{5}{18}\\right)^2-8 \\left(x+\\frac{1}{8}\\right)^2=-\\frac{247}{72}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{72} \\left(-9-\\sqrt{4199}\\right) & \\frac{5}{18} \\\\\n \\frac{1}{72} \\left(\\sqrt{4199}-9\\right) & \\frac{5}{18} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{17}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{72} \\left(-9-\\sqrt{4199}\\right)+\\frac{1}{72} \\left(\\sqrt{4199}-9\\right)\\right),\\frac{5}{18}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2 \\sqrt{2} x}{3}+\\frac{1}{36} \\left(10+3 \\sqrt{2}\\right),y=\\frac{1}{36} \\left(10-3 \\sqrt{2}\\right)-\\frac{2 \\sqrt{2} x}{3}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2-2*x+9*y**2-5*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^5+8 x^4-x^3+2 x^2-x+5$ when divided by $-x^3+10 x^2+10 x+1$.", + "Output Answer": [ + "$6 x^2+52 x+581$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**5+8*x**4-x**3+2*x**2-x+5\nq = -x**3+10*x**2+10*x+1\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 12 (1-2 x)^2, q(x) = -\\frac{(15 x-7)^3}{3 \\sqrt{3}}$", + "Output Answer": [ + "$-375 \\sqrt{3} x^3+525 \\sqrt{3} x^2+48 x^2-245 \\sqrt{3} x-48 x+\\frac{343}{3 \\sqrt{3}}+12$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 12*(1-2*x)**2\nq = -(((15*x-7)**3)/(3*sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{17 e^{-\\frac{11 i \\pi }{180}}}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $\\frac{17}{\\sqrt{\\pi }}$\nArgument: $-\\frac{11 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((17*math.e**(-((11*i*math.pi)/180)))/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{7} \\left(-71 x^2-36 x+94\\right)$, $q(x) = \\frac{1}{7} \\left(-15 x^2-58 x+78\\right)$", + "Output Answer": [ + "$-\\frac{86 x^2}{7}-\\frac{94 x}{7}+\\frac{172}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/7)*(-71*x**2-36*x+94)\nq = (1/7)*(-15*x**2-58*x+78)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 8 x+12$, $q(x) = 4 x^2+15 x-8$", + "Output Answer": [ + "$4 x^2+23 x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x+12\nq = 4*x**2+15*x-8\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $6 \\left(\\cos \\left(\\frac{\\pi }{15}\\right)-i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)$.", + "Output Answer": [ + "Norm: $6 \\sqrt{\\sin ^2\\left(\\frac{\\pi }{15}\\right)+\\cos ^2\\left(\\frac{\\pi }{15}\\right)}$\nArgument: $-\\frac{\\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 6*(math.cos((math.pi/15))-i*math.sin((math.pi/15)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sin \\left(\\sqrt{8 x-1}\\right)$ at the point $x=6$", + "Output Answer": [ + "$\\sin \\left(\\sqrt{47}\\right) = 0.542$" + ], + "Output Program": [ + "import math\n\nx = 6\ntry: \n f = math.sin(math.sqrt(8*x-1))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{9}{2} \\left(\\cos \\left(\\frac{49}{30}\\right)+i \\sin \\left(\\frac{49}{30}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$\\frac{59049}{32} \\left(\\cos \\left(\\frac{49}{6}\\right)+i \\sin \\left(\\frac{49}{6}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((9/2)*(math.cos((49/30))+1j*math.sin((49/30))))**5)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $9 x+6$ when divided by $5$.", + "Output Answer": [ + "$\\frac{9 x}{5}+\\frac{6}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x+6\nq = 5\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\sqrt{5} \\left(5 t^2+70 t+243\\right), x(t)=5 t^2+70 t+245$", + "Output Answer": [ + "$y=\\sqrt{5} x-2 \\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = sqrt(5)*(5*t**2+70*t+243)\nx_t = 5*t**2+70*t+245\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2-x+4 y^2-7 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(y-\\frac{7}{8}\\right)^2-3 \\left(x+\\frac{1}{6}\\right)^2=\\frac{383}{48}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{6} & \\frac{7}{8}-\\frac{\\sqrt{2681}}{24} \\\\\n -\\frac{1}{6} & \\frac{1}{24} \\left(21+\\sqrt{2681}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{3}}$\nCenter: $\\left\\{-\\frac{1}{6},\\frac{1}{2} \\left(\\frac{7}{8}-\\frac{\\sqrt{2681}}{24}+\\frac{1}{24} \\left(21+\\sqrt{2681}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{24} \\left(21-2 \\sqrt{3}\\right)-\\frac{\\sqrt{3} x}{2},y=\\frac{\\sqrt{3} x}{2}+\\frac{1}{24} \\left(21+2 \\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2-x+4*y**2-7*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 11-\\frac{113 x}{5}\\right| =\\frac{62}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{113}\\right\\},\\left\\{x\\to \\frac{117}{113}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11-((113*x)/5)), (62/5)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{43}{42}$, and $a_n=a_{n-1}+7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=17$.", + "Output Answer": [ + "$\\frac{40715}{42}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (43/42) # initial value\nd = 7 # second term\nn = 17 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (43/42) # initial value\nd = 7 # second term\nn = 17 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\sqrt{2} \\left(-\\cos \\left(\\frac{7 \\pi }{30}\\right)+i \\sin \\left(\\frac{7 \\pi }{30}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$32768 \\left(\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*math.sqrt(2)*(-math.cos(((7*math.pi)/30))+1j*math.sin(((7*math.pi)/30))))**10)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $8 \\sqrt{2} x^2-\\sqrt{2} x-3 \\sqrt{2}$", + "Output Answer": [ + "$8 \\sqrt{2} \\left(x-\\frac{1}{16}\\right)^2-3 \\sqrt{2}-\\frac{1}{16 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (8*math.sqrt(2)*x**2-math.sqrt(2)*x-3*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((16-10)+23) \\left(\\left(\\frac{24+23}{3}+19\\right)+17\\right)$.", + "Output Answer": [ + "$\\frac{4495}{3}$" + ], + "Output Program": [ + "try: \n print(((16-10)+23)*((((24+23)/3)+19)+17))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=81 t^2+63 \\left(27+\\sqrt{2}\\right) t+\\frac{49}{4} \\left(731+54 \\sqrt{2}\\right), x(t)=-\\sqrt{2} t-\\frac{21}{\\sqrt{2}}$", + "Output Answer": [ + "$y=\\frac{81 x^2}{2}-63 x+\\frac{49}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 81*t**2+63*(27+sqrt(2))*t+(49/4)*(731+54*sqrt(2))\nx_t = -sqrt(2)*t-(21/(sqrt(2)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-x^5-x^4-7 x^3-5 x^2-5 x+9$ when divided by $-9 x^3+6 x^2+8 x-6$.", + "Output Answer": [ + "$\\frac{x^2}{9}+\\frac{5 x}{27}+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**5-x**4-7*x**3-5*x**2-5*x+9\nq = -9*x**3+6*x**2+8*x-6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{13 i}{\\sqrt{2}}$ and $y=\\frac{5-4 i}{\\sqrt{2}}$", + "Output Answer": [ + "$-\\frac{5-17 i}{\\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((13*i)/(math.sqrt(2)))\ny = ((5-4*i)/(math.sqrt(2)))\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{15-13 i}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $\\sqrt{\\frac{394}{\\pi }}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{13}{15}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((15-13*i)/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\sqrt{2} \\left(\\frac{1}{4} \\left(-1-\\sqrt{5}\\right)-i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)\\right)^8$", + "Output Answer": [ + "$1048576 \\left(\\frac{1}{4} \\left(\\sqrt{5}-1\\right)-i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*math.sqrt(2)*((1/4)*(-1-math.sqrt(5))-1j*math.sqrt((5/8)-((math.sqrt(5))/8))))**8)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=32 (t+4), x(t)=-4 t-15$", + "Output Answer": [ + "$y=8-8 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 32*(t+4)\nx_t = -4*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 6 x+19| =15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{17}{3}\\right\\},\\left\\{x\\to -\\frac{2}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(6*x+19), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{29 \\left(\\cos \\left(\\frac{11 \\pi }{45}\\right)+i \\sin \\left(\\frac{11 \\pi }{45}\\right)\\right)}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{29 \\sqrt{\\sin ^2\\left(\\frac{11 \\pi }{45}\\right)+\\cos ^2\\left(\\frac{11 \\pi }{45}\\right)}}{\\pi }$\nArgument: $\\frac{11 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((29*(math.cos(((11*math.pi)/45))+i*math.sin(((11*math.pi)/45))))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9-2 x}+2 \\sqrt{-x}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-597+28 \\sqrt{410}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9-2*x)+2*sqrt(-x), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{625} (1806 t+3175)^2, x(t)=-\\frac{42 t}{5}-15$", + "Output Answer": [ + "$y=\\frac{1849 x^2}{25}+\\frac{172 x}{5}+4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/625)*(1806*t+3175)**2\nx_t = -((42*t)/5)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3-5 x$ and $4 x^4-2 x^2+3 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3-5*x, 4*x**4-2*x**2+3*x-1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2+164 x-\\frac{781}{2}$", + "Output Answer": [ + "$8 \\left(\\frac{71}{4}-x\\right) \\left(x-\\frac{11}{4}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2+164*x-(781/2), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=2 \\left(t^2-30 t+227\\right), x(t)=t^2-30 t+225$", + "Output Answer": [ + "$y=2 x+4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 2*(t**2-30*t+227)\nx_t = t**2-30*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{7 x}{\\sqrt{3}}-\\frac{16}{\\sqrt{3}}\\right| =\\frac{8}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{8}{7}\\right\\},\\left\\{x\\to \\frac{24}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((7*x)/(sqrt(3)))-(16/(sqrt(3)))), (8/(sqrt(3)))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-2 x-22 y+11=0$, $11 x+2 y+8=0$", + "Output Answer": [ + "$x=-\\frac{99}{119}$, $y=\\frac{137}{238}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-2*x-22*y+11, 11*x+2*y+8), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-1-4 i) \\sqrt{3}$ and $y=(-1-2 i) \\sqrt{3}$", + "Output Answer": [ + "$-2 i \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-1-4*i)*math.sqrt(3)\ny = (-1-2*i)*math.sqrt(3)\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-120 x^2-572 x-504}{384 x^2+520 x+84}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{18}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-120*x**2-572*x-504)/(384*x**2+520*x+84)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$10 x+14 y-17 z-6=0$, $-18 x-21 y-16 z-21=0$, $-10 x-12 y+15 z-2=0$", + "Output Answer": [ + "$x=-\\frac{2165}{424}$, $y=\\frac{773}{212}$, $z=-\\frac{75}{212}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((10*x+14*y-17*z-6, -18*x-21*y-16*z-21, -10*x-12*y+15*z-2)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $10 x^2+x+4$ when divided by $-6 x-6$.", + "Output Answer": [ + "$\\frac{3}{2}-\\frac{5 x}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x**2+x+4\nq = -6*x-6\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-3 x^2-x+1$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(-1-\\sqrt{13}\\right)\\lor x=\\frac{1}{6} \\left(\\sqrt{13}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-3*x**2-x+1, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{17}{12}$, and $a_n=a_{n-1}+\\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$4 \\left(\\frac{17}{6}+7 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\na = (17/12) # initial value\nd = math.sqrt(5) # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (17/12) # initial value\nd = math.sqrt(5) # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{5 \\sqrt{3} x^2-14 \\sqrt{3} x-5 \\sqrt{3}}{-14 \\sqrt{3} x-\\sqrt{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(7-\\sqrt{74}\\right)\\right\\},\\left\\{x\\to \\frac{1}{5} \\left(7+\\sqrt{74}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((5*sqrt(3)*x**2-14*sqrt(3)*x-5*sqrt(3))/(-14*sqrt(3)*x-sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8-14 x}+\\sqrt{3-7 x}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(-583+28 \\sqrt{390}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8-14*x)+sqrt(3-7*x), 14), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{32}{17}$, and $a_n=a_{n-1}+-\\frac{8}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$-\\frac{58000}{51}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(32/17) # initial value\nd = -(8/3) # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(32/17) # initial value\nd = -(8/3) # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\cosh \\left(\\frac{x}{3}+5\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$-3 \\cosh ^{-1}(y)-15\\text{ if }y\\geq 1$}\\right\\},\\left\\{x\\to \\fbox{$3 \\cosh ^{-1}(y)-15\\text{ if }y\\geq 1$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, cosh((x/3)+5))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{10+9 i}{\\sqrt{3}}$ and $y=\\frac{16+2 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{142}{3}-\\frac{164 i}{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((10+9*i)/(math.sqrt(3)))\ny = ((16+2*i)/(math.sqrt(3)))\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{27 x^2}{5}+\\frac{73 x}{5}-8$", + "Output Answer": [ + "$x=\\frac{1}{54} \\left(73-\\sqrt{1009}\\right)\\lor x=\\frac{1}{54} \\left(73+\\sqrt{1009}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((27*x**2)/5)+((73*x)/5)-8, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{1}{3} \\left(-\\cos \\left(\\frac{1}{5}\\right)-i \\sin \\left(\\frac{1}{5}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$\\frac{1}{729} \\left(\\cos \\left(\\frac{6}{5}\\right)+i \\sin \\left(\\frac{6}{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((1/3)*(-math.cos((1/5))-1j*math.sin((1/5))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -6 x^2+7 x-7$ and $q(x) = 12 x^2-4 x-2$", + "Output Answer": [ + "$-72 x^4+108 x^3-100 x^2+14 x+14$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -6*x**2+7*x-7\nq = 12*x**2-4*x-2\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x-\\frac{27}{2}}+\\sqrt{10 x+\\frac{23}{2}}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(122-7 \\sqrt{238}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x-(27/2))+sqrt(10*x+(23/2)), 7), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 x^2+x-1$", + "Output Answer": [ + "$-3 \\left(x-\\frac{1}{6}\\right)^2-\\frac{11}{12}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*x**2+x-1), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 9-21 x| =17$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{8}{21}\\right\\},\\left\\{x\\to \\frac{26}{21}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(9-21*x), 17), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{22+5}{17}-\\left(\\frac{22}{25}-8\\right)$.", + "Output Answer": [ + "$\\frac{3701}{425}$" + ], + "Output Program": [ + "try: \n print(((22+5)/17)-((22/25)-8))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^2+3$ when divided by $3 x+8$.", + "Output Answer": [ + "$\\frac{5 x}{3}-\\frac{40}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**2+3\nq = 3*x+8\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-4 x^2+20 \\sqrt{5} x+720$", + "Output Answer": [ + "$-4 \\left(x-9 \\sqrt{5}\\right) \\left(x+4 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-4*x**2+20*sqrt(5)*x+720, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\cos \\left(\\frac{17}{9}\\right)+i \\sin \\left(\\frac{17}{9}\\right)\\right)^6$", + "Output Answer": [ + "$\\cos \\left(\\frac{34}{3}\\right)+i \\sin \\left(\\frac{34}{3}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.cos((17/9))+1j*math.sin((17/9)))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{58 x}{3}-\\frac{11 y}{3}+\\frac{32 z}{3}=0$, $24 x-\\frac{29 y}{3}-5 z+\\frac{7}{3}=0$, $-\\frac{7 x}{3}-\\frac{19 y}{3}+\\frac{19 z}{3}+\\frac{64}{3}=0$", + "Output Answer": [ + "$x=\\frac{67159}{84867}$, $y=\\frac{70806}{28289}$, $z=-\\frac{48707}{84867}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((58*x)/3)-((11*y)/3)+((32*z)/3), 24*x-((29*y)/3)-5*z+(7/3), -((7*x)/3)-((19*y)/3)+((19*z)/3)+(64/3))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{15 x}{7}-\\frac{75}{7}\\right| =\\frac{107}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{182}{15}\\right\\},\\left\\{x\\to \\frac{32}{15}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((15*x)/7)-(75/7)), (107/7)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-9-4 i$ and $y=-9+i$", + "Output Answer": [ + "$-5 i$" + ], + "Output Program": [ + "i = 1j\nx = -9-4*i\ny = -9+i\nprint(x-y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 22 x^2-14 x-11\\right| =-22$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(22*x**2-14*x-11), -22), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x+1}+\\sqrt{6 x-5}=3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{2} \\left(17-2 \\sqrt{67}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x+1)+sqrt(6*x-5), 3), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\cos (6 x+4)$ at the point $x=-4$", + "Output Answer": [ + "$\\cos (20) = 0.408$" + ], + "Output Program": [ + "import math\n\nx = -4\ntry: \n f = math.cos(6*x+4)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(11-18)^2+((12-17)+25)$.", + "Output Answer": [ + "$69$" + ], + "Output Program": [ + "try: \n print((11-18)**2+((12-17)+25))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $x^2-2 x-7 y^2-3 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $(x-1)^2-7 \\left(y+\\frac{3}{14}\\right)^2=-\\frac{149}{28}$\nFoci: $\\left(\n\\begin{array}{cc}\n 1 & \\frac{1}{14} \\left(-3-2 \\sqrt{298}\\right) \\\\\n 1 & \\frac{1}{14} \\left(2 \\sqrt{298}-3\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{2}$\nCenter: $\\left\\{1,\\frac{1}{2} \\left(\\frac{1}{14} \\left(-3-2 \\sqrt{298}\\right)+\\frac{1}{14} \\left(2 \\sqrt{298}-3\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{14} \\left(2 \\sqrt{7}-3\\right)-\\frac{x}{\\sqrt{7}},y=\\frac{x}{\\sqrt{7}}-\\frac{1}{\\sqrt{7}}-\\frac{3}{14}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-2*x-7*y**2-3*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x-9}+\\sqrt{14 x-9}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5}{4} \\left(20-\\sqrt{139}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x-9)+sqrt(14*x-9), 15), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-3 x^2-3 x+3$ when divided by $-\\frac{17 x^3}{2}+\\frac{9 x^2}{2}-x-\\frac{3}{2}$.", + "Output Answer": [ + "$0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x**2-3*x+3\nq = -((17*x**3)/2)+((9*x**2)/2)-x-(3/2)\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 10 x^2-4 x-3\\right| =23$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(1-\\sqrt{66}\\right)\\right\\},\\left\\{x\\to \\frac{1}{5} \\left(1+\\sqrt{66}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(10*x**2-4*x-3), 23), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-6 \\sqrt{3} x^2+8 \\sqrt{3} x-8 \\sqrt{3}}{\\sqrt{3} x^2+10 \\sqrt{3} x+5 \\sqrt{3}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-6*sqrt(3)*x**2+8*sqrt(3)*x-8*sqrt(3))/(sqrt(3)*x**2+10*sqrt(3)*x+5*sqrt(3))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2$ and $-x^4-5 x^3+2 x^2-4 x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2, -x**4-5*x**3+2*x**2-4*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{26}{3} \\left(\\cos \\left(\\frac{\\pi }{90}\\right)+i \\sin \\left(\\frac{\\pi }{90}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$\\frac{95428956661682176 \\left(\\cos \\left(\\frac{2 \\pi }{15}\\right)+i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)}{531441}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(26/3)*(math.cos((math.pi/90))+1j*math.sin((math.pi/90))))**12)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\tan (8 x+2)$ at the point $x=9$", + "Output Answer": [ + "$-\\tan (74) = 5.737$" + ], + "Output Program": [ + "import math\n\nx = 9\ntry: \n f = -math.tan(8*x+2)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\cos (3 x+7)$ at the point $x=7$", + "Output Answer": [ + "$\\cos (28) = -0.963$" + ], + "Output Program": [ + "import math\n\nx = 7\ntry: \n f = math.cos(3*x+7)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $4 x^2+\\frac{20 x}{3}+\\frac{14}{3}$", + "Output Answer": [ + "$4 \\left(x+\\frac{5}{6}\\right)^2+\\frac{17}{9}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (4*x**2+((20*x)/3)+(14/3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 6 \\sqrt{3} x^2+7 \\sqrt{3} x+\\frac{2}{\\sqrt{3}}$ and $q(x) = -3 \\sqrt{3} x^2+8 \\sqrt{3} x-\\frac{11}{\\sqrt{3}}$", + "Output Answer": [ + "$-54 x^4+81 x^3+96 x^2-61 x-\\frac{22}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 6*sqrt(3)*x**2+7*sqrt(3)*x+(2/(sqrt(3)))\nq = -3*sqrt(3)*x**2+8*sqrt(3)*x-(11/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sin (6-4 x)-e^{1-8 x}$ at the point $x=8$", + "Output Answer": [ + "$-\\frac{1}{e^{63}}-\\sin (26) = -0.763$" + ], + "Output Program": [ + "import math\n\nx = 8\ntry: \n f = math.sin(6-4*x)-math.e**(1-8*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $3 x^2-102 x+864$", + "Output Answer": [ + "$3 (16-x) (18-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(3*x**2-102*x+864, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{(((21-19)-20)-6)+4}{\\frac{1}{10} ((13+21)+9)+22}$.", + "Output Answer": [ + "$-\\frac{200}{263}$" + ], + "Output Program": [ + "try: \n print((((((21-19)-20)-6)+4)/((1/10)*((13+21)+9)+22)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -x^2-7 x-\\frac{40}{3}$ and $q(x) = \\frac{5 x^2}{3}+\\frac{19 x}{3}+13$", + "Output Answer": [ + "$-\\frac{5 x^4}{3}-18 x^3-\\frac{716 x^2}{9}-\\frac{1579 x}{9}-\\frac{520}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -x**2-7*x-(40/3)\nq = ((5*x**2)/3)+((19*x)/3)+13\nprint((p * q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $((((4-10)-12)+12)-14) \\left(\\left(\\frac{5}{21}+13\\right)+7\\right)$.", + "Output Answer": [ + "$-\\frac{8500}{21}$" + ], + "Output Program": [ + "try: \n print(((((4-10)-12)+12)-14)*(((5/21)+13)+7))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2-8 x+y^2-8 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $(y-4)^2-6 \\left(x+\\frac{2}{3}\\right)^2=\\frac{16}{3}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{3} & 4-\\frac{2 \\sqrt{14}}{3} \\\\\n -\\frac{2}{3} & \\frac{2}{3} \\left(6+\\sqrt{14}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{6}}$\nCenter: $\\left\\{-\\frac{2}{3},\\frac{1}{2} \\left(4-\\frac{2 \\sqrt{14}}{3}+\\frac{2}{3} \\left(6+\\sqrt{14}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\sqrt{6} x-\\frac{2}{3} \\left(\\sqrt{6}-6\\right),y=\\sqrt{6} x+\\frac{2}{3} \\left(6+\\sqrt{6}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2-8*x+y**2-8*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-6 x-9}+\\sqrt{-2 x-8}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-163+9 \\sqrt{213}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-6*x-9)+sqrt(-2*x-8), 9), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| -19 x-6| =\\frac{44}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{62}{57}\\right\\},\\left\\{x\\to \\frac{26}{57}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-19*x-6), (44/3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=99-56 t, x(t)=8 t-15$", + "Output Answer": [ + "$y=-7 x-6$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 99-56*t\nx_t = 8*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{17 e^{\\frac{61 i \\pi }{90}}}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $\\frac{17}{\\sqrt{\\pi }}$\nArgument: $\\frac{61 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((17*math.e**((61*i*math.pi)/90))/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^6+4 x^5-x^4+4 x^3-x^2-6 x-4$ when divided by $3 x+3$.", + "Output Answer": [ + "$-\\frac{4 x^5}{3}+\\frac{8 x^4}{3}-3 x^3+\\frac{13 x^2}{3}-\\frac{14 x}{3}+\\frac{8}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**6+4*x**5-x**4+4*x**3-x**2-6*x-4\nq = 3*x+3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{36}{25} (6 x+5)^2, q(x) = -\\frac{32 x}{5}-1$", + "Output Answer": [ + "$\\frac{1296 x^2}{25}+80 x+35$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (36/25)*(6*x+5)**2\nq = -((32*x)/5)-1\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (2-5 x)^4, q(x) = (1-7 x)^4$", + "Output Answer": [ + "$3026 x^4-2372 x^3+894 x^2-188 x+17$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (2-5*x)**4\nq = (1-7*x)**4\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-8 x^2-22 x+14}{-5 x^2-3 x-17}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(-11-\\sqrt{233}\\right)\\right\\},\\left\\{x\\to \\frac{1}{8} \\left(-11+\\sqrt{233}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-8*x**2-22*x+14)/(-5*x**2-3*x-17)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(1-3 i) \\pi$ and $y=(2-3 i) \\pi$", + "Output Answer": [ + "$(-7-9 i) \\pi ^2$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (1-3*i)*math.pi\ny = (2-3*i)*math.pi\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $15 x^2+3 x-14$", + "Output Answer": [ + "$x=\\frac{1}{30} \\left(-3-\\sqrt{849}\\right)\\lor x=\\frac{1}{30} \\left(\\sqrt{849}-3\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(15*x**2+3*x-14, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\sqrt{5} x^2-4 \\sqrt{5} x+6 \\sqrt{5}}{9 \\sqrt{5} x-3 \\sqrt{5}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((sqrt(5)*x**2-4*sqrt(5)*x+6*sqrt(5))/(9*sqrt(5)*x-3*sqrt(5))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x+10}+\\sqrt{8 x+3}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(313-11 \\sqrt{595}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x+10)+sqrt(8*x+3), 11), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$16 x-7 y+10 z+10=0$, $x+3 y-14 z+18=0$, $-14 x+23 y-8 z+12=0$", + "Output Answer": [ + "$x=-\\frac{3464}{1995}$, $y=-\\frac{844}{665}$, $z=\\frac{355}{399}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((16*x-7*y+10*z+10, x+3*y-14*z+18, -14*x+23*y-8*z+12)), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(66-5 t)^2, x(t)=t-15$", + "Output Answer": [ + "$y=25 x^2+90 x+81$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (66-5*t)**2\nx_t = t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-4 \\sqrt{2} x-7 \\sqrt{2} y+11 \\sqrt{2} z-16 \\sqrt{2}=0$, $8 \\sqrt{2} x-12 \\sqrt{2} y-15 \\sqrt{2} z+13 \\sqrt{2}=0$, $-15 \\sqrt{2} x-15 \\sqrt{2} y-14 \\sqrt{2} z+9 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{374}{5431}$, $y=-\\frac{2267}{5431}$, $z=\\frac{6321}{5431}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-4*sqrt(2)*x-7*sqrt(2)*y+11*sqrt(2)*z-16*sqrt(2), 8*sqrt(2)*x-12*sqrt(2)*y-15*sqrt(2)*z+13*sqrt(2), -15*sqrt(2)*x-15*sqrt(2)*y-14*sqrt(2)*z+9*sqrt(2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the first order series of the inverse of the following function around 1:\n$\\log \\left(\\frac{2 x}{5}\\right)$", + "Output Answer": [ + "$3 (x+\\log (5)-\\log (3)-\\log (2))+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, log(((2*x)/5)))\nprint(solve(f, x)[0].series(y, 1, 1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sqrt{x+5} \\sin (\\cosh (2))$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\csc ^2(\\cosh (2)) \\left(y^2-5 \\sin ^2(\\cosh (2))\\right)\\text{ if }y<0$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, sqrt(x+5)*sin(cosh(2)))\nprint(solve(f, x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-22 x-2 y-12=0$, $22 x-y-11=0$", + "Output Answer": [ + "$x=\\frac{5}{33}$, $y=-\\frac{23}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-22*x-2*y-12, 22*x-y-11), (x, y)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{17 x^2}{2}-\\frac{5 x}{4}-\\frac{53}{4}$", + "Output Answer": [ + "$x=\\frac{1}{68} \\left(5-\\sqrt{7233}\\right)\\lor x=\\frac{1}{68} \\left(5+\\sqrt{7233}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((17*x**2)/2)-((5*x)/4)-(53/4), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+3 x-5 y^2+2 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x+\\frac{3}{14}\\right)^2-5 \\left(y-\\frac{1}{5}\\right)^2=-\\frac{403}{140}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{14} & \\frac{1}{35} \\left(7-\\sqrt{1209}\\right) \\\\\n -\\frac{3}{14} & \\frac{1}{35} \\left(7+\\sqrt{1209}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{3}{7}}$\nCenter: $\\left\\{-\\frac{3}{14},\\frac{1}{2} \\left(\\frac{1}{35} \\left(7-\\sqrt{1209}\\right)+\\frac{1}{35} \\left(7+\\sqrt{1209}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{70} \\left(14-3 \\sqrt{35}\\right)-\\sqrt{\\frac{7}{5}} x,y=\\sqrt{\\frac{7}{5}} x+\\frac{1}{70} \\left(14+3 \\sqrt{35}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+3*x-5*y**2+2*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{3} \\left(6 x^2-31 x-19\\right)$, $q(x) = -6 x^2-\\frac{17 x}{3}+\\frac{19}{3}$", + "Output Answer": [ + "$-4 x^2-16 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/3)*(6*x**2-31*x-19)\nq = -6*x**2-((17*x)/3)+(19/3)\nprint((p + q).expand())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{16+16 i}{\\sqrt{\\pi }}$ and $y=-\\frac{11+16 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{432}{377}+\\frac{80 i}{377}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((16+16*i)/(math.sqrt(math.pi)))\ny = -((11+16*i)/(math.sqrt(math.pi)))\nprint((x/y))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-3 \\left(2 t+\\sqrt{2}-22\\right), x(t)=\\sqrt{2} t-11 \\sqrt{2}$", + "Output Answer": [ + "$y=-3 \\sqrt{2} x-3 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -3*(2*t+sqrt(2)-22)\nx_t = sqrt(2)*t-11*sqrt(2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+7 x-7 y^2-2 y+7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x+\\frac{7}{18}\\right)^2-7 \\left(y+\\frac{1}{7}\\right)^2=-\\frac{1457}{252}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{7}{18} & \\frac{1}{63} \\left(-9-2 \\sqrt{1457}\\right) \\\\\n -\\frac{7}{18} & \\frac{1}{63} \\left(2 \\sqrt{1457}-9\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{4}{3}$\nCenter: $\\left\\{-\\frac{7}{18},\\frac{1}{2} \\left(\\frac{1}{63} \\left(-9-2 \\sqrt{1457}\\right)+\\frac{1}{63} \\left(2 \\sqrt{1457}-9\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{42} \\left(-6-7 \\sqrt{7}\\right)-\\frac{3 x}{\\sqrt{7}},y=\\frac{3 x}{\\sqrt{7}}+\\frac{1}{42} \\left(7 \\sqrt{7}-6\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+7*x-7*y**2-2*y+7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-7-i$ and $y=4+\\frac{11 i}{2}$", + "Output Answer": [ + "$-\\frac{45}{2}-\\frac{85 i}{2}$" + ], + "Output Program": [ + "i = 1j\nx = -7-i\ny = 4+((11*i)/2)\nprint(x*y)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{60-240 x^2}{420 x^2+480 x+135}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((60-240*x**2)/(420*x**2+480*x+135)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $11 x^2+9 x+2$", + "Output Answer": [ + "$11 \\left(x+\\frac{9}{22}\\right)^2+\\frac{7}{44}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (11*x**2+9*x+2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9 x-10}+\\sqrt{13 x+1}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(1837-13 \\sqrt{19217}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9*x-10)+sqrt(13*x+1), 13), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{1}{19} (((3-16)-8)+3)^2}{((17+25)+5)-15}$.", + "Output Answer": [ + "$\\frac{81}{152}$" + ], + "Output Program": [ + "try: \n print((((1/19)*(((3-16)-8)+3)**2)/(((17+25)+5)-15)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $(((2+19)+16)-17) (2+5)^2$.", + "Output Answer": [ + "$980$" + ], + "Output Program": [ + "try: \n print((((2+19)+16)-17)*(2+5)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -12 \\sqrt{2} x-11 \\sqrt{2}\\right| =4 \\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{4}\\right\\},\\left\\{x\\to -\\frac{7}{12}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-12*sqrt(2)*x-11*sqrt(2)), 4*sqrt(2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-6 x^3-\\frac{9 x^2}{2}+\\frac{3}{2}$ and $2 x^3+\\frac{3 x^2}{2}-\\frac{1}{2}$.", + "Output Answer": [ + "$2 x^3+\\frac{3 x^2}{2}-\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-6*x**3-((9*x**2)/2)+(3/2), 2*x**3+((3*x**2)/2)-(1/2)))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{60 x^2-\\frac{515 x}{2}-\\frac{185}{2}}{-120 x-40}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{37}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((60*x**2-((515*x)/2)-(185/2))/(-120*x-40)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{67}{7} \\left(\\cos \\left(\\frac{2 \\pi }{45}\\right)+i \\sin \\left(\\frac{2 \\pi }{45}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{67}{7} \\sqrt{\\sin ^2\\left(\\frac{2 \\pi }{45}\\right)+\\cos ^2\\left(\\frac{2 \\pi }{45}\\right)}$\nArgument: $\\frac{2 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (67/7)*(math.cos(((2*math.pi)/45))+i*math.sin(((2*math.pi)/45)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $x^6+6 x^5-9 x^4-5 x^3+6 x^2-4 x-9$ when divided by $8 x^4-2 x^3-7 x^2+7 x-3$.", + "Output Answer": [ + "$\\frac{x^2}{8}+\\frac{25 x}{32}-\\frac{105}{128}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**6+6*x**5-9*x**4-5*x**3+6*x**2-4*x-9\nq = 8*x**4-2*x**3-7*x**2+7*x-3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2-52 x-272$", + "Output Answer": [ + "$-4 (-x-4) (x-17)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2-52*x-272, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify $\\frac{1-10}{(20-22)+7}$.", + "Output Answer": [ + "$-\\frac{9}{5}$" + ], + "Output Program": [ + "try: \n print(((1-10)/((20-22)+7)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $2 \\sqrt{3} | x| =3 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{2}\\right\\},\\left\\{x\\to \\frac{3}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(2*sqrt(3)*abs(x), 3*sqrt(3)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-20 x^4+8 x^3+16 x^2-8 x$ and $5 x^4-2 x^3-4 x^2+2 x$.", + "Output Answer": [ + "$5 x^4-2 x^3-4 x^2+2 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-20*x**4+8*x**3+16*x**2-8*x, 5*x**4-2*x**3-4*x**2+2*x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $| 2 x-12| =22$", + "Output Answer": [ + "$\\{\\{x\\to -5\\},\\{x\\to 17\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(2*x-12), 22), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-9 \\left(\\cos \\left(\\frac{11 \\pi }{45}\\right)-i \\sin \\left(\\frac{11 \\pi }{45}\\right)\\right)$.", + "Output Answer": [ + "Norm: $9 \\sqrt{\\sin ^2\\left(\\frac{11 \\pi }{45}\\right)+\\cos ^2\\left(\\frac{11 \\pi }{45}\\right)}$\nArgument: $\\frac{34 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -9*(math.cos(((11*math.pi)/45))-i*math.sin(((11*math.pi)/45)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^3+6 x^2+6 x-2$ when divided by $7 x-3$.", + "Output Answer": [ + "$-x^2+\\frac{3 x}{7}+\\frac{51}{49}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**3+6*x**2+6*x-2\nq = 7*x-3\nprint((p / q).simplify())\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-12 x^2-9 x-3$ and $4 x^2+3 x+1$.", + "Output Answer": [ + "$4 x^2+3 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-12*x**2-9*x-3, 4*x**2+3*x+1))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10 x-14}+\\sqrt{12 x+\\frac{21}{2}}=\\frac{15}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(2377-60 \\sqrt{1551}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10*x-14)+sqrt(12*x+(21/2)), (15/2)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-12 x^2+24 x+17}{-9 x^2+19 x+14}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(6-\\sqrt{87}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(6+\\sqrt{87}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-12*x**2+24*x+17)/(-9*x**2+19*x+14)), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{13 x}{\\sqrt{2}}+\\frac{5 y}{\\sqrt{2}}+\\frac{5 z}{\\sqrt{2}}-9 \\sqrt{2}=0$, $-15 \\sqrt{2} x+\\frac{21 y}{\\sqrt{2}}-10 \\sqrt{2} z+\\frac{31}{\\sqrt{2}}=0$, $14 \\sqrt{2} x+\\frac{27 y}{\\sqrt{2}}-\\frac{7 z}{\\sqrt{2}}+8 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{124}{389}$, $y=\\frac{141}{389}$, $z=\\frac{937}{389}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((13*x)/(sqrt(2)))+((5*y)/(sqrt(2)))+((5*z)/(sqrt(2)))-9*sqrt(2), -15*sqrt(2)*x+((21*y)/(sqrt(2)))-10*sqrt(2)*z+(31/(sqrt(2))), 14*sqrt(2)*x+((27*y)/(sqrt(2)))-((7*z)/(sqrt(2)))+8*sqrt(2))), (x, y, z))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(-\\cos \\left(\\frac{19 \\pi }{90}\\right)-i \\sin \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$117649 \\left(-\\sin \\left(\\frac{7 \\pi }{30}\\right)-i \\cos \\left(\\frac{7 \\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(-math.cos(((19*math.pi)/90))-1j*math.sin(((19*math.pi)/90))))**6)\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{117 x^2}{7}+\\frac{3 x}{7}+\\frac{172}{7}}{-\\frac{136 x^2}{7}+\\frac{124 x}{7}-\\frac{174}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{78} \\left(1-\\sqrt{8945}\\right)\\right\\},\\left\\{x\\to \\frac{1}{78} \\left(1+\\sqrt{8945}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((117*x**2)/7)+((3*x)/7)+(172/7))/(-((136*x**2)/7)+((124*x)/7)-(174/7))), x))\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2+x-7 y^2+5 y+7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(x+\\frac{1}{4}\\right)^2-7 \\left(y-\\frac{5}{14}\\right)^2=-\\frac{435}{56}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{4} & \\frac{1}{28} \\left(10-3 \\sqrt{435}\\right) \\\\\n -\\frac{1}{4} & \\frac{1}{28} \\left(10+3 \\sqrt{435}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{2}}$\nCenter: $\\left\\{-\\frac{1}{4},\\frac{1}{2} \\left(\\frac{1}{28} \\left(10-3 \\sqrt{435}\\right)+\\frac{1}{28} \\left(10+3 \\sqrt{435}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{28} \\left(10-\\sqrt{14}\\right)-\\sqrt{\\frac{2}{7}} x,y=\\sqrt{\\frac{2}{7}} x+\\frac{1}{28} \\left(10+\\sqrt{14}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2+x-7*y**2+5*y+7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "train" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$10 x+5 y+10 z-13=0$, $-9 x-14 y-23=0$, $17 x+15 y+17 z+14=0$", + "Output Answer": [ + "$x=\\frac{3559}{585}$, $y=-\\frac{361}{65}$, $z=-\\frac{1174}{585}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((10*x+5*y+10*z-13, -9*x-14*y-23, 17*x+15*y+17*z+14)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{e^{-\\frac{7 i \\pi }{12}}}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\frac{1}{\\sqrt{3}}$\nArgument: $\\tan ^{-1}\\left(\\frac{\\Im\\left(e^{-\\frac{7 i \\pi }{12}}\\right)}{\\Re\\left(e^{-\\frac{7 i \\pi }{12}}\\right)}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((math.e**(-((7*i*math.pi)/12)))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{41 x}{5}-\\frac{104 y}{5}-\\frac{48 z}{5}-\\frac{28}{5}=0$, $\\frac{117 x}{5}-\\frac{34 y}{5}-\\frac{32 z}{5}-5=0$, $\\frac{68 x}{5}-\\frac{69 y}{5}+\\frac{102 z}{5}+\\frac{71}{5}=0$", + "Output Answer": [ + "$x=\\frac{17164}{377813}$, $y=\\frac{48327}{755626}$, $z=-\\frac{1032337}{1511252}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((41*x)/5)-((104*y)/5)-((48*z)/5)-(28/5), ((117*x)/5)-((34*y)/5)-((32*z)/5)-5, ((68*x)/5)-((69*y)/5)+((102*z)/5)+(71/5))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{4 x^2-19 x-21}{19 x+12}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(19-\\sqrt{697}\\right)\\right\\},\\left\\{x\\to \\frac{1}{8} \\left(19+\\sqrt{697}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((4*x**2-19*x-21)/(19*x+12)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{22+i}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{485}}{\\pi }$\nArgument: $\\tan ^{-1}\\left(\\frac{1}{22}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((22+i)/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{182 x^2}{9}-\\frac{91 x}{9}-\\frac{26}{9}$ and $-\\frac{13}{3}$.", + "Output Answer": [ + "$\\frac{13}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((182*x**2)/9)-((91*x)/9)-(26/9), -(13/3)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\sqrt{3} x^2+9 \\sqrt{3} x+\\frac{7}{\\sqrt{3}}}{-\\frac{7 x^2}{\\sqrt{3}}-14 \\sqrt{3} x+\\frac{37}{\\sqrt{3}}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(-27-\\sqrt{645}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(-27+\\sqrt{645}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((sqrt(3)*x**2+9*sqrt(3)*x+(7/(sqrt(3))))/(-((7*x**2)/(sqrt(3)))-14*sqrt(3)*x+(37/(sqrt(3))))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{256} (1-24 x)^4, q(x) = \\frac{1}{64} (33 x+35)^3$", + "Output Answer": [ + "$1296 x^4+\\frac{22113 x^3}{64}+\\frac{115209 x^2}{64}+\\frac{121251 x}{64}+\\frac{171501}{256}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/256)*(1-24*x)**4\nq = (1/64)*(33*x+35)**3\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{3}{2}$, and $a_n=a_{n-1}+2 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{27}{2} \\left(3+52 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (3/2) # initial value\nd = 2*math.sqrt(3) # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (3/2) # initial value\nd = 2*math.sqrt(3) # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $4 x^2-10 x-1$", + "Output Answer": [ + "$4 \\left(x-\\frac{5}{4}\\right)^2-\\frac{29}{4}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (4*x**2-10*x-1), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-x+9 y^2-7 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x-\\frac{1}{8}\\right)^2+9 \\left(y-\\frac{7}{18}\\right)^2=\\frac{1069}{144}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{72} \\left(9-\\sqrt{5345}\\right) & \\frac{7}{18} \\\\\n \\frac{1}{72} \\left(9+\\sqrt{5345}\\right) & \\frac{7}{18} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{72} \\left(9-\\sqrt{5345}\\right)+\\frac{1}{72} \\left(9+\\sqrt{5345}\\right)\\right),\\frac{7}{18}\\right\\}$\nArea Enclosed: $\\frac{1069 \\pi }{864}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-x+9*y**2-7*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^5+4 x^4+6 x^3-3 x^2-6 x+10$ when divided by $-3 x^5+10 x^4+5 x^3+7 x^2-3 x-9$.", + "Output Answer": [ + "$-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**5+4*x**4+6*x**3-3*x**2-6*x+10\nq = -3*x**5+10*x**4+5*x**3+7*x**2-3*x-9\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-8-2 i$ and $y=-3-6 i$", + "Output Answer": [ + "$12+54 i$" + ], + "Output Program": [ + "i = 1j\nx = -8-2*i\ny = -3-6*i\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all roots of the following function: $-5 x^4+\\sqrt{\\frac{32 x}{5}+\\frac{27}{5}}-\\frac{29}{5}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\text{Root}\\left[625 \\text{$\\#$1}^8+1450 \\text{$\\#$1}^4-160 \\text{$\\#$1}+706\\&,3\\right]\\right\\},\\left\\{x\\to \\text{Root}\\left[625 \\text{$\\#$1}^8+1450 \\text{$\\#$1}^4-160 \\text{$\\#$1}+706\\&,4\\right]\\right\\},\\left\\{x\\to \\text{Root}\\left[625 \\text{$\\#$1}^8+1450 \\text{$\\#$1}^4-160 \\text{$\\#$1}+706\\&,5\\right]\\right\\},\\left\\{x\\to \\text{Root}\\left[625 \\text{$\\#$1}^8+1450 \\text{$\\#$1}^4-160 \\text{$\\#$1}+706\\&,6\\right]\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(-5*x**4+sqrt(((32*x)/5)+(27/5))-(29/5), x)\n print(soln)\nexcept: ...\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((20+18)+1)-(14-16)$.", + "Output Answer": [ + "$41$" + ], + "Output Program": [ + "try: \n print(((20+18)+1)-(14-16))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$9 x+15 y-7=0$, $-19 x-3 y-6=0$", + "Output Answer": [ + "$x=-\\frac{37}{86}$, $y=\\frac{187}{258}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((9*x+15*y-7, -19*x-3*y-6), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 3 x^2+10 x+1$, $q(x) = -x^2+x+13$", + "Output Answer": [ + "$2 x^2+11 x+14$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**2+10*x+1\nq = -x**2+x+13\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2-x+4 y^2+6 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(y+\\frac{3}{4}\\right)^2-9 \\left(x+\\frac{1}{18}\\right)^2=\\frac{92}{9}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{18} & -\\frac{3}{4}-\\frac{\\sqrt{299}}{9} \\\\\n -\\frac{1}{18} & \\frac{\\sqrt{299}}{9}-\\frac{3}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{13}}{3}$\nCenter: $\\left\\{-\\frac{1}{18},-\\frac{3}{4}\\right\\}$\nAsymptotes: $\\left\\{y=-\\frac{3 x}{2}-\\frac{5}{6},y=\\frac{3 x}{2}-\\frac{2}{3}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2-x+4*y**2+6*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{4 e^{-\\frac{i \\pi }{30}}}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $\\frac{4}{\\sqrt{\\pi }}$\nArgument: $\\frac{29 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((4*math.e**(-((i*math.pi)/30)))/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2+10 x+10 y^2-y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(y-\\frac{1}{20}\\right)^2-4 \\left(x-\\frac{5}{4}\\right)^2=-\\frac{89}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{40} \\left(50-\\sqrt{1246}\\right) & \\frac{1}{20} \\\\\n \\frac{1}{40} \\left(50+\\sqrt{1246}\\right) & \\frac{1}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{40} \\left(50-\\sqrt{1246}\\right)+\\frac{1}{40} \\left(50+\\sqrt{1246}\\right)\\right),\\frac{1}{20}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{2}{5}} x+\\frac{1}{20} \\left(1-5 \\sqrt{10}\\right),y=\\frac{1}{20} \\left(1+5 \\sqrt{10}\\right)-\\sqrt{\\frac{2}{5}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2+10*x+10*y**2-y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{1}{2}-4 x$ and $-\\frac{7 x^5}{2}-\\frac{7 x^4}{2}+\\frac{5 x^3}{2}-\\frac{7 x^2}{2}+3 x+\\frac{3}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd((1/2)-4*x, -((7*x**5)/2)-((7*x**4)/2)+((5*x**3)/2)-((7*x**2)/2)+3*x+(3/2)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-7 x^2-14 x-1$", + "Output Answer": [ + "$x=\\frac{1}{7} \\left(-7-\\sqrt{42}\\right)\\lor x=\\frac{1}{7} \\left(\\sqrt{42}-7\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-7*x**2-14*x-1, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{27 x^3}{5}-\\frac{49 x^2}{5}-\\frac{21 x}{5}-\\frac{3}{5}$ when divided by $5 x-4$.", + "Output Answer": [ + "$\\frac{27 x^2}{25}-\\frac{137 x}{125}-\\frac{1073}{625}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((27*x**3)/5)-((49*x**2)/5)-((21*x)/5)-(3/5)\nq = 5*x-4\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{1}{10} ((8-2)+10)+((((3-13)+14)-3)-7)$.", + "Output Answer": [ + "$-\\frac{22}{5}$" + ], + "Output Program": [ + "try: \n print((1/10)*((8-2)+10)+((((3-13)+14)-3)-7))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{11 x^2+7 x-21}{-4 x^2-19 x+18}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{22} \\left(-7-\\sqrt{973}\\right)\\right\\},\\left\\{x\\to \\frac{1}{22} \\left(-7+\\sqrt{973}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((11*x**2+7*x-21)/(-4*x**2-19*x+18)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt{4 x+\\frac{10}{3}} \\sqrt{7 x-\\frac{19}{3}}$", + "Output Answer": [ + "$x\\geq \\frac{19}{21}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sqrt(4*x+(10/3))*sqrt(7*x-(19/3))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{((20-19)+10)-25}{\\frac{10}{13}+25}$.", + "Output Answer": [ + "$-\\frac{182}{335}$" + ], + "Output Program": [ + "try: \n print(((((20-19)+10)-25)/((10/13)+25)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 x^2-9 x+1$, $q(x) = 9 x^2+15 x+11$", + "Output Answer": [ + "$13 x^2+6 x+12$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**2-9*x+1\nq = 9*x**2+15*x+11\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$11 x+21 y-19=0$, $-19 x-18 y-25=0$", + "Output Answer": [ + "$x=-\\frac{289}{67}$, $y=\\frac{212}{67}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((11*x+21*y-19, -19*x-18*y-25), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{(11+21)-10}{23+20}$.", + "Output Answer": [ + "$\\frac{22}{43}$" + ], + "Output Program": [ + "try: \n print((((11+21)-10)/(23+20)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\log \\left(-6 x^5-8\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\sqrt[5]{-\\frac{3}{2}}\\right\\},\\left\\{x\\to -\\sqrt[5]{\\frac{3}{2}}\\right\\},\\left\\{x\\to -(-1)^{2/5} \\sqrt[5]{\\frac{3}{2}}\\right\\},\\left\\{x\\to (-1)^{3/5} \\sqrt[5]{\\frac{3}{2}}\\right\\},\\left\\{x\\to -(-1)^{4/5} \\sqrt[5]{\\frac{3}{2}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(log(-6*x**5-8), x)\n print(soln)\nexcept: ...\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{19-8}{24}-5\\right)-((8-16)+23)^2$.", + "Output Answer": [ + "$-\\frac{5509}{24}$" + ], + "Output Program": [ + "try: \n print((((19-8)/24)-5)-((8-16)+23)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-5 x-2}+\\sqrt{4-4 x}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{198}{-55-4 \\sqrt{187}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-5*x-2)+sqrt(4-4*x), 6), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{196}{9} \\left(7 t^2+30 t+31\\right)^2, x(t)=49 t^2+210 t+225$", + "Output Answer": [ + "$y=\\frac{4 x^2}{9}-\\frac{64 x}{9}+\\frac{256}{9}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (196/9)*(7*t**2+30*t+31)**2\nx_t = 49*t**2+210*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$11 x-12 y-24=0$, $-2 x-10 y+6=0$", + "Output Answer": [ + "$x=\\frac{156}{67}$, $y=\\frac{9}{67}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((11*x-12*y-24, -2*x-10*y+6), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^3+3 x^2+5 x-9$ when divided by $-9$.", + "Output Answer": [ + "$x^3-\\frac{x^2}{3}-\\frac{5 x}{9}+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**3+3*x**2+5*x-9\nq = -9\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -6.478 x^2-9.839 x-3.058$, $q(x) = -2.435 x^2-13.848 x+1.334$", + "Output Answer": [ + "$-8.913 x^2-23.687 x-1.724$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6.478*x**2-9.839*x-3.058\nq = -2.435*x**2-13.848*x+1.334\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{113}}{\\sqrt{59}}$.", + "Output Answer": [ + "$\\sqrt{\\frac{113}{59}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(113))/(sqrt(59))))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{49} (-54 t-7), x(t)=\\frac{54 t}{7}-15$", + "Output Answer": [ + "$y=-\\frac{x}{7}-\\frac{16}{7}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/49)*(-54*t-7)\nx_t = ((54*t)/7)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-5 \\left(-\\sin \\left(\\frac{\\pi }{15}\\right)-i \\cos \\left(\\frac{\\pi }{15}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$625 \\left(\\sin \\left(\\frac{7 \\pi }{30}\\right)-i \\cos \\left(\\frac{7 \\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-5*(-math.sin((math.pi/15))-1j*math.cos((math.pi/15))))**4)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=36 \\left(30 t^2-150 t+187\\right)^2, x(t)=36 t^2-180 t+225$", + "Output Answer": [ + "$y=25 x^2-30 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 36*(30*t**2-150*t+187)**2\nx_t = 36*t**2-180*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{2}-7 x, q(x) = \\frac{1}{16} (x-9)^4$", + "Output Answer": [ + "$\\frac{x^4}{16}-\\frac{9 x^3}{4}+\\frac{243 x^2}{8}-\\frac{757 x}{4}+\\frac{6569}{16}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/2)-7*x\nq = (1/16)*(x-9)**4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-8 x+18 y+24 z+21=0$, $14 x+21 y-19 z-14=0$, $-17 x-12 y+7 z-22=0$", + "Output Answer": [ + "$x=-\\frac{841}{342}$, $y=\\frac{1417}{3078}$, $z=-\\frac{2093}{1026}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-8*x+18*y+24*z+21, 14*x+21*y-19*z-14, -17*x-12*y+7*z-22)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(14+14) \\left(\\frac{1}{21} ((22-6)+18)+23\\right)$.", + "Output Answer": [ + "$\\frac{2068}{3}$" + ], + "Output Program": [ + "try: \n print((14+14)*((1/21)*((22-6)+18)+23))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2-8 x+2 y^2+10 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(y+\\frac{5}{2}\\right)^2-6 \\left(x+\\frac{2}{3}\\right)^2=\\frac{83}{6}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{3} & -\\frac{5}{2}-\\frac{\\sqrt{83}}{3} \\\\\n -\\frac{2}{3} & \\frac{\\sqrt{83}}{3}-\\frac{5}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{3}}$\nCenter: $\\left\\{-\\frac{2}{3},-\\frac{5}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{6} \\left(-15-4 \\sqrt{3}\\right)-\\sqrt{3} x,y=\\sqrt{3} x+\\frac{1}{6} \\left(4 \\sqrt{3}-15\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2-8*x+2*y**2+10*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2-9 x-10 y^2+2 y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x-\\frac{1}{2}\\right)^2-10 \\left(y-\\frac{1}{10}\\right)^2=\\frac{3}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{60} \\left(30-\\sqrt{114}\\right) & \\frac{1}{10} \\\\\n \\frac{1}{60} \\left(30+\\sqrt{114}\\right) & \\frac{1}{10} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{19}{10}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{60} \\left(30-\\sqrt{114}\\right)+\\frac{1}{60} \\left(30+\\sqrt{114}\\right)\\right),\\frac{1}{10}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3 x}{\\sqrt{10}}+\\frac{1}{20} \\left(2-3 \\sqrt{10}\\right),y=\\frac{1}{20} \\left(2+3 \\sqrt{10}\\right)-\\frac{3 x}{\\sqrt{10}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2-9*x-10*y**2+2*y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-4 x^3-116 x^2-664 x+1824$", + "Output Answer": [ + "$4 (-x-19) (-x-12) (2-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-4*x**3-116*x**2-664*x+1824, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 7 x^2+8 x+8$ and $q(x) = -8 x^2-10 x+2$", + "Output Answer": [ + "$-56 x^4-134 x^3-130 x^2-64 x+16$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 7*x**2+8*x+8\nq = -8*x**2-10*x+2\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-15 x-12}+\\sqrt{-\\frac{9 x}{2}-\\frac{19}{2}}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{147} \\left(-2635+40 \\sqrt{2587}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-15*x-12)+sqrt(-((9*x)/2)-(19/2)), 10), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{72}{91}$, and $a_n=a_{n-1}+-10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$-\\frac{5388}{7}$" + ], + "Output Program": [ + "a = (72/91) # initial value\nd = -10 # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (72/91) # initial value\nd = -10 # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\left(-\\sin \\left(\\frac{\\pi }{30}\\right)-i \\cos \\left(\\frac{\\pi }{30}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$2176782336 \\left(\\frac{1}{4} \\left(\\sqrt{5}-1\\right)-i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*(-math.sin((math.pi/30))-1j*math.cos((math.pi/30))))**12)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{3 x^2}{4}+\\frac{15 x}{2}-\\frac{1}{4}$", + "Output Answer": [ + "$\\frac{3}{4} (x+5)^2-19$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((3*x**2)/4)+((15*x)/2)-(1/4)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^5+6 x^4+6 x^3-x^2-x+5$ when divided by $8 x^5-6 x^4-5 x^3+7 x^2+4 x-4$.", + "Output Answer": [ + "$\\frac{7}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**5+6*x**4+6*x**3-x**2-x+5\nq = 8*x**5-6*x**4-5*x**3+7*x**2+4*x-4\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^6-\\frac{11 x^5}{2}-\\frac{9 x^4}{2}+9 x^3-8 x^2-\\frac{19 x}{2}-\\frac{15}{2}$ when divided by $\\frac{9 x^5}{2}+3 x^4-6 x^3+\\frac{11 x^2}{2}+\\frac{5 x}{2}-4$.", + "Output Answer": [ + "$-\\frac{16 x}{9}-\\frac{1}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**6-((11*x**5)/2)-((9*x**4)/2)+9*x**3-8*x**2-((19*x)/2)-(15/2)\nq = ((9*x**5)/2)+3*x**4-6*x**3+((11*x**2)/2)+((5*x)/2)-4\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=8+9 i$ and $y=-4-3 i$", + "Output Answer": [ + "$-\\frac{59}{25}-\\frac{12 i}{25}$" + ], + "Output Program": [ + "i = 1j\nx = 8+9*i\ny = -4-3*i\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{25+4 i}{\\pi }$ and $y=-\\frac{1+22 i}{\\pi }$", + "Output Answer": [ + "$-\\frac{113}{485}+\\frac{546 i}{485}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((25+4*i)/math.pi)\ny = -((1+22*i)/math.pi)\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $8 x^5-18 x^4-19 x^3-10 x^2+3$ and $-2 x^3+5 x^2+3 x+3$.", + "Output Answer": [ + "$2 x^3-5 x^2-3 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(8*x**5-18*x**4-19*x**3-10*x**2+3, -2*x**3+5*x**2+3*x+3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\left(-\\sin \\left(\\frac{\\pi }{15}\\right)-i \\cos \\left(\\frac{\\pi }{15}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$216 \\left(\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(1+\\sqrt{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*(-math.sin((math.pi/15))-1j*math.cos((math.pi/15))))**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2+9 \\sqrt{2} x-532$", + "Output Answer": [ + "$2 \\left(x-\\frac{19}{\\sqrt{2}}\\right) \\left(x+14 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2+9*sqrt(2)*x-532, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{37 x}{\\sqrt{3}}+\\frac{2 y}{\\sqrt{3}}-\\frac{31 z}{\\sqrt{3}}-\\frac{11}{\\sqrt{3}}=0$, $-\\sqrt{3} x-\\frac{26 y}{\\sqrt{3}}+\\frac{7 z}{\\sqrt{3}}-\\frac{16}{\\sqrt{3}}=0$, $\\frac{4 x}{\\sqrt{3}}+\\frac{35 y}{\\sqrt{3}}+10 \\sqrt{3} z-\\frac{17}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{43059}{37658}$, $y=-\\frac{9110}{18829}$, $z=\\frac{36855}{37658}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((37*x)/(sqrt(3)))+((2*y)/(sqrt(3)))-((31*z)/(sqrt(3)))-(11/(sqrt(3))), -sqrt(3)*x-((26*y)/(sqrt(3)))+((7*z)/(sqrt(3)))-(16/(sqrt(3))), ((4*x)/(sqrt(3)))+((35*y)/(sqrt(3)))+10*sqrt(3)*z-(17/(sqrt(3))))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = x^2-5 x-11$, $q(x) = x^2-15 x-4$", + "Output Answer": [ + "$2 x^2-20 x-15$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**2-5*x-11\nq = x**2-15*x-4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+5 x-6 y^2-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x+\\frac{5}{16}\\right)^2-6 y^2=\\frac{153}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{16} \\left(-5-\\sqrt{357}\\right) & 0 \\\\\n \\frac{1}{16} \\left(\\sqrt{357}-5\\right) & 0 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{16} \\left(-5-\\sqrt{357}\\right)+\\frac{1}{16} \\left(\\sqrt{357}-5\\right)\\right),0\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2 x}{\\sqrt{3}}+\\frac{5}{8 \\sqrt{3}},y=-\\frac{2 x}{\\sqrt{3}}-\\frac{5}{8 \\sqrt{3}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+5*x-6*y**2-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-88 x^2+56 x+32}{-128 x^2+240 x-112}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{4}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-88*x**2+56*x+32)/(-128*x**2+240*x-112)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-306 x^2+x+342}{-36 x^2-38 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{18}{17}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-306*x**2+x+342)/(-36*x**2-38*x)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{40 x^2}{\\sqrt{3}}+\\frac{17 x}{\\sqrt{3}}-\\frac{37}{\\sqrt{3}}\\right| =2 \\sqrt{3}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((40*x**2)/(sqrt(3)))+((17*x)/(sqrt(3)))-(37/(sqrt(3)))), 2*sqrt(3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^5+9 x^4+10 x^3-8 x^2+10 x+9$ when divided by $-3 x^5+10 x^4+4 x^3-x^2-5 x+8$.", + "Output Answer": [ + "$2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**5+9*x**4+10*x**3-8*x**2+10*x+9\nq = -3*x**5+10*x**4+4*x**3-x**2-5*x+8\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{8 x^3}{3}-12 x^2-\\frac{37 x}{3}-1$ and $-\\frac{8 x^2}{3}-4 x-\\frac{1}{3}$.", + "Output Answer": [ + "$\\frac{8 x^2}{3}+4 x+\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((8*x**3)/3)-12*x**2-((37*x)/3)-1, -((8*x**2)/3)-4*x-(1/3)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{20 x^2}{3}-\\frac{41 x}{3}+\\frac{22}{3}$", + "Output Answer": [ + "$x=\\frac{1}{40} \\left(-41-\\sqrt{3441}\\right)\\lor x=\\frac{1}{40} \\left(\\sqrt{3441}-41\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((20*x**2)/3)-((41*x)/3)+(22/3), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((((11+25)-7)-12)+1)+((((19+3)-8)+8)-20)$.", + "Output Answer": [ + "$20$" + ], + "Output Program": [ + "try: \n print(((((11+25)-7)-12)+1)+((((19+3)-8)+8)-20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{4-7}{((18-10)+9)+2}$.", + "Output Answer": [ + "$-\\frac{3}{19}$" + ], + "Output Program": [ + "try: \n print(((4-7)/(((18-10)+9)+2)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{9 x^2}{\\sqrt{\\pi }}-\\frac{14 x}{\\sqrt{\\pi }}+\\frac{11}{\\sqrt{\\pi }}$ and $q(x) = \\frac{7 x^2}{\\sqrt{\\pi }}-\\frac{26 x}{\\sqrt{\\pi }}-\\frac{19}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{63 x^4}{\\pi }+\\frac{136 x^3}{\\pi }+\\frac{612 x^2}{\\pi }-\\frac{20 x}{\\pi }-\\frac{209}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((9*x**2)/(sqrt(pi)))-((14*x)/(sqrt(pi)))+(11/(sqrt(pi)))\nq = ((7*x**2)/(sqrt(pi)))-((26*x)/(sqrt(pi)))-(19/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2-5 x-8 y^2+2 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x-\\frac{5}{14}\\right)^2-8 \\left(y-\\frac{1}{8}\\right)^2=\\frac{99}{56}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{56} \\left(20-3 \\sqrt{165}\\right) & \\frac{1}{8} \\\\\n \\frac{1}{56} \\left(20+3 \\sqrt{165}\\right) & \\frac{1}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{15}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{56} \\left(20-3 \\sqrt{165}\\right)+\\frac{1}{56} \\left(20+3 \\sqrt{165}\\right)\\right),\\frac{1}{8}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{2} \\sqrt{\\frac{7}{2}} x+\\frac{1}{56} \\left(7-5 \\sqrt{14}\\right),y=\\frac{1}{56} \\left(7+5 \\sqrt{14}\\right)-\\frac{1}{2} \\sqrt{\\frac{7}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2-5*x-8*y**2+2*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+4 x+6 y^2+6 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $3 \\left(x+\\frac{2}{3}\\right)^2+6 \\left(y+\\frac{1}{2}\\right)^2=\\frac{35}{6}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{6} \\left(-4-\\sqrt{35}\\right) & -\\frac{1}{2} \\\\\n \\frac{1}{6} \\left(\\sqrt{35}-4\\right) & -\\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{6} \\left(-4-\\sqrt{35}\\right)+\\frac{1}{6} \\left(\\sqrt{35}-4\\right)\\right),-\\frac{1}{2}\\right\\}$\nArea Enclosed: $\\frac{35 \\pi }{18 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+4*x+6*y**2+6*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{(22-3)+7}{\\left(\\frac{5}{3}+4\\right)+20}$.", + "Output Answer": [ + "$\\frac{78}{77}$" + ], + "Output Program": [ + "try: \n print((((22-3)+7)/(((5/3)+4)+20)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2+116 x-\\frac{680}{3}$", + "Output Answer": [ + "$12 \\left(-x-\\frac{34}{3}\\right) \\left(\\frac{5}{3}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2+116*x-(680/3), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-12 \\sqrt{3} x+13 \\sqrt{3} y-5 \\sqrt{3}=0$, $3 \\sqrt{3} x-8 \\sqrt{3} y+14 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{142}{57}$, $y=\\frac{51}{19}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-12*sqrt(3)*x+13*sqrt(3)*y-5*sqrt(3), 3*sqrt(3)*x-8*sqrt(3)*y+14*sqrt(3)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^5+2 x^4+9 x^3+10 x^2+5 x+7$ when divided by $6 x^3+5 x^2+7 x-5$.", + "Output Answer": [ + "$-\\frac{x^2}{3}+\\frac{11 x}{18}+\\frac{149}{108}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**5+2*x**4+9*x**3+10*x**2+5*x+7\nq = 6*x**3+5*x**2+7*x-5\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{20 x}{3}+9 y+\\frac{5 z}{3}-\\frac{43}{3}=0$, $-\\frac{x}{3}+\\frac{26 y}{3}+\\frac{47 z}{3}-\\frac{56}{3}=0$, $8 x-6 y+23 z+\\frac{29}{3}=0$", + "Output Answer": [ + "$x=-\\frac{28879}{82089}$, $y=\\frac{2372}{1303}$, $z=\\frac{14527}{82089}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((20*x)/3)+9*y+((5*z)/3)-(43/3), -(x/3)+((26*y)/3)+((47*z)/3)-(56/3), 8*x-6*y+23*z+(29/3))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 14-3 x| =0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{14}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(14-3*x), 0), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{532 x^2}{3}+\\frac{176 x}{3}+12}{\\frac{14 x}{3}+\\frac{2}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{9}{19}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((532*x**2)/3)+((176*x)/3)+12)/(((14*x)/3)+(2/3))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $x^2-13 x+1$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(13-\\sqrt{165}\\right)\\lor x=\\frac{1}{2} \\left(13+\\sqrt{165}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(x**2-13*x+1, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^6-x^5-8 x^4-10 x^3-x^2+8 x+8$ when divided by $8 x^3+5 x^2+x-8$.", + "Output Answer": [ + "$\\frac{7 x^3}{8}-\\frac{43 x^2}{64}-\\frac{353 x}{512}+\\frac{573}{4096}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**6-x**5-8*x**4-10*x**3-x**2+8*x+8\nq = 8*x**3+5*x**2+x-8\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -2 \\sqrt{2} (6 x-5)^3, q(x) = -4 \\sqrt{2} x$", + "Output Answer": [ + "$-432 \\sqrt{2} x^3+1080 \\sqrt{2} x^2-904 \\sqrt{2} x+250 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*sqrt(2)*(6*x-5)**3\nq = -4*sqrt(2)*x\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2 x-1$ and $-2 x-1$.", + "Output Answer": [ + "$2 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2*x-1, -2*x-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{14+13 i}{\\sqrt{3}}$ and $y=-\\frac{7+7 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{21+20 i}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((14+13*i)/(math.sqrt(3)))\ny = -((7+7*i)/(math.sqrt(3)))\nprint(x+y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 12 x^2 \\log (2)+5 x \\log (2)+7 \\log (2)$ and $q(x) = 13 x^2 \\log (2)+15 x \\log (2)-15 \\log (2)$", + "Output Answer": [ + "$156 x^4 \\log ^2(2)+245 x^3 \\log ^2(2)-14 x^2 \\log ^2(2)+30 x \\log ^2(2)-105 \\log ^2(2)$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 12*x**2*log(2)+5*x*log(2)+7*log(2)\nq = 13*x**2*log(2)+15*x*log(2)-15*log(2)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{9 x^2}{\\sqrt{2}}+13 \\sqrt{2} x-7 \\sqrt{2}\\right| =10 \\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(13-\\sqrt{223}\\right)\\right\\},\\left\\{x\\to \\frac{1}{9} \\left(13+\\sqrt{223}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((9*x**2)/(sqrt(2)))+13*sqrt(2)*x-7*sqrt(2)), 10*sqrt(2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $10 x+y^2-y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $10 x+y^2-y=-6$\nVertex: $\\left\\{-\\frac{23}{40},\\frac{1}{2}\\right\\}$\nDirectrix: $x=\\frac{77}{40}$\nFocal Parameter: $5$\nFocus: $\\left\\{-\\frac{123}{40},\\frac{1}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x+y**2-y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$2 x-19 y-11=0$, $-10 x+24 y-3=0$", + "Output Answer": [ + "$x=-\\frac{321}{142}$, $y=-\\frac{58}{71}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((2*x-19*y-11, -10*x+24*y-3), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-46 x^2-499 x+345}{42 x^2+505 x+253}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{15}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-46*x**2-499*x+345)/(42*x**2+505*x+253)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{9+8 i}{\\sqrt{3}}$ and $y=-\\frac{12+11 i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{196}{265}-\\frac{3 i}{265}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((9+8*i)/(math.sqrt(3)))\ny = -((12+11*i)/(math.sqrt(3)))\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $7 x^2+49 \\sqrt{2} x$", + "Output Answer": [ + "$7 x \\left(x+7 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(7*x**2+49*sqrt(2)*x, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+3 x+5 y^2-8 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x+\\frac{3}{16}\\right)^2+5 \\left(y-\\frac{4}{5}\\right)^2=\\frac{2157}{160}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{16} & \\frac{4}{5}-\\frac{3 \\sqrt{719}}{80} \\\\\n -\\frac{3}{16} & \\frac{4}{5}+\\frac{3 \\sqrt{719}}{80} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{3}{2}}}{2}$\nCenter: $\\left\\{-\\frac{3}{16},\\frac{4}{5}\\right\\}$\nArea Enclosed: $\\frac{2157 \\pi }{320 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+3*x+5*y**2-8*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{25}{7}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{10503}{7}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (25/7) # initial value\nd = 4 # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (25/7) # initial value\nd = 4 # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^3+9 x^2+2 x-3$ when divided by $-3 x^3+7 x^2+8 x-7$.", + "Output Answer": [ + "$\\frac{7}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**3+9*x**2+2*x-3\nq = -3*x**3+7*x**2+8*x-7\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2+30 x-52$", + "Output Answer": [ + "$2 (13-x) (x-2)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2+30*x-52, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-6 \\left(\\cos \\left(\\frac{7 \\pi }{45}\\right)+i \\sin \\left(\\frac{7 \\pi }{45}\\right)\\right)$.", + "Output Answer": [ + "Norm: $6 \\sqrt{\\sin ^2\\left(\\frac{7 \\pi }{45}\\right)+\\cos ^2\\left(\\frac{7 \\pi }{45}\\right)}$\nArgument: $-\\frac{38 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -6*(math.cos(((7*math.pi)/45))+i*math.sin(((7*math.pi)/45)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{27 x^2}{7}+\\frac{94 x}{7}+\\frac{75}{7}$", + "Output Answer": [ + "$x=\\frac{1}{27} \\left(47-\\sqrt{4234}\\right)\\lor x=\\frac{1}{27} \\left(47+\\sqrt{4234}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((27*x**2)/7)+((94*x)/7)+(75/7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2-\\frac{1716 x}{5}-2673$", + "Output Answer": [ + "$11 \\left(-x-\\frac{81}{5}\\right) (x+15)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2-((1716*x)/5)-2673, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{23-16 i}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{785}}{\\pi }$\nArgument: $-\\tan ^{-1}\\left(\\frac{16}{23}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((23-16*i)/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (9, \\sqrt{5}, \\frac{1}{\\sqrt{3}})$", + "Output Answer": [ + "$\\left\\{\\sqrt{\\frac{259}{3}},\\tan ^{-1}\\left(\\sqrt{258}\\right),\\tan ^{-1}\\left(\\frac{\\sqrt{5}}{9}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 9\ny = math.sqrt(5)\nz = (1/(math.sqrt(3)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 8.397 x^2+14.865 x+10.086$, $q(x) = 14.978 x^2-0.264 x+7.057$", + "Output Answer": [ + "$23.375 x^2+14.601 x+17.143$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8.397*x**2+14.865*x+10.086\nq = 14.978*x**2-0.264*x+7.057\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{x}{\\sqrt{2}}-3 \\sqrt{2} y+9 \\sqrt{2} z-7 \\sqrt{2}=0$, $-2 \\sqrt{2} x+\\frac{25 y}{\\sqrt{2}}-9 \\sqrt{2} z-\\frac{27}{\\sqrt{2}}=0$, $17 \\sqrt{2} x-11 \\sqrt{2} z=0$", + "Output Answer": [ + "$x=\\frac{5632}{5825}$, $y=\\frac{13459}{5825}$, $z=\\frac{8704}{5825}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve(((x/(sqrt(2)))-3*sqrt(2)*y+9*sqrt(2)*z-7*sqrt(2), -2*sqrt(2)*x+((25*y)/(sqrt(2)))-9*sqrt(2)*z-(27/(sqrt(2))), 17*sqrt(2)*x-11*sqrt(2)*z)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{173 x}{7}+\\frac{10 y}{7}-\\frac{29 z}{7}+\\frac{156}{7}=0$, $\\frac{87 x}{7}+\\frac{57 y}{7}+\\frac{65 z}{7}-\\frac{41}{7}=0$, $-\\frac{153 x}{7}+\\frac{131 y}{7}+\\frac{158 z}{7}-\\frac{61}{7}=0$", + "Output Answer": [ + "$x=\\frac{156652}{735389}$, $y=-\\frac{3794725}{735389}$, $z=\\frac{3581870}{735389}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((173*x)/7)+((10*y)/7)-((29*z)/7)+(156/7), ((87*x)/7)+((57*y)/7)+((65*z)/7)-(41/7), -((153*x)/7)+((131*y)/7)+((158*z)/7)-(61/7))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-1+i) \\sqrt{3}$ and $y=(3-4 i) \\sqrt{3}$", + "Output Answer": [ + "$-\\frac{7}{25}-\\frac{i}{25}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-1+i)*math.sqrt(3)\ny = (3-4*i)*math.sqrt(3)\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 13 x^2+6 x+13$, $q(x) = 4 x^2+15 x-12$", + "Output Answer": [ + "$17 x^2+21 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 13*x**2+6*x+13\nq = 4*x**2+15*x-12\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2-8 x+8 y^2+5 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $3 \\left(x-\\frac{4}{3}\\right)^2+8 \\left(y+\\frac{5}{16}\\right)^2=\\frac{1163}{96}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{4}{3}-\\frac{\\sqrt{5815}}{48} & -\\frac{5}{16} \\\\\n \\frac{1}{48} \\left(64+\\sqrt{5815}\\right) & -\\frac{5}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{5}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{4}{3}-\\frac{\\sqrt{5815}}{48}+\\frac{1}{48} \\left(64+\\sqrt{5815}\\right)\\right),-\\frac{5}{16}\\right\\}$\nArea Enclosed: $\\frac{1163 \\pi }{192 \\sqrt{6}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2-8*x+8*y**2+5*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-140 x^2-198 x-34}{20 x^2-116 x-24}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{17}{14}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-140*x**2-198*x-34)/(20*x**2-116*x-24)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{13 x^2}{2}+\\frac{57 x}{4}-\\frac{47}{4}$", + "Output Answer": [ + "$x=\\frac{1}{52} \\left(-57-\\sqrt{8137}\\right)\\lor x=\\frac{1}{52} \\left(\\sqrt{8137}-57\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((13*x**2)/2)+((57*x)/4)-(47/4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{13}{4}-2 i$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{233}}{4}$\nArgument: $-\\tan ^{-1}\\left(\\frac{8}{13}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (13/4)-2*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $10-x$ when divided by $3$.", + "Output Answer": [ + "$\\frac{10}{3}-\\frac{x}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10-x\nq = 3\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^6-3 x^5+8 x^4+9 x-6$ when divided by $-6 x^2-6 x+6$.", + "Output Answer": [ + "$-\\frac{5 x^4}{6}+\\frac{4 x^3}{3}-\\frac{7 x^2}{2}+\\frac{29 x}{6}-\\frac{25}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**6-3*x**5+8*x**4+9*x-6\nq = -6*x**2-6*x+6\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-4 x^2-\\frac{29 x}{3}+14$", + "Output Answer": [ + "$\\frac{2857}{144}-4 \\left(x+\\frac{29}{24}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-4*x**2-((29*x)/3)+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-12 x^6-2 x^5-18 x^4+6 x^3-4 x^2-6 x$ and $-3 x^5+x^4-5 x^3+4 x^2-3 x$.", + "Output Answer": [ + "$3 x^5-x^4+5 x^3-4 x^2+3 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-12*x**6-2*x**5-18*x**4+6*x**3-4*x**2-6*x, -3*x**5+x**4-5*x**3+4*x**2-3*x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-14 x^2-22 x+\\frac{45}{4}}{13-\\frac{25 x}{4}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{28} \\left(-22-\\sqrt{1114}\\right)\\right\\},\\left\\{x\\to \\frac{1}{28} \\left(-22+\\sqrt{1114}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-14*x**2-22*x+(45/4))/(13-((25*x)/4))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{51}{61}$, and $a_n=a_{n-1}+5$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$\\frac{122351}{61}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(51/61) # initial value\nd = 5 # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(51/61) # initial value\nd = 5 # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 7 x+4| =12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{16}{7}\\right\\},\\left\\{x\\to \\frac{8}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(7*x+4), 12), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{((7-10)-13)+15}{19+4}$.", + "Output Answer": [ + "$-\\frac{1}{23}$" + ], + "Output Program": [ + "try: \n print(((((7-10)-13)+15)/(19+4)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\left(\\cos \\left(\\frac{26}{45}\\right)+i \\sin \\left(\\frac{26}{45}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$59049 \\left(\\cos \\left(\\frac{52}{9}\\right)+i \\sin \\left(\\frac{52}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*(math.cos((26/45))+1j*math.sin((26/45))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{44}{9}$, and $a_n=a_{n-1}+-\\frac{9}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$7 \\left(-\\frac{88}{9}-\\frac{117}{\\sqrt{5}}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(44/9) # initial value\nd = -(9/(math.sqrt(5))) # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(44/9) # initial value\nd = -(9/(math.sqrt(5))) # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{1}{(8 x+3)^4 \\sqrt[3]{-8 x-6}}$ at the point $x=7$", + "Output Answer": [ + "$-\\frac{1}{12117361 \\sqrt[3]{62}} = 0.$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 7\ntry: \n f = (1/((8*x+3)**4*np.cbrt(-8*x-6)))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{9} \\left(169 t^2+26 \\left(11 \\sqrt{3}-26\\right) t-572 \\sqrt{3}+1039\\right), x(t)=\\frac{13 t}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=\\frac{x^2}{3}+\\frac{22 x}{3}+\\frac{121}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/9)*(169*t**2+26*(11*sqrt(3)-26)*t-572*sqrt(3)+1039)\nx_t = ((13*t)/(sqrt(3)))-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{26 x}{5}+\\frac{49}{5}}+\\sqrt{\\frac{53 x}{5}+13}=\\frac{63}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{135} \\left(11533-14 \\sqrt{621303}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((26*x)/5)+(49/5))+sqrt(((53*x)/5)+13), (63/5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{8}{9}$, and $a_n=a_{n-1}+4 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$\\frac{5}{2} \\left(16 \\sqrt{3}-\\frac{16}{9}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(8/9) # initial value\nd = 4*math.sqrt(3) # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(8/9) # initial value\nd = 4*math.sqrt(3) # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{10 x^2-6 x-10}{4 x^2+18 x+1}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(3-\\sqrt{109}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(3+\\sqrt{109}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((10*x**2-6*x-10)/(4*x**2+18*x+1)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{7}{3}-13 x}+\\sqrt{\\frac{35}{3}-\\frac{10 x}{3}}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{841} \\left(-18599+110 \\sqrt{21495}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((7/3)-13*x)+sqrt((35/3)-((10*x)/3)), 11), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-8.40024-5.04737 i$.", + "Output Answer": [ + "Norm: $9.8$\nArgument: $-2.60054$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -8.40024-5.04737*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$x+24 y-19 z-20=0$, $5 x+5 y-15 z-3=0$, $-21 x-21 y+18 z-11=0$", + "Output Answer": [ + "$x=-\\frac{7514}{5175}$, $y=\\frac{2477}{5175}$, $z=-\\frac{118}{225}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((x+24*y-19*z-20, 5*x+5*y-15*z-3, -21*x-21*y+18*z-11)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2-81 \\sqrt{5} x$", + "Output Answer": [ + "$-9 x \\left(x+9 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2-81*sqrt(5)*x, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{8 x^2+12 x-14}{-2 x^2+12 x+3}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-3-\\sqrt{37}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(-3+\\sqrt{37}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((8*x**2+12*x-14)/(-2*x**2+12*x+3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{69 x^2}{7}-\\frac{90 x}{7}+\\frac{32}{7}$", + "Output Answer": [ + "$\\frac{1411}{161}-\\frac{69}{7} \\left(x+\\frac{15}{23}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((69*x**2)/7)-((90*x)/7)+(32/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 9 x^2-6 x+4$ and $q(x) = 2 x^2-8 x-2$", + "Output Answer": [ + "$18 x^4-84 x^3+38 x^2-20 x-8$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 9*x**2-6*x+4\nq = 2*x**2-8*x-2\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{3}, 10, \\pi)$", + "Output Answer": [ + "$\\left\\{\\sqrt{\\frac{901}{9}+\\pi ^2},\\tan ^{-1}\\left(\\frac{\\sqrt{901}}{3 \\pi }\\right),\\tan ^{-1}(30)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/3)\ny = 10\nz = math.pi\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -13 \\sqrt{3} x-5 \\sqrt{3}\\right| =12 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{17}{13}\\right\\},\\left\\{x\\to \\frac{7}{13}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-13*sqrt(3)*x-5*sqrt(3)), 12*sqrt(3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -8.644 x^2+11.733 x-6.647$, $q(x) = 5.708 x^2+9.057 x-12.477$", + "Output Answer": [ + "$-2.936 x^2+20.79 x-19.124$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8.644*x**2+11.733*x-6.647\nq = 5.708*x**2+9.057*x-12.477\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 2 x^2-9 x-7$, $q(x) = 12 x^2-5 x+3$", + "Output Answer": [ + "$14 x^2-14 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**2-9*x-7\nq = 12*x**2-5*x+3\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{7}{2}-\\frac{33 i}{4}$ and $y=\\frac{23}{4}+\\frac{39 i}{4}$", + "Output Answer": [ + "$-\\frac{1609}{2050}-\\frac{213 i}{2050}$" + ], + "Output Program": [ + "i = 1j\nx = -(7/2)-((33*i)/4)\ny = (23/4)+((39*i)/4)\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $10 x^2+11$", + "Output Answer": [ + "$10 x^2+11$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (10*x**2+11), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2-4 y^2+2 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 x^2-4 \\left(y-\\frac{1}{4}\\right)^2=\\frac{39}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3 \\sqrt{13}}{4} & \\frac{1}{4} \\\\\n \\frac{3 \\sqrt{13}}{4} & \\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{2}}$\nCenter: $\\left\\{0,\\frac{1}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{2}}+\\frac{1}{4},y=\\frac{1}{4}-\\frac{x}{\\sqrt{2}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2-4*y**2+2*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(((17-2)-10)-14)-(6-16)$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "try: \n print((((17-2)-10)-14)-(6-16))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-11 \\sqrt{3} x+7 \\sqrt{3} y+12 \\sqrt{3}=0$, $-\\frac{41 x}{\\sqrt{3}}-13 \\sqrt{3} y+14 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{381}{358}$, $y=-\\frac{15}{358}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-11*sqrt(3)*x+7*sqrt(3)*y+12*sqrt(3), -((41*x)/(sqrt(3)))-13*sqrt(3)*y+14*sqrt(3)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3} | x| ^2=9 \\sqrt{3}$", + "Output Answer": [ + "$\\{\\{x\\to -3\\},\\{x\\to 3\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(sqrt(3)*abs(x)*2, 9*sqrt(3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{9 x}{2}-\\frac{7}{2}$ when divided by $4 x-7$.", + "Output Answer": [ + "$\\frac{9}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((9*x)/2)-(7/2)\nq = 4*x-7\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^4-6 x^3+\\frac{9 x}{2}-6$ when divided by $-\\frac{7 x^2}{2}-\\frac{13 x}{2}+\\frac{11}{2}$.", + "Output Answer": [ + "$\\frac{16 x^2}{7}-\\frac{124 x}{49}+\\frac{2844}{343}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**4-6*x**3+((9*x)/2)-6\nq = -((7*x**2)/2)-((13*x)/2)+(11/2)\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -6 x^2 \\log (2)-16 x \\log (2)+21 \\log (2)$ and $q(x) = 3 x^2 \\log (2)+6 x \\log (2)-13 \\log (2)$", + "Output Answer": [ + "$-18 x^4 \\log ^2(2)-84 x^3 \\log ^2(2)+45 x^2 \\log ^2(2)+334 x \\log ^2(2)-273 \\log ^2(2)$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -6*x**2*log(2)-16*x*log(2)+21*log(2)\nq = 3*x**2*log(2)+6*x*log(2)-13*log(2)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{1}{125} (19 x-2)^3, q(x) = -\\frac{1}{125} (9 x-14)^3$", + "Output Answer": [ + "$-\\frac{7588 x^3}{125}+\\frac{5568 x^2}{125}-\\frac{1104 x}{25}+\\frac{2752}{125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(1/125)*(19*x-2)**3\nq = -(1/125)*(9*x-14)**3\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-12 x^2-12 x+8$ and $-3 x^2-3 x+2$.", + "Output Answer": [ + "$3 x^2+3 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-12*x**2-12*x+8, -3*x**2-3*x+2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -10 x^2+2 x+10$ and $q(x) = -12 x^2+8 x-12$", + "Output Answer": [ + "$120 x^4-104 x^3+16 x^2+56 x-120$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -10*x**2+2*x+10\nq = -12*x**2+8*x-12\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| -16 x-11| =7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{9}{8}\\right\\},\\left\\{x\\to -\\frac{1}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-16*x-11), 7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $5 x+y^2-6 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $5 x+y^2-6 y=3$\nVertex: $\\left\\{\\frac{12}{5},3\\right\\}$\nDirectrix: $x=\\frac{73}{20}$\nFocal Parameter: $\\frac{5}{2}$\nFocus: $\\left\\{\\frac{23}{20},3\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x+y**2-6*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=2 \\left(54 t^2-396 t+725\\right)^2, x(t)=18 t^2-132 t+242$", + "Output Answer": [ + "$y=18 x^2-12 x+2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 2*(54*t**2-396*t+725)**2\nx_t = 18*t**2-132*t+242\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-4 x^2+5 x+13$", + "Output Answer": [ + "$x=\\frac{1}{8} \\left(5-\\sqrt{233}\\right)\\lor x=\\frac{1}{8} \\left(5+\\sqrt{233}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-4*x**2+5*x+13, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{17}{2}-6 i$ and $y=7+4 i$", + "Output Answer": [ + "$-\\frac{71}{2}-76 i$" + ], + "Output Program": [ + "i = 1j\nx = -(17/2)-6*i\ny = 7+4*i\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x+2$ and $5$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x+2, 5))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-156 x^3+646 x^2-716 x+391}{-156 x^2+358 x+238}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-156*x**3+646*x**2-716*x+391)/(-156*x**2+358*x+238)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-17 x+5 y-18=0$, $17 x+15 y-14=0$", + "Output Answer": [ + "$x=-\\frac{10}{17}$, $y=\\frac{8}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-17*x+5*y-18, 17*x+15*y-14), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-6 \\sqrt{3} x^2-5 \\sqrt{3} x-4 \\sqrt{3}$", + "Output Answer": [ + "$-6 \\sqrt{3} \\left(x+\\frac{5}{12}\\right)^2-4 \\sqrt{3}+\\frac{25}{8 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-6*math.sqrt(3)*x**2-5*math.sqrt(3)*x-4*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{64 (x-2)^3}{3 \\sqrt{3}}, q(x) = -\\frac{(4 x-11)^3}{3 \\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{128 x^3}{3 \\sqrt{3}}+\\frac{304 x^2}{\\sqrt{3}}-\\frac{740 x}{\\sqrt{3}}+\\frac{1843}{3 \\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((64*(x-2)**3)/(3*sqrt(3)))\nq = -(((4*x-11)**3)/(3*sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{53}{70}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$-\\frac{1219}{70}$" + ], + "Output Program": [ + "a = -(53/70) # initial value\nd = 0 # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(53/70) # initial value\nd = 0 # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{7}{99}$, and $a_n=a_{n-1}+\\frac{27}{4}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$\\frac{18655}{99}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(7/99) # initial value\nd = (27/4) # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(7/99) # initial value\nd = (27/4) # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{13 x^2}{\\sqrt{3}}-\\frac{13 x}{\\sqrt{3}}-\\frac{13}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{13 \\left(x+\\frac{1}{2}\\right)^2}{\\sqrt{3}}-\\frac{13 \\sqrt{3}}{4}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((13*x**2)/(math.sqrt(3)))-((13*x)/(math.sqrt(3)))-(13/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-7 x^2-\\frac{329 x}{\\sqrt{3}}-1078$", + "Output Answer": [ + "$-7 \\left(-x-\\frac{14}{\\sqrt{3}}\\right) \\left(-x-11 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-7*x**2-((329*x)/(sqrt(3)))-1078, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{4 x^2-4 x-18}{21 x+17}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(1-\\sqrt{19}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(1+\\sqrt{19}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((4*x**2-4*x-18)/(21*x+17)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=e^{-\\frac{9 x^2}{2}-\\frac{5}{2}}+\\tan ^{-1}(1-5 x)$ at the point $x=3$", + "Output Answer": [ + "$\\frac{1}{e^{43}}-\\tan ^{-1}(14) = -1.499$" + ], + "Output Program": [ + "import math\n\nx = 3\ntry: \n f = math.e**(-((9*x**2)/2)-(5/2))+math.atan(1-5*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-8 x-6}+\\sqrt{5-8 x}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{38929}{6272}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-8*x-6)+sqrt(5-8*x), 14), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $6 x^2-12 x+13$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(6-i \\sqrt{42}\\right)\\lor x=\\frac{1}{6} \\left(6+i \\sqrt{42}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(6*x**2-12*x+13, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{99 x}{4}+\\frac{33 y}{2}-\\frac{51 z}{4}-4=0$, $14 x-\\frac{5 y}{2}-\\frac{37 z}{2}-\\frac{37}{4}=0$, $\\frac{87 x}{4}+\\frac{93 y}{4}+\\frac{85 z}{4}-\\frac{37}{4}=0$", + "Output Answer": [ + "$x=\\frac{16763}{56766}$, $y=\\frac{351544}{823107}$, $z=-\\frac{183413}{548738}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((99*x)/4)+((33*y)/2)-((51*z)/4)-4, 14*x-((5*y)/2)-((37*z)/2)-(37/4), ((87*x)/4)+((93*y)/4)+((85*z)/4)-(37/4))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $4 x^2+7 x-8$", + "Output Answer": [ + "$4 \\left(x+\\frac{7}{8}\\right)^2-\\frac{177}{16}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (4*x**2+7*x-8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{35}{9}$, and $a_n=a_{n-1}+\\frac{25}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$\\frac{6620}{3}$" + ], + "Output Program": [ + "a = -(35/9) # initial value\nd = (25/3) # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(35/9) # initial value\nd = (25/3) # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{19 x^2}{2}-\\frac{11 x}{2}-\\frac{11}{2}$", + "Output Answer": [ + "$x=\\frac{1}{38} \\left(-11-i \\sqrt{715}\\right)\\lor x=\\frac{1}{38} \\left(-11+i \\sqrt{715}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((19*x**2)/2)-((11*x)/2)-(11/2), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=24 t+5 \\sqrt{2}-132, x(t)=2 \\sqrt{2} t-11 \\sqrt{2}$", + "Output Answer": [ + "$y=6 \\sqrt{2} x+5 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 24*t+5*sqrt(2)-132\nx_t = 2*sqrt(2)*t-11*sqrt(2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{17}{2} e^{-\\frac{31 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $\\frac{17}{2}$\nArgument: $-\\frac{31 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (17/2)*math.e**(-((31*i*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 4-24 x| =25$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{8}\\right\\},\\left\\{x\\to \\frac{29}{24}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(4-24*x), 25), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{225 x^2-262 x-91}{-90 x^2+13 x+169}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{25}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((225*x**2-262*x-91)/(-90*x**2+13*x+169)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{25 x}{3}-\\frac{67}{3}\\right| =20$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7}{25}\\right\\},\\left\\{x\\to \\frac{127}{25}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((25*x)/3)-(67/3)), 20), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -x^2+4 x+14$, $q(x) = 2 \\left(5 x^2-x-6\\right)$", + "Output Answer": [ + "$9 x^2+2 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**2+4*x+14\nq = 2*(5*x**2-x-6)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$10 y-20 z-25=0$, $-8 x-21 y-21 z+14=0$, $19 x+13 y-5 z+15=0$", + "Output Answer": [ + "$x=-\\frac{104}{49}$, $y=\\frac{3739}{2058}$, $z=-\\frac{703}{2058}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((10*y-20*z-25, -8*x-21*y-21*z+14, 19*x+13*y-5*z+15)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-6 x^2-12 x$", + "Output Answer": [ + "$6-6 (x+1)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-6*x**2-12*x), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{25-9}{13}+14\\right)^2+(23+17)$.", + "Output Answer": [ + "$\\frac{45964}{169}$" + ], + "Output Program": [ + "try: \n print((((25-9)/13)+14)**2+(23+17))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{x^2}{2}-\\frac{9 x}{2}-\\frac{7}{2}$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(9-\\sqrt{109}\\right)\\lor x=\\frac{1}{2} \\left(9+\\sqrt{109}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((x**2)/2)-((9*x)/2)-(7/2), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $3 x-5 y^2-2 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $3 x-5 y^2-2 y=-8$\nVertex: $\\left\\{-\\frac{41}{15},-\\frac{1}{5}\\right\\}$\nDirectrix: $x=-\\frac{173}{60}$\nFocal Parameter: $\\frac{3}{10}$\nFocus: $\\left\\{-\\frac{31}{12},-\\frac{1}{5}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x-5*y**2-2*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\sqrt{3} \\left(\\cos \\left(\\frac{13}{9}\\right)+i \\sin \\left(\\frac{13}{9}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$19683 \\left(\\cos \\left(\\frac{26}{3}\\right)+i \\sin \\left(\\frac{26}{3}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*math.sqrt(3)*(math.cos((13/9))+1j*math.sin((13/9))))**6)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\sqrt{3} x^2-\\frac{x}{\\sqrt{3}}+\\frac{13}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(\\frac{\\sqrt{157}}{3}-\\frac{1}{3}\\right)\\lor x=\\frac{1}{2} \\left(-\\frac{1}{3}-\\frac{\\sqrt{157}}{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-sqrt(3)*x**2-(x/(sqrt(3)))+(13/(sqrt(3))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{17}{2}-\\frac{19 x}{2}}+\\sqrt{-4 x-\\frac{27}{2}}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -50+14 \\sqrt{10}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((17/2)-((19*x)/2))+sqrt(-4*x-(27/2)), 11), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-5 x^2+5 x+5 y^2-y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(y-\\frac{1}{10}\\right)^2-5 \\left(x-\\frac{1}{2}\\right)^2=\\frac{24}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & \\frac{1}{10} \\left(1-8 \\sqrt{3}\\right) \\\\\n \\frac{1}{2} & \\frac{1}{10} \\left(1+8 \\sqrt{3}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{10} \\left(1-8 \\sqrt{3}\\right)+\\frac{1}{10} \\left(1+8 \\sqrt{3}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3}{5}-x,y=x-\\frac{2}{5}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-5*x**2+5*x+5*y**2-y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-6 e^{\\frac{71 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $6$\nArgument: $-\\frac{109 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -6*math.e**((71*i*math.pi)/180)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2+121 \\sqrt{3} x+792$", + "Output Answer": [ + "$-11 \\left(-x-3 \\sqrt{3}\\right) \\left(x+8 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2+121*sqrt(3)*x+792, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\tan \\left(4 x^4+4\\right)$ at the point $x=-4$", + "Output Answer": [ + "$\\tan (1028) = 0.841$" + ], + "Output Program": [ + "import math\n\nx = -4\ntry: \n f = math.tan(4*x**4+4)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{28}{3} \\left(\\cos \\left(\\frac{59}{45}\\right)+i \\sin \\left(\\frac{59}{45}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$\\frac{232218265089212416 \\left(\\cos \\left(\\frac{236}{15}\\right)+i \\sin \\left(\\frac{236}{15}\\right)\\right)}{531441}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((28/3)*(math.cos((59/45))+1j*math.sin((59/45))))**12)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sin (8-5 x)$ at the point $x=-2$", + "Output Answer": [ + "$\\sin (18) = -0.751$" + ], + "Output Program": [ + "import math\n\nx = -2\ntry: \n f = math.sin(8-5*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = x^2+x+10$ and $q(x) = 11 x^2+x+9$", + "Output Answer": [ + "$11 x^4+12 x^3+120 x^2+19 x+90$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = x**2+x+10\nq = 11*x**2+x+9\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\left(-\\cos \\left(\\frac{\\pi }{9}\\right)-i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1024 \\left(-\\cos \\left(\\frac{\\pi }{9}\\right)-i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*(-math.cos((math.pi/9))-1j*math.sin((math.pi/9))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{240 x^3+390 x^2-285 x-495}{300 x^2+150 x-450}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(-1-\\sqrt{353}\\right)\\right\\},\\left\\{x\\to \\frac{1}{16} \\left(-1+\\sqrt{353}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((240*x**3+390*x**2-285*x-495)/(300*x**2+150*x-450)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{192 x^3+272 x^2+272 x+80}{-144 x^2-612 x-230}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((192*x**3+272*x**2+272*x+80)/(-144*x**2-612*x-230)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -8 \\sqrt{5} x-6 \\sqrt{5}\\right| =9 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{15}{8}\\right\\},\\left\\{x\\to \\frac{3}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-8*sqrt(5)*x-6*sqrt(5)), 9*sqrt(5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{15-9}{11}-20\\right)+(10+8)^2$.", + "Output Answer": [ + "$\\frac{3350}{11}$" + ], + "Output Program": [ + "try: \n print((((15-9)/11)-20)+(10+8)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -4, q(x) = (7 x+4)^2$", + "Output Answer": [ + "$49 x^2+56 x+12$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4\nq = (7*x+4)**2\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(3-5 i) \\sqrt{3}$ and $y=(3+3 i) \\sqrt{3}$", + "Output Answer": [ + "$(6-2 i) \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (3-5*i)*math.sqrt(3)\ny = (3+3*i)*math.sqrt(3)\nprint(x+y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (9, 5, 8)$", + "Output Answer": [ + "$\\left\\{\\sqrt{170},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{53}{2}}}{4}\\right),\\tan ^{-1}\\left(\\frac{5}{9}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 9\ny = 5\nz = 8\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-8.1-1.9 i$.", + "Output Answer": [ + "Norm: $8.31986$\nArgument: $-2.91119$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -8.1-1.9*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-1$ and $3 x^4-2 x^3-2 x^2-4 x-4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-1, 3*x**4-2*x**3-2*x**2-4*x-4))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $6 x^2+2 x-4$", + "Output Answer": [ + "$x=\\frac{2}{3}\\lor x=-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(6*x**2+2*x-4, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2-22 x+117$", + "Output Answer": [ + "$(x-13) (x-9)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2-22*x+117, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{17 x}{\\sqrt{3}}-9 \\sqrt{3} y-\\frac{25 z}{\\sqrt{3}}+\\frac{4}{\\sqrt{3}}=0$, $\\frac{2 x}{\\sqrt{3}}+\\frac{5 y}{\\sqrt{3}}-\\frac{8 z}{\\sqrt{3}}-6 \\sqrt{3}=0$, $-\\frac{32 x}{\\sqrt{3}}-\\frac{17 y}{\\sqrt{3}}-\\frac{10 z}{\\sqrt{3}}+\\frac{1}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{103}{444}$, $y=\\frac{9325}{6882}$, $z=-\\frac{20111}{13764}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((17*x)/(sqrt(3)))-9*sqrt(3)*y-((25*z)/(sqrt(3)))+(4/(sqrt(3))), ((2*x)/(sqrt(3)))+((5*y)/(sqrt(3)))-((8*z)/(sqrt(3)))-6*sqrt(3), -((32*x)/(sqrt(3)))-((17*y)/(sqrt(3)))-((10*z)/(sqrt(3)))+(1/(sqrt(3))))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4096 x^4, q(x) = (7-6 x)^2$", + "Output Answer": [ + "$4096 x^4+36 x^2-84 x+49$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4096*x**4\nq = (7-6*x)**2\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(-\\sin \\left(\\frac{8 \\pi }{45}\\right)-i \\cos \\left(\\frac{8 \\pi }{45}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$1953125 \\left(\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(1-\\sqrt{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(-math.sin(((8*math.pi)/45))-1j*math.cos(((8*math.pi)/45))))**9)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{74 x}{5}-\\frac{89}{5}\\right| =\\frac{78}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{167}{74}\\right\\},\\left\\{x\\to -\\frac{11}{74}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((74*x)/5)-(89/5)), (78/5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{240 x^3+\\frac{952 x^2}{3}-\\frac{1187 x}{3}-\\frac{697}{3}}{-192 x^2-\\frac{1172 x}{3}-\\frac{425}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{40} \\left(-17-\\sqrt{3569}\\right)\\right\\},\\left\\{x\\to \\frac{1}{40} \\left(-17+\\sqrt{3569}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((240*x**3+((952*x**2)/3)-((1187*x)/3)-(697/3))/(-192*x**2-((1172*x)/3)-(425/3))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{10 x^2}{\\sqrt{3}}-6 \\sqrt{3} x$ and $q(x) = -\\frac{23 x^2}{\\sqrt{3}}+8 \\sqrt{3} x+\\frac{20}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{230 x^4}{3}+218 x^3-\\frac{232 x^2}{3}-120 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((10*x**2)/(sqrt(3)))-6*sqrt(3)*x\nq = -((23*x**2)/(sqrt(3)))+8*sqrt(3)*x+(20/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{16} (8 x+17)^4, q(x) = \\frac{125}{8} (2 x-3)^3$", + "Output Answer": [ + "$256 x^4+2301 x^3+\\frac{12747 x^2}{2}+\\frac{42679 x}{4}+\\frac{76771}{16}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/16)*(8*x+17)**4\nq = (125/8)*(2*x-3)**3\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\sqrt{3} x^2+4 \\sqrt{3} x+6 \\sqrt{3}$ and $q(x) = -8 \\sqrt{3} x^2+2 \\sqrt{3} x+8 \\sqrt{3}$", + "Output Answer": [ + "$-24 x^4-90 x^3-96 x^2+132 x+144$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = sqrt(3)*x**2+4*sqrt(3)*x+6*sqrt(3)\nq = -8*sqrt(3)*x**2+2*sqrt(3)*x+8*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{175 t}{16}+\\frac{191}{2}, x(t)=-\\frac{7 t}{4}-15$", + "Output Answer": [ + "$y=\\frac{7}{4}-\\frac{25 x}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = ((175*t)/16)+(191/2)\nx_t = -((7*t)/4)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\cos \\left(\\frac{7}{45}\\right)+i \\sin \\left(\\frac{7}{45}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$16807 \\left(\\cos \\left(\\frac{7}{9}\\right)+i \\sin \\left(\\frac{7}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.cos((7/45))+1j*math.sin((7/45))))**5)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2+5 x+8 y^2-5 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y-\\frac{5}{16}\\right)^2-9 \\left(x-\\frac{5}{18}\\right)^2=-\\frac{263}{288}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{144} \\left(40-\\sqrt{4471}\\right) & \\frac{5}{16} \\\\\n \\frac{1}{144} \\left(40+\\sqrt{4471}\\right) & \\frac{5}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{17}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{144} \\left(40-\\sqrt{4471}\\right)+\\frac{1}{144} \\left(40+\\sqrt{4471}\\right)\\right),\\frac{5}{16}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3 x}{2 \\sqrt{2}}-\\frac{5}{48} \\left(2 \\sqrt{2}-3\\right),y=\\frac{5}{48} \\left(3+2 \\sqrt{2}\\right)-\\frac{3 x}{2 \\sqrt{2}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2+5*x+8*y**2-5*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left((22-8)^2-7\\right)-16\\right)+17\\right)-\\left(\\left(\\frac{25}{6}+3\\right)-4\\right)$.", + "Output Answer": [ + "$\\frac{1121}{6}$" + ], + "Output Program": [ + "try: \n print(((((22-8)**2-7)-16)+17)-(((25/6)+3)-4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$8 x-13 y-3 z+5=0$, $10 x-14 y-4 z-14=0$, $9 x+5 y+3 z+2=0$", + "Output Answer": [ + "$x=\\frac{213}{77}$, $y=\\frac{520}{77}$, $z=-\\frac{1557}{77}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((8*x-13*y-3*z+5, 10*x-14*y-4*z-14, 9*x+5*y+3*z+2)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sqrt{x^2-7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$-\\sqrt{y^2+7}\\text{ if }y>0$}\\right\\},\\left\\{x\\to \\fbox{$\\sqrt{y^2+7}\\text{ if }y>0$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, sqrt(x**2-7))\nprint(solve(f, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2+4 y^2+2 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(y+\\frac{1}{4}\\right)^2-7 x^2=\\frac{21}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n 0 & \\frac{1}{4} \\left(-1-\\sqrt{33}\\right) \\\\\n 0 & \\frac{1}{4} \\left(\\sqrt{33}-1\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{11}{7}}$\nCenter: $\\left\\{0,\\frac{1}{2} \\left(\\frac{1}{4} \\left(-1-\\sqrt{33}\\right)+\\frac{1}{4} \\left(\\sqrt{33}-1\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\frac{\\sqrt{7} x}{2}-\\frac{1}{4},y=\\frac{\\sqrt{7} x}{2}-\\frac{1}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2+4*y**2+2*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-4.-1.4 i$.", + "Output Answer": [ + "Norm: $4.23792$\nArgument: $-2.80492$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -4.-1.4*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-x-20 y+11=0$, $-13 x+25 y+22=0$", + "Output Answer": [ + "$x=\\frac{143}{57}$, $y=\\frac{121}{285}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-x-20*y+11, -13*x+25*y+22), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{1}{4} \\left(\\cos \\left(\\frac{71}{90}\\right)+i \\sin \\left(\\frac{71}{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$\\frac{\\cos \\left(\\frac{781}{90}\\right)+i \\sin \\left(\\frac{781}{90}\\right)}{4194304}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((1/4)*(math.cos((71/90))+1j*math.sin((71/90))))**11)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+4 x+5 y^2+8 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $7 \\left(x+\\frac{2}{7}\\right)^2+5 \\left(y+\\frac{4}{5}\\right)^2=\\frac{342}{35}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{7} & -\\frac{2}{35} \\left(14+3 \\sqrt{19}\\right) \\\\\n -\\frac{2}{7} & \\frac{6 \\sqrt{19}}{35}-\\frac{4}{5} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{7}}$\nCenter: $\\left\\{-\\frac{2}{7},\\frac{1}{2} \\left(-\\frac{4}{5}+\\frac{6 \\sqrt{19}}{35}-\\frac{2}{35} \\left(14+3 \\sqrt{19}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{342 \\pi }{35 \\sqrt{35}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+4*x+5*y**2+8*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^4-4 x^3-6 x^2+9 x-5$ when divided by $-4$.", + "Output Answer": [ + "$2 x^4+x^3+\\frac{3 x^2}{2}-\\frac{9 x}{4}+\\frac{5}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**4-4*x**3-6*x**2+9*x-5\nq = -4\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 12 x+15| =23$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{19}{6}\\right\\},\\left\\{x\\to \\frac{2}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(12*x+15), 23), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $(-12+2 i) \\log (2)$.", + "Output Answer": [ + "Norm: $2 \\sqrt{37} \\log (2)$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{1}{6}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (-12+2*i)*math.log(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $9 e^{\\frac{103 i \\pi }{180}} \\log (2)$.", + "Output Answer": [ + "Norm: $9 \\log (2)$\nArgument: $\\frac{103 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 9*math.e**((103*i*math.pi)/180)*math.log(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{8 e^{\\frac{131 i \\pi }{180}}}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $\\frac{8}{\\sqrt{\\pi }}$\nArgument: $\\frac{131 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((8*math.e**((131*i*math.pi)/180))/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 18-8 x| =25$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{8}\\right\\},\\left\\{x\\to \\frac{43}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(18-8*x), 25), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2-55 x-1144$", + "Output Answer": [ + "$11 (x-13) (x+8)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2-55*x-1144, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -9 x^2+7 x+3$, $q(x) = 4 x^2+7 x-14$", + "Output Answer": [ + "$-5 x^2+14 x-11$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**2+7*x+3\nq = 4*x**2+7*x-14\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $x^4-7 x^3-x$ when divided by $7 x^3-10 x^2-6 x+6$.", + "Output Answer": [ + "$\\frac{x}{7}-\\frac{39}{49}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**4-7*x**3-x\nq = 7*x**3-10*x**2-6*x+6\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{14-11 i}{\\sqrt{3}}$ and $y=\\frac{14-6 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{131}{116}+\\frac{35 i}{116}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((14-11*i)/(math.sqrt(3)))\ny = ((14-6*i)/(math.sqrt(3)))\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-5 \\sqrt{2} x^2+10 \\sqrt{2} x+10 \\sqrt{2}$", + "Output Answer": [ + "$15 \\sqrt{2}-5 \\sqrt{2} (x-1)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-5*math.sqrt(2)*x**2+10*math.sqrt(2)*x+10*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{61}{5}$, and $a_n=a_{n-1}+-\\frac{3}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$-\\frac{2167}{10}$" + ], + "Output Program": [ + "a = -(61/5) # initial value\nd = -(3/2) # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(61/5) # initial value\nd = -(3/2) # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-6 x+2 y-24=0$, $-24 x-3 y-14=0$", + "Output Answer": [ + "$x=-\\frac{50}{33}$, $y=\\frac{82}{11}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-6*x+2*y-24, -24*x-3*y-14), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-10 x^2-4 x+13$", + "Output Answer": [ + "$x=\\frac{1}{10} \\left(-2-\\sqrt{134}\\right)\\lor x=\\frac{1}{10} \\left(\\sqrt{134}-2\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-10*x**2-4*x+13, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2-5 x+5 y^2+7 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(y+\\frac{7}{10}\\right)^2-7 \\left(x+\\frac{5}{14}\\right)^2=\\frac{459}{70}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{14} & -\\frac{7}{10}-\\frac{9 \\sqrt{34}}{35} \\\\\n -\\frac{5}{14} & \\frac{9 \\sqrt{34}}{35}-\\frac{7}{10} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{3}{7}}$\nCenter: $\\left\\{-\\frac{5}{14},-\\frac{7}{10}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{70} \\left(-49-5 \\sqrt{35}\\right)-\\sqrt{\\frac{7}{5}} x,y=\\sqrt{\\frac{7}{5}} x+\\frac{1}{70} \\left(5 \\sqrt{35}-49\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2-5*x+5*y**2+7*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{3} \\left(-19 x^2-36 x+32\\right)$, $q(x) = \\frac{16 x^2}{3}+8 x-\\frac{19}{3}$", + "Output Answer": [ + "$-x^2-4 x+\\frac{13}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/3)*(-19*x**2-36*x+32)\nq = ((16*x**2)/3)+8*x-(19/3)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{-6 x^4-3} \\sin (4-4 x)$ at the point $x=5$", + "Output Answer": [ + "$3 \\sqrt[3]{139} \\sin (16) = -4.474$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 5\ntry: \n f = np.cbrt(-6*x**4-3)*math.sin(4-4*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{69}{41}$, and $a_n=a_{n-1}+-\\frac{9}{4}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=12$.", + "Output Answer": [ + "$-\\frac{13833}{82}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(69/41) # initial value\nd = -(9/4) # second term\nn = 12 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(69/41) # initial value\nd = -(9/4) # second term\nn = 12 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $15 x^2+4 x-5$", + "Output Answer": [ + "$x=\\frac{1}{15} \\left(-2-\\sqrt{79}\\right)\\lor x=\\frac{1}{15} \\left(\\sqrt{79}-2\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(15*x**2+4*x-5, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{75}{59}$, and $a_n=a_{n-1}+-3$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$-\\frac{28431}{59}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(75/59) # initial value\nd = -3 # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(75/59) # initial value\nd = -3 # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{14}{5}-14\\right) \\frac{7-18}{11}$.", + "Output Answer": [ + "$\\frac{56}{5}$" + ], + "Output Program": [ + "try: \n print(((14/5)-14)*((7-18)/11))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=e^{4 x-5}-1$ at the point $x=3$", + "Output Answer": [ + "$-1+e^7 = 1095.63$" + ], + "Output Program": [ + "import math\n\nx = 3\ntry: \n f = math.e**(4*x-5)-1\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3$ and $5 x^3+2 x^2+5 x+3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3, 5*x**3+2*x**2+5*x+3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{2 \\sqrt{3} x^2+11 \\sqrt{3} x}{3 \\sqrt{3} x+11 \\sqrt{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{11}{2}\\right\\},\\{x\\to 0\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((2*sqrt(3)*x**2+11*sqrt(3)*x)/(3*sqrt(3)*x+11*sqrt(3))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{1}{14} ((4+17)-20)-(5+6)$.", + "Output Answer": [ + "$-\\frac{153}{14}$" + ], + "Output Program": [ + "try: \n print((1/14)*((4+17)-20)-(5+6))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-12 x^2+\\frac{16 x}{3}+8$", + "Output Answer": [ + "$x=\\frac{1}{9} \\left(2-\\sqrt{58}\\right)\\lor x=\\frac{1}{9} \\left(2+\\sqrt{58}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-12*x**2+((16*x)/3)+8, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$60466176 \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*(math.cos(((2*math.pi)/9))-1j*math.sin(((2*math.pi)/9))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^2+2$ when divided by $8 x^2-x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**2+2\nq = 8*x**2-x-3\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+x-2 y^2+6 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x+\\frac{1}{6}\\right)^2-2 \\left(y-\\frac{3}{2}\\right)^2=-\\frac{125}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{6} & \\frac{3}{2}-\\frac{25}{6 \\sqrt{2}} \\\\\n -\\frac{1}{6} & \\frac{3}{2}+\\frac{25}{6 \\sqrt{2}} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{3}}$\nCenter: $\\left\\{-\\frac{1}{6},\\frac{3}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{12} \\left(18-\\sqrt{6}\\right)-\\sqrt{\\frac{3}{2}} x,y=\\sqrt{\\frac{3}{2}} x+\\frac{1}{12} \\left(18+\\sqrt{6}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+x-2*y**2+6*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-230 x^3+291 x^2+300 x-221}{-80 x^2+6 x+221}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to -1\\},\\left\\{x\\to \\frac{13}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-230*x**3+291*x**2+300*x-221)/(-80*x**2+6*x+221)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-6 x^2-8 x+3}{8-21 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(-4-\\sqrt{34}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(-4+\\sqrt{34}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-6*x**2-8*x+3)/(8-21*x)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+4 x+10 y^2-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x+\\frac{1}{2}\\right)^2+10 y^2=5$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} \\left(-1-\\sqrt{3}\\right) & 0 \\\\\n \\frac{1}{2} \\left(\\sqrt{3}-1\\right) & 0 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{2} \\left(-1-\\sqrt{3}\\right)+\\frac{1}{2} \\left(\\sqrt{3}-1\\right)\\right),0\\right\\}$\nArea Enclosed: $\\frac{1}{2} \\sqrt{\\frac{5}{2}} \\pi$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+4*x+10*y**2-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-8 x-1}+\\sqrt{-4 x-1}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 4 \\left(-12+\\sqrt{127}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-8*x-1)+sqrt(-4*x-1), 8), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{24}{37}$, and $a_n=a_{n-1}+-\\frac{59}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$-\\frac{172458}{259}$" + ], + "Output Program": [ + "a = -(24/37) # initial value\nd = -(59/7) # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(24/37) # initial value\nd = -(59/7) # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+132 x+1463$", + "Output Answer": [ + "$-11 (x-19) (x+7)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+132*x+1463, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{49}{5} \\left(\\left(\\frac{1}{2}-\\frac{i}{2}\\right) \\sqrt{\\frac{3}{2}}+\\frac{\\frac{1}{2}+\\frac{i}{2}}{\\sqrt{2}}\\right)$.", + "Output Answer": [ + "Norm: $\\frac{49}{5} \\sqrt{\\left(\\frac{1}{2 \\sqrt{2}}-\\frac{\\sqrt{\\frac{3}{2}}}{2}\\right)^2+\\left(\\frac{\\sqrt{\\frac{3}{2}}}{2}+\\frac{1}{2 \\sqrt{2}}\\right)^2}$\nArgument: $\\pi +\\tan ^{-1}\\left(\\frac{\\frac{\\sqrt{\\frac{3}{2}}}{2}-\\frac{1}{2 \\sqrt{2}}}{-\\frac{\\sqrt{\\frac{3}{2}}}{2}-\\frac{1}{2 \\sqrt{2}}}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(49/5)*(((1/2)-(i/2))*math.sqrt((3/2))+(((1/2)+(i/2))/(math.sqrt(2))))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-3 x^2+11 x-20}{8-25 x}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-3*x**2+11*x-20)/(8-25*x)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-0.8+5.1 i$.", + "Output Answer": [ + "Norm: $5.16236$\nArgument: $1.72639$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -0.8+5.1*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 5 x+2| =-\\frac{65}{3}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(5*x+2), -(65/3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $1$ and $-3 x^2-4 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(1, -3*x**2-4*x-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-6 t+\\frac{1}{\\sqrt{3}}+\\frac{52}{3}, x(t)=3 \\sqrt{3} t-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=\\frac{1}{\\sqrt{3}}-\\frac{2 x}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -6*t+(1/(sqrt(3)))+(52/3)\nx_t = 3*sqrt(3)*t-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{4}-\\frac{9 x}{2}, q(x) = \\frac{1}{16} (13 x+14)^4$", + "Output Answer": [ + "$\\frac{28561 x^4}{16}+\\frac{15379 x^3}{2}+\\frac{24843 x^2}{2}+\\frac{17827 x}{2}+\\frac{9605}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/4)-((9*x)/2)\nq = (1/16)*(13*x+14)**4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{5 x^2}{3}-\\frac{37 x}{3}-6$", + "Output Answer": [ + "$\\frac{1009}{60}-\\frac{5}{3} \\left(x+\\frac{37}{10}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((5*x**2)/3)-((37*x)/3)-6), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\pi, 7, 3)$", + "Output Answer": [ + "$\\left\\{\\sqrt{58+\\pi ^2},\\tan ^{-1}\\left(\\frac{\\sqrt{49+\\pi ^2}}{3}\\right),\\tan ^{-1}\\left(\\frac{7}{\\pi }\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.pi\ny = 7\nz = 3\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$-\\frac{343 x^3}{27}$", + "Output Answer": [ + "$-\\frac{81 \\left(x+\\frac{21952}{27}\\right)^2}{120472576}-\\frac{9 \\left(x+\\frac{21952}{27}\\right)}{5488}+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, -((343*x**3)/27))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2 x^6-x^5+11 x^4-6 x^3+3 x^2+9 x-20$ and $2 x^4-x^3+x-4$.", + "Output Answer": [ + "$2 x^4-x^3+x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2*x**6-x**5+11*x**4-6*x**3+3*x**2+9*x-20, 2*x**4-x**3+x-4))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -9 x^2-12 x-14$ and $q(x) = -5 x^2-8 x+15$", + "Output Answer": [ + "$45 x^4+132 x^3+31 x^2-68 x-210$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -9*x**2-12*x-14\nq = -5*x**2-8*x+15\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{37}{7}-\\frac{12 x}{7}}+\\sqrt{\\frac{97 x}{7}+\\frac{95}{7}}=\\frac{22}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-3114-44 \\sqrt{3044851}}{83167}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((37/7)-((12*x)/7))+sqrt(((97*x)/7)+(95/7)), (22/7)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-6 x+3 y+16 z+24=0$, $-22 x+21 y-4 z-22=0$, $25 x-y+24 z+8=0$", + "Output Answer": [ + "$x=\\frac{2788}{2441}$, $y=\\frac{4808}{2441}$, $z=-\\frac{7035}{4882}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-6*x+3*y+16*z+24, -22*x+21*y-4*z-22, 25*x-y+24*z+8)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{7 x}{5}+\\frac{14}{5}}+\\sqrt{\\frac{19 x}{5}-\\frac{54}{5}}=\\frac{16}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{45} \\left(671-8 \\sqrt{4543}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((7*x)/5)+(14/5))+sqrt(((19*x)/5)-(54/5)), (16/5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^4-5 x^3-x^2+2 x-8$ when divided by $-3 x^2+5 x-4$.", + "Output Answer": [ + "$\\frac{7 x^2}{3}+\\frac{50 x}{9}+\\frac{175}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**4-5*x**3-x**2+2*x-8\nq = -3*x**2+5*x-4\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2-x-2$", + "Output Answer": [ + "$-((2-x) (x+1))$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2-x-2, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+x-9 y^2-9 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x+\\frac{1}{6}\\right)^2-9 \\left(y+\\frac{1}{2}\\right)^2=\\frac{35}{6}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{18} \\left(-3-2 \\sqrt{210}\\right) & -\\frac{1}{2} \\\\\n \\frac{1}{18} \\left(2 \\sqrt{210}-3\\right) & -\\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{18} \\left(-3-2 \\sqrt{210}\\right)+\\frac{1}{18} \\left(2 \\sqrt{210}-3\\right)\\right),-\\frac{1}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{3}}+\\frac{1}{18} \\left(\\sqrt{3}-9\\right),y=\\frac{1}{18} \\left(-9-\\sqrt{3}\\right)-\\frac{x}{\\sqrt{3}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+x-9*y**2-9*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 27 (x-3)^3, q(x) = -4 x$", + "Output Answer": [ + "$27 x^3-243 x^2+725 x-729$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 27*(x-3)**3\nq = -4*x\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{9}{49} (5 t+179)^2, x(t)=-\\frac{3 t}{7}-15$", + "Output Answer": [ + "$y=25 x^2-\\frac{120 x}{7}+\\frac{144}{49}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (9/49)*(5*t+179)**2\nx_t = -((3*t)/7)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{24 x^2+17 x-21}{20 x+6}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{48} \\left(-17-\\sqrt{2305}\\right)\\right\\},\\left\\{x\\to \\frac{1}{48} \\left(-17+\\sqrt{2305}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((24*x**2+17*x-21)/(20*x+6)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{264 x^2-\\frac{1535 x}{2}+\\frac{1739}{4}}{99 x^2+25 x-\\frac{2021}{4}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{37}{48}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((264*x**2-((1535*x)/2)+(1739/4))/(99*x**2+25*x-(2021/4))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -12.24 x^2+6.6 x-13.44$, $q(x) = 5.81 x^2+1.98 x+5.33$", + "Output Answer": [ + "$-6.43 x^2+8.58 x-8.11$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -12.24*x**2+6.6*x-13.44\nq = 5.81*x**2+1.98*x+5.33\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{17}{5}$ and $-\\frac{13 x^2}{5}+\\frac{16 x}{5}-\\frac{19}{5}$.", + "Output Answer": [ + "$\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-(17/5), -((13*x**2)/5)+((16*x)/5)-(19/5)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the eighth order series of the inverse of the following function around 8:\n$\\sqrt{2} \\sqrt{-x}$", + "Output Answer": [ + "$-\\frac{1}{2} (x-2)^2-2 (x-2)-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, sqrt(2)*sqrt(-x))\nprint(solve(f, x)[0].series(y, 8, 6))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{5+10 i}{\\sqrt{3}}$ and $y=(-3-2 i) \\sqrt{3}$", + "Output Answer": [ + "$-\\frac{35}{39}-\\frac{20 i}{39}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((5+10*i)/(math.sqrt(3)))\ny = (-3-2*i)*math.sqrt(3)\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-2 x+16 z-3=0$, $-11 x+11 y-12 z+10=0$, $20 x+15 y-22 z+18=0$", + "Output Answer": [ + "$x=-\\frac{97}{1006}$, $y=-\\frac{819}{1006}$, $z=\\frac{353}{2012}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-2*x+16*z-3, -11*x+11*y-12*z+10, 20*x+15*y-22*z+18)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-6$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$1104$" + ], + "Output Program": [ + "a = -6 # initial value\nd = 10 # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -6 # initial value\nd = 10 # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{12}{7}-\\frac{44 i}{7}$ and $y=-\\frac{53}{7}+3 i$", + "Output Answer": [ + "$\\frac{288}{49}+\\frac{2584 i}{49}$" + ], + "Output Program": [ + "i = 1j\nx = (12/7)-((44*i)/7)\ny = -(53/7)+3*i\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2-8 x-5 y^2+2 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(x-\\frac{2}{5}\\right)^2-5 \\left(y-\\frac{1}{5}\\right)^2=\\frac{2}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{5} \\left(2-\\sqrt{3}\\right) & \\frac{1}{5} \\\\\n \\frac{1}{5} \\left(2+\\sqrt{3}\\right) & \\frac{1}{5} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{5} \\left(2-\\sqrt{3}\\right)+\\frac{1}{5} \\left(2+\\sqrt{3}\\right)\\right),\\frac{1}{5}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{2} x+\\frac{1}{5} \\left(1-2 \\sqrt{2}\\right),y=\\frac{1}{5} \\left(1+2 \\sqrt{2}\\right)-\\sqrt{2} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2-8*x-5*y**2+2*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{5} (2-3 x) x$, $q(x) = -\\sqrt{5} \\left(x^2+5 x+1\\right)$", + "Output Answer": [ + "$-4 \\sqrt{5} x^2-3 \\sqrt{5} x-\\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(5)*(2-3*x)*x\nq = -sqrt(5)*(x**2+5*x+1)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\sqrt{5}, 7, \\frac{1}{4})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{865}}{4},\\tan ^{-1}\\left(12 \\sqrt{6}\\right),\\tan ^{-1}\\left(\\frac{7}{\\sqrt{5}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.sqrt(5)\ny = 7\nz = (1/4)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{12-i}{\\sqrt{2}}$ and $y=-\\frac{9-13 i}{\\sqrt{2}}$", + "Output Answer": [ + "$-\\frac{121}{250}-\\frac{147 i}{250}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((12-i)/(math.sqrt(2)))\ny = -((9-13*i)/(math.sqrt(2)))\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\sqrt{3} x^2+\\sqrt{3} x+6 \\sqrt{3}$", + "Output Answer": [ + "$\\frac{25 \\sqrt{3}}{4}-\\sqrt{3} \\left(x-\\frac{1}{2}\\right)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-math.sqrt(3)*x**2+math.sqrt(3)*x+6*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{x^2}{2}-\\frac{15 x}{2}-\\frac{1}{2}$", + "Output Answer": [ + "$\\frac{1}{2} \\left(x-\\frac{15}{2}\\right)^2-\\frac{229}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((x**2)/2)-((15*x)/2)-(1/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $9 x^2+144 x+\\frac{1863}{4}$", + "Output Answer": [ + "$9 \\left(-x-\\frac{23}{2}\\right) \\left(-x-\\frac{9}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(9*x**2+144*x+(1863/4), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-8 \\sqrt{3} x^2-13 \\sqrt{3} x+13 \\sqrt{3}}{11 \\sqrt{3} x^2-\\sqrt{3} x+8 \\sqrt{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(-13-3 \\sqrt{65}\\right)\\right\\},\\left\\{x\\to \\frac{1}{16} \\left(-13+3 \\sqrt{65}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-8*sqrt(3)*x**2-13*sqrt(3)*x+13*sqrt(3))/(11*sqrt(3)*x**2-sqrt(3)*x+8*sqrt(3))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\left(-\\cos \\left(\\frac{2 \\pi }{15}\\right)+i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-16384 \\left(\\cos \\left(\\frac{\\pi }{15}\\right)+i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*(-math.cos(((2*math.pi)/15))+1j*math.sin(((2*math.pi)/15))))**7)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^3-8 x^2+9 x-4$ when divided by $2 x^3-6 x^2-10 x-8$.", + "Output Answer": [ + "$-\\frac{7}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**3-8*x**2+9*x-4\nq = 2*x**3-6*x**2-10*x-8\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2+\\frac{121 x}{2}$", + "Output Answer": [ + "$-11 \\left(-x-\\frac{11}{2}\\right) x$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2+((121*x)/2), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{(48 t+469)^2}{2401}, x(t)=-\\frac{6 t}{7}-15$", + "Output Answer": [ + "$y=\\frac{64 x^2}{49}+\\frac{848 x}{49}+\\frac{2809}{49}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (((48*t+469)**2)/2401)\nx_t = -((6*t)/7)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{7}{43}$, and $a_n=a_{n-1}+-3 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$\\frac{13}{2} \\left(\\frac{14}{43}-36 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\na = (7/43) # initial value\nd = -3*math.pi # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (7/43) # initial value\nd = -3*math.pi # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-4 \\sqrt{5} x^2-4 \\sqrt{5} x-3 \\sqrt{5}$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(-1-i \\sqrt{2}\\right)\\lor x=\\frac{1}{2} \\left(-1+i \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-4*sqrt(5)*x**2-4*sqrt(5)*x-3*sqrt(5), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -9 x^2-14 x-14$ and $q(x) = -15 x^2-13 x-1$", + "Output Answer": [ + "$135 x^4+327 x^3+401 x^2+196 x+14$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -9*x**2-14*x-14\nq = -15*x**2-13*x-1\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(20+9)-\\frac{1}{12} \\left(((25+16)-24)^2+6\\right)$.", + "Output Answer": [ + "$\\frac{53}{12}$" + ], + "Output Program": [ + "try: \n print((20+9)-(1/12)*(((25+16)-24)**2+6))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{19}{2}-8 i$ and $y=-\\frac{5}{2}+\\frac{13 i}{2}$", + "Output Answer": [ + "$-\\frac{113}{194}+\\frac{327 i}{194}$" + ], + "Output Program": [ + "i = 1j\nx = -(19/2)-8*i\ny = -(5/2)+((13*i)/2)\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^2+6 x-6$ when divided by $-3$.", + "Output Answer": [ + "$-3 x^2-2 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**2+6*x-6\nq = -3\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=0$ and $y=-5 i \\sqrt{3}$", + "Output Answer": [ + "$-5 i \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = 0\ny = -5*i*math.sqrt(3)\nprint(x+y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-6 x-5}+\\sqrt{7} \\sqrt{-x}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -463+12 \\sqrt{1477}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-6*x-5)+sqrt(7)*sqrt(-x), 6), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{35}{2}$, and $a_n=a_{n-1}+-9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$-4440$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(35/2) # initial value\nd = -9 # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(35/2) # initial value\nd = -9 # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^5+8 x^4+5 x^3-3 x^2+3 x-2$ when divided by $-2 x^4-2 x^3+10 x^2+2 x+9$.", + "Output Answer": [ + "$-4 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**5+8*x**4+5*x**3-3*x**2+3*x-2\nq = -2*x**4-2*x**3+10*x**2+2*x+9\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\sqrt{2} x-\\frac{17 y}{\\sqrt{2}}+12 \\sqrt{2}=0$, $\\frac{9 x}{\\sqrt{2}}-\\frac{33 y}{\\sqrt{2}}+16 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{248}{87}$, $y=\\frac{152}{87}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((sqrt(2)*x-((17*y)/(sqrt(2)))+12*sqrt(2), ((9*x)/(sqrt(2)))-((33*y)/(sqrt(2)))+16*sqrt(2)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-7-6 i$ and $y=-9+4 i$", + "Output Answer": [ + "$\\frac{39}{97}+\\frac{82 i}{97}$" + ], + "Output Program": [ + "i = 1j\nx = -7-6*i\ny = -9+4*i\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{26}{41}$, and $a_n=a_{n-1}+-\\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$10 \\left(\\frac{52}{41}-19 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\na = (26/41) # initial value\nd = -math.sqrt(5) # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (26/41) # initial value\nd = -math.sqrt(5) # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $8 x^2-222 x+1330$", + "Output Answer": [ + "$8 (x-19) \\left(x-\\frac{35}{4}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(8*x**2-222*x+1330, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-9 x-2 y-6 z-11=0$, $-13 x+17 y+24 z-9=0$, $18 x+19 y-14 z+6=0$", + "Output Answer": [ + "$x=-\\frac{2309}{2266}$, $y=\\frac{773}{2266}$, $z=-\\frac{1897}{4532}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-9*x-2*y-6*z-11, -13*x+17*y+24*z-9, 18*x+19*y-14*z+6)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{7}{5} \\left(\\frac{i}{4}-\\frac{i \\sqrt{5}}{4}+\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)$.", + "Output Answer": [ + "Norm: $\\frac{7}{5} \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}+\\left(\\frac{1}{4}-\\frac{\\sqrt{5}}{4}\\right)^2}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{\\frac{\\sqrt{5}}{4}-\\frac{1}{4}}{\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(7/5)*((i/4)-((i*math.sqrt(5))/4)+math.sqrt((5/8)+((math.sqrt(5))/8)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{1-19 i}{\\pi }$ and $y=\\frac{29-22 i}{\\pi }$", + "Output Answer": [ + "$\\frac{447}{1325}-\\frac{529 i}{1325}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((1-19*i)/math.pi)\ny = ((29-22*i)/math.pi)\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 6 (x-2) x$, $q(x) = -14 x-3$", + "Output Answer": [ + "$6 x^2-26 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*(x-2)*x\nq = -14*x-3\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{4 x}{5}+\\frac{31}{5}}+\\sqrt{\\frac{37 x}{5}-\\frac{69}{5}}=\\frac{57}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{49903-38 \\sqrt{715647}}{1815}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((4*x)/5)+(31/5))+sqrt(((37*x)/5)-(69/5)), (57/5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{8+12}{\\frac{1}{21} \\left(\\left((10-21)^2-24\\right)+2\\right)}$.", + "Output Answer": [ + "$\\frac{140}{33}$" + ], + "Output Program": [ + "try: \n print(((8+12)/((1/21)*(((10-21)**2-24)+2))))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-10 x^2-10 x+6$ and $-5 x^2-5 x+3$.", + "Output Answer": [ + "$5 x^2+5 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-10*x**2-10*x+6, -5*x**2-5*x+3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{184 x^3+325 x^2-39 x-54}{161 x+63}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(-11-\\sqrt{313}\\right)\\right\\},\\left\\{x\\to \\frac{1}{16} \\left(-11+\\sqrt{313}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((184*x**3+325*x**2-39*x-54)/(161*x+63)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x+8}+\\sqrt{5 x+2}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(375-11 \\sqrt{757}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x+8)+sqrt(5*x+2), 11), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{24 x^2-5 x-6}{21 x+20}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{48} \\left(5-\\sqrt{601}\\right)\\right\\},\\left\\{x\\to \\frac{1}{48} \\left(5+\\sqrt{601}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((24*x**2-5*x-6)/(21*x+20)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4$ and $x^3+2 x^2-2 x+3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4, x**3+2*x**2-2*x+3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\sin \\left(5-\\frac{7 x}{2}\\right)$ at the point $x=-5$", + "Output Answer": [ + "$-\\sin \\left(\\frac{45}{2}\\right) = 0.487$" + ], + "Output Program": [ + "import math\n\nx = -5\ntry: \n f = -math.sin(5-((7*x)/2))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $8 x^2+16 x-1792$", + "Output Answer": [ + "$-8 (-x-16) (x-14)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(8*x**2+16*x-1792, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the third order series of the inverse of the following function around 3:\n$-\\frac{125 x^3}{8}$", + "Output Answer": [ + "$-\\frac{2 (x-125)^3}{31640625}+\\frac{2 (x-125)^2}{140625}-\\frac{2 (x-125)}{375}-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, -((125*x**3)/8))\nprint(solve(f, x)[0].series(y, 3, 3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2$ and $-2 x^4-3 x^3+3 x^2-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2, -2*x**4-3*x**3+3*x**2-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $x^2-2 x+4 y^2+9 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $(x-1)^2+4 \\left(y+\\frac{9}{8}\\right)^2=\\frac{241}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n 1-\\frac{\\sqrt{723}}{8} & -\\frac{9}{8} \\\\\n \\frac{1}{8} \\left(8+\\sqrt{723}\\right) & -\\frac{9}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{3}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(1-\\frac{\\sqrt{723}}{8}+\\frac{1}{8} \\left(8+\\sqrt{723}\\right)\\right),-\\frac{9}{8}\\right\\}$\nArea Enclosed: $\\frac{241 \\pi }{32}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-2*x+4*y**2+9*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{29 x^2}{5}-\\frac{7 x}{5}+\\frac{39}{5}$", + "Output Answer": [ + "$\\frac{29}{5} \\left(x-\\frac{7}{58}\\right)^2+\\frac{895}{116}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((29*x**2)/5)-((7*x)/5)+(39/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{83}{60}$, and $a_n=a_{n-1}+-4 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$12 \\left(-\\frac{83}{30}-92 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(83/60) # initial value\nd = -4*math.sqrt(5) # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(83/60) # initial value\nd = -4*math.sqrt(5) # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{5}, 5, \\frac{1}{\\sqrt{3}})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{\\frac{1903}{3}}}{5},\\tan ^{-1}\\left(\\frac{\\sqrt{1878}}{5}\\right),\\tan ^{-1}(25)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/5)\ny = 5\nz = (1/(math.sqrt(3)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{8 \\sqrt{2} x^2+15 \\sqrt{2} x+14 \\sqrt{2}}{-11 \\sqrt{2} x-\\sqrt{2}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((8*sqrt(2)*x**2+15*sqrt(2)*x+14*sqrt(2))/(-11*sqrt(2)*x-sqrt(2))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{28}{3} \\left(\\cos \\left(\\frac{37}{90}\\right)+i \\sin \\left(\\frac{37}{90}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-\\frac{10578455953408 \\left(\\cos \\left(\\frac{37}{10}\\right)+i \\sin \\left(\\frac{37}{10}\\right)\\right)}{19683}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(28/3)*(math.cos((37/90))+1j*math.sin((37/90))))**9)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{15 x^3}{2}-\\frac{x^2}{2}+\\frac{7 x}{2}+4$ when divided by $\\frac{17}{2}-7 x$.", + "Output Answer": [ + "$\\frac{15 x^2}{14}+\\frac{269 x}{196}+\\frac{3201}{2744}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((15*x**3)/2)-((x**2)/2)+((7*x)/2)+4\nq = (17/2)-7*x\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2+\\frac{207 x}{4}+\\frac{1185}{8}$", + "Output Answer": [ + "$3 \\left(\\frac{79}{4}-x\\right) \\left(x+\\frac{5}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2+((207*x)/4)+(1185/8), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2-70 x-\\frac{935}{4}$", + "Output Answer": [ + "$5 \\left(-x-\\frac{11}{2}\\right) \\left(x+\\frac{17}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2-70*x-(935/4), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sqrt{2 x+\\frac{3}{2}}+1$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{4} \\left(2 y^2-4 y-1\\right)\\text{ if }y>1$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, sqrt(2*x+(3/2))+1)\nprint(solve(f, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{15+3 i}{\\sqrt{\\pi }}$ and $y=\\frac{16-12 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{51}{100}+\\frac{57 i}{100}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((15+3*i)/(math.sqrt(math.pi)))\ny = ((16-12*i)/(math.sqrt(math.pi)))\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2-x+8 y^2+5 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x-\\frac{1}{20}\\right)^2+8 \\left(y+\\frac{5}{16}\\right)^2=\\frac{289}{160}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{20} & -\\frac{21}{40} \\\\\n \\frac{1}{20} & -\\frac{1}{10} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{5}}$\nCenter: $\\left\\{\\frac{1}{20},-\\frac{5}{16}\\right\\}$\nArea Enclosed: $\\frac{289 \\pi }{640 \\sqrt{5}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2-x+8*y**2+5*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{7}{4}-\\frac{11 i}{4}$ and $y=\\frac{37}{4}+\\frac{33 i}{4}$", + "Output Answer": [ + "$-11-11 i$" + ], + "Output Program": [ + "i = 1j\nx = -(7/4)-((11*i)/4)\ny = (37/4)+((33*i)/4)\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $3 x^2-36 x+108$", + "Output Answer": [ + "$3 (6-x)^2$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(3*x**2-36*x+108, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=2 \\sqrt{2} \\left(50 t^2+210 t+219\\right), x(t)=50 t^2+210 t+\\frac{441}{2}$", + "Output Answer": [ + "$y=2 \\sqrt{2} x-3 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 2*sqrt(2)*(50*t**2+210*t+219)\nx_t = 50*t**2+210*t+(441/2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{2 x^2}{\\sqrt{3}}+\\frac{4 x}{\\sqrt{3}}-8 \\sqrt{3}$ and $q(x) = 8 \\sqrt{3} x^2-\\frac{4 x}{\\sqrt{3}}+\\frac{13}{\\sqrt{3}}$", + "Output Answer": [ + "$-16 x^4+\\frac{104 x^3}{3}-206 x^2+\\frac{148 x}{3}-104$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((2*x**2)/(sqrt(3)))+((4*x)/(sqrt(3)))-8*sqrt(3)\nq = 8*sqrt(3)*x**2-((4*x)/(sqrt(3)))+(13/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{1}{(7 x-5)^5}$ at the point $x=-8$", + "Output Answer": [ + "$-\\frac{1}{844596301} = 0.$" + ], + "Output Program": [ + "x = -8\ntry: \n f = (1/((7*x-5)**5))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(7-16)+(((4+11)-18)+23)$.", + "Output Answer": [ + "$11$" + ], + "Output Program": [ + "try: \n print((7-16)+(((4+11)-18)+23))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11 x+10}+\\sqrt{13 x-3}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2798}{985+9 \\sqrt{11909}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11*x+10)+sqrt(13*x-3), 9), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3-2 x$ and $-x^4-4 x^3-3 x^2+5 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3-2*x, -x**4-4*x**3-3*x**2+5*x-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{65 x}{3}+9 y+10=0$, $-19 x+4 y-19=0$", + "Output Answer": [ + "$x=-\\frac{633}{253}$, $y=-\\frac{1805}{253}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((65*x)/3)+9*y+10, -19*x+4*y-19), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{15-\\frac{25 x}{2}}+\\sqrt{2-\\frac{x}{2}}=\\frac{5}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{576} \\left(299+5 \\sqrt{3985}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(15-((25*x)/2))+sqrt(2-(x/2)), (5/2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2+78 x+\\frac{328}{5}$", + "Output Answer": [ + "$5 \\left(\\frac{82}{5}-x\\right) \\left(x+\\frac{4}{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2+78*x+(328/5), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^4-10 x^3-9 x^2-10 x-9$ when divided by $x^2+2 x-10$.", + "Output Answer": [ + "$6 x^2-22 x+95$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**4-10*x**3-9*x**2-10*x-9\nq = x**2+2*x-10\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 11 x^2-4 x+12$ and $q(x) = -10 x^2-10 x-14$", + "Output Answer": [ + "$-110 x^4-70 x^3-234 x^2-64 x-168$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 11*x**2-4*x+12\nq = -10*x**2-10*x-14\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-7 x^2-13 x+14$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(-13-\\sqrt{561}\\right)\\lor x=\\frac{1}{14} \\left(\\sqrt{561}-13\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-7*x**2-13*x+14, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -x^2-5 x-1$, $q(x) = -7 x^2+14 x-8$", + "Output Answer": [ + "$-8 x^2+9 x-9$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**2-5*x-1\nq = -7*x**2+14*x-8\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3$ and $-\\frac{3 x^2}{2}-2 x-1$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3, -((3*x**2)/2)-2*x-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{(9-24)+1}{\\left(\\frac{1}{24}-5\\right)+21}$.", + "Output Answer": [ + "$-\\frac{48}{55}$" + ], + "Output Program": [ + "try: \n print((((9-24)+1)/(((1/24)-5)+21)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2-3 x-4 y^2+y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x-\\frac{3}{14}\\right)^2-4 \\left(y-\\frac{1}{8}\\right)^2=\\frac{365}{112}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{56} \\left(12-\\sqrt{4015}\\right) & \\frac{1}{8} \\\\\n \\frac{1}{56} \\left(12+\\sqrt{4015}\\right) & \\frac{1}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{11}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{56} \\left(12-\\sqrt{4015}\\right)+\\frac{1}{56} \\left(12+\\sqrt{4015}\\right)\\right),\\frac{1}{8}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{7} x}{2}+\\frac{1}{56} \\left(7-6 \\sqrt{7}\\right),y=\\frac{1}{56} \\left(7+6 \\sqrt{7}\\right)-\\frac{\\sqrt{7} x}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2-3*x-4*y**2+y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\sqrt{3} \\left(-\\cos \\left(\\frac{7 \\pi }{30}\\right)-i \\sin \\left(\\frac{7 \\pi }{30}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-243 \\sqrt{3} \\left(\\sin \\left(\\frac{\\pi }{15}\\right)-i \\cos \\left(\\frac{\\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-math.sqrt(3)*(-math.cos(((7*math.pi)/30))-1j*math.sin(((7*math.pi)/30))))**11)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{31}{4} \\left(\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(\\sqrt{5}-1\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-\\frac{29791}{64} \\left(\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(1+\\sqrt{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(31/4)*(math.sqrt((5/8)+((math.sqrt(5))/8))+(1/4)*1j*(math.sqrt(5)-1)))**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{25}{47}$, and $a_n=a_{n-1}+3 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$5 \\left(\\frac{50}{47}+27 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (25/47) # initial value\nd = 3*math.sqrt(2) # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (25/47) # initial value\nd = 3*math.sqrt(2) # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $8 x-2 y^2+3 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $8 x-2 y^2+3 y=-3$\nVertex: $\\left\\{-\\frac{33}{64},\\frac{3}{4}\\right\\}$\nDirectrix: $x=-\\frac{97}{64}$\nFocal Parameter: $2$\nFocus: $\\left\\{\\frac{31}{64},\\frac{3}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x-2*y**2+3*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $12 x^2+10 x+1$", + "Output Answer": [ + "$x=\\frac{1}{12} \\left(-5-\\sqrt{13}\\right)\\lor x=\\frac{1}{12} \\left(\\sqrt{13}-5\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(12*x**2+10*x+1, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x-11}+\\sqrt{8 x-1}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5}{9} \\left(47-2 \\sqrt{271}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x-11)+sqrt(8*x-1), 10), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{10 x}{\\sqrt{3}}-3 \\sqrt{3}\\right| =-14 \\sqrt{3}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((10*x)/(sqrt(3)))-3*sqrt(3)), -14*sqrt(3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 8 (4 x+1)^3, q(x) = 256 (x+2)^4$", + "Output Answer": [ + "$256 x^4+2560 x^3+6528 x^2+8288 x+4104$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*(4*x+1)**3\nq = 256*(x+2)**4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -7 x^2+2 x-2$, $q(x) = 10 x^2+11 x+9$", + "Output Answer": [ + "$3 x^2+13 x+7$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**2+2*x-2\nq = 10*x**2+11*x+9\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{56}{51}$, and $a_n=a_{n-1}+-\\frac{35}{4}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=12$.", + "Output Answer": [ + "$-\\frac{19187}{34}$" + ], + "Output Program": [ + "a = (56/51) # initial value\nd = -(35/4) # second term\nn = 12 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (56/51) # initial value\nd = -(35/4) # second term\nn = 12 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-8 \\sqrt{2} x^2-\\frac{9 x}{\\sqrt{2}}+\\frac{7}{\\sqrt{2}}}{-\\frac{11 x^2}{\\sqrt{2}}-11 \\sqrt{2} x-7 \\sqrt{2}}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to -1\\},\\left\\{x\\to \\frac{7}{16}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-8*sqrt(2)*x**2-((9*x)/(sqrt(2)))+(7/(sqrt(2))))/(-((11*x**2)/(sqrt(2)))-11*sqrt(2)*x-7*sqrt(2))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$22 x+7=0$, $-16 x-y+11=0$", + "Output Answer": [ + "$x=-\\frac{7}{22}$, $y=\\frac{177}{11}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((22*x+7, -16*x-y+11), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-10 x^3-230 x^2-1390 x-1170$", + "Output Answer": [ + "$10 (-x-13) (-x-9) (-x-1)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-10*x**3-230*x**2-1390*x-1170, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^6+5 x^4+7 x^3+5 x^2-10$ when divided by $6 x+1$.", + "Output Answer": [ + "$\\frac{7 x^5}{6}-\\frac{7 x^4}{36}+\\frac{187 x^3}{216}+\\frac{1325 x^2}{1296}+\\frac{5155 x}{7776}-\\frac{5155}{46656}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**6+5*x**4+7*x**3+5*x**2-10\nq = 6*x+1\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\cosh (2-2 x)$", + "Output Answer": [ + "$1\\leq y$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(cosh(2-2*x), x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{3 x^3+2 x^2-77 x+84}{15 x-60}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-7-4 \\sqrt{7}\\right)\\right\\},\\left\\{x\\to \\frac{1}{3} \\left(-7+4 \\sqrt{7}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((3*x**3+2*x**2-77*x+84)/(15*x-60)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $9 x+5$", + "Output Answer": [ + "$x=-\\frac{5}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(9*x+5, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2-9 x-8 y^2-6 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(x-\\frac{9}{20}\\right)^2-8 \\left(y+\\frac{3}{8}\\right)^2=\\frac{89}{10}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{20} \\left(\\sqrt{89}-3\\right) & -\\frac{3}{8} \\\\\n \\frac{3}{20} \\left(3+\\sqrt{89}\\right) & -\\frac{3}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{3}{20} \\left(3+\\sqrt{89}\\right)-\\frac{3}{20} \\left(\\sqrt{89}-3\\right)\\right),-\\frac{3}{8}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{5} x}{2}-\\frac{3}{40} \\left(5+3 \\sqrt{5}\\right),y=\\frac{3}{40} \\left(3 \\sqrt{5}-5\\right)-\\frac{\\sqrt{5} x}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2-9*x-8*y**2-6*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-25 x^2+x+9}{-17 x-25}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{50} \\left(1-\\sqrt{901}\\right)\\right\\},\\left\\{x\\to \\frac{1}{50} \\left(1+\\sqrt{901}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-25*x**2+x+9)/(-17*x-25)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{55}{3}$ and $-\\frac{11}{3}$.", + "Output Answer": [ + "$\\frac{11}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd((55/3), -(11/3)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-54 x-126}{90-180 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-54*x-126)/(90-180*x)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{47}{15}$, and $a_n=a_{n-1}+\\frac{25}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{7735}{3}$" + ], + "Output Program": [ + "a = (47/15) # initial value\nd = (25/3) # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (47/15) # initial value\nd = (25/3) # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2-\\frac{23 x}{\\sqrt{2}}+63$", + "Output Answer": [ + "$-\\left(\\left(7 \\sqrt{2}-x\\right) \\left(x-\\frac{9}{\\sqrt{2}}\\right)\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2-((23*x)/(sqrt(2)))+63, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{(1+4)+6}{((20+10)+18)-7}$.", + "Output Answer": [ + "$\\frac{11}{41}$" + ], + "Output Program": [ + "try: \n print((((1+4)+6)/(((20+10)+18)-7)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8-15 x}+\\sqrt{-11 x-1}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{9}{8} \\left(-115+\\sqrt{12953}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8-15*x)+sqrt(-11*x-1), 9), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-14 x+11 y-20 z-14=0$, $-3 x+3 y-8 z-22=0$, $23 x+12 y+21 z-14=0$", + "Output Answer": [ + "$x=\\frac{8528}{1457}$, $y=-\\frac{1230}{1457}$, $z=-\\frac{7666}{1457}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-14*x+11*y-20*z-14, -3*x+3*y-8*z-22, 23*x+12*y+21*z-14)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{1241 x^2}{9}+\\frac{4069 x}{9}+\\frac{826}{3}}{-\\frac{4745 x^2}{9}-\\frac{7996 x}{9}-\\frac{1121}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{42}{17}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((1241*x**2)/9)+((4069*x)/9)+(826/3))/(-((4745*x**2)/9)-((7996*x)/9)-(1121/3))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{60}{7} e^{\\frac{163 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $\\frac{60}{7}$\nArgument: $-\\frac{17 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(60/7)*math.e**((163*i*math.pi)/180)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-42 x^2+301 x+105}{-504 x-168}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{15}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-42*x**2+301*x+105)/(-504*x-168)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{17 x}{4}+\\frac{37 y}{2}+\\frac{55}{4}=0$, $-\\frac{31 x}{2}-\\frac{39 y}{4}+\\frac{13}{2}=0$", + "Output Answer": [ + "$x=\\frac{4069}{5251}$, $y=-\\frac{2968}{5251}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((17*x)/4)+((37*y)/2)+(55/4), -((31*x)/2)-((39*y)/4)+(13/2)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{1}{(2 x+2)^4}$ at the point $x=3$", + "Output Answer": [ + "$\\frac{1}{4096} = 0.$" + ], + "Output Program": [ + "x = 3\ntry: \n f = (1/((2*x+2)**4))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $x^4-7 x^3-7 x^2-9 x+10$ when divided by $8-10 x$.", + "Output Answer": [ + "$-\\frac{x^3}{10}+\\frac{31 x^2}{50}+\\frac{299 x}{250}+\\frac{2321}{1250}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**4-7*x**3-7*x**2-9*x+10\nq = 8-10*x\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(\\cos \\left(\\frac{7 \\pi }{45}\\right)-i \\sin \\left(\\frac{7 \\pi }{45}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$25 \\left(\\sin \\left(\\frac{17 \\pi }{90}\\right)-i \\cos \\left(\\frac{17 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(math.cos(((7*math.pi)/45))-1j*math.sin(((7*math.pi)/45))))**2)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -10 x^2-14 x+3$, $q(x) = 6 x^2-8 x-5$", + "Output Answer": [ + "$-4 x^2-22 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -10*x**2-14*x+3\nq = 6*x**2-8*x-5\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^5-2 x^4+x^3-x^2-9 x-3$ when divided by $-4 x^3+x^2-3 x+1$.", + "Output Answer": [ + "$-\\frac{7 x^2}{4}+\\frac{x}{16}+\\frac{69}{64}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**5-2*x**4+x**3-x**2-9*x-3\nq = -4*x**3+x**2-3*x+1\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left((2-5)^2-18\\right)-18\\right)+19\\right)^2 ((16-1)+14)$.", + "Output Answer": [ + "$1856$" + ], + "Output Program": [ + "try: \n print(((((2-5)**2-18)-18)+19)**2*((16-1)+14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2+\\frac{600 x}{7}-\\frac{28272}{49}$", + "Output Answer": [ + "$-3 \\left(x-\\frac{124}{7}\\right) \\left(x-\\frac{76}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2+((600*x)/7)-(28272/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{x^2}{2}-\\frac{3 x}{2}-\\frac{3}{2}$ and $4 x^2-\\frac{9 x}{2}+\\frac{7}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((x**2)/2)-((3*x)/2)-(3/2), 4*x**2-((9*x)/2)+(7/2)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (8 x+9)^2, q(x) = 81 (x-2)^4$", + "Output Answer": [ + "$81 x^4-648 x^3+2008 x^2-2448 x+1377$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (8*x+9)**2\nq = 81*(x-2)**4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\log \\left(\\frac{11 x}{2}+\\frac{5}{2}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{11} \\left(2 e^y-5\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, log(((11*x)/2)+(5/2)))\nprint(solve(f, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x+3$ and $5 x^5-4 x^4-5 x^3+x^2+4 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x+3, 5*x**5-4*x**4-5*x**3+x**2+4*x-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-x^2-3 x+3 y^2-9 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(y-\\frac{3}{2}\\right)^2-\\left(x+\\frac{3}{2}\\right)^2=\\frac{17}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{2} & \\frac{3}{2}-\\sqrt{\\frac{34}{3}} \\\\\n -\\frac{3}{2} & \\frac{3}{2}+\\sqrt{\\frac{34}{3}} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2$\nCenter: $\\left\\{-\\frac{3}{2},\\frac{3}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{2} \\left(3-\\sqrt{3}\\right)-\\frac{x}{\\sqrt{3}},y=\\frac{x}{\\sqrt{3}}+\\frac{1}{2} \\left(3+\\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-x**2-3*x+3*y**2-9*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 11.3 x^2+0.4 x+3.6$, $q(x) = -14.6 x^2-3.6 x-13.1$", + "Output Answer": [ + "$-3.3 x^2-3.2 x-9.5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 11.3*x**2+0.4*x+3.6\nq = -14.6*x**2-3.6*x-13.1\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{135 x^2}{7}+\\frac{46 x}{7}-23}{-\\frac{134 x}{7}-\\frac{81}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{135} \\left(-23-22 \\sqrt{46}\\right)\\right\\},\\left\\{x\\to \\frac{1}{135} \\left(-23+22 \\sqrt{46}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((135*x**2)/7)+((46*x)/7)-23)/(-((134*x)/7)-(81/7))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{87 x}{4}-\\frac{81}{4}\\right| =\\frac{1}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{79}{87}\\right\\},\\left\\{x\\to \\frac{83}{87}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((87*x)/4)-(81/4)), (1/2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{25} (13 x+33)^2, q(x) = \\frac{16}{625} (21-10 x)^4$", + "Output Answer": [ + "$256 x^4-\\frac{10752 x^3}{5}+\\frac{169513 x^2}{25}-\\frac{1181118 x}{125}+\\frac{3138921}{625}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/25)*(13*x+33)**2\nq = (16/625)*(21-10*x)**4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $14 x^2+4 x-7$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(-2-\\sqrt{102}\\right)\\lor x=\\frac{1}{14} \\left(\\sqrt{102}-2\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(14*x**2+4*x-7, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2+12 x-3$ and $q(x) = 12 x^2+12 x+14$", + "Output Answer": [ + "$-168 x^4-24 x^3-88 x^2+132 x-42$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2+12*x-3\nq = 12*x**2+12*x+14\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 5 x^2+24 x+23\\right| =24$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(-12-\\sqrt{149}\\right)\\right\\},\\left\\{x\\to \\frac{1}{5} \\left(-12+\\sqrt{149}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(5*x**2+24*x+23), 24), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(-\\sin \\left(\\frac{\\pi }{90}\\right)+i \\cos \\left(\\frac{\\pi }{90}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$40353607 \\left(\\frac{1}{4} \\left(1-\\sqrt{5}\\right)+i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(-math.sin((math.pi/90))+1j*math.cos((math.pi/90))))**9)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -13 x^2+18 x-4\\right| =16$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{13} \\left(9-\\sqrt{237}\\right)\\right\\},\\left\\{x\\to \\frac{1}{13} \\left(9+\\sqrt{237}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-13*x**2+18*x-4), 16), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(-2+2 i) \\sqrt{5}$ and $y=(2+i) \\sqrt{5}$", + "Output Answer": [ + "$3 i \\sqrt{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-2+2*i)*math.sqrt(5)\ny = (2+i)*math.sqrt(5)\nprint(x+y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{9 x^2-7 x-19}{11-5 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(7-\\sqrt{733}\\right)\\right\\},\\left\\{x\\to \\frac{1}{18} \\left(7+\\sqrt{733}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((9*x**2-7*x-19)/(11-5*x)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-9 x-7}+\\sqrt{10-8 x}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -1717+20 \\sqrt{7346}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-9*x-7)+sqrt(10-8*x), 10), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 19 x^2+18 x+23\\right| =-5$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(19*x**2+18*x+23), -5), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\sqrt{2} \\left(\\cos \\left(\\frac{17}{10}\\right)+i \\sin \\left(\\frac{17}{10}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$-4096 \\sqrt{2} \\left(\\cos \\left(\\frac{17}{2}\\right)+i \\sin \\left(\\frac{17}{2}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*math.sqrt(2)*(math.cos((17/10))+1j*math.sin((17/10))))**5)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $x^2+4 x+7 y^2-7 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $(x+2)^2+7 \\left(y-\\frac{1}{2}\\right)^2=\\frac{51}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n -2-3 \\sqrt{\\frac{17}{14}} & \\frac{1}{2} \\\\\n 3 \\sqrt{\\frac{17}{14}}-2 & \\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{6}{7}}$\nCenter: $\\left\\{-2,\\frac{1}{2}\\right\\}$\nArea Enclosed: $\\frac{51 \\pi }{4 \\sqrt{7}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2+4*x+7*y**2-7*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $6 \\sqrt{2} e^{-\\frac{7 i \\pi }{36}}$.", + "Output Answer": [ + "Norm: $6 \\sqrt{2}$\nArgument: $-\\frac{7 \\pi }{36}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 6*math.sqrt(2)*math.e**(-((7*i*math.pi)/36))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{103 x^2}{5}+\\frac{13 x}{5}+\\frac{106}{5}}{\\frac{107 x}{5}-\\frac{42}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{206} \\left(13-\\sqrt{43841}\\right)\\right\\},\\left\\{x\\to \\frac{1}{206} \\left(13+\\sqrt{43841}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((103*x**2)/5)+((13*x)/5)+(106/5))/(((107*x)/5)-(42/5))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $10 x^3+7 x^2+8 x+7$ when divided by $6 x^3+x^2-7 x+6$.", + "Output Answer": [ + "$\\frac{5}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x**3+7*x**2+8*x+7\nq = 6*x**3+x**2-7*x+6\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sinh \\left(\\frac{11}{3}-\\frac{2 x}{3}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{11}{2}-\\frac{3}{2} \\sinh ^{-1}(y)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, sinh((11/3)-((2*x)/3)))\nprint(solve(f, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-8 \\sqrt{3} x-6 \\sqrt{3} y+3 \\sqrt{3} z-12 \\sqrt{3}=0$, $-9 \\sqrt{3} x-3 \\sqrt{3} y-2 \\sqrt{3} z-11 \\sqrt{3}=0$, $-9 \\sqrt{3} x+\\sqrt{3} y+9 \\sqrt{3} z+4 \\sqrt{3}=0$", + "Output Answer": [ + "$x=-\\frac{243}{502}$, $y=-\\frac{865}{502}$, $z=-\\frac{185}{251}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-8*sqrt(3)*x-6*sqrt(3)*y+3*sqrt(3)*z-12*sqrt(3), -9*sqrt(3)*x-3*sqrt(3)*y-2*sqrt(3)*z-11*sqrt(3), -9*sqrt(3)*x+sqrt(3)*y+9*sqrt(3)*z+4*sqrt(3))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{18}{25}$, and $a_n=a_{n-1}+\\frac{13}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$1968$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (18/25) # initial value\nd = (13/2) # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (18/25) # initial value\nd = (13/2) # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+6 x+9 y^2-5 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x+\\frac{3}{4}\\right)^2+9 \\left(y-\\frac{5}{18}\\right)^2=\\frac{143}{18}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{36} \\left(-27-\\sqrt{1430}\\right) & \\frac{5}{18} \\\\\n \\frac{1}{36} \\left(\\sqrt{1430}-27\\right) & \\frac{5}{18} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{36} \\left(-27-\\sqrt{1430}\\right)+\\frac{1}{36} \\left(\\sqrt{1430}-27\\right)\\right),\\frac{5}{18}\\right\\}$\nArea Enclosed: $\\frac{143 \\pi }{108}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+6*x+9*y**2-5*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $59-\\sqrt[3]{\\sqrt[3]{59}}$.", + "Output Answer": [ + "$59-\\sqrt[9]{59}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(59-cbrt(cbrt(59)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=81-20 t, x(t)=4 t-15$", + "Output Answer": [ + "$y=6-5 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 81-20*t\nx_t = 4*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{24 x^3}{5}-\\frac{4 x^2}{5}-\\frac{34 x}{5}-\\frac{16}{5}$ when divided by $2$.", + "Output Answer": [ + "$\\frac{12 x^3}{5}-\\frac{2 x^2}{5}-\\frac{17 x}{5}-\\frac{8}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((24*x**3)/5)-((4*x**2)/5)-((34*x)/5)-(16/5)\nq = 2\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4$ and $3 x^2+2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4, 3*x**2+2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-5 x^3+230 x^2-3505 x+17680$", + "Output Answer": [ + "$5 (17-x) (x-16) (x-13)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-5*x**3+230*x**2-3505*x+17680, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{3 e^{-\\frac{i \\pi }{60}}}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{3}{\\pi }$\nArgument: $-\\frac{\\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((3*math.e**(-((i*math.pi)/60)))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{15 x^2}{2}+4 x+\\frac{13}{2}$ and $q(x) = -\\frac{27 x^2}{2}+4 x-4$", + "Output Answer": [ + "$-\\frac{405 x^4}{4}-24 x^3-\\frac{407 x^2}{4}+10 x-26$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((15*x**2)/2)+4*x+(13/2)\nq = -((27*x**2)/2)+4*x-4\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 6 \\sqrt{5} x^2+\\sqrt{5} x-2 \\sqrt{5}$ and $q(x) = 6 \\sqrt{5} x^2-4 \\sqrt{5} x+6 \\sqrt{5}$", + "Output Answer": [ + "$180 x^4-90 x^3+100 x^2+70 x-60$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 6*sqrt(5)*x**2+sqrt(5)*x-2*sqrt(5)\nq = 6*sqrt(5)*x**2-4*sqrt(5)*x+6*sqrt(5)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-11 x-11 y-17 z+21=0$, $-22 x+7 y+20 z-2=0$, $-3 x-19 y-12 z-3=0$", + "Output Answer": [ + "$x=\\frac{6137}{7155}$, $y=-\\frac{324}{265}$, $z=\\frac{10528}{7155}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-11*x-11*y-17*z+21, -22*x+7*y+20*z-2, -3*x-19*y-12*z-3)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 7 x^2-4 x+13$, $q(x) = -7 x^2+x-5$", + "Output Answer": [ + "$8-3 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**2-4*x+13\nq = -7*x**2+x-5\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{14-4 x}+\\sqrt{10 x-3}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{98} \\left(167-96 \\sqrt{2}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(14-4*x)+sqrt(10*x-3), 4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-4-4 i) \\sqrt{2}$ and $y=(-7+5 i) \\sqrt{2}$", + "Output Answer": [ + "$\\frac{4}{37}+\\frac{24 i}{37}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-4-4*i)*math.sqrt(2)\ny = (-7+5*i)*math.sqrt(2)\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x+6}+\\sqrt{9 x+13}=2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(-5-8 \\sqrt{67}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x+6)+sqrt(9*x+13), 2), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{79}{57}$, and $a_n=a_{n-1}+-4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$-\\frac{16757}{57}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (79/57) # initial value\nd = -4 # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (79/57) # initial value\nd = -4 # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{13 e^{\\frac{29 i \\pi }{45}}}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\frac{13}{\\sqrt{3}}$\nArgument: $-\\frac{16 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((13*math.e**((29*i*math.pi)/45))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{x^6}{2}+\\frac{9 x^5}{2}+\\frac{13 x^4}{2}+\\frac{15 x^3}{2}-\\frac{3 x^2}{2}-x-\\frac{3}{2}$ when divided by $-\\frac{x^2}{2}+\\frac{x}{2}-9$.", + "Output Answer": [ + "$x^4-8 x^3-39 x^2+90 x+795$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((x**6)/2)+((9*x**5)/2)+((13*x**4)/2)+((15*x**3)/2)-((3*x**2)/2)-x-(3/2)\nq = -((x**2)/2)+(x/2)-9\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\tan ^{-1}\\left(\\frac{5 x^3}{2}+5\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\sqrt[3]{-2}\\right\\},\\left\\{x\\to -\\sqrt[3]{-2} \\sqrt[3]{-1}\\right\\},\\left\\{x\\to \\sqrt[3]{-2} (-1)^{2/3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(atan(((5*x**3)/2)+5), x)\n print(soln)\nexcept: ...\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 8 \\sqrt{3} x^2-3 \\sqrt{3} x-2 \\sqrt{3}$ and $q(x) = 5 \\sqrt{3} x^2-9 \\sqrt{3} x+7 \\sqrt{3}$", + "Output Answer": [ + "$120 x^4-261 x^3+219 x^2-9 x-42$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 8*sqrt(3)*x**2-3*sqrt(3)*x-2*sqrt(3)\nq = 5*sqrt(3)*x**2-9*sqrt(3)*x+7*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{1}{125} (35 x+22)^3, q(x) = \\frac{1}{5} (23-42 x)$", + "Output Answer": [ + "$-343 x^3-\\frac{3234 x^2}{5}-\\frac{10374 x}{25}-\\frac{10073}{125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(1/125)*(35*x+22)**3\nq = (1/5)*(23-42*x)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2+5 x+6 y^2-8 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y-\\frac{2}{3}\\right)^2-8 \\left(x-\\frac{5}{16}\\right)^2=-\\frac{203}{96}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{48} \\left(15-7 \\sqrt{29}\\right) & \\frac{2}{3} \\\\\n \\frac{1}{48} \\left(15+7 \\sqrt{29}\\right) & \\frac{2}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{48} \\left(15-7 \\sqrt{29}\\right)+\\frac{1}{48} \\left(15+7 \\sqrt{29}\\right)\\right),\\frac{2}{3}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2 x}{\\sqrt{3}}+\\frac{1}{24} \\left(16-5 \\sqrt{3}\\right),y=\\frac{1}{24} \\left(16+5 \\sqrt{3}\\right)-\\frac{2 x}{\\sqrt{3}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2+5*x+6*y**2-8*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2+3 x-8 y^2-7 y+10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Circle\nEquation: $-8 \\left(x-\\frac{3}{16}\\right)^2-8 \\left(y+\\frac{7}{16}\\right)^2=-\\frac{189}{16}$\nRadius: $\\frac{3 \\sqrt{\\frac{21}{2}}}{8}$\nCircumference: $\\frac{3}{4} \\sqrt{\\frac{21}{2}} \\pi$\nCenter: $\\left\\{\\frac{3}{16},-\\frac{7}{16}\\right\\}$\nArea Enclosed: $\\frac{189 \\pi }{128}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2+3*x-8*y**2-7*y+10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -15 x^2+13 x-4$ and $q(x) = x^2+13 x+15$", + "Output Answer": [ + "$-15 x^4-182 x^3-60 x^2+143 x-60$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -15*x**2+13*x-4\nq = x**2+13*x+15\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{3} \\left(4 t^2+208 t+2707\\right)^2, x(t)=\\frac{t^2}{3}+\\frac{52 t}{3}+\\frac{676}{3}$", + "Output Answer": [ + "$y=48 x^2+24 x+3$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/3)*(4*t**2+208*t+2707)**2\nx_t = ((t**2)/3)+((52*t)/3)+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-2 \\sqrt{3} x+\\frac{13 y}{\\sqrt{3}}+\\frac{16 z}{\\sqrt{3}}-\\frac{22}{\\sqrt{3}}=0$, $-\\frac{13 x}{\\sqrt{3}}+\\frac{2 y}{\\sqrt{3}}+\\frac{43 z}{\\sqrt{3}}+\\frac{7}{\\sqrt{3}}=0$, $13 \\sqrt{3} x-8 \\sqrt{3} y-\\frac{37 z}{\\sqrt{3}}-11 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{9447}{3386}$, $y=\\frac{3847}{1693}$, $z=\\frac{1947}{3386}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-2*sqrt(3)*x+((13*y)/(sqrt(3)))+((16*z)/(sqrt(3)))-(22/(sqrt(3))), -((13*x)/(sqrt(3)))+((2*y)/(sqrt(3)))+((43*z)/(sqrt(3)))+(7/(sqrt(3))), 13*sqrt(3)*x-8*sqrt(3)*y-((37*z)/(sqrt(3)))-11*sqrt(3))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{12 x^2}{7}+\\frac{25 x}{7}-\\frac{4}{7}$", + "Output Answer": [ + "$\\frac{433}{336}-\\frac{12}{7} \\left(x-\\frac{25}{24}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((12*x**2)/7)+((25*x)/7)-(4/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\log (5 x+3)-\\tan \\left(4-2 x^4\\right)$", + "Output Answer": [ + "$\\frac{4-2 x^4}{\\pi }+\\frac{1}{2}\\notin \\mathbb{Z}\\land x>-\\frac{3}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = log(5*x+3)-tan(4-2*x**4)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{27 x}{2}-2}+\\sqrt{-5 x-3}=\\frac{21}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{578} \\left(-16249+42 \\sqrt{114922}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((27*x)/2)-2)+sqrt(-5*x-3), (21/2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt[3]{182}+\\sqrt[3]{29}}{\\sqrt[3]{157}}$.", + "Output Answer": [ + "$\\sqrt[3]{\\frac{29}{157}}+\\sqrt[3]{\\frac{182}{157}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((cbrt(182)+cbrt(29))/(cbrt(157))))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^5-6 x^4+8 x^3-7 x^2+4 x-2$ when divided by $10$.", + "Output Answer": [ + "$-\\frac{9 x^5}{10}-\\frac{3 x^4}{5}+\\frac{4 x^3}{5}-\\frac{7 x^2}{10}+\\frac{2 x}{5}-\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**5-6*x**4+8*x**3-7*x**2+4*x-2\nq = 10\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| -4 x-1| =16$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{17}{4}\\right\\},\\left\\{x\\to \\frac{15}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-4*x-1), 16), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-4 \\sqrt{3} x^2+2 \\sqrt{3} x+2 \\sqrt{3}$", + "Output Answer": [ + "$x=-\\frac{1}{2}\\lor x=1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-4*sqrt(3)*x**2+2*sqrt(3)*x+2*sqrt(3), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $20 x^6-11 x^5-18 x^4+2 x^3+6 x^2+x$ and $-4 x^5+3 x^4+3 x^3-x^2-x$.", + "Output Answer": [ + "$4 x^5-3 x^4-3 x^3+x^2+x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(20*x**6-11*x**5-18*x**4+2*x**3+6*x**2+x, -4*x**5+3*x**4+3*x**3-x**2-x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{10} \\sqrt{\\sqrt{175}}$.", + "Output Answer": [ + "$5 \\sqrt{2} \\sqrt[4]{7}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(10)*sqrt(sqrt(175)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+x-6 y^2+5 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x+\\frac{1}{14}\\right)^2-6 \\left(y-\\frac{5}{12}\\right)^2=\\frac{167}{168}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{84} \\left(-6-\\sqrt{2171}\\right) & \\frac{5}{12} \\\\\n \\frac{1}{84} \\left(\\sqrt{2171}-6\\right) & \\frac{5}{12} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{13}{6}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{84} \\left(-6-\\sqrt{2171}\\right)+\\frac{1}{84} \\left(\\sqrt{2171}-6\\right)\\right),\\frac{5}{12}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{7}{6}} x+\\frac{1}{84} \\left(35+\\sqrt{42}\\right),y=\\frac{1}{84} \\left(35-\\sqrt{42}\\right)-\\sqrt{\\frac{7}{6}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+x-6*y**2+5*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-3 x+5 y^2-2 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x-\\frac{3}{8}\\right)^2+5 \\left(y-\\frac{1}{5}\\right)^2=\\frac{541}{80}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{8}-\\frac{\\sqrt{541}}{40} & \\frac{1}{5} \\\\\n \\frac{1}{40} \\left(15+\\sqrt{541}\\right) & \\frac{1}{5} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{3}{8}-\\frac{\\sqrt{541}}{40}+\\frac{1}{40} \\left(15+\\sqrt{541}\\right)\\right),\\frac{1}{5}\\right\\}$\nArea Enclosed: $\\frac{541 \\pi }{160 \\sqrt{5}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-3*x+5*y**2-2*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{26}{3}-10 x}+\\sqrt{\\frac{4 x}{3}+\\frac{8}{3}}=\\frac{10}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{867} \\left(-191+20 \\sqrt{1443}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((26/3)-10*x)+sqrt(((4*x)/3)+(8/3)), (10/3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-13 \\sqrt{2} x^2+15 \\sqrt{2} x+\\frac{35}{\\sqrt{2}}}{-\\frac{29 x^2}{\\sqrt{2}}+10 \\sqrt{2} x+\\sqrt{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{26} \\left(15-\\sqrt{1135}\\right)\\right\\},\\left\\{x\\to \\frac{1}{26} \\left(15+\\sqrt{1135}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-13*sqrt(2)*x**2+15*sqrt(2)*x+(35/(sqrt(2))))/(-((29*x**2)/(sqrt(2)))+10*sqrt(2)*x+sqrt(2))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{33}{31}$, and $a_n=a_{n-1}+-\\frac{2}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$\\frac{21}{2} \\left(-\\frac{66}{31}-8 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(33/31) # initial value\nd = -(2/(math.sqrt(5))) # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(33/31) # initial value\nd = -(2/(math.sqrt(5))) # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(12+22) \\left(((5-15)+14) \\frac{1}{1}+6\\right)$.", + "Output Answer": [ + "$340$" + ], + "Output Program": [ + "try: \n print((12+22)*(((5-15)+14)*(1/1)+6))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{29}{3} \\left(\\sin \\left(\\frac{4 \\pi }{45}\\right)-i \\cos \\left(\\frac{4 \\pi }{45}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{420707233300201 \\left(\\cos \\left(\\frac{\\pi }{9}\\right)-i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)}{59049}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(29/3)*(math.sin(((4*math.pi)/45))-1j*math.cos(((4*math.pi)/45))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\log (3 x+3)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(e^y-3\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, log(3*x+3))\nprint(solve(f, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{7-6 x}+\\sqrt{x+13}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{49} \\left(-61+4 \\sqrt{499}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(7-6*x)+sqrt(x+13), 4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{27}{5} \\left(\\cos \\left(\\frac{22}{45}\\right)+i \\sin \\left(\\frac{22}{45}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$\\frac{5559060566555523 \\left(\\cos \\left(\\frac{242}{45}\\right)+i \\sin \\left(\\frac{242}{45}\\right)\\right)}{48828125}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((27/5)*(math.cos((22/45))+1j*math.sin((22/45))))**11)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=36 (15-8 t)^2, x(t)=8 t-15$", + "Output Answer": [ + "$y=36 x^2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 36*(15-8*t)**2\nx_t = 8*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$25 x-17 y+22=0$, $16 x-6 y-22=0$", + "Output Answer": [ + "$x=\\frac{253}{61}$, $y=\\frac{451}{61}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((25*x-17*y+22, 16*x-6*y-22), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -x^2+16 x-4\\right| =-11$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-x**2+16*x-4), -11), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x-1$ and $-4 x^4-5 x^3+3 x^2+5 x-2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x-1, -4*x**4-5*x**3+3*x**2+5*x-2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2+4 x+4 y^2+8 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x+\\frac{2}{5}\\right)^2+4 (y+1)^2=\\frac{34}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{5} & -1-\\frac{\\sqrt{\\frac{17}{2}}}{5} \\\\\n -\\frac{2}{5} & \\frac{1}{10} \\left(\\sqrt{34}-10\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{5}}$\nCenter: $\\left\\{-\\frac{2}{5},\\frac{1}{2} \\left(-1-\\frac{\\sqrt{\\frac{17}{2}}}{5}+\\frac{1}{10} \\left(\\sqrt{34}-10\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{17 \\pi }{5 \\sqrt{5}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2+4*x+4*y**2+8*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{23}{31}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$\\frac{108570}{31}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (23/31) # initial value\nd = 8 # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (23/31) # initial value\nd = 8 # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{52}{7}-\\frac{48 i}{7}$ and $y=3+\\frac{31 i}{7}$", + "Output Answer": [ + "$\\frac{2580}{49}+\\frac{604 i}{49}$" + ], + "Output Program": [ + "i = 1j\nx = (52/7)-((48*i)/7)\ny = 3+((31*i)/7)\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left(\\frac{16}{10}-6\\right)-7\\right)^2-13\\right)^2 \\left(\\left(\\left(\\frac{7}{5}-22\\right)-1\\right)+13\\right)$.", + "Output Answer": [ + "$-\\frac{367640368}{3125}$" + ], + "Output Program": [ + "try: \n print(((((16/10)-6)-7)**2-13)**2*((((7/5)-22)-1)+13))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $10-2 x$ and $2$.", + "Output Answer": [ + "$2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(10-2*x, 2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{46}{57}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$\\frac{21392}{57}$" + ], + "Output Program": [ + "a = (46/57) # initial value\nd = 4 # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (46/57) # initial value\nd = 4 # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{25 x^2}{\\sqrt{\\pi }}+\\frac{23 x}{\\sqrt{\\pi }}-\\frac{12}{\\sqrt{\\pi }}$ and $q(x) = \\frac{2 x^2}{\\sqrt{\\pi }}-\\frac{22 x}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{50 x^4}{\\pi }+\\frac{596 x^3}{\\pi }-\\frac{530 x^2}{\\pi }+\\frac{264 x}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((25*x**2)/(sqrt(pi)))+((23*x)/(sqrt(pi)))-(12/(sqrt(pi)))\nq = ((2*x**2)/(sqrt(pi)))-((22*x)/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{79}{63}$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$\\frac{69304}{63}$" + ], + "Output Program": [ + "a = (79/63) # initial value\nd = 9 # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (79/63) # initial value\nd = 9 # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{14 x^2}{5}-10 x-\\frac{17}{5}$", + "Output Answer": [ + "$\\frac{387}{70}-\\frac{14}{5} \\left(x+\\frac{25}{14}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((14*x**2)/5)-10*x-(17/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{15 x^2}{2}-5 x+7$", + "Output Answer": [ + "$\\frac{15}{2} \\left(x-\\frac{1}{3}\\right)^2+\\frac{37}{6}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((15*x**2)/2)-5*x+7), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 16 x^2-5 x+1\\right| =3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{32} \\left(5-3 \\sqrt{17}\\right)\\right\\},\\left\\{x\\to \\frac{1}{32} \\left(5+3 \\sqrt{17}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(16*x**2-5*x+1), 3), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{(3+25)-1}{5-17}$.", + "Output Answer": [ + "$-\\frac{9}{4}$" + ], + "Output Program": [ + "try: \n print((((3+25)-1)/(5-17)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{18+9 i}{\\pi }$ and $y=\\frac{16-20 i}{\\pi }$", + "Output Answer": [ + "$-\\frac{468-216 i}{\\pi ^2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((18+9*i)/math.pi)\ny = ((16-20*i)/math.pi)\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-7 x^2-3 x$", + "Output Answer": [ + "$x=-\\frac{3}{7}\\lor x=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-7*x**2-3*x, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{x}{5}+\\frac{42}{5}}+\\sqrt{\\frac{43 x}{5}+\\frac{51}{5}}=\\frac{24}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{490} \\left(1303-8 \\sqrt{43702}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((x/5)+(42/5))+sqrt(((43*x)/5)+(51/5)), (24/5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{6}{67}$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$\\frac{3594}{67}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(6/67) # initial value\nd = 9 # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(6/67) # initial value\nd = 9 # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-2 \\sqrt{5} x^2-5 \\sqrt{5} x-6 \\sqrt{5}$", + "Output Answer": [ + "$x=\\frac{1}{4} \\left(-5-i \\sqrt{23}\\right)\\lor x=\\frac{1}{4} \\left(-5+i \\sqrt{23}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-2*sqrt(5)*x**2-5*sqrt(5)*x-6*sqrt(5), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -11 \\sqrt{2} x^2+13 \\sqrt{2} x-12 \\sqrt{2}\\right| =11 \\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{22} \\left(13-5 \\sqrt{5}\\right)\\right\\},\\left\\{x\\to \\frac{1}{22} \\left(13+5 \\sqrt{5}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-11*sqrt(2)*x**2+13*sqrt(2)*x-12*sqrt(2)), 11*sqrt(2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| -7 x-19| =-4$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-7*x-19), -4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{23 x^2}{\\sqrt{2}}+13 \\sqrt{2} x-\\frac{17}{\\sqrt{2}}\\right| =\\frac{33}{\\sqrt{2}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{23} \\left(-13-\\sqrt{1319}\\right)\\right\\},\\left\\{x\\to \\frac{1}{23} \\left(-13+\\sqrt{1319}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((23*x**2)/(sqrt(2)))+13*sqrt(2)*x-(17/(sqrt(2)))), (33/(sqrt(2)))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(((13-4)-11)^2+21\\right) (((2-10)-2)-16)^2$.", + "Output Answer": [ + "$16900$" + ], + "Output Program": [ + "try: \n print((((13-4)-11)**2+21)*(((2-10)-2)-16)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{4 x^2}{\\sqrt{3}}+\\frac{19 x}{\\sqrt{3}}-\\frac{8}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{4 \\left(x+\\frac{19}{8}\\right)^2}{\\sqrt{3}}-\\frac{163 \\sqrt{3}}{16}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((4*x**2)/(math.sqrt(3)))+((19*x)/(math.sqrt(3)))-(8/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(4-21)-\\frac{1}{15} (17+5)^2$.", + "Output Answer": [ + "$-\\frac{739}{15}$" + ], + "Output Program": [ + "try: \n print((4-21)-(1/15)*(17+5)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2-5 x$ and $-x^5+3 x^4-x^3-4 x^2-2 x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2-5*x, -x**5+3*x**4-x**3-4*x**2-2*x-3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(8 \\left(\\cos \\left(\\frac{46}{45}\\right)+i \\sin \\left(\\frac{46}{45}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1073741824 \\left(\\cos \\left(\\frac{92}{9}\\right)+i \\sin \\left(\\frac{92}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((8*(math.cos((46/45))+1j*math.sin((46/45))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{23 x^2}{3}+\\frac{31 x}{3}+3$ and $q(x) = -\\frac{25 x^2}{3}-\\frac{29 x}{3}-\\frac{29}{3}$", + "Output Answer": [ + "$\\frac{575 x^4}{9}-12 x^3-\\frac{457 x^2}{9}-\\frac{1160 x}{9}-29$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((23*x**2)/3)+((31*x)/3)+3\nq = -((25*x**2)/3)-((29*x)/3)-(29/3)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{25 x^2}{3}+2 x-1$", + "Output Answer": [ + "$x=\\frac{1}{25} \\left(3-i \\sqrt{66}\\right)\\lor x=\\frac{1}{25} \\left(3+i \\sqrt{66}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((25*x**2)/3)+2*x-1, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left((18-25)^2+5\\right)+20\\right)-20\\right)+((((9-16)+5)+15)-14)$.", + "Output Answer": [ + "$53$" + ], + "Output Program": [ + "try: \n print(((((18-25)**2+5)+20)-20)+((((9-16)+5)+15)-14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1575 t^2+5460 t+4726}{3 \\sqrt{3}}, x(t)=75 t^2+260 t+\\frac{676}{3}$", + "Output Answer": [ + "$y=\\frac{7 x}{\\sqrt{3}}-\\frac{2}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = ((1575*t**2+5460*t+4726)/(3*sqrt(3)))\nx_t = 75*t**2+260*t+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{14-24}{25+14}$.", + "Output Answer": [ + "$-\\frac{10}{39}$" + ], + "Output Program": [ + "try: \n print(((14-24)/(25+14)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=50 \\left(32 t^2-176 t+241\\right)^2, x(t)=32 t^2-176 t+242$", + "Output Answer": [ + "$y=50 x^2-100 x+50$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 50*(32*t**2-176*t+241)**2\nx_t = 32*t**2-176*t+242\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\sqrt{2} \\left(\\cos \\left(\\frac{16}{45}\\right)+i \\sin \\left(\\frac{16}{45}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$5184 \\left(\\cos \\left(\\frac{64}{45}\\right)+i \\sin \\left(\\frac{64}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*math.sqrt(2)*(math.cos((16/45))+1j*math.sin((16/45))))**4)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{3}{2}+\\frac{5 i}{2}$.", + "Output Answer": [ + "Norm: $\\sqrt{\\frac{17}{2}}$\nArgument: $\\tan ^{-1}\\left(\\frac{5}{3}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (3/2)+((5*i)/2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (8, \\frac{1}{5}, 7)$", + "Output Answer": [ + "$\\left\\{\\frac{3 \\sqrt{314}}{5},\\tan ^{-1}\\left(\\frac{\\sqrt{1601}}{35}\\right),\\tan ^{-1}\\left(\\frac{1}{40}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 8\ny = (1/5)\nz = 7\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^5-\\frac{x^4}{2}+9 x^3-\\frac{17 x^2}{2}+4 x-\\frac{9}{2}$ when divided by $x+9$.", + "Output Answer": [ + "$-5 x^4+\\frac{89 x^3}{2}-\\frac{783 x^2}{2}+3515 x-31631$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**5-((x**4)/2)+9*x**3-((17*x**2)/2)+4*x-(9/2)\nq = x+9\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((20-7)-17) ((2+22)+24)$.", + "Output Answer": [ + "$-192$" + ], + "Output Program": [ + "try: \n print(((20-7)-17)*((2+22)+24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^6-x^4+6 x^3+7 x^2-10 x+3$ when divided by $-2 x^5-7 x^4-6 x^3+8 x^2-10 x-1$.", + "Output Answer": [ + "$2 x-7$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**6-x**4+6*x**3+7*x**2-10*x+3\nq = -2*x**5-7*x**4-6*x**3+8*x**2-10*x-1\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x-3}+\\sqrt{4 x-13}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(275-14 \\sqrt{199}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x-3)+sqrt(4*x-13), 7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=e^{4-6 x} \\cos (1-3 x)$ at the point $x=3$", + "Output Answer": [ + "$\\frac{\\cos (8)}{e^{14}} = 0.$" + ], + "Output Program": [ + "import math\n\nx = 3\ntry: \n f = math.e**(4-6*x)*math.cos(1-3*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^6-9 x^5+5 x^4-8 x^3+3 x^2+x+6$ when divided by $-x^5+x^4-3 x^2-6 x-7$.", + "Output Answer": [ + "$7-2 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**6-9*x**5+5*x**4-8*x**3+3*x**2+x+6\nq = -x**5+x**4-3*x**2-6*x-7\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2+5 x-9 y^2+6 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Circle\nEquation: $-9 \\left(x-\\frac{5}{18}\\right)^2-9 \\left(y-\\frac{1}{3}\\right)^2=-\\frac{205}{36}$\nRadius: $\\frac{\\sqrt{205}}{18}$\nCircumference: $\\frac{\\sqrt{205} \\pi }{9}$\nCenter: $\\left\\{\\frac{5}{18},\\frac{1}{3}\\right\\}$\nArea Enclosed: $\\frac{205 \\pi }{324}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2+5*x-9*y**2+6*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 8-22 x| =1$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7}{22}\\right\\},\\left\\{x\\to \\frac{9}{22}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(8-22*x), 1), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x^4-3 x^3+5 x^2+1$ and $-5 x^4+3 x^3-5 x^2-1$.", + "Output Answer": [ + "$5 x^4-3 x^3+5 x^2+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x**4-3*x**3+5*x**2+1, -5*x**4+3*x**3-5*x**2-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{38 x^2}{\\sqrt{3}}+\\frac{x}{\\sqrt{3}}+4 \\sqrt{3}}{-\\frac{29 x^2}{\\sqrt{3}}+\\frac{32 x}{\\sqrt{3}}+\\frac{13}{\\sqrt{3}}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((38*x**2)/(sqrt(3)))+(x/(sqrt(3)))+4*sqrt(3))/(-((29*x**2)/(sqrt(3)))+((32*x)/(sqrt(3)))+(13/(sqrt(3))))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{43 x^2}{\\pi }-\\frac{38 x}{\\pi }-\\frac{4}{\\pi }$ and $q(x) = -\\frac{20 x^2}{\\pi }-\\frac{20 x}{\\pi }+\\frac{24}{\\pi }$", + "Output Answer": [ + "$-\\frac{860 x^4}{\\pi ^2}-\\frac{100 x^3}{\\pi ^2}+\\frac{1872 x^2}{\\pi ^2}-\\frac{832 x}{\\pi ^2}-\\frac{96}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((43*x**2)/pi)-((38*x)/pi)-(4/pi)\nq = -((20*x**2)/pi)-((20*x)/pi)+(24/pi)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $5 x^2-1$", + "Output Answer": [ + "$5 x^2-1$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (5*x**2-1), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{20 x^2-184 x-396}{-220 x^2-226 x+306}=0$", + "Output Answer": [ + "$\\{\\{x\\to 11\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((20*x**2-184*x-396)/(-220*x**2-226*x+306)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = x^2+2 x+1$ and $q(x) = 1-12 x^2$", + "Output Answer": [ + "$-12 x^4-24 x^3-11 x^2+2 x+1$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = x**2+2*x+1\nq = 1-12*x**2\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-204 x^2-281 x-22}{-252 x^2-165 x-12}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{22}{17}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-204*x**2-281*x-22)/(-252*x**2-165*x-12)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(-3-3 i) \\sqrt{2}$ and $y=(-1+5 i) \\sqrt{2}$", + "Output Answer": [ + "$(-4+2 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-3-3*i)*math.sqrt(2)\ny = (-1+5*i)*math.sqrt(2)\nprint(x+y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{38 x^2}{\\sqrt{3}}+4 \\sqrt{3} x-\\frac{16}{\\sqrt{3}}\\right| =\\frac{40}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{19} \\left(3-\\sqrt{237}\\right)\\right\\},\\left\\{x\\to \\frac{1}{19} \\left(3+\\sqrt{237}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((38*x**2)/(sqrt(3)))+4*sqrt(3)*x-(16/(sqrt(3)))), (40/(sqrt(3)))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\cos \\left(\\frac{9}{2}-8 x^4\\right)$ at the point $x=-1$", + "Output Answer": [ + "$\\cos \\left(\\frac{7}{2}\\right) = -0.936$" + ], + "Output Program": [ + "import math\n\nx = -1\ntry: \n f = math.cos((9/2)-8*x**4)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\tan (\\cos (1))-\\sin (5 x+4)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{5} \\left(2 \\pi c_1-\\sin ^{-1}(\\tan (\\cos (1)))+\\pi -4\\right)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\},\\left\\{x\\to \\fbox{$\\frac{1}{5} \\left(2 \\pi c_1+\\sin ^{-1}(\\tan (\\cos (1)))-4\\right)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(tan(cos(1))-sin(5*x+4), x)\n print(soln)\nexcept: ...\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\cos \\left(\\frac{7 \\pi }{45}\\right)+i \\sin \\left(\\frac{7 \\pi }{45}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$16807 \\left(-\\cos \\left(\\frac{2 \\pi }{9}\\right)+i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.cos(((7*math.pi)/45))+1j*math.sin(((7*math.pi)/45))))**5)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(21 t+106)^2, x(t)=-3 t-15$", + "Output Answer": [ + "$y=49 x^2-14 x+1$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (21*t+106)**2\nx_t = -3*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 3 x^2-13 x-9$, $q(x) = -7 x^2-6 x+9$", + "Output Answer": [ + "$-4 x^2-19 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**2-13*x-9\nq = -7*x**2-6*x+9\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $9-\\frac{6 i}{5}$.", + "Output Answer": [ + "Norm: $\\frac{3 \\sqrt{229}}{5}$\nArgument: $-\\tan ^{-1}\\left(\\frac{2}{15}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 9-((6*i)/5)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{83}{58}$, and $a_n=a_{n-1}+6 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$10 \\left(\\frac{83}{29}+114 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (83/58) # initial value\nd = 6*math.sqrt(2) # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (83/58) # initial value\nd = 6*math.sqrt(2) # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 16 x^2+5 x+8\\right| =12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{32} \\left(-5-\\sqrt{281}\\right)\\right\\},\\left\\{x\\to \\frac{1}{32} \\left(-5+\\sqrt{281}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(16*x**2+5*x+8), 12), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-9 \\left(\\cos \\left(\\frac{77}{45}\\right)+i \\sin \\left(\\frac{77}{45}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$43046721 \\left(\\cos \\left(\\frac{616}{45}\\right)+i \\sin \\left(\\frac{616}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-9*(math.cos((77/45))+1j*math.sin((77/45))))**8)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $x^2-7 x+9 y^2-5 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $\\left(x-\\frac{7}{2}\\right)^2+9 \\left(y-\\frac{5}{18}\\right)^2=\\frac{251}{18}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{7}{2}-\\frac{2 \\sqrt{251}}{9} & \\frac{5}{18} \\\\\n \\frac{7}{2}+\\frac{2 \\sqrt{251}}{9} & \\frac{5}{18} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2 \\sqrt{2}}{3}$\nCenter: $\\left\\{\\frac{7}{2},\\frac{5}{18}\\right\\}$\nArea Enclosed: $\\frac{251 \\pi }{54}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-7*x+9*y**2-5*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-2 x^2-4 x+7$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(-2-3 \\sqrt{2}\\right)\\lor x=\\frac{1}{2} \\left(3 \\sqrt{2}-2\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-2*x**2-4*x+7, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-4 x+6 y^2-2 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x-\\frac{2}{5}\\right)^2+6 \\left(y-\\frac{1}{6}\\right)^2=\\frac{329}{30}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{2}{5}-\\frac{\\sqrt{329}}{30} & \\frac{1}{6} \\\\\n \\frac{1}{30} \\left(12+\\sqrt{329}\\right) & \\frac{1}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{6}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{2}{5}-\\frac{\\sqrt{329}}{30}+\\frac{1}{30} \\left(12+\\sqrt{329}\\right)\\right),\\frac{1}{6}\\right\\}$\nArea Enclosed: $\\frac{329 \\pi }{30 \\sqrt{30}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-4*x+6*y**2-2*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\sqrt{2} \\left(\\cos \\left(\\frac{83}{90}\\right)+i \\sin \\left(\\frac{83}{90}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$125000 \\left(\\cos \\left(\\frac{83}{15}\\right)+i \\sin \\left(\\frac{83}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*math.sqrt(2)*(math.cos((83/90))+1j*math.sin((83/90))))**6)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{29}{4}-\\frac{15 i}{2}$ and $y=\\frac{15}{2}-\\frac{27 i}{4}$", + "Output Answer": [ + "$-\\frac{1}{4}-\\frac{3 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = (29/4)-((15*i)/2)\ny = (15/2)-((27*i)/4)\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2+24 x+320$", + "Output Answer": [ + "$2 (-x-8) (x-20)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2+24*x+320, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{322 x^3}{3}+\\frac{x^2}{3}-\\frac{730 x}{3}-\\frac{418}{3}}{-\\frac{574 x^2}{3}-\\frac{493 x}{3}-11}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{23} \\left(9-\\sqrt{955}\\right)\\right\\},\\left\\{x\\to \\frac{1}{23} \\left(9+\\sqrt{955}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((322*x**3)/3)+((x**2)/3)-((730*x)/3)-(418/3))/(-((574*x**2)/3)-((493*x)/3)-11)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 14 \\sqrt{3}-7 \\sqrt{3} x\\right| =5 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{9}{7}\\right\\},\\left\\{x\\to \\frac{19}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(14*sqrt(3)-7*sqrt(3)*x), 5*sqrt(3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{19 x}{2}-\\frac{19}{2}}+\\sqrt{\\frac{29}{4}-\\frac{31 x}{4}}=\\frac{21}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{28} \\left(-4615+6 \\sqrt{583338}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((19*x)/2)-(19/2))+sqrt((29/4)-((31*x)/4)), (21/4)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-10 x^5-5 x^4-6 x^3+5 x^2-6 x-5$ and $5 x^4+3 x^2-4 x+5$.", + "Output Answer": [ + "$5 x^4+3 x^2-4 x+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-10*x**5-5*x**4-6*x**3+5*x**2-6*x-5, 5*x**4+3*x**2-4*x+5))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{7}{10}$, and $a_n=a_{n-1}+3 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$15 \\left(87 \\pi -\\frac{7}{5}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(7/10) # initial value\nd = 3*math.pi # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(7/10) # initial value\nd = 3*math.pi # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{75 x}{4}-\\frac{77}{4}\\right| =\\frac{31}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{46}{75}\\right\\},\\left\\{x\\to \\frac{36}{25}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((75*x)/4)-(77/4)), (31/4)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\sqrt{2} \\left(-\\cos \\left(\\frac{4 \\pi }{45}\\right)-i \\sin \\left(\\frac{4 \\pi }{45}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$11609505792 \\sqrt{2} \\left(\\cos \\left(\\frac{\\pi }{45}\\right)-i \\sin \\left(\\frac{\\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*math.sqrt(2)*(-math.cos(((4*math.pi)/45))-1j*math.sin(((4*math.pi)/45))))**11)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 e x+5 e$ and $q(x) = e x^2+5 e x-4 e$", + "Output Answer": [ + "$3 e^2 x^3+20 e^2 x^2+13 e^2 x-20 e^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = 3*math.e*x+5*math.e\nq = math.e*x**2+5*math.e*x-4*math.e\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{45 y}{2}+\\frac{9 z}{2}-\\frac{67}{4}=0$, $-\\frac{35 x}{4}+\\frac{19 y}{4}-\\frac{63 z}{4}-24=0$, $5 x-7 y-7 z-19=0$", + "Output Answer": [ + "$x=\\frac{52151}{23850}$, $y=\\frac{5813}{4770}$, $z=-\\frac{377}{159}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((45*y)/2)+((9*z)/2)-(67/4), -((35*x)/4)+((19*y)/4)-((63*z)/4)-24, 5*x-7*y-7*z-19)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -8 \\sqrt{3} x^2-8 \\sqrt{3} x-10 \\sqrt{3}\\right| =14 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-1-\\sqrt{3}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(-1+\\sqrt{3}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-8*sqrt(3)*x**2-8*sqrt(3)*x-10*sqrt(3)), 14*sqrt(3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{30-17 i}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{1189}}{\\pi }$\nArgument: $-\\tan ^{-1}\\left(\\frac{17}{30}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((30-17*i)/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{18 x^2}{7}-\\frac{101 x}{7}-\\frac{90}{7}$", + "Output Answer": [ + "$x=-\\frac{10}{9}\\lor x=-\\frac{9}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((18*x**2)/7)-((101*x)/7)-(90/7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-6 x^2-8 x+17}{7-19 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(-4-\\sqrt{118}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(-4+\\sqrt{118}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-6*x**2-8*x+17)/(7-19*x)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{4}, 10, 7)$", + "Output Answer": [ + "$\\left\\{\\frac{3 \\sqrt{265}}{4},\\tan ^{-1}\\left(\\frac{\\sqrt{1601}}{28}\\right),\\tan ^{-1}(40)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/4)\ny = 10\nz = 7\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{25 x}{4}-12}+\\sqrt{\\frac{37 x}{4}+\\frac{13}{4}}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(1613-6 \\sqrt{68622}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((25*x)/4)-12)+sqrt(((37*x)/4)+(13/4)), 9), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -4 x^2-16 x-9\\right| =15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-4-\\sqrt{22}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(-4+\\sqrt{22}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-4*x**2-16*x-9), 15), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{35}{93}$, and $a_n=a_{n-1}+-7 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{27}{2} \\left(\\frac{70}{93}-182 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = (35/93) # initial value\nd = -7*math.sqrt(2) # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (35/93) # initial value\nd = -7*math.sqrt(2) # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{26}{45}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$-\\frac{296}{15}$" + ], + "Output Program": [ + "a = -(26/45) # initial value\nd = -6 # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(26/45) # initial value\nd = -6 # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-10 x^3-\\frac{680 x^2}{3}-\\frac{3200 x}{3}$", + "Output Answer": [ + "$10 (-x-16) x \\left(x+\\frac{20}{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-10*x**3-((680*x**2)/3)-((3200*x)/3), a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=16 t^2+240 t+895, x(t)=4 t^2+60 t+225$", + "Output Answer": [ + "$y=4 x-5$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 16*t**2+240*t+895\nx_t = 4*t**2+60*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 2 \\sqrt{5}-11 \\sqrt{5} x\\right| =2 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\{x\\to 0\\},\\left\\{x\\to \\frac{4}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(2*sqrt(5)-11*sqrt(5)*x), 2*sqrt(5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2+4 x+48$", + "Output Answer": [ + "$2 (-x-4) (x-6)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2+4*x+48, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{59}{100}$, and $a_n=a_{n-1}+-4 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{3}{2} \\left(-\\frac{59}{50}-8 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(59/100) # initial value\nd = -4*math.sqrt(2) # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(59/100) # initial value\nd = -4*math.sqrt(2) # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{(14+20)-12}{((13-25)-19)-23}$.", + "Output Answer": [ + "$-\\frac{11}{27}$" + ], + "Output Program": [ + "try: \n print((((14+20)-12)/(((13-25)-19)-23)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 15 \\sqrt{2}-12 \\sqrt{2} x\\right| =\\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7}{6}\\right\\},\\left\\{x\\to \\frac{4}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(15*sqrt(2)-12*sqrt(2)*x), sqrt(2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{3+13 i}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $\\sqrt{\\frac{178}{\\pi }}$\nArgument: $\\tan ^{-1}\\left(\\frac{13}{3}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((3+13*i)/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the first order series of the inverse of the following function around 1:\n$\\tan ^{-1}\\left(x^3\\right)$", + "Output Answer": [ + "$\\frac{65}{12} \\left(x+\\tan ^{-1}(8)\\right)-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, atan(x**3))\nprint(solve(f, x)[0].series(y, 1, 1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 7 \\sqrt{5} x+2 \\sqrt{5}\\right| =7 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{9}{7}\\right\\},\\left\\{x\\to \\frac{5}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(7*sqrt(5)*x+2*sqrt(5)), 7*sqrt(5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-12 x^3-16 x^2-8 x+16$ and $-3 x^3-4 x^2-2 x+4$.", + "Output Answer": [ + "$3 x^3+4 x^2+2 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-12*x**3-16*x**2-8*x+16, -3*x**3-4*x**2-2*x+4))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{35}{33}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$\\frac{1060}{11}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (35/33) # initial value\nd = 6 # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (35/33) # initial value\nd = 6 # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $13 x^2+13 x-3$", + "Output Answer": [ + "$13 \\left(x+\\frac{1}{2}\\right)^2-\\frac{25}{4}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (13*x**2+13*x-3), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^5-9 x^4+6 x^3+8 x^2+4 x+4$ when divided by $-3 x-4$.", + "Output Answer": [ + "$-\\frac{4 x^4}{3}+\\frac{43 x^3}{9}-\\frac{226 x^2}{27}+\\frac{688 x}{81}-\\frac{3076}{243}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**5-9*x**4+6*x**3+8*x**2+4*x+4\nq = -3*x-4\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $7 x^2-\\frac{21 x}{2}+\\frac{1}{2}$", + "Output Answer": [ + "$x=\\frac{1}{28} \\left(21-\\sqrt{385}\\right)\\lor x=\\frac{1}{28} \\left(21+\\sqrt{385}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(7*x**2-((21*x)/2)+(1/2), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 11 x-20| =8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{12}{11}\\right\\},\\left\\{x\\to \\frac{28}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11*x-20), 8), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(21-17) \\frac{1-25}{22}$.", + "Output Answer": [ + "$-\\frac{48}{11}$" + ], + "Output Program": [ + "try: \n print((21-17)*((1-25)/22))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{17 x^2-23 x+18}{\\sqrt{\\pi }}$, $q(x) = \\frac{-25 x^2+17 x+10}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{8 x^2}{\\sqrt{\\pi }}-\\frac{6 x}{\\sqrt{\\pi }}+\\frac{28}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((17*x**2-23*x+18)/(sqrt(pi)))\nq = ((-25*x**2+17*x+10)/(sqrt(pi)))\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -6 x-\\frac{25}{2}\\right| =7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{13}{4}\\right\\},\\left\\{x\\to -\\frac{11}{12}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-6*x-(25/2)), 7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{1}{4}-\\frac{5 i}{4}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{\\frac{13}{2}}}{2}$\nArgument: $-\\tan ^{-1}(5)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (1/4)-((5*i)/4)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $x^2-9 x+7$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(9-\\sqrt{53}\\right)\\lor x=\\frac{1}{2} \\left(9+\\sqrt{53}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(x**2-9*x+7, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $8 x^2-\\frac{184 x}{5}-\\frac{336}{5}$", + "Output Answer": [ + "$-8 (6-x) \\left(x+\\frac{7}{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(8*x**2-((184*x)/5)-(336/5), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 14 x^2+2 x+11$, $q(x) = 8 x^2+7 x-10$", + "Output Answer": [ + "$22 x^2+9 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 14*x**2+2*x+11\nq = 8*x**2+7*x-10\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 3 x^2-11 x-10$, $q(x) = 2 \\left(6 x^2+7 x-6\\right)$", + "Output Answer": [ + "$15 x^2+3 x-22$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**2-11*x-10\nq = 2*(6*x**2+7*x-6)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{15}{61}$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{1692}{61}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (15/61) # initial value\nd = 9 # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (15/61) # initial value\nd = 9 # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 81 (x+2)^4, q(x) = (1-9 x)^4$", + "Output Answer": [ + "$6642 x^4-2268 x^3+2430 x^2+2556 x+1297$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 81*(x+2)**4\nq = (1-9*x)**4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{43 x^2}{\\sqrt{3}}+2 \\sqrt{3} x+\\frac{13}{\\sqrt{3}}}{\\frac{43 x}{\\sqrt{3}}-\\frac{20}{\\sqrt{3}}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((43*x**2)/(sqrt(3)))+2*sqrt(3)*x+(13/(sqrt(3))))/(((43*x)/(sqrt(3)))-(20/(sqrt(3))))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-2 x-24 y-9 z=0$, $-10 x+16 y-15 z-6=0$, $18 x-4 y+4 z-12=0$", + "Output Answer": [ + "$x=\\frac{855}{968}$, $y=\\frac{411}{1936}$, $z=-\\frac{369}{484}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-2*x-24*y-9*z, -10*x+16*y-15*z-6, 18*x-4*y+4*z-12)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{37}{7}-\\frac{51 x}{7}}+\\sqrt{\\frac{96}{7}-\\frac{33 x}{7}}=\\frac{54}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{126} \\left(-14021+18 \\sqrt{596742}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((37/7)-((51*x)/7))+sqrt((96/7)-((33*x)/7)), (54/7)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2+13 \\sqrt{2} x+72$", + "Output Answer": [ + "$\\left(x+4 \\sqrt{2}\\right) \\left(x+9 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2+13*sqrt(2)*x+72, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-7 x^2-5 x-10$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(-5-i \\sqrt{255}\\right)\\lor x=\\frac{1}{14} \\left(-5+i \\sqrt{255}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-7*x**2-5*x-10, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\sqrt{3} \\left(\\cos \\left(\\frac{61}{45}\\right)+i \\sin \\left(\\frac{61}{45}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$2373046875 \\left(\\cos \\left(\\frac{122}{9}\\right)+i \\sin \\left(\\frac{122}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*math.sqrt(3)*(math.cos((61/45))+1j*math.sin((61/45))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 x^2-\\frac{11 x}{2}-11$ and $q(x) = -x^2-11 x-\\frac{3}{2}$", + "Output Answer": [ + "$4 x^4+\\frac{99 x^3}{2}+\\frac{155 x^2}{2}+\\frac{517 x}{4}+\\frac{33}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*x**2-((11*x)/2)-11\nq = -x**2-11*x-(3/2)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2-9 x+10 y^2+10 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(y+\\frac{1}{2}\\right)^2-9 \\left(x+\\frac{1}{2}\\right)^2=\\frac{17}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{2} & \\frac{1}{60} \\left(-30-\\sqrt{3230}\\right) \\\\\n -\\frac{1}{2} & \\frac{1}{60} \\left(\\sqrt{3230}-30\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{19}}{3}$\nCenter: $\\left\\{-\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{60} \\left(-30-\\sqrt{3230}\\right)+\\frac{1}{60} \\left(\\sqrt{3230}-30\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{20} \\left(-10-3 \\sqrt{10}\\right)-\\frac{3 x}{\\sqrt{10}},y=\\frac{3 x}{\\sqrt{10}}+\\frac{1}{20} \\left(3 \\sqrt{10}-10\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2-9*x+10*y**2+10*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^6+2 x^5+6 x^4-10 x^3-3 x^2-3 x+6$ when divided by $6 x^5-7 x^4+3 x^3-4 x^2-2 x+5$.", + "Output Answer": [ + "$\\frac{2 x}{3}+\\frac{10}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**6+2*x**5+6*x**4-10*x**3-3*x**2-3*x+6\nq = 6*x**5-7*x**4+3*x**3-4*x**2-2*x+5\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-20 x^2+121 x-84}{10 x^2-58 x+40}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{21}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-20*x**2+121*x-84)/(10*x**2-58*x+40)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-6 x^2-100 \\sqrt{3} x-1200$", + "Output Answer": [ + "$-6 \\left(x+\\frac{20}{\\sqrt{3}}\\right) \\left(x+10 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-6*x**2-100*sqrt(3)*x-1200, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-55 x^2+\\frac{1091 x}{3}-360}{\\frac{100 x^2}{3}-\\frac{395 x}{3}-261}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{40}{33}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-55*x**2+((1091*x)/3)-360)/(((100*x**2)/3)-((395*x)/3)-261)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-5 \\sqrt{2} x^2-8 \\sqrt{2} x+3 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{5} \\left(-4-\\sqrt{31}\\right)\\lor x=\\frac{1}{5} \\left(\\sqrt{31}-4\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-5*sqrt(2)*x**2-8*sqrt(2)*x+3*sqrt(2), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10 x-5}+\\sqrt{12 x-6}=1$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 6-\\sqrt{30}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10*x-5)+sqrt(12*x-6), 1), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(8 \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)+i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$64 \\left(\\sin \\left(\\frac{\\pi }{18}\\right)+i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((8*(math.cos(((2*math.pi)/9))+1j*math.sin(((2*math.pi)/9))))**2)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{129}+\\sqrt{91}$.", + "Output Answer": [ + "$\\sqrt{91}+\\sqrt{129}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(129)+sqrt(91))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2+72 x-324$", + "Output Answer": [ + "$3 (18-x) (x-6)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2+72*x-324, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x-2$ and $-3 x^2-2 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x-2, -3*x**2-2*x-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{52 x^2}{5}-9 x-\\frac{21}{5}$", + "Output Answer": [ + "$x=\\frac{1}{104} \\left(-45-i \\sqrt{2343}\\right)\\lor x=\\frac{1}{104} \\left(-45+i \\sqrt{2343}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((52*x**2)/5)-9*x-(21/5), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2-264 x+\\frac{6061}{4}$", + "Output Answer": [ + "$-11 \\left(\\frac{29}{2}-x\\right) \\left(x-\\frac{19}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2-264*x+(6061/4), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $10 x^2-5 x-5$ and $-2 x-1$.", + "Output Answer": [ + "$2 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(10*x**2-5*x-5, -2*x-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{10 t}{3}-52, x(t)=t-15$", + "Output Answer": [ + "$y=\\frac{10 x}{3}-2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = ((10*t)/3)-52\nx_t = t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^6-9 x^5-3 x^4+10 x^3+6 x^2+7 x-2$ when divided by $3 x^5-10 x^4+9 x^3-8 x^2+3 x+4$.", + "Output Answer": [ + "$2 x+\\frac{11}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**6-9*x**5-3*x**4+10*x**3+6*x**2+7*x-2\nq = 3*x**5-10*x**4+9*x**3-8*x**2+3*x+4\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{x}{\\sqrt{3}}-10 \\sqrt{3} y+2 \\sqrt{3} z-\\frac{28}{\\sqrt{3}}=0$, $-\\frac{20 x}{\\sqrt{3}}-11 \\sqrt{3} y-\\frac{19 z}{\\sqrt{3}}-13 \\sqrt{3}=0$, $-6 \\sqrt{3} x+\\frac{28 y}{\\sqrt{3}}+\\frac{40 z}{\\sqrt{3}}-\\frac{16}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{10894}{10099}$, $y=-\\frac{8101}{10099}$, $z=\\frac{4808}{10099}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-(x/(sqrt(3)))-10*sqrt(3)*y+2*sqrt(3)*z-(28/(sqrt(3))), -((20*x)/(sqrt(3)))-11*sqrt(3)*y-((19*z)/(sqrt(3)))-13*sqrt(3), -6*sqrt(3)*x+((28*y)/(sqrt(3)))+((40*z)/(sqrt(3)))-(16/(sqrt(3))))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\sqrt{2} \\left(\\cos \\left(\\frac{11 \\pi }{90}\\right)+i \\sin \\left(\\frac{11 \\pi }{90}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$64 \\left(-\\sin \\left(\\frac{\\pi }{30}\\right)-i \\cos \\left(\\frac{\\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.sqrt(2)*(math.cos(((11*math.pi)/90))+1j*math.sin(((11*math.pi)/90))))**12)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\sqrt{5} \\left(\\frac{i}{4}+\\frac{i \\sqrt{5}}{4}-\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)$.", + "Output Answer": [ + "Norm: $\\sqrt{5 \\left(\\frac{5}{8}-\\frac{\\sqrt{5}}{8}+\\left(\\frac{1}{4}+\\frac{\\sqrt{5}}{4}\\right)^2\\right)}$\nArgument: $\\tan ^{-1}\\left(\\frac{-\\frac{1}{4}-\\frac{\\sqrt{5}}{4}}{\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.sqrt(5)*((i/4)+((i*math.sqrt(5))/4)-math.sqrt((5/8)-((math.sqrt(5))/8)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-x^6-2 x^5+5 x^4-5 x+1$ when divided by $-4 x^5+3 x^4-2 x^3+3 x^2-10 x-2$.", + "Output Answer": [ + "$\\frac{x}{4}+\\frac{11}{16}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**6-2*x**5+5*x**4-5*x+1\nq = -4*x**5+3*x**4-2*x**3+3*x**2-10*x-2\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 1296 (x-1)^4, q(x) = (9-4 x)^4$", + "Output Answer": [ + "$1552 x^4-7488 x^3+15552 x^2-16848 x+7857$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 1296*(x-1)**4\nq = (9-4*x)**4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$4 x+\\frac{101 y}{7}+\\frac{1}{7}=0$, $-\\frac{66 x}{7}+\\frac{6 y}{7}-\\frac{99}{7}=0$", + "Output Answer": [ + "$x=-\\frac{3335}{2278}$, $y=\\frac{451}{1139}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((4*x+((101*y)/7)+(1/7), -((66*x)/7)+((6*y)/7)-(99/7)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 \\sqrt{3} x^2-4 \\sqrt{3} x+\\sqrt{3}$ and $q(x) = -8 \\sqrt{3} x^2+\\sqrt{3} x-7 \\sqrt{3}$", + "Output Answer": [ + "$-96 x^4+108 x^3-120 x^2+87 x-21$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*sqrt(3)*x**2-4*sqrt(3)*x+sqrt(3)\nq = -8*sqrt(3)*x**2+sqrt(3)*x-7*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{14 x^2-12 x-19}{3 x^2-15 x+20}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{14} \\left(6-\\sqrt{302}\\right)\\right\\},\\left\\{x\\to \\frac{1}{14} \\left(6+\\sqrt{302}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((14*x**2-12*x-19)/(3*x**2-15*x+20)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $5 \\log (2) \\left(\\sin \\left(\\frac{11 \\pi }{60}\\right)-i \\cos \\left(\\frac{11 \\pi }{60}\\right)\\right)$.", + "Output Answer": [ + "Norm: $5 \\log (2) \\sqrt{\\sin ^2\\left(\\frac{11 \\pi }{60}\\right)+\\cos ^2\\left(\\frac{11 \\pi }{60}\\right)}$\nArgument: $-\\frac{19 \\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 5*math.log(2)*(math.sin(((11*math.pi)/60))-i*math.cos(((11*math.pi)/60)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{35 x}{2}+\\frac{81 y}{4}-\\frac{23}{2}=0$, $\\frac{99 x}{4}+\\frac{47 y}{4}+\\frac{57}{4}=0$", + "Output Answer": [ + "$x=-\\frac{6779}{11309}$, $y=\\frac{564}{11309}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((35*x)/2)+((81*y)/4)-(23/2), ((99*x)/4)+((47*y)/4)+(57/4)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 6 x^2+x-3\\right| =0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(-1-\\sqrt{73}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(-1+\\sqrt{73}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(6*x**2+x-3), 0), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-192 x^2+488 x-266}{-120 x^2+98 x+196}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{19}{24}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-192*x**2+488*x-266)/(-120*x**2+98*x+196)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all roots of the following function: $e^{\\frac{5 x}{2}+4} \\sqrt[3]{\\sin \\left(\\frac{3 x}{2}+\\frac{17}{2}\\right)}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{3} (4 \\pi c_1-17)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\},\\left\\{x\\to \\fbox{$\\frac{1}{3} (4 \\pi c_1+2 \\pi -17)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(math.e**(((5*x)/2)+4)*cbrt(sin(((3*x)/2)+(17/2))), x)\n print(soln)\nexcept: ...\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{3 x-21}{-14 x^2+9 x-1}=0$", + "Output Answer": [ + "$\\{\\{x\\to 7\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((3*x-21)/(-14*x**2+9*x-1)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{7 \\left(-\\cos \\left(\\frac{11 \\pi }{90}\\right)-i \\sin \\left(\\frac{11 \\pi }{90}\\right)\\right)}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $7 \\sqrt{\\frac{1}{3} \\left(\\sin ^2\\left(\\frac{11 \\pi }{90}\\right)+\\cos ^2\\left(\\frac{11 \\pi }{90}\\right)\\right)}$\nArgument: $-\\frac{79 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((7*(-math.cos(((11*math.pi)/90))-i*math.sin(((11*math.pi)/90))))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{32 x^2}{7}+\\frac{62 x}{7}+\\frac{85}{7}$", + "Output Answer": [ + "$x=\\frac{1}{32} \\left(31-3 \\sqrt{409}\\right)\\lor x=\\frac{1}{32} \\left(31+3 \\sqrt{409}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((32*x**2)/7)+((62*x)/7)+(85/7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-8 \\left(-\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)$.", + "Output Answer": [ + "Norm: $8$\nArgument: $\\frac{\\pi }{3}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -8*(-(1/2)-((i*math.sqrt(3))/2))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^2+5 x-2$ when divided by $7-7 x$.", + "Output Answer": [ + "$x+\\frac{2}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**2+5*x-2\nq = 7-7*x\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-10 x-5 y^2+9 y+7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x-\\frac{5}{8}\\right)^2-5 \\left(y-\\frac{9}{10}\\right)^2=-\\frac{317}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{8} & \\frac{1}{40} \\left(36-\\sqrt{4121}\\right) \\\\\n \\frac{5}{8} & \\frac{1}{40} \\left(36+\\sqrt{4121}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{13}{2}}}{2}$\nCenter: $\\left\\{\\frac{5}{8},\\frac{1}{2} \\left(\\frac{1}{40} \\left(36-\\sqrt{4121}\\right)+\\frac{1}{40} \\left(36+\\sqrt{4121}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{20} \\left(18+5 \\sqrt{10}\\right)-2 \\sqrt{\\frac{2}{5}} x,y=2 \\sqrt{\\frac{2}{5}} x+\\frac{1}{20} \\left(18-5 \\sqrt{10}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-10*x-5*y**2+9*y+7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 x^2+8 x-4$ and $q(x) = 9 x^2-3 x+13$", + "Output Answer": [ + "$-45 x^4+87 x^3-125 x^2+116 x-52$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -5*x**2+8*x-4\nq = 9*x**2-3*x+13\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{91}{5}$, and $a_n=a_{n-1}+-\\frac{14}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=12$.", + "Output Answer": [ + "$6 \\left(-\\frac{182}{5}-\\frac{154}{\\sqrt{5}}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(91/5) # initial value\nd = -(14/(math.sqrt(5))) # second term\nn = 12 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(91/5) # initial value\nd = -(14/(math.sqrt(5))) # second term\nn = 12 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{7 x^2}{\\sqrt{3}}+\\frac{13 x}{\\sqrt{3}}-\\sqrt{3}$", + "Output Answer": [ + "$\\frac{7 \\left(x+\\frac{13}{14}\\right)^2}{\\sqrt{3}}-\\sqrt{3}-\\frac{169}{28 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((7*x**2)/(math.sqrt(3)))+((13*x)/(math.sqrt(3)))-math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\sqrt{3} x-10 \\sqrt{3}\\right| =13 \\sqrt{3}$", + "Output Answer": [ + "$\\{\\{x\\to -23\\},\\{x\\to 3\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-sqrt(3)*x-10*sqrt(3)), 13*sqrt(3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-0.85505-2.34923 i$.", + "Output Answer": [ + "Norm: $2.5$\nArgument: $-1.91986$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -0.85505-2.34923*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-4+12 i) \\log (2)$ and $y=(-4+3 i) \\log (2)$", + "Output Answer": [ + "$\\frac{52}{25}-\\frac{36 i}{25}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-4+12*i)*math.log10(2)\ny = (-4+3*i)*math.log10(2)\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\pi \\left(-x^2+4 x+1\\right)$, $q(x) = \\pi \\left(x^2-3 x-4\\right)$", + "Output Answer": [ + "$\\pi x-3 \\pi$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = pi*(-x**2+4*x+1)\nq = pi*(x**2-3*x-4)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x+7}+\\sqrt{13 x-1}=8$", + "Output Answer": [ + "$\\{\\{x\\to 2\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x+7)+sqrt(13*x-1), 8), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=36 (2 t+7)^2, x(t)=-4 t-15$", + "Output Answer": [ + "$y=9 x^2+18 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 36*(2*t+7)**2\nx_t = -4*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{7 \\left(\\cos \\left(\\frac{173}{90}\\right)+i \\sin \\left(\\frac{173}{90}\\right)\\right)}{\\sqrt{3}}\\right)^10$", + "Output Answer": [ + "$\\frac{282475249}{243} \\left(\\cos \\left(\\frac{173}{9}\\right)+i \\sin \\left(\\frac{173}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((7*(math.cos((173/90))+1j*math.sin((173/90))))/(math.sqrt(3))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(9 \\left(\\cos \\left(\\frac{29}{30}\\right)+i \\sin \\left(\\frac{29}{30}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$531441 \\left(\\cos \\left(\\frac{29}{5}\\right)+i \\sin \\left(\\frac{29}{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((9*(math.cos((29/30))+1j*math.sin((29/30))))**6)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $1-2 x^2$ and $-2 x^5-3 x^4-3 x^3-3 x^2+5 x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(1-2*x**2, -2*x**5-3*x**4-3*x**3-3*x**2+5*x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{4}{43}$, and $a_n=a_{n-1}+-4 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$\\frac{29}{2} \\left(-\\frac{8}{43}-112 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(4/43) # initial value\nd = -4*math.sqrt(3) # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(4/43) # initial value\nd = -4*math.sqrt(3) # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $7 x^2-7 x+8$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(7-5 i \\sqrt{7}\\right)\\lor x=\\frac{1}{14} \\left(7+5 i \\sqrt{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(7*x**2-7*x+8, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-11 x-6}+\\sqrt{-7 x-10}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -17+4 \\sqrt{15}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-11*x-6)+sqrt(-7*x-10), 4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{81}{55}$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{33405}{11}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (81/55) # initial value\nd = 10 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (81/55) # initial value\nd = 10 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{19 x^2}{2}-\\frac{17 x}{2}-\\frac{25}{2}$", + "Output Answer": [ + "$x=\\frac{1}{38} \\left(-17-3 i \\sqrt{179}\\right)\\lor x=\\frac{1}{38} \\left(-17+3 i \\sqrt{179}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((19*x**2)/2)-((17*x)/2)-(25/2), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{5-6}{11}-11\\right) ((((23+7)-7)+25)-24)$.", + "Output Answer": [ + "$-\\frac{2928}{11}$" + ], + "Output Program": [ + "try: \n print((((5-6)/11)-11)*((((23+7)-7)+25)-24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt[3]{\\cosh ^{-1}(6 x)}$", + "Output Answer": [ + "$x\\geq \\frac{1}{6}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = cbrt(acosh(6*x))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(\\cos \\left(\\frac{\\pi }{18}\\right)+i \\sin \\left(\\frac{\\pi }{18}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$9 \\left(\\cos \\left(\\frac{\\pi }{9}\\right)+i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(math.cos((math.pi/18))+1j*math.sin((math.pi/18))))**2)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{10 \\sqrt{3} x^2+14 \\sqrt{3} x-5 \\sqrt{3}}{-\\sqrt{3} x-8 \\sqrt{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(-7-3 \\sqrt{11}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(-7+3 \\sqrt{11}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((10*sqrt(3)*x**2+14*sqrt(3)*x-5*sqrt(3))/(-sqrt(3)*x-8*sqrt(3))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{48 x^2-128 x-91}{68 x^2-193 x-91}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{12}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((48*x**2-128*x-91)/(68*x**2-193*x-91)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{9 x^2}{2}-\\frac{63 x}{4}+\\frac{41}{4}}{\\frac{79 x}{4}+\\frac{37}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(21-\\sqrt{113}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(21+\\sqrt{113}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((9*x**2)/2)-((63*x)/4)+(41/4))/(((79*x)/4)+(37/2))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{6 x^2+13 x-25}{2 x^2+2 x-7}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(-13-\\sqrt{769}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(-13+\\sqrt{769}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((6*x**2+13*x-25)/(2*x**2+2*x-7)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^5-4 x^4+5 x^3-7 x^2-1$ when divided by $9 x^5+6 x^3+4 x^2-5 x-7$.", + "Output Answer": [ + "$-\\frac{2}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**5-4*x**4+5*x**3-7*x**2-1\nq = 9*x**5+6*x**3+4*x**2-5*x-7\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-7 x^2-14 x+693$", + "Output Answer": [ + "$-7 (x-9) (x+11)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-7*x**2-14*x+693, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $3 \\sqrt{3} \\left(\\cos \\left(\\frac{29 \\pi }{180}\\right)+i \\sin \\left(\\frac{29 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $3 \\sqrt{3 \\left(\\sin ^2\\left(\\frac{29 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{29 \\pi }{180}\\right)\\right)}$\nArgument: $\\frac{29 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 3*math.sqrt(3)*(math.cos(((29*math.pi)/180))+i*math.sin(((29*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{165 x^3-119 x^2-156 x+80}{66 x^2+146 x-80}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{15} \\left(2-2 \\sqrt{61}\\right)\\right\\},\\left\\{x\\to \\frac{1}{15} \\left(2+2 \\sqrt{61}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((165*x**3-119*x**2-156*x+80)/(66*x**2+146*x-80)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{8} (189 t+850), x(t)=-\\frac{7 t}{2}-15$", + "Output Answer": [ + "$y=5-\\frac{27 x}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/8)*(189*t+850)\nx_t = -((7*t)/2)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{5}{6}$, and $a_n=a_{n-1}+-5$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$-\\frac{665}{6}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(5/6) # initial value\nd = -5 # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(5/6) # initial value\nd = -5 # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((9+18)+8)^2-(10+2)$.", + "Output Answer": [ + "$1213$" + ], + "Output Program": [ + "try: \n print(((9+18)+8)**2-(10+2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{3} \\left(t^2+52 t+671\\right)^2, x(t)=\\frac{t^2}{3}+\\frac{52 t}{3}+\\frac{676}{3}$", + "Output Answer": [ + "$y=3 x^2-10 x+\\frac{25}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/3)*(t**2+52*t+671)**2\nx_t = ((t**2)/3)+((52*t)/3)+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-12 x^2-10 x+4$", + "Output Answer": [ + "$\\frac{73}{12}-12 \\left(x+\\frac{5}{12}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-12*x**2-10*x+4), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\frac{2 x^4+3}{(5 x+3)^4}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\sqrt[4]{-\\frac{3}{2}}\\right\\},\\left\\{x\\to -i \\sqrt[4]{-\\frac{3}{2}}\\right\\},\\left\\{x\\to i \\sqrt[4]{-\\frac{3}{2}}\\right\\},\\left\\{x\\to \\sqrt[4]{-\\frac{3}{2}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(((2*x**4+3)/((5*x+3)**4)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-2 x-5}+\\sqrt{-\\frac{x}{3}-13}=\\frac{44}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{75} \\left(-13192+88 \\sqrt{8331}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-2*x-5)+sqrt(-(x/3)-13), (44/3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{3+3 i}{\\sqrt{2}}$ and $y=-\\frac{7-9 i}{\\sqrt{2}}$", + "Output Answer": [ + "$-\\frac{3}{65}+\\frac{24 i}{65}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((3+3*i)/(math.sqrt(2)))\ny = -((7-9*i)/(math.sqrt(2)))\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-x+2 y^2-9 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x-\\frac{1}{10}\\right)^2+2 \\left(y-\\frac{9}{4}\\right)^2=\\frac{607}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{10} & \\frac{9}{4}-\\frac{\\sqrt{1821}}{20} \\\\\n \\frac{1}{10} & \\frac{1}{20} \\left(45+\\sqrt{1821}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{5}}$\nCenter: $\\left\\{\\frac{1}{10},\\frac{1}{2} \\left(\\frac{9}{4}-\\frac{\\sqrt{1821}}{20}+\\frac{1}{20} \\left(45+\\sqrt{1821}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{607 \\pi }{40 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-x+2*y**2-9*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-16 x^6-4 x^5+32 x^4+28 x^3+8 x+16$ and $4 x^5-3 x^4-5 x^3-2 x^2+2 x-4$.", + "Output Answer": [ + "$4 x^5-3 x^4-5 x^3-2 x^2+2 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-16*x**6-4*x**5+32*x**4+28*x**3+8*x+16, 4*x**5-3*x**4-5*x**3-2*x**2+2*x-4))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{11}{9}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=28$.", + "Output Answer": [ + "$\\frac{13300}{9}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(11/9) # initial value\nd = 4 # second term\nn = 28 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(11/9) # initial value\nd = 4 # second term\nn = 28 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 x^2+10 x+8$ and $q(x) = 4 x^2+2 x-8$", + "Output Answer": [ + "$-20 x^4+30 x^3+92 x^2-64 x-64$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -5*x**2+10*x+8\nq = 4*x**2+2*x-8\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $x^2-\\frac{29 x}{3}+15$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(29-\\sqrt{301}\\right)\\lor x=\\frac{1}{6} \\left(29+\\sqrt{301}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(x**2-((29*x)/3)+15, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{27 x^6}{5}-6 x^5-5 x^4-\\frac{29 x^3}{5}+\\frac{13 x^2}{5}+9 x+\\frac{47}{5}$ when divided by $\\frac{17 x^5}{5}+\\frac{47 x^4}{5}-\\frac{48 x^3}{5}+\\frac{4 x^2}{5}-7 x+\\frac{38}{5}$.", + "Output Answer": [ + "$\\frac{27 x}{17}-\\frac{1779}{289}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((27*x**6)/5)-6*x**5-5*x**4-((29*x**3)/5)+((13*x**2)/5)+9*x+(47/5)\nq = ((17*x**5)/5)+((47*x**4)/5)-((48*x**3)/5)+((4*x**2)/5)-7*x+(38/5)\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2+\\frac{775 x}{7}-\\frac{4250}{7}$", + "Output Answer": [ + "$5 \\left(\\frac{85}{7}-x\\right) (x-10)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2+((775*x)/7)-(4250/7), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt{-x-2}-\\sqrt[3]{7 x-3}$", + "Output Answer": [ + "$x\\leq -2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sqrt(-x-2)-cbrt(7*x-3)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{7}{4}$, and $a_n=a_{n-1}+-4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$-795$" + ], + "Output Program": [ + "a = -(7/4) # initial value\nd = -4 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(7/4) # initial value\nd = -4 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(((22+19)-20)-15) ((((20+12)-16)+15)-8)^2$.", + "Output Answer": [ + "$3174$" + ], + "Output Program": [ + "try: \n print((((22+19)-20)-15)*((((20+12)-16)+15)-8)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-16 x+14 y+6=0$, $-12 x-19 y-14=0$", + "Output Answer": [ + "$x=-\\frac{41}{236}$, $y=-\\frac{37}{59}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-16*x+14*y+6, -12*x-19*y-14), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2+13 x+140$", + "Output Answer": [ + "$-((-x-7) (20-x))$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2+13*x+140, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 2 \\sqrt{2} (x-5)^3, q(x) = 4 (2-3 x)^4$", + "Output Answer": [ + "$324 x^4+2 \\sqrt{2} x^3-864 x^3-30 \\sqrt{2} x^2+864 x^2+150 \\sqrt{2} x-384 x-250 \\sqrt{2}+64$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*sqrt(2)*(x-5)**3\nq = 4*(2-3*x)**4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-2 e^{-\\frac{2 i \\pi }{3}} \\log (2)$.", + "Output Answer": [ + "Norm: $2 \\log (2)$\nArgument: $\\frac{\\pi }{3}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -2*math.e**(-((2*i*math.pi)/3))*math.log(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt{\\tan \\left(\\frac{5}{2}-5 x\\right)}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{10} (2 \\pi c_1+5)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(sqrt(tan((5/2)-5*x)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(\\cos \\left(\\frac{19}{15}\\right)+i \\sin \\left(\\frac{19}{15}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$1024 \\left(\\cos \\left(\\frac{19}{3}\\right)+i \\sin \\left(\\frac{19}{3}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(math.cos((19/15))+1j*math.sin((19/15))))**5)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $2 x^2-3 x-14$", + "Output Answer": [ + "$2 \\left(x-\\frac{3}{4}\\right)^2-\\frac{121}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (2*x**2-3*x-14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{84 x^2-6 x-18}{-\\frac{189 x^2}{4}+\\frac{3 x}{4}+9}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((84*x**2-6*x-18)/(-((189*x**2)/4)+((3*x)/4)+9)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{24}{5}-\\frac{13 x}{5}\\right| =\\frac{18}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{6}{13}\\right\\},\\left\\{x\\to \\frac{42}{13}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs((24/5)-((13*x)/5)), (18/5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-220 x^2+636 x-368}{-440 x^2+692 x-272}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{23}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-220*x**2+636*x-368)/(-440*x**2+692*x-272)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+9 x-y^2+7 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x+\\frac{3}{2}\\right)^2-\\left(y-\\frac{7}{2}\\right)^2=-\\frac{1}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{2} & \\frac{7}{2}-\\sqrt{\\frac{2}{3}} \\\\\n -\\frac{3}{2} & \\frac{7}{2}+\\sqrt{\\frac{2}{3}} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{3}}$\nCenter: $\\left\\{-\\frac{3}{2},\\frac{7}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{2} \\left(7-3 \\sqrt{3}\\right)-\\sqrt{3} x,y=\\sqrt{3} x+\\frac{1}{2} \\left(7+3 \\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+9*x-y**2+7*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-10 y^2+6 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 x^2-10 \\left(y-\\frac{3}{10}\\right)^2=-\\frac{49}{10}$\nFoci: $\\left(\n\\begin{array}{cc}\n 0 & \\frac{1}{30} \\left(9-14 \\sqrt{6}\\right) \\\\\n 0 & \\frac{1}{30} \\left(9+14 \\sqrt{6}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{0,\\frac{1}{2} \\left(\\frac{1}{30} \\left(9-14 \\sqrt{6}\\right)+\\frac{1}{30} \\left(9+14 \\sqrt{6}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3}{10}-\\sqrt{\\frac{3}{5}} x,y=\\sqrt{\\frac{3}{5}} x+\\frac{3}{10}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-10*y**2+6*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -7 x^2+23 x-16\\right| =11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{14} \\left(23-\\sqrt{389}\\right)\\right\\},\\left\\{x\\to \\frac{1}{14} \\left(23+\\sqrt{389}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-7*x**2+23*x-16), 11), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-i \\sqrt{3}$ and $y=(-3+3 i) \\sqrt{3}$", + "Output Answer": [ + "$(3-4 i) \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -i*math.sqrt(3)\ny = (-3+3*i)*math.sqrt(3)\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{1}{4}$, and $a_n=a_{n-1}+-\\frac{15}{4}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$-\\frac{1183}{4}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(1/4) # initial value\nd = -(15/4) # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(1/4) # initial value\nd = -(15/4) # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{1}{343} (59 x+2)^3, q(x) = \\frac{1}{7} (34-45 x)$", + "Output Answer": [ + "$-\\frac{205379 x^3}{343}-\\frac{20886 x^2}{343}-\\frac{2913 x}{343}+\\frac{1658}{343}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(1/343)*(59*x+2)**3\nq = (1/7)*(34-45*x)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x^2-2 x-4$ and $-3 x^4+2 x^3-3 x^2-x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x**2-2*x-4, -3*x**4+2*x**3-3*x**2-x-3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{68 x}{5}+\\frac{71 y}{5}+\\frac{68}{5}=0$, $4 x-\\frac{123 y}{5}-\\frac{99}{5}=0$", + "Output Answer": [ + "$x=-\\frac{1335}{9784}$, $y=-\\frac{2023}{2446}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((68*x)/5)+((71*y)/5)+(68/5), 4*x-((123*y)/5)-(99/5)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| -15 x-12| =-22$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-15*x-12), -22), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x-2}+\\sqrt{7 x+8}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(2126-140 \\sqrt{214}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x-2)+sqrt(7*x+8), 14), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{16} (34-9 t)^2, x(t)=\\frac{9 t}{4}-15$", + "Output Answer": [ + "$y=x^2+13 x+\\frac{169}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/16)*(34-9*t)**2\nx_t = ((9*t)/4)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2-8 y^2+7 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 x^2-8 \\left(y-\\frac{7}{16}\\right)^2=-\\frac{145}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n 0 & \\frac{1}{16} \\left(7-5 \\sqrt{29}\\right) \\\\\n 0 & \\frac{1}{16} \\left(7+5 \\sqrt{29}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{5}$\nCenter: $\\left\\{0,\\frac{1}{2} \\left(\\frac{1}{16} \\left(7-5 \\sqrt{29}\\right)+\\frac{1}{16} \\left(7+5 \\sqrt{29}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{7}{16}-\\frac{x}{2},y=\\frac{x}{2}+\\frac{7}{16}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2-8*y**2+7*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $4 x^2-6 x+8$", + "Output Answer": [ + "$4 \\left(x-\\frac{3}{4}\\right)^2+\\frac{23}{4}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (4*x**2-6*x+8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $10 x^3-x^2+3 x+3$ and $2 x+1$.", + "Output Answer": [ + "$2 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(10*x**3-x**2+3*x+3, 2*x+1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$22 x+25 y-18 z-12=0$, $4 x+5 y-2 z+5=0$, $3 x-21 y+22 z+3=0$", + "Output Answer": [ + "$x=\\frac{389}{232}$, $y=-\\frac{1867}{464}$, $z=-\\frac{3903}{928}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((22*x+25*y-18*z-12, 4*x+5*y-2*z+5, 3*x-21*y+22*z+3)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 6 x^2-12 x-1$, $q(x) = -13 x^2+12 x+3$", + "Output Answer": [ + "$2-7 x^2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**2-12*x-1\nq = -13*x**2+12*x+3\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $7 x^2+3 x-1$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(-3-\\sqrt{37}\\right)\\lor x=\\frac{1}{14} \\left(\\sqrt{37}-3\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(7*x**2+3*x-1, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{22-1}{(3-14)^2}$.", + "Output Answer": [ + "$\\frac{21}{121}$" + ], + "Output Program": [ + "try: \n print(((22-1)/((3-14)**2)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(((9+20)-7)^2+8\\right)^2+((13-13)+13)$.", + "Output Answer": [ + "$242077$" + ], + "Output Program": [ + "try: \n print((((9+20)-7)**2+8)**2+((13-13)+13))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\left(-\\sin \\left(\\frac{11 \\pi }{45}\\right)-i \\cos \\left(\\frac{11 \\pi }{45}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1024 \\left(-\\sin \\left(\\frac{\\pi }{18}\\right)+i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*(-math.sin(((11*math.pi)/45))-1j*math.cos(((11*math.pi)/45))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\sqrt{5} x^2$", + "Output Answer": [ + "$x=0\\lor x=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(sqrt(5)*x**2, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-5 x^2+2 x+11$", + "Output Answer": [ + "$x=\\frac{1}{5} \\left(1-2 \\sqrt{14}\\right)\\lor x=\\frac{1}{5} \\left(1+2 \\sqrt{14}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-5*x**2+2*x+11, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -6 x^2+13 x+14$ and $q(x) = -11 x^2+14 x-15$", + "Output Answer": [ + "$66 x^4-227 x^3+118 x^2+x-210$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -6*x**2+13*x+14\nq = -11*x**2+14*x-15\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\cos (5 x+4)$ at the point $x=-8$", + "Output Answer": [ + "$\\cos (36) = -0.128$" + ], + "Output Program": [ + "import math\n\nx = -8\ntry: \n f = math.cos(5*x+4)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-7-\\frac{44 i}{7}$ and $y=\\frac{20}{7}+\\frac{i}{7}$", + "Output Answer": [ + "$-\\frac{69}{7}-\\frac{45 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = -7-((44*i)/7)\ny = (20/7)+(i/7)\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-3 x+y+25=0$, $-17 x-12 y+25=0$", + "Output Answer": [ + "$x=\\frac{325}{53}$, $y=-\\frac{350}{53}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-3*x+y+25, -17*x-12*y+25), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $5 x^2-10 x-75$", + "Output Answer": [ + "$-5 (5-x) (x+3)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(5*x**2-10*x-75, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{7 x}{3}+\\frac{26}{3}}+\\sqrt{9 x-\\frac{23}{3}}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{200} \\left(9109-13 \\sqrt{339249}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((7*x)/3)+(26/3))+sqrt(9*x-(23/3)), 13), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-12 x^2-\\frac{11 x}{4}+\\frac{21}{2}$", + "Output Answer": [ + "$x=\\frac{1}{96} \\left(-11-\\sqrt{8185}\\right)\\lor x=\\frac{1}{96} \\left(\\sqrt{8185}-11\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-12*x**2-((11*x)/4)+(21/2), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-5 x-7}+\\sqrt{4-3 x}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-335+9 \\sqrt{1297}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-5*x-7)+sqrt(4-3*x), 9), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\cos (5 x+1)-\\sqrt[3]{x-1}$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = cos(5*x+1)-cbrt(x-1)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -12 x^2-4 x-13$, $q(x) = -10 x^2-7 x+12$", + "Output Answer": [ + "$-22 x^2-11 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -12*x**2-4*x-13\nq = -10*x**2-7*x+12\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{-4 x-6}+\\tan (2-3 x)$ at the point $x=4$", + "Output Answer": [ + "$-\\sqrt[3]{22}-\\tan (10) = -3.45$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 4\ntry: \n f = np.cbrt(-4*x-6)+math.tan(2-3*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{31 x^2}{7}-\\frac{123 x}{7}-14}{\\frac{83 x}{7}+22}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{62} \\left(-123-\\sqrt{2977}\\right)\\right\\},\\left\\{x\\to \\frac{1}{62} \\left(-123+\\sqrt{2977}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((31*x**2)/7)-((123*x)/7)-14)/(((83*x)/7)+22)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{2} (35-3 t), x(t)=\\frac{3 t}{2}-15$", + "Output Answer": [ + "$y=\\frac{5}{2}-x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/2)*(35-3*t)\nx_t = ((3*t)/2)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2+56 x+1824$", + "Output Answer": [ + "$8 (-x-12) (x-19)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2+56*x+1824, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\sqrt{2} \\left(\\sin \\left(\\frac{\\pi }{90}\\right)-i \\cos \\left(\\frac{\\pi }{90}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$2 \\left(-\\cos \\left(\\frac{\\pi }{45}\\right)-i \\sin \\left(\\frac{\\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.sqrt(2)*(math.sin((math.pi/90))-1j*math.cos((math.pi/90))))**2)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $10 x-3 x^2$", + "Output Answer": [ + "$x=\\frac{10}{3}\\lor x=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(10*x-3*x**2, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{66 x^2}{7}+\\frac{66 x}{7}+\\frac{74}{7}$", + "Output Answer": [ + "$x=\\frac{1}{66} \\left(33-\\sqrt{5973}\\right)\\lor x=\\frac{1}{66} \\left(33+\\sqrt{5973}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((66*x**2)/7)+((66*x)/7)+(74/7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 3 x^2-12 x-13$, $q(x) = -11 x^2+13 x-9$", + "Output Answer": [ + "$-8 x^2+x-22$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**2-12*x-13\nq = -11*x**2+13*x-9\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$21 y+25=0$, $12 x-18 y+1=0$", + "Output Answer": [ + "$x=-\\frac{157}{84}$, $y=-\\frac{25}{21}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((21*y+25, 12*x-18*y+1), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+2 x-3 y^2-y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x+\\frac{1}{6}\\right)^2-3 \\left(y+\\frac{1}{6}\\right)^2=\\frac{49}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{12} \\left(-2-7 \\sqrt{6}\\right) & -\\frac{1}{6} \\\\\n \\frac{1}{12} \\left(7 \\sqrt{6}-2\\right) & -\\frac{1}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{12} \\left(-2-7 \\sqrt{6}\\right)+\\frac{1}{12} \\left(7 \\sqrt{6}-2\\right)\\right),-\\frac{1}{6}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{2} x+\\frac{1}{6} \\left(\\sqrt{2}-1\\right),y=\\frac{1}{6} \\left(-1-\\sqrt{2}\\right)-\\sqrt{2} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+2*x-3*y**2-y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(19+19)-((((25+5)-25)+3)-23)$.", + "Output Answer": [ + "$53$" + ], + "Output Program": [ + "try: \n print((19+19)-((((25+5)-25)+3)-23))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\sqrt{2} \\left(-\\cos \\left(\\frac{19 \\pi }{90}\\right)+i \\sin \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$104976 \\left(\\sin \\left(\\frac{17 \\pi }{90}\\right)+i \\cos \\left(\\frac{17 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*math.sqrt(2)*(-math.cos(((19*math.pi)/90))+1j*math.sin(((19*math.pi)/90))))**8)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{49}{31}$, and $a_n=a_{n-1}+-9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$-\\frac{111853}{31}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (49/31) # initial value\nd = -9 # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (49/31) # initial value\nd = -9 # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(\\sin \\left(\\frac{19 \\pi }{90}\\right)+i \\cos \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-2048 \\left(-\\cos \\left(\\frac{8 \\pi }{45}\\right)-i \\sin \\left(\\frac{8 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(math.sin(((19*math.pi)/90))+1j*math.cos(((19*math.pi)/90))))**11)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2-3 x+3$ and $-x^2+x-1$.", + "Output Answer": [ + "$x^2-x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2-3*x+3, -x**2+x-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{3}}, 10, 3)$", + "Output Answer": [ + "$\\left\\{2 \\sqrt{\\frac{82}{3}},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{301}{3}}}{3}\\right),\\tan ^{-1}\\left(10 \\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(3)))\ny = 10\nz = 3\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $6 x^2+26 x-\\frac{28}{3}$", + "Output Answer": [ + "$6 \\left(x-\\frac{1}{3}\\right) \\left(x+\\frac{14}{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(6*x**2+26*x-(28/3), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $11 x^2-12 x+5$", + "Output Answer": [ + "$11 \\left(x-\\frac{6}{11}\\right)^2+\\frac{19}{11}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (11*x**2-12*x+5), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{10 x^2}{\\sqrt{3}}+\\frac{16 x}{\\sqrt{3}}+7 \\sqrt{3}$ and $q(x) = \\frac{22}{\\sqrt{3}}-\\frac{7 x}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{70 x^3}{3}-\\frac{332 x^2}{3}+\\frac{205 x}{3}+154$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((10*x**2)/(sqrt(3)))+((16*x)/(sqrt(3)))+7*sqrt(3)\nq = (22/(sqrt(3)))-((7*x)/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-9 x^2+14 x-11$", + "Output Answer": [ + "$x=\\frac{1}{9} \\left(7-5 i \\sqrt{2}\\right)\\lor x=\\frac{1}{9} \\left(7+5 i \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-9*x**2+14*x-11, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-x-23 y-12=0$, $22 x+y+13=0$", + "Output Answer": [ + "$x=-\\frac{287}{505}$, $y=-\\frac{251}{505}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-x-23*y-12, 22*x+y+13), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{74 x^2}{7}+6 x-3$, $q(x) = -7 x^2+\\frac{52 x}{7}+\\frac{27}{7}$", + "Output Answer": [ + "$-\\frac{123 x^2}{7}+\\frac{94 x}{7}+\\frac{6}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((74*x**2)/7)+6*x-3\nq = -7*x**2+((52*x)/7)+(27/7)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2+2 x+4 y^2-8 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 (y-1)^2-6 \\left(x-\\frac{1}{6}\\right)^2=\\frac{59}{6}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{6} & 1-\\frac{\\sqrt{\\frac{295}{2}}}{6} \\\\\n \\frac{1}{6} & \\frac{1}{12} \\left(12+\\sqrt{590}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{3}}$\nCenter: $\\left\\{\\frac{1}{6},\\frac{1}{2} \\left(1-\\frac{\\sqrt{\\frac{295}{2}}}{6}+\\frac{1}{12} \\left(12+\\sqrt{590}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{12} \\left(12+\\sqrt{6}\\right)-\\sqrt{\\frac{3}{2}} x,y=\\sqrt{\\frac{3}{2}} x+\\frac{1}{12} \\left(12-\\sqrt{6}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2+2*x+4*y**2-8*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\sqrt{3} \\left(-\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(1-\\sqrt{5}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-648 \\sqrt{3} \\left(-\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(-1-\\sqrt{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*math.sqrt(3)*(-math.sqrt((5/8)+((math.sqrt(5))/8))+(1/4)*1j*(1-math.sqrt(5))))**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{21}{\\sqrt{2}}-13 \\sqrt{2} x\\right| =9 \\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{26}\\right\\},\\left\\{x\\to \\frac{3}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs((21/(sqrt(2)))-13*sqrt(2)*x), 9*sqrt(2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{1}{3} \\left(\\frac{1}{6} ((7-1)+22)\\right)\\right) (4-7)$.", + "Output Answer": [ + "$-\\frac{14}{3}$" + ], + "Output Program": [ + "try: \n print(((1/3)*((1/6)*((7-1)+22)))*(4-7))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(-\\cos \\left(\\frac{17 \\pi }{90}\\right)+i \\sin \\left(\\frac{17 \\pi }{90}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$49 \\left(\\sin \\left(\\frac{11 \\pi }{90}\\right)-i \\cos \\left(\\frac{11 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(-math.cos(((17*math.pi)/90))+1j*math.sin(((17*math.pi)/90))))**2)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{(((21-16)-13)-19)-8}{22+22}$.", + "Output Answer": [ + "$-\\frac{35}{44}$" + ], + "Output Program": [ + "try: \n print((((((21-16)-13)-19)-8)/(22+22)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{445 x^3}{8}+\\frac{8133 x^2}{16}+\\frac{1819 x}{8}-\\frac{3081}{16}}{\\frac{1911}{8}-\\frac{4361 x}{8}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{20} \\left(87-\\sqrt{10729}\\right)\\right\\},\\left\\{x\\to \\frac{1}{20} \\left(87+\\sqrt{10729}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((445*x**3)/8)+((8133*x**2)/16)+((1819*x)/8)-(3081/16))/((1911/8)-((4361*x)/8))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 9 x^2-3 x+10$ and $q(x) = -x^2+14 x+15$", + "Output Answer": [ + "$-9 x^4+129 x^3+83 x^2+95 x+150$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 9*x**2-3*x+10\nq = -x**2+14*x+15\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $12 x^6-2 x^5-31 x^4+24 x^3+37 x^2-19 x-15$ and $3 x^4-2 x^3-3 x^2+5 x+3$.", + "Output Answer": [ + "$3 x^4-2 x^3-3 x^2+5 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(12*x**6-2*x**5-31*x**4+24*x**3+37*x**2-19*x-15, 3*x**4-2*x**3-3*x**2+5*x+3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{8}{9}$, and $a_n=a_{n-1}+\\frac{39}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{3949}{9}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (8/9) # initial value\nd = (39/5) # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (8/9) # initial value\nd = (39/5) # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{27}{53}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$\\frac{108}{53}$" + ], + "Output Program": [ + "a = (27/53) # initial value\nd = 0 # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (27/53) # initial value\nd = 0 # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\sqrt{2} \\left(-\\sin \\left(\\frac{\\pi }{45}\\right)-i \\cos \\left(\\frac{\\pi }{45}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$1562500000 \\sqrt{2} \\left(\\sin \\left(\\frac{11 \\pi }{45}\\right)+i \\cos \\left(\\frac{11 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*math.sqrt(2)*(-math.sin((math.pi/45))-1j*math.cos((math.pi/45))))**11)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-x^2-4 x+4$ and $2 x^5+x^3-5 x^2-5 x-4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-x**2-4*x+4, 2*x**5+x**3-5*x**2-5*x-4))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $8 x^2-2$ and $-4 x-2$.", + "Output Answer": [ + "$4 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(8*x**2-2, -4*x-2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{47}{5} \\left(\\cos \\left(\\frac{2 \\pi }{45}\\right)+i \\sin \\left(\\frac{2 \\pi }{45}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{52599132235830049 \\left(\\sin \\left(\\frac{\\pi }{18}\\right)+i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)}{9765625}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(47/5)*(math.cos(((2*math.pi)/45))+1j*math.sin(((2*math.pi)/45))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{19 x^4}{2}+\\frac{17 x^3}{2}-\\frac{17 x^2}{2}-9 x-\\frac{1}{2}$ when divided by $7 x^5+x^4-\\frac{5 x^3}{2}-7 x^2-9 x+1$.", + "Output Answer": [ + "$0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((19*x**4)/2)+((17*x**3)/2)-((17*x**2)/2)-9*x-(1/2)\nq = 7*x**5+x**4-((5*x**3)/2)-7*x**2-9*x+1\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{5146 x^3}{49}-\\frac{14843 x^2}{49}-\\frac{257 x}{49}+\\frac{12300}{49}}{-\\frac{3348 x^2}{49}-\\frac{428 x}{7}+\\frac{1275}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{166} \\left(-139-\\sqrt{73769}\\right)\\right\\},\\left\\{x\\to \\frac{1}{166} \\left(-139+\\sqrt{73769}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((5146*x**3)/49)-((14843*x**2)/49)-((257*x)/49)+(12300/49))/(-((3348*x**2)/49)-((428*x)/7)+(1275/49))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{32 x^5}{5}-\\frac{34 x^4}{5}+\\frac{21 x^3}{5}+\\frac{46 x^2}{5}+4 x+\\frac{28}{5}$ when divided by $\\frac{18 x^5}{5}-\\frac{12 x^4}{5}+\\frac{33 x^3}{5}-9 x^2+\\frac{24 x}{5}+\\frac{26}{5}$.", + "Output Answer": [ + "$-\\frac{16}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((32*x**5)/5)-((34*x**4)/5)+((21*x**3)/5)+((46*x**2)/5)+4*x+(28/5)\nq = ((18*x**5)/5)-((12*x**4)/5)+((33*x**3)/5)-9*x**2+((24*x)/5)+(26/5)\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 6 \\sqrt{5} x^2+7 \\sqrt{5} x\\right| =-5 \\sqrt{5}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(6*sqrt(5)*x**2+7*sqrt(5)*x), -5*sqrt(5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-x^4+\\frac{9 x^3}{4}+15 x^2+\\frac{79 x}{4}+9$ and $-2 x^2-\\frac{7 x}{2}-2$.", + "Output Answer": [ + "$x^2+\\frac{7 x}{4}+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-x**4+((9*x**3)/4)+15*x**2+((79*x)/4)+9, -2*x**2-((7*x)/2)-2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{91}{37}$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$\\frac{58248}{37}$" + ], + "Output Program": [ + "a = (91/37) # initial value\nd = 10 # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (91/37) # initial value\nd = 10 # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=10-4 t, x(t)=4 t-15$", + "Output Answer": [ + "$y=-x-5$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 10-4*t\nx_t = 4*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{81}{28}$, and $a_n=a_{n-1}+\\frac{33}{4}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{225}{14}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(81/28) # initial value\nd = (33/4) # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(81/28) # initial value\nd = (33/4) # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-10 x-\\frac{19}{2}}+\\sqrt{\\frac{29}{2}-2 x}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(-195+7 \\sqrt{573}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-10*x-(19/2))+sqrt((29/2)-2*x), 7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -11 x^2-\\frac{x}{2}+\\frac{19}{2}$ and $q(x) = -\\frac{29 x^2}{2}+6 x+6$", + "Output Answer": [ + "$\\frac{319 x^4}{2}-\\frac{235 x^3}{4}-\\frac{827 x^2}{4}+54 x+57$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -11*x**2-(x/2)+(19/2)\nq = -((29*x**2)/2)+6*x+6\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-10 x+9 y^2-8 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-10 x+9 y^2-8 y=4$\nVertex: $\\left\\{-\\frac{26}{45},\\frac{4}{9}\\right\\}$\nDirectrix: $x=-\\frac{77}{90}$\nFocal Parameter: $\\frac{5}{9}$\nFocus: $\\left\\{-\\frac{3}{10},\\frac{4}{9}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x+9*y**2-8*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-126 x^2+6 x+216}{196 x+252}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{4}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-126*x**2+6*x+216)/(196*x+252)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(5-5 i) \\sqrt{3}$ and $y=(-3-4 i) \\sqrt{3}$", + "Output Answer": [ + "$-105-15 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (5-5*i)*math.sqrt(3)\ny = (-3-4*i)*math.sqrt(3)\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{\\left(1875 t^2+9000 t+10672\\right)^2}{4096}, x(t)=\\frac{625 t^2}{16}+\\frac{375 t}{2}+225$", + "Output Answer": [ + "$y=\\frac{9 x^2}{16}-3 x+4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (((1875*t**2+9000*t+10672)**2)/4096)\nx_t = ((625*t**2)/16)+((375*t)/2)+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-4 x+17 y+9 z+22=0$, $-23 x-18 y-3 z-11=0$, $2 x-20 y+6 z-3=0$", + "Output Answer": [ + "$x=\\frac{103}{820}$, $y=-\\frac{447}{820}$, $z=-\\frac{3343}{2460}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-4*x+17*y+9*z+22, -23*x-18*y-3*z-11, 2*x-20*y+6*z-3)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-5 x-18 y-7=0$, $9 x-13 y-13=0$", + "Output Answer": [ + "$x=\\frac{143}{227}$, $y=-\\frac{128}{227}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-5*x-18*y-7, 9*x-13*y-13), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^6-3 x^5+8 x^4+9 x^3+8 x^2+8 x+6$ when divided by $5 x^5+x^4-3 x^3+8 x^2+9 x-5$.", + "Output Answer": [ + "$-\\frac{8 x}{5}-\\frac{7}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**6-3*x**5+8*x**4+9*x**3+8*x**2+8*x+6\nq = 5*x**5+x**4-3*x**3+8*x**2+9*x-5\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-9 \\sqrt{2} x^2-8 \\sqrt{2} x+2 \\sqrt{2}$", + "Output Answer": [ + "$\\frac{34 \\sqrt{2}}{9}-9 \\sqrt{2} \\left(x+\\frac{4}{9}\\right)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-9*math.sqrt(2)*x**2-8*math.sqrt(2)*x+2*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{3}{7}-\\frac{22 i}{7}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{493}}{7}$\nArgument: $\\tan ^{-1}\\left(\\frac{22}{3}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(3/7)-((22*i)/7)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+8 x-6 y^2+3 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x+\\frac{2}{3}\\right)^2-6 \\left(y-\\frac{1}{4}\\right)^2=\\frac{175}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{12} \\left(-8-5 \\sqrt{14}\\right) & \\frac{1}{4} \\\\\n \\frac{1}{12} \\left(5 \\sqrt{14}-8\\right) & \\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{12} \\left(-8-5 \\sqrt{14}\\right)+\\frac{1}{12} \\left(5 \\sqrt{14}-8\\right)\\right),\\frac{1}{4}\\right\\}$\nAsymptotes: $\\left\\{y=x+\\frac{11}{12},y=-x-\\frac{5}{12}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+8*x-6*y**2+3*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$13 x+5 y+\\frac{27 z}{2}+\\frac{17}{2}=0$, $-25 x+\\frac{y}{2}+\\frac{23 z}{2}-\\frac{9}{2}=0$, $-9 x+\\frac{13 y}{2}+\\frac{21 z}{2}-\\frac{39}{2}=0$", + "Output Answer": [ + "$x=-\\frac{3478}{4483}$, $y=\\frac{19374}{4483}$, $z=-\\frac{6649}{4483}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((13*x+5*y+((27*z)/2)+(17/2), -25*x+(y/2)+((23*z)/2)-(9/2), -9*x+((13*y)/2)+((21*z)/2)-(39/2))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2+9 x+14$ and $q(x) = 7 x^2-5 x+8$", + "Output Answer": [ + "$-98 x^4+133 x^3-59 x^2+2 x+112$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2+9*x+14\nq = 7*x**2-5*x+8\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $6 x^2+9 x$ and $3$.", + "Output Answer": [ + "$3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(6*x**2+9*x, 3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{14 x^2}{\\sqrt{3}}-\\frac{8 x}{\\sqrt{3}}+8 \\sqrt{3}$ and $q(x) = -7 \\sqrt{3} x^2-\\frac{14 x}{\\sqrt{3}}-\\sqrt{3}$", + "Output Answer": [ + "$98 x^4+\\frac{364 x^3}{3}-\\frac{350 x^2}{3}-104 x-24$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((14*x**2)/(sqrt(3)))-((8*x)/(sqrt(3)))+8*sqrt(3)\nq = -7*sqrt(3)*x**2-((14*x)/(sqrt(3)))-sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{11 \\left(\\cos \\left(\\frac{11 \\pi }{45}\\right)-i \\sin \\left(\\frac{11 \\pi }{45}\\right)\\right)}{\\sqrt{3}}\\right)^2$", + "Output Answer": [ + "$\\frac{121}{3} \\left(\\sin \\left(\\frac{\\pi }{90}\\right)-i \\cos \\left(\\frac{\\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((11*(math.cos(((11*math.pi)/45))-1j*math.sin(((11*math.pi)/45))))/(math.sqrt(3))))**2)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left((3+15)^2-15\\right)+21\\right)+6\\right)^2+((11+4)-24)^2$.", + "Output Answer": [ + "$112977$" + ], + "Output Program": [ + "try: \n print(((((3+15)**2-15)+21)+6)**2+((11+4)-24)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+9 x-8 y^2+6 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x+\\frac{1}{2}\\right)^2-8 \\left(y-\\frac{3}{8}\\right)^2=\\frac{17}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{29}{24} & \\frac{3}{8} \\\\\n \\frac{5}{24} & \\frac{3}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{17}{2}}}{2}$\nCenter: $\\left\\{-\\frac{1}{2},\\frac{3}{8}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3 x}{2 \\sqrt{2}}+\\frac{3}{8} \\left(1+\\sqrt{2}\\right),y=-\\frac{3 x}{2 \\sqrt{2}}-\\frac{3}{8} \\left(\\sqrt{2}-1\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+9*x-8*y**2+6*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^3+2 x^2+8 x-2$ when divided by $9$.", + "Output Answer": [ + "$-\\frac{4 x^3}{9}+\\frac{2 x^2}{9}+\\frac{8 x}{9}-\\frac{2}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**3+2*x**2+8*x-2\nq = 9\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\tan ^{-1}\\left(\\frac{3}{2}-4 x\\right)$ at the point $x=-2$", + "Output Answer": [ + "$-\\tan ^{-1}\\left(\\frac{19}{2}\\right) = -1.466$" + ], + "Output Program": [ + "import math\n\nx = -2\ntry: \n f = -math.atan((3/2)-4*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{37 x^2}{\\sqrt{3}}-9 \\sqrt{3} x+\\frac{34}{\\sqrt{3}}\\right| =-2 \\sqrt{3}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((37*x**2)/(sqrt(3)))-9*sqrt(3)*x+(34/(sqrt(3)))), -2*sqrt(3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-1$ and $-x^5+3 x^4-2 x^3-3 x^2-4 x-5$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-1, -x**5+3*x**4-2*x**3-3*x**2-4*x-5))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{7 x+2}$ at the point $x=9$", + "Output Answer": [ + "$\\sqrt{65} = 8.062$" + ], + "Output Program": [ + "import math\n\nx = 9\ntry: \n f = math.sqrt(7*x+2)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-3 \\pi \\left(-\\cos \\left(\\frac{2 \\pi }{15}\\right)-i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)$.", + "Output Answer": [ + "Norm: $3 \\pi \\sqrt{\\sin ^2\\left(\\frac{2 \\pi }{15}\\right)+\\cos ^2\\left(\\frac{2 \\pi }{15}\\right)}$\nArgument: $\\frac{2 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -3*math.pi*(-math.cos(((2*math.pi)/15))-i*math.sin(((2*math.pi)/15)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{7}{2} \\left(\\cos \\left(\\frac{43}{30}\\right)+i \\sin \\left(\\frac{43}{30}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$\\frac{2401}{16} \\left(\\cos \\left(\\frac{86}{15}\\right)+i \\sin \\left(\\frac{86}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((7/2)*(math.cos((43/30))+1j*math.sin((43/30))))**4)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\cosh \\left(\\frac{10 x}{3}+7\\right)$", + "Output Answer": [ + "$1\\leq y$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(cosh(((10*x)/3)+7), x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{7 x^2}{4}-\\frac{31 x}{4}-\\frac{13}{4}$", + "Output Answer": [ + "$\\frac{597}{112}-\\frac{7}{4} \\left(x+\\frac{31}{14}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((7*x**2)/4)-((31*x)/4)-(13/4)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2+88 x+78$", + "Output Answer": [ + "$-10 (-x-1) \\left(x+\\frac{39}{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2+88*x+78, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -5 x^2-7 x-3$, $q(x) = 11 x^2-7 x+13$", + "Output Answer": [ + "$6 x^2-14 x+10$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**2-7*x-3\nq = 11*x**2-7*x+13\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-5 x^2+6 y^2+7 y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y+\\frac{7}{12}\\right)^2-5 x^2=\\frac{1}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n 0 & \\frac{1}{60} \\left(-35-\\sqrt{55}\\right) \\\\\n 0 & \\frac{1}{60} \\left(\\sqrt{55}-35\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{11}{5}}$\nCenter: $\\left\\{0,\\frac{1}{2} \\left(\\frac{1}{60} \\left(-35-\\sqrt{55}\\right)+\\frac{1}{60} \\left(\\sqrt{55}-35\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\sqrt{\\frac{5}{6}} x-\\frac{7}{12},y=\\sqrt{\\frac{5}{6}} x-\\frac{7}{12}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-5*x**2+6*y**2+7*y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^5-2 x^4-x^2+6 x-8$ when divided by $-5 x^5-x^4-9 x^3+3 x^2+2 x-7$.", + "Output Answer": [ + "$-\\frac{7}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**5-2*x**4-x**2+6*x-8\nq = -5*x**5-x**4-9*x**3+3*x**2+2*x-7\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^6+8 x^5-3 x^3+7 x^2-x+4$ when divided by $-1$.", + "Output Answer": [ + "$-7 x^6-8 x^5+3 x^3-7 x^2+x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**6+8*x**5-3*x**3+7*x**2-x+4\nq = -1\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{4 \\left(-\\frac{2923 x^3}{16}+\\frac{869 x^2}{8}+\\frac{1501 x}{4}\\right)}{711 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{37} \\left(11-\\sqrt{2933}\\right)\\right\\},\\left\\{x\\to \\frac{1}{37} \\left(11+\\sqrt{2933}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((4*(-((2923*x**3)/16)+((869*x**2)/8)+((1501*x)/4)))/(711*x)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{21 x}{5}+\\frac{31 y}{5}-4 z+\\frac{79}{5}=0$, $-\\frac{102 x}{5}+\\frac{98 y}{5}+\\frac{64 z}{5}+\\frac{42}{5}=0$, $\\frac{82 x}{5}+\\frac{32 y}{5}+\\frac{83 z}{5}+\\frac{72}{5}=0$", + "Output Answer": [ + "$x=-\\frac{9262}{11455}$, $y=-\\frac{318901}{194735}$, $z=\\frac{21916}{38947}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((21*x)/5)+((31*y)/5)-4*z+(79/5), -((102*x)/5)+((98*y)/5)+((64*z)/5)+(42/5), ((82*x)/5)+((32*y)/5)+((83*z)/5)+(72/5))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -12 x^2+7 x+2$ and $q(x) = 7-13 x$", + "Output Answer": [ + "$156 x^3-175 x^2+23 x+14$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -12*x**2+7*x+2\nq = 7-13*x\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -23 x^2+12 x+20\\right| =23$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{23} \\left(6-5 \\sqrt{41}\\right)\\right\\},\\left\\{x\\to \\frac{1}{23} \\left(6+5 \\sqrt{41}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-23*x**2+12*x+20), 23), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{26+4 i}{\\pi }$ and $y=\\frac{3+17 i}{\\pi }$", + "Output Answer": [ + "$-\\frac{10+454 i}{\\pi ^2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((26+4*i)/math.pi)\ny = ((3+17*i)/math.pi)\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-6 \\sqrt{2} e^{-\\frac{i \\pi }{12}}$.", + "Output Answer": [ + "Norm: $6 \\sqrt{2}$\nArgument: $\\pi +\\tan ^{-1}\\left(\\frac{\\Im\\left(e^{-\\frac{i \\pi }{12}}\\right)}{\\Re\\left(e^{-\\frac{i \\pi }{12}}\\right)}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -6*math.sqrt(2)*math.e**(-((i*math.pi)/12))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 x^2-4 x+10$ and $q(x) = -4 x^2-3 x+10$", + "Output Answer": [ + "$-12 x^4+7 x^3+2 x^2-70 x+100$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*x**2-4*x+10\nq = -4*x**2-3*x+10\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{13}{5}+10}{((23-19)+1)+19}$.", + "Output Answer": [ + "$\\frac{21}{40}$" + ], + "Output Program": [ + "try: \n print((((13/5)+10)/(((23-19)+1)+19)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 10 x^2-6 x-9$ and $q(x) = 11 x^2+5 x+10$", + "Output Answer": [ + "$110 x^4-16 x^3-29 x^2-105 x-90$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 10*x**2-6*x-9\nq = 11*x**2+5*x+10\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-3+2 i) \\sqrt{2}$ and $y=(-1+4 i) \\sqrt{2}$", + "Output Answer": [ + "$(-2-2 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-3+2*i)*math.sqrt(2)\ny = (-1+4*i)*math.sqrt(2)\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2+9 x+7 y^2-10 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(y-\\frac{5}{7}\\right)^2-10 \\left(x-\\frac{9}{20}\\right)^2=\\frac{2393}{280}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{9}{20} & \\frac{5}{7}-\\frac{\\sqrt{40681}}{140} \\\\\n \\frac{9}{20} & \\frac{1}{140} \\left(100+\\sqrt{40681}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{17}{10}}$\nCenter: $\\left\\{\\frac{9}{20},\\frac{1}{2} \\left(\\frac{5}{7}-\\frac{\\sqrt{40681}}{140}+\\frac{1}{140} \\left(100+\\sqrt{40681}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{140} \\left(100+9 \\sqrt{70}\\right)-\\sqrt{\\frac{10}{7}} x,y=\\sqrt{\\frac{10}{7}} x+\\frac{1}{140} \\left(100-9 \\sqrt{70}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2+9*x+7*y**2-10*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=5-\\frac{7 t}{16}, x(t)=\\frac{7 t}{4}-15$", + "Output Answer": [ + "$y=\\frac{5}{4}-\\frac{x}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 5-((7*t)/16)\nx_t = ((7*t)/4)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{5}{2} \\left(-10 t+\\sqrt{2}+21\\right), x(t)=5 \\sqrt{2} t-\\frac{21}{\\sqrt{2}}$", + "Output Answer": [ + "$y=\\frac{5 x}{\\sqrt{2}}-\\frac{5}{\\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -(5/2)*(-10*t+sqrt(2)+21)\nx_t = 5*sqrt(2)*t-(21/(sqrt(2)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{64} \\left(363 t^2-1980 t+2680\\right)^2, x(t)=\\frac{121 t^2}{4}-165 t+225$", + "Output Answer": [ + "$y=\\frac{9 x^2}{4}-\\frac{15 x}{2}+\\frac{25}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/64)*(363*t**2-1980*t+2680)**2\nx_t = ((121*t**2)/4)-165*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-7 \\sqrt{2} x-9 \\sqrt{2} y-14 \\sqrt{2}=0$, $-3 \\sqrt{2} x+7 \\sqrt{2} y+\\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{89}{76}$, $y=-\\frac{49}{76}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-7*sqrt(2)*x-9*sqrt(2)*y-14*sqrt(2), -3*sqrt(2)*x+7*sqrt(2)*y+sqrt(2)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-20 x^2-7 x+12}{-12 x^2+20 x+24}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{40} \\left(-7-\\sqrt{1009}\\right)\\right\\},\\left\\{x\\to \\frac{1}{40} \\left(-7+\\sqrt{1009}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-20*x**2-7*x+12)/(-12*x**2+20*x+24)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2+\\frac{580 x}{\\sqrt{3}}+2750$", + "Output Answer": [ + "$-10 \\left(-x-11 \\sqrt{3}\\right) \\left(x+\\frac{25}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2+((580*x)/(sqrt(3)))+2750, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $2 x^2-9 x-4$", + "Output Answer": [ + "$x=\\frac{1}{4} \\left(9-\\sqrt{113}\\right)\\lor x=\\frac{1}{4} \\left(9+\\sqrt{113}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(2*x**2-9*x-4, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{6-2 x^4}$ at the point $x=-1$", + "Output Answer": [ + "$2 = 2.$" + ], + "Output Program": [ + "import math\n\nx = -1\ntry: \n f = math.sqrt(6-2*x**4)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+8 x+5 y^2+2 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $6 \\left(x+\\frac{2}{3}\\right)^2+5 \\left(y+\\frac{1}{5}\\right)^2=\\frac{73}{15}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{3} & \\frac{1}{30} \\left(-6-\\sqrt{146}\\right) \\\\\n -\\frac{2}{3} & \\frac{1}{30} \\left(\\sqrt{146}-6\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{6}}$\nCenter: $\\left\\{-\\frac{2}{3},\\frac{1}{2} \\left(\\frac{1}{30} \\left(-6-\\sqrt{146}\\right)+\\frac{1}{30} \\left(\\sqrt{146}-6\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{73 \\pi }{15 \\sqrt{30}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+8*x+5*y**2+2*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt[3]{\\log \\left(\\frac{13 x}{3}-6\\right)}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{21}{13}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(cbrt(log(((13*x)/3)-6)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{35 x^2}{e}+\\frac{19 x}{e}+\\frac{16}{e}$ and $q(x) = -\\frac{10 x^2}{e}-\\frac{8 x}{e}+\\frac{17}{e}$", + "Output Answer": [ + "$-\\frac{350 x^4}{e^2}-\\frac{470 x^3}{e^2}+\\frac{283 x^2}{e^2}+\\frac{195 x}{e^2}+\\frac{272}{e^2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = ((35*x**2)/math.e)+((19*x)/math.e)+(16/math.e)\nq = -((10*x**2)/math.e)-((8*x)/math.e)+(17/math.e)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\sqrt{2} x-\\frac{9 y}{\\sqrt{2}}+2 \\sqrt{2}=0$, $-6 \\sqrt{2} x-\\frac{23 y}{\\sqrt{2}}-12 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-2$, $y=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((sqrt(2)*x-((9*y)/(sqrt(2)))+2*sqrt(2), -6*sqrt(2)*x-((23*y)/(sqrt(2)))-12*sqrt(2)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -21 x^2-7 x-17\\right| =19$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{42} \\left(-7-\\sqrt{217}\\right)\\right\\},\\left\\{x\\to \\frac{1}{42} \\left(-7+\\sqrt{217}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-21*x**2-7*x-17), 19), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$11 \\sqrt{5} z-7 \\sqrt{5}=0$, $-6 \\sqrt{5} x-9 \\sqrt{5} y+5 \\sqrt{5} z-6 \\sqrt{5}=0$, $-5 \\sqrt{5} x+6 \\sqrt{5} z+5 \\sqrt{5}=0$", + "Output Answer": [ + "$x=\\frac{97}{55}$, $y=-\\frac{67}{45}$, $z=\\frac{7}{11}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((11*sqrt(5)*z-7*sqrt(5), -6*sqrt(5)*x-9*sqrt(5)*y+5*sqrt(5)*z-6*sqrt(5), -5*sqrt(5)*x+6*sqrt(5)*z+5*sqrt(5))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-5 \\left(-20 t^2+4 \\left(3 \\sqrt{5}-70\\right) t+84 \\sqrt{5}-989\\right), x(t)=-\\sqrt{5} t-7 \\sqrt{5}$", + "Output Answer": [ + "$y=20 x^2+60 x+45$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -5*(-20*t**2+4*(3*sqrt(5)-70)*t+84*sqrt(5)-989)\nx_t = -sqrt(5)*t-7*sqrt(5)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-2+6 i$ and $y=3-8 i$", + "Output Answer": [ + "$-\\frac{54}{73}+\\frac{2 i}{73}$" + ], + "Output Program": [ + "i = 1j\nx = -2+6*i\ny = 3-8*i\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2$ and $-4 x^5+x^4-5 x^2+x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2, -4*x**5+x**4-5*x**2+x-3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-2 x-7 y^2-2 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(x-\\frac{1}{4}\\right)^2-7 \\left(y+\\frac{1}{7}\\right)^2=\\frac{171}{28}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{28} \\left(7-3 \\sqrt{209}\\right) & -\\frac{1}{7} \\\\\n \\frac{1}{28} \\left(7+3 \\sqrt{209}\\right) & -\\frac{1}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{11}{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{28} \\left(7-3 \\sqrt{209}\\right)+\\frac{1}{28} \\left(7+3 \\sqrt{209}\\right)\\right),-\\frac{1}{7}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2 x}{\\sqrt{7}}+\\frac{1}{14} \\left(-2-\\sqrt{7}\\right),y=\\frac{1}{14} \\left(\\sqrt{7}-2\\right)-\\frac{2 x}{\\sqrt{7}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-2*x-7*y**2-2*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=8+\\frac{42 i}{5}$ and $y=-1+\\frac{47 i}{5}$", + "Output Answer": [ + "$-\\frac{2174}{25}+\\frac{334 i}{5}$" + ], + "Output Program": [ + "i = 1j\nx = 8+((42*i)/5)\ny = -1+((47*i)/5)\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 5 x^2+11 x+8$, $q(x) = 3 x^2+7 x+9$", + "Output Answer": [ + "$8 x^2+18 x+17$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**2+11*x+8\nq = 3*x**2+7*x+9\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{7-\\frac{13 x}{2}}+\\sqrt{\\frac{21}{2}-2 x}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{81} \\left(-5809+26 \\sqrt{39058}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(7-((13*x)/2))+sqrt((21/2)-2*x), 13), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{164 x}{7}+\\frac{29 y}{7}-\\frac{149 z}{7}-\\frac{1}{7}=0$, $\\frac{12 x}{7}+\\frac{100 y}{7}+\\frac{24 z}{7}+19=0$, $-\\frac{68 x}{7}+\\frac{81 y}{7}-\\frac{6 z}{7}+\\frac{90}{7}=0$", + "Output Answer": [ + "$x=-\\frac{175851}{786052}$, $y=-\\frac{255451}{196513}$, $z=-\\frac{2649}{196513}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((164*x)/7)+((29*y)/7)-((149*z)/7)-(1/7), ((12*x)/7)+((100*y)/7)+((24*z)/7)+19, -((68*x)/7)+((81*y)/7)-((6*z)/7)+(90/7))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 4 x+12| =9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{21}{4}\\right\\},\\left\\{x\\to -\\frac{3}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(4*x+12), 9), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{22 x^2}{\\sqrt{3}}-\\frac{17 x}{\\sqrt{3}}$ and $q(x) = \\sqrt{3} x^2-\\frac{23 x}{\\sqrt{3}}-\\frac{4}{\\sqrt{3}}$", + "Output Answer": [ + "$-22 x^4+\\frac{455 x^3}{3}+\\frac{479 x^2}{3}+\\frac{68 x}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((22*x**2)/(sqrt(3)))-((17*x)/(sqrt(3)))\nq = sqrt(3)*x**2-((23*x)/(sqrt(3)))-(4/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(8 \\left(\\sin \\left(\\frac{13 \\pi }{90}\\right)-i \\cos \\left(\\frac{13 \\pi }{90}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$262144 \\left(\\cos \\left(\\frac{2 \\pi }{15}\\right)-i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((8*(math.sin(((13*math.pi)/90))-1j*math.cos(((13*math.pi)/90))))**6)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -x^2+x+14$, $q(x) = -5 x^2-9 x+2$", + "Output Answer": [ + "$-6 x^2-8 x+16$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**2+x+14\nq = -5*x**2-9*x+2\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-5 x^2-10 x+2 y^2-4 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 (y-1)^2-5 (x+1)^2=-9$\nFoci: $\\left(\n\\begin{array}{cc}\n -1-3 \\sqrt{\\frac{7}{10}} & 1 \\\\\n 3 \\sqrt{\\frac{7}{10}}-1 & 1 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{2}}$\nCenter: $\\{-1,1\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{5}{2}} x+\\frac{1}{2} \\left(2+\\sqrt{10}\\right),y=\\frac{1}{2} \\left(2-\\sqrt{10}\\right)-\\sqrt{\\frac{5}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-5*x**2-10*x+2*y**2-4*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{63 x^2}{5}-14 x-\\frac{29}{5}$", + "Output Answer": [ + "$x=\\frac{1}{63} \\left(-35-i \\sqrt{602}\\right)\\lor x=\\frac{1}{63} \\left(-35+i \\sqrt{602}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((63*x**2)/5)-14*x-(29/5), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{38}{47}$, and $a_n=a_{n-1}+-5 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$4 \\left(\\frac{76}{47}-35 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = (38/47) # initial value\nd = -5*math.sqrt(2) # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (38/47) # initial value\nd = -5*math.sqrt(2) # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\left(-\\cos \\left(\\frac{2 \\pi }{15}\\right)+i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$32 \\left(\\frac{1}{2}+\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*(-math.cos(((2*math.pi)/15))+1j*math.sin(((2*math.pi)/15))))**5)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $8 x^2+32 x+24$", + "Output Answer": [ + "$-8 (-x-1) (x+3)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(8*x**2+32*x+24, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(((18+20)-9)+12) \\left(\\left(\\left((8+9)^2+23\\right)-2\\right)-9\\right)$.", + "Output Answer": [ + "$12341$" + ], + "Output Program": [ + "try: \n print((((18+20)-9)+12)*((((8+9)**2+23)-2)-9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{12 x}{5}+\\frac{1}{5}}+\\sqrt{\\frac{23 x}{5}-\\frac{43}{5}}=\\frac{28}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{605} \\left(29860-392 \\sqrt{5021}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((12*x)/5)+(1/5))+sqrt(((23*x)/5)-(43/5)), (28/5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $13 x^2+6 x+14$", + "Output Answer": [ + "$13 \\left(x+\\frac{3}{13}\\right)^2+\\frac{173}{13}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (13*x**2+6*x+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 8-9 x, q(x) = x+1$", + "Output Answer": [ + "$9-8 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8-9*x\nq = x+1\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^2+9 x-5$ when divided by $8$.", + "Output Answer": [ + "$\\frac{x^2}{2}+\\frac{9 x}{8}-\\frac{5}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**2+9*x-5\nq = 8\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x^2-3 x-4$ and $-x^3+3 x^2-5 x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x**2-3*x-4, -x**3+3*x**2-5*x-3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{37}{3}-\\frac{44 x}{3}}+\\sqrt{\\frac{29}{3}-\\frac{2 x}{3}}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{147} \\left(-1122+10 \\sqrt{6407}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((37/3)-((44*x)/3))+sqrt((29/3)-((2*x)/3)), 10), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x-4$ and $4 x^4-3 x^3-4 x^2-5 x+2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x-4, 4*x**4-3*x**3-4*x**2-5*x+2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $9 x^2+99 x-\\frac{20925}{16}$", + "Output Answer": [ + "$-9 \\left(-x-\\frac{75}{4}\\right) \\left(x-\\frac{31}{4}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(9*x**2+99*x-(20925/16), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{9 x-3 x^2}{14 x+17}=0$", + "Output Answer": [ + "$\\{\\{x\\to 0\\},\\{x\\to 3\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((9*x-3*x**2)/(14*x+17)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-2 x^2-8 x+8 y^2+7 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y+\\frac{7}{16}\\right)^2-2 (x+2)^2=-\\frac{79}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n -2-\\frac{\\sqrt{395}}{16} & -\\frac{7}{16} \\\\\n \\frac{\\sqrt{395}}{16}-2 & -\\frac{7}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{2}$\nCenter: $\\left\\{-2,-\\frac{7}{16}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{2}+\\frac{9}{16},y=-\\frac{x}{2}-\\frac{23}{16}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x**2-8*x+8*y**2+7*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-21 x-\\frac{57 y}{4}+\\frac{7 z}{2}-\\frac{5}{2}=0$, $-\\frac{35 x}{2}-\\frac{99 y}{4}-\\frac{5 z}{4}+\\frac{7}{2}=0$, $-\\frac{37 x}{2}-\\frac{33 y}{2}-\\frac{95 z}{4}+7=0$", + "Output Answer": [ + "$x=-\\frac{11059}{36852}$, $y=\\frac{9364}{27639}$, $z=\\frac{5401}{18426}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-21*x-((57*y)/4)+((7*z)/2)-(5/2), -((35*x)/2)-((99*y)/4)-((5*z)/4)+(7/2), -((37*x)/2)-((33*y)/2)-((95*z)/4)+7)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{8 \\sqrt{3} x^2-14 \\sqrt{3} x-2 \\sqrt{3}}{-10 \\sqrt{3} x^2+8 \\sqrt{3} x+13 \\sqrt{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(7-\\sqrt{65}\\right)\\right\\},\\left\\{x\\to \\frac{1}{8} \\left(7+\\sqrt{65}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((8*sqrt(3)*x**2-14*sqrt(3)*x-2*sqrt(3))/(-10*sqrt(3)*x**2+8*sqrt(3)*x+13*sqrt(3))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^6+9 x^5+7 x^4+8 x^3+8 x^2-8 x+10$ when divided by $-2 x^4-4 x^3+2 x^2-8 x-4$.", + "Output Answer": [ + "$-x^2-\\frac{5 x}{2}+\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**6+9*x**5+7*x**4+8*x**3+8*x**2-8*x+10\nq = -2*x**4-4*x**3+2*x**2-8*x-4\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{1}{9} ((13+6)-3)-((((7+4)-19)+7)+4)$.", + "Output Answer": [ + "$-\\frac{11}{9}$" + ], + "Output Program": [ + "try: \n print((1/9)*((13+6)-3)-((((7+4)-19)+7)+4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-15 x-12}+\\sqrt{5-9 x}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(-917+15 \\sqrt{3497}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-15*x-12)+sqrt(5-9*x), 15), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(1+22) ((6+5)+11)$.", + "Output Answer": [ + "$506$" + ], + "Output Program": [ + "try: \n print((1+22)*((6+5)+11))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (5 x-6)^3, q(x) = 7 x-2$", + "Output Answer": [ + "$125 x^3-450 x^2+547 x-218$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (5*x-6)**3\nq = 7*x-2\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{5}{33}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$\\frac{31760}{33}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (5/33) # initial value\nd = 8 # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (5/33) # initial value\nd = 8 # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-11 x^2+9 x+3}{-25 x^2-17 x-6}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{22} \\left(9-\\sqrt{213}\\right)\\right\\},\\left\\{x\\to \\frac{1}{22} \\left(9+\\sqrt{213}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-11*x**2+9*x+3)/(-25*x**2-17*x-6)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -8 x^2-x+12$, $q(x) = -7 x^2+7 x+10$", + "Output Answer": [ + "$-15 x^2+6 x+22$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**2-x+12\nq = -7*x**2+7*x+10\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=9 t-6, x(t)=9 t-15$", + "Output Answer": [ + "$y=x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 9*t-6\nx_t = 9*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 21-6 x| =0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(21-6*x), 0), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{5 x^2}{\\sqrt{2}}+6 \\sqrt{2} x+3 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{2}{5} \\left(-3-\\sqrt{\\frac{3}{2}}\\right)\\lor x=\\frac{2}{5} \\left(\\sqrt{\\frac{3}{2}}-3\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((5*x**2)/(sqrt(2)))+6*sqrt(2)*x+3*sqrt(2), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 13-6 x| =17$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{2}{3}\\right\\},\\{x\\to 5\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(13-6*x), 17), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{3 x^2+12 x-15}{12-17 x}=0$", + "Output Answer": [ + "$\\{\\{x\\to -5\\},\\{x\\to 1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((3*x**2+12*x-15)/(12-17*x)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2+5 x+6 y^2+3 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $2 \\left(x+\\frac{5}{4}\\right)^2+6 \\left(y+\\frac{1}{4}\\right)^2=\\frac{13}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{4}-\\sqrt{\\frac{13}{6}} & -\\frac{1}{4} \\\\\n \\sqrt{\\frac{13}{6}}-\\frac{5}{4} & -\\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{-\\frac{5}{4},-\\frac{1}{4}\\right\\}$\nArea Enclosed: $\\frac{13 \\pi }{4 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2+5*x+6*y**2+3*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^5+10 x^4-6 x^3-x^2+4 x-4$ when divided by $-8$.", + "Output Answer": [ + "$-\\frac{3 x^5}{4}-\\frac{5 x^4}{4}+\\frac{3 x^3}{4}+\\frac{x^2}{8}-\\frac{x}{2}+\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**5+10*x**4-6*x**3-x**2+4*x-4\nq = -8\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{23}{34}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$\\frac{25610}{17}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(23/34) # initial value\nd = 8 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(23/34) # initial value\nd = 8 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+6 x+4 y^2+10 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Circle\nEquation: $4 \\left(x+\\frac{3}{4}\\right)^2+4 \\left(y+\\frac{5}{4}\\right)^2=\\frac{25}{2}$\nRadius: $\\frac{5}{2 \\sqrt{2}}$\nCircumference: $\\frac{5 \\pi }{\\sqrt{2}}$\nCenter: $\\left\\{-\\frac{3}{4},-\\frac{5}{4}\\right\\}$\nArea Enclosed: $\\frac{25 \\pi }{8}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+6*x+4*y**2+10*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{11 x}{2}-\\frac{91 y}{4}+\\frac{5}{2}=0$, $16 x+2 y-\\frac{73}{4}=0$", + "Output Answer": [ + "$x=\\frac{6563}{6000}$, $y=\\frac{1123}{3000}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((11*x)/2)-((91*y)/4)+(5/2), 16*x+2*y-(73/4)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{46}{7}-\\frac{32 x}{7}, q(x) = \\frac{(29 x+42)^4}{2401}$", + "Output Answer": [ + "$\\frac{707281 x^4}{2401}+\\frac{585336 x^3}{343}+\\frac{181656 x^2}{49}+\\frac{25024 x}{7}+\\frac{9118}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (46/7)-((32*x)/7)\nq = (((29*x+42)**4)/2401)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 7 \\sqrt{3} x-8 \\sqrt{3}\\right| =14 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{6}{7}\\right\\},\\left\\{x\\to \\frac{22}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(7*sqrt(3)*x-8*sqrt(3)), 14*sqrt(3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{15 x^2}{\\sqrt{2}}+\\frac{17 x}{\\sqrt{2}}+\\frac{17}{\\sqrt{2}}$", + "Output Answer": [ + "$x=\\frac{1}{30} \\left(-17-i \\sqrt{731}\\right)\\lor x=\\frac{1}{30} \\left(-17+i \\sqrt{731}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((15*x**2)/(sqrt(2)))+((17*x)/(sqrt(2)))+(17/(sqrt(2))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $18-18 x$ and $4 x-4$.", + "Output Answer": [ + "$2 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(18-18*x, 4*x-4))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((((16+20)+10)-20)+11)+((18-9)-9)$.", + "Output Answer": [ + "$37$" + ], + "Output Program": [ + "try: \n print(((((16+20)+10)-20)+11)+((18-9)-9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{5 x^2}{\\sqrt{2}}+3 \\sqrt{2} x+\\frac{5}{\\sqrt{2}}$ and $q(x) = -\\frac{9 x^2}{\\sqrt{2}}+\\frac{15 x}{\\sqrt{2}}+9 \\sqrt{2}$", + "Output Answer": [ + "$-\\frac{45 x^4}{2}+\\frac{21 x^3}{2}+\\frac{135 x^2}{2}+\\frac{183 x}{2}+45$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((5*x**2)/(sqrt(2)))+3*sqrt(2)*x+(5/(sqrt(2)))\nq = -((9*x**2)/(sqrt(2)))+((15*x)/(sqrt(2)))+9*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^3-4 x^2+8 x+1$ when divided by $-6 x^3+6 x^2+x+1$.", + "Output Answer": [ + "$-\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**3-4*x**2+8*x+1\nq = -6*x**3+6*x**2+x+1\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-6 x-14}+\\sqrt{-2 x-4}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-348+13 \\sqrt{511}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-6*x-14)+sqrt(-2*x-4), 13), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(((2+24)+18)-18)+\\left((24+20)^2+9\\right)$.", + "Output Answer": [ + "$1971$" + ], + "Output Program": [ + "try: \n print((((2+24)+18)-18)+((24+20)**2+9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2-5 x+y^2+4 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $(y+2)^2-8 \\left(x+\\frac{5}{16}\\right)^2=\\frac{7}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{16} & -2-\\frac{3 \\sqrt{7}}{16} \\\\\n -\\frac{5}{16} & \\frac{3 \\sqrt{7}}{16}-2 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2 \\sqrt{2}}$\nCenter: $\\left\\{-\\frac{5}{16},-2\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{8} \\left(-16-5 \\sqrt{2}\\right)-2 \\sqrt{2} x,y=2 \\sqrt{2} x+\\frac{1}{8} \\left(5 \\sqrt{2}-16\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2-5*x+y**2+4*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{224 x^3}{9}+\\frac{496 x^2}{9}+\\frac{346 x}{9}-82}{-\\frac{328 x^2}{9}+\\frac{142 x}{3}+78}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{56} \\left(-1-\\sqrt{4593}\\right)\\right\\},\\left\\{x\\to \\frac{1}{56} \\left(-1+\\sqrt{4593}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((224*x**3)/9)+((496*x**2)/9)+((346*x)/9)-82)/(-((328*x**2)/9)+((142*x)/3)+78)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-9 \\left(\\cos \\left(\\frac{107}{90}\\right)+i \\sin \\left(\\frac{107}{90}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-729 \\left(\\cos \\left(\\frac{107}{30}\\right)+i \\sin \\left(\\frac{107}{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-9*(math.cos((107/90))+1j*math.sin((107/90))))**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $4+10 i$.", + "Output Answer": [ + "Norm: $2 \\sqrt{29}$\nArgument: $\\tan ^{-1}\\left(\\frac{5}{2}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 4+10*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{17}{2} e^{\\frac{7 i \\pi }{30}}$.", + "Output Answer": [ + "Norm: $\\frac{17}{2}$\nArgument: $-\\frac{23 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(17/2)*math.e**((7*i*math.pi)/30)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^6+8 x^5+2 x^4-x^3-4 x^2-x-8$ when divided by $-x^5-10 x^4-7 x^3-x^2+4 x-7$.", + "Output Answer": [ + "$62-7 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**6+8*x**5+2*x**4-x**3-4*x**2-x-8\nq = -x**5-10*x**4-7*x**3-x**2+4*x-7\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=343 t^2+1470 t+1570, x(t)=49 t^2+210 t+225$", + "Output Answer": [ + "$y=7 x-5$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 343*t**2+1470*t+1570\nx_t = 49*t**2+210*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{49}-60\\right) \\left(\\sqrt{85}-\\sqrt{5}\\right)$.", + "Output Answer": [ + "$-53 \\sqrt{5} \\left(\\sqrt{17}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(49)-60)*(sqrt(85)-sqrt(5)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 i\\right)^3$", + "Output Answer": [ + "$-216 i$" + ], + "Output Program": [ + "i = 1j\nprint((6*i)**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x^3-\\frac{21 x^2}{4}-4 x-3$ and $-2 x^2-\\frac{3 x}{2}-1$.", + "Output Answer": [ + "$x^2+\\frac{3 x}{4}+\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x**3-((21*x**2)/4)-4*x-3, -2*x**2-((3*x)/2)-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{1-13 x}+\\sqrt{6-13 x}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{817}{1872}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(1-13*x)+sqrt(6-13*x), 6), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 \\left(8 t^2-60 t+117\\right)^2, x(t)=16 t^2-120 t+225$", + "Output Answer": [ + "$y=x^2+18 x+81$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*(8*t**2-60*t+117)**2\nx_t = 16*t**2-120*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\log \\left(4 x^3-5\\right)+\\cos (8)$", + "Output Answer": [ + "$y\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(log(4*x**3-5)+cos(8), x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{57 x}{4}-\\frac{19 y}{2}+\\frac{19 z}{4}+\\frac{29}{2}=0$, $\\frac{25 x}{2}-4 y+\\frac{61 z}{4}+\\frac{61}{4}=0$, $22 x-5 y+\\frac{39 z}{2}+17=0$", + "Output Answer": [ + "$x=\\frac{4762}{11609}$, $y=\\frac{6491}{23218}$, $z=-\\frac{14661}{11609}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((57*x)/4)-((19*y)/2)+((19*z)/4)+(29/2), ((25*x)/2)-4*y+((61*z)/4)+(61/4), 22*x-5*y+((39*z)/2)+17)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt[3]{\\sqrt[3]{170}+\\sqrt[3]{74}}}{\\sqrt[3]{188}}$.", + "Output Answer": [ + "$\\frac{\\sqrt[3]{\\frac{1}{47} \\left(\\sqrt[3]{37}+\\sqrt[3]{85}\\right)}}{2^{5/9}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((cbrt(cbrt(170)+cbrt(74)))/(cbrt(188))))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^5+4 x^4-3 x^3-9 x^2+9 x+1$ when divided by $4$.", + "Output Answer": [ + "$\\frac{3 x^5}{4}+x^4-\\frac{3 x^3}{4}-\\frac{9 x^2}{4}+\\frac{9 x}{4}+\\frac{1}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**5+4*x**4-3*x**3-9*x**2+9*x+1\nq = 4\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{2 x^2}{5}+\\frac{31 x}{5}+\\frac{33}{5}$ and $q(x) = \\frac{62 x^2}{5}+\\frac{14 x}{5}+\\frac{38}{5}$", + "Output Answer": [ + "$\\frac{124 x^4}{25}+78 x^3+\\frac{2556 x^2}{25}+\\frac{328 x}{5}+\\frac{1254}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((2*x**2)/5)+((31*x)/5)+(33/5)\nq = ((62*x**2)/5)+((14*x)/5)+(38/5)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(14+1)-(21-9)$.", + "Output Answer": [ + "$3$" + ], + "Output Program": [ + "try: \n print((14+1)-(21-9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2-x-8 y^2-y+10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(x-\\frac{1}{4}\\right)^2-8 \\left(y+\\frac{1}{16}\\right)^2=-\\frac{317}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{4} & \\frac{1}{16} \\left(-1-\\sqrt{1585}\\right) \\\\\n \\frac{1}{4} & \\frac{1}{16} \\left(\\sqrt{1585}-1\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{5}$\nCenter: $\\left\\{\\frac{1}{4},\\frac{1}{2} \\left(\\frac{1}{16} \\left(-1-\\sqrt{1585}\\right)+\\frac{1}{16} \\left(\\sqrt{1585}-1\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{16}-\\frac{x}{2},y=\\frac{x}{2}-\\frac{3}{16}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2-x-8*y**2-y+10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4-4 x}+\\sqrt{13 x+3}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{33}{289}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4-4*x)+sqrt(13*x+3), 4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(((17+22)+11)^2+3\\right)+(12+11)$.", + "Output Answer": [ + "$2526$" + ], + "Output Program": [ + "try: \n print((((17+22)+11)**2+3)+(12+11))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+9 x-4 y^2+2 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x+\\frac{3}{4}\\right)^2-4 \\left(y-\\frac{1}{4}\\right)^2=\\frac{1}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{4}-\\frac{\\sqrt{\\frac{5}{6}}}{4} & \\frac{1}{4} \\\\\n \\frac{1}{24} \\left(\\sqrt{30}-18\\right) & \\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{3}{4}-\\frac{\\sqrt{\\frac{5}{6}}}{4}+\\frac{1}{24} \\left(\\sqrt{30}-18\\right)\\right),\\frac{1}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{3}{2}} x+\\frac{1}{8} \\left(2+3 \\sqrt{6}\\right),y=\\frac{1}{8} \\left(2-3 \\sqrt{6}\\right)-\\sqrt{\\frac{3}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+9*x-4*y**2+2*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-21 x-y-23=0$, $-4 x-24 y-12=0$", + "Output Answer": [ + "$x=-\\frac{27}{25}$, $y=-\\frac{8}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-21*x-y-23, -4*x-24*y-12), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{12+10 i}{\\sqrt{3}}$ and $y=\\frac{3-10 i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{136}{3}-30 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((12+10*i)/(math.sqrt(3)))\ny = ((3-10*i)/(math.sqrt(3)))\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -9 x^2-2 x+5$ and $q(x) = -11 x^2+x+8$", + "Output Answer": [ + "$99 x^4+13 x^3-129 x^2-11 x+40$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -9*x**2-2*x+5\nq = -11*x**2+x+8\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $5 x^3-25 x^2-445 x-975$", + "Output Answer": [ + "$5 (-x-5) (13-x) (x+3)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(5*x**3-25*x**2-445*x-975, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{29 x^2}{3}+\\frac{31 x}{3}+\\frac{17}{3}$", + "Output Answer": [ + "$\\frac{29}{3} \\left(x+\\frac{31}{58}\\right)^2+\\frac{337}{116}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((29*x**2)/3)+((31*x)/3)+(17/3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{3 x}{7}+10}+\\sqrt{\\frac{74 x}{7}-\\frac{20}{7}}=\\frac{36}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{144522-144 \\sqrt{722998}}{35287}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((3*x)/7)+10)+sqrt(((74*x)/7)-(20/7)), (36/7)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11-\\frac{21 x}{5}}+\\sqrt{\\frac{69 x}{5}+\\frac{49}{5}}=\\frac{24}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{375} \\left(281-16 \\sqrt{1031}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11-((21*x)/5))+sqrt(((69*x)/5)+(49/5)), (24/5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2-1440$", + "Output Answer": [ + "$-10 (-x-12) (x-12)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2-1440, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-4 x-5 y^2-7 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-4 x-5 y^2-7 y=-8$\nVertex: $\\left\\{\\frac{209}{80},-\\frac{7}{10}\\right\\}$\nDirectrix: $x=\\frac{45}{16}$\nFocal Parameter: $\\frac{2}{5}$\nFocus: $\\left\\{\\frac{193}{80},-\\frac{7}{10}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x-5*y**2-7*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{16}{35}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$-\\frac{74142}{35}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(16/35) # initial value\nd = -6 # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(16/35) # initial value\nd = -6 # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 54 \\sqrt{2} (x-1)^3, q(x) = \\sqrt{2} (4 x+1)$", + "Output Answer": [ + "$54 \\sqrt{2} x^3-162 \\sqrt{2} x^2+166 \\sqrt{2} x-53 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 54*sqrt(2)*(x-1)**3\nq = sqrt(2)*(4*x+1)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{23}{37}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$\\frac{690}{37}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (23/37) # initial value\nd = 0 # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (23/37) # initial value\nd = 0 # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-54 x^2-\\frac{711 x}{2}-\\frac{555}{4}}{69 x+\\frac{851}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{12}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-54*x**2-((711*x)/2)-(555/4))/(69*x+(851/2))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-1+10 i$ and $y=6$", + "Output Answer": [ + "$-7+10 i$" + ], + "Output Program": [ + "i = 1j\nx = -1+10*i\ny = 6\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 x^2-12 x-14$", + "Output Answer": [ + "$4-2 (x+3)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*x**2-12*x-14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{21 x^2}{2}-\\frac{17 x}{2}+\\frac{27}{2}$ and $q(x) = -10 x^2+5 x-\\frac{21}{2}$", + "Output Answer": [ + "$105 x^4+\\frac{65 x^3}{2}-\\frac{269 x^2}{4}+\\frac{627 x}{4}-\\frac{567}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((21*x**2)/2)-((17*x)/2)+(27/2)\nq = -10*x**2+5*x-(21/2)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $8 x^2+112 x-858$", + "Output Answer": [ + "$8 \\left(-x-\\frac{39}{2}\\right) \\left(\\frac{11}{2}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(8*x**2+112*x-858, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^3-8$ when divided by $9 x^3+4 x^2-x-8$.", + "Output Answer": [ + "$\\frac{8}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**3-8\nq = 9*x**3+4*x**2-x-8\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 12 x^2-\\frac{69 x}{7}+\\frac{52}{7}$ and $q(x) = -\\frac{55 x^2}{7}+\\frac{61 x}{7}+\\frac{36}{7}$", + "Output Answer": [ + "$-\\frac{660 x^4}{7}+\\frac{8919 x^3}{49}-\\frac{4045 x^2}{49}+\\frac{688 x}{49}+\\frac{1872}{49}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 12*x**2-((69*x)/7)+(52/7)\nq = -((55*x**2)/7)+((61*x)/7)+(36/7)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-4 \\sqrt{3} x^2+3 \\sqrt{3} x+2 \\sqrt{3}$", + "Output Answer": [ + "$x=\\frac{1}{8} \\left(3-\\sqrt{41}\\right)\\lor x=\\frac{1}{8} \\left(3+\\sqrt{41}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-4*sqrt(3)*x**2+3*sqrt(3)*x+2*sqrt(3), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -13 \\sqrt{2} x^2+9 \\sqrt{2} x+\\frac{11}{\\sqrt{2}}\\right| =\\frac{25}{\\sqrt{2}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{26} \\left(3-\\sqrt{113}\\right)\\right\\},\\left\\{x\\to \\frac{3}{26} \\left(3+\\sqrt{113}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-13*sqrt(2)*x**2+9*sqrt(2)*x+(11/(sqrt(2)))), (25/(sqrt(2)))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-8-\\frac{19 i}{4}$ and $y=-\\frac{39}{4}-\\frac{37 i}{4}$", + "Output Answer": [ + "$\\frac{7}{4}+\\frac{9 i}{2}$" + ], + "Output Program": [ + "i = 1j\nx = -8-((19*i)/4)\ny = -(39/4)-((37*i)/4)\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{26}{3}+\\frac{7 i}{3}$ and $y=-8-9 i$", + "Output Answer": [ + "$-\\frac{50}{3}-\\frac{20 i}{3}$" + ], + "Output Program": [ + "i = 1j\nx = -(26/3)+((7*i)/3)\ny = -8-9*i\nprint(x+y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-8 x^2-8 x$ and $4 x+4$.", + "Output Answer": [ + "$4 x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-8*x**2-8*x, 4*x+4))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-3 x+9 y+22 z+23=0$, $-14 x+4 y+10 z+23=0$, $-15 x+8 y-5 z-3=0$", + "Output Answer": [ + "$x=\\frac{2777}{2824}$, $y=\\frac{3709}{2824}$, $z=-\\frac{4091}{2824}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-3*x+9*y+22*z+23, -14*x+4*y+10*z+23, -15*x+8*y-5*z-3)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^2+2 x-5$ and $-4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**2+2*x-5, -4))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 6 x^2+2 x-10$ and $q(x) = -3 x^2-7 x-12$", + "Output Answer": [ + "$-18 x^4-48 x^3-56 x^2+46 x+120$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 6*x**2+2*x-10\nq = -3*x**2-7*x-12\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{49}{69}$, and $a_n=a_{n-1}+-\\frac{26}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$-\\frac{209792}{483}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (49/69) # initial value\nd = -(26/7) # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (49/69) # initial value\nd = -(26/7) # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-9 x-\\frac{5}{2}}+\\sqrt{\\frac{3}{4}-\\frac{17 x}{2}}=\\frac{13}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(-5967+26 \\sqrt{52610}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-9*x-(5/2))+sqrt((3/4)-((17*x)/2)), (13/4)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{11}{38}$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{20779}{38}$" + ], + "Output Program": [ + "a = -(11/38) # initial value\nd = 10 # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(11/38) # initial value\nd = 10 # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2-3 x+y^2-9 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $\\left(y-\\frac{9}{2}\\right)^2-4 \\left(x+\\frac{3}{8}\\right)^2=\\frac{251}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{8} & \\frac{9}{2}-\\frac{\\sqrt{1255}}{8} \\\\\n -\\frac{3}{8} & \\frac{1}{8} \\left(36+\\sqrt{1255}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{2}$\nCenter: $\\left\\{-\\frac{3}{8},\\frac{1}{2} \\left(\\frac{9}{2}-\\frac{\\sqrt{1255}}{8}+\\frac{1}{8} \\left(36+\\sqrt{1255}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{15}{4}-2 x,y=2 x+\\frac{21}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2-3*x+y**2-9*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{22-11 i}{e}$.", + "Output Answer": [ + "Norm: $\\frac{11 \\sqrt{5}}{e}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{1}{2}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((22-11*i)/math.e)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^5-5 x^4+6 x^3-7 x^2-2 x-5$ when divided by $-3 x^4+10 x^3+7 x^2+4 x+9$.", + "Output Answer": [ + "$\\frac{4 x}{3}+\\frac{55}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**5-5*x**4+6*x**3-7*x**2-2*x-5\nq = -3*x**4+10*x**3+7*x**2+4*x+9\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11-\\frac{88 x}{7}}+\\sqrt{-\\frac{41 x}{7}-\\frac{96}{7}}=\\frac{45}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-204308+90 \\sqrt{3488155}}{15463}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11-((88*x)/7))+sqrt(-((41*x)/7)-(96/7)), (45/7)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{4 \\left(\\cos \\left(\\frac{7 \\pi }{30}\\right)+i \\sin \\left(\\frac{7 \\pi }{30}\\right)\\right)}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $4 \\sqrt{\\frac{1}{3} \\left(\\sin ^2\\left(\\frac{7 \\pi }{30}\\right)+\\cos ^2\\left(\\frac{7 \\pi }{30}\\right)\\right)}$\nArgument: $\\frac{7 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((4*(math.cos(((7*math.pi)/30))+i*math.sin(((7*math.pi)/30))))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\left(125 t^2+750 t+1117\\right)^2, x(t)=25 t^2+150 t+225$", + "Output Answer": [ + "$y=25 x^2-80 x+64$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (125*t**2+750*t+1117)**2\nx_t = 25*t**2+150*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(23+25) ((((16-18)-2)+14)+24)$.", + "Output Answer": [ + "$1632$" + ], + "Output Program": [ + "try: \n print((23+25)*((((16-18)-2)+14)+24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{30 x^2}{\\pi }+\\frac{19 x}{\\pi }+\\frac{32}{\\pi }$ and $q(x) = \\frac{44 x^2}{\\pi }+\\frac{31 x}{\\pi }+\\frac{47}{\\pi }$", + "Output Answer": [ + "$\\frac{1320 x^4}{\\pi ^2}+\\frac{1766 x^3}{\\pi ^2}+\\frac{3407 x^2}{\\pi ^2}+\\frac{1885 x}{\\pi ^2}+\\frac{1504}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((30*x**2)/pi)+((19*x)/pi)+(32/pi)\nq = ((44*x**2)/pi)+((31*x)/pi)+(47/pi)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{(1+3)+7}{1-9}$.", + "Output Answer": [ + "$-\\frac{11}{8}$" + ], + "Output Program": [ + "try: \n print((((1+3)+7)/(1-9)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=2-4 i$ and $y=-7+10 i$", + "Output Answer": [ + "$9-14 i$" + ], + "Output Program": [ + "i = 1j\nx = 2-4*i\ny = -7+10*i\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{160 x}{7}-\\frac{50}{7}\\right| =\\frac{25}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5}{32}\\right\\},\\left\\{x\\to \\frac{15}{32}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((160*x)/7)-(50/7)), (25/7)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 10 x^2-14 x+19\\right| =8$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(10*x**2-14*x+19), 8), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{x^2}{3}-\\frac{11 x}{3}+\\frac{8}{3}$ and $\\frac{13 x}{3}+3$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((x**2)/3)-((11*x)/3)+(8/3), ((13*x)/3)+3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^2+2 x-2$ and $-2 x^3-2 x^2+4 x+5$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**2+2*x-2, -2*x**3-2*x**2+4*x+5))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{25 \\left(\\sin \\left(\\frac{11 \\pi }{45}\\right)-i \\cos \\left(\\frac{11 \\pi }{45}\\right)\\right)}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{25 \\sqrt{\\sin ^2\\left(\\frac{11 \\pi }{45}\\right)+\\cos ^2\\left(\\frac{11 \\pi }{45}\\right)}}{\\pi }$\nArgument: $-\\frac{23 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((25*(math.sin(((11*math.pi)/45))-i*math.cos(((11*math.pi)/45))))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{15 \\left(-\\cos \\left(\\frac{13 \\pi }{180}\\right)+i \\sin \\left(\\frac{13 \\pi }{180}\\right)\\right)}{e}$.", + "Output Answer": [ + "Norm: $\\frac{15 \\sqrt{\\sin ^2\\left(\\frac{13 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{180}\\right)}}{e}$\nArgument: $-\\frac{13 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((15*(-math.cos(((13*math.pi)/180))+i*math.sin(((13*math.pi)/180))))/math.e)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{37 x^2}{5}+10 x-9$", + "Output Answer": [ + "$\\frac{37}{5} \\left(x+\\frac{25}{37}\\right)^2-\\frac{458}{37}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((37*x**2)/5)+10*x-9), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{42 x}{5}+\\frac{17}{5}}+\\sqrt{\\frac{49 x}{5}-9}=\\frac{28}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{35} \\left(10502-56 \\sqrt{34873}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((42*x)/5)+(17/5))+sqrt(((49*x)/5)-9), (28/5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\sqrt{3} x^2+5 \\sqrt{3} x+\\frac{2}{\\sqrt{3}}$", + "Output Answer": [ + "$\\sqrt{3} \\left(x+\\frac{5}{2}\\right)^2-\\frac{25 \\sqrt{3}}{4}+\\frac{2}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (math.sqrt(3)*x**2+5*math.sqrt(3)*x+(2/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-144 x^3-468 x^2-108 x}{324 x-72 x^2}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to -3\\},\\left\\{x\\to -\\frac{1}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-144*x**3-468*x**2-108*x)/(324*x-72*x**2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{9 x^2+5 x+20}{-8 x-15}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((9*x**2+5*x+20)/(-8*x-15)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^3-x^2-7 x-5$ when divided by $2 x^5+9 x^4+6 x^2-6$.", + "Output Answer": [ + "$0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**3-x**2-7*x-5\nq = 2*x**5+9*x**4+6*x**2-6\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $e^{-\\frac{59 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $1$\nArgument: $-\\frac{59 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = math.e**(-((59*i*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-26 e^{-1+\\frac{67 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $\\frac{26}{e}$\nArgument: $-\\frac{113 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -26*math.e**(-1+((67*i*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $1-3 x$ and $1-5 x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(1-3*x, 1-5*x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2-10 x-6 y^2-9 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x-\\frac{5}{9}\\right)^2-6 \\left(y+\\frac{3}{4}\\right)^2=\\frac{389}{72}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{9}-\\frac{\\sqrt{1945}}{36} & -\\frac{3}{4} \\\\\n \\frac{1}{36} \\left(20+\\sqrt{1945}\\right) & -\\frac{3}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{5}{9}-\\frac{\\sqrt{1945}}{36}+\\frac{1}{36} \\left(20+\\sqrt{1945}\\right)\\right),-\\frac{3}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{3}{2}} x+\\frac{1}{36} \\left(-27-10 \\sqrt{6}\\right),y=\\frac{1}{36} \\left(10 \\sqrt{6}-27\\right)-\\sqrt{\\frac{3}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2-10*x-6*y**2-9*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-7 x^2+11 x-10$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(11-i \\sqrt{159}\\right)\\lor x=\\frac{1}{14} \\left(11+i \\sqrt{159}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-7*x**2+11*x-10, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $7 x^2+21 x-196$", + "Output Answer": [ + "$-7 (-x-7) (x-4)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(7*x**2+21*x-196, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^5+6 x^4-8 x^3-x^2+2 x+4$ when divided by $-7 x^5+3 x^4-x^3-3 x^2-6 x+8$.", + "Output Answer": [ + "$\\frac{4}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**5+6*x**4-8*x**3-x**2+2*x+4\nq = -7*x**5+3*x**4-x**3-3*x**2-6*x+8\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{\\sqrt{-x^5-2}}$ at the point $x=-6$", + "Output Answer": [ + "$\\sqrt[3]{13} \\sqrt[6]{46} = 4.451$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = -6\ntry: \n f = np.cbrt(math.sqrt(-x**5-2))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\sqrt{2}, \\frac{1}{\\sqrt{5}}, \\frac{1}{\\sqrt{2}})$", + "Output Answer": [ + "$\\left\\{3 \\sqrt{\\frac{3}{10}},\\tan ^{-1}\\left(\\sqrt{\\frac{22}{5}}\\right),\\tan ^{-1}\\left(\\frac{1}{\\sqrt{10}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.sqrt(2)\ny = (1/(math.sqrt(5)))\nz = (1/(math.sqrt(2)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $8 x^3+360 x^2+5344 x+26112$", + "Output Answer": [ + "$-8 (-x-12) (x+16) (x+17)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(8*x**3+360*x**2+5344*x+26112, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 x+6, q(x) = 3-5 x$", + "Output Answer": [ + "$4 x+9$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x+6\nq = 3-5*x\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4-12 x}+\\sqrt{4-4 x}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5}{8} \\left(-10+\\sqrt{91}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4-12*x)+sqrt(4-4*x), 5), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\frac{1}{(3-x)^4}$", + "Output Answer": [ + "$x<3\\lor x>3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = (1/((3-x)**4))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{4 x^2}{\\sqrt{3}}+7 \\sqrt{3} x-\\frac{22}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{4 \\left(x+\\frac{21}{8}\\right)^2}{\\sqrt{3}}-\\frac{147 \\sqrt{3}}{16}-\\frac{22}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((4*x**2)/(math.sqrt(3)))+7*math.sqrt(3)*x-(22/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -4 x^2+10 x+9$, $q(x) = -14 x^2+3 x+10$", + "Output Answer": [ + "$-18 x^2+13 x+19$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**2+10*x+9\nq = -14*x**2+3*x+10\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2+\\frac{11 x}{2}+\\frac{15}{2}$", + "Output Answer": [ + "$2 \\left(\\frac{15}{4}-x\\right) (x+1)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2+((11*x)/2)+(15/2), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{3-2 i}{\\sqrt{\\pi }}$ and $y=\\frac{5+6 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{27+8 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((3-2*i)/(math.sqrt(math.pi)))\ny = ((5+6*i)/(math.sqrt(math.pi)))\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $15 x^3+5 x$ and $3 x^2+1$.", + "Output Answer": [ + "$3 x^2+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(15*x**3+5*x, 3*x**2+1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\sqrt{2} \\left(\\cos \\left(\\frac{1}{3}\\right)+i \\sin \\left(\\frac{1}{3}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$16 \\sqrt{2} (\\cos (1)+i \\sin (1))$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*math.sqrt(2)*(math.cos((1/3))+1j*math.sin((1/3))))**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{13}{4} \\left(\\cos \\left(\\frac{23}{18}\\right)+i \\sin \\left(\\frac{23}{18}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$\\frac{169}{16} \\left(\\cos \\left(\\frac{23}{9}\\right)+i \\sin \\left(\\frac{23}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(13/4)*(math.cos((23/18))+1j*math.sin((23/18))))**2)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{8 x^2}{\\sqrt{3}}-\\frac{10 x}{\\sqrt{3}}+\\frac{2}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{8} \\left(-5-\\sqrt{41}\\right)\\lor x=\\frac{1}{8} \\left(\\sqrt{41}-5\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((8*x**2)/(sqrt(3)))-((10*x)/(sqrt(3)))+(2/(sqrt(3))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2+3 x$ and $2 x^4+4 x^3+x^2+x+3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2+3*x, 2*x**4+4*x**3+x**2+x+3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-16 x^2-3 x+1}{25 x^2-17 x+7}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{32} \\left(-3-\\sqrt{73}\\right)\\right\\},\\left\\{x\\to \\frac{1}{32} \\left(-3+\\sqrt{73}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-16*x**2-3*x+1)/(25*x**2-17*x+7)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-7 \\sqrt{3} x^2-4 \\sqrt{3} x-7 \\sqrt{3}$", + "Output Answer": [ + "$x=\\frac{1}{7} \\left(-2-3 i \\sqrt{5}\\right)\\lor x=\\frac{1}{7} \\left(-2+3 i \\sqrt{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-7*sqrt(3)*x**2-4*sqrt(3)*x-7*sqrt(3), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^5+3 x^4+9 x^3-7 x^2-9 x+4$ when divided by $x^3+7 x^2+10 x-8$.", + "Output Answer": [ + "$2 x^2-11 x+66$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**5+3*x**4+9*x**3-7*x**2-9*x+4\nq = x**3+7*x**2+10*x-8\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $x^2-x+9$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(1-i \\sqrt{35}\\right)\\lor x=\\frac{1}{2} \\left(1+i \\sqrt{35}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(x**2-x+9, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((((17+15)+19)+6)-5) (((16-24)-6)-21)^2$.", + "Output Answer": [ + "$63700$" + ], + "Output Program": [ + "try: \n print(((((17+15)+19)+6)-5)*(((16-24)-6)-21)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-9 \\left(\\cos \\left(\\frac{53}{45}\\right)+i \\sin \\left(\\frac{53}{45}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$6561 \\left(\\cos \\left(\\frac{212}{45}\\right)+i \\sin \\left(\\frac{212}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-9*(math.cos((53/45))+1j*math.sin((53/45))))**4)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(((10-10)-12)^2-3\\right)-20\\right) ((5-12)+24)$.", + "Output Answer": [ + "$2057$" + ], + "Output Program": [ + "try: \n print(((((10-10)-12)**2-3)-20)*((5-12)+24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{36 x^2}{5}-\\frac{16 x}{5}-\\frac{71}{5}$", + "Output Answer": [ + "$x=\\frac{1}{18} \\left(4-\\sqrt{655}\\right)\\lor x=\\frac{1}{18} \\left(4+\\sqrt{655}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((36*x**2)/5)-((16*x)/5)-(71/5), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2-20 \\sqrt{3} x+44$", + "Output Answer": [ + "$-3 \\left(-x-\\frac{22}{\\sqrt{3}}\\right) \\left(\\frac{2}{\\sqrt{3}}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2-20*sqrt(3)*x+44, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{13-12}{\\left(\\frac{1}{19} (22+21)^2-23\\right)+6}$.", + "Output Answer": [ + "$\\frac{19}{1526}$" + ], + "Output Program": [ + "try: \n print(((13-12)/(((1/19)*(22+21)**2-23)+6)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^5+7 x^4+6 x^3-4 x^2+2 x+6$ when divided by $7 x^2+8 x-8$.", + "Output Answer": [ + "$\\frac{9 x^3}{7}-\\frac{23 x^2}{49}+\\frac{982 x}{343}-\\frac{10516}{2401}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**5+7*x**4+6*x**3-4*x**2+2*x+6\nq = 7*x**2+8*x-8\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(-\\cos \\left(\\frac{\\pi }{90}\\right)-i \\sin \\left(\\frac{\\pi }{90}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$49 \\left(\\cos \\left(\\frac{\\pi }{45}\\right)+i \\sin \\left(\\frac{\\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(-math.cos((math.pi/90))-1j*math.sin((math.pi/90))))**2)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{4}{3}+7 i$ and $y=-\\frac{5}{3}+2 i$", + "Output Answer": [ + "$-\\frac{106}{9}-\\frac{43 i}{3}$" + ], + "Output Program": [ + "i = 1j\nx = -(4/3)+7*i\ny = -(5/3)+2*i\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$14 x-15 y-2 z+8=0$, $-2 x-16 y-9 z+25=0$, $-14 x-7 y+23 z-23=0$", + "Output Answer": [ + "$x=\\frac{1579}{4097}$, $y=\\frac{2868}{4097}$, $z=\\frac{5931}{4097}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((14*x-15*y-2*z+8, -2*x-16*y-9*z+25, -14*x-7*y+23*z-23)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{11}{2} \\left(\\cos \\left(\\frac{9}{5}\\right)+i \\sin \\left(\\frac{9}{5}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$\\frac{1771561}{64} \\left(\\cos \\left(\\frac{54}{5}\\right)+i \\sin \\left(\\frac{54}{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(11/2)*(math.cos((9/5))+1j*math.sin((9/5))))**6)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\frac{\\cos (7 x+3)}{\\sqrt{6-5 x}}$", + "Output Answer": [ + "$x<\\frac{6}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = ((cos(7*x+3))/(sqrt(6-5*x)))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $5 \\sqrt{3} x^2-8 \\sqrt{3} x$", + "Output Answer": [ + "$5 \\sqrt{3} \\left(x-\\frac{4}{5}\\right)^2-\\frac{16 \\sqrt{3}}{5}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (5*math.sqrt(3)*x**2-8*math.sqrt(3)*x), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{37}{4} \\left(\\cos \\left(\\frac{41}{30}\\right)+i \\sin \\left(\\frac{41}{30}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$\\frac{3512479453921 \\left(\\cos \\left(\\frac{164}{15}\\right)+i \\sin \\left(\\frac{164}{15}\\right)\\right)}{65536}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(37/4)*(math.cos((41/30))+1j*math.sin((41/30))))**8)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{55 x^2}{7}-\\frac{87 x}{7}+\\frac{47}{7}}{\\frac{153 x}{7}-\\frac{129}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{110} \\left(-87-\\sqrt{17909}\\right)\\right\\},\\left\\{x\\to \\frac{1}{110} \\left(-87+\\sqrt{17909}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((55*x**2)/7)-((87*x)/7)+(47/7))/(((153*x)/7)-(129/7))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2+5 x+5 y^2+6 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(y+\\frac{3}{5}\\right)^2-8 \\left(x-\\frac{5}{16}\\right)^2=-\\frac{637}{160}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{33}{40} & -\\frac{3}{5} \\\\\n \\frac{29}{20} & -\\frac{3}{5} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{13}{5}}$\nCenter: $\\left\\{\\frac{5}{16},-\\frac{3}{5}\\right\\}$\nAsymptotes: $\\left\\{y=2 \\sqrt{\\frac{2}{5}} x+\\frac{1}{40} \\left(-24-5 \\sqrt{10}\\right),y=\\frac{1}{40} \\left(5 \\sqrt{10}-24\\right)-2 \\sqrt{\\frac{2}{5}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2+5*x+5*y**2+6*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2-2 x+7 y^2-3 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(y-\\frac{3}{14}\\right)^2-3 \\left(x+\\frac{1}{3}\\right)^2=\\frac{83}{84}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{3} & \\frac{1}{42} \\left(9-\\sqrt{830}\\right) \\\\\n -\\frac{1}{3} & \\frac{1}{42} \\left(9+\\sqrt{830}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{10}{3}}$\nCenter: $\\left\\{-\\frac{1}{3},\\frac{1}{2} \\left(\\frac{1}{42} \\left(9-\\sqrt{830}\\right)+\\frac{1}{42} \\left(9+\\sqrt{830}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\sqrt{\\frac{3}{7}} x-\\frac{1}{\\sqrt{21}}+\\frac{3}{14},y=\\sqrt{\\frac{3}{7}} x+\\frac{1}{42} \\left(9+2 \\sqrt{21}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2-2*x+7*y**2-3*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\left(\\sin \\left(\\frac{\\pi }{90}\\right)-i \\cos \\left(\\frac{\\pi }{90}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-64 \\left(-\\sin \\left(\\frac{\\pi }{30}\\right)+i \\cos \\left(\\frac{\\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*(math.sin((math.pi/90))-1j*math.cos((math.pi/90))))**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{73}{17}$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$-\\frac{1725}{17}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(73/17) # initial value\nd = -8 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(73/17) # initial value\nd = -8 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{44}{7}$, and $a_n=a_{n-1}+\\frac{13}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$\\frac{27287}{14}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(44/7) # initial value\nd = (13/2) # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(44/7) # initial value\nd = (13/2) # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(\\cos \\left(\\frac{5}{9}\\right)+i \\sin \\left(\\frac{5}{9}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$64 \\left(\\cos \\left(\\frac{5}{3}\\right)+i \\sin \\left(\\frac{5}{3}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(math.cos((5/9))+1j*math.sin((5/9))))**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $9 x^6-16 x^4+3 x^3-6 x^2-6 x+4$ and $3 x^4-x^3-4 x^2+2 x-4$.", + "Output Answer": [ + "$3 x^4-x^3-4 x^2+2 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(9*x**6-16*x**4+3*x**3-6*x**2-6*x+4, 3*x**4-x**3-4*x**2+2*x-4))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{85 x}{4}-14\\right| =\\frac{73}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{5}\\right\\},\\left\\{x\\to \\frac{129}{85}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((85*x)/4)-14), (73/4)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-6 x^2+54 \\sqrt{3} x+180$", + "Output Answer": [ + "$-6 \\left(-x-\\sqrt{3}\\right) \\left(10 \\sqrt{3}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-6*x**2+54*sqrt(3)*x+180, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{77}{72}$, and $a_n=a_{n-1}+-\\frac{37}{4}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$-\\frac{201725}{72}$" + ], + "Output Program": [ + "a = -(77/72) # initial value\nd = -(37/4) # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(77/72) # initial value\nd = -(37/4) # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{44}{7}-\\frac{17 i}{7}$ and $y=\\frac{5}{7}-\\frac{27 i}{7}$", + "Output Answer": [ + "$-\\frac{97}{7}+\\frac{1103 i}{49}$" + ], + "Output Program": [ + "i = 1j\nx = -(44/7)-((17*i)/7)\ny = (5/7)-((27*i)/7)\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2-70 x+255$", + "Output Answer": [ + "$5 (-x-17) (x-3)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2-70*x+255, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{9 x}{2}-\\frac{1}{2}$ and $-2 x^5+3 x^4-\\frac{5 x^3}{2}+x^2+\\frac{9 x}{2}+5$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((9*x)/2)-(1/2), -2*x**5+3*x**4-((5*x**3)/2)+x**2+((9*x)/2)+5))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{4}{3}$, and $a_n=a_{n-1}+\\frac{64}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{10868}{21}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (4/3) # initial value\nd = (64/7) # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (4/3) # initial value\nd = (64/7) # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^5-x^4+9 x^3+8 x^2-3 x+3$ when divided by $2 x^5+6 x^4-x^3+x^2-2 x-9$.", + "Output Answer": [ + "$\\frac{5}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**5-x**4+9*x**3+8*x**2-3*x+3\nq = 2*x**5+6*x**4-x**3+x**2-2*x-9\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -2 \\left(2 x^2+6 x+5\\right)$, $q(x) = -x^2-6 x-12$", + "Output Answer": [ + "$-5 x^2-18 x-22$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*(2*x**2+6*x+5)\nq = -x**2-6*x-12\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{21}{2}-\\frac{11 x}{2}\\right| =5$", + "Output Answer": [ + "$\\left\\{\\{x\\to 1\\},\\left\\{x\\to \\frac{31}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs((21/2)-((11*x)/2)), 5), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5$ and $4 x^5-3 x^4-4 x^2+x+5$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5, 4*x**5-3*x**4-4*x**2+x+5))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2-40 x-1400$", + "Output Answer": [ + "$-10 (14-x) (x+10)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2-40*x-1400, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 8 x^2-8 x+8$ and $q(x) = x^2-13 x$", + "Output Answer": [ + "$8 x^4-112 x^3+112 x^2-104 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 8*x**2-8*x+8\nq = x**2-13*x\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{37 x}{7}+\\frac{33}{7}}+\\sqrt{\\frac{82 x}{7}+\\frac{101}{7}}=\\frac{34}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{116144-68 \\sqrt{3182539}}{14175}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((37*x)/7)+(33/7))+sqrt(((82*x)/7)+(101/7)), (34/7)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 11 x^2+8 x+9$, $q(x) = 13 \\left(x^2-x+1\\right)$", + "Output Answer": [ + "$24 x^2-5 x+22$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 11*x**2+8*x+9\nq = 13*(x**2-x+1)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\sqrt{3} x^2-\\sqrt{3} x-6 \\sqrt{3}$", + "Output Answer": [ + "$x=-2\\lor x=3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(sqrt(3)*x**2-sqrt(3)*x-6*sqrt(3), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{81}{49}$, and $a_n=a_{n-1}+-3 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$\\frac{15}{2} \\left(-\\frac{162}{49}-42 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(81/49) # initial value\nd = -3*math.pi # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(81/49) # initial value\nd = -3*math.pi # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $9 x^6-15 x^5-23 x^4+27 x^3+15 x^2-14 x-5$ and $-3 x^4+x^3+4 x^2-2 x-1$.", + "Output Answer": [ + "$3 x^4-x^3-4 x^2+2 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(9*x**6-15*x**5-23*x**4+27*x**3+15*x**2-14*x-5, -3*x**4+x**3+4*x**2-2*x-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3 x+10}+2 \\sqrt{3}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(146-48 \\sqrt{3}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3*x+10)+2*sqrt(3), 12), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+8 y^2+5 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $3 x^2+8 \\left(y+\\frac{5}{16}\\right)^2=\\frac{185}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5 \\sqrt{\\frac{37}{3}}}{16} & -\\frac{5}{16} \\\\\n \\frac{5 \\sqrt{\\frac{37}{3}}}{16} & -\\frac{5}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{5}{2}}}{2}$\nCenter: $\\left\\{0,-\\frac{5}{16}\\right\\}$\nArea Enclosed: $\\frac{185 \\pi }{64 \\sqrt{6}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+8*y**2+5*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=7 t-\\frac{37}{3}, x(t)=7 t-15$", + "Output Answer": [ + "$y=x+\\frac{8}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 7*t-(37/3)\nx_t = 7*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{14 \\left(-\\cos \\left(\\frac{4 \\pi }{45}\\right)-i \\sin \\left(\\frac{4 \\pi }{45}\\right)\\right)}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $14 \\sqrt{\\frac{\\sin ^2\\left(\\frac{4 \\pi }{45}\\right)+\\cos ^2\\left(\\frac{4 \\pi }{45}\\right)}{\\pi }}$\nArgument: $\\frac{4 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((14*(-math.cos(((4*math.pi)/45))-i*math.sin(((4*math.pi)/45))))/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 22 x^2+7 x+1\\right| =20$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{44} \\left(-7-\\sqrt{1721}\\right)\\right\\},\\left\\{x\\to \\frac{1}{44} \\left(-7+\\sqrt{1721}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(22*x**2+7*x+1), 20), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-7 x+9 y+10=0$, $-11 x-10 y-1=0$", + "Output Answer": [ + "$x=\\frac{7}{13}$, $y=-\\frac{9}{13}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-7*x+9*y+10, -11*x-10*y-1), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((((20+16)+17)-7)-23)-\\left(((11-16)+13)^2-25\\right)$.", + "Output Answer": [ + "$-16$" + ], + "Output Program": [ + "try: \n print(((((20+16)+17)-7)-23)-(((11-16)+13)**2-25))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-9 x^3-252 x^2-2304 x-6912$", + "Output Answer": [ + "$-9 (-x-8)^2 (x+12)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-9*x**3-252*x**2-2304*x-6912, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{350 x^2+707 x+273}{-125 x^2-265 x-104}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((350*x**2+707*x+273)/(-125*x**2-265*x-104)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\log (x-19)}{\\log (3)}+\\frac{\\log (22 x+8)}{\\log (3)}=\\frac{\\log (x-19)}{\\log (3)}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{22}\\right\\},\\{x\\to 19\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(((log(x-19))/(log(3)))+((log(22*x+8))/(log(3))), ((log(x-19))/(log(3)))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{27} \\left(90 t^2-1560 t+6799\\right)^2, x(t)=3 t^2-52 t+\\frac{676}{3}$", + "Output Answer": [ + "$y=\\frac{100 x^2}{3}+\\frac{260 x}{3}+\\frac{169}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/27)*(90*t**2-1560*t+6799)**2\nx_t = 3*t**2-52*t+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{92 x^2}{5}-\\frac{52 x}{5}-15}{\\frac{39 x^2}{5}-\\frac{79 x}{5}-\\frac{37}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{46} \\left(13-\\sqrt{1894}\\right)\\right\\},\\left\\{x\\to \\frac{1}{46} \\left(13+\\sqrt{1894}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((92*x**2)/5)-((52*x)/5)-15)/(((39*x**2)/5)-((79*x)/5)-(37/5))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{37}{2}$, and $a_n=a_{n-1}+\\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{25}{2} \\left(37+24 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (37/2) # initial value\nd = math.sqrt(3) # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (37/2) # initial value\nd = math.sqrt(3) # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$-\\frac{7 x}{3}$", + "Output Answer": [ + "$-\\frac{3}{7} \\left(x-\\frac{35}{3}\\right)-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, -((7*x)/3))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\cos ^{-1}(-4 x-8)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{4} (-\\cos (y)-8)\\text{ if }0\\leq y\\leq \\pi $}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, acos(-4*x-8))\nprint(solve(f, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 (x-4)^2, q(x) = -5 x-8$", + "Output Answer": [ + "$4 x^2-37 x+56$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*(x-4)**2\nq = -5*x-8\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-8 x^2-7 x+20}{-4 x^2+12 x+21}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(-7-\\sqrt{689}\\right)\\right\\},\\left\\{x\\to \\frac{1}{16} \\left(-7+\\sqrt{689}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-8*x**2-7*x+20)/(-4*x**2+12*x+21)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\sqrt{2} \\left(-\\sin \\left(\\frac{2 \\pi }{9}\\right)-i \\cos \\left(\\frac{2 \\pi }{9}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-11609505792 \\sqrt{2} \\left(\\cos \\left(\\frac{\\pi }{18}\\right)+i \\sin \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*math.sqrt(2)*(-math.sin(((2*math.pi)/9))-1j*math.cos(((2*math.pi)/9))))**11)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{85}{96}$, and $a_n=a_{n-1}+\\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$10 \\left(\\frac{85}{48}+19 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (85/96) # initial value\nd = math.sqrt(2) # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (85/96) # initial value\nd = math.sqrt(2) # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $15 x^3+21 x^2-9 x-6$ and $5 x+2$.", + "Output Answer": [ + "$5 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(15*x**3+21*x**2-9*x-6, 5*x+2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 10 x^2 \\log (2)+2 x \\log (2)-\\log (2)$ and $q(x) = -21 x^2 \\log (2)-8 x \\log (2)+19 \\log (2)$", + "Output Answer": [ + "$-210 x^4 \\log ^2(2)-122 x^3 \\log ^2(2)+195 x^2 \\log ^2(2)+46 x \\log ^2(2)-19 \\log ^2(2)$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 10*x**2*log(2)+2*x*log(2)-log(2)\nq = -21*x**2*log(2)-8*x*log(2)+19*log(2)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2-16 x+504$", + "Output Answer": [ + "$8 (-x-9) (x-7)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2-16*x+504, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{89}{24}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{2225}{24}$" + ], + "Output Program": [ + "a = (89/24) # initial value\nd = 0 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (89/24) # initial value\nd = 0 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^3+7 x+1$ when divided by $x^3+4 x^2-9 x-9$.", + "Output Answer": [ + "$-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**3+7*x+1\nq = x**3+4*x**2-9*x-9\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{75 x}{7}-\\frac{102}{7}}+\\sqrt{-6 x-\\frac{102}{7}}=\\frac{103}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-413751+412 \\sqrt{906689}}{2541}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((75*x)/7)-(102/7))+sqrt(-6*x-(102/7)), (103/7)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-132 x^3-222 x^2-78 x}{99 x+117}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{2}\\right\\},\\{x\\to 0\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-132*x**3-222*x**2-78*x)/(99*x+117)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(((7-6)-25)-1) (((17-2)+13)-14)$.", + "Output Answer": [ + "$-350$" + ], + "Output Program": [ + "try: \n print((((7-6)-25)-1)*(((17-2)+13)-14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\log \\left(\\sqrt{7} \\sqrt{-x}\\right)+\\tan (8-5 x)$", + "Output Answer": [ + "$\\frac{8-5 x}{\\pi }+\\frac{1}{2}\\notin \\mathbb{Z}\\land x<0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = log(sqrt(7)*sqrt(-x))+tan(8-5*x)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (5-6 x)^4, q(x) = 81$", + "Output Answer": [ + "$1296 x^4-4320 x^3+5400 x^2-3000 x+706$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (5-6*x)**4\nq = 81\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{9}{49} (13 x+10)^2, q(x) = \\frac{1}{49} (22 x+35)^2$", + "Output Answer": [ + "$\\frac{2005 x^2}{49}+\\frac{3880 x}{49}+\\frac{2125}{49}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (9/49)*(13*x+10)**2\nq = (1/49)*(22*x+35)**2\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{26-4 i}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{2 \\sqrt{173}}{\\pi }$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{2}{13}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((26-4*i)/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-80 t^2+600 t-1127, x(t)=16 t^2-120 t+225$", + "Output Answer": [ + "$y=-5 x-2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -80*t**2+600*t-1127\nx_t = 16*t**2-120*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{30}{7}+\\frac{32 i}{7}$.", + "Output Answer": [ + "Norm: $\\frac{2 \\sqrt{481}}{7}$\nArgument: $\\tan ^{-1}\\left(\\frac{16}{15}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (30/7)+((32*i)/7)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-5 x^2+7 y^2-3 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(y-\\frac{3}{14}\\right)^2-5 x^2=-\\frac{215}{28}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{\\sqrt{129}}{7} & \\frac{3}{14} \\\\\n \\frac{\\sqrt{129}}{7} & \\frac{3}{14} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{3}{7}}$\nCenter: $\\left\\{0,\\frac{3}{14}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{5}{7}} x+\\frac{3}{14},y=\\frac{3}{14}-\\sqrt{\\frac{5}{7}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-5*x**2+7*y**2-3*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-7 x^2-3 x-13$", + "Output Answer": [ + "$-7 \\left(x+\\frac{3}{14}\\right)^2-\\frac{355}{28}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-7*x**2-3*x-13), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\sqrt{-7 x-7}$", + "Output Answer": [ + "$y\\geq 0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(sqrt(-7*x-7), x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2+88 x+288$", + "Output Answer": [ + "$4 (-x-18) (-x-4)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2+88*x+288, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left((12-22)^2-24\\right)-17\\right)-20\\right) \\left(\\left(\\frac{21-16}{12}-9\\right)-8\\right)$.", + "Output Answer": [ + "$-\\frac{2587}{4}$" + ], + "Output Program": [ + "try: \n print(((((12-22)**2-24)-17)-20)*((((21-16)/12)-9)-8))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 x^2+2 x-10$", + "Output Answer": [ + "$-2 \\left(x-\\frac{1}{2}\\right)^2-\\frac{19}{2}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*x**2+2*x-10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{75 x}{7}-\\frac{44}{7}}+\\sqrt{\\frac{85}{7}-\\frac{55 x}{7}}=\\frac{61}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{280} \\left(-50179+61 \\sqrt{663217}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((75*x)/7)-(44/7))+sqrt((85/7)-((55*x)/7)), (61/7)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 13 x^2+8 x-8$ and $q(x) = 7 x^2+9 x+7$", + "Output Answer": [ + "$91 x^4+173 x^3+107 x^2-16 x-56$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 13*x**2+8*x-8\nq = 7*x**2+9*x+7\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$4 x+7 y+2=0$, $-16 x-22 y-21 z+8=0$, $-9 x+3 y+4 z+6=0$", + "Output Answer": [ + "$x=\\frac{1156}{1671}$, $y=-\\frac{1138}{1671}$, $z=\\frac{316}{557}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((4*x+7*y+2, -16*x-22*y-21*z+8, -9*x+3*y+4*z+6)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 x^2+\\frac{8 x}{3}+6$ and $q(x) = \\frac{2 x^2}{3}-\\frac{13 x}{3}-\\frac{17}{3}$", + "Output Answer": [ + "$-\\frac{8 x^4}{3}+\\frac{172 x^3}{9}+\\frac{136 x^2}{9}-\\frac{370 x}{9}-34$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*x**2+((8*x)/3)+6\nq = ((2*x**2)/3)-((13*x)/3)-(17/3)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{5 x^5}{2}-\\frac{37 x^4}{2}-9 x^3-\\frac{63 x^2}{4}-\\frac{29 x}{2}-\\frac{63}{4}$ and $5 x^4+2 x^3+4 x^2+\\frac{7 x}{2}+\\frac{9}{2}$.", + "Output Answer": [ + "$\\frac{5 x^4}{2}+x^3+2 x^2+\\frac{7 x}{4}+\\frac{9}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((5*x**5)/2)-((37*x**4)/2)-9*x**3-((63*x**2)/4)-((29*x)/2)-(63/4), 5*x**4+2*x**3+4*x**2+((7*x)/2)+(9/2)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{\\frac{18}{23}}{10}-16\\right) (((6-7)-1)+20)$.", + "Output Answer": [ + "$-\\frac{32958}{115}$" + ], + "Output Program": [ + "try: \n print((((18/23)/10)-16)*(((6-7)-1)+20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $20 x^4+8 x^3-8 x^2-8 x+12$ and $-5 x^4-2 x^3+2 x^2+2 x-3$.", + "Output Answer": [ + "$5 x^4+2 x^3-2 x^2-2 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(20*x**4+8*x**3-8*x**2-8*x+12, -5*x**4-2*x**3+2*x**2+2*x-3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{20}{11}$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=12$.", + "Output Answer": [ + "$\\frac{7020}{11}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(20/11) # initial value\nd = 10 # second term\nn = 12 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(20/11) # initial value\nd = 10 # second term\nn = 12 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=3$ and $y=4+10 i$", + "Output Answer": [ + "$\\frac{3}{29}-\\frac{15 i}{58}$" + ], + "Output Program": [ + "i = 1j\nx = 3\ny = 4+10*i\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $15 x^5+5 x^4+20 x^3+15 x^2-25 x$ and $3 x^5+x^4+4 x^3+3 x^2-5 x$.", + "Output Answer": [ + "$3 x^5+x^4+4 x^3+3 x^2-5 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(15*x**5+5*x**4+20*x**3+15*x**2-25*x, 3*x**5+x**4+4*x**3+3*x**2-5*x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{6 x+2}$ at the point $x=5$", + "Output Answer": [ + "$4 \\sqrt{2} = 5.657$" + ], + "Output Program": [ + "import math\n\nx = 5\ntry: \n f = math.sqrt(6*x+2)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\cos ^{-1}\\left(\\frac{33 x}{5}+\\frac{7}{5}\\right)+1$", + "Output Answer": [ + "$-\\frac{4}{11}\\leq x\\leq -\\frac{2}{33}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = acos(((33*x)/5)+(7/5))+1\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((21-3)-18)-(((19+3)+2)+11)$.", + "Output Answer": [ + "$-35$" + ], + "Output Program": [ + "try: \n print(((21-3)-18)-(((19+3)+2)+11))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{11-17 i}{\\sqrt{3}}$ and $y=\\frac{1+4 i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{10-21 i}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((11-17*i)/(math.sqrt(3)))\ny = ((1+4*i)/(math.sqrt(3)))\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 6 x^2+x+3$, $q(x) = -9 x^2-14 x+2$", + "Output Answer": [ + "$-3 x^2-13 x+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**2+x+3\nq = -9*x**2-14*x+2\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x^2+2 x-4$ and $2 x-5$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x**2+2*x-4, 2*x-5))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{144 x^2+60 x-126}{-156 x-182}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((144*x**2+60*x-126)/(-156*x-182)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{65 x}{3}+22 y-21=0$, $\\frac{50 x}{3}-\\frac{65 y}{3}-10=0$", + "Output Answer": [ + "$x=-\\frac{243}{37}$, $y=-\\frac{204}{37}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((65*x)/3)+22*y-21, ((50*x)/3)-((65*y)/3)-10), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-x^2-11 x-21}{7 x^2+19 x-15}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-11-\\sqrt{37}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(-11+\\sqrt{37}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-x**2-11*x-21)/(7*x**2+19*x-15)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{13 \\left(\\cos \\left(\\frac{1}{30}\\right)+i \\sin \\left(\\frac{1}{30}\\right)\\right)}{\\sqrt{3}}\\right)^6$", + "Output Answer": [ + "$\\frac{4826809}{27} \\left(\\cos \\left(\\frac{1}{5}\\right)+i \\sin \\left(\\frac{1}{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((13*(math.cos((1/30))+1j*math.sin((1/30))))/(math.sqrt(3))))**6)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^2-7 x-4$ when divided by $1$.", + "Output Answer": [ + "$2 x^2-7 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**2-7*x-4\nq = 1\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^5-10 x^4+4 x^3-x^2-9 x-2$ when divided by $-5 x^5-9 x^4-8 x^2-3 x+3$.", + "Output Answer": [ + "$-\\frac{9}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**5-10*x**4+4*x**3-x**2-9*x-2\nq = -5*x**5-9*x**4-8*x**2-3*x+3\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{84}{5}$, and $a_n=a_{n-1}+-3 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$\\frac{19}{2} \\left(\\frac{168}{5}-54 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = (84/5) # initial value\nd = -3*math.sqrt(2) # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (84/5) # initial value\nd = -3*math.sqrt(2) # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^6-6 x^5+6 x^4-x^3+6 x^2-2 x+4$ when divided by $-8 x^4-2 x^3-7 x^2-5 x+3$.", + "Output Answer": [ + "$-\\frac{3 x^2}{8}+\\frac{27 x}{32}-\\frac{81}{128}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**6-6*x**5+6*x**4-x**3+6*x**2-2*x+4\nq = -8*x**4-2*x**3-7*x**2-5*x+3\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-7 x+8 y-15 z+12=0$, $23 x-7 y-z-2=0$, $25 x+20 y-9 z-5=0$", + "Output Answer": [ + "$x=\\frac{2017}{8650}$, $y=\\frac{1534}{4325}$, $z=\\frac{1523}{1730}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-7*x+8*y-15*z+12, 23*x-7*y-z-2, 25*x+20*y-9*z-5)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=16 (31-10 t)^2, x(t)=5 t-15$", + "Output Answer": [ + "$y=64 x^2-64 x+16$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 16*(31-10*t)**2\nx_t = 5*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{66}{71}$, and $a_n=a_{n-1}+-3 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$3 \\left(-\\frac{132}{71}-15 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(66/71) # initial value\nd = -3*math.pi # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(66/71) # initial value\nd = -3*math.pi # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{22}{11}-7}{((((15+5)-24)-21)-25)^2}$.", + "Output Answer": [ + "$-\\frac{1}{500}$" + ], + "Output Program": [ + "try: \n print((((22/11)-7)/(((((15+5)-24)-21)-25)**2)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 16 (2-3 x)^4, q(x) = 81 (1-2 x)^4$", + "Output Answer": [ + "$2592 x^4-6048 x^3+5400 x^2-2184 x+337$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 16*(2-3*x)**4\nq = 81*(1-2*x)**4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 x^2+x+9$ and $q(x) = -8 x^2-6 x+4$", + "Output Answer": [ + "$-40 x^4-38 x^3-58 x^2-50 x+36$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*x**2+x+9\nq = -8*x**2-6*x+4\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -x^2+10 x-4$, $q(x) = 3 x^2+8 x-10$", + "Output Answer": [ + "$2 x^2+18 x-14$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**2+10*x-4\nq = 3*x**2+8*x-10\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{22 x}{\\sqrt{3}}-10 \\sqrt{3} y+\\frac{7 z}{\\sqrt{3}}-\\frac{16}{\\sqrt{3}}=0$, $-\\frac{28 x}{\\sqrt{3}}+8 \\sqrt{3} y+8 \\sqrt{3} z-7 \\sqrt{3}=0$, $\\frac{20 x}{\\sqrt{3}}-\\frac{22 y}{\\sqrt{3}}-\\frac{14 z}{\\sqrt{3}}+\\frac{23}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{5721}{2956}$, $y=\\frac{675}{1478}$, $z=-\\frac{2719}{1478}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((22*x)/(sqrt(3)))-10*sqrt(3)*y+((7*z)/(sqrt(3)))-(16/(sqrt(3))), -((28*x)/(sqrt(3)))+8*sqrt(3)*y+8*sqrt(3)*z-7*sqrt(3), ((20*x)/(sqrt(3)))-((22*y)/(sqrt(3)))-((14*z)/(sqrt(3)))+(23/(sqrt(3))))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+10 x+3 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $6 x^2+10 x+3 y=5$\nVertex: $\\left\\{-\\frac{5}{6},\\frac{55}{18}\\right\\}$\nDirectrix: $y=\\frac{229}{72}$\nFocal Parameter: $\\frac{1}{4}$\nFocus: $\\left\\{-\\frac{5}{6},\\frac{211}{72}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+10*x+3*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 16 (x+3)^4, q(x) = (8 x+9)^4$", + "Output Answer": [ + "$4112 x^4+18624 x^3+31968 x^2+25056 x+7857$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 16*(x+3)**4\nq = (8*x+9)**4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 13 x-15| =2$", + "Output Answer": [ + "$\\left\\{\\{x\\to 1\\},\\left\\{x\\to \\frac{17}{13}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(13*x-15), 2), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-3+4 i$ and $y=-7+3 i$", + "Output Answer": [ + "$4+i$" + ], + "Output Program": [ + "i = 1j\nx = -3+4*i\ny = -7+3*i\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 3 (x+4)^2, q(x) = 192 \\sqrt{3} (x+1)^3$", + "Output Answer": [ + "$192 \\sqrt{3} x^3+576 \\sqrt{3} x^2+3 x^2+576 \\sqrt{3} x+24 x+192 \\sqrt{3}+48$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*(x+4)**2\nq = 192*sqrt(3)*(x+1)**3\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 15 x-23| =-4$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(15*x-23), -4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(\\cos \\left(\\frac{17}{9}\\right)+i \\sin \\left(\\frac{17}{9}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-823543 \\left(\\cos \\left(\\frac{119}{9}\\right)+i \\sin \\left(\\frac{119}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(math.cos((17/9))+1j*math.sin((17/9))))**7)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $9 x^2-\\frac{11 x}{2}+\\frac{3}{2}$", + "Output Answer": [ + "$9 \\left(x-\\frac{11}{36}\\right)^2+\\frac{95}{144}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (9*x**2-((11*x)/2)+(3/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 9 x^2+11 x+5\\right| =24$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(-11-\\sqrt{805}\\right)\\right\\},\\left\\{x\\to \\frac{1}{18} \\left(-11+\\sqrt{805}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(9*x**2+11*x+5), 24), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+352 x-2640$", + "Output Answer": [ + "$11 (12-x) (x-20)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+352*x-2640, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $5 x^2-x+2$", + "Output Answer": [ + "$5 \\left(x-\\frac{1}{10}\\right)^2+\\frac{39}{20}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (5*x**2-x+2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-7 x^2-x-2$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(-1-i \\sqrt{55}\\right)\\lor x=\\frac{1}{14} \\left(-1+i \\sqrt{55}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-7*x**2-x-2, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $x^2+x-14$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(-1-\\sqrt{57}\\right)\\lor x=\\frac{1}{2} \\left(\\sqrt{57}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(x**2+x-14, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $10 x-5 y^2-5 y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $10 x-5 y^2-5 y=-2$\nVertex: $\\left\\{-\\frac{13}{40},-\\frac{1}{2}\\right\\}$\nDirectrix: $x=-\\frac{33}{40}$\nFocal Parameter: $1$\nFocus: $\\left\\{\\frac{7}{40},-\\frac{1}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x-5*y**2-5*y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{7 x-7}+\\sqrt{13 x+9}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(1642-91 \\sqrt{295}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(7*x-7)+sqrt(13*x+9), 13), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^5-6 x^4+7 x^3+9 x^2+5 x+1$ when divided by $5 x^2+3 x-6$.", + "Output Answer": [ + "$-\\frac{2 x^3}{5}-\\frac{24 x^2}{25}+\\frac{187 x}{125}-\\frac{156}{625}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**5-6*x**4+7*x**3+9*x**2+5*x+1\nq = 5*x**2+3*x-6\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{19}{2}+\\frac{27 i}{4}$ and $y=\\frac{31}{4}-i$", + "Output Answer": [ + "$-\\frac{7}{4}+\\frac{23 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = -(19/2)+((27*i)/4)\ny = (31/4)-i\nprint(x+y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{15 x^5}{2}+\\frac{15 x^4}{4}-\\frac{27 x^3}{4}-\\frac{3 x^2}{2}-3 x-6$ and $5 x^5+\\frac{5 x^4}{2}-\\frac{9 x^3}{2}-x^2-2 x-4$.", + "Output Answer": [ + "$\\frac{5 x^5}{2}+\\frac{5 x^4}{4}-\\frac{9 x^3}{4}-\\frac{x^2}{2}-x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((15*x**5)/2)+((15*x**4)/4)-((27*x**3)/4)-((3*x**2)/2)-3*x-6, 5*x**5+((5*x**4)/2)-((9*x**3)/2)-x**2-2*x-4))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-2 x^2+5 x-2 y^2+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Circle\nEquation: $-2 \\left(x-\\frac{5}{4}\\right)^2-2 y^2=-\\frac{57}{8}$\nRadius: $\\frac{\\sqrt{57}}{4}$\nCircumference: $\\frac{\\sqrt{57} \\pi }{2}$\nCenter: $\\left\\{\\frac{5}{4},0\\right\\}$\nArea Enclosed: $\\frac{57 \\pi }{16}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x**2+5*x-2*y**2+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{3}{2}$ and $-3 x^3+5 x-\\frac{7}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-(3/2), -3*x**3+5*x-(7/2)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-7 x^2+3 x-8$", + "Output Answer": [ + "$-7 \\left(x-\\frac{3}{14}\\right)^2-\\frac{215}{28}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-7*x**2+3*x-8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-9$, and $a_n=a_{n-1}+-\\frac{2}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$-\\frac{803}{7}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -9 # initial value\nd = -(2/7) # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -9 # initial value\nd = -(2/7) # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x-12}+\\sqrt{9 x-15}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(83-24 \\sqrt{10}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x-12)+sqrt(9*x-15), 4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $7 x^2+21 x-1260$", + "Output Answer": [ + "$-7 (12-x) (x+15)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(7*x**2+21*x-1260, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2-\\frac{869 x}{4}+\\frac{8349}{8}$", + "Output Answer": [ + "$-11 \\left(\\frac{23}{2}-x\\right) \\left(x-\\frac{33}{4}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2-((869*x)/4)+(8349/8), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-5 x+4 y-7 z-24=0$, $-12 x-12 y-3 z+18=0$, $7 x-12 y-11 z-11=0$", + "Output Answer": [ + "$x=\\frac{11}{28}$, $y=\\frac{1595}{896}$, $z=-\\frac{603}{224}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-5*x+4*y-7*z-24, -12*x-12*y-3*z+18, 7*x-12*y-11*z-11)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-13 x-15}+\\sqrt{-2 x-6}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{121} \\left(-2634+26 \\sqrt{3866}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-13*x-15)+sqrt(-2*x-6), 13), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left((9+22)^2-14\\right)-6\\right)^2+19\\right)-(1+7)$.", + "Output Answer": [ + "$885492$" + ], + "Output Program": [ + "try: \n print(((((9+22)**2-14)-6)**2+19)-(1+7))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{11 x^2-13 x+1}{24 x^2+24 x-7}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{22} \\left(13-5 \\sqrt{5}\\right)\\right\\},\\left\\{x\\to \\frac{1}{22} \\left(13+5 \\sqrt{5}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((11*x**2-13*x+1)/(24*x**2+24*x-7)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $9 x^3-\\frac{549 x^2}{2}+\\frac{5085 x}{2}-6975$", + "Output Answer": [ + "$9 (5-x) \\left(\\frac{31}{2}-x\\right) (x-10)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(9*x**3-((549*x**2)/2)+((5085*x)/2)-6975, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{22 x^2}{\\sqrt{\\pi }}-\\frac{26 x}{\\sqrt{\\pi }}-\\frac{26}{\\sqrt{\\pi }}$ and $q(x) = -\\frac{14 x^2}{\\sqrt{\\pi }}-\\frac{24 x}{\\sqrt{\\pi }}-\\frac{7}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{308 x^4}{\\pi }+\\frac{892 x^3}{\\pi }+\\frac{1142 x^2}{\\pi }+\\frac{806 x}{\\pi }+\\frac{182}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((22*x**2)/(sqrt(pi)))-((26*x)/(sqrt(pi)))-(26/(sqrt(pi)))\nq = -((14*x**2)/(sqrt(pi)))-((24*x)/(sqrt(pi)))-(7/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2-10 x+8$ and $q(x) = 14 x^2+9 x-13$", + "Output Answer": [ + "$-196 x^4-266 x^3+204 x^2+202 x-104$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2-10*x+8\nq = 14*x**2+9*x-13\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 (4-3 x)^2, q(x) = (2-5 x)^2$", + "Output Answer": [ + "$61 x^2-116 x+68$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*(4-3*x)**2\nq = (2-5*x)**2\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{53 x^2}{4}-\\frac{25 x}{4}-\\frac{7}{4}$", + "Output Answer": [ + "$x=\\frac{1}{106} \\left(25-\\sqrt{2109}\\right)\\lor x=\\frac{1}{106} \\left(25+\\sqrt{2109}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((53*x**2)/4)-((25*x)/4)-(7/4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{2}{3} \\left(\\cos \\left(\\frac{13 \\pi }{90}\\right)-i \\sin \\left(\\frac{13 \\pi }{90}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{2}{3} \\sqrt{\\sin ^2\\left(\\frac{13 \\pi }{90}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{90}\\right)}$\nArgument: $\\frac{77 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(2/3)*(math.cos(((13*math.pi)/90))-i*math.sin(((13*math.pi)/90)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=1$, and $a_n=a_{n-1}+-\\frac{8}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$\\frac{19}{2} \\left(2-\\frac{144}{\\sqrt{5}}\\right)$" + ], + "Output Program": [ + "import math\n\na = 1 # initial value\nd = -(8/(math.sqrt(5))) # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 1 # initial value\nd = -(8/(math.sqrt(5))) # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{11}{3}+\\frac{8 i}{3}$ and $y=\\frac{22}{3}-\\frac{22 i}{3}$", + "Output Answer": [ + "$-11+10 i$" + ], + "Output Program": [ + "i = 1j\nx = -(11/3)+((8*i)/3)\ny = (22/3)-((22*i)/3)\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{22 x^2}{3}+\\frac{2 x}{3}-\\frac{44}{3}$", + "Output Answer": [ + "$x=\\frac{1}{22} \\left(-1-\\sqrt{969}\\right)\\lor x=\\frac{1}{22} \\left(\\sqrt{969}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((22*x**2)/3)+((2*x)/3)-(44/3), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-5 x-\\frac{26}{3}}+\\sqrt{-3 x-\\frac{16}{3}}=\\frac{40}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-3215+40 \\sqrt{5997}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-5*x-(26/3))+sqrt(-3*x-(16/3)), (40/3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{32}{5} \\left(\\cos \\left(\\frac{7}{6}\\right)+i \\sin \\left(\\frac{7}{6}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$\\frac{32768}{125} \\left(\\cos \\left(\\frac{7}{2}\\right)+i \\sin \\left(\\frac{7}{2}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((32/5)*(math.cos((7/6))+1j*math.sin((7/6))))**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{56}{9}$ and $\\frac{7}{3}$.", + "Output Answer": [ + "$\\frac{7}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd((56/9), (7/3)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-x^2+11 x-7$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(11-\\sqrt{93}\\right)\\lor x=\\frac{1}{2} \\left(11+\\sqrt{93}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-x**2+11*x-7, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-221 x^3-112 x^2+192 x+72}{34 x+12}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{13} \\left(-1-\\sqrt{157}\\right)\\right\\},\\left\\{x\\to \\frac{1}{13} \\left(-1+\\sqrt{157}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-221*x**3-112*x**2+192*x+72)/(34*x+12)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (8-5 x)^4, q(x) = 2401 x^4$", + "Output Answer": [ + "$3026 x^4-4000 x^3+9600 x^2-10240 x+4096$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (8-5*x)**4\nq = 2401*x**4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x-3$ and $-3 x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x-3, -3*x-3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(((21+8)-17)-19)+(((22+9)-7)-15)$.", + "Output Answer": [ + "$2$" + ], + "Output Program": [ + "try: \n print((((21+8)-17)-19)+(((22+9)-7)-15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -3 x^2-12 x-9$ and $q(x) = 10 x^2-8 x+13$", + "Output Answer": [ + "$-30 x^4-96 x^3-33 x^2-84 x-117$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -3*x**2-12*x-9\nq = 10*x**2-8*x+13\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{1}{20} (9+12)^2+11\\right)+((((21+1)-9)-13)-8)$.", + "Output Answer": [ + "$\\frac{501}{20}$" + ], + "Output Program": [ + "try: \n print(((1/20)*(9+12)**2+11)+((((21+1)-9)-13)-8))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\left(\\cos \\left(\\frac{109}{90}\\right)+i \\sin \\left(\\frac{109}{90}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$16 \\left(\\cos \\left(\\frac{218}{45}\\right)+i \\sin \\left(\\frac{218}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*(math.cos((109/90))+1j*math.sin((109/90))))**4)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 14 x^2+x-3$ and $q(x) = -x^2+6 x+4$", + "Output Answer": [ + "$-14 x^4+83 x^3+65 x^2-14 x-12$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 14*x**2+x-3\nq = -x**2+6*x+4\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{17 x^2+5 x+23}{16 x^2+12 x-12}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((17*x**2+5*x+23)/(16*x**2+12*x-12)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{63 x}{5}-\\frac{62}{5}}+\\sqrt{\\frac{58}{5}-\\frac{18 x}{5}}=\\frac{24}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{375} \\left(-2728+16 \\sqrt{21314}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((63*x)/5)-(62/5))+sqrt((58/5)-((18*x)/5)), (24/5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((17+13)-12)-\\left(\\left(((17+12)-19)^2+9\\right)+15\\right)$.", + "Output Answer": [ + "$-106$" + ], + "Output Program": [ + "try: \n print(((17+13)-12)-((((17+12)-19)**2+9)+15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$14 x-7 y+2=0$, $-24 x-10 y+11=0$", + "Output Answer": [ + "$x=\\frac{57}{308}$, $y=\\frac{101}{154}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((14*x-7*y+2, -24*x-10*y+11), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{8}{17}$, and $a_n=a_{n-1}+-4 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$\\frac{15}{2} \\left(\\frac{16}{17}-56 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\na = (8/17) # initial value\nd = -4*math.sqrt(3) # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (8/17) # initial value\nd = -4*math.sqrt(3) # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $3 \\sqrt{2} x^2+\\frac{17 x}{\\sqrt{2}}+10 \\sqrt{2}$", + "Output Answer": [ + "$3 \\sqrt{2} \\left(x+\\frac{17}{12}\\right)^2+10 \\sqrt{2}-\\frac{289}{24 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (3*math.sqrt(2)*x**2+((17*x)/(math.sqrt(2)))+10*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^3+8 x^2+6 x-10$ when divided by $-10$.", + "Output Answer": [ + "$\\frac{4 x^3}{5}-\\frac{4 x^2}{5}-\\frac{3 x}{5}+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**3+8*x**2+6*x-10\nq = -10\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{35 x^2}{e}-\\frac{12 x}{e}-\\frac{8}{e}$ and $q(x) = -\\frac{13 x^2}{e}-\\frac{7 x}{e}+\\frac{24}{e}$", + "Output Answer": [ + "$\\frac{455 x^4}{e^2}+\\frac{401 x^3}{e^2}-\\frac{652 x^2}{e^2}-\\frac{232 x}{e^2}-\\frac{192}{e^2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -((35*x**2)/math.e)-((12*x)/math.e)-(8/math.e)\nq = -((13*x**2)/math.e)-((7*x)/math.e)+(24/math.e)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -(8 x+7)^3, q(x) = 2401 (x-1)^4$", + "Output Answer": [ + "$2401 x^4-10116 x^3+13062 x^2-10780 x+2058$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(8*x+7)**3\nq = 2401*(x-1)**4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+99 x+572$", + "Output Answer": [ + "$11 (-x-4) (x-13)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+99*x+572, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{39 x}{5}+2$ when divided by $\\frac{2 x}{5}-\\frac{16}{5}$.", + "Output Answer": [ + "$\\frac{39}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((39*x)/5)+2\nq = ((2*x)/5)-(16/5)\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-3 x+y^2+9 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-3 x+y^2+9 y=-4$\nVertex: $\\left\\{-\\frac{65}{12},-\\frac{9}{2}\\right\\}$\nDirectrix: $x=-\\frac{37}{6}$\nFocal Parameter: $\\frac{3}{2}$\nFocus: $\\left\\{-\\frac{14}{3},-\\frac{9}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x+y**2+9*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-10 x^2+230 x-1120$", + "Output Answer": [ + "$10 (16-x) (x-7)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-10*x**2+230*x-1120, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -2 x^2-x+3$ and $q(x) = 4 x^2+11 x+8$", + "Output Answer": [ + "$-8 x^4-26 x^3-15 x^2+25 x+24$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -2*x**2-x+3\nq = 4*x**2+11*x+8\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^3+3 x^2-x-6$ when divided by $10 x^2-6 x+8$.", + "Output Answer": [ + "$\\frac{7 x}{10}+\\frac{18}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**3+3*x**2-x-6\nq = 10*x**2-6*x+8\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x+1}+\\sqrt{5 x+4}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3003}{299+20 \\sqrt{221}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x+1)+sqrt(5*x+4), 10), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\sin \\left(\\frac{\\pi }{90}\\right)+i \\cos \\left(\\frac{\\pi }{90}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$343 \\left(-\\sin \\left(\\frac{\\pi }{30}\\right)-i \\cos \\left(\\frac{\\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.sin((math.pi/90))+1j*math.cos((math.pi/90))))**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{1}{30}$, and $a_n=a_{n-1}+3 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$\\frac{19}{2} \\left(\\frac{1}{15}+54 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\na = (1/30) # initial value\nd = 3*math.sqrt(5) # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (1/30) # initial value\nd = 3*math.sqrt(5) # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{19 x^2}{3}+14 x-8$, $q(x) = \\frac{1}{3} \\left(28 x^2-19 x+26\\right)$", + "Output Answer": [ + "$3 x^2+\\frac{23 x}{3}+\\frac{2}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((19*x**2)/3)+14*x-8\nq = (1/3)*(28*x**2-19*x+26)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(-\\cos \\left(\\frac{11 \\pi }{45}\\right)+i \\sin \\left(\\frac{11 \\pi }{45}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$16 \\left(\\sin \\left(\\frac{\\pi }{90}\\right)-i \\cos \\left(\\frac{\\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(-math.cos(((11*math.pi)/45))+1j*math.sin(((11*math.pi)/45))))**2)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{7}, 6, \\frac{1}{4})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{28289}}{28},\\tan ^{-1}\\left(\\frac{4 \\sqrt{1765}}{7}\\right),\\tan ^{-1}(42)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/7)\ny = 6\nz = (1/4)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left((20-17)^2-8\\right)^2+((6+24)+10)$.", + "Output Answer": [ + "$41$" + ], + "Output Program": [ + "try: \n print(((20-17)**2-8)**2+((6+24)+10))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{92}{97}$, and $a_n=a_{n-1}+-\\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$13 \\left(\\frac{184}{97}-25 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (92/97) # initial value\nd = -math.pi # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (92/97) # initial value\nd = -math.pi # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^3-5 x^2-9 x+3$ when divided by $4 x^3+8 x^2+x$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**3-5*x**2-9*x+3\nq = 4*x**3+8*x**2+x\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-x^2+5 x-5$", + "Output Answer": [ + "$\\frac{5}{4}-\\left(x-\\frac{5}{2}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-x**2+5*x-5), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{5} \\left(51 x^2-53 x-65\\right)$, $q(x) = \\frac{2}{5} \\left(26 x^2+27 x-6\\right)$", + "Output Answer": [ + "$\\frac{103 x^2}{5}+\\frac{x}{5}-\\frac{77}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/5)*(51*x**2-53*x-65)\nq = (2/5)*(26*x**2+27*x-6)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{41}{5}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$\\frac{287}{5}$" + ], + "Output Program": [ + "a = (41/5) # initial value\nd = 0 # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (41/5) # initial value\nd = 0 # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{36}{7}-\\frac{34 i}{7}$ and $y=\\frac{9}{7}-\\frac{40 i}{7}$", + "Output Answer": [ + "$-\\frac{1684}{49}+\\frac{162 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = -(36/7)-((34*i)/7)\ny = (9/7)-((40*i)/7)\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -7 x^2-11 x-10$ and $q(x) = 11 x^2-7 x-11$", + "Output Answer": [ + "$-77 x^4-72 x^3+44 x^2+191 x+110$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -7*x**2-11*x-10\nq = 11*x**2-7*x-11\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{\\cos \\left(\\frac{49}{45}\\right)+i \\sin \\left(\\frac{49}{45}\\right)}{\\sqrt{3}}\\right)^3$", + "Output Answer": [ + "$-\\frac{\\cos \\left(\\frac{49}{15}\\right)+i \\sin \\left(\\frac{49}{15}\\right)}{3 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((math.cos((49/45))+1j*math.sin((49/45)))/(math.sqrt(3))))**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -8 \\sqrt{3} x^2+4 \\sqrt{3} x+\\frac{7}{\\sqrt{3}}$ and $q(x) = \\frac{5 x^2}{\\sqrt{3}}-\\frac{8 x}{\\sqrt{3}}+\\frac{19}{\\sqrt{3}}$", + "Output Answer": [ + "$-40 x^4+84 x^3-\\frac{517 x^2}{3}+\\frac{172 x}{3}+\\frac{133}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -8*sqrt(3)*x**2+4*sqrt(3)*x+(7/(sqrt(3)))\nq = ((5*x**2)/(sqrt(3)))-((8*x)/(sqrt(3)))+(19/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| x+22| =-16$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(x+22), -16), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-12 x^2+276 x-1560$", + "Output Answer": [ + "$12 (13-x) (x-10)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-12*x**2+276*x-1560, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $4 x+8 y^2+6 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $4 x+8 y^2+6 y=5$\nVertex: $\\left\\{\\frac{49}{32},-\\frac{3}{8}\\right\\}$\nDirectrix: $x=\\frac{53}{32}$\nFocal Parameter: $\\frac{1}{4}$\nFocus: $\\left\\{\\frac{45}{32},-\\frac{3}{8}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x+8*y**2+6*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{39}{4}+\\frac{11 i}{4}$ and $y=-8-\\frac{33 i}{4}$", + "Output Answer": [ + "$-\\frac{7}{4}+11 i$" + ], + "Output Program": [ + "i = 1j\nx = -(39/4)+((11*i)/4)\ny = -8-((33*i)/4)\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{29}{5}-14 x}+\\sqrt{-\\frac{63 x}{5}-\\frac{47}{5}}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(-4579+14 \\sqrt{106595}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((29/5)-14*x)+sqrt(-((63*x)/5)-(47/5)), 7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^3-15 x^2-x+6$ and $-x^2-3 x+2$.", + "Output Answer": [ + "$x^2+3 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**3-15*x**2-x+6, -x**2-3*x+2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^5+7 x^4-2 x^3-8 x^2+5$ when divided by $8 x^3-7 x^2+4 x-5$.", + "Output Answer": [ + "$\\frac{9 x^2}{8}+\\frac{119 x}{64}+\\frac{417}{512}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**5+7*x**4-2*x**3-8*x**2+5\nq = 8*x**3-7*x**2+4*x-5\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{(((3-17)-11)-17)-8}{(5-19)^2}$.", + "Output Answer": [ + "$-\\frac{25}{98}$" + ], + "Output Program": [ + "try: \n print((((((3-17)-11)-17)-8)/((5-19)**2)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{3} \\left(5 x^2+3 x+2\\right)$, $q(x) = \\sqrt{3} \\left(-3 x^2+6 x-2\\right)$", + "Output Answer": [ + "$2 \\sqrt{3} x^2+9 \\sqrt{3} x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(3)*(5*x**2+3*x+2)\nq = sqrt(3)*(-3*x**2+6*x-2)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((2+18)-15)+((((24+25)+18)-3)+12)$.", + "Output Answer": [ + "$81$" + ], + "Output Program": [ + "try: \n print(((2+18)-15)+((((24+25)+18)-3)+12))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11-15 x}+\\sqrt{12-5 x}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(-129+88 \\sqrt{2}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11-15*x)+sqrt(12-5*x), 8), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2+3 x+4 y^2+8 y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 (y+1)^2-6 \\left(x-\\frac{1}{4}\\right)^2=\\frac{13}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{4} & -1-\\frac{\\sqrt{\\frac{65}{6}}}{4} \\\\\n \\frac{1}{4} & \\frac{\\sqrt{\\frac{65}{6}}}{4}-1 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{3}}$\nCenter: $\\left\\{\\frac{1}{4},-1\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{8} \\left(\\sqrt{6}-8\\right)-\\sqrt{\\frac{3}{2}} x,y=\\sqrt{\\frac{3}{2}} x+\\frac{1}{8} \\left(-8-\\sqrt{6}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2+3*x+4*y**2+8*y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{13 x^3}{3}+\\frac{16 x^2}{3}+8 x+\\frac{10}{3}$ when divided by $\\frac{16 x^2}{3}+\\frac{29 x}{3}+\\frac{19}{3}$.", + "Output Answer": [ + "$\\frac{13 x}{16}-\\frac{121}{256}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((13*x**3)/3)+((16*x**2)/3)+8*x+(10/3)\nq = ((16*x**2)/3)+((29*x)/3)+(19/3)\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5-\\frac{7 x}{3}}+\\sqrt{\\frac{13}{3}-2 x}=\\frac{34}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-15022+204 \\sqrt{5395}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5-((7*x)/3))+sqrt((13/3)-2*x), (34/3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{5 x^2}{2}+\\frac{3 x}{2}-12$ and $q(x) = -9 x^2+12 x+14$", + "Output Answer": [ + "$-\\frac{45 x^4}{2}+\\frac{33 x^3}{2}+161 x^2-123 x-168$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((5*x**2)/2)+((3*x)/2)-12\nq = -9*x**2+12*x+14\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2+3 x+6 y^2-6 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y-\\frac{1}{2}\\right)^2-7 \\left(x-\\frac{3}{14}\\right)^2=\\frac{89}{28}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{14} & \\frac{1}{84} \\left(42-\\sqrt{6942}\\right) \\\\\n \\frac{3}{14} & \\frac{1}{84} \\left(42+\\sqrt{6942}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{13}{7}}$\nCenter: $\\left\\{\\frac{3}{14},\\frac{1}{2} \\left(\\frac{1}{84} \\left(42-\\sqrt{6942}\\right)+\\frac{1}{84} \\left(42+\\sqrt{6942}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{28} \\left(14+\\sqrt{42}\\right)-\\sqrt{\\frac{7}{6}} x,y=\\sqrt{\\frac{7}{6}} x+\\frac{1}{28} \\left(14-\\sqrt{42}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2+3*x+6*y**2-6*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -7 x^2-2 x+11$ and $q(x) = -7 x^2-4 x+14$", + "Output Answer": [ + "$49 x^4+42 x^3-167 x^2-72 x+154$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -7*x**2-2*x+11\nq = -7*x**2-4*x+14\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $11 x^2-12 x+1$", + "Output Answer": [ + "$11 \\left(x-\\frac{6}{11}\\right)^2-\\frac{25}{11}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (11*x**2-12*x+1), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x^4-10 x^3-8 x^2-15 x-20$ and $x^3+2 x^2+5$.", + "Output Answer": [ + "$x^3+2 x^2+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x**4-10*x**3-8*x**2-15*x-20, x**3+2*x**2+5))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-2 \\sqrt{2} x-\\frac{29 y}{\\sqrt{2}}+2 \\sqrt{2} z-\\frac{29}{\\sqrt{2}}=0$, $-\\sqrt{2} x-\\frac{19 y}{\\sqrt{2}}+8 \\sqrt{2} z-5 \\sqrt{2}=0$, $6 \\sqrt{2} x-15 \\sqrt{2} y+17 \\sqrt{2} z-4 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{7}{54}$, $y=-\\frac{29}{27}$, $z=-\\frac{2}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-2*sqrt(2)*x-((29*y)/(sqrt(2)))+2*sqrt(2)*z-(29/(sqrt(2))), -sqrt(2)*x-((19*y)/(sqrt(2)))+8*sqrt(2)*z-5*sqrt(2), 6*sqrt(2)*x-15*sqrt(2)*y+17*sqrt(2)*z-4*sqrt(2))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{((5-10)-9)-9}{\\left(\\left(\\frac{13}{9}-21\\right)^2-5\\right)+24}$.", + "Output Answer": [ + "$-\\frac{1863}{32515}$" + ], + "Output Program": [ + "try: \n print(((((5-10)-9)-9)/((((13/9)-21)**2-5)+24)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\left(\\cos \\left(\\frac{16}{15}\\right)+i \\sin \\left(\\frac{16}{15}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$16777216 \\left(\\cos \\left(\\frac{64}{5}\\right)+i \\sin \\left(\\frac{64}{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*(math.cos((16/15))+1j*math.sin((16/15))))**12)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 7 x+13| =21$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{34}{7}\\right\\},\\left\\{x\\to \\frac{8}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(7*x+13), 21), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{160 x^2}{3}-\\frac{529 x}{3}-\\frac{770}{3}}{\\frac{22}{3}-\\frac{5 x}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{35}{32}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((160*x**2)/3)-((529*x)/3)-(770/3))/((22/3)-((5*x)/3))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(1-14) ((6-4)-3)$.", + "Output Answer": [ + "$13$" + ], + "Output Program": [ + "try: \n print((1-14)*((6-4)-3))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=16 (18 t+29)^2, x(t)=-9 t-15$", + "Output Answer": [ + "$y=64 x^2+64 x+16$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 16*(18*t+29)**2\nx_t = -9*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9-\\frac{45 x}{4}}+\\sqrt{\\frac{27}{2}-2 x}=\\frac{29}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-45239+174 \\sqrt{42446}}{1369}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9-((45*x)/4))+sqrt((27/2)-2*x), (29/2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-5 x-8 y^2+y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x-\\frac{5}{12}\\right)^2-8 \\left(y-\\frac{1}{16}\\right)^2=\\frac{577}{96}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{48} \\left(20-\\sqrt{4039}\\right) & \\frac{1}{16} \\\\\n \\frac{1}{48} \\left(20+\\sqrt{4039}\\right) & \\frac{1}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{7}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{48} \\left(20-\\sqrt{4039}\\right)+\\frac{1}{48} \\left(20+\\sqrt{4039}\\right)\\right),\\frac{1}{16}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{3} x}{2}+\\frac{1}{48} \\left(3-10 \\sqrt{3}\\right),y=\\frac{1}{48} \\left(3+10 \\sqrt{3}\\right)-\\frac{\\sqrt{3} x}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-5*x-8*y**2+y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{x^2}{3}-\\frac{10 x}{3}-\\frac{16}{3}$", + "Output Answer": [ + "$x=5-\\sqrt{41}\\lor x=5+\\sqrt{41}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((x**2)/3)-((10*x)/3)-(16/3), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{2}, \\frac{1}{\\sqrt{3}}, 9)$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{\\frac{979}{3}}}{2},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{7}{3}}}{18}\\right),\\tan ^{-1}\\left(\\frac{2}{\\sqrt{3}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/2)\ny = (1/(math.sqrt(3)))\nz = 9\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $11 x^3+275 x^2-506 x-33440$", + "Output Answer": [ + "$11 (-x-19) (-x-16) (x-10)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(11*x**3+275*x**2-506*x-33440, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{3}{8} \\left(3 t^2-180 t+2710\\right), x(t)=\\frac{t^2}{4}-15 t+225$", + "Output Answer": [ + "$y=-\\frac{9 x}{2}-\\frac{15}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -(3/8)*(3*t**2-180*t+2710)\nx_t = ((t**2)/4)-15*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 17 x^2+12 x-5\\right| =8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{17} \\left(-6-\\sqrt{257}\\right)\\right\\},\\left\\{x\\to \\frac{1}{17} \\left(-6+\\sqrt{257}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(17*x**2+12*x-5), 8), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{15 x^3-207 x^2-281 x+165}{-5 x^2+70 x+75}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{15} \\left(-9-\\sqrt{246}\\right)\\right\\},\\left\\{x\\to \\frac{1}{15} \\left(-9+\\sqrt{246}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((15*x**3-207*x**2-281*x+165)/(-5*x**2+70*x+75)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(-9-8 i) \\log (2)$ and $y=(-10+12 i) \\log (2)$", + "Output Answer": [ + "$(186-28 i) \\log ^2(2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-9-8*i)*math.log10(2)\ny = (-10+12*i)*math.log10(2)\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8 x+15}+\\sqrt{9 x+11}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7060}{834+7 \\sqrt{14159}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8*x+15)+sqrt(9*x+11), 14), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $11 x^2+10 x+1$", + "Output Answer": [ + "$11 \\left(x+\\frac{5}{11}\\right)^2-\\frac{14}{11}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (11*x**2+10*x+1), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+9 x+y^2-5 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $7 \\left(x+\\frac{9}{14}\\right)^2+\\left(y-\\frac{5}{2}\\right)^2=\\frac{71}{7}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{9}{14} & \\frac{5}{2}-\\frac{\\sqrt{426}}{7} \\\\\n -\\frac{9}{14} & \\frac{5}{2}+\\frac{\\sqrt{426}}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{6}{7}}$\nCenter: $\\left\\{-\\frac{9}{14},\\frac{5}{2}\\right\\}$\nArea Enclosed: $\\frac{71 \\pi }{7 \\sqrt{7}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+9*x+y**2-5*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$13 x-19 y-14 z-20=0$, $-12 x-2 z-21=0$, $9 x+24 y+22 z-11=0$", + "Output Answer": [ + "$x=-\\frac{1550}{9}$, $y=-\\frac{7853}{9}$, $z=\\frac{6137}{6}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((13*x-19*y-14*z-20, -12*x-2*z-21, 9*x+24*y+22*z-11)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(7-4)-(21-12)$.", + "Output Answer": [ + "$-6$" + ], + "Output Program": [ + "try: \n print((7-4)-(21-12))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(10+12)^2 (((7-10)-24)-11)$.", + "Output Answer": [ + "$-18392$" + ], + "Output Program": [ + "try: \n print((10+12)**2*(((7-10)-24)-11))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x-4$ and $-2 x^3+2 x^2+4 x-4$.", + "Output Answer": [ + "$2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x-4, -2*x**3+2*x**2+4*x-4))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{48 x^2}{7}+\\frac{34 x}{7}-\\frac{19}{7}$", + "Output Answer": [ + "$x=\\frac{1}{48} \\left(-17-\\sqrt{1201}\\right)\\lor x=\\frac{1}{48} \\left(\\sqrt{1201}-17\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((48*x**2)/7)+((34*x)/7)-(19/7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $x^5+3 x^4-7 x^3-8 x^2-8$ when divided by $3 x^5-7 x^4-10 x^3-5 x^2-5 x+1$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**5+3*x**4-7*x**3-8*x**2-8\nq = 3*x**5-7*x**4-10*x**3-5*x**2-5*x+1\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8 x+5}+\\sqrt{12 x-2}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(306-11 \\sqrt{745}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8*x+5)+sqrt(12*x-2), 11), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{77 x^2}{4}+\\frac{13 x}{4}+\\frac{29}{2}}{24-\\frac{19 x}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{154} \\left(13-\\sqrt{18033}\\right)\\right\\},\\left\\{x\\to \\frac{1}{154} \\left(13+\\sqrt{18033}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((77*x**2)/4)+((13*x)/4)+(29/2))/(24-((19*x)/2))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4-4 x$ and $-5 x^5-3 x^4+4 x^3-5 x^2+3 x+1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4-4*x, -5*x**5-3*x**4+4*x**3-5*x**2+3*x+1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\sqrt{3} \\left(-6 t^2+108 t-487\\right), x(t)=3 t^2-54 t+243$", + "Output Answer": [ + "$y=-2 \\sqrt{3} x-\\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = sqrt(3)*(-6*t**2+108*t-487)\nx_t = 3*t**2-54*t+243\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{1}{2}$ and $y=-7-\\frac{i}{2}$", + "Output Answer": [ + "$\\frac{7}{2}+\\frac{i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = -(1/2)\ny = -7-(i/2)\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{15-12 x}+\\sqrt{-9 x-9}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-1348+28 \\sqrt{2271}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(15-12*x)+sqrt(-9*x-9), 14), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{(((24-11)+12)+16)-20}{(((4-9)-24)-14)-1}$.", + "Output Answer": [ + "$-\\frac{21}{44}$" + ], + "Output Program": [ + "try: \n print((((((24-11)+12)+16)-20)/((((4-9)-24)-14)-1)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{22 x^2}{7}-\\frac{75 x}{7}+\\frac{69}{7}$ and $q(x) = \\frac{93 x^2}{7}+\\frac{10 x}{7}+\\frac{73}{7}$", + "Output Answer": [ + "$-\\frac{2046 x^4}{49}-\\frac{7195 x^3}{49}+\\frac{4061 x^2}{49}-\\frac{4785 x}{49}+\\frac{5037}{49}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((22*x**2)/7)-((75*x)/7)+(69/7)\nq = ((93*x**2)/7)+((10*x)/7)+(73/7)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{46}{7}-\\frac{59 i}{7}$ and $y=\\frac{4}{7}+\\frac{54 i}{7}$", + "Output Answer": [ + "$\\frac{50}{7}-\\frac{5 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = (46/7)-((59*i)/7)\ny = (4/7)+((54*i)/7)\nprint(x+y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^3-3 x^2+10 x+1$ when divided by $6 x-9$.", + "Output Answer": [ + "$\\frac{4 x^2}{3}+\\frac{3 x}{2}+\\frac{47}{12}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**3-3*x**2+10*x+1\nq = 6*x-9\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=12 t-57, x(t)=3 t-15$", + "Output Answer": [ + "$y=4 x+3$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 12*t-57\nx_t = 3*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-8 t-123, x(t)=-t-15$", + "Output Answer": [ + "$y=8 x-3$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -8*t-123\nx_t = -t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{17}{9}$, and $a_n=a_{n-1}+7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$269$" + ], + "Output Program": [ + "a = (17/9) # initial value\nd = 7 # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (17/9) # initial value\nd = 7 # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{22 x^2}{3}-\\frac{7 x}{3}+5$", + "Output Answer": [ + "$\\frac{22}{3} \\left(x-\\frac{7}{44}\\right)^2+\\frac{1271}{264}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((22*x**2)/3)-((7*x)/3)+5), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-9 x-6 y-13=0$, $-2 x-13 y-19=0$", + "Output Answer": [ + "$x=-\\frac{11}{21}$, $y=-\\frac{29}{21}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-9*x-6*y-13, -2*x-13*y-19), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\left(4-\\frac{11 x}{3}\\right)^4 \\sqrt{5 x-3}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{5}\\right\\},\\left\\{x\\to \\frac{12}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve((4-((11*x)/3))**4*sqrt(5*x-3), x)\n print(soln)\nexcept: ...\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{625} (3265-473 t)^2, x(t)=\\frac{11 t}{5}-15$", + "Output Answer": [ + "$y=\\frac{1849 x^2}{25}-\\frac{688 x}{25}+\\frac{64}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/625)*(3265-473*t)**2\nx_t = ((11*t)/5)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 3 \\sqrt{5} x-9 \\sqrt{5}\\right| =5 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{4}{3}\\right\\},\\left\\{x\\to \\frac{14}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(3*sqrt(5)*x-9*sqrt(5)), 5*sqrt(5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=4+4 i$ and $y=-8+i$", + "Output Answer": [ + "$-\\frac{28}{65}-\\frac{36 i}{65}$" + ], + "Output Program": [ + "i = 1j\nx = 4+4*i\ny = -8+i\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^5-6 x^4+5 x^3-10 x^2+8 x-9$ when divided by $-5 x^5+8 x^4+4 x^3-7 x^2-2 x$.", + "Output Answer": [ + "$\\frac{7}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**5-6*x**4+5*x**3-10*x**2+8*x-9\nq = -5*x**5+8*x**4+4*x**3-7*x**2-2*x\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $4 \\sqrt{3} x^2+8 \\sqrt{3} x-5 \\sqrt{3}$", + "Output Answer": [ + "$x=-\\frac{5}{2}\\lor x=\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(4*sqrt(3)*x**2+8*sqrt(3)*x-5*sqrt(3), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt{8 x+7}$", + "Output Answer": [ + "$x\\geq -\\frac{7}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sqrt(8*x+7)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-4 \\sqrt{5} x-5 \\sqrt{5}=0$, $-5 \\sqrt{5} x-9 \\sqrt{5} y-10 \\sqrt{5}=0$", + "Output Answer": [ + "$x=-\\frac{5}{4}$, $y=-\\frac{5}{12}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-4*sqrt(5)*x-5*sqrt(5), -5*sqrt(5)*x-9*sqrt(5)*y-10*sqrt(5)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2-66 \\sqrt{2} x-702$", + "Output Answer": [ + "$-3 \\left(-x-13 \\sqrt{2}\\right) \\left(-x-9 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2-66*sqrt(2)*x-702, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 4 \\sqrt{5} x-9 \\sqrt{5}\\right| =5 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\{x\\to 1\\},\\left\\{x\\to \\frac{7}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(4*sqrt(5)*x-9*sqrt(5)), 5*sqrt(5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{11+11 i}{\\sqrt{3}}$ and $y=-\\frac{4-10 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{33}{58}+\\frac{77 i}{58}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((11+11*i)/(math.sqrt(3)))\ny = -((4-10*i)/(math.sqrt(3)))\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$23 x+3 y-14 z-10=0$, $-7 x-22 y-20 z+17=0$, $6 x+19 y+z-23=0$", + "Output Answer": [ + "$x=-\\frac{311}{7909}$, $y=\\frac{9885}{7909}$, $z=-\\frac{4042}{7909}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((23*x+3*y-14*z-10, -7*x-22*y-20*z+17, 6*x+19*y+z-23)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(\\cos \\left(\\frac{61}{45}\\right)+i \\sin \\left(\\frac{61}{45}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$4 \\left(\\cos \\left(\\frac{122}{45}\\right)+i \\sin \\left(\\frac{122}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(math.cos((61/45))+1j*math.sin((61/45))))**2)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 11-19 x| =11$", + "Output Answer": [ + "$\\left\\{\\{x\\to 0\\},\\left\\{x\\to \\frac{22}{19}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11-19*x), 11), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{47 x}{5}-\\frac{22}{5}}+\\sqrt{\\frac{23}{5}-7 x}=\\frac{53}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{360} \\left(-116519+53 \\sqrt{4731865}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((47*x)/5)-(22/5))+sqrt((23/5)-7*x), (53/5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{13 x^2}{4}+\\frac{11 x}{2}-13$", + "Output Answer": [ + "$x=\\frac{1}{13} \\left(11-i \\sqrt{555}\\right)\\lor x=\\frac{1}{13} \\left(11+i \\sqrt{555}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((13*x**2)/4)+((11*x)/2)-13, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{3}{2}+\\frac{7 i}{2}$ and $y=\\frac{19}{2}-4 i$", + "Output Answer": [ + "$-\\frac{113}{425}+\\frac{109 i}{425}$" + ], + "Output Program": [ + "i = 1j\nx = -(3/2)+((7*i)/2)\ny = (19/2)-4*i\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{127}+\\left(\\sqrt{53}-\\sqrt{26}\\right)$.", + "Output Answer": [ + "$-\\sqrt{26}+\\sqrt{53}+\\sqrt{127}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(127)+(sqrt(53)-sqrt(26)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sin (1-4 x)-e^{-8 x-4}$ at the point $x=-2$", + "Output Answer": [ + "$-e^{12}+\\sin (9) = -162754.$" + ], + "Output Program": [ + "import math\n\nx = -2\ntry: \n f = math.sin(1-4*x)-math.e**(-8*x-4)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(\\cos \\left(\\frac{13 \\pi }{90}\\right)+i \\sin \\left(\\frac{13 \\pi }{90}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$64 \\left(-\\cos \\left(\\frac{2 \\pi }{15}\\right)+i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(math.cos(((13*math.pi)/90))+1j*math.sin(((13*math.pi)/90))))**6)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-54 x^3+243 x^2+249 x-48}{21-126 x}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to -1\\},\\left\\{x\\to \\frac{16}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-54*x**3+243*x**2+249*x-48)/(21-126*x)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left((24+24)^2+4\\right)+14\\right) ((21-19)-20)$.", + "Output Answer": [ + "$-41796$" + ], + "Output Program": [ + "try: \n print((((24+24)**2+4)+14)*((21-19)-20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $4 x-9$ when divided by $1-7 x$.", + "Output Answer": [ + "$-\\frac{4}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x-9\nq = 1-7*x\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{-12 x^2+8 x-7}{e}$, $q(x) = \\frac{-27 x^2+2 x-30}{e}$", + "Output Answer": [ + "$-\\frac{39 x^2}{e}+\\frac{10 x}{e}-\\frac{37}{e}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x\n\np = ((-12*x**2+8*x-7)/math.e)\nq = ((-27*x**2+2*x-30)/math.e)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2-27 x+660$", + "Output Answer": [ + "$-3 (x-11) (x+20)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2-27*x+660, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{81}{625} (x+9)^4, q(x) = \\frac{1}{125} (27 x-1)^3$", + "Output Answer": [ + "$\\frac{81 x^4}{625}+\\frac{101331 x^3}{625}+\\frac{28431 x^2}{625}+\\frac{236601 x}{625}+\\frac{531436}{625}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (81/625)*(x+9)**4\nq = (1/125)*(27*x-1)**3\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-5 x^2-\\frac{27 x}{2}+\\frac{5}{2}$", + "Output Answer": [ + "$x=\\frac{1}{20} \\left(-27-\\sqrt{929}\\right)\\lor x=\\frac{1}{20} \\left(\\sqrt{929}-27\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-5*x**2-((27*x)/2)+(5/2), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{26 x}{7}-\\frac{36}{7}\\right| =4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{32}{13}\\right\\},\\left\\{x\\to -\\frac{4}{13}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((26*x)/7)-(36/7)), 4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt{\\frac{13 x}{3}+3} \\cos ^{-1}\\left(-\\frac{2 x}{3}-8\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{27}{2}\\right\\},\\left\\{x\\to -\\frac{9}{13}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(sqrt(((13*x)/3)+3)*acos(-((2*x)/3)-8), x)\n print(soln)\nexcept: ...\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$x-8 y+7 z-7=0$, $5 x-14 y-2 z+4=0$, $3 x-16 y-13 z+7=0$", + "Output Answer": [ + "$x=-\\frac{93}{49}$, $y=-\\frac{145}{294}$, $z=\\frac{104}{147}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((x-8*y+7*z-7, 5*x-14*y-2*z+4, 3*x-16*y-13*z+7)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^6-2 x^5-4 x^4+5 x^3-2 x+1$ and $2 x^5-4 x^3+x^2+x-1$.", + "Output Answer": [ + "$2 x^5-4 x^3+x^2+x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**6-2*x**5-4*x**4+5*x**3-2*x+1, 2*x**5-4*x**3+x**2+x-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{15 x}{4}+\\frac{49}{4}}+\\sqrt{\\frac{47 x}{4}+\\frac{19}{2}}=\\frac{23}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{512} \\left(16575-23 \\sqrt{428401}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((15*x)/4)+(49/4))+sqrt(((47*x)/4)+(19/2)), (23/2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{78}+\\left(\\sqrt{114}-65\\right)$.", + "Output Answer": [ + "$-65+\\sqrt{78}+\\sqrt{114}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(78)+(sqrt(114)-65))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-7 \\sqrt{3} x^2+2 \\sqrt{3} x+8 \\sqrt{3}$", + "Output Answer": [ + "$\\frac{57 \\sqrt{3}}{7}-7 \\sqrt{3} \\left(x-\\frac{1}{7}\\right)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-7*math.sqrt(3)*x**2+2*math.sqrt(3)*x+8*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{150 x^2-135 x-429}{60 x^2-222 x-390}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{11}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((150*x**2-135*x-429)/(60*x**2-222*x-390)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{18 x^4}{25}+\\frac{429 x^3}{25}+\\frac{192 x^2}{25}+24 x+\\frac{192}{25}$ and $\\frac{18 x^2}{5}+\\frac{3 x}{5}+\\frac{24}{5}$.", + "Output Answer": [ + "$\\frac{18 x^2}{25}+\\frac{3 x}{25}+\\frac{24}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((18*x**4)/25)+((429*x**3)/25)+((192*x**2)/25)+24*x+(192/25), ((18*x**2)/5)+((3*x)/5)+(24/5)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{81}{7}-\\frac{104 x}{7}}+\\sqrt{\\frac{100}{7}-\\frac{73 x}{7}}=\\frac{43}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-331396+86 \\sqrt{15011287}}{6727}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((81/7)-((104*x)/7))+sqrt((100/7)-((73*x)/7)), (43/7)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-10 \\sqrt{2} x^2-\\frac{13 x}{\\sqrt{2}}-\\frac{13}{\\sqrt{2}}$", + "Output Answer": [ + "$x=\\frac{1}{20} \\left(-\\frac{13}{2}+\\frac{i \\sqrt{871}}{2}\\right)\\lor x=\\frac{1}{20} \\left(-\\frac{13}{2}-\\frac{i \\sqrt{871}}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-10*sqrt(2)*x**2-((13*x)/(sqrt(2)))-(13/(sqrt(2))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sqrt[3]{2 x-6}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(y^3+6\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, cbrt(2*x-6))\nprint(solve(f, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{9}{5}-\\frac{48 x}{5}}+\\sqrt{\\frac{72}{5}-\\frac{14 x}{5}}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{578} \\left(-16571+100 \\sqrt{22461}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((9/5)-((48*x)/5))+sqrt((72/5)-((14*x)/5)), 10), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{2 x}{3}-\\frac{34 y}{3}-\\frac{73 z}{3}-11=0$, $-\\frac{55 x}{3}-\\frac{73 y}{3}+\\frac{73 z}{3}+\\frac{47}{3}=0$, $7 x+18 y-\\frac{13 z}{3}+\\frac{41}{3}=0$", + "Output Answer": [ + "$x=\\frac{85506}{16615}$, $y=-\\frac{43376}{16615}$, $z=\\frac{10349}{16615}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((2*x)/3)-((34*y)/3)-((73*z)/3)-11, -((55*x)/3)-((73*y)/3)+((73*z)/3)+(47/3), 7*x+18*y-((13*z)/3)+(41/3))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = x-10 x^2$ and $q(x) = 4 x^2-10 x+13$", + "Output Answer": [ + "$-40 x^4+104 x^3-140 x^2+13 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = x-10*x**2\nq = 4*x**2-10*x+13\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^3-6 x^2+5 x+7$ when divided by $9 x^4+8 x^2-7 x+8$.", + "Output Answer": [ + "$0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**3-6*x**2+5*x+7\nq = 9*x**4+8*x**2-7*x+8\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-5 \\left(-\\sin \\left(\\frac{17 \\pi }{180}\\right)+i \\cos \\left(\\frac{17 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $5 \\sqrt{\\sin ^2\\left(\\frac{17 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{17 \\pi }{180}\\right)}$\nArgument: $-\\frac{73 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -5*(-math.sin(((17*math.pi)/180))+i*math.cos(((17*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-24 x-2 y+7 z-7=0$, $12 x+25 y+19 z+18=0$, $21 x-25 y+5 z+20=0$", + "Output Answer": [ + "$x=-\\frac{1270}{2317}$, $y=\\frac{1207}{6951}$, $z=-\\frac{5767}{6951}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-24*x-2*y+7*z-7, 12*x+25*y+19*z+18, 21*x-25*y+5*z+20)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $6 x^2-13$", + "Output Answer": [ + "$x=\\sqrt{\\frac{13}{6}}\\lor x=-\\sqrt{\\frac{13}{6}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(6*x**2-13, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{16}{625} (120-7 t)^2, x(t)=\\frac{7 t}{5}-15$", + "Output Answer": [ + "$y=\\frac{16 x^2}{25}-\\frac{288 x}{25}+\\frac{1296}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (16/625)*(120-7*t)**2\nx_t = ((7*t)/5)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{22}{3} \\left(\\cos \\left(\\frac{91}{90}\\right)+i \\sin \\left(\\frac{91}{90}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$\\frac{12855002631049216 \\left(\\cos \\left(\\frac{182}{15}\\right)+i \\sin \\left(\\frac{182}{15}\\right)\\right)}{531441}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(22/3)*(math.cos((91/90))+1j*math.sin((91/90))))**12)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{51}{88}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$\\frac{2487}{44}$" + ], + "Output Program": [ + "a = -(51/88) # initial value\nd = 4 # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(51/88) # initial value\nd = 4 # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6-12 x}+\\sqrt{-8 x-12}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-481+28 \\sqrt{282}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6-12*x)+sqrt(-8*x-12), 14), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{1}{9} (((15+24)-16)-6)}{\\frac{10}{6}+6}$.", + "Output Answer": [ + "$\\frac{17}{69}$" + ], + "Output Program": [ + "try: \n print((((1/9)*(((15+24)-16)-6))/((10/6)+6)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{11 x^2}{\\sqrt{\\pi }}+\\frac{23 x}{\\sqrt{\\pi }}+\\frac{8}{\\sqrt{\\pi }}$ and $q(x) = -\\frac{6 x^2}{\\sqrt{\\pi }}-\\frac{6 x}{\\sqrt{\\pi }}-\\frac{7}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{66 x^4}{\\pi }-\\frac{204 x^3}{\\pi }-\\frac{263 x^2}{\\pi }-\\frac{209 x}{\\pi }-\\frac{56}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((11*x**2)/(sqrt(pi)))+((23*x)/(sqrt(pi)))+(8/(sqrt(pi)))\nq = -((6*x**2)/(sqrt(pi)))-((6*x)/(sqrt(pi)))-(7/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{x}{2}+\\frac{49 y}{2}-5 z+\\frac{11}{2}=0$, $-10 x+23 y-\\frac{31 z}{2}-\\frac{11}{2}=0$, $-\\frac{39 x}{2}-\\frac{41 y}{2}-\\frac{43 z}{2}+\\frac{23}{2}=0$", + "Output Answer": [ + "$x=-\\frac{29261}{1930}$, $y=\\frac{11543}{5790}$, $z=\\frac{35854}{2895}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-(x/2)+((49*y)/2)-5*z+(11/2), -10*x+23*y-((31*z)/2)-(11/2), -((39*x)/2)-((41*y)/2)-((43*z)/2)+(23/2))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10-9 x}+\\sqrt{14-6 x}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-249+28 \\sqrt{79}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10-9*x)+sqrt(14-6*x), 7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{119 x^4}{25}+\\frac{87 x^3}{25}-\\frac{309 x^2}{25}-\\frac{378 x}{25}+\\frac{432}{25}$ and $-\\frac{7 x^3}{5}-3 x^2-\\frac{3 x}{5}+\\frac{18}{5}$.", + "Output Answer": [ + "$\\frac{7 x^3}{25}+\\frac{3 x^2}{5}+\\frac{3 x}{25}-\\frac{18}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((119*x**4)/25)+((87*x**3)/25)-((309*x**2)/25)-((378*x)/25)+(432/25), -((7*x**3)/5)-3*x**2-((3*x)/5)+(18/5)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 \\sqrt{3} x^2+6 \\sqrt{3} x-3 \\sqrt{3}$ and $q(x) = -8 \\sqrt{3} x^2+7 \\sqrt{3} x-5 \\sqrt{3}$", + "Output Answer": [ + "$96 x^4-228 x^3+258 x^2-153 x+45$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*sqrt(3)*x**2+6*sqrt(3)*x-3*sqrt(3)\nq = -8*sqrt(3)*x**2+7*sqrt(3)*x-5*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{7}{2}$ and $x^5-4 x^4-\\frac{x^3}{2}+\\frac{5 x^2}{2}+4 x-1$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd((7/2), x**5-4*x**4-((x**3)/2)+((5*x**2)/2)+4*x-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2-2 x$ and $-5 x^4-3 x^3+3 x^2+3 x-4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2-2*x, -5*x**4-3*x**3+3*x**2+3*x-4))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\left(-18 x^2-19 x+1\\right) \\log (2)$, $q(x) = 2 \\left(-6 x^2+4 x+9\\right) \\log (2)$", + "Output Answer": [ + "$-30 x^2 \\log (2)-11 x \\log (2)+19 \\log (2)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (-18*x**2-19*x+1)*log(2)\nq = 2*(-6*x**2+4*x+9)*log(2)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-7$ and $y=6-10 i$", + "Output Answer": [ + "$-1-10 i$" + ], + "Output Program": [ + "i = 1j\nx = -7\ny = 6-10*i\nprint(x+y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\cos (8-5 x)$ at the point $x=-4$", + "Output Answer": [ + "$\\cos (28) = -0.963$" + ], + "Output Program": [ + "import math\n\nx = -4\ntry: \n f = math.cos(8-5*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $6 e^{-\\frac{5 i \\pi }{18}}$.", + "Output Answer": [ + "Norm: $6$\nArgument: $-\\frac{5 \\pi }{18}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 6*math.e**(-((5*i*math.pi)/18))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$\\sinh ^{-1}\\left(\\frac{14 x}{3}\\right)$", + "Output Answer": [ + "$\\frac{3 x}{14}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, asinh((14*x)/3))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{67}{95}$, and $a_n=a_{n-1}+\\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$4 \\left(\\frac{134}{95}+7 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (67/95) # initial value\nd = math.pi # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (67/95) # initial value\nd = math.pi # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{13}{7}-\\frac{52 i}{7}$ and $y=-7-\\frac{55 i}{7}$", + "Output Answer": [ + "$-\\frac{3497}{49}+\\frac{1833 i}{49}$" + ], + "Output Program": [ + "i = 1j\nx = (13/7)-((52*i)/7)\ny = -7-((55*i)/7)\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{47}{28}$, and $a_n=a_{n-1}+2 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$2 \\left(6 \\sqrt{5}-\\frac{47}{14}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(47/28) # initial value\nd = 2*math.sqrt(5) # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(47/28) # initial value\nd = 2*math.sqrt(5) # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=7$, and $a_n=a_{n-1}+-5 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$2 \\left(14-15 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\na = 7 # initial value\nd = -5*math.sqrt(3) # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 7 # initial value\nd = -5*math.sqrt(3) # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-2 x^3-40 x^2+46 x+1596$", + "Output Answer": [ + "$-2 (-x-7) (6-x) (x+19)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-2*x**3-40*x**2+46*x+1596, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2+4 x-126$", + "Output Answer": [ + "$-2 (7-x) (x+9)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2+4*x-126, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-15 x+12 y-1=0$, $2 x+4 y-11=0$", + "Output Answer": [ + "$x=\\frac{32}{21}$, $y=\\frac{167}{84}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-15*x+12*y-1, 2*x+4*y-11), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3$ and $x^3+\\frac{2 x^2}{3}-\\frac{14 x}{3}+\\frac{8}{3}$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3, x**3+((2*x**2)/3)-((14*x)/3)+(8/3)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2-11 x+26$", + "Output Answer": [ + "$(2-x) (x+13)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2-11*x+26, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{1}{22} \\left(\\left(\\frac{9}{13}+12\\right)-1\\right)}{25+13}$.", + "Output Answer": [ + "$\\frac{2}{143}$" + ], + "Output Program": [ + "try: \n print((((1/22)*(((9/13)+12)-1))/(25+13)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{15 x^2}{2}-\\frac{17 x}{2}+11$", + "Output Answer": [ + "$x=\\frac{1}{30} \\left(-17-\\sqrt{1609}\\right)\\lor x=\\frac{1}{30} \\left(\\sqrt{1609}-17\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((15*x**2)/2)-((17*x)/2)+11, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-10 x-5}+\\sqrt{12-6 x}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-341+9 \\sqrt{1365}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-10*x-5)+sqrt(12-6*x), 9), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x+5$ and $-x^2-4 x+2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x+5, -x**2-4*x+2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=e^{x+4}+\\tan (2-5 x)$ at the point $x=7$", + "Output Answer": [ + "$e^{11}-\\tan (33) = 59949.5$" + ], + "Output Program": [ + "import math\n\nx = 7\ntry: \n f = math.e**(x+4)+math.tan(2-5*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-2 x-3 y^2+7 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-2 x-3 y^2+7 y=-8$\nVertex: $\\left\\{\\frac{145}{24},\\frac{7}{6}\\right\\}$\nDirectrix: $x=\\frac{149}{24}$\nFocal Parameter: $\\frac{1}{3}$\nFocus: $\\left\\{\\frac{47}{8},\\frac{7}{6}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x-3*y**2+7*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $10 x^6+4 x^5-5 x^4+3 x^2+4 x-8$ when divided by $7 x^3-4 x^2+6 x-7$.", + "Output Answer": [ + "$\\frac{10 x^3}{7}+\\frac{68 x^2}{49}-\\frac{393 x}{343}-\\frac{998}{2401}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x**6+4*x**5-5*x**4+3*x**2+4*x-8\nq = 7*x**3-4*x**2+6*x-7\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\log \\left(-\\sin ^{-1}\\left(8-5 x^2\\right)\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\sqrt{\\frac{1}{5} (8+\\sin (1))}\\right\\},\\left\\{x\\to \\sqrt{\\frac{1}{5} (8+\\sin (1))}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(log(-asin(8-5*x**2)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{72}{37}$, and $a_n=a_{n-1}+3 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$13 \\left(75 \\pi -\\frac{144}{37}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(72/37) # initial value\nd = 3*math.pi # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(72/37) # initial value\nd = 3*math.pi # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{5} \\left(-5 x^2+x-4\\right)$, $q(x) = \\sqrt{5} \\left(3 x^2-3 x-1\\right)$", + "Output Answer": [ + "$-2 \\sqrt{5} x^2-2 \\sqrt{5} x-5 \\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(5)*(-5*x**2+x-4)\nq = sqrt(5)*(3*x**2-3*x-1)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^6-3 x^5+8 x^4-6 x^3-x^2+2 x-2$ when divided by $3 x^4-4 x^3+2 x^2+3 x-5$.", + "Output Answer": [ + "$\\frac{5 x^2}{3}+\\frac{11 x}{9}+\\frac{86}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**6-3*x**5+8*x**4-6*x**3-x**2+2*x-2\nq = 3*x**4-4*x**3+2*x**2+3*x-5\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(3+3 i) \\sqrt{3}$ and $y=(1-3 i) \\sqrt{3}$", + "Output Answer": [ + "$4 \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (3+3*i)*math.sqrt(3)\ny = (1-3*i)*math.sqrt(3)\nprint(x+y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2+3 x+154$", + "Output Answer": [ + "$(14-x) (x+11)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2+3*x+154, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $10 x^5+18 x^4+16 x^3+21 x^2-5 x$ and $-2 x^4-4 x^3-4 x^2-5 x$.", + "Output Answer": [ + "$2 x^4+4 x^3+4 x^2+5 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(10*x**5+18*x**4+16*x**3+21*x**2-5*x, -2*x**4-4*x**3-4*x**2-5*x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-10 x^3-7 x^2+6 x-5$ when divided by $9 x^3-9 x^2-6 x$.", + "Output Answer": [ + "$-\\frac{10}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -10*x**3-7*x**2+6*x-5\nq = 9*x**3-9*x**2-6*x\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-3 \\left(8 t+\\sqrt{3}-18\\right), x(t)=4 \\sqrt{3} t-9 \\sqrt{3}$", + "Output Answer": [ + "$y=-2 \\sqrt{3} x-3 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -3*(8*t+sqrt(3)-18)\nx_t = 4*sqrt(3)*t-9*sqrt(3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{14}{12}+(6-8)$.", + "Output Answer": [ + "$-\\frac{5}{6}$" + ], + "Output Program": [ + "try: \n print((14/12)+(6-8))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{2 x^2}{3}-\\frac{x}{3}-3$ and $-\\frac{11 x}{3}-\\frac{5}{3}$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((2*x**2)/3)-(x/3)-3, -((11*x)/3)-(5/3)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{31}{32}$, and $a_n=a_{n-1}+2 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{27}{2} \\left(52 \\sqrt{3}-\\frac{31}{16}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(31/32) # initial value\nd = 2*math.sqrt(3) # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(31/32) # initial value\nd = 2*math.sqrt(3) # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{75 t^2}{2}-225 t-344, x(t)=25 t^2+150 t+225$", + "Output Answer": [ + "$y=-\\frac{3 x}{2}-\\frac{13}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -((75*t**2)/2)-225*t-344\nx_t = 25*t**2+150*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{22 x^2-15 x+3}{5 x^2+6 x-4}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((22*x**2-15*x+3)/(5*x**2+6*x-4)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{18 x}{5}+9}+\\sqrt{\\frac{47 x}{5}+\\frac{1}{5}}=\\frac{17}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{25165-102 \\sqrt{60951}}{4205}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((18*x)/5)+9)+sqrt(((47*x)/5)+(1/5)), (17/5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $9 x^2+180 x+891$", + "Output Answer": [ + "$9 (-x-11) (-x-9)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(9*x**2+180*x+891, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-5 x^2-8 x-11$", + "Output Answer": [ + "$-5 \\left(x+\\frac{4}{5}\\right)^2-\\frac{39}{5}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-5*x**2-8*x-11), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{16} (11 x+8)^2, q(x) = \\frac{81}{16} (5 x+4)^4$", + "Output Answer": [ + "$\\frac{50625 x^4}{16}+10125 x^3+\\frac{194521 x^2}{16}+6491 x+1300$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/16)*(11*x+8)**2\nq = (81/16)*(5*x+4)**4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 1-9 x| =-7$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(1-9*x), -7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 \\left(160 t^2+600 t+561\\right)^2, x(t)=64 t^2+240 t+225$", + "Output Answer": [ + "$y=25 x^2-30 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*(160*t**2+600*t+561)**2\nx_t = 64*t**2+240*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x-3}+\\sqrt{13 x+10}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{32} \\left(389-7 \\sqrt{2473}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x-3)+sqrt(13*x+10), 7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2+48 \\sqrt{2} x-3078$", + "Output Answer": [ + "$-12 \\left(-x-\\frac{27}{\\sqrt{2}}\\right) \\left(x-\\frac{19}{\\sqrt{2}}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2+48*sqrt(2)*x-3078, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 x^2+4 x+15$ and $q(x) = -6 x^2-14 x+7$", + "Output Answer": [ + "$-12 x^4-52 x^3-132 x^2-182 x+105$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*x**2+4*x+15\nq = -6*x**2-14*x+7\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{\\sqrt{169}}+\\left(\\sqrt{86}-46\\right)$.", + "Output Answer": [ + "$-46+\\sqrt{13}+\\sqrt{86}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(sqrt(169))+(sqrt(86)-46))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 15 x^2-9 x+6$ and $q(x) = -2 x^2+13 x+14$", + "Output Answer": [ + "$-30 x^4+213 x^3+81 x^2-48 x+84$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 15*x**2-9*x+6\nq = -2*x**2+13*x+14\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-5 x-1$ and $-2 x^5+2 x^4-2 x^3+2 x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-5*x-1, -2*x**5+2*x**4-2*x**3+2*x-3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{7} \\left(57 x^2-81 x-88\\right)$, $q(x) = \\frac{1}{7} \\left(96 x^2-97 x+62\\right)$", + "Output Answer": [ + "$\\frac{153 x^2}{7}-\\frac{178 x}{7}-\\frac{26}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/7)*(57*x**2-81*x-88)\nq = (1/7)*(96*x**2-97*x+62)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{1}{5}+\\frac{38 i}{5}$.", + "Output Answer": [ + "Norm: $\\frac{17}{\\sqrt{5}}$\nArgument: $\\pi -\\tan ^{-1}(38)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(1/5)+((38*i)/5)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2-\\frac{1584 x}{7}+\\frac{50149}{49}$", + "Output Answer": [ + "$11 \\left(\\frac{47}{7}-x\\right) \\left(\\frac{97}{7}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2-((1584*x)/7)+(50149/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-16 x+4 y-11=0$, $-11 x+20 y+24=0$", + "Output Answer": [ + "$x=-\\frac{79}{69}$, $y=-\\frac{505}{276}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-16*x+4*y-11, -11*x+20*y+24), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 9 x+18| =-14$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(9*x+18), -14), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-5 \\left(\\sin \\left(\\frac{\\pi }{36}\\right)-i \\cos \\left(\\frac{\\pi }{36}\\right)\\right)$.", + "Output Answer": [ + "Norm: $5 \\sqrt{\\sin ^2\\left(\\frac{\\pi }{36}\\right)+\\cos ^2\\left(\\frac{\\pi }{36}\\right)}$\nArgument: $\\frac{19 \\pi }{36}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -5*(math.sin((math.pi/36))-i*math.cos((math.pi/36)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-5 x+4 y^2-8 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Circle\nEquation: $4 \\left(x-\\frac{5}{8}\\right)^2+4 (y-1)^2=\\frac{233}{16}$\nRadius: $\\frac{\\sqrt{233}}{8}$\nCircumference: $\\frac{\\sqrt{233} \\pi }{4}$\nCenter: $\\left\\{\\frac{5}{8},1\\right\\}$\nArea Enclosed: $\\frac{233 \\pi }{64}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-5*x+4*y**2-8*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-10 \\sqrt{2} x^2-\\frac{x}{\\sqrt{2}}+6 \\sqrt{2}$", + "Output Answer": [ + "$x=-\\frac{4}{5}\\lor x=\\frac{3}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-10*sqrt(2)*x**2-(x/(sqrt(2)))+6*sqrt(2), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{5 e^{-\\frac{113 i \\pi }{180}}}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\frac{5}{\\sqrt{3}}$\nArgument: $-\\frac{113 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((5*math.e**(-((113*i*math.pi)/180)))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $3 \\sqrt{3} | x| =2 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{2}{3}\\right\\},\\left\\{x\\to \\frac{2}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(3*sqrt(3)*abs(x), 2*sqrt(3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{x^2}{\\sqrt{2}}-\\frac{33 x}{\\sqrt{2}}-\\frac{1}{\\sqrt{2}}}{\\frac{7 x^2}{\\sqrt{2}}+13 \\sqrt{2} x+\\frac{23}{\\sqrt{2}}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-33-\\sqrt{1085}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(-33+\\sqrt{1085}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((x**2)/(sqrt(2)))-((33*x)/(sqrt(2)))-(1/(sqrt(2))))/(((7*x**2)/(sqrt(2)))+13*sqrt(2)*x+(23/(sqrt(2))))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $1$ and $2 x^2-x+4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(1, 2*x**2-x+4))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $6 x^2+6 x-8$", + "Output Answer": [ + "$6 \\left(x+\\frac{1}{2}\\right)^2-\\frac{19}{2}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (6*x**2+6*x-8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 x^2+5 x+1$ and $q(x) = 11 x^2+2 x+12$", + "Output Answer": [ + "$-44 x^4+47 x^3-27 x^2+62 x+12$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*x**2+5*x+1\nq = 11*x**2+2*x+12\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-8 x-9}+\\sqrt{10-2 x}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(-259+8 \\sqrt{723}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-8*x-9)+sqrt(10-2*x), 12), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2-3 x-5 y^2-10 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(x-\\frac{3}{4}\\right)^2-5 (y+1)^2=\\frac{1}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{4}-\\frac{\\sqrt{\\frac{7}{5}}}{4} & -1 \\\\\n \\frac{1}{20} \\left(15+\\sqrt{35}\\right) & -1 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{3}{4}-\\frac{\\sqrt{\\frac{7}{5}}}{4}+\\frac{1}{20} \\left(15+\\sqrt{35}\\right)\\right),-1\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{2}{5}} x+\\frac{1}{20} \\left(-20-3 \\sqrt{10}\\right),y=\\frac{1}{20} \\left(3 \\sqrt{10}-20\\right)-\\sqrt{\\frac{2}{5}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2-3*x-5*y**2-10*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $14 x^2-6 x$", + "Output Answer": [ + "$x=0\\lor x=\\frac{3}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(14*x**2-6*x, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-273 x^2-390 x}{-546 x^2-351 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{10}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-273*x**2-390*x)/(-546*x**2-351*x)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -12 x^2-15 x-2$, $q(x) = 13 x^2+5 x-4$", + "Output Answer": [ + "$x^2-10 x-6$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -12*x**2-15*x-2\nq = 13*x**2+5*x-4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 \\sqrt{2} x^2+\\frac{11 x}{\\sqrt{2}}+\\frac{19}{\\sqrt{2}}$", + "Output Answer": [ + "$\\frac{577}{24 \\sqrt{2}}-3 \\sqrt{2} \\left(x-\\frac{11}{12}\\right)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*math.sqrt(2)*x**2+((11*x)/(math.sqrt(2)))+(19/(math.sqrt(2)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -8 (2 x+3)^3, q(x) = -8 x^3$", + "Output Answer": [ + "$-72 x^3-288 x^2-432 x-216$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*(2*x+3)**3\nq = -8*x**3\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{60}{19}$, and $a_n=a_{n-1}+-9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$-\\frac{3171}{19}$" + ], + "Output Program": [ + "a = (60/19) # initial value\nd = -9 # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (60/19) # initial value\nd = -9 # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\log (7 x+3)$", + "Output Answer": [ + "$x>-\\frac{3}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = log(7*x+3)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-7 x^2-2 x-8$", + "Output Answer": [ + "$-7 \\left(x+\\frac{1}{7}\\right)^2-\\frac{55}{7}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-7*x**2-2*x-8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^3+2 x^2-5 x-5$ when divided by $7-4 x$.", + "Output Answer": [ + "$-\\frac{x^2}{2}-\\frac{11 x}{8}-\\frac{37}{32}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**3+2*x**2-5*x-5\nq = 7-4*x\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{15 x^5}{2}+3 x^4+9 x^3-\\frac{11 x^2}{2}-4 x-\\frac{13}{2}$ when divided by $-x^2-\\frac{x}{2}+\\frac{1}{2}$.", + "Output Answer": [ + "$\\frac{15 x^3}{2}-\\frac{27 x^2}{4}-\\frac{15 x}{8}+\\frac{49}{16}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((15*x**5)/2)+3*x**4+9*x**3-((11*x**2)/2)-4*x-(13/2)\nq = -x**2-(x/2)+(1/2)\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-63 x^3+31 x^2+345 x+95}{114-42 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-10-\\sqrt{55}\\right)\\right\\},\\left\\{x\\to \\frac{1}{9} \\left(-10+\\sqrt{55}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-63*x**3+31*x**2+345*x+95)/(114-42*x)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{(20+2)+14}{\\frac{22}{6}-12}$.", + "Output Answer": [ + "$-\\frac{108}{25}$" + ], + "Output Program": [ + "try: \n print((((20+2)+14)/((22/6)-12)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{5}{78}$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$\\frac{133285}{78}$" + ], + "Output Program": [ + "a = -(5/78) # initial value\nd = 10 # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(5/78) # initial value\nd = 10 # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{77}{3}$, and $a_n=a_{n-1}+-4 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$\\frac{21}{2} \\left(\\frac{154}{3}-80 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (77/3) # initial value\nd = -4*math.sqrt(2) # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (77/3) # initial value\nd = -4*math.sqrt(2) # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{25}{27}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$\\frac{500}{27}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (25/27) # initial value\nd = 0 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (25/27) # initial value\nd = 0 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{39}{7}-\\frac{39 i}{7}$ and $y=\\frac{24}{7}-\\frac{62 i}{7}$", + "Output Answer": [ + "$-9+\\frac{23 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = -(39/7)-((39*i)/7)\ny = (24/7)-((62*i)/7)\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-8 x^2-14 x+10$", + "Output Answer": [ + "$x=\\frac{1}{8} \\left(-7-\\sqrt{129}\\right)\\lor x=\\frac{1}{8} \\left(\\sqrt{129}-7\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-8*x**2-14*x+10, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2+\\frac{160 x}{\\sqrt{3}}-136$", + "Output Answer": [ + "$8 \\left(\\sqrt{3}-x\\right) \\left(x-\\frac{17}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2+((160*x)/(sqrt(3)))-136, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{9 x^2}{2}+3 x-2$ and $-3 x^4-2 x^3+\\frac{9 x^2}{2}+4 x+\\frac{7}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((9*x**2)/2)+3*x-2, -3*x**4-2*x**3+((9*x**2)/2)+4*x+(7/2)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 5 x^2+8 x-2\\right| =22$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{5} \\left(-2-\\sqrt{34}\\right)\\right\\},\\left\\{x\\to \\frac{2}{5} \\left(-2+\\sqrt{34}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(5*x**2+8*x-2), 22), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{14 y}{3}+\\frac{7 z}{3}-\\frac{58}{3}=0$, $\\frac{59 x}{3}+\\frac{31 y}{3}+\\frac{71 z}{3}-22=0$, $15 x-y+\\frac{28 z}{3}-16=0$", + "Output Answer": [ + "$x=-\\frac{14528}{16303}$, $y=-\\frac{44264}{16303}$, $z=\\frac{46554}{16303}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((14*y)/3)+((7*z)/3)-(58/3), ((59*x)/3)+((31*y)/3)+((71*z)/3)-22, 15*x-y+((28*z)/3)-16)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-14 x^2+\\frac{23 x}{3}-9$", + "Output Answer": [ + "$x=\\frac{1}{84} \\left(23-i \\sqrt{4007}\\right)\\lor x=\\frac{1}{84} \\left(23+i \\sqrt{4007}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-14*x**2+((23*x)/3)-9, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $4 \\sqrt{2} x-\\sqrt{2} x^2$", + "Output Answer": [ + "$x=4\\lor x=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(4*sqrt(2)*x-sqrt(2)*x**2, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{198 x^4}{25}+\\frac{317 x^3}{25}+\\frac{4 x^2}{25}-\\frac{552 x}{25}+\\frac{69}{25}$ and $\\frac{22 x^2}{5}+\\frac{21 x}{5}-\\frac{3}{5}$.", + "Output Answer": [ + "$\\frac{22 x^2}{25}+\\frac{21 x}{25}-\\frac{3}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((198*x**4)/25)+((317*x**3)/25)+((4*x**2)/25)-((552*x)/25)+(69/25), ((22*x**2)/5)+((21*x)/5)-(3/5)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\frac{\\log (4 x+8)}{(5-8 x)^4}$", + "Output Answer": [ + "$-2\\frac{5}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = ((log(4*x+8))/((5-8*x)**4))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{91}{93}$, and $a_n=a_{n-1}+-5$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$-\\frac{42052}{31}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (91/93) # initial value\nd = -5 # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (91/93) # initial value\nd = -5 # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 11 \\sqrt{3} x^2+12 \\sqrt{3} x+3 \\sqrt{3}\\right| =14 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{11} \\left(-6-\\sqrt{157}\\right)\\right\\},\\left\\{x\\to \\frac{1}{11} \\left(-6+\\sqrt{157}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11*sqrt(3)*x**2+12*sqrt(3)*x+3*sqrt(3)), 14*sqrt(3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-13 \\sqrt{2} x-4 \\sqrt{2} y+13 \\sqrt{2}=0$, $16 \\sqrt{2} x-\\sqrt{2} y-7 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{41}{77}$, $y=\\frac{117}{77}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-13*sqrt(2)*x-4*sqrt(2)*y+13*sqrt(2), 16*sqrt(2)*x-sqrt(2)*y-7*sqrt(2)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (5, \\frac{1}{3}, \\frac{1}{\\sqrt{5}})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{\\frac{1139}{5}}}{3},\\tan ^{-1}\\left(\\frac{\\sqrt{1130}}{3}\\right),\\tan ^{-1}\\left(\\frac{1}{15}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 5\ny = (1/3)\nz = (1/(math.sqrt(5)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the eighth order series of the inverse of the following function around 8:\n$\\frac{3 x}{2}$", + "Output Answer": [ + "$\\frac{2 (x+6)}{3}-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, ((3*x)/2))\nprint(solve(f, x)[0].series(y, 8, 6))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -6 x^2+3 x-5$, $q(x) = 11 x^2+3 x+10$", + "Output Answer": [ + "$5 x^2+6 x+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**2+3*x-5\nq = 11*x**2+3*x+10\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $11 x^3+165 x^2-572 x-11616$", + "Output Answer": [ + "$-11 (-x-12) (-x-11) (8-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(11*x**3+165*x**2-572*x-11616, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-8 x^2-\\frac{28 x}{3}+\\frac{32}{3}$", + "Output Answer": [ + "$\\frac{241}{18}-8 \\left(x+\\frac{7}{12}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-8*x**2-((28*x)/3)+(32/3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2 \\sqrt{5} \\left(-\\sin \\left(\\frac{41 \\pi }{180}\\right)+i \\cos \\left(\\frac{41 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $2 \\sqrt{5 \\left(\\sin ^2\\left(\\frac{41 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{41 \\pi }{180}\\right)\\right)}$\nArgument: $\\frac{131 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2*math.sqrt(5)*(-math.sin(((41*math.pi)/180))+i*math.cos(((41*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{13 x^2}{2}-\\frac{59 x}{4}-7$", + "Output Answer": [ + "$\\frac{569}{416}-\\frac{13}{2} \\left(x+\\frac{59}{52}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((13*x**2)/2)-((59*x)/4)-7), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{46}{5} \\left(\\cos \\left(\\frac{31}{18}\\right)+i \\sin \\left(\\frac{31}{18}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-\\frac{435817657216 \\left(\\cos \\left(\\frac{217}{18}\\right)+i \\sin \\left(\\frac{217}{18}\\right)\\right)}{78125}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(46/5)*(math.cos((31/18))+1j*math.sin((31/18))))**7)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sin (3-8 x) \\cos ^{-1}\\left(\\sqrt[3]{x^3}\\right)$", + "Output Answer": [ + "$-1\\leq x\\leq 1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sin(3-8*x)*acos(cbrt(x**3))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2+21 x+294$", + "Output Answer": [ + "$-3 (x-14) (x+7)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2+21*x+294, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\frac{15}{21}-12\\right)^2+9\\right)-((((23-17)+8)-16)+15)$.", + "Output Answer": [ + "$\\frac{6045}{49}$" + ], + "Output Program": [ + "try: \n print((((15/21)-12)**2+9)-((((23-17)+8)-16)+15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{112} \\left(\\sqrt{146}+\\sqrt{37}\\right)$.", + "Output Answer": [ + "$4 \\left(\\sqrt{259}+\\sqrt{1022}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(112)*(sqrt(146)+sqrt(37)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-100 x^3+\\frac{2048 x^2}{9}-220 x+168}{-118 x^2+\\frac{2048 x}{9}-\\frac{616}{9}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-100*x**3+((2048*x**2)/9)-220*x+168)/(-118*x**2+((2048*x)/9)-(616/9))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $20 x-10$ and $-5$.", + "Output Answer": [ + "$5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(20*x-10, -5))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $x^4+5 x^3-5 x^2-2$ when divided by $-5 x^4+x^3+x^2+9 x-5$.", + "Output Answer": [ + "$-\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**4+5*x**3-5*x**2-2\nq = -5*x**4+x**3+x**2+9*x-5\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{1}{5} \\left((25+17)^2-10\\right)\\right) \\left(\\left(\\left(\\frac{17}{9}+12\\right)-23\\right)+1\\right)$.", + "Output Answer": [ + "$-\\frac{128042}{45}$" + ], + "Output Program": [ + "try: \n print(((1/5)*((25+17)**2-10))*((((17/9)+12)-23)+1))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{1-10 x}+\\sqrt{6-10 x}=\\frac{27}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{491017}{116640}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(1-10*x)+sqrt(6-10*x), (27/2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 7 \\sqrt{3} x-\\frac{11}{\\sqrt{3}}\\right| =\\frac{41}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{10}{7}\\right\\},\\left\\{x\\to \\frac{52}{21}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(7*sqrt(3)*x-(11/(sqrt(3)))), (41/(sqrt(3)))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=3 \\left(60 t^2+300 t+373\\right), x(t)=36 t^2+180 t+225$", + "Output Answer": [ + "$y=5 x-6$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 3*(60*t**2+300*t+373)\nx_t = 36*t**2+180*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\left(\\cos \\left(\\frac{163}{90}\\right)+i \\sin \\left(\\frac{163}{90}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1048576 \\left(\\cos \\left(\\frac{163}{9}\\right)+i \\sin \\left(\\frac{163}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*(math.cos((163/90))+1j*math.sin((163/90))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{15-8 i}{\\sqrt{\\pi }}$ and $y=\\frac{10+16 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{25+8 i}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((15-8*i)/(math.sqrt(math.pi)))\ny = ((10+16*i)/(math.sqrt(math.pi)))\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-5 \\left(\\cos \\left(\\frac{121}{90}\\right)+i \\sin \\left(\\frac{121}{90}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-1953125 \\left(\\cos \\left(\\frac{121}{10}\\right)+i \\sin \\left(\\frac{121}{10}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-5*(math.cos((121/90))+1j*math.sin((121/90))))**9)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -4 x^2-13 x-18\\right| =16$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(-13-\\sqrt{137}\\right)\\right\\},\\left\\{x\\to \\frac{1}{8} \\left(-13+\\sqrt{137}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-4*x**2-13*x-18), 16), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{5 x^6}{3}+\\frac{x^5}{3}+\\frac{25 x^4}{3}+\\frac{11 x^3}{3}+\\frac{5 x^2}{3}+\\frac{5 x}{3}+\\frac{16}{3}$ when divided by $-\\frac{5}{3}$.", + "Output Answer": [ + "$-x^6-\\frac{x^5}{5}-5 x^4-\\frac{11 x^3}{5}-x^2-x-\\frac{16}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((5*x**6)/3)+((x**5)/3)+((25*x**4)/3)+((11*x**3)/3)+((5*x**2)/3)+((5*x)/3)+(16/3)\nq = -(5/3)\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{62}{85}$, and $a_n=a_{n-1}+-\\frac{7}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$9 \\left(\\frac{124}{85}-\\frac{119}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\na = (62/85) # initial value\nd = -(7/(math.sqrt(3))) # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (62/85) # initial value\nd = -(7/(math.sqrt(3))) # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-8 x^2-2 x-8$", + "Output Answer": [ + "$-8 \\left(x+\\frac{1}{8}\\right)^2-\\frac{63}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-8*x**2-2*x-8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{4 x^2}{3}+\\frac{40 x}{3}+2$ and $q(x) = -\\frac{13 x^2}{3}+\\frac{16 x}{3}-3$", + "Output Answer": [ + "$-\\frac{52 x^4}{9}-\\frac{152 x^3}{3}+\\frac{526 x^2}{9}-\\frac{88 x}{3}-6$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((4*x**2)/3)+((40*x)/3)+2\nq = -((13*x**2)/3)+((16*x)/3)-3\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $6 x^2-132 x+510$", + "Output Answer": [ + "$6 (5-x) (17-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(6*x**2-132*x+510, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2+8 x+y^2-2 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x+\\frac{2}{5}\\right)^2+(y-1)^2=\\frac{33}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{5} & 1-\\frac{3 \\sqrt{\\frac{33}{2}}}{5} \\\\\n -\\frac{2}{5} & 1+\\frac{3 \\sqrt{\\frac{33}{2}}}{5} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{10}}$\nCenter: $\\left\\{-\\frac{2}{5},1\\right\\}$\nArea Enclosed: $\\frac{33 \\pi }{5 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2+8*x+y**2-2*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$4 x+6 y-21 z+6=0$, $-x+17 y+22 z-14=0$, $24 x-4 y-12 z-5=0$", + "Output Answer": [ + "$x=\\frac{5325}{11116}$, $y=\\frac{2953}{11116}$, $z=\\frac{2517}{5558}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((4*x+6*y-21*z+6, -x+17*y+22*z-14, 24*x-4*y-12*z-5)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -13 x^2-11 x-11$ and $q(x) = -14 x^2+x+14$", + "Output Answer": [ + "$182 x^4+141 x^3-39 x^2-165 x-154$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -13*x**2-11*x-11\nq = -14*x**2+x+14\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{13 x^2}{\\sqrt{3}}-4 \\sqrt{3} x+\\frac{8}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{2}{13} \\left(3-i \\sqrt{17}\\right)\\lor x=\\frac{2}{13} \\left(3+i \\sqrt{17}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((13*x**2)/(sqrt(3)))-4*sqrt(3)*x+(8/(sqrt(3))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{98 x^4}{25}-\\frac{77 x^3}{25}-\\frac{91 x^2}{25}+\\frac{77 x}{25}-\\frac{112}{25}$ and $\\frac{14 x^4}{5}+\\frac{11 x^3}{5}+\\frac{13 x^2}{5}-\\frac{11 x}{5}+\\frac{16}{5}$.", + "Output Answer": [ + "$\\frac{14 x^4}{25}+\\frac{11 x^3}{25}+\\frac{13 x^2}{25}-\\frac{11 x}{25}+\\frac{16}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((98*x**4)/25)-((77*x**3)/25)-((91*x**2)/25)+((77*x)/25)-(112/25), ((14*x**4)/5)+((11*x**3)/5)+((13*x**2)/5)-((11*x)/5)+(16/5)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$e^{6 x-4}$", + "Output Answer": [ + "$y>0$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(math.e**(6*x-4), x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{11 x}{3}+\\frac{13}{3}$ and $\\frac{2}{3}-\\frac{5 x}{3}$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((11*x)/3)+(13/3), (2/3)-((5*x)/3)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{167} \\sqrt{121}$.", + "Output Answer": [ + "$11 \\sqrt{167}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(167)*sqrt(121))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-288 x^3-84 x^2+465 x+171}{456 x+171}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{24} \\left(1-\\sqrt{913}\\right)\\right\\},\\left\\{x\\to \\frac{1}{24} \\left(1+\\sqrt{913}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-288*x**3-84*x**2+465*x+171)/(456*x+171)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x^7-5 x^6+4 x^5-x^4-7 x^3+3 x^2-x-3$ and $x^5-4 x^4-x^3+2 x^2-4 x-3$.", + "Output Answer": [ + "$x^5-4 x^4-x^3+2 x^2-4 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x**7-5*x**6+4*x**5-x**4-7*x**3+3*x**2-x-3, x**5-4*x**4-x**3+2*x**2-4*x-3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3 x-5}+\\sqrt{5 x-7}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(326-9 \\sqrt{1207}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3*x-5)+sqrt(5*x-7), 9), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-10 x^2+270 x-1820$", + "Output Answer": [ + "$-10 (13-x) (14-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-10*x**2+270*x-1820, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{11}{4} \\left(-\\cos \\left(\\frac{7 \\pi }{45}\\right)+i \\sin \\left(\\frac{7 \\pi }{45}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-\\frac{1331}{64} \\left(-\\sin \\left(\\frac{\\pi }{30}\\right)+i \\cos \\left(\\frac{\\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(11/4)*(-math.cos(((7*math.pi)/45))+1j*math.sin(((7*math.pi)/45))))**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $21-2 x$ and $\\frac{21}{5}-\\frac{2 x}{5}$.", + "Output Answer": [ + "$\\frac{2 x}{5}-\\frac{21}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(21-2*x, (21/5)-((2*x)/5)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2 x^3+2 x^2+8 x+4$ and $-x-1$.", + "Output Answer": [ + "$x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2*x**3+2*x**2+8*x+4, -x-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{4-3 i}{\\pi }$ and $y=\\frac{14-21 i}{\\pi }$", + "Output Answer": [ + "$\\frac{17}{91}+\\frac{6 i}{91}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((4-3*i)/math.pi)\ny = ((14-21*i)/math.pi)\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{17 x^2}{\\sqrt{2}}+\\frac{15 x}{\\sqrt{2}}+\\frac{5}{\\sqrt{2}}$", + "Output Answer": [ + "$x=\\frac{1}{34} \\left(-15-i \\sqrt{115}\\right)\\lor x=\\frac{1}{34} \\left(-15+i \\sqrt{115}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((17*x**2)/(sqrt(2)))+((15*x)/(sqrt(2)))+(5/(sqrt(2))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt[3]{-5 x^2-5}$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = cbrt(-5*x**2-5)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-4-i) \\sqrt{5}$ and $y=(2+2 i) \\sqrt{5}$", + "Output Answer": [ + "$(-6-3 i) \\sqrt{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-4-i)*math.sqrt(5)\ny = (2+2*i)*math.sqrt(5)\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{1}{5} e^{-\\frac{23 i \\pi }{60}}$.", + "Output Answer": [ + "Norm: $\\frac{1}{5}$\nArgument: $-\\frac{23 \\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (1/5)*math.e**(-((23*i*math.pi)/60))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{26}{5} e^{-\\frac{49 i \\pi }{60}}$.", + "Output Answer": [ + "Norm: $\\frac{26}{5}$\nArgument: $\\frac{11 \\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(26/5)*math.e**(-((49*i*math.pi)/60))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^5-6 x^4-13 x^3+9 x^2+7 x+1$ and $2 x^3+2 x^2-3 x-1$.", + "Output Answer": [ + "$2 x^3+2 x^2-3 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**5-6*x**4-13*x**3+9*x**2+7*x+1, 2*x**3+2*x**2-3*x-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$5 x+18 y+6 z+14=0$, $-4 x-24 y+18 z+24=0$, $-7 x+8 y+24 z-18=0$", + "Output Answer": [ + "$x=-\\frac{462}{89}$, $y=\\frac{92}{89}$, $z=-\\frac{296}{267}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((5*x+18*y+6*z+14, -4*x-24*y+18*z+24, -7*x+8*y+24*z-18)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $8 x^2+12 x-20$ and $2 x^2+3 x-5$.", + "Output Answer": [ + "$2 x^2+3 x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(8*x**2+12*x-20, 2*x**2+3*x-5))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{44}{3}$, and $a_n=a_{n-1}+\\frac{14}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$10 \\left(\\frac{266}{\\sqrt{3}}-\\frac{88}{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(44/3) # initial value\nd = (14/(math.sqrt(3))) # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(44/3) # initial value\nd = (14/(math.sqrt(3))) # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{27}{47}$, and $a_n=a_{n-1}+-9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$-\\frac{72846}{47}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(27/47) # initial value\nd = -9 # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(27/47) # initial value\nd = -9 # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-3 x^6+x^5-9 x^4-2 x^3+9 x^2+7 x+5$ when divided by $-x^5+3 x^4+2 x^3-9 x^2-x+3$.", + "Output Answer": [ + "$3 x+8$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x**6+x**5-9*x**4-2*x**3+9*x**2+7*x+5\nq = -x**5+3*x**4+2*x**3-9*x**2-x+3\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 \\left(4 t^2+60 t+229\\right)^2, x(t)=4 t^2+60 t+225$", + "Output Answer": [ + "$y=4 x^2+32 x+64$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*(4*t**2+60*t+229)**2\nx_t = 4*t**2+60*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-10 x^2-140 x+150$", + "Output Answer": [ + "$10 (1-x) (x+15)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-10*x**2-140*x+150, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\sin \\left(7-7 x^2\\right)$ at the point $x=9$", + "Output Answer": [ + "$\\sin (560) = 0.715$" + ], + "Output Program": [ + "import math\n\nx = 9\ntry: \n f = -math.sin(7-7*x**2)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 7 \\sqrt{3} x^2-3 \\sqrt{3} x+9 \\sqrt{3}\\right| =-2 \\sqrt{3}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(7*sqrt(3)*x**2-3*sqrt(3)*x+9*sqrt(3)), -2*sqrt(3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 8 \\sqrt{2} x^2-\\frac{21 x}{\\sqrt{2}}+7 \\sqrt{2}$ and $q(x) = -\\frac{7 x^2}{\\sqrt{2}}-7 \\sqrt{2} x+7 \\sqrt{2}$", + "Output Answer": [ + "$-56 x^4-\\frac{77 x^3}{2}+210 x^2-245 x+98$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 8*sqrt(2)*x**2-((21*x)/(sqrt(2)))+7*sqrt(2)\nq = -((7*x**2)/(sqrt(2)))-7*sqrt(2)*x+7*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 7 x^2-8 x+11$, $q(x) = -4 x^2-9 x-14$", + "Output Answer": [ + "$3 x^2-17 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**2-8*x+11\nq = -4*x**2-9*x-14\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{39 x}{5}-\\frac{46}{5}}+\\sqrt{-\\frac{26 x}{5}-\\frac{31}{5}}=\\frac{22}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{65} \\left(-2495+44 \\sqrt{2899}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((39*x)/5)-(46/5))+sqrt(-((26*x)/5)-(31/5)), (22/5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{8}{3} \\left(-\\cos \\left(\\frac{7 \\pi }{90}\\right)+i \\sin \\left(\\frac{7 \\pi }{90}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{1073741824 \\left(-\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)}{59049}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(8/3)*(-math.cos(((7*math.pi)/90))+1j*math.sin(((7*math.pi)/90))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-12 x^2-10 x+3$", + "Output Answer": [ + "$\\frac{61}{12}-12 \\left(x+\\frac{5}{12}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-12*x**2-10*x+3), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{47}{50}$, and $a_n=a_{n-1}+-9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$-\\frac{8456}{5}$" + ], + "Output Program": [ + "a = (47/50) # initial value\nd = -9 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (47/50) # initial value\nd = -9 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt{2 x^2-8}$", + "Output Answer": [ + "$x\\leq -2\\lor x\\geq 2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sqrt(2*x**2-8)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{5}{13}$, and $a_n=a_{n-1}+7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{27175}{13}$" + ], + "Output Program": [ + "a = -(5/13) # initial value\nd = 7 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(5/13) # initial value\nd = 7 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-14 x-2 y-22=0$, $21 x-3 y-10=0$", + "Output Answer": [ + "$x=-\\frac{23}{42}$, $y=-\\frac{43}{6}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-14*x-2*y-22, 21*x-3*y-10), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2+7 x-2 y^2-6 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(x+\\frac{7}{4}\\right)^2-2 \\left(y+\\frac{3}{2}\\right)^2=-\\frac{35}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{7}{4} & \\frac{1}{4} \\left(-6-\\sqrt{70}\\right) \\\\\n -\\frac{7}{4} & \\frac{1}{4} \\left(\\sqrt{70}-6\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{-\\frac{7}{4},\\frac{1}{2} \\left(\\frac{1}{4} \\left(-6-\\sqrt{70}\\right)+\\frac{1}{4} \\left(\\sqrt{70}-6\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-x-\\frac{13}{4},y=x+\\frac{1}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2+7*x-2*y**2-6*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{43}{47}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$-\\frac{30255}{47}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(43/47) # initial value\nd = -6 # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(43/47) # initial value\nd = -6 # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$e^{-\\frac{13 x}{2}-1}$", + "Output Answer": [ + "$y>0$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(math.e**(-((13*x)/2)-1), x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the seventh order series of the inverse of the following function around 7:\n$-\\tan ^{-1}(4 x)$", + "Output Answer": [ + "$-\\frac{17 x^7}{1260}-\\frac{x^5}{30}-\\frac{x^3}{12}-\\frac{x}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, -atan(4*x))\nprint(solve(f, x)[0].series(y, 7, 6))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2-192 x-1024$", + "Output Answer": [ + "$-8 (-x-16) (-x-8)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2-192*x-1024, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{39 x}{4}-\\frac{21}{4}}+\\sqrt{8-\\frac{x}{2}}=\\frac{17}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-13810+816 \\sqrt{122}}{1369}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((39*x)/4)-(21/4))+sqrt(8-(x/2)), (17/2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$25 x+\\frac{87 y}{7}+\\frac{134}{7}=0$, $\\frac{113 x}{7}-\\frac{90 y}{7}-\\frac{29}{7}=0$", + "Output Answer": [ + "$x=-\\frac{3179}{8527}$, $y=-\\frac{6739}{8527}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((25*x+((87*y)/7)+(134/7), ((113*x)/7)-((90*y)/7)-(29/7)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-8 x^2+2 x+5$", + "Output Answer": [ + "$x=\\frac{1}{8} \\left(1-\\sqrt{41}\\right)\\lor x=\\frac{1}{8} \\left(1+\\sqrt{41}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-8*x**2+2*x+5, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$x-21 y+2=0$, $18 x+10 y-7=0$", + "Output Answer": [ + "$x=\\frac{127}{388}$, $y=\\frac{43}{388}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((x-21*y+2, 18*x+10*y-7), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{28-11 i}{\\pi }$ and $y=-\\frac{10-25 i}{\\pi }$", + "Output Answer": [ + "$-\\frac{5-810 i}{\\pi ^2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((28-11*i)/math.pi)\ny = -((10-25*i)/math.pi)\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-4 x^2-20 x-16$", + "Output Answer": [ + "$4 (-x-1) (x+4)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-4*x**2-20*x-16, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-1$ and $-2 x^3-x^2-x+1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-1, -2*x**3-x**2-x+1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\cos ^{-1}\\left(\\frac{5 x}{3}+\\frac{8}{3}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{5} (3 \\cos (y)-8)\\text{ if }0\\leq y\\leq \\pi $}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, acos(((5*x)/3)+(8/3)))\nprint(solve(f, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{39 x}{\\pi }-\\frac{2}{\\pi }$ and $q(x) = \\frac{19 x^2}{\\pi }-\\frac{8 x}{\\pi }-\\frac{29}{\\pi }$", + "Output Answer": [ + "$-\\frac{741 x^3}{\\pi ^2}+\\frac{274 x^2}{\\pi ^2}+\\frac{1147 x}{\\pi ^2}+\\frac{58}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((39*x)/pi)-(2/pi)\nq = ((19*x**2)/pi)-((8*x)/pi)-(29/pi)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-x^2-x+14$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(-1-\\sqrt{57}\\right)\\lor x=\\frac{1}{2} \\left(\\sqrt{57}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-x**2-x+14, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4$ and $-2 x^5+2 x^4+3 x^3+5 x^2-5 x+5$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4, -2*x**5+2*x**4+3*x**3+5*x**2-5*x+5))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{71}{24}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$\\frac{25973}{24}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (71/24) # initial value\nd = 6 # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (71/24) # initial value\nd = 6 # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{2 i}{\\sqrt{\\pi }}$ and $y=-\\frac{10+5 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{10-20 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((2*i)/(math.sqrt(math.pi)))\ny = -((10+5*i)/(math.sqrt(math.pi)))\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{17 x^2+20 x-14}{-10 x^2-4 x+6}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{17} \\left(-10-13 \\sqrt{2}\\right)\\right\\},\\left\\{x\\to \\frac{1}{17} \\left(-10+13 \\sqrt{2}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((17*x**2+20*x-14)/(-10*x**2-4*x+6)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $4 \\sqrt{2} x^2-4 \\sqrt{2} x-\\frac{3}{\\sqrt{2}}$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(1-\\sqrt{\\frac{5}{2}}\\right)\\lor x=\\frac{1}{2} \\left(1+\\sqrt{\\frac{5}{2}}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(4*sqrt(2)*x**2-4*sqrt(2)*x-(3/(sqrt(2))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-7 x^2-63 x+630$", + "Output Answer": [ + "$-7 (x-6) (x+15)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-7*x**2-63*x+630, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{152 x}{7}-\\frac{3 y}{7}-\\frac{5}{7}=0$, $\\frac{113 x}{7}+\\frac{135 y}{7}-\\frac{150}{7}=0$", + "Output Answer": [ + "$x=-\\frac{375}{6727}$, $y=\\frac{23365}{20181}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((152*x)/7)-((3*y)/7)-(5/7), ((113*x)/7)+((135*y)/7)-(150/7)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{47 x}{7}+\\frac{51}{7}}+\\sqrt{\\frac{66 x}{7}-\\frac{72}{7}}=\\frac{44}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{235127-88 \\sqrt{6903222}}{2527}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((47*x)/7)+(51/7))+sqrt(((66*x)/7)-(72/7)), (44/7)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+242 x-935$", + "Output Answer": [ + "$11 (5-x) (x-17)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+242*x-935, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $2 x-9$ when divided by $9-2 x$.", + "Output Answer": [ + "$-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x-9\nq = 9-2*x\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sin \\left(\\frac{7}{5}-\\frac{4 x}{5}\\right)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sin((7/5)-((4*x)/5))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 13 x^2+21 x+17\\right| =12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{26} \\left(-21-\\sqrt{181}\\right)\\right\\},\\left\\{x\\to \\frac{1}{26} \\left(-21+\\sqrt{181}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(13*x**2+21*x+17), 12), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{19}{3} e^{\\frac{173 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $\\frac{19}{3}$\nArgument: $-\\frac{7 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(19/3)*math.e**((173*i*math.pi)/180)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-4 e \\left(-\\sin \\left(\\frac{3 \\pi }{20}\\right)-i \\cos \\left(\\frac{3 \\pi }{20}\\right)\\right)$.", + "Output Answer": [ + "Norm: $4 e \\sqrt{\\sin ^2\\left(\\frac{3 \\pi }{20}\\right)+\\cos ^2\\left(\\frac{3 \\pi }{20}\\right)}$\nArgument: $\\frac{7 \\pi }{20}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -4*math.e*(-math.sin(((3*math.pi)/20))-i*math.cos(((3*math.pi)/20)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2+12 \\sqrt{5} x+160$", + "Output Answer": [ + "$-2 \\left(-x-2 \\sqrt{5}\\right) \\left(8 \\sqrt{5}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2+12*sqrt(5)*x+160, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{20 x}{\\sqrt{3}}+10 \\sqrt{3} y+\\frac{41}{\\sqrt{3}}=0$, $\\frac{10 x}{\\sqrt{3}}+5 \\sqrt{3} y-\\frac{32}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{21}{8}$, $y=\\frac{23}{60}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((20*x)/(sqrt(3)))+10*sqrt(3)*y+(41/(sqrt(3))), ((10*x)/(sqrt(3)))+5*sqrt(3)*y-(32/(sqrt(3)))), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+5 x+y^2+2 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $9 \\left(x+\\frac{5}{18}\\right)^2+(y+1)^2=\\frac{349}{36}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{18} & -1-\\frac{\\sqrt{698}}{9} \\\\\n -\\frac{5}{18} & \\frac{1}{9} \\left(\\sqrt{698}-9\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2 \\sqrt{2}}{3}$\nCenter: $\\left\\{-\\frac{5}{18},\\frac{1}{2} \\left(-1-\\frac{\\sqrt{698}}{9}+\\frac{1}{9} \\left(\\sqrt{698}-9\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{349 \\pi }{108}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+5*x+y**2+2*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2-8 x-6 y^2+2 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(x-\\frac{2}{5}\\right)^2-6 \\left(y-\\frac{1}{6}\\right)^2=\\frac{73}{30}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{15} \\left(6-\\sqrt{146}\\right) & \\frac{1}{6} \\\\\n \\frac{1}{15} \\left(6+\\sqrt{146}\\right) & \\frac{1}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{15} \\left(6-\\sqrt{146}\\right)+\\frac{1}{15} \\left(6+\\sqrt{146}\\right)\\right),\\frac{1}{6}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{5}{3}} x+\\frac{1}{30} \\left(5-4 \\sqrt{15}\\right),y=\\frac{1}{30} \\left(5+4 \\sqrt{15}\\right)-\\sqrt{\\frac{5}{3}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2-8*x-6*y**2+2*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -14 x^2+6 x-6$, $q(x) = -12 x^2+9 x+15$", + "Output Answer": [ + "$-26 x^2+15 x+9$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -14*x**2+6*x-6\nq = -12*x**2+9*x+15\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{-\\sin \\left(\\frac{13 \\pi }{90}\\right)-i \\cos \\left(\\frac{13 \\pi }{90}\\right)}{\\sqrt{3}}\\right)^2$", + "Output Answer": [ + "$\\frac{1}{3} \\left(-\\sin \\left(\\frac{19 \\pi }{90}\\right)+i \\cos \\left(\\frac{19 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((-math.sin(((13*math.pi)/90))-1j*math.cos(((13*math.pi)/90)))/(math.sqrt(3))))**2)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=12 t+\\sqrt{2}-66, x(t)=2 \\sqrt{2} t-11 \\sqrt{2}$", + "Output Answer": [ + "$y=3 \\sqrt{2} x+\\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 12*t+sqrt(2)-66\nx_t = 2*sqrt(2)*t-11*sqrt(2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -12 x^2-16 x+20\\right| =-2$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-12*x**2-16*x+20), -2), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-5 x+16 y-23 z+15=0$, $-21 x-7 y+z+15=0$, $-25 x+19 y-10 z+1=0$", + "Output Answer": [ + "$x=\\frac{3535}{9187}$, $y=\\frac{10912}{9187}$, $z=\\frac{12814}{9187}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-5*x+16*y-23*z+15, -21*x-7*y+z+15, -25*x+19*y-10*z+1)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $6 \\sqrt{2} x^2+2 \\sqrt{2} x-3 \\sqrt{2}$", + "Output Answer": [ + "$6 \\sqrt{2} \\left(x+\\frac{1}{6}\\right)^2-3 \\sqrt{2}-\\frac{1}{3 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (6*math.sqrt(2)*x**2+2*math.sqrt(2)*x-3*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(16 t+115)^2, x(t)=-2 t-15$", + "Output Answer": [ + "$y=64 x^2+80 x+25$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (16*t+115)**2\nx_t = -2*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=16 (15-8 t)^2, x(t)=8 t-15$", + "Output Answer": [ + "$y=16 x^2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 16*(15-8*t)**2\nx_t = 8*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\tan (4-4 x)$ at the point $x=5$", + "Output Answer": [ + "$\\tan (16) = 0.301$" + ], + "Output Program": [ + "import math\n\nx = 5\ntry: \n f = -math.tan(4-4*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-4 x^2-2 x+8$", + "Output Answer": [ + "$\\frac{33}{4}-4 \\left(x+\\frac{1}{4}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-4*x**2-2*x+8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-7 x^2+10 x-4$", + "Output Answer": [ + "$-7 \\left(x-\\frac{5}{7}\\right)^2-\\frac{3}{7}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-7*x**2+10*x-4), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\cos \\left(\\frac{7 \\pi }{90}\\right)+i \\sin \\left(\\frac{7 \\pi }{90}\\right)\\right)^6$", + "Output Answer": [ + "$\\sin \\left(\\frac{\\pi }{30}\\right)+i \\cos \\left(\\frac{\\pi }{30}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.cos(((7*math.pi)/90))+1j*math.sin(((7*math.pi)/90)))**6)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$x+7 y-9=0$, $-25 x+9 y-7=0$", + "Output Answer": [ + "$x=\\frac{4}{23}$, $y=\\frac{29}{23}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((x+7*y-9, -25*x+9*y-7), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8 x+1}+\\sqrt{13 x+12}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{39}{-281-8 \\sqrt{1249}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8*x+1)+sqrt(13*x+12), 4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-24$, and $a_n=a_{n-1}+-2 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$\\frac{21}{2} \\left(-48-40 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -24 # initial value\nd = -2*math.sqrt(3) # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -24 # initial value\nd = -2*math.sqrt(3) # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-9 x^2-6 x-8$", + "Output Answer": [ + "$-9 \\left(x+\\frac{1}{3}\\right)^2-7$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-9*x**2-6*x-8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the first order series of the inverse of the following function around 1:\n$-\\frac{1}{2 x}$", + "Output Answer": [ + "$2 \\left(x-\\frac{1}{2}\\right)-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, -(1/(2*x)))\nprint(solve(f, x)[0].series(y, 1, 1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{22}{5}+8 i$.", + "Output Answer": [ + "Norm: $\\frac{2 \\sqrt{521}}{5}$\nArgument: $\\tan ^{-1}\\left(\\frac{20}{11}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (22/5)+8*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{71}{19}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=28$.", + "Output Answer": [ + "$-\\frac{1988}{19}$" + ], + "Output Program": [ + "a = -(71/19) # initial value\nd = 0 # second term\nn = 28 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(71/19) # initial value\nd = 0 # second term\nn = 28 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 8 x^2+11 x-5$, $q(x) = -3 \\left(4 x^2+2 x-5\\right)$", + "Output Answer": [ + "$-4 x^2+5 x+10$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**2+11*x-5\nq = -3*(4*x**2+2*x-5)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-14 x^2+23 x+5}{-5 x^2+9 x+19}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{28} \\left(23-\\sqrt{809}\\right)\\right\\},\\left\\{x\\to \\frac{1}{28} \\left(23+\\sqrt{809}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-14*x**2+23*x+5)/(-5*x**2+9*x+19)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{31}{7}-\\frac{19 x^2}{7}$ and $q(x) = -\\frac{15 x^2}{7}-\\frac{61 x}{7}-\\frac{46}{7}$", + "Output Answer": [ + "$\\frac{285 x^4}{49}+\\frac{1159 x^3}{49}+\\frac{409 x^2}{49}-\\frac{1891 x}{49}-\\frac{1426}{49}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = (31/7)-((19*x**2)/7)\nq = -((15*x**2)/7)-((61*x)/7)-(46/7)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{(((20-22)+17)-5)-15}{(3-12)+19}$.", + "Output Answer": [ + "$-\\frac{1}{2}$" + ], + "Output Program": [ + "try: \n print((((((20-22)+17)-5)-15)/((3-12)+19)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{11 x^2-13 x-18}{21 x^2-17 x+12}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{9}{11}\\right\\},\\{x\\to 2\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((11*x**2-13*x-18)/(21*x**2-17*x+12)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x+\\frac{5}{2}}+\\sqrt{\\frac{21 x}{2}-9}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{121} \\left(3291-42 \\sqrt{5270}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x+(5/2))+sqrt(((21*x)/2)-9), 7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{2}{5}$, and $a_n=a_{n-1}+-10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$-\\frac{13848}{5}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(2/5) # initial value\nd = -10 # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(2/5) # initial value\nd = -10 # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x-4 x^2$ and $2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x-4*x**2, 2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((((17+14)-19)-22)-9)+(((23+19)-20)-5)$.", + "Output Answer": [ + "$-2$" + ], + "Output Program": [ + "try: \n print(((((17+14)-19)-22)-9)+(((23+19)-20)-5))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2-8 x+2 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $2 x^2-8 x+2 y=10$\nVertex: $\\{2,9\\}$\nDirectrix: $y=\\frac{37}{4}$\nFocal Parameter: $\\frac{1}{2}$\nFocus: $\\left\\{2,\\frac{35}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2-8*x+2*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{13 x}{3}-\\frac{5}{3}}+\\sqrt{\\frac{38 x}{3}+13}=\\frac{40}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{75} \\left(3132-80 \\sqrt{1181}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((13*x)/3)-(5/3))+sqrt(((38*x)/3)+13), (40/3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(((21+24)+6)+24)-\\left(\\left(((17+8)-2)^2+23\\right)-9\\right)$.", + "Output Answer": [ + "$-468$" + ], + "Output Program": [ + "try: \n print((((21+24)+6)+24)-((((17+8)-2)**2+23)-9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-15 x-11 y-22 z-1=0$, $-24 x+19 y+4 z+18=0$, $19 x+5 y+15 z-15=0$", + "Output Answer": [ + "$x=\\frac{4885}{1811}$, $y=\\frac{5782}{1811}$, $z=-\\frac{6304}{1811}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-15*x-11*y-22*z-1, -24*x+19*y+4*z+18, 19*x+5*y+15*z-15)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{2 \\left(2 x^2-9 x+4\\right)}{\\sqrt{3}}$, $q(x) = \\frac{16 x^2+20 x+3}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{20 x^2}{\\sqrt{3}}-6 \\sqrt{3} x+\\frac{20 x}{\\sqrt{3}}+\\sqrt{3}+\\frac{8}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((2*(2*x**2-9*x+4))/(sqrt(3)))\nq = ((16*x**2+20*x+3)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x+11}+\\sqrt{2 x-14}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 217-32 \\sqrt{41}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x+11)+sqrt(2*x-14), 8), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{27 x^2}{5}-\\frac{37 x}{5}+\\frac{32}{5}$", + "Output Answer": [ + "$x=\\frac{1}{54} \\left(37-i \\sqrt{2087}\\right)\\lor x=\\frac{1}{54} \\left(37+i \\sqrt{2087}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((27*x**2)/5)-((37*x)/5)+(32/5), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+x+4 y^2-2 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $6 \\left(x+\\frac{1}{12}\\right)^2+4 \\left(y-\\frac{1}{4}\\right)^2=\\frac{55}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{12} & \\frac{1}{24} \\left(6-\\sqrt{110}\\right) \\\\\n -\\frac{1}{12} & \\frac{1}{24} \\left(6+\\sqrt{110}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{3}}$\nCenter: $\\left\\{-\\frac{1}{12},\\frac{1}{2} \\left(\\frac{1}{24} \\left(6-\\sqrt{110}\\right)+\\frac{1}{24} \\left(6+\\sqrt{110}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{55 \\pi }{48 \\sqrt{6}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+x+4*y**2-2*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{5 \\left(\\cos \\left(\\frac{53}{30}\\right)+i \\sin \\left(\\frac{53}{30}\\right)\\right)}{\\sqrt{2}}\\right)^8$", + "Output Answer": [ + "$\\frac{390625}{16} \\left(\\cos \\left(\\frac{212}{15}\\right)+i \\sin \\left(\\frac{212}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((5*(math.cos((53/30))+1j*math.sin((53/30))))/(math.sqrt(2))))**8)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{13}{3}-\\frac{11 i}{3}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{290}}{3}$\nArgument: $\\tan ^{-1}\\left(\\frac{11}{13}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(13/3)-((11*i)/3)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{10 x^6}{3}+\\frac{14 x^5}{3}+\\frac{13 x^4}{3}-\\frac{8 x^3}{3}+\\frac{22 x^2}{3}-2 x+\\frac{4}{3}$ when divided by $9$.", + "Output Answer": [ + "$\\frac{10 x^6}{27}+\\frac{14 x^5}{27}+\\frac{13 x^4}{27}-\\frac{8 x^3}{27}+\\frac{22 x^2}{27}-\\frac{2 x}{9}+\\frac{4}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((10*x**6)/3)+((14*x**5)/3)+((13*x**4)/3)-((8*x**3)/3)+((22*x**2)/3)-2*x+(4/3)\nq = 9\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{14}{3} \\left(\\cos \\left(\\frac{109}{90}\\right)+i \\sin \\left(\\frac{109}{90}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-\\frac{2744}{27} \\left(\\cos \\left(\\frac{109}{30}\\right)+i \\sin \\left(\\frac{109}{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(14/3)*(math.cos((109/90))+1j*math.sin((109/90))))**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{7 x}{2}-4$ and $-\\frac{5 x^3}{2}-x^2+x-\\frac{3}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((7*x)/2)-4, -((5*x**3)/2)-x**2+x-(3/2)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{25 x^2}{3}+\\frac{4 x}{3}-\\frac{29}{3}$ and $q(x) = \\frac{32 x^2}{3}-\\frac{28 x}{3}+\\frac{41}{3}$", + "Output Answer": [ + "$-\\frac{800 x^4}{9}+92 x^3-\\frac{2065 x^2}{9}+\\frac{976 x}{9}-\\frac{1189}{9}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((25*x**2)/3)+((4*x)/3)-(29/3)\nq = ((32*x**2)/3)-((28*x)/3)+(41/3)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-4 t-57, x(t)=-t-15$", + "Output Answer": [ + "$y=4 x+3$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -4*t-57\nx_t = -t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=3$, and $a_n=a_{n-1}+-\\frac{7}{\\sqrt{2}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$\\frac{15}{2} \\left(6-49 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = 3 # initial value\nd = -(7/(math.sqrt(2))) # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 3 # initial value\nd = -(7/(math.sqrt(2))) # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 8 \\sqrt{5} x^2-7 \\sqrt{5}\\right| =7 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\{x\\to 0\\},\\left\\{x\\to -\\frac{\\sqrt{7}}{2}\\right\\},\\left\\{x\\to \\frac{\\sqrt{7}}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(8*sqrt(5)*x**2-7*sqrt(5)), 7*sqrt(5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{25}{4}-\\frac{13 x}{2}}+\\sqrt{\\frac{27}{4}-\\frac{11 x}{4}}=\\frac{25}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{45} \\left(-4631+10 \\sqrt{185155}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((25/4)-((13*x)/2))+sqrt((27/4)-((11*x)/4)), (25/2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 22 x+9| =-16$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(22*x+9), -16), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=35 t-109, x(t)=5 t-15$", + "Output Answer": [ + "$y=7 x-4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 35*t-109\nx_t = 5*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-8 \\sqrt{3} x^2-4 \\sqrt{3} x-4 \\sqrt{3}$", + "Output Answer": [ + "$x=\\frac{1}{4} \\left(-1-i \\sqrt{7}\\right)\\lor x=\\frac{1}{4} \\left(-1+i \\sqrt{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-8*sqrt(3)*x**2-4*sqrt(3)*x-4*sqrt(3), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-4 x-2}+\\sqrt{-x-7}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-485+20 \\sqrt{322}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-4*x-2)+sqrt(-x-7), 10), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{19 x^2}{4}-\\frac{13 x}{4}-7$, $q(x) = 5 x^2-\\frac{27 x}{2}+\\frac{53}{4}$", + "Output Answer": [ + "$\\frac{39 x^2}{4}-\\frac{67 x}{4}+\\frac{25}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((19*x**2)/4)-((13*x)/4)-7\nq = 5*x**2-((27*x)/2)+(53/4)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -8 x^2+11 x+1$ and $q(x) = 9 x+7$", + "Output Answer": [ + "$-72 x^3+43 x^2+86 x+7$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -8*x**2+11*x+1\nq = 9*x+7\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{3 x}{7}-\\frac{88 y}{7}+\\frac{156 z}{7}+\\frac{129}{7}=0$, $-13 x+9 y+23 z+\\frac{71}{7}=0$, $\\frac{162 x}{7}+\\frac{158 y}{7}+\\frac{167 z}{7}+\\frac{92}{7}=0$", + "Output Answer": [ + "$x=-\\frac{1338501}{7512407}$, $y=\\frac{2215782}{7512407}$, $z=-\\frac{4936514}{7512407}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((3*x)/7)-((88*y)/7)+((156*z)/7)+(129/7), -13*x+9*y+23*z+(71/7), ((162*x)/7)+((158*y)/7)+((167*z)/7)+(92/7))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{6448 x^2}{25}+\\frac{12096 x}{25}-\\frac{324}{5}}{\\frac{5456 x}{25}-\\frac{792}{25}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{45}{26}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((6448*x**2)/25)+((12096*x)/25)-(324/5))/(((5456*x)/25)-(792/25))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-255 x^2-68 x+187}{-170 x-170}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{11}{15}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-255*x**2-68*x+187)/(-170*x-170)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2-25 x+1330$", + "Output Answer": [ + "$-5 (x-14) (x+19)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2-25*x+1330, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4$ and $-2 x^3-x^2+4 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4, -2*x**3-x**2+4*x-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-10-2 i$ and $y=-7-2 i$", + "Output Answer": [ + "$-17-4 i$" + ], + "Output Program": [ + "i = 1j\nx = -10-2*i\ny = -7-2*i\nprint(x+y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{1-12 i}{\\sqrt{2}}$ and $y=(-4-i) \\sqrt{2}$", + "Output Answer": [ + "$-\\frac{4}{17}-\\frac{49 i}{34}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((1-12*i)/(math.sqrt(2)))\ny = (-4-i)*math.sqrt(2)\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{25}{3}-\\frac{28 i}{3}$ and $y=\\frac{29}{3}+2 i$", + "Output Answer": [ + "$-18-\\frac{34 i}{3}$" + ], + "Output Program": [ + "i = 1j\nx = -(25/3)-((28*i)/3)\ny = (29/3)+2*i\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{43}{3}-\\frac{28 x}{3}}+\\sqrt{15-2 x}=\\frac{26}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{363} \\left(-5779+130 \\sqrt{1797}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((43/3)-((28*x)/3))+sqrt(15-2*x), (26/3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 13 x+1| =22$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{23}{13}\\right\\},\\left\\{x\\to \\frac{21}{13}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(13*x+1), 22), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{4-21 i}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{457}}{\\pi }$\nArgument: $-\\tan ^{-1}\\left(\\frac{21}{4}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((4-21*i)/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $7 x^2-12$", + "Output Answer": [ + "$x=2 \\sqrt{\\frac{3}{7}}\\lor x=-2 \\sqrt{\\frac{3}{7}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(7*x**2-12, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{9}{2} \\left(\\cos \\left(\\frac{41}{45}\\right)+i \\sin \\left(\\frac{41}{45}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$\\frac{81}{4} \\left(\\cos \\left(\\frac{82}{45}\\right)+i \\sin \\left(\\frac{82}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(9/2)*(math.cos((41/45))+1j*math.sin((41/45))))**2)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (3, \\frac{1}{\\sqrt{3}}, 6)$", + "Output Answer": [ + "$\\left\\{2 \\sqrt{\\frac{34}{3}},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{7}{3}}}{3}\\right),\\tan ^{-1}\\left(\\frac{1}{3 \\sqrt{3}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 3\ny = (1/(math.sqrt(3)))\nz = 6\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2+15 x-4$ and $q(x) = -5 x^2+7 x-11$", + "Output Answer": [ + "$70 x^4-173 x^3+279 x^2-193 x+44$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2+15*x-4\nq = -5*x**2+7*x-11\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 \\sqrt{2} x^2+2 \\sqrt{2} x+3 \\sqrt{2}$ and $q(x) = -2 \\sqrt{2} x^2+\\sqrt{2} x-7 \\sqrt{2}$", + "Output Answer": [ + "$-20 x^4+2 x^3-78 x^2-22 x-42$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*sqrt(2)*x**2+2*sqrt(2)*x+3*sqrt(2)\nq = -2*sqrt(2)*x**2+sqrt(2)*x-7*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-19 x^2+\\frac{40 x}{3}-\\frac{10}{3}}{2 x^2-14 x-\\frac{4}{3}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-19*x**2+((40*x)/3)-(10/3))/(2*x**2-14*x-(4/3))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-10 x^3-185 x^2+1515 x+25740$", + "Output Answer": [ + "$10 \\left(-x-\\frac{39}{2}\\right) (x-12) (x+11)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-10*x**3-185*x**2+1515*x+25740, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-7 x^2+70 \\sqrt{3} x+231$", + "Output Answer": [ + "$-7 \\left(-x-\\sqrt{3}\\right) \\left(11 \\sqrt{3}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-7*x**2+70*sqrt(3)*x+231, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^3+x^2-3 x+7$ when divided by $-3$.", + "Output Answer": [ + "$-3 x^3-\\frac{x^2}{3}+x-\\frac{7}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**3+x**2-3*x+7\nq = -3\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (2, 4, 5)$", + "Output Answer": [ + "$\\left\\{3 \\sqrt{5},\\tan ^{-1}\\left(\\frac{2}{\\sqrt{5}}\\right),\\tan ^{-1}(2)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 2\ny = 4\nz = 5\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{495 x^2}{4}+\\frac{1017 x}{4}-\\frac{259}{2}}{-90 x^2+264 x-168}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{37}{33}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((495*x**2)/4)+((1017*x)/4)-(259/2))/(-90*x**2+264*x-168)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-12 x-2}+\\sqrt{-7 x-2}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{25} \\left(-3211+26 \\sqrt{14146}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-12*x-2)+sqrt(-7*x-2), 13), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{9} (18 x+11)^2, q(x) = \\frac{1}{81} (7 x+26)^4$", + "Output Answer": [ + "$\\frac{2401 x^4}{81}+\\frac{35672 x^3}{81}+\\frac{67220 x^2}{27}+\\frac{495692 x}{81}+\\frac{458065}{81}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/9)*(18*x+11)**2\nq = (1/81)*(7*x+26)**4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{1}{2}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=28$.", + "Output Answer": [ + "$1526$" + ], + "Output Program": [ + "a = (1/2) # initial value\nd = 4 # second term\nn = 28 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (1/2) # initial value\nd = 4 # second term\nn = 28 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^2+x+4$ and $4 x+3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**2+x+4, 4*x+3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{-6 x-7} \\sin (1-4 x)$ at the point $x=-2$", + "Output Answer": [ + "$\\sqrt[3]{5} \\sin (9) = 0.705$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = -2\ntry: \n f = np.cbrt(-6*x-7)*math.sin(1-4*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $12 x^2-15 x-9$", + "Output Answer": [ + "$x=\\frac{1}{8} \\left(5-\\sqrt{73}\\right)\\lor x=\\frac{1}{8} \\left(5+\\sqrt{73}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(12*x**2-15*x-9, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{22 x^3-239 x^2-131 x-345}{299-26 x}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((22*x**3-239*x**2-131*x-345)/(299-26*x)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 13 x^2-6 x-13$, $q(x) = 3 x^2-12 x+7$", + "Output Answer": [ + "$16 x^2-18 x-6$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 13*x**2-6*x-13\nq = 3*x**2-12*x+7\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 12 x^2-10 x-\\frac{27}{2}$ and $q(x) = 7 x^2-2 x-4$", + "Output Answer": [ + "$84 x^4-94 x^3-\\frac{245 x^2}{2}+67 x+54$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 12*x**2-10*x-(27/2)\nq = 7*x**2-2*x-4\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -9 x^2+11 x-8$ and $q(x) = 8 x^2+x+14$", + "Output Answer": [ + "$-72 x^4+79 x^3-179 x^2+146 x-112$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -9*x**2+11*x-8\nq = 8*x**2+x+14\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\cosh (8-3 x)$", + "Output Answer": [ + "$1\\leq y$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(cosh(8-3*x), x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\tan (9 x+8)-\\sqrt[3]{-x^4-9}$", + "Output Answer": [ + "$\\frac{9 x+8}{\\pi }+\\frac{1}{2}\\notin \\mathbb{Z}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = tan(9*x+8)-cbrt(-x**4-9)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4$ and $-4 x^3-5 x^2-\\frac{5 x}{2}+5$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4, -4*x**3-5*x**2-((5*x)/2)+5))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-9 x+9 y^2+7 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x-\\frac{9}{8}\\right)^2+9 \\left(y+\\frac{7}{18}\\right)^2=\\frac{1213}{144}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{9}{8}-\\frac{\\sqrt{6065}}{72} & -\\frac{7}{18} \\\\\n \\frac{1}{72} \\left(81+\\sqrt{6065}\\right) & -\\frac{7}{18} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{9}{8}-\\frac{\\sqrt{6065}}{72}+\\frac{1}{72} \\left(81+\\sqrt{6065}\\right)\\right),-\\frac{7}{18}\\right\\}$\nArea Enclosed: $\\frac{1213 \\pi }{864}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-9*x+9*y**2+7*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{4} \\left(-17 x^2+33 x+55\\right)$, $q(x) = \\frac{1}{4} \\left(51 x^2-29 x-50\\right)$", + "Output Answer": [ + "$\\frac{17 x^2}{2}+x+\\frac{5}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/4)*(-17*x**2+33*x+55)\nq = (1/4)*(51*x**2-29*x-50)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{(((24-8)+18)-21)+3}{((25+8)-15)-20}$.", + "Output Answer": [ + "$-8$" + ], + "Output Program": [ + "try: \n print((((((24-8)+18)-21)+3)/(((25+8)-15)-20)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{31 x^2}{5}+\\frac{56 x}{5}-\\frac{4}{5}$ and $q(x) = \\frac{73 x^2}{5}+\\frac{23 x}{5}+12$", + "Output Answer": [ + "$\\frac{2263 x^4}{25}+\\frac{4801 x^3}{25}+\\frac{2856 x^2}{25}+\\frac{3268 x}{25}-\\frac{48}{5}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((31*x**2)/5)+((56*x)/5)-(4/5)\nq = ((73*x**2)/5)+((23*x)/5)+12\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^3-5 x-4$ when divided by $4 x^3+2 x^2+2 x-4$.", + "Output Answer": [ + "$-\\frac{9}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**3-5*x-4\nq = 4*x**3+2*x**2+2*x-4\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (5 x+7)^2, q(x) = (x+2)^2$", + "Output Answer": [ + "$26 x^2+74 x+53$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (5*x+7)**2\nq = (x+2)**2\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(((25+23)-24)+24)+(16-2)$.", + "Output Answer": [ + "$62$" + ], + "Output Program": [ + "try: \n print((((25+23)-24)+24)+(16-2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{7 x^2}{3}+\\frac{43 x}{3}-\\frac{29}{3}$", + "Output Answer": [ + "$\\frac{7}{3} \\left(x+\\frac{43}{14}\\right)^2-\\frac{887}{28}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((7*x**2)/3)+((43*x)/3)-(29/3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 6 \\sqrt{3} x^2+9 \\sqrt{3} x+13 \\sqrt{3}\\right| =-9 \\sqrt{3}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(6*sqrt(3)*x**2+9*sqrt(3)*x+13*sqrt(3)), -9*sqrt(3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{44}{5}-\\frac{48 i}{5}$.", + "Output Answer": [ + "Norm: $4 \\sqrt{\\frac{53}{5}}$\nArgument: $-\\tan ^{-1}\\left(\\frac{12}{11}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (44/5)-((48*i)/5)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{-9 x-\\frac{8}{3}}+\\log \\left(7 x-\\frac{5}{3}\\right)$ at the point $x=6$", + "Output Answer": [ + "$-\\sqrt[3]{\\frac{170}{3}}+\\log \\left(\\frac{121}{3}\\right) = -0.144$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 6\ntry: \n f = np.cbrt(-9*x-(8/3))+math.log(7*x-(5/3))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-9 x^2+23 x+25}{x^2+15 x-21}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(23-\\sqrt{1429}\\right)\\right\\},\\left\\{x\\to \\frac{1}{18} \\left(23+\\sqrt{1429}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-9*x**2+23*x+25)/(x**2+15*x-21)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left(\\frac{10}{15}-12\\right)-25\\right)-15\\right)-\\frac{1}{25} \\left(\\left(\\frac{19}{22}-8\\right)-6\\right)$.", + "Output Answer": [ + "$-\\frac{83833}{1650}$" + ], + "Output Program": [ + "try: \n print(((((10/15)-12)-25)-15)-(1/25)*(((19/22)-8)-6))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$2 x+19 y-23 z-1=0$, $2 x+22 y-9 z-16=0$, $4 x-3 y-3 z-20=0$", + "Output Answer": [ + "$x=\\frac{8623}{1406}$, $y=\\frac{393}{703}$, $z=\\frac{669}{703}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((2*x+19*y-23*z-1, 2*x+22*y-9*z-16, 4*x-3*y-3*z-20)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -15 x^2-9 x+1$, $q(x) = 9 x+1$", + "Output Answer": [ + "$2-15 x^2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -15*x**2-9*x+1\nq = 9*x+1\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 9 x^2+13 x-14$ and $q(x) = 8 x-8$", + "Output Answer": [ + "$72 x^3+32 x^2-216 x+112$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 9*x**2+13*x-14\nq = 8*x-8\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^4-7 x^3-8 x^2+x-7$ when divided by $x^4-6 x^3+9 x^2+7 x-8$.", + "Output Answer": [ + "$8$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**4-7*x**3-8*x**2+x-7\nq = x**4-6*x**3+9*x**2+7*x-8\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -10 x^2-9 x+7$, $q(x) = 11 x^2-3 x+3$", + "Output Answer": [ + "$x^2-12 x+10$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -10*x**2-9*x+7\nq = 11*x**2-3*x+3\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=e^{6 x^5-5}$ at the point $x=1$", + "Output Answer": [ + "$e = 2.718$" + ], + "Output Program": [ + "import math\n\nx = 1\ntry: \n f = math.e**(6*x**5-5)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $2 \\sqrt{3} x^2-2 \\sqrt{3} x+8 \\sqrt{3}$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(1-i \\sqrt{15}\\right)\\lor x=\\frac{1}{2} \\left(1+i \\sqrt{15}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(2*sqrt(3)*x**2-2*sqrt(3)*x+8*sqrt(3), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$2 \\sqrt{2} \\sqrt{x}+\\tan ^{-1}(5 x+3)$", + "Output Answer": [ + "$x\\geq 0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = 2*sqrt(2)*sqrt(x)+atan(5*x+3)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2-45 x-162$", + "Output Answer": [ + "$-3 (x+6) (x+9)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2-45*x-162, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{29}{47}$, and $a_n=a_{n-1}+-\\frac{32}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$-\\frac{4338}{47}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (29/47) # initial value\nd = -(32/5) # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (29/47) # initial value\nd = -(32/5) # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{38}{87}$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$\\frac{60580}{87}$" + ], + "Output Program": [ + "a = -(38/87) # initial value\nd = 9 # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(38/87) # initial value\nd = 9 # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^5-5 x^4-3 x^3+7 x^2-5 x-2$ when divided by $-3 x^4+7 x^3+10 x^2-2$.", + "Output Answer": [ + "$3 x+\\frac{26}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**5-5*x**4-3*x**3+7*x**2-5*x-2\nq = -3*x**4+7*x**3+10*x**2-2\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-9 x^2+5 x+10$", + "Output Answer": [ + "$x=\\frac{1}{18} \\left(5-\\sqrt{385}\\right)\\lor x=\\frac{1}{18} \\left(5+\\sqrt{385}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-9*x**2+5*x+10, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2+8 x+7 y^2+2 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(y+\\frac{1}{7}\\right)^2-8 \\left(x-\\frac{1}{2}\\right)^2=\\frac{8}{7}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & \\frac{1}{7} \\left(-1-\\sqrt{15}\\right) \\\\\n \\frac{1}{2} & \\frac{1}{7} \\left(\\sqrt{15}-1\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{15}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{7} \\left(-1-\\sqrt{15}\\right)+\\frac{1}{7} \\left(\\sqrt{15}-1\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{7} \\left(\\sqrt{14}-1\\right)-2 \\sqrt{\\frac{2}{7}} x,y=2 \\sqrt{\\frac{2}{7}} x+\\frac{1}{7} \\left(-1-\\sqrt{14}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2+8*x+7*y**2+2*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{92 x^2}{7}-\\frac{27 x}{7}-\\frac{69}{7}}{\\frac{32 x^2}{7}+\\frac{41 x}{7}+\\frac{22}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{184} \\left(27-\\sqrt{26121}\\right)\\right\\},\\left\\{x\\to \\frac{1}{184} \\left(27+\\sqrt{26121}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((92*x**2)/7)-((27*x)/7)-(69/7))/(((32*x**2)/7)+((41*x)/7)+(22/7))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-6 x+\\sin (9-x)-5$ at the point $x=0$", + "Output Answer": [ + "$-5+\\sin (9) = -4.588$" + ], + "Output Program": [ + "import math\n\nx = 0\ntry: \n f = -6*x+math.sin(9-x)-5\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\log \\left(x+6 \\sqrt{5}\\right)}{\\log (3)}+\\frac{\\log \\left(x+6 \\sqrt{5}\\right)}{\\log (3)}=\\frac{\\log \\left(-6 \\sqrt{5} x-7 \\sqrt{5}\\right)}{\\log (3)}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -9 \\sqrt{5}-\\sqrt{225-7 \\sqrt{5}}\\right\\},\\left\\{x\\to -9 \\sqrt{5}+\\sqrt{225-7 \\sqrt{5}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(((log(x+6*sqrt(5)))/(log(3)))+((log(x+6*sqrt(5)))/(log(3))), ((log(-6*sqrt(5)*x-7*sqrt(5)))/(log(3)))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{23 x}{2}-12}+\\frac{5 \\sqrt{-x}}{\\sqrt{2}}=\\frac{15}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-5352+75 \\sqrt{5079}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((23*x)/2)-12)+((5*sqrt(-x))/(sqrt(2))), (15/2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 x^2-11 x-9$, $q(x) = 3 x^2-6 x+2$", + "Output Answer": [ + "$12 x^2-17 x-7$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**2-11*x-9\nq = 3*x**2-6*x+2\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| -23 x-19| =12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{31}{23}\\right\\},\\left\\{x\\to -\\frac{7}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-23*x-19), 12), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 13 x+10| =-23$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(13*x+10), -23), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+6 x-8 y^2-7 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 (x+1)^2-8 \\left(y+\\frac{7}{16}\\right)^2=\\frac{143}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n -1-\\frac{11 \\sqrt{\\frac{13}{3}}}{16} & -\\frac{7}{16} \\\\\n \\frac{11 \\sqrt{\\frac{13}{3}}}{16}-1 & -\\frac{7}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{11}{2}}}{2}$\nCenter: $\\left\\{-1,-\\frac{7}{16}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{2} \\sqrt{\\frac{3}{2}} x+\\frac{1}{16} \\left(4 \\sqrt{6}-7\\right),y=\\frac{1}{16} \\left(-7-4 \\sqrt{6}\\right)-\\frac{1}{2} \\sqrt{\\frac{3}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+6*x-8*y**2-7*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{1-10 x}+\\sqrt{13-6 x}=\\frac{19}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(-1492+19 \\sqrt{5911}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(1-10*x)+sqrt(13-6*x), (19/2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(18+10)-(19+19)$.", + "Output Answer": [ + "$-10$" + ], + "Output Program": [ + "try: \n print((18+10)-(19+19))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(\\cos \\left(\\frac{5}{9}\\right)+i \\sin \\left(\\frac{5}{9}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$9 \\left(\\cos \\left(\\frac{10}{9}\\right)+i \\sin \\left(\\frac{10}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(math.cos((5/9))+1j*math.sin((5/9))))**2)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-8 \\sqrt{2} x-14 \\sqrt{2} y+10 \\sqrt{2} z+17 \\sqrt{2}=0$, $-10 \\sqrt{2} x-2 \\sqrt{2} y-11 \\sqrt{2} z-7 \\sqrt{2}=0$, $-7 \\sqrt{2} x+\\sqrt{2} y-7 \\sqrt{2} z+5 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{1911}{538}$, $y=-\\frac{1703}{538}$, $z=-\\frac{885}{269}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-8*sqrt(2)*x-14*sqrt(2)*y+10*sqrt(2)*z+17*sqrt(2), -10*sqrt(2)*x-2*sqrt(2)*y-11*sqrt(2)*z-7*sqrt(2), -7*sqrt(2)*x+sqrt(2)*y-7*sqrt(2)*z+5*sqrt(2))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{38 x^2}{3}-\\frac{5 x}{3}-\\frac{29}{3}$ and $q(x) = \\frac{31 x^2}{3}+9 x-\\frac{10}{3}$", + "Output Answer": [ + "$-\\frac{1178 x^4}{9}-\\frac{1181 x^3}{9}-\\frac{218 x^2}{3}-\\frac{733 x}{9}+\\frac{290}{9}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((38*x**2)/3)-((5*x)/3)-(29/3)\nq = ((31*x**2)/3)+9*x-(10/3)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{102 x}{7}-\\frac{5}{7}}+\\sqrt{-\\frac{99 x}{7}-\\frac{99}{7}}=\\frac{69}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{21} \\left(-318329+138 \\sqrt{5319435}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((102*x)/7)-(5/7))+sqrt(-((99*x)/7)-(99/7)), (69/7)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt[3]{97}+\\sqrt[3]{11}\\right) \\sqrt[3]{\\sqrt[3]{123}}$.", + "Output Answer": [ + "$\\sqrt[9]{123} \\left(\\sqrt[3]{11}+\\sqrt[3]{97}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint((cbrt(97)+cbrt(11))*cbrt(cbrt(123)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{81}{13}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$\\frac{1215}{13}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (81/13) # initial value\nd = 0 # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (81/13) # initial value\nd = 0 # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^5-3 x^4-x^3+5 x^2+7 x$ when divided by $6 x^4+6 x^3-x^2-2 x$.", + "Output Answer": [ + "$\\frac{1}{6}-\\frac{2 x}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**5-3*x**4-x**3+5*x**2+7*x\nq = 6*x**4+6*x**3-x**2-2*x\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 x^2-10 x-14$ and $q(x) = -5 x^2-14 x-14$", + "Output Answer": [ + "$-25 x^4-20 x^3+140 x^2+336 x+196$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*x**2-10*x-14\nq = -5*x**2-14*x-14\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{85}{52}$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$-\\frac{4585}{52}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(85/52) # initial value\nd = -8 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(85/52) # initial value\nd = -8 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt{4 x-9}$", + "Output Answer": [ + "$x\\geq \\frac{9}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sqrt(4*x-9)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-x-1$ and $-2 x^4-3 x^3-3 x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-x-1, -2*x**4-3*x**3-3*x-3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{53 x}{7}-\\frac{27 y}{7}-\\frac{85 z}{7}-\\frac{165}{7}=0$, $-\\frac{58 x}{7}-11 y+\\frac{13 z}{7}-\\frac{117}{7}=0$, $\\frac{33 x}{7}+10 y-\\frac{164 z}{7}+\\frac{67}{7}=0$", + "Output Answer": [ + "$x=\\frac{590638}{497705}$, $y=-\\frac{2471621}{995410}$, $z=-\\frac{410603}{995410}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((53*x)/7)-((27*y)/7)-((85*z)/7)-(165/7), -((58*x)/7)-11*y+((13*z)/7)-(117/7), ((33*x)/7)+10*y-((164*z)/7)+(67/7))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(((10-11)+1)+3)-((6+1)+22)$.", + "Output Answer": [ + "$-26$" + ], + "Output Program": [ + "try: \n print((((10-11)+1)+3)-((6+1)+22))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{9}{5}+\\frac{17 i}{5}$ and $y=-\\frac{36}{5}-10 i$", + "Output Answer": [ + "$9+\\frac{67 i}{5}$" + ], + "Output Program": [ + "i = 1j\nx = (9/5)+((17*i)/5)\ny = -(36/5)-10*i\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2+2 x+7 y^2+6 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(y+\\frac{3}{7}\\right)^2-7 \\left(x-\\frac{1}{7}\\right)^2=\\frac{36}{7}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{7} & -\\frac{3}{7} \\left(1+2 \\sqrt{2}\\right) \\\\\n \\frac{1}{7} & \\frac{3}{7} \\left(2 \\sqrt{2}-1\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{7},\\frac{1}{2} \\left(\\frac{3}{7} \\left(2 \\sqrt{2}-1\\right)-\\frac{3}{7} \\left(1+2 \\sqrt{2}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-x-\\frac{2}{7},y=x-\\frac{4}{7}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2+2*x+7*y**2+6*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(1-18) \\left(\\left(\\frac{13}{11}+24\\right)-16\\right)$.", + "Output Answer": [ + "$-\\frac{1717}{11}$" + ], + "Output Program": [ + "try: \n print((1-18)*(((13/11)+24)-16))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(10 \\left(\\cos \\left(\\frac{43}{30}\\right)+i \\sin \\left(\\frac{43}{30}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$10000000000 \\left(\\cos \\left(\\frac{43}{3}\\right)+i \\sin \\left(\\frac{43}{3}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((10*(math.cos((43/30))+1j*math.sin((43/30))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{4 x^2}{3}-9 x+4$ and $q(x) = -\\frac{11 x^2}{3}-\\frac{19 x}{3}+13$", + "Output Answer": [ + "$\\frac{44 x^4}{9}+\\frac{373 x^3}{9}+25 x^2-\\frac{427 x}{3}+52$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((4*x**2)/3)-9*x+4\nq = -((11*x**2)/3)-((19*x)/3)+13\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{15 x^2}{2}+2 x+\\frac{3}{2}$ when divided by $\\frac{1}{2}$.", + "Output Answer": [ + "$-15 x^2+4 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((15*x**2)/2)+2*x+(3/2)\nq = (1/2)\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((16-12)-23)+(((4+25)+1)-16)$.", + "Output Answer": [ + "$-5$" + ], + "Output Program": [ + "try: \n print(((16-12)-23)+(((4+25)+1)-16))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=1-i$ and $y=3-9 i$", + "Output Answer": [ + "$\\frac{2}{15}+\\frac{i}{15}$" + ], + "Output Program": [ + "i = 1j\nx = 1-i\ny = 3-9*i\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-16 x+11 y+24=0$, $-19 x-4 y+18=0$", + "Output Answer": [ + "$x=\\frac{14}{13}$, $y=-\\frac{8}{13}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-16*x+11*y+24, -19*x-4*y+18), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2+7 x+7 y^2-10 y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(y-\\frac{5}{7}\\right)^2-10 \\left(x-\\frac{7}{20}\\right)^2=\\frac{97}{280}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{7}{20} & \\frac{5}{7}-\\frac{\\sqrt{1649}}{140} \\\\\n \\frac{7}{20} & \\frac{1}{140} \\left(100+\\sqrt{1649}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{17}{10}}$\nCenter: $\\left\\{\\frac{7}{20},\\frac{1}{2} \\left(\\frac{5}{7}-\\frac{\\sqrt{1649}}{140}+\\frac{1}{140} \\left(100+\\sqrt{1649}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{140} \\left(100+7 \\sqrt{70}\\right)-\\sqrt{\\frac{10}{7}} x,y=\\sqrt{\\frac{10}{7}} x+\\frac{1}{140} \\left(100-7 \\sqrt{70}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2+7*x+7*y**2-10*y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{40}{31}$, and $a_n=a_{n-1}+-6 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$7 \\left(\\frac{80}{31}-78 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = (40/31) # initial value\nd = -6*math.sqrt(2) # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (40/31) # initial value\nd = -6*math.sqrt(2) # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\sqrt{3} \\left(\\cos \\left(\\frac{16}{9}\\right)+i \\sin \\left(\\frac{16}{9}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-3456 \\sqrt{3} \\left(\\cos \\left(\\frac{112}{9}\\right)+i \\sin \\left(\\frac{112}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*math.sqrt(3)*(math.cos((16/9))+1j*math.sin((16/9))))**7)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{2} \\left(-3 x^2+4 x-1\\right)$, $q(x) = \\sqrt{2} \\left(7 x^2+2 x-11\\right)$", + "Output Answer": [ + "$4 \\sqrt{2} x^2+6 \\sqrt{2} x-12 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(2)*(-3*x**2+4*x-1)\nq = sqrt(2)*(7*x**2+2*x-11)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^3-7 x^2+7 x-8$ when divided by $1$.", + "Output Answer": [ + "$-6 x^3-7 x^2+7 x-8$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**3-7*x**2+7*x-8\nq = 1\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-5 \\sqrt{2} e^{-\\frac{79 i \\pi }{90}}$.", + "Output Answer": [ + "Norm: $5 \\sqrt{2}$\nArgument: $\\frac{11 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -5*math.sqrt(2)*math.e**(-((79*i*math.pi)/90))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{19}{4} \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{6131066257801 \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)}{1048576}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(19/4)*(math.cos(((2*math.pi)/9))-1j*math.sin(((2*math.pi)/9))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $4 x^2-x+4$", + "Output Answer": [ + "$x=\\frac{1}{8} \\left(1-3 i \\sqrt{7}\\right)\\lor x=\\frac{1}{8} \\left(1+3 i \\sqrt{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(4*x**2-x+4, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $10 x^5+9 x^4-8 x^3-3 x^2-6 x+7$ when divided by $10 x^4+6 x^3-8 x^2-8 x+9$.", + "Output Answer": [ + "$x+\\frac{3}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x**5+9*x**4-8*x**3-3*x**2-6*x+7\nq = 10*x**4+6*x**3-8*x**2-8*x+9\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2-\\frac{187 x}{\\sqrt{2}}+924$", + "Output Answer": [ + "$11 \\left(-x-12 \\sqrt{2}\\right) \\left(x-\\frac{7}{\\sqrt{2}}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2-((187*x)/(sqrt(2)))+924, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $5 x^2+9 x+6$", + "Output Answer": [ + "$x=\\frac{1}{10} \\left(-9-i \\sqrt{39}\\right)\\lor x=\\frac{1}{10} \\left(-9+i \\sqrt{39}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(5*x**2+9*x+6, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{21}{29}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$\\frac{546}{29}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (21/29) # initial value\nd = 0 # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (21/29) # initial value\nd = 0 # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $15 x^2-\\frac{19 x}{2}+\\frac{5}{2}$", + "Output Answer": [ + "$15 \\left(x-\\frac{19}{60}\\right)^2+\\frac{239}{240}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (15*x**2-((19*x)/2)+(5/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{1}{(-2 x-8)^5}$ at the point $x=-5$", + "Output Answer": [ + "$\\frac{1}{32} = 0.031$" + ], + "Output Program": [ + "x = -5\ntry: \n f = (1/((-2*x-8)**5))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{85}{99}$, and $a_n=a_{n-1}+-10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$-\\frac{4045}{11}$" + ], + "Output Program": [ + "a = -(85/99) # initial value\nd = -10 # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(85/99) # initial value\nd = -10 # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-72 x^2+104 x-32}{36 x^2+218 x-104}=0$", + "Output Answer": [ + "$\\{\\{x\\to 1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-72*x**2+104*x-32)/(36*x**2+218*x-104)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{2 x^2}{\\sqrt{3}}+\\frac{4 x}{\\sqrt{3}}-\\frac{4}{\\sqrt{3}}\\right| =\\frac{8}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -1-\\sqrt{7}\\right\\},\\left\\{x\\to -1+\\sqrt{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((2*x**2)/(sqrt(3)))+((4*x)/(sqrt(3)))-(4/(sqrt(3)))), (8/(sqrt(3)))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-525 x^3-194 x^2-170 x-289}{294 x^2+511 x+221}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-525*x**3-194*x**2-170*x-289)/(294*x**2+511*x+221)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x-11}+\\sqrt{9 x-14}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{3} \\left(64-5 \\sqrt{145}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x-11)+sqrt(9*x-14), 5), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -9 \\sqrt{3} x^2-13 \\sqrt{3} x-\\sqrt{3}\\right| =5 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(-13-\\sqrt{313}\\right)\\right\\},\\left\\{x\\to \\frac{1}{18} \\left(-13+\\sqrt{313}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-9*sqrt(3)*x**2-13*sqrt(3)*x-sqrt(3)), 5*sqrt(3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^2-5 x-8$ when divided by $-7$.", + "Output Answer": [ + "$\\frac{5 x^2}{7}+\\frac{5 x}{7}+\\frac{8}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**2-5*x-8\nq = -7\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{27} \\left(16 t^2-416 t+2671\\right)^2, x(t)=\\frac{4 t^2}{3}-\\frac{104 t}{3}+\\frac{676}{3}$", + "Output Answer": [ + "$y=\\frac{16 x^2}{3}-\\frac{88 x}{3}+\\frac{121}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/27)*(16*t**2-416*t+2671)**2\nx_t = ((4*t**2)/3)-((104*t)/3)+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 \\sqrt{5} x^2+6 \\sqrt{5} x+5 \\sqrt{5}$ and $q(x) = \\sqrt{5} x^2+3 \\sqrt{5} x$", + "Output Answer": [ + "$-25 x^4-45 x^3+115 x^2+75 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -5*sqrt(5)*x**2+6*sqrt(5)*x+5*sqrt(5)\nq = sqrt(5)*x**2+3*sqrt(5)*x\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $8 x^6+16 x^5-10 x^4+20 x^2-4$ and $-2 x^5-3 x^4+4 x^3-2 x^2-4 x+2$.", + "Output Answer": [ + "$2 x^5+3 x^4-4 x^3+2 x^2+4 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(8*x**6+16*x**5-10*x**4+20*x**2-4, -2*x**5-3*x**4+4*x**3-2*x**2-4*x+2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-8 x^2-13 x-13$", + "Output Answer": [ + "$-8 \\left(x+\\frac{13}{16}\\right)^2-\\frac{247}{32}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-8*x**2-13*x-13), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{59 x^2}{4}-\\frac{17 x}{2}+\\frac{45}{4}$", + "Output Answer": [ + "$x=\\frac{1}{59} \\left(17-13 i \\sqrt{14}\\right)\\lor x=\\frac{1}{59} \\left(17+13 i \\sqrt{14}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((59*x**2)/4)-((17*x)/2)+(45/4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{27}{20}$, and $a_n=a_{n-1}+-\\frac{16}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$-\\frac{4721}{2}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(27/20) # initial value\nd = -(16/3) # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(27/20) # initial value\nd = -(16/3) # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 5 \\sqrt{5}-8 \\sqrt{5} x\\right| =2 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{8}\\right\\},\\left\\{x\\to \\frac{7}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(5*sqrt(5)-8*sqrt(5)*x), 2*sqrt(5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 x^2-9 x-\\frac{13}{2}$ and $q(x) = x^2+12 x-\\frac{25}{2}$", + "Output Answer": [ + "$-5 x^4-69 x^3-52 x^2+\\frac{69 x}{2}+\\frac{325}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -5*x**2-9*x-(13/2)\nq = x**2+12*x-(25/2)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2+3 x+6 y^2+3 y+10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y+\\frac{1}{4}\\right)^2-9 \\left(x-\\frac{1}{6}\\right)^2=-\\frac{79}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{12} \\left(2-\\sqrt{395}\\right) & -\\frac{1}{4} \\\\\n \\frac{1}{12} \\left(2+\\sqrt{395}\\right) & -\\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{12} \\left(2-\\sqrt{395}\\right)+\\frac{1}{12} \\left(2+\\sqrt{395}\\right)\\right),-\\frac{1}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{3}{2}} x+\\frac{1}{12} \\left(-3-\\sqrt{6}\\right),y=\\frac{1}{12} \\left(\\sqrt{6}-3\\right)-\\sqrt{\\frac{3}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2+3*x+6*y**2+3*y+10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 17 x^2+21 x+5\\right| =6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{34} \\left(-21-\\sqrt{509}\\right)\\right\\},\\left\\{x\\to \\frac{1}{34} \\left(-21+\\sqrt{509}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(17*x**2+21*x+5), 6), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2-4 x+4 y^2-9 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(y-\\frac{9}{8}\\right)^2-9 \\left(x+\\frac{2}{9}\\right)^2=\\frac{1097}{144}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{9} & \\frac{9}{8}-\\frac{\\sqrt{14261}}{72} \\\\\n -\\frac{2}{9} & \\frac{1}{72} \\left(81+\\sqrt{14261}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{13}}{3}$\nCenter: $\\left\\{-\\frac{2}{9},\\frac{1}{2} \\left(\\frac{9}{8}-\\frac{\\sqrt{14261}}{72}+\\frac{1}{72} \\left(81+\\sqrt{14261}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{19}{24}-\\frac{3 x}{2},y=\\frac{3 x}{2}+\\frac{35}{24}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2-4*x+4*y**2-9*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\pi \\left(-4 x^2-3 x+1\\right)$, $q(x) = \\pi \\left(-4 x^2+3 x-3\\right)$", + "Output Answer": [ + "$-8 \\pi x^2-2 \\pi$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = pi*(-4*x**2-3*x+1)\nq = pi*(-4*x**2+3*x-3)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{29 x^2}{4}-6 x+\\frac{23}{4}$", + "Output Answer": [ + "$\\frac{29}{4} \\left(x-\\frac{12}{29}\\right)^2+\\frac{523}{116}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((29*x**2)/4)-6*x+(23/4)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-112 x^2+254 x-144}{256-224 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{9}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-112*x**2+254*x-144)/(256-224*x)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-9 \\left(\\cos \\left(\\frac{8}{15}\\right)+i \\sin \\left(\\frac{8}{15}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$282429536481 \\left(\\cos \\left(\\frac{32}{5}\\right)+i \\sin \\left(\\frac{32}{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-9*(math.cos((8/15))+1j*math.sin((8/15))))**12)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{7912 x^3}{49}+\\frac{23360 x^2}{49}-\\frac{27844 x}{49}+\\frac{6868}{49}}{\\frac{9452}{49}-\\frac{23908 x}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{46} \\left(-77-15 \\sqrt{47}\\right)\\right\\},\\left\\{x\\to \\frac{1}{46} \\left(-77+15 \\sqrt{47}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((7912*x**3)/49)+((23360*x**2)/49)-((27844*x)/49)+(6868/49))/((9452/49)-((23908*x)/49))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $5 \\sqrt{2} \\left(\\cos \\left(\\frac{7 \\pi }{30}\\right)+i \\sin \\left(\\frac{7 \\pi }{30}\\right)\\right)$.", + "Output Answer": [ + "Norm: $5 \\sqrt{2 \\left(\\sin ^2\\left(\\frac{7 \\pi }{30}\\right)+\\cos ^2\\left(\\frac{7 \\pi }{30}\\right)\\right)}$\nArgument: $\\frac{7 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 5*math.sqrt(2)*(math.cos(((7*math.pi)/30))+i*math.sin(((7*math.pi)/30)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (3 x-2)^3, q(x) = -27 (x-1)^3$", + "Output Answer": [ + "$27 x^2-45 x+19$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (3*x-2)**3\nq = -27*(x-1)**3\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{23 x^2}{4}+\\frac{21 x}{4}+\\frac{35}{4}$", + "Output Answer": [ + "$x=\\frac{1}{46} \\left(21-\\sqrt{3661}\\right)\\lor x=\\frac{1}{46} \\left(21+\\sqrt{3661}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((23*x**2)/4)+((21*x)/4)+(35/4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{43}{34}$, and $a_n=a_{n-1}+\\frac{9}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$\\frac{36289}{34}$" + ], + "Output Program": [ + "a = (43/34) # initial value\nd = (9/2) # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (43/34) # initial value\nd = (9/2) # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$12 x+14 y+24 z-17=0$, $9 x+7 y-20 z+17=0$, $9 x-24 y-12 z-8=0$", + "Output Answer": [ + "$x=\\frac{1559}{3618}$, $y=-\\frac{356}{603}$, $z=\\frac{4039}{4824}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((12*x+14*y+24*z-17, 9*x+7*y-20*z+17, 9*x-24*y-12*z-8)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 9 x-20| =-17$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(9*x-20), -17), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{91}{64}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$-\\frac{273}{64}$" + ], + "Output Program": [ + "a = -(91/64) # initial value\nd = 0 # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(91/64) # initial value\nd = 0 # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{21 x^2}{5}+\\frac{26 x}{5}-6$", + "Output Answer": [ + "$-\\frac{21}{5} \\left(x-\\frac{13}{21}\\right)^2-\\frac{461}{105}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((21*x**2)/5)+((26*x)/5)-6), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x^5-\\frac{35 x^4}{4}+5 x^3+\\frac{45 x^2}{4}-\\frac{5 x}{4}+\\frac{35}{4}$ and $-2 x^5+\\frac{7 x^4}{2}-2 x^3-\\frac{9 x^2}{2}+\\frac{x}{2}-\\frac{7}{2}$.", + "Output Answer": [ + "$x^5-\\frac{7 x^4}{4}+x^3+\\frac{9 x^2}{4}-\\frac{x}{4}+\\frac{7}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x**5-((35*x**4)/4)+5*x**3+((45*x**2)/4)-((5*x)/4)+(35/4), -2*x**5+((7*x**4)/2)-2*x**3-((9*x**2)/2)+(x/2)-(7/2)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^4+2 x^3+9 x^2-7 x-4$ when divided by $-3 x^3+7 x^2+7$.", + "Output Answer": [ + "$-\\frac{8 x}{3}-\\frac{62}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**4+2*x**3+9*x**2-7*x-4\nq = -3*x**3+7*x**2+7\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{88 x^2}{7}-\\frac{59 x}{7}-\\frac{96}{7}$", + "Output Answer": [ + "$\\frac{88}{7} \\left(x-\\frac{59}{176}\\right)^2-\\frac{37273}{2464}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((88*x**2)/7)-((59*x)/7)-(96/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-24 x-14 y+6 z+17=0$, $11 x+11 y-13 z+16=0$, $-8 x-7 y-23 z-17=0$", + "Output Answer": [ + "$x=\\frac{1137}{277}$, $y=-\\frac{6617}{1108}$, $z=-\\frac{387}{1108}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-24*x-14*y+6*z+17, 11*x+11*y-13*z+16, -8*x-7*y-23*z-17)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{49} \\left(-21600 t^2-75600 t-65863\\right), x(t)=\\frac{3600 t^2}{49}+\\frac{1800 t}{7}+225$", + "Output Answer": [ + "$y=\\frac{41}{7}-6 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/49)*(-21600*t**2-75600*t-65863)\nx_t = ((3600*t**2)/49)+((1800*t)/7)+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -24 x^2+24 x-4\\right| =-4$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-24*x**2+24*x-4), -4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(\\cos \\left(\\frac{29}{15}\\right)+i \\sin \\left(\\frac{29}{15}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-40353607 \\left(\\cos \\left(\\frac{87}{5}\\right)+i \\sin \\left(\\frac{87}{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(math.cos((29/15))+1j*math.sin((29/15))))**9)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -7 x^2-13 x+11$ and $q(x) = -8 x^2+12 x+15$", + "Output Answer": [ + "$56 x^4+20 x^3-349 x^2-63 x+165$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -7*x**2-13*x+11\nq = -8*x**2+12*x+15\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2+3 x+10 y^2+5 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x+\\frac{3}{10}\\right)^2+10 \\left(y+\\frac{1}{4}\\right)^2=\\frac{363}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{20} \\left(-6-11 \\sqrt{3}\\right) & -\\frac{1}{4} \\\\\n \\frac{1}{20} \\left(11 \\sqrt{3}-6\\right) & -\\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{20} \\left(-6-11 \\sqrt{3}\\right)+\\frac{1}{20} \\left(11 \\sqrt{3}-6\\right)\\right),-\\frac{1}{4}\\right\\}$\nArea Enclosed: $\\frac{363 \\pi }{200 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2+3*x+10*y**2+5*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$23 x-9 y-23=0$, $7 x-y+13=0$", + "Output Answer": [ + "$x=-\\frac{7}{2}$, $y=-\\frac{23}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((23*x-9*y-23, 7*x-y+13), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-4 x-21 y-20 z-9=0$, $8 x+9 y-9 z+8=0$, $14 x-9 y-9 z+17=0$", + "Output Answer": [ + "$x=-\\frac{851}{638}$, $y=\\frac{53}{957}$, $z=-\\frac{7}{29}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-4*x-21*y-20*z-9, 8*x+9*y-9*z+8, 14*x-9*y-9*z+17)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+6 x+6 y^2+4 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x+\\frac{3}{8}\\right)^2+6 \\left(y+\\frac{1}{3}\\right)^2=\\frac{139}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{8} & \\frac{1}{24} \\left(-8-\\sqrt{139}\\right) \\\\\n -\\frac{3}{8} & \\frac{1}{24} \\left(\\sqrt{139}-8\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{2}$\nCenter: $\\left\\{-\\frac{3}{8},\\frac{1}{2} \\left(\\frac{1}{24} \\left(-8-\\sqrt{139}\\right)+\\frac{1}{24} \\left(\\sqrt{139}-8\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{139 \\pi }{96 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+6*x+6*y**2+4*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 14 x+11| =8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{19}{14}\\right\\},\\left\\{x\\to -\\frac{3}{14}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(14*x+11), 8), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{3 \\left(\\sin \\left(\\frac{7 \\pi }{30}\\right)+i \\cos \\left(\\frac{7 \\pi }{30}\\right)\\right)}{\\sqrt{2}}\\right)^5$", + "Output Answer": [ + "$\\frac{243 \\left(-\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)}{4 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((3*(math.sin(((7*math.pi)/30))+1j*math.cos(((7*math.pi)/30))))/(math.sqrt(2))))**5)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 21 x+1| =\\frac{73}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{11}{12}\\right\\},\\left\\{x\\to \\frac{23}{28}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(21*x+1), (73/4)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8-14 x}+\\sqrt{-11 x-12}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-565+10 \\sqrt{3082}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8-14*x)+sqrt(-11*x-12), 5), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{(23-18)+11}{\\left(((25-22)+7)^2+11\\right)-8}$.", + "Output Answer": [ + "$\\frac{16}{103}$" + ], + "Output Program": [ + "try: \n print((((23-18)+11)/((((25-22)+7)**2+11)-8)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sin (2 x+8)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{2} (2 \\pi c_1-8)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\},\\left\\{x\\to \\fbox{$\\frac{1}{2} (2 \\pi c_1+\\pi -8)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(sin(2*x+8), x)\n print(soln)\nexcept: ...\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{74}{95}$, and $a_n=a_{n-1}+2$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$\\frac{27738}{95}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(74/95) # initial value\nd = 2 # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(74/95) # initial value\nd = 2 # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-6 \\sqrt{2} x-17 \\sqrt{2} y+3 \\sqrt{2}=0$, $-11 \\sqrt{2} x+4 \\sqrt{2} y+14 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{250}{211}$, $y=-\\frac{51}{211}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-6*sqrt(2)*x-17*sqrt(2)*y+3*sqrt(2), -11*sqrt(2)*x+4*sqrt(2)*y+14*sqrt(2)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-2 \\left(9 t^2+90 t+224\\right), x(t)=9 t^2+90 t+225$", + "Output Answer": [ + "$y=2-2 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -2*(9*t**2+90*t+224)\nx_t = 9*t**2+90*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-0.704207-1.32442 i$.", + "Output Answer": [ + "Norm: $1.5$\nArgument: $-2.05949$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -0.704207-1.32442*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{4}, 5, \\frac{1}{2})$", + "Output Answer": [ + "$\\left\\{\\frac{9 \\sqrt{5}}{4},\\tan ^{-1}\\left(\\frac{\\sqrt{401}}{2}\\right),\\tan ^{-1}(20)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/4)\ny = 5\nz = (1/2)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2+8 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $2 x^2+8 y=7$\nVertex: $\\left\\{0,\\frac{7}{8}\\right\\}$\nDirectrix: $y=\\frac{15}{8}$\nFocal Parameter: $2$\nFocus: $\\left\\{0,-\\frac{1}{8}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2+8*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(-\\cos \\left(\\frac{13 \\pi }{90}\\right)-i \\sin \\left(\\frac{13 \\pi }{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-2048 \\left(-\\sin \\left(\\frac{4 \\pi }{45}\\right)+i \\cos \\left(\\frac{4 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(-math.cos(((13*math.pi)/90))-1j*math.sin(((13*math.pi)/90))))**11)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{19+18}{7}+1\\right)+(((10-8)+9)-25)$.", + "Output Answer": [ + "$-\\frac{54}{7}$" + ], + "Output Program": [ + "try: \n print((((19+18)/7)+1)+(((10-8)+9)-25))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2 x^5-x^4+x^3+2 x^2-2 x+3$ and $2 x^5+x^4-x^3-2 x^2+2 x-3$.", + "Output Answer": [ + "$2 x^5+x^4-x^3-2 x^2+2 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2*x**5-x**4+x**3+2*x**2-2*x+3, 2*x**5+x**4-x**3-2*x**2+2*x-3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(19-4)+(21-15)$.", + "Output Answer": [ + "$21$" + ], + "Output Program": [ + "try: \n print((19-4)+(21-15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=9 \\left(32 t^2+160 t+199\\right), x(t)=36 t^2+180 t+225$", + "Output Answer": [ + "$y=8 x-9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 9*(32*t**2+160*t+199)\nx_t = 36*t**2+180*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{93}{28}$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$-\\frac{6999}{4}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(93/28) # initial value\nd = -8 # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(93/28) # initial value\nd = -8 # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -4 x-7, q(x) = -(2 x-3)^3$", + "Output Answer": [ + "$-8 x^3+36 x^2-58 x+20$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x-7\nq = -(2*x-3)**3\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2-\\frac{1595 x}{7}-\\frac{48246}{49}$", + "Output Answer": [ + "$11 \\left(-x-\\frac{102}{7}\\right) \\left(x+\\frac{43}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2-((1595*x)/7)-(48246/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{15}{7}+\\frac{52 i}{7}$ and $y=-2-\\frac{39 i}{7}$", + "Output Answer": [ + "$\\frac{29}{7}+13 i$" + ], + "Output Program": [ + "i = 1j\nx = (15/7)+((52*i)/7)\ny = -2-((39*i)/7)\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-8 \\sqrt{5} x-10 \\sqrt{5} y+9 \\sqrt{5}=0$, $7 \\sqrt{5} x+7 \\sqrt{5} y-2 \\sqrt{5}=0$", + "Output Answer": [ + "$x=-\\frac{43}{14}$, $y=\\frac{47}{14}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-8*sqrt(5)*x-10*sqrt(5)*y+9*sqrt(5), 7*sqrt(5)*x+7*sqrt(5)*y-2*sqrt(5)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{111 x}{5}+\\frac{97 y}{5}-\\frac{54 z}{5}+\\frac{91}{5}=0$, $\\frac{27 x}{5}+\\frac{39 y}{5}+\\frac{42 z}{5}+\\frac{87}{5}=0$, $-\\frac{99 x}{5}+\\frac{22 y}{5}+\\frac{52 z}{5}+\\frac{48}{5}=0$", + "Output Answer": [ + "$x=-\\frac{4030}{25073}$, $y=-\\frac{36656}{25073}$, $z=-\\frac{30617}{50146}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((111*x)/5)+((97*y)/5)-((54*z)/5)+(91/5), ((27*x)/5)+((39*y)/5)+((42*z)/5)+(87/5), -((99*x)/5)+((22*y)/5)+((52*z)/5)+(48/5))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^6+x^5-6 x^4+4 x^3-7 x^2-x-10$ when divided by $x^5-6 x^4-5 x^3+3 x^2-2 x+2$.", + "Output Answer": [ + "$8 x+49$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**6+x**5-6*x**4+4*x**3-7*x**2-x-10\nq = x**5-6*x**4-5*x**3+3*x**2-2*x+2\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-8 e^{-1-\\frac{2 i \\pi }{3}}$.", + "Output Answer": [ + "Norm: $\\frac{8}{e}$\nArgument: $\\frac{\\pi }{3}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -8*math.e**(-1-((2*i*math.pi)/3))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $4 x^2+x+12$", + "Output Answer": [ + "$4 \\left(x+\\frac{1}{8}\\right)^2+\\frac{191}{16}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (4*x**2+x+12), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2+7 x+3 y^2+7 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(y+\\frac{7}{6}\\right)^2-7 \\left(x-\\frac{1}{2}\\right)^2=-\\frac{8}{3}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2}-\\frac{4 \\sqrt{\\frac{5}{7}}}{3} & -\\frac{7}{6} \\\\\n \\frac{1}{2}+\\frac{4 \\sqrt{\\frac{5}{7}}}{3} & -\\frac{7}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{10}{3}}$\nCenter: $\\left\\{\\frac{1}{2},-\\frac{7}{6}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{7}{3}} x+\\frac{1}{6} \\left(-7-\\sqrt{21}\\right),y=\\frac{1}{6} \\left(\\sqrt{21}-7\\right)-\\sqrt{\\frac{7}{3}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2+7*x+3*y**2+7*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-10 x^2-5 x-5$ and $-2 x^2-x-1$.", + "Output Answer": [ + "$2 x^2+x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-10*x**2-5*x-5, -2*x**2-x-1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{29+18 i}{\\pi }$ and $y=-\\frac{2+8 i}{\\pi }$", + "Output Answer": [ + "$\\frac{27+10 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((29+18*i)/math.pi)\ny = -((2+8*i)/math.pi)\nprint(x+y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(9-2)^2 (16-4)$.", + "Output Answer": [ + "$588$" + ], + "Output Program": [ + "try: \n print((9-2)**2*(16-4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\left(-\\cos \\left(\\frac{17 \\pi }{90}\\right)-i \\sin \\left(\\frac{17 \\pi }{90}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$216 \\left(\\sin \\left(\\frac{\\pi }{15}\\right)-i \\cos \\left(\\frac{\\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*(-math.cos(((17*math.pi)/90))-1j*math.sin(((17*math.pi)/90))))**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{25}{97}$, and $a_n=a_{n-1}+4 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$\\frac{15}{2} \\left(56 \\sqrt{3}-\\frac{50}{97}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(25/97) # initial value\nd = 4*math.sqrt(3) # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(25/97) # initial value\nd = 4*math.sqrt(3) # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\sqrt{3} \\left(-\\sin \\left(\\frac{17 \\pi }{90}\\right)+i \\cos \\left(\\frac{17 \\pi }{90}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$19683 \\left(\\cos \\left(\\frac{2 \\pi }{15}\\right)+i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*math.sqrt(3)*(-math.sin(((17*math.pi)/90))+1j*math.cos(((17*math.pi)/90))))**6)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{16}+33\\right) \\sqrt{160}$.", + "Output Answer": [ + "$148 \\sqrt{10}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(16)+33)*sqrt(160))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=91$, and $a_n=a_{n-1}+-\\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$12 \\left(182-23 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\na = 91 # initial value\nd = -math.sqrt(3) # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 91 # initial value\nd = -math.sqrt(3) # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x-9}+\\sqrt{2 x-15}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 2 \\left(99-40 \\sqrt{5}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x-9)+sqrt(2*x-15), 8), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-x^3+9 x^2-3 x-9$ when divided by $9 x^2+5 x+4$.", + "Output Answer": [ + "$\\frac{86}{81}-\\frac{x}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**3+9*x**2-3*x-9\nq = 9*x**2+5*x+4\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{17 e^{\\frac{67 i \\pi }{90}}}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $\\frac{17}{\\sqrt{\\pi }}$\nArgument: $\\frac{67 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((17*math.e**((67*i*math.pi)/90))/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{52}{7} e^{\\frac{9 i \\pi }{10}}$.", + "Output Answer": [ + "Norm: $\\frac{52}{7}$\nArgument: $\\tan ^{-1}\\left(\\frac{\\Im\\left(e^{\\frac{9 i \\pi }{10}}\\right)}{\\Re\\left(e^{\\frac{9 i \\pi }{10}}\\right)}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(52/7)*math.e**((9*i*math.pi)/10)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=7 t+\\frac{215}{2}, x(t)=-t-15$", + "Output Answer": [ + "$y=\\frac{5}{2}-7 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 7*t+(215/2)\nx_t = -t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{15}+\\sqrt{26}}{\\sqrt{\\sqrt{102}-\\sqrt{80}}}$.", + "Output Answer": [ + "$\\frac{\\sqrt{15}+\\sqrt{26}}{\\sqrt[4]{2} \\sqrt{\\sqrt{51}-2 \\sqrt{10}}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(15)+sqrt(26))/(sqrt(sqrt(102)-sqrt(80)))))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(-\\cos \\left(\\frac{13 \\pi }{90}\\right)-i \\sin \\left(\\frac{13 \\pi }{90}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$49 \\left(\\sin \\left(\\frac{19 \\pi }{90}\\right)+i \\cos \\left(\\frac{19 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(-math.cos(((13*math.pi)/90))-1j*math.sin(((13*math.pi)/90))))**2)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-144 x^2-292 x-64}{-160 x-40}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{16}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-144*x**2-292*x-64)/(-160*x-40)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{11 x}{4}+11 y-\\frac{47}{2}=0$, $\\frac{5 x}{2}+\\frac{45 y}{2}+\\frac{21}{2}=0$", + "Output Answer": [ + "$x=-\\frac{5154}{715}$, $y=\\frac{239}{715}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((11*x)/4)+11*y-(47/2), ((5*x)/2)+((45*y)/2)+(21/2)), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\sqrt{2} \\left(\\cos \\left(\\frac{53}{90}\\right)+i \\sin \\left(\\frac{53}{90}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1889568 \\left(\\cos \\left(\\frac{53}{9}\\right)+i \\sin \\left(\\frac{53}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*math.sqrt(2)*(math.cos((53/90))+1j*math.sin((53/90))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(2-15)-\\frac{\\frac{5+15}{14}}{12}$.", + "Output Answer": [ + "$-\\frac{551}{42}$" + ], + "Output Program": [ + "try: \n print((2-15)-(((5+15)/14)/12))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{2 \\left(\\cos \\left(\\frac{2 \\pi }{15}\\right)+i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)}{\\sqrt{3}}\\right)^6$", + "Output Answer": [ + "$\\frac{64}{27} \\left(\\frac{1}{4} \\left(-1-\\sqrt{5}\\right)+i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((2*(math.cos(((2*math.pi)/15))+1j*math.sin(((2*math.pi)/15))))/(math.sqrt(3))))**6)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-x^6+7 x^5-8 x^4-3 x^3-2 x^2+7 x$ when divided by $7 x^2+5 x+2$.", + "Output Answer": [ + "$-\\frac{x^4}{7}+\\frac{54 x^3}{49}-\\frac{648 x^2}{343}+\\frac{1455 x}{2401}-\\frac{3005}{16807}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**6+7*x**5-8*x**4-3*x**3-2*x**2+7*x\nq = 7*x**2+5*x+2\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt[3]{131}}{\\sqrt[3]{\\sqrt[3]{139}}}$.", + "Output Answer": [ + "$\\frac{\\sqrt[3]{131}}{\\sqrt[9]{139}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((cbrt(131))/(cbrt(cbrt(139)))))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$9 x+23 y+3=0$, $-13 x-23 y-3=0$", + "Output Answer": [ + "$x=0$, $y=-\\frac{3}{23}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((9*x+23*y+3, -13*x-23*y-3), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{12-9 i}{\\sqrt{2}}$ and $y=\\frac{12+3 i}{\\sqrt{2}}$", + "Output Answer": [ + "$6 i \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((12-9*i)/(math.sqrt(2)))\ny = ((12+3*i)/(math.sqrt(2)))\nprint(x+y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{84}{5}$, and $a_n=a_{n-1}+-\\frac{3}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$-\\frac{5319}{10}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(84/5) # initial value\nd = -(3/2) # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(84/5) # initial value\nd = -(3/2) # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{11}{3}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$\\frac{319}{3}$" + ], + "Output Program": [ + "a = (11/3) # initial value\nd = 0 # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (11/3) # initial value\nd = 0 # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -x^2-23 x+4\\right| =-4$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-x**2-23*x+4), -4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -11 x^2+10 x-9$ and $q(x) = 9 x^2-10 x$", + "Output Answer": [ + "$-99 x^4+200 x^3-181 x^2+90 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -11*x**2+10*x-9\nq = 9*x**2-10*x\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-0.397018-0.0487477 i$.", + "Output Answer": [ + "Norm: $0.4$\nArgument: $-3.01942$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -0.397018-0.0487477*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2+8 x-2 y^2+6 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(x+\\frac{2}{5}\\right)^2-2 \\left(y-\\frac{3}{2}\\right)^2=-\\frac{39}{10}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{5} & -\\frac{3}{10} \\left(\\sqrt{26}-5\\right) \\\\\n -\\frac{2}{5} & \\frac{3}{10} \\left(5+\\sqrt{26}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{6}{5}}$\nCenter: $\\left\\{-\\frac{2}{5},\\frac{1}{2} \\left(\\frac{3}{10} \\left(5+\\sqrt{26}\\right)-\\frac{3}{10} \\left(\\sqrt{26}-5\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{10} \\left(15-4 \\sqrt{5}\\right)-\\sqrt{5} x,y=\\sqrt{5} x+\\frac{1}{10} \\left(15+4 \\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2+8*x-2*y**2+6*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-3$ when divided by $2 x+1$.", + "Output Answer": [ + "$0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3\nq = 2*x+1\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{56}{3}$, and $a_n=a_{n-1}+3 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$2 \\left(\\frac{112}{3}+9 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (56/3) # initial value\nd = 3*math.sqrt(3) # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (56/3) # initial value\nd = 3*math.sqrt(3) # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{10-12 i}{e}$.", + "Output Answer": [ + "Norm: $\\frac{2 \\sqrt{61}}{e}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{6}{5}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((10-12*i)/math.e)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = x^2+11 x+6$ and $q(x) = -7 x^2-14 x-6$", + "Output Answer": [ + "$-7 x^4-91 x^3-202 x^2-150 x-36$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = x**2+11*x+6\nq = -7*x**2-14*x-6\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{x}{4}+\\frac{17}{2}}+\\sqrt{9 x-\\frac{9}{4}}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3 \\left(8839-52 \\sqrt{7499}\\right)}{1225}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((x/4)+(17/2))+sqrt(9*x-(9/4)), 13), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{2}{3} \\left(49 t+4 \\sqrt{3}-182\\right), x(t)=\\frac{7 t}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=\\frac{14 x}{\\sqrt{3}}+\\frac{8}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (2/3)*(49*t+4*sqrt(3)-182)\nx_t = ((7*t)/(sqrt(3)))-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^5+4 x^3+5 x^2-5 x-1$ when divided by $6 x^5-7 x^4+2 x^3-7 x^2-8 x-7$.", + "Output Answer": [ + "$-\\frac{7}{6}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**5+4*x**3+5*x**2-5*x-1\nq = 6*x**5-7*x**4+2*x**3-7*x**2-8*x-7\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all roots of the following function: $-\\tan \\left(\\frac{13 x}{2}+5\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{2}{13} (\\pi c_1-5)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(-tan(((13*x)/2)+5), x)\n print(soln)\nexcept: ...\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2$ and $5 x^2-5 x-2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2, 5*x**2-5*x-2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -2 \\sqrt{2} x^2-7 \\sqrt{2} x-8 \\sqrt{2}$ and $q(x) = 4 \\sqrt{2} x^2+\\sqrt{2} x-6 \\sqrt{2}$", + "Output Answer": [ + "$-16 x^4-60 x^3-54 x^2+68 x+96$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -2*sqrt(2)*x**2-7*sqrt(2)*x-8*sqrt(2)\nq = 4*sqrt(2)*x**2+sqrt(2)*x-6*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((((18-12)-18)-19)-1)+((21-7)+12)^2$.", + "Output Answer": [ + "$644$" + ], + "Output Program": [ + "try: \n print(((((18-12)-18)-19)-1)+((21-7)+12)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{704 t^2-4576 t+7481}{3 \\sqrt{3}}, x(t)=\\frac{64 t^2}{3}-\\frac{416 t}{3}+\\frac{676}{3}$", + "Output Answer": [ + "$y=-\\frac{11 x}{\\sqrt{3}}-5 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -((704*t**2-4576*t+7481)/(3*sqrt(3)))\nx_t = ((64*t**2)/3)-((416*t)/3)+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-6+2 i$ and $y=-2+7 i$", + "Output Answer": [ + "$\\frac{26}{53}+\\frac{38 i}{53}$" + ], + "Output Program": [ + "i = 1j\nx = -6+2*i\ny = -2+7*i\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2-\\frac{5 x}{2}+\\frac{2013}{4}$", + "Output Answer": [ + "$-2 \\left(x-\\frac{61}{4}\\right) \\left(x+\\frac{33}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2-((5*x)/2)+(2013/4), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{61 x^2}{7}+\\frac{52 x}{7}+\\frac{64}{7}$", + "Output Answer": [ + "$x=\\frac{2}{61} \\left(-13-i \\sqrt{807}\\right)\\lor x=\\frac{2}{61} \\left(-13+i \\sqrt{807}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((61*x**2)/7)+((52*x)/7)+(64/7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{480 x^2-158 x-63}{-144 x^2+369 x-162}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{30}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((480*x**2-158*x-63)/(-144*x**2+369*x-162)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{79}{92}$, and $a_n=a_{n-1}+4 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$5 \\left(36 \\sqrt{3}-\\frac{79}{46}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(79/92) # initial value\nd = 4*math.sqrt(3) # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(79/92) # initial value\nd = 4*math.sqrt(3) # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $7 x$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{y}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, 7*x)\nprint(solve(f, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-11 x-13 y-23 z+3=0$, $16 x-6 y-20 z-10=0$, $-19 x+7 y+22 z-5=0$", + "Output Answer": [ + "$x=-\\frac{918}{203}$, $y=\\frac{701}{29}$, $z=-\\frac{2308}{203}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-11*x-13*y-23*z+3, 16*x-6*y-20*z-10, -19*x+7*y+22*z-5)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((20+23)-14) \\left(\\left(\\left((18+25)^2+20\\right)+21\\right)-7\\right)$.", + "Output Answer": [ + "$54607$" + ], + "Output Program": [ + "try: \n print(((20+23)-14)*((((18+25)**2+20)+21)-7))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{45 x^2}{4}+\\frac{x}{4}+\\frac{19}{4}$", + "Output Answer": [ + "$\\frac{3421}{720}-\\frac{45}{4} \\left(x-\\frac{1}{90}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((45*x**2)/4)+(x/4)+(19/4)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{17-12 i}{e}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{433}}{e}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{12}{17}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((17-12*i)/math.e)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(\\cos \\left(\\frac{19}{15}\\right)+i \\sin \\left(\\frac{19}{15}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$2187 \\left(\\cos \\left(\\frac{133}{15}\\right)+i \\sin \\left(\\frac{133}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(math.cos((19/15))+1j*math.sin((19/15))))**7)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8 x-6}+\\sqrt{15 x+14}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(3747-26 \\sqrt{18866}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8*x-6)+sqrt(15*x+14), 13), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 15 \\sqrt{2}-\\frac{31 x}{\\sqrt{2}}\\right| =12 \\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{6}{31}\\right\\},\\left\\{x\\to \\frac{54}{31}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(15*sqrt(2)-((31*x)/(sqrt(2)))), 12*sqrt(2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{35 x^2}{\\pi }+\\frac{12 x}{\\pi }-\\frac{41}{\\pi }$ and $q(x) = \\frac{22 x^2}{\\pi }-\\frac{42 x}{\\pi }-\\frac{40}{\\pi }$", + "Output Answer": [ + "$\\frac{770 x^4}{\\pi ^2}-\\frac{1206 x^3}{\\pi ^2}-\\frac{2806 x^2}{\\pi ^2}+\\frac{1242 x}{\\pi ^2}+\\frac{1640}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((35*x**2)/pi)+((12*x)/pi)-(41/pi)\nq = ((22*x**2)/pi)-((42*x)/pi)-(40/pi)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{18 x}{5}-\\frac{119 y}{5}-\\frac{42}{5}=0$, $2 x+\\frac{104 y}{5}+19=0$", + "Output Answer": [ + "$x=\\frac{6937}{682}$, $y=-\\frac{645}{341}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((18*x)/5)-((119*y)/5)-(42/5), 2*x+((104*y)/5)+19), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{54}{47}$, and $a_n=a_{n-1}+-3$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$-\\frac{23085}{47}$" + ], + "Output Program": [ + "a = (54/47) # initial value\nd = -3 # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (54/47) # initial value\nd = -3 # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((((21+23)+13)-25)+3) (16+14)^2$.", + "Output Answer": [ + "$31500$" + ], + "Output Program": [ + "try: \n print(((((21+23)+13)-25)+3)*(16+14)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{19 x^2}{4}+2 x+6$ and $q(x) = -10 x^2+\\frac{25 x}{2}-\\frac{13}{2}$", + "Output Answer": [ + "$-\\frac{95 x^4}{2}+\\frac{315 x^3}{8}-\\frac{527 x^2}{8}+62 x-39$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((19*x**2)/4)+2*x+6\nq = -10*x**2+((25*x)/2)-(13/2)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-3 x-3 y^2-5 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x-\\frac{3}{16}\\right)^2-3 \\left(y+\\frac{5}{6}\\right)^2=\\frac{115}{96}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{48} \\left(9-\\sqrt{1265}\\right) & -\\frac{5}{6} \\\\\n \\frac{1}{48} \\left(9+\\sqrt{1265}\\right) & -\\frac{5}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{11}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{48} \\left(9-\\sqrt{1265}\\right)+\\frac{1}{48} \\left(9+\\sqrt{1265}\\right)\\right),-\\frac{5}{6}\\right\\}$\nAsymptotes: $\\left\\{y=2 \\sqrt{\\frac{2}{3}} x+\\frac{1}{24} \\left(-20-3 \\sqrt{6}\\right),y=\\frac{1}{24} \\left(3 \\sqrt{6}-20\\right)-2 \\sqrt{\\frac{2}{3}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-3*x-3*y**2-5*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-7 x^3-147 x^2-126 x+7560$", + "Output Answer": [ + "$7 (6-x) (x+12) (x+15)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-7*x**3-147*x**2-126*x+7560, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{3}{2}-\\frac{5 i}{2}$ and $y=-\\frac{17}{2}-3 i$", + "Output Answer": [ + "$-10-\\frac{11 i}{2}$" + ], + "Output Program": [ + "i = 1j\nx = -(3/2)-((5*i)/2)\ny = -(17/2)-3*i\nprint(x+y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(23+18)+\\frac{20}{10}$.", + "Output Answer": [ + "$43$" + ], + "Output Program": [ + "try: \n print((23+18)+(20/10))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{3 x}{\\sqrt{2}}+2 \\sqrt{2} y-15 \\sqrt{2} z+\\frac{3}{\\sqrt{2}}=0$, $-2 \\sqrt{2} x+\\frac{11 y}{\\sqrt{2}}-\\frac{35 z}{\\sqrt{2}}+\\frac{23}{\\sqrt{2}}=0$, $-\\frac{31 x}{\\sqrt{2}}+12 \\sqrt{2} y+\\frac{21 z}{\\sqrt{2}}+\\frac{7}{\\sqrt{2}}=0$", + "Output Answer": [ + "$x=-\\frac{481}{203}$, $y=-\\frac{663}{203}$, $z=-\\frac{20}{203}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((3*x)/(sqrt(2)))+2*sqrt(2)*y-15*sqrt(2)*z+(3/(sqrt(2))), -2*sqrt(2)*x+((11*y)/(sqrt(2)))-((35*z)/(sqrt(2)))+(23/(sqrt(2))), -((31*x)/(sqrt(2)))+12*sqrt(2)*y+((21*z)/(sqrt(2)))+(7/(sqrt(2))))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-9 \\left(-25 t^2+10 \\left(\\sqrt{3}-9\\right) t+18 \\sqrt{3}-84\\right), x(t)=-5 \\sqrt{3} t-9 \\sqrt{3}$", + "Output Answer": [ + "$y=3 x^2+18 x+27$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -9*(-25*t**2+10*(sqrt(3)-9)*t+18*sqrt(3)-84)\nx_t = -5*sqrt(3)*t-9*sqrt(3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{x-2}+\\cos (7-2 x)$ at the point $x=0$", + "Output Answer": [ + "$-\\sqrt[3]{2}+\\cos (7) = -0.506$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 0\ntry: \n f = np.cbrt(x-2)+math.cos(7-2*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{162}-\\left(65-\\sqrt{66}\\right)$.", + "Output Answer": [ + "$-65+9 \\sqrt{2}+\\sqrt{66}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(162)-(65-sqrt(66)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\sqrt{2} \\left(-\\cos \\left(\\frac{\\pi }{15}\\right)-i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\sqrt{2 \\left(\\sin ^2\\left(\\frac{\\pi }{15}\\right)+\\cos ^2\\left(\\frac{\\pi }{15}\\right)\\right)}$\nArgument: $\\frac{\\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.sqrt(2)*(-math.cos((math.pi/15))-i*math.sin((math.pi/15)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-13 x-\\frac{25}{2}}+\\sqrt{\\frac{5}{2}-\\frac{9 x}{2}}=\\frac{21}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{578} \\left(-16455+336 \\sqrt{1801}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-13*x-(25/2))+sqrt((5/2)-((9*x)/2)), (21/2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$21 x-10 y-21=0$, $24 x-13 y-1=0$", + "Output Answer": [ + "$x=\\frac{263}{33}$, $y=\\frac{161}{11}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((21*x-10*y-21, 24*x-13*y-1), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 7 x^2-13 x-14$, $q(x) = -5 x^2-8 x+9$", + "Output Answer": [ + "$2 x^2-21 x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**2-13*x-14\nq = -5*x**2-8*x+9\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+5 x+10 y^2+9 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x+\\frac{5}{8}\\right)^2+10 \\left(y+\\frac{9}{20}\\right)^2=\\frac{607}{80}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{8}-\\frac{\\sqrt{1821}}{40} & -\\frac{9}{20} \\\\\n \\frac{1}{40} \\left(\\sqrt{1821}-25\\right) & -\\frac{9}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{5}{8}-\\frac{\\sqrt{1821}}{40}+\\frac{1}{40} \\left(\\sqrt{1821}-25\\right)\\right),-\\frac{9}{20}\\right\\}$\nArea Enclosed: $\\frac{607 \\pi }{160 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+5*x+10*y**2+9*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{625}{64} (32-11 t)^2, x(t)=\\frac{11 t}{2}-15$", + "Output Answer": [ + "$y=\\frac{625 x^2}{16}-\\frac{625 x}{8}+\\frac{625}{16}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (625/64)*(32-11*t)**2\nx_t = ((11*t)/2)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x$ and $2 x^4+3 x^3-4 x^2-2 x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x, 2*x**4+3*x**3-4*x**2-2*x-3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2-20 x+1260$", + "Output Answer": [ + "$5 (-x-18) (x-14)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2-20*x+1260, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-9+9 i$ and $y=5+5 i$", + "Output Answer": [ + "$-14+4 i$" + ], + "Output Program": [ + "i = 1j\nx = -9+9*i\ny = 5+5*i\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-5 x^2-3 x-10$", + "Output Answer": [ + "$-5 \\left(x+\\frac{3}{10}\\right)^2-\\frac{191}{20}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-5*x**2-3*x-10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-8 x+4 y^2-9 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Circle\nEquation: $4 (x-1)^2+4 \\left(y-\\frac{9}{8}\\right)^2=\\frac{257}{16}$\nRadius: $\\frac{\\sqrt{257}}{8}$\nCircumference: $\\frac{\\sqrt{257} \\pi }{4}$\nCenter: $\\left\\{1,\\frac{9}{8}\\right\\}$\nArea Enclosed: $\\frac{257 \\pi }{64}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-8*x+4*y**2-9*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{16}{12}}{14-21}$.", + "Output Answer": [ + "$-\\frac{4}{21}$" + ], + "Output Program": [ + "try: \n print(((16/12)/(14-21)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{72}{77}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=12$.", + "Output Answer": [ + "$-\\frac{864}{77}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(72/77) # initial value\nd = 0 # second term\nn = 12 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(72/77) # initial value\nd = 0 # second term\nn = 12 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^6+9 x^5+5 x^4-5 x^3-9 x^2-9 x-1$ when divided by $-10 x$.", + "Output Answer": [ + "$\\frac{2 x^5}{5}-\\frac{9 x^4}{10}-\\frac{x^3}{2}+\\frac{x^2}{2}+\\frac{9 x}{10}+\\frac{9}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**6+9*x**5+5*x**4-5*x**3-9*x**2-9*x-1\nq = -10*x\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-9 x^3-126 x^2+144 x+2016$", + "Output Answer": [ + "$-9 (-x-14) (-x-4) (x-4)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-9*x**3-126*x**2+144*x+2016, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 11 x^2+13 x+7$, $q(x) = 9 x^2-4 x+2$", + "Output Answer": [ + "$20 x^2+9 x+9$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 11*x**2+13*x+7\nq = 9*x**2-4*x+2\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-8-7 i) \\log (2)$ and $y=(8+14 i) \\log (2)$", + "Output Answer": [ + "$-\\frac{81}{130}+\\frac{14 i}{65}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-8-7*i)*math.log10(2)\ny = (8+14*i)*math.log10(2)\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2+12 \\sqrt{2} x-28$", + "Output Answer": [ + "$-2 \\left(-x-7 \\sqrt{2}\\right) \\left(x-\\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2+12*sqrt(2)*x-28, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $9 x^2-\\frac{981 x}{7}+\\frac{26226}{49}$", + "Output Answer": [ + "$9 \\left(\\frac{47}{7}-x\\right) \\left(\\frac{62}{7}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(9*x**2-((981*x)/7)+(26226/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{8 x^2}{\\sqrt{3}}+\\frac{14 x}{\\sqrt{3}}+\\frac{19}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{67 \\sqrt{3}}{8}-\\frac{8 \\left(x-\\frac{7}{8}\\right)^2}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((8*x**2)/(math.sqrt(3)))+((14*x)/(math.sqrt(3)))+(19/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{99}{25}$ and $-\\frac{9}{5}$.", + "Output Answer": [ + "$\\frac{9}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd((99/25), -(9/5)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2+8 x-6 y^2+9 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(x+\\frac{2}{5}\\right)^2-6 \\left(y-\\frac{3}{4}\\right)^2=\\frac{209}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{5}-\\frac{\\sqrt{\\frac{209}{6}}}{5} & \\frac{3}{4} \\\\\n \\frac{1}{30} \\left(\\sqrt{1254}-12\\right) & \\frac{3}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{2}{5}-\\frac{\\sqrt{\\frac{209}{6}}}{5}+\\frac{1}{30} \\left(\\sqrt{1254}-12\\right)\\right),\\frac{3}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{5}{3}} x+\\frac{1}{60} \\left(45+8 \\sqrt{15}\\right),y=\\frac{1}{60} \\left(45-8 \\sqrt{15}\\right)-\\sqrt{\\frac{5}{3}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2+8*x-6*y**2+9*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $12 x^2+12 x-14$", + "Output Answer": [ + "$12 \\left(x+\\frac{1}{2}\\right)^2-17$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (12*x**2+12*x-14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{7 x^2}{2}-2 x+10$", + "Output Answer": [ + "$x=\\frac{10}{7}\\lor x=-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((7*x**2)/2)-2*x+10, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $x^3+\\frac{13 x^2}{2}-2 x-30$", + "Output Answer": [ + "$(x-2) \\left(x+\\frac{5}{2}\\right) (x+6)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(x**3+((13*x**2)/2)-2*x-30, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2-12 x$ and $4-x$.", + "Output Answer": [ + "$x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2-12*x, 4-x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2+\\frac{459 x}{7}-\\frac{17520}{49}$", + "Output Answer": [ + "$-3 \\left(x-\\frac{80}{7}\\right) \\left(x-\\frac{73}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2+((459*x)/7)-(17520/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{7}{3} \\left(\\frac{1}{4} \\left(1-\\sqrt{5}\\right)-i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)\\right)^4$", + "Output Answer": [ + "$\\frac{2401}{81} \\left(\\frac{1}{4} \\left(\\sqrt{5}-1\\right)-i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(7/3)*((1/4)*(1-math.sqrt(5))-1j*math.sqrt((5/8)+((math.sqrt(5))/8))))**4)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{44 x}{3}-\\frac{7}{3}}+\\sqrt{6 x+\\frac{31}{3}}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{961} \\left(-901+4 \\sqrt{29055}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((44*x)/3)-(7/3))+sqrt(6*x+(31/3)), 4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-x^4-x^3-2 x^2+3 x+3$ when divided by $4 x^4+8 x^3-5 x^2+7 x-8$.", + "Output Answer": [ + "$-\\frac{1}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**4-x**3-2*x**2+3*x+3\nq = 4*x**4+8*x**3-5*x**2+7*x-8\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -18 x^2+20 x-23\\right| =14$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-18*x**2+20*x-23), 14), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^4+9 x^3-8 x^2-6 x+9$ when divided by $-8 x-4$.", + "Output Answer": [ + "$-\\frac{x^3}{4}-x^2+\\frac{3 x}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**4+9*x**3-8*x**2-6*x+9\nq = -8*x-4\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\log \\left(\\cos ^{-1}(5 x+1)\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} (\\cos (1)-1)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(log(acos(5*x+1)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{5 x^2}{2}-\\frac{13 x}{2}+13$", + "Output Answer": [ + "$\\frac{689}{40}-\\frac{5}{2} \\left(x+\\frac{13}{10}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((5*x**2)/2)-((13*x)/2)+13), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((((8+2)-15)+13)-24) \\frac{25}{9}$.", + "Output Answer": [ + "$-\\frac{400}{9}$" + ], + "Output Program": [ + "try: \n print(((((8+2)-15)+13)-24)*(25/9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-22 x^3+\\frac{344 x^2}{3}-\\frac{292 x}{3}-70}{-\\frac{748 x}{3}-\\frac{340}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(17-\\sqrt{37}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(17+\\sqrt{37}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-22*x**3+((344*x**2)/3)-((292*x)/3)-70)/(-((748*x)/3)-(340/3))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{3} \\left(4 x^2-3 x-7\\right)$, $q(x) = \\sqrt{3} \\left(-8 x^2+7 x+6\\right)$", + "Output Answer": [ + "$-4 \\sqrt{3} x^2+4 \\sqrt{3} x-\\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(3)*(4*x**2-3*x-7)\nq = sqrt(3)*(-8*x**2+7*x+6)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-9 \\left(\\cos \\left(\\frac{3}{2}\\right)+i \\sin \\left(\\frac{3}{2}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$3486784401 (\\cos (15)+i \\sin (15))$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-9*(math.cos((3/2))+1j*math.sin((3/2))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{59 x^2}{5}-\\frac{61 x}{5}-\\frac{62}{5}$", + "Output Answer": [ + "$\\frac{59}{5} \\left(x-\\frac{61}{118}\\right)^2-\\frac{18353}{1180}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((59*x**2)/5)-((61*x)/5)-(62/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+9 x-5 y^2-9 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x+\\frac{3}{2}\\right)^2-5 \\left(y+\\frac{9}{10}\\right)^2=\\frac{17}{10}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{30} \\left(-45-4 \\sqrt{51}\\right) & -\\frac{9}{10} \\\\\n \\frac{1}{30} \\left(4 \\sqrt{51}-45\\right) & -\\frac{9}{10} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{30} \\left(-45-4 \\sqrt{51}\\right)+\\frac{1}{30} \\left(4 \\sqrt{51}-45\\right)\\right),-\\frac{9}{10}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{3}{5}} x+\\frac{3}{10} \\left(\\sqrt{15}-3\\right),y=-\\sqrt{\\frac{3}{5}} x-\\frac{3}{10} \\left(3+\\sqrt{15}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+9*x-5*y**2-9*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $-\\tan ^{-1}\\left(\\frac{11 x}{2}+\\frac{15}{2}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$-\\frac{2 \\tan (y)}{11}-\\frac{15}{11}\\text{ if }-\\frac{\\pi }{2} 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=12$.", + "Output Answer": [ + "$\\frac{912}{61}$" + ], + "Output Program": [ + "a = (76/61) # initial value\nd = 0 # second term\nn = 12 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (76/61) # initial value\nd = 0 # second term\nn = 12 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-5 \\sqrt{2} \\left(\\cos \\left(\\frac{9}{10}\\right)+i \\sin \\left(\\frac{9}{10}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-250 \\sqrt{2} \\left(\\cos \\left(\\frac{27}{10}\\right)+i \\sin \\left(\\frac{27}{10}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-5*math.sqrt(2)*(math.cos((9/10))+1j*math.sin((9/10))))**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+6 x-4 y^2-3 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 (x+1)^2-4 \\left(y+\\frac{3}{8}\\right)^2=\\frac{87}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n -1-\\frac{\\sqrt{203}}{8} & -\\frac{3}{8} \\\\\n \\frac{1}{8} \\left(\\sqrt{203}-8\\right) & -\\frac{3}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{7}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-1-\\frac{\\sqrt{203}}{8}+\\frac{1}{8} \\left(\\sqrt{203}-8\\right)\\right),-\\frac{3}{8}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{3} x}{2}+\\frac{1}{8} \\left(4 \\sqrt{3}-3\\right),y=\\frac{1}{8} \\left(-3-4 \\sqrt{3}\\right)-\\frac{\\sqrt{3} x}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+6*x-4*y**2-3*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{33 x}{\\sqrt{2}}+\\frac{21 y}{\\sqrt{2}}+5 \\sqrt{2} z+\\frac{9}{\\sqrt{2}}=0$, $-\\frac{27 x}{\\sqrt{2}}-13 \\sqrt{2} y-12 \\sqrt{2} z-\\frac{21}{\\sqrt{2}}=0$, $-11 \\sqrt{2} x+\\frac{31 y}{\\sqrt{2}}+\\frac{z}{\\sqrt{2}}+\\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{95}{26129}$, $y=-\\frac{1056}{26129}$, $z=-\\frac{21612}{26129}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((33*x)/(sqrt(2)))+((21*y)/(sqrt(2)))+5*sqrt(2)*z+(9/(sqrt(2))), -((27*x)/(sqrt(2)))-13*sqrt(2)*y-12*sqrt(2)*z-(21/(sqrt(2))), -11*sqrt(2)*x+((31*y)/(sqrt(2)))+(z/(sqrt(2)))+sqrt(2))), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-5 x^2-9 x+11$", + "Output Answer": [ + "$x=\\frac{1}{10} \\left(-9-\\sqrt{301}\\right)\\lor x=\\frac{1}{10} \\left(\\sqrt{301}-9\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-5*x**2-9*x+11, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 7 x^2-\\frac{11 x}{7}+\\frac{94}{7}$, $q(x) = -\\frac{93 x^2}{7}+\\frac{57 x}{7}-9$", + "Output Answer": [ + "$-\\frac{44 x^2}{7}+\\frac{46 x}{7}+\\frac{31}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**2-((11*x)/7)+(94/7)\nq = -((93*x**2)/7)+((57*x)/7)-9\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{11-15 i}{\\sqrt{3}}$ and $y=-\\frac{9-13 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{147}{125}-\\frac{4 i}{125}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((11-15*i)/(math.sqrt(3)))\ny = -((9-13*i)/(math.sqrt(3)))\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+9 x-7 y^2+3 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x+\\frac{3}{4}\\right)^2-7 \\left(y-\\frac{3}{14}\\right)^2=\\frac{283}{56}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{84} \\left(-63-\\sqrt{11037}\\right) & \\frac{3}{14} \\\\\n \\frac{1}{84} \\left(\\sqrt{11037}-63\\right) & \\frac{3}{14} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{13}{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{84} \\left(-63-\\sqrt{11037}\\right)+\\frac{1}{84} \\left(\\sqrt{11037}-63\\right)\\right),\\frac{3}{14}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{6}{7}} x+\\frac{3}{28} \\left(2+\\sqrt{42}\\right),y=-\\sqrt{\\frac{6}{7}} x-\\frac{3}{28} \\left(\\sqrt{42}-2\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+9*x-7*y**2+3*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 12 x^2+7 x+1$ and $q(x) = 4 x-14$", + "Output Answer": [ + "$48 x^3-140 x^2-94 x-14$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 12*x**2+7*x+1\nq = 4*x-14\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{1}{2} \\left(-\\cos \\left(\\frac{23}{30}\\right)-i \\sin \\left(\\frac{23}{30}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$\\frac{1}{4} \\left(\\cos \\left(\\frac{23}{15}\\right)+i \\sin \\left(\\frac{23}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((1/2)*(-math.cos((23/30))-1j*math.sin((23/30))))**2)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -7 \\sqrt{3} x^2+6 \\sqrt{3} x+7 \\sqrt{3}$ and $q(x) = 2 \\sqrt{3} x-5 \\sqrt{3}$", + "Output Answer": [ + "$-42 x^3+141 x^2-48 x-105$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -7*sqrt(3)*x**2+6*sqrt(3)*x+7*sqrt(3)\nq = 2*sqrt(3)*x-5*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2+3 x+10 y^2+6 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(y+\\frac{3}{10}\\right)^2-7 \\left(x-\\frac{3}{14}\\right)^2=-\\frac{59}{140}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{140} \\left(30-\\sqrt{2006}\\right) & -\\frac{3}{10} \\\\\n \\frac{1}{140} \\left(30+\\sqrt{2006}\\right) & -\\frac{3}{10} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{17}{10}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{140} \\left(30-\\sqrt{2006}\\right)+\\frac{1}{140} \\left(30+\\sqrt{2006}\\right)\\right),-\\frac{3}{10}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{7}{10}} x-\\frac{3}{140} \\left(14+\\sqrt{70}\\right),y=\\frac{3}{140} \\left(\\sqrt{70}-14\\right)-\\sqrt{\\frac{7}{10}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2+3*x+10*y**2+6*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $e^{1+\\frac{19 i \\pi }{30}}$.", + "Output Answer": [ + "Norm: $e$\nArgument: $\\frac{19 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = math.e**(1+((19*i*math.pi)/30))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $10 \\sqrt{2} x^2-\\frac{9 x}{\\sqrt{2}}-9 \\sqrt{2}$", + "Output Answer": [ + "$10 \\sqrt{2} \\left(x-\\frac{9}{40}\\right)^2-9 \\sqrt{2}-\\frac{81}{80 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (10*math.sqrt(2)*x**2-((9*x)/(math.sqrt(2)))-9*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-189 x^2+264 x-60}{210 x-60}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{10}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-189*x**2+264*x-60)/(210*x-60)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{31}{7}-\\frac{65 i}{7}$ and $y=\\frac{48}{7}+\\frac{34 i}{7}$", + "Output Answer": [ + "$-\\frac{361}{1730}-\\frac{2087 i}{1730}$" + ], + "Output Program": [ + "i = 1j\nx = (31/7)-((65*i)/7)\ny = (48/7)+((34*i)/7)\nprint((x/y))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-8 x^5-2 x^4+10 x^3-6 x^2$ and $4 x^5+x^4-5 x^3+3 x^2$.", + "Output Answer": [ + "$4 x^5+x^4-5 x^3+3 x^2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-8*x**5-2*x**4+10*x**3-6*x**2, 4*x**5+x**4-5*x**3+3*x**2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt{-2 x-2}$", + "Output Answer": [ + "$x\\leq -1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sqrt(-2*x-2)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $3 x^2-\\frac{27 x}{2}+\\frac{25}{2}$", + "Output Answer": [ + "$3 \\left(x-\\frac{9}{4}\\right)^2-\\frac{43}{16}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (3*x**2-((27*x)/2)+(25/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2+6 x+8 y^2-8 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x+\\frac{3}{10}\\right)^2+8 \\left(y-\\frac{1}{2}\\right)^2=\\frac{79}{10}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{10} & \\frac{1}{2}-\\frac{\\sqrt{79}}{20} \\\\\n -\\frac{3}{10} & \\frac{1}{20} \\left(10+\\sqrt{79}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{5}}$\nCenter: $\\left\\{-\\frac{3}{10},\\frac{1}{2} \\left(\\frac{1}{2}-\\frac{\\sqrt{79}}{20}+\\frac{1}{20} \\left(10+\\sqrt{79}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{79 \\pi }{40 \\sqrt{5}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2+6*x+8*y**2-8*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2+33 x-2288$", + "Output Answer": [ + "$-11 (13-x) (x+16)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2+33*x-2288, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2+15 x-76$", + "Output Answer": [ + "$(-x-19) (4-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2+15*x-76, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $16 x^7+12 x^6-14 x^5+39 x^4-16 x^3+2 x^2+7 x-6$ and $4 x^5+5 x^4-4 x^3+4 x^2+x-2$.", + "Output Answer": [ + "$4 x^5+5 x^4-4 x^3+4 x^2+x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(16*x**7+12*x**6-14*x**5+39*x**4-16*x**3+2*x**2+7*x-6, 4*x**5+5*x**4-4*x**3+4*x**2+x-2))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{7}{3}+4\\right)+\\left(\\left(((20+3)-20)^2-19\\right)+11\\right)$.", + "Output Answer": [ + "$\\frac{22}{3}$" + ], + "Output Program": [ + "try: \n print(((7/3)+4)+((((20+3)-20)**2-19)+11))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{5}{2} \\left(2 t^2+60 t+449\\right), x(t)=t^2+30 t+225$", + "Output Answer": [ + "$y=\\frac{5}{2}-5 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -(5/2)*(2*t**2+60*t+449)\nx_t = t**2+30*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{44}{7}-\\frac{43 i}{7}$ and $y=-\\frac{52}{7}-\\frac{39 i}{7}$", + "Output Answer": [ + "$-\\frac{3965}{49}+\\frac{520 i}{49}$" + ], + "Output Program": [ + "i = 1j\nx = (44/7)-((43*i)/7)\ny = -(52/7)-((39*i)/7)\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-7 x^2+3 x-15$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(3-i \\sqrt{411}\\right)\\lor x=\\frac{1}{14} \\left(3+i \\sqrt{411}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-7*x**2+3*x-15, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{44 x^2}{3}-\\frac{28 x}{3}+10$", + "Output Answer": [ + "$x=\\frac{1}{22} \\left(-7-\\sqrt{379}\\right)\\lor x=\\frac{1}{22} \\left(\\sqrt{379}-7\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((44*x**2)/3)-((28*x)/3)+10, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 2-10 x| =18$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{8}{5}\\right\\},\\{x\\to 2\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(2-10*x), 18), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-4 i$ and $y=5-2 i$", + "Output Answer": [ + "$-5-2 i$" + ], + "Output Program": [ + "i = 1j\nx = -4*i\ny = 5-2*i\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -10 x^2-13 x-5\\right| =7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{20} \\left(-13-\\sqrt{249}\\right)\\right\\},\\left\\{x\\to \\frac{1}{20} \\left(-13+\\sqrt{249}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-10*x**2-13*x-5), 7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{32}{5} e^{\\frac{23 i \\pi }{36}}$.", + "Output Answer": [ + "Norm: $\\frac{32}{5}$\nArgument: $\\frac{23 \\pi }{36}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (32/5)*math.e**((23*i*math.pi)/36)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{4 x^2+5}$ at the point $x=-1$", + "Output Answer": [ + "$3^{2/3} = 2.08$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = -1\ntry: \n f = np.cbrt(4*x**2+5)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2-4 x+10 y^2-10 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(y-\\frac{1}{2}\\right)^2-3 \\left(x+\\frac{2}{3}\\right)^2=\\frac{19}{6}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{3} & \\frac{1}{2}-\\frac{\\sqrt{\\frac{247}{5}}}{6} \\\\\n -\\frac{2}{3} & \\frac{1}{30} \\left(15+\\sqrt{1235}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{13}{3}}$\nCenter: $\\left\\{-\\frac{2}{3},\\frac{1}{2} \\left(\\frac{1}{2}-\\frac{\\sqrt{\\frac{247}{5}}}{6}+\\frac{1}{30} \\left(15+\\sqrt{1235}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{30} \\left(15-2 \\sqrt{30}\\right)-\\sqrt{\\frac{3}{10}} x,y=\\sqrt{\\frac{3}{10}} x+\\frac{1}{30} \\left(15+2 \\sqrt{30}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2-4*x+10*y**2-10*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $8-9 x$ when divided by $5-7 x$.", + "Output Answer": [ + "$\\frac{9}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8-9*x\nq = 5-7*x\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{5 \\left(\\cos \\left(\\frac{\\pi }{18}\\right)-i \\sin \\left(\\frac{\\pi }{18}\\right)\\right)}{\\sqrt{3}}\\right)^9$", + "Output Answer": [ + "$-\\frac{1953125 i}{81 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((5*(math.cos((math.pi/18))-1j*math.sin((math.pi/18))))/(math.sqrt(3))))**9)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-7 \\sqrt{2} x^2+\\frac{x}{\\sqrt{2}}-\\frac{11}{\\sqrt{2}}$", + "Output Answer": [ + "$-7 \\sqrt{2} \\left(x-\\frac{1}{28}\\right)^2-\\frac{615}{56 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-7*math.sqrt(2)*x**2+(x/(math.sqrt(2)))-(11/(math.sqrt(2)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 9 \\sqrt{3} x+\\frac{4}{\\sqrt{3}}\\right| =\\frac{5}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{3}\\right\\},\\left\\{x\\to \\frac{1}{27}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(9*sqrt(3)*x+(4/(sqrt(3)))), (5/(sqrt(3)))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{1}{10} ((3-13)-14)+\\frac{1}{17} ((16+1)+25)$.", + "Output Answer": [ + "$\\frac{6}{85}$" + ], + "Output Program": [ + "try: \n print((1/10)*((3-13)-14)+(1/17)*((16+1)+25))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^2+8 x+3$ when divided by $x-5$.", + "Output Answer": [ + "$8 x+48$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**2+8*x+3\nq = x-5\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-x^3-4 x^2-5 x$ and $x$.", + "Output Answer": [ + "$x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-x**3-4*x**2-5*x, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 16 (3 x+4)^4, q(x) = 3 (x+2)$", + "Output Answer": [ + "$1296 x^4+6912 x^3+13824 x^2+12291 x+4102$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 16*(3*x+4)**4\nq = 3*(x+2)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-148 x^3-\\frac{334 x^2}{3}-\\frac{674 x}{3}+560}{333 x^2+121 x-520}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-148*x**3-((334*x**2)/3)-((674*x)/3)+560)/(333*x**2+121*x-520)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-20 \\left(-80 t^2+8 \\left(2 \\sqrt{5}-35\\right) t+28 \\sqrt{5}-249\\right), x(t)=-4 \\sqrt{5} t-7 \\sqrt{5}$", + "Output Answer": [ + "$y=20 x^2+80 x+80$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -20*(-80*t**2+8*(2*sqrt(5)-35)*t+28*sqrt(5)-249)\nx_t = -4*sqrt(5)*t-7*sqrt(5)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^4+x^3+8 x^2-5 x-2$ when divided by $-8 x^4-8 x^3+x^2-7 x-2$.", + "Output Answer": [ + "$-\\frac{5}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**4+x**3+8*x**2-5*x-2\nq = -8*x**4-8*x**3+x**2-7*x-2\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{19 x^2+2 x+28}{\\pi }$, $q(x) = \\frac{34 x+46}{\\pi }$", + "Output Answer": [ + "$\\frac{19 x^2}{\\pi }+\\frac{36 x}{\\pi }+\\frac{74}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((19*x**2+2*x+28)/pi)\nq = ((34*x+46)/pi)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{9}{64} \\left(375 t^2+3000 t+6064\\right), x(t)=\\frac{225 t^2}{16}+\\frac{225 t}{2}+225$", + "Output Answer": [ + "$y=\\frac{15 x}{4}+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (9/64)*(375*t**2+3000*t+6064)\nx_t = ((225*t**2)/16)+((225*t)/2)+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{5 x^2}{7}-\\frac{41 x}{7}+\\frac{11}{7}$", + "Output Answer": [ + "$\\frac{1901}{140}-\\frac{5}{7} \\left(x+\\frac{41}{10}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((5*x**2)/7)-((41*x)/7)+(11/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $5 e^{-\\frac{83 i \\pi }{90}}$.", + "Output Answer": [ + "Norm: $5$\nArgument: $-\\frac{83 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 5*math.e**(-((83*i*math.pi)/90))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(\\cos \\left(\\frac{59}{90}\\right)+i \\sin \\left(\\frac{59}{90}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$2401 \\left(\\cos \\left(\\frac{118}{45}\\right)+i \\sin \\left(\\frac{118}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(math.cos((59/90))+1j*math.sin((59/90))))**4)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $4 \\sqrt{3} e^{-\\frac{103 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $4 \\sqrt{3}$\nArgument: $-\\frac{103 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 4*math.sqrt(3)*math.e**(-((103*i*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{112 x^2+182 x+63}{128 x+144}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((112*x**2+182*x+63)/(128*x+144)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $3 x^2-15 x-3$", + "Output Answer": [ + "$3 \\left(x-\\frac{5}{2}\\right)^2-\\frac{87}{4}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (3*x**2-15*x-3), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -5 x^2-20 x+6\\right| =-22$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-5*x**2-20*x+6), -22), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^3+2 x^2+8 x-9$ when divided by $8 x+8$.", + "Output Answer": [ + "$-\\frac{5 x^2}{8}+\\frac{7 x}{8}+\\frac{1}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**3+2*x**2+8*x-9\nq = 8*x+8\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-x^2-\\frac{63 x}{5}+\\frac{46}{5}$", + "Output Answer": [ + "$\\frac{4889}{100}-\\left(x+\\frac{63}{10}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-x**2-((63*x)/5)+(46/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{(25+9)^2}{(22+9)-8}$.", + "Output Answer": [ + "$\\frac{1156}{23}$" + ], + "Output Program": [ + "try: \n print((((25+9)**2)/((22+9)-8)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=32 \\left(50 t^2-220 t+241\\right)^2, x(t)=50 t^2-220 t+242$", + "Output Answer": [ + "$y=32 x^2-64 x+32$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 32*(50*t**2-220*t+241)**2\nx_t = 50*t**2-220*t+242\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2+132 x-960$", + "Output Answer": [ + "$12 (x-5) (x+16)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2+132*x-960, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(((24-24)-23)-13) (22+1)^2$.", + "Output Answer": [ + "$-19044$" + ], + "Output Program": [ + "try: \n print((((24-24)-23)-13)*(22+1)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{13 x^2}{2}-\\frac{49 x}{4}-\\frac{7}{4}$ and $q(x) = -\\frac{7 x^2}{2}-\\frac{9 x}{4}+\\frac{35}{4}$", + "Output Answer": [ + "$-\\frac{91 x^4}{4}+\\frac{113 x^3}{4}+\\frac{1449 x^2}{16}-\\frac{413 x}{4}-\\frac{245}{16}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((13*x**2)/2)-((49*x)/4)-(7/4)\nq = -((7*x**2)/2)-((9*x)/4)+(35/4)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(-\\sin \\left(\\frac{\\pi }{90}\\right)-i \\cos \\left(\\frac{\\pi }{90}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$256 \\left(\\cos \\left(\\frac{4 \\pi }{45}\\right)-i \\sin \\left(\\frac{4 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(-math.sin((math.pi/90))-1j*math.cos((math.pi/90))))**8)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $3 x^2-\\frac{9 x}{\\sqrt{2}}-627$", + "Output Answer": [ + "$3 \\left(x+\\frac{19}{\\sqrt{2}}\\right) \\left(x-11 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(3*x**2-((9*x)/(sqrt(2)))-627, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\sqrt{2} x^2-13 \\sqrt{2} x-17 \\sqrt{2}}{15 \\sqrt{2} x^2-\\sqrt{2} x+5 \\sqrt{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(13-\\sqrt{237}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(13+\\sqrt{237}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((sqrt(2)*x**2-13*sqrt(2)*x-17*sqrt(2))/(15*sqrt(2)*x**2-sqrt(2)*x+5*sqrt(2))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+4 x-6 y^2+8 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(x+\\frac{1}{2}\\right)^2-6 \\left(y-\\frac{2}{3}\\right)^2=-\\frac{8}{3}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{2} & \\frac{1}{3} \\left(2-\\sqrt{10}\\right) \\\\\n -\\frac{1}{2} & \\frac{1}{3} \\left(2+\\sqrt{10}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{2}}$\nCenter: $\\left\\{-\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{3} \\left(2-\\sqrt{10}\\right)+\\frac{1}{3} \\left(2+\\sqrt{10}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{6} \\left(4-\\sqrt{6}\\right)-\\sqrt{\\frac{2}{3}} x,y=\\sqrt{\\frac{2}{3}} x+\\frac{1}{6} \\left(4+\\sqrt{6}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+4*x-6*y**2+8*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{14-2 x}+\\sqrt{11 x-7}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{169} \\left(597-24 \\sqrt{257}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(14-2*x)+sqrt(11*x-7), 6), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{111 x^2}{5}-\\frac{x}{5}+\\frac{1}{5}\\right| =-\\frac{94}{5}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((111*x**2)/5)-(x/5)+(1/5)), -(94/5)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-12 x-1}+\\sqrt{-6 x-13}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{3} \\left(-144+7 \\sqrt{367}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-12*x-1)+sqrt(-6*x-13), 14), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{4}{625} (551 t+1200)^2, x(t)=-\\frac{38 t}{5}-15$", + "Output Answer": [ + "$y=\\frac{841 x^2}{25}-\\frac{522 x}{5}+81$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (4/625)*(551*t+1200)**2\nx_t = -((38*t)/5)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(-1+4 i) \\sqrt{5}$ and $y=4 \\sqrt{5}$", + "Output Answer": [ + "$(3+4 i) \\sqrt{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-1+4*i)*math.sqrt(5)\ny = 4*math.sqrt(5)\nprint(x+y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((3+15)+9)+((((12-15)-16)-10)+8)^2$.", + "Output Answer": [ + "$468$" + ], + "Output Program": [ + "try: \n print(((3+15)+9)+((((12-15)-16)-10)+8)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{16 x^2}{5}+\\frac{17 x}{5}+\\frac{31}{5}$", + "Output Answer": [ + "$x=\\frac{1}{32} \\left(-17-i \\sqrt{1695}\\right)\\lor x=\\frac{1}{32} \\left(-17+i \\sqrt{1695}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((16*x**2)/5)+((17*x)/5)+(31/5), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $((((22-18)+17)+10)-14) (((22-11)+15)+18)$.", + "Output Answer": [ + "$748$" + ], + "Output Program": [ + "try: \n print(((((22-18)+17)+10)-14)*(((22-11)+15)+18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{1}{3}-\\frac{5 i}{3}$ and $y=-\\frac{11}{3}-6 i$", + "Output Answer": [ + "$\\frac{10}{3}+\\frac{13 i}{3}$" + ], + "Output Program": [ + "i = 1j\nx = -(1/3)-((5*i)/3)\ny = -(11/3)-6*i\nprint(x-y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x^2-4 x-5$ and $1-x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x**2-4*x-5, 1-x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\left(\\sin \\left(\\frac{7 \\pi }{90}\\right)+i \\cos \\left(\\frac{7 \\pi }{90}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$65536 \\left(-\\sin \\left(\\frac{11 \\pi }{90}\\right)-i \\cos \\left(\\frac{11 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*(math.sin(((7*math.pi)/90))+1j*math.cos(((7*math.pi)/90))))**8)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-2 \\left(243 t^2-810 t+676\\right), x(t)=81 t^2-270 t+225$", + "Output Answer": [ + "$y=-6 x-2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -2*(243*t**2-810*t+676)\nx_t = 81*t**2-270*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{14520 x^2}{49}-\\frac{17747 x}{49}+\\frac{4280}{49}}{\\frac{18618}{49}-\\frac{20880 x}{49}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{40}{121}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((14520*x**2)/49)-((17747*x)/49)+(4280/49))/((18618/49)-((20880*x)/49))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{23+9}{(((20+18)-21)+3)-8}$.", + "Output Answer": [ + "$\\frac{8}{3}$" + ], + "Output Program": [ + "try: \n print(((23+9)/((((20+18)-21)+3)-8)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $3 e^{-\\frac{13 i \\pi }{15}} \\pi$.", + "Output Answer": [ + "Norm: $3 \\pi$\nArgument: $-\\frac{13 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 3*math.e**(-((13*i*math.pi)/15))*math.pi\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2-5 x-4 y^2+y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x-\\frac{5}{6}\\right)^2-4 \\left(y-\\frac{1}{8}\\right)^2=\\frac{1}{48}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{6}-\\frac{\\sqrt{7}}{24} & \\frac{1}{8} \\\\\n \\frac{1}{24} \\left(20+\\sqrt{7}\\right) & \\frac{1}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{7}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{5}{6}-\\frac{\\sqrt{7}}{24}+\\frac{1}{24} \\left(20+\\sqrt{7}\\right)\\right),\\frac{1}{8}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{3} x}{2}+\\frac{1}{24} \\left(3-10 \\sqrt{3}\\right),y=\\frac{1}{24} \\left(3+10 \\sqrt{3}\\right)-\\frac{\\sqrt{3} x}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2-5*x-4*y**2+y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt[3]{\\sqrt{6 x+8}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{4}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(cbrt(sqrt(6*x+8)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{1}{500} \\left(-50 x^2+325 x-475\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(13-\\sqrt{17}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(13+\\sqrt{17}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve((1/500)*(-50*x**2+325*x-475), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{10 x^2-x-3}{-21 x^2-20 x+10}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{2}\\right\\},\\left\\{x\\to \\frac{3}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((10*x**2-x-3)/(-21*x**2-20*x+10)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-3+5 i$ and $y=-5+2 i$", + "Output Answer": [ + "$5-31 i$" + ], + "Output Program": [ + "i = 1j\nx = -3+5*i\ny = -5+2*i\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{36}{5} \\left(\\cos \\left(\\frac{61}{45}\\right)+i \\sin \\left(\\frac{61}{45}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{3656158440062976 \\left(\\cos \\left(\\frac{122}{9}\\right)+i \\sin \\left(\\frac{122}{9}\\right)\\right)}{9765625}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(36/5)*(math.cos((61/45))+1j*math.sin((61/45))))**10)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{49}{9}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{9575}{9}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(49/9) # initial value\nd = 4 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(49/9) # initial value\nd = 4 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(9 \\left(\\cos \\left(\\frac{1}{45}\\right)+i \\sin \\left(\\frac{1}{45}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$59049 \\left(\\cos \\left(\\frac{1}{9}\\right)+i \\sin \\left(\\frac{1}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((9*(math.cos((1/45))+1j*math.sin((1/45))))**5)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-345 x^2-244 x-32}{195 x^2+449 x+184}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{4}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-345*x**2-244*x-32)/(195*x**2+449*x+184)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^5-10 x^4-8 x^3-8 x-5$ when divided by $-3 x-9$.", + "Output Answer": [ + "$\\frac{7 x^4}{3}-\\frac{11 x^3}{3}+\\frac{41 x^2}{3}-41 x+\\frac{377}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**5-10*x**4-8*x**3-8*x-5\nq = -3*x-9\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$8 x+y-21=0$, $6 x+22 y-15=0$", + "Output Answer": [ + "$x=\\frac{447}{170}$, $y=-\\frac{3}{85}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((8*x+y-21, 6*x+22*y-15), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 x+5, q(x) = (9-8 x)^4$", + "Output Answer": [ + "$4096 x^4-18432 x^3+31104 x^2-23319 x+6566$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x+5\nq = (9-8*x)**4\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 x^2+8 x+14$ and $q(x) = 14 x^2+7 x+11$", + "Output Answer": [ + "$42 x^4+133 x^3+285 x^2+186 x+154$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*x**2+8*x+14\nq = 14*x**2+7*x+11\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{4 \\sqrt{5} x^2+6 \\sqrt{5} x+11 \\sqrt{5}}{6 \\sqrt{5} x+5 \\sqrt{5}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((4*sqrt(5)*x**2+6*sqrt(5)*x+11*sqrt(5))/(6*sqrt(5)*x+5*sqrt(5))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$4 x+y-14=0$, $-9 x+16 y+3=0$", + "Output Answer": [ + "$x=\\frac{227}{73}$, $y=\\frac{114}{73}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((4*x+y-14, -9*x+16*y+3), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{11-22 i}{\\pi }$ and $y=-\\frac{21+3 i}{\\pi }$", + "Output Answer": [ + "$\\frac{297-429 i}{\\pi ^2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((11-22*i)/math.pi)\ny = -((21+3*i)/math.pi)\nprint(x*y)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{18 x^2}{7}-\\frac{59 x}{7}-\\frac{68}{7}$", + "Output Answer": [ + "$-\\frac{18}{7} \\left(x+\\frac{59}{36}\\right)^2-\\frac{1415}{504}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((18*x**2)/7)-((59*x)/7)-(68/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2-3 x$ and $q(x) = 9 x^2+10 x+4$", + "Output Answer": [ + "$-27 x^3-12 x^2+8 x+8$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2-3*x\nq = 9*x**2+10*x+4\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{25 x}{\\sqrt{2}}+17 \\sqrt{2}=0$, $-5 \\sqrt{2} x-3 \\sqrt{2} y+\\frac{29}{\\sqrt{2}}=0$", + "Output Answer": [ + "$x=-\\frac{34}{25}$, $y=\\frac{71}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((25*x)/(sqrt(2)))+17*sqrt(2), -5*sqrt(2)*x-3*sqrt(2)*y+(29/(sqrt(2)))), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2-2 x-9 y^2-2 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Circle\nEquation: $-9 \\left(x+\\frac{1}{9}\\right)^2-9 \\left(y+\\frac{1}{9}\\right)^2=-\\frac{74}{9}$\nRadius: $\\frac{\\sqrt{74}}{9}$\nCircumference: $\\frac{2 \\sqrt{74} \\pi }{9}$\nCenter: $\\left\\{-\\frac{1}{9},-\\frac{1}{9}\\right\\}$\nArea Enclosed: $\\frac{74 \\pi }{81}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2-2*x-9*y**2-2*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $7 \\sqrt{5} x^2-2 \\sqrt{5} x-6 \\sqrt{5}$", + "Output Answer": [ + "$x=\\frac{1}{7} \\left(1-\\sqrt{43}\\right)\\lor x=\\frac{1}{7} \\left(1+\\sqrt{43}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(7*sqrt(5)*x**2-2*sqrt(5)*x-6*sqrt(5), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{11 x^2}{3}-\\frac{19 x}{3}+\\frac{25}{3}$ when divided by $\\frac{8}{3}-7 x$.", + "Output Answer": [ + "$\\frac{311}{441}-\\frac{11 x}{21}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((11*x**2)/3)-((19*x)/3)+(25/3)\nq = (8/3)-7*x\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 21 x-\\frac{111}{5}\\right| =-4$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(21*x-(111/5)), -4), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{22 x^2}{\\sqrt{3}}-8 \\sqrt{3} x+\\frac{26}{\\sqrt{3}}$ and $q(x) = 6 \\sqrt{3} x^2+\\frac{23 x}{\\sqrt{3}}+5 \\sqrt{3}$", + "Output Answer": [ + "$132 x^4+\\frac{74 x^3}{3}+82 x^2+\\frac{238 x}{3}+130$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((22*x**2)/(sqrt(3)))-8*sqrt(3)*x+(26/(sqrt(3)))\nq = 6*sqrt(3)*x**2+((23*x)/(sqrt(3)))+5*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 81 (x+1)^2, q(x) = (7-4 x)^2$", + "Output Answer": [ + "$97 x^2+106 x+130$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 81*(x+1)**2\nq = (7-4*x)**2\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{((13+20)-10)^2-11}{1-14}$.", + "Output Answer": [ + "$-\\frac{518}{13}$" + ], + "Output Program": [ + "try: \n print(((((13+20)-10)**2-11)/(1-14)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11-9 x}+\\sqrt{15-4 x}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{131}{657+14 \\sqrt{2219}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11-9*x)+sqrt(15-4*x), 7), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $9 x^2-\\frac{69 x}{5}-\\frac{39}{5}$", + "Output Answer": [ + "$x=\\frac{1}{30} \\left(23-\\sqrt{1309}\\right)\\lor x=\\frac{1}{30} \\left(23+\\sqrt{1309}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(9*x**2-((69*x)/5)-(39/5), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{1}{11} (((23-7)+25)+17)}{(((15-20)+19)-18)+22}$.", + "Output Answer": [ + "$\\frac{29}{99}$" + ], + "Output Program": [ + "try: \n print((((1/11)*(((23-7)+25)+17))/((((15-20)+19)-18)+22)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^6-3 x^5-2 x^4-5 x^3+8 x^2+3 x-4$ when divided by $-10 x^5+7 x^4+9 x^3+7 x^2+6 x-6$.", + "Output Answer": [ + "$\\frac{3 x}{5}+\\frac{18}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**6-3*x**5-2*x**4-5*x**3+8*x**2+3*x-4\nq = -10*x**5+7*x**4+9*x**3+7*x**2+6*x-6\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $3 x^2+\\frac{141 x}{4}+\\frac{315}{8}$", + "Output Answer": [ + "$-3 \\left(-x-\\frac{5}{4}\\right) \\left(x+\\frac{21}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(3*x**2+((141*x)/4)+(315/8), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{-\\sin \\left(\\frac{2 \\pi }{15}\\right)+i \\cos \\left(\\frac{2 \\pi }{15}\\right)}{\\sqrt{3}}\\right)^3$", + "Output Answer": [ + "$\\frac{\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(1-\\sqrt{5}\\right)}{3 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((-math.sin(((2*math.pi)/15))+1j*math.cos(((2*math.pi)/15)))/(math.sqrt(3))))**3)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{4 x^2}{\\sqrt{3}}+\\frac{x}{\\sqrt{3}}-8 \\sqrt{3}$", + "Output Answer": [ + "$\\frac{4 \\left(x+\\frac{1}{8}\\right)^2}{\\sqrt{3}}-8 \\sqrt{3}-\\frac{1}{16 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((4*x**2)/(math.sqrt(3)))+(x/(math.sqrt(3)))-8*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -21 x^2+16 x-13\\right| =-2$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-21*x**2+16*x-13), -2), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-14 x-11}+\\sqrt{13-14 x}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{28461}{9464}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-14*x-11)+sqrt(13-14*x), 13), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{95}{99}$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$\\frac{120320}{99}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (95/99) # initial value\nd = 10 # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (95/99) # initial value\nd = 10 # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{3} \\left(-8 t-5 \\sqrt{3}-104\\right), x(t)=-\\frac{2 t}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=\\frac{4 x}{\\sqrt{3}}-\\frac{5}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/3)*(-8*t-5*sqrt(3)-104)\nx_t = -((2*t)/(sqrt(3)))-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{5}{53}$, and $a_n=a_{n-1}+4 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$12 \\left(\\frac{10}{53}+92 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\na = (5/53) # initial value\nd = 4*math.sqrt(5) # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (5/53) # initial value\nd = 4*math.sqrt(5) # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -3 x^2-15 x+1$ and $q(x) = 7 x^2-9 x-11$", + "Output Answer": [ + "$-21 x^4-78 x^3+175 x^2+156 x-11$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -3*x**2-15*x+1\nq = 7*x**2-9*x-11\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-2 x-11 y-24=0$, $6 x+21 y+13=0$", + "Output Answer": [ + "$x=\\frac{361}{24}$, $y=-\\frac{59}{12}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-2*x-11*y-24, 6*x+21*y+13), (x, y)))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$13 x+4 y+11 z-5=0$, $10 x+10 y-21 z+4=0$, $17 x-5 y-21 z+13=0$", + "Output Answer": [ + "$x=-\\frac{831}{7103}$, $y=\\frac{3874}{7103}$, $z=\\frac{2802}{7103}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((13*x+4*y+11*z-5, 10*x+10*y-21*z+4, 17*x-5*y-21*z+13)), (x, y, z))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2+11 \\sqrt{3} x-3630$", + "Output Answer": [ + "$11 \\left(x-10 \\sqrt{3}\\right) \\left(x+11 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2+11*sqrt(3)*x-3630, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-4 (8 t+17), x(t)=-8 t-15$", + "Output Answer": [ + "$y=4 x-8$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -4*(8*t+17)\nx_t = -8*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-12 x^4+12 x^3-3 x^2-3 x$ and $-4 x^4+4 x^3-x^2-x$.", + "Output Answer": [ + "$4 x^4-4 x^3+x^2+x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-12*x**4+12*x**3-3*x**2-3*x, -4*x**4+4*x**3-x**2-x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{2} \\left(5 t-6 \\sqrt{2}-105\\right), x(t)=\\frac{t}{\\sqrt{2}}-\\frac{21}{\\sqrt{2}}$", + "Output Answer": [ + "$y=\\frac{5 x}{\\sqrt{2}}-3 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/2)*(5*t-6*sqrt(2)-105)\nx_t = (t/(sqrt(2)))-(21/(sqrt(2)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(8 \\left(\\cos \\left(\\frac{46}{45}\\right)+i \\sin \\left(\\frac{46}{45}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$8589934592 \\left(\\cos \\left(\\frac{506}{45}\\right)+i \\sin \\left(\\frac{506}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((8*(math.cos((46/45))+1j*math.sin((46/45))))**11)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{73}{55}$, and $a_n=a_{n-1}+-3 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{11}{2} \\left(\\frac{146}{55}-30 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (73/55) # initial value\nd = -3*math.pi # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (73/55) # initial value\nd = -3*math.pi # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-3 x-6 y^2+2 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x-\\frac{3}{16}\\right)^2-6 \\left(y-\\frac{1}{6}\\right)^2=-\\frac{565}{96}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{16} & \\frac{1}{48} \\left(8-\\sqrt{3955}\\right) \\\\\n \\frac{3}{16} & \\frac{1}{48} \\left(8+\\sqrt{3955}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{7}}{2}$\nCenter: $\\left\\{\\frac{3}{16},\\frac{1}{2} \\left(\\frac{1}{48} \\left(8-\\sqrt{3955}\\right)+\\frac{1}{48} \\left(8+\\sqrt{3955}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{24} \\left(4+3 \\sqrt{3}\\right)-\\frac{2 x}{\\sqrt{3}},y=\\frac{2 x}{\\sqrt{3}}+\\frac{1}{24} \\left(4-3 \\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-3*x-6*y**2+2*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(107-21 t)^2, x(t)=3 t-15$", + "Output Answer": [ + "$y=49 x^2-28 x+4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (107-21*t)**2\nx_t = 3*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\log (\\cos (4 x+6))$ at the point $x=-6$", + "Output Answer": [ + "$\\log (\\cos (18)) = -0.415$" + ], + "Output Program": [ + "import math\n\nx = -6\ntry: \n f = math.log(math.cos(4*x+6))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^2+10 x-10$ when divided by $-5$.", + "Output Answer": [ + "$-\\frac{7 x^2}{5}-2 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**2+10*x-10\nq = -5\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left((14-25)^2-12\\right)+14\\right)-23\\right) \\left(\\left(\\left(\\frac{10}{21}+11\\right)-21\\right)+5\\right)$.", + "Output Answer": [ + "$-\\frac{9500}{21}$" + ], + "Output Program": [ + "try: \n print(((((14-25)**2-12)+14)-23)*((((10/21)+11)-21)+5))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $9 x^2+\\frac{29 x}{2}-\\frac{37}{4}$", + "Output Answer": [ + "$9 \\left(x+\\frac{29}{36}\\right)^2-\\frac{2173}{144}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (9*x**2+((29*x)/2)-(37/4)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{18 x^2}{5}+13 x+4$ and $q(x) = \\frac{58 x^2}{5}+\\frac{73 x}{5}+14$", + "Output Answer": [ + "$-\\frac{1044 x^4}{25}+\\frac{2456 x^3}{25}+\\frac{929 x^2}{5}+\\frac{1202 x}{5}+56$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((18*x**2)/5)+13*x+4\nq = ((58*x**2)/5)+((73*x)/5)+14\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{94}{7}-\\frac{59 x}{7}}+\\sqrt{-\\frac{43 x}{7}-\\frac{95}{7}}=\\frac{59}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{896} \\left(-166947+59 \\sqrt{7750833}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((94/7)-((59*x)/7))+sqrt(-((43*x)/7)-(95/7)), (59/7)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(((13+18)-9)+16) (((18+24)-20)+21)$.", + "Output Answer": [ + "$1634$" + ], + "Output Program": [ + "try: \n print((((13+18)-9)+16)*(((18+24)-20)+21))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{54}{7}+\\frac{33 i}{7}$.", + "Output Answer": [ + "Norm: $\\frac{3 \\sqrt{445}}{7}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{11}{18}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(54/7)+((33*i)/7)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{17 x^3}{2}-\\frac{15 x^2}{2}-\\frac{19 x}{2}-1$ when divided by $-5 x^3+\\frac{7 x^2}{2}+\\frac{5 x}{2}+\\frac{13}{2}$.", + "Output Answer": [ + "$\\frac{17}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((17*x**3)/2)-((15*x**2)/2)-((19*x)/2)-1\nq = -5*x**3+((7*x**2)/2)+((5*x)/2)+(13/2)\nprint((p / q).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 10 x^2+14 x-\\frac{23}{3}$ and $q(x) = -\\frac{17 x^2}{3}+\\frac{8 x}{3}-6$", + "Output Answer": [ + "$-\\frac{170 x^4}{3}-\\frac{158 x^3}{3}+\\frac{187 x^2}{9}-\\frac{940 x}{9}+46$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 10*x**2+14*x-(23/3)\nq = -((17*x**2)/3)+((8*x)/3)-6\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{2 x^2-38 x+31}{\\pi }$, $q(x) = \\frac{-37 x^2+11 x+13}{\\pi }$", + "Output Answer": [ + "$-\\frac{35 x^2}{\\pi }-\\frac{27 x}{\\pi }+\\frac{44}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((2*x**2-38*x+31)/pi)\nq = ((-37*x**2+11*x+13)/pi)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-15 x^2+\\frac{337 x}{5}+\\frac{68}{25}}{-\\frac{243 x^2}{5}+\\frac{6558 x}{25}-\\frac{952}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{25}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-15*x**2+((337*x)/5)+(68/25))/(-((243*x**2)/5)+((6558*x)/25)-(952/5))), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSimplify $(((5+14)-24)-5) ((((15-8)+8)-10)+2)^2$.", + "Output Answer": [ + "$-490$" + ], + "Output Program": [ + "try: \n print((((5+14)-24)-5)*((((15-8)+8)-10)+2)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{58}{53}$, and $a_n=a_{n-1}+7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{112750}{53}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (58/53) # initial value\nd = 7 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (58/53) # initial value\nd = 7 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-7 x^2+x-3$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(1-i \\sqrt{83}\\right)\\lor x=\\frac{1}{14} \\left(1+i \\sqrt{83}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-7*x**2+x-3, x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{47}{7} \\left(\\cos \\left(\\frac{7 \\pi }{45}\\right)+i \\sin \\left(\\frac{7 \\pi }{45}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{47}{7} \\sqrt{\\sin ^2\\left(\\frac{7 \\pi }{45}\\right)+\\cos ^2\\left(\\frac{7 \\pi }{45}\\right)}$\nArgument: $-\\frac{38 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(47/7)*(math.cos(((7*math.pi)/45))+i*math.sin(((7*math.pi)/45)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x^6+6 x^5+13 x^4+3 x^3+4 x^2-x+2$ and $5 x^4+x^3+2 x^2-x+1$.", + "Output Answer": [ + "$5 x^4+x^3+2 x^2-x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x**6+6*x**5+13*x**4+3*x**3+4*x**2-x+2, 5*x**4+x**3+2*x**2-x+1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{18 x^2}{7}+\\frac{116 x}{7}+\\frac{54}{7}}{-\\frac{38 x}{7}-2}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-29-\\sqrt{598}\\right)\\right\\},\\left\\{x\\to \\frac{1}{9} \\left(-29+\\sqrt{598}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((18*x**2)/7)+((116*x)/7)+(54/7))/(-((38*x)/7)-2)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{62 x^2}{3}+16 x+\\frac{74}{3}\\right| =-\\frac{2}{3}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((62*x**2)/3)+16*x+(74/3)), -(2/3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $| 5 x+17| =17$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{34}{5}\\right\\},\\{x\\to 0\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(5*x+17), 17), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $3 x^2+x-7$", + "Output Answer": [ + "$3 \\left(x+\\frac{1}{6}\\right)^2-\\frac{85}{12}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (3*x**2+x-7), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $4 x^2-11 x+7$", + "Output Answer": [ + "$4 \\left(x-\\frac{11}{8}\\right)^2-\\frac{9}{16}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (4*x**2-11*x+7), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x^2-5 x-1$ and $-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x**2-5*x-1, -1))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 10 x^2+x-2$, $q(x) = -2 \\left(5 x^2+4\\right)$", + "Output Answer": [ + "$x-10$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x**2+x-2\nq = -2*(5*x**2+4)\nprint((p + q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{67}{84}$, and $a_n=a_{n-1}+\\frac{20}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$\\frac{3707}{6}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (67/84) # initial value\nd = (20/3) # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (67/84) # initial value\nd = (20/3) # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $3 \\pi \\left(\\sin \\left(\\frac{13 \\pi }{90}\\right)-i \\cos \\left(\\frac{13 \\pi }{90}\\right)\\right)$.", + "Output Answer": [ + "Norm: $3 \\pi \\sqrt{\\sin ^2\\left(\\frac{13 \\pi }{90}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{90}\\right)}$\nArgument: $-\\frac{16 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 3*math.pi*(math.sin(((13*math.pi)/90))-i*math.cos(((13*math.pi)/90)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=91-\\frac{345 t}{8}, x(t)=\\frac{15 t}{2}-15$", + "Output Answer": [ + "$y=\\frac{19}{4}-\\frac{23 x}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 91-((345*t)/8)\nx_t = ((15*t)/2)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-x^5-4 x^4-3 x^3+5 x^2+6 x-3$ and $-x^3-2 x^2+3$.", + "Output Answer": [ + "$x^3+2 x^2-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-x**5-4*x**4-3*x**3+5*x**2+6*x-3, -x**3-2*x**2+3))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-2 \\sqrt{5} e^{\\frac{9 i \\pi }{20}}$.", + "Output Answer": [ + "Norm: $2 \\sqrt{5}$\nArgument: $-\\frac{11 \\pi }{20}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -2*math.sqrt(5)*math.e**((9*i*math.pi)/20)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{19 x^2}{4}-\\frac{49 x}{4}+\\frac{45}{4}$ and $q(x) = -\\frac{21 x^2}{4}+8 x-6$", + "Output Answer": [ + "$-\\frac{399 x^4}{16}+\\frac{1637 x^3}{16}-\\frac{2969 x^2}{16}+\\frac{327 x}{2}-\\frac{135}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((19*x**2)/4)-((49*x)/4)+(45/4)\nq = -((21*x**2)/4)+8*x-6\nprint((p * q).expand())\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{26 x^2}{\\sqrt{3}}-\\frac{25 x}{\\sqrt{3}}-6 \\sqrt{3}\\right| =14 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{52} \\left(25-\\sqrt{6865}\\right)\\right\\},\\left\\{x\\to \\frac{1}{52} \\left(25+\\sqrt{6865}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((26*x**2)/(sqrt(3)))-((25*x)/(sqrt(3)))-6*sqrt(3)), 14*sqrt(3)), x))\n" + ], + "split": "dev" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{11 \\left(66 t^2-252 t+241\\right)}{\\sqrt{2}}, x(t)=\\frac{121 t^2}{2}-231 t+\\frac{441}{2}$", + "Output Answer": [ + "$y=-6 \\sqrt{2} x-\\frac{5}{\\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -((11*(66*t**2-252*t+241))/(sqrt(2)))\nx_t = ((121*t**2)/2)-231*t+(441/2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\tan ^{-1}\\left(\\frac{9 x}{2}+\\frac{9}{2}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{2 \\tan (y)}{9}-1\\text{ if }-\\frac{\\pi }{2} 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$4 \\left(\\frac{17}{50}-35 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = (17/100) # initial value\nd = -5*math.sqrt(2) # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (17/100) # initial value\nd = -5*math.sqrt(2) # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{35 x}{3}-\\frac{44}{3}}+\\sqrt{\\frac{2}{3}-\\frac{20 x}{3}}=\\frac{38}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{135} \\left(-16298+76 \\sqrt{42142}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((35*x)/3)-(44/3))+sqrt((2/3)-((20*x)/3)), (38/3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=6-\\frac{13 i}{2}$ and $y=-1-\\frac{7 i}{4}$", + "Output Answer": [ + "$\\frac{86}{65}+\\frac{272 i}{65}$" + ], + "Output Program": [ + "i = 1j\nx = 6-((13*i)/2)\ny = -1-((7*i)/4)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{5}{7}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$\\frac{18070}{7}$" + ], + "Output Program": [ + "a = -(5/7) # initial value\nd = 8 # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(5/7) # initial value\nd = 8 # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (10, \\frac{1}{4}, \\frac{1}{5})$", + "Output Answer": [ + "$\\left\\{\\frac{3 \\sqrt{4449}}{20},\\tan ^{-1}\\left(\\frac{5 \\sqrt{1601}}{4}\\right),\\tan ^{-1}\\left(\\frac{1}{40}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 10\ny = (1/4)\nz = (1/5)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{30 x}{7}+\\frac{108 y}{7}+\\frac{81}{7}=0$, $\\frac{64 x}{7}-\\frac{125 y}{7}+\\frac{106}{7}=0$", + "Output Answer": [ + "$x=-\\frac{7191}{3554}$, $y=-\\frac{334}{1777}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((30*x)/7)+((108*y)/7)+(81/7), ((64*x)/7)-((125*y)/7)+(106/7)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2-81 x-486$", + "Output Answer": [ + "$3 (-x-18) (x+9)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2-81*x-486, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{15 x^2+5 x-6}{-4 x^2-4 x-20}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{30} \\left(-5-\\sqrt{385}\\right)\\right\\},\\left\\{x\\to \\frac{1}{30} \\left(-5+\\sqrt{385}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((15*x**2+5*x-6)/(-4*x**2-4*x-20)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2+32 x+360$", + "Output Answer": [ + "$8 (-x-5) (x-9)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2+32*x+360, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\sqrt{2} \\left(128 t^2-704 t+971\\right), x(t)=32 t^2-176 t+242$", + "Output Answer": [ + "$y=4 \\sqrt{2} x+3 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = sqrt(2)*(128*t**2-704*t+971)\nx_t = 32*t**2-176*t+242\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$e^{-3 x-8}$", + "Output Answer": [ + "$y>0$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(math.e**(-3*x-8), x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-2-2 i$ and $y=4+2 i$", + "Output Answer": [ + "$-4-12 i$" + ], + "Output Program": [ + "i = 1j\nx = -2-2*i\ny = 4+2*i\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $15 x^2+\\frac{43 x}{3}-2$", + "Output Answer": [ + "$x=\\frac{1}{90} \\left(-43-\\sqrt{2929}\\right)\\lor x=\\frac{1}{90} \\left(\\sqrt{2929}-43\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(15*x**2+((43*x)/3)-2, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $9 x^2+2 x+14$", + "Output Answer": [ + "$9 \\left(x+\\frac{1}{9}\\right)^2+\\frac{125}{9}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (9*x**2+2*x+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{11 x^2}{\\sqrt{3}}-\\frac{22 x}{\\sqrt{3}}+\\frac{16}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{11} \\left(11-i \\sqrt{55}\\right)\\lor x=\\frac{1}{11} \\left(11+i \\sqrt{55}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((11*x**2)/(sqrt(3)))-((22*x)/(sqrt(3)))+(16/(sqrt(3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (5 x-8)^3, q(x) = -27 (x+1)^3$", + "Output Answer": [ + "$98 x^3-681 x^2+879 x-539$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (5*x-8)**3\nq = -27*(x+1)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{13 x^5}{2}+4 x^4-\\frac{3 x^3}{2}-5 x^2+\\frac{3 x}{2}-\\frac{7}{2}$ when divided by $\\frac{13 x}{2}-7 x^2$.", + "Output Answer": [ + "$\\frac{13 x^3}{14}+\\frac{57 x^2}{196}+\\frac{1329 x}{2744}+\\frac{44717}{38416}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((13*x**5)/2)+4*x**4-((3*x**3)/2)-5*x**2+((3*x)/2)-(7/2)\nq = ((13*x)/2)-7*x**2\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\log (5 x-3)$ at the point $x=9$", + "Output Answer": [ + "$\\log (42) = 3.738$" + ], + "Output Program": [ + "import math\n\nx = 9\ntry: \n f = math.log(5*x-3)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{375 x^2-700 x+320}{210 x^2+31 x-272}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{4}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((375*x**2-700*x+320)/(210*x**2+31*x-272)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-6 y-9 z+16=0$, $7 x-22 y-17 z-14=0$, $-17 x+14 y-14 z+1=0$", + "Output Answer": [ + "$x=-\\frac{1930}{27}$, $y=-\\frac{919}{18}$, $z=\\frac{967}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-6*y-9*z+16, 7*x-22*y-17*z-14, -17*x+14*y-14*z+1)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{4}{49} \\left(81 t^2-945 t+2723\\right), x(t)=\\frac{324 t^2}{49}-\\frac{540 t}{7}+225$", + "Output Answer": [ + "$y=\\frac{19}{7}-x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -(4/49)*(81*t**2-945*t+2723)\nx_t = ((324*t**2)/49)-((540*t)/7)+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(\\cos \\left(\\frac{61}{45}\\right)+i \\sin \\left(\\frac{61}{45}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$16777216 \\left(\\cos \\left(\\frac{244}{15}\\right)+i \\sin \\left(\\frac{244}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(math.cos((61/45))+1j*math.sin((61/45))))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{10}{3}+4 i$ and $y=\\frac{23}{3}+8 i$", + "Output Answer": [ + "$-11-4 i$" + ], + "Output Program": [ + "i = 1j\nx = -(10/3)+4*i\ny = (23/3)+8*i\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $x^2-8 x+2 y^2+7 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $(x-4)^2+2 \\left(y+\\frac{7}{4}\\right)^2=\\frac{257}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n 4-\\frac{\\sqrt{257}}{4} & -\\frac{7}{4} \\\\\n 4+\\frac{\\sqrt{257}}{4} & -\\frac{7}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{4,-\\frac{7}{4}\\right\\}$\nArea Enclosed: $\\frac{257 \\pi }{8 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-8*x+2*y**2+7*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=45 t-127, x(t)=5 t-15$", + "Output Answer": [ + "$y=9 x+8$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 45*t-127\nx_t = 5*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -7 x^2-6 x+4$ and $q(x) = 8 x^2+x-3$", + "Output Answer": [ + "$-56 x^4-55 x^3+47 x^2+22 x-12$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -7*x**2-6*x+4\nq = 8*x**2+x-3\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $13 x^2-7 x+14$", + "Output Answer": [ + "$13 \\left(x-\\frac{7}{26}\\right)^2+\\frac{679}{52}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (13*x**2-7*x+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{11}{45}$, and $a_n=a_{n-1}+-3 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{25}{2} \\left(\\frac{22}{45}-72 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (11/45) # initial value\nd = -3*math.sqrt(2) # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (11/45) # initial value\nd = -3*math.sqrt(2) # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-5 x^4+5 x^3+5 x^2+5 x-5$ and $x^4-x^3-x^2-x+1$.", + "Output Answer": [ + "$x^4-x^3-x^2-x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-5*x**4+5*x**3+5*x**2+5*x-5, x**4-x**3-x**2-x+1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{\\log (8 x-4)}$ at the point $x=3$", + "Output Answer": [ + "$\\sqrt{\\log (20)} = 1.731$" + ], + "Output Program": [ + "import math\n\nx = 3\ntry: \n f = math.sqrt(math.log(8*x-4))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$-\\tan ^{-1}\\left(\\frac{42}{5}-\\frac{38 x}{5}\\right)$", + "Output Answer": [ + "$-\\frac{\\pi }{2} 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$\\frac{21728}{17}$" + ], + "Output Program": [ + "a = (83/17) # initial value\nd = 10 # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (83/17) # initial value\nd = 10 # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-3-2 i) \\pi$ and $y=(-2+2 i) \\pi$", + "Output Answer": [ + "$(-1-4 i) \\pi$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-3-2*i)*math.pi\ny = (-2+2*i)*math.pi\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-11 x-\\frac{34}{3}}+\\sqrt{-7 x-\\frac{38}{3}}=\\frac{41}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{72} \\left(-15105+41 \\sqrt{127277}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-11*x-(34/3))+sqrt(-7*x-(38/3)), (41/3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{88}{45}$, and $a_n=a_{n-1}+-\\frac{7}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{25}{2} \\left(\\frac{176}{45}-56 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (88/45) # initial value\nd = -(7/(math.sqrt(3))) # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (88/45) # initial value\nd = -(7/(math.sqrt(3))) # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -(x+2)^3, q(x) = 4 (2 x+1)^2$", + "Output Answer": [ + "$-x^3+10 x^2+4 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(x+2)**3\nq = 4*(2*x+1)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{8 e^{\\frac{7 i \\pi }{15}}}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\frac{8}{\\sqrt{3}}$\nArgument: $-\\frac{8 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((8*math.e**((7*i*math.pi)/15))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{46}{49}$, and $a_n=a_{n-1}+\\frac{13}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$\\frac{5680}{147}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(46/49) # initial value\nd = (13/3) # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(46/49) # initial value\nd = (13/3) # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{20 x^2+18 x+1}{\\sqrt{2}}$, $q(x) = -\\frac{(x+3)^2}{\\sqrt{2}}$", + "Output Answer": [ + "$-10 \\sqrt{2} x^2-\\frac{x^2}{\\sqrt{2}}-12 \\sqrt{2} x-5 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((20*x**2+18*x+1)/(sqrt(2)))\nq = -(((x+3)**2)/(sqrt(2)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{33}{2}$, and $a_n=a_{n-1}+3 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{25}{2} (72 \\pi -33)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(33/2) # initial value\nd = 3*math.pi # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(33/2) # initial value\nd = 3*math.pi # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 e x^2-5 e x+e$ and $q(x) = 3 e-3 e x^2$", + "Output Answer": [ + "$-9 e^2 x^4+15 e^2 x^3+6 e^2 x^2-15 e^2 x+3 e^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = 3*math.e*x**2-5*math.e*x+math.e\nq = 3*math.e-3*math.e*x**2\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{51 x^2}{4}-\\frac{15 x}{2}+11$", + "Output Answer": [ + "$\\frac{51}{4} \\left(x-\\frac{5}{17}\\right)^2+\\frac{673}{68}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((51*x**2)/4)-((15*x)/2)+11), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2+\\frac{13 x}{\\sqrt{2}}+150$", + "Output Answer": [ + "$-\\left(\\left(\\frac{25}{\\sqrt{2}}-x\\right) \\left(-x-6 \\sqrt{2}\\right)\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2+((13*x)/(sqrt(2)))+150, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{3 x^2}{5}-8 x-\\frac{39}{5}$ and $q(x) = \\frac{32 x^2}{5}-14 x-\\frac{21}{5}$", + "Output Answer": [ + "$-\\frac{96 x^4}{25}-\\frac{214 x^3}{5}+\\frac{323 x^2}{5}+\\frac{714 x}{5}+\\frac{819}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((3*x**2)/5)-8*x-(39/5)\nq = ((32*x**2)/5)-14*x-(21/5)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$x+20 y+z+15=0$, $24 x-9 y-3 z=0$, $-14 x+2 y-16 z+18=0$", + "Output Answer": [ + "$x=-\\frac{111}{716}$, $y=-\\frac{573}{716}$, $z=\\frac{831}{716}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((x+20*y+z+15, 24*x-9*y-3*z, -14*x+2*y-16*z+18)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$24 x+16 y-20=0$, $3 x-3 y-12=0$", + "Output Answer": [ + "$x=\\frac{21}{10}$, $y=-\\frac{19}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((24*x+16*y-20, 3*x-3*y-12), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{148}-\\sqrt{51}\\right) \\sqrt{\\sqrt{160}-\\sqrt{4}}$.", + "Output Answer": [ + "$\\sqrt{4 \\sqrt{10}-2} \\left(2 \\sqrt{37}-\\sqrt{51}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(148)-sqrt(51))*sqrt(sqrt(160)-sqrt(4)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 7 x^2+12 x+13$ and $q(x) = -10 x^2-14 x-12$", + "Output Answer": [ + "$-70 x^4-218 x^3-382 x^2-326 x-156$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 7*x**2+12*x+13\nq = -10*x**2-14*x-12\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{361 x^3+399 x^2-455 x-500}{285 x^2+262 x-40}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{38} \\left(-1-\\sqrt{1901}\\right)\\right\\},\\left\\{x\\to \\frac{1}{38} \\left(-1+\\sqrt{1901}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((361*x**3+399*x**2-455*x-500)/(285*x**2+262*x-40)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $12 x^3+2 x^2-17 x+5$ and $4 x^2+2 x-5$.", + "Output Answer": [ + "$4 x^2+2 x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(12*x**3+2*x**2-17*x+5, 4*x**2+2*x-5))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{40 x^2}{3}+\\frac{37 x}{3}-\\frac{11}{3}$", + "Output Answer": [ + "$-\\frac{40}{3} \\left(x-\\frac{37}{80}\\right)^2-\\frac{391}{480}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((40*x**2)/3)+((37*x)/3)-(11/3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{23 x^2}{5}+\\frac{9 x}{5}+\\frac{48}{5}$", + "Output Answer": [ + "$x=\\frac{1}{46} \\left(-9-17 i \\sqrt{15}\\right)\\lor x=\\frac{1}{46} \\left(-9+17 i \\sqrt{15}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((23*x**2)/5)+((9*x)/5)+(48/5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -2 x^2-12 x+4$ and $q(x) = -14 x$", + "Output Answer": [ + "$28 x^3+168 x^2-56 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -2*x**2-12*x+4\nq = -14*x\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^6+8 x^5-5 x^4-2 x^3+7 x^2-10 x-6$ when divided by $-4 x^4+x^3+2 x^2+5 x+2$.", + "Output Answer": [ + "$\\frac{3 x^2}{2}-\\frac{13 x}{8}+\\frac{51}{32}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**6+8*x**5-5*x**4-2*x**3+7*x**2-10*x-6\nq = -4*x**4+x**3+2*x**2+5*x+2\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 x^2-7 x+13$ and $q(x) = 13 x^2-6 x-10$", + "Output Answer": [ + "$26 x^4-103 x^3+191 x^2-8 x-130$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*x**2-7*x+13\nq = 13*x**2-6*x-10\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $x^2-8 x-7 y^2+7 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $(x-4)^2-7 \\left(y-\\frac{1}{2}\\right)^2=\\frac{85}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n 4-\\sqrt{\\frac{170}{7}} & \\frac{1}{2} \\\\\n 4+\\sqrt{\\frac{170}{7}} & \\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{7}}$\nCenter: $\\left\\{4,\\frac{1}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{7}}+\\frac{1}{14} \\left(7-8 \\sqrt{7}\\right),y=\\frac{1}{14} \\left(7+8 \\sqrt{7}\\right)-\\frac{x}{\\sqrt{7}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-8*x-7*y**2+7*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x+12}+\\sqrt{2 x-6}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 93-40 \\sqrt{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x+12)+sqrt(2*x-6), 5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\left(6-6 x^2\\right)^3$", + "Output Answer": [ + "$y\\leq 216$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range((6-6*x**2)**3, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{49} (25-62 x)^2, q(x) = -\\frac{4}{7} (5 x-6)$", + "Output Answer": [ + "$\\frac{3844 x^2}{49}-\\frac{3240 x}{49}+\\frac{793}{49}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/49)*(25-62*x)**2\nq = -(4/7)*(5*x-6)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2+3 x+28$", + "Output Answer": [ + "$-((x-7) (x+4))$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2+3*x+28, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-8 x^3+72 x^2+1760 x-11424$", + "Output Answer": [ + "$8 (6-x) (x-17) (x+14)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-8*x**3+72*x**2+1760*x-11424, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{15 e^{-\\frac{29 i \\pi }{30}}}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $\\frac{15}{\\sqrt{\\pi }}$\nArgument: $-\\frac{29 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((15*math.e**(-((29*i*math.pi)/30)))/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\cos \\left(\\frac{53}{90}\\right)+i \\sin \\left(\\frac{53}{90}\\right)\\right)^12$", + "Output Answer": [ + "$\\cos \\left(\\frac{106}{15}\\right)+i \\sin \\left(\\frac{106}{15}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.cos((53/90))+1j*math.sin((53/90)))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-135 x^3+276 x^2+163 x-304}{99 x^2+7 x-456}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{16}{15}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-135*x**3+276*x**2+163*x-304)/(99*x**2+7*x-456)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the seventh order series of the inverse of the following function around 7:\n$\\sin \\left(3 x^5\\right)$", + "Output Answer": [ + "$\\frac{\\sqrt[5]{x}}{\\sqrt[5]{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, sin(3*x**5))\nprint(solve(f, x)[0].series(y, 7, 6))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\cos \\left(3 x^4+9\\right)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = cos(3*x**4+9)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{7}{2}-2 x$ and $\\frac{7}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd((7/2)-2*x, (7/2)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$2 x-16 y+8=0$, $-10 x+24 y-20=0$", + "Output Answer": [ + "$x=-\\frac{8}{7}$, $y=\\frac{5}{14}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((2*x-16*y+8, -10*x+24*y-20), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-4 x^2-x-12$", + "Output Answer": [ + "$-4 \\left(x+\\frac{1}{8}\\right)^2-\\frac{191}{16}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-4*x**2-x-12), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$9 \\sqrt{3} x+\\frac{26 y}{\\sqrt{3}}-\\frac{22}{\\sqrt{3}}=0$, $-\\frac{29 x}{\\sqrt{3}}+\\frac{y}{\\sqrt{3}}+\\frac{5}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{152}{781}$, $y=\\frac{503}{781}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((9*sqrt(3)*x+((26*y)/(sqrt(3)))-(22/(sqrt(3))), -((29*x)/(sqrt(3)))+(y/(sqrt(3)))+(5/(sqrt(3)))), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-8 x-7}+\\sqrt{2-4 x}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-201+16 \\sqrt{139}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-8*x-7)+sqrt(2-4*x), 8), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{20}{3}$, and $a_n=a_{n-1}+\\frac{6}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$12 \\left(\\frac{40}{3}+\\frac{138}{\\sqrt{5}}\\right)$" + ], + "Output Program": [ + "import math\n\na = (20/3) # initial value\nd = (6/(math.sqrt(5))) # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (20/3) # initial value\nd = (6/(math.sqrt(5))) # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-9-4 i$ and $y=8-i$", + "Output Answer": [ + "$-76-23 i$" + ], + "Output Program": [ + "i = 1j\nx = -9-4*i\ny = 8-i\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -8 x^2-\\frac{37 x}{3}-\\frac{19}{3}$ and $q(x) = -\\frac{4 x^2}{3}-8 x+\\frac{7}{3}$", + "Output Answer": [ + "$\\frac{32 x^4}{3}+\\frac{724 x^3}{9}+\\frac{796 x^2}{9}+\\frac{197 x}{9}-\\frac{133}{9}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -8*x**2-((37*x)/3)-(19/3)\nq = -((4*x**2)/3)-8*x+(7/3)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\left(150 t^2-900 t+1343\\right)^2, x(t)=25 t^2-150 t+225$", + "Output Answer": [ + "$y=36 x^2-84 x+49$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (150*t**2-900*t+1343)**2\nx_t = 25*t**2-150*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\cos \\left(5 x^2+1\\right)$ at the point $x=-7$", + "Output Answer": [ + "$\\cos (246) = 0.577$" + ], + "Output Program": [ + "import math\n\nx = -7\ntry: \n f = math.cos(5*x**2+1)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{6 x-9}-\\tan ^{-1}\\left(3-5 x^2\\right)$ at the point $x=-7$", + "Output Answer": [ + "$-\\sqrt[3]{51}+\\tan ^{-1}(242) = -2.142$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = -7\ntry: \n f = np.cbrt(6*x-9)-math.atan(3-5*x**2)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((((9-24)+4)-2)-21)+(((25+6)-4)+20)$.", + "Output Answer": [ + "$13$" + ], + "Output Program": [ + "try: \n print(((((9-24)+4)-2)-21)+(((25+6)-4)+20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{7}{5}$, and $a_n=a_{n-1}+-\\frac{33}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$-\\frac{8188}{5}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (7/5) # initial value\nd = -(33/5) # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (7/5) # initial value\nd = -(33/5) # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{13 x^2+4 x-3}{16-24 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{13} \\left(-2-\\sqrt{43}\\right)\\right\\},\\left\\{x\\to \\frac{1}{13} \\left(-2+\\sqrt{43}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((13*x**2+4*x-3)/(16-24*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{43 x}{\\sqrt{3}}+\\frac{14 y}{\\sqrt{3}}+5 \\sqrt{3} z+\\frac{41}{\\sqrt{3}}=0$, $\\frac{8 x}{\\sqrt{3}}+11 \\sqrt{3} y-8 \\sqrt{3} z-\\frac{25}{\\sqrt{3}}=0$, $-\\frac{20 x}{\\sqrt{3}}-\\frac{11 y}{\\sqrt{3}}-\\frac{16 z}{\\sqrt{3}}-\\frac{37}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{800}{4241}$, $y=-\\frac{1999}{4241}$, $z=-\\frac{7433}{4241}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((43*x)/(sqrt(3)))+((14*y)/(sqrt(3)))+5*sqrt(3)*z+(41/(sqrt(3))), ((8*x)/(sqrt(3)))+11*sqrt(3)*y-8*sqrt(3)*z-(25/(sqrt(3))), -((20*x)/(sqrt(3)))-((11*y)/(sqrt(3)))-((16*z)/(sqrt(3)))-(37/(sqrt(3))))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{23+21 i}{e}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{970}}{e}$\nArgument: $\\tan ^{-1}\\left(\\frac{21}{23}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((23+21*i)/math.e)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -8 x^2+3 x+5$ and $q(x) = -6 x^2+8 x+1$", + "Output Answer": [ + "$48 x^4-82 x^3-14 x^2+43 x+5$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -8*x**2+3*x+5\nq = -6*x**2+8*x+1\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (x-3)^4, q(x) = 343 (x+1)^3$", + "Output Answer": [ + "$x^4+331 x^3+1083 x^2+921 x+424$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (x-3)**4\nq = 343*(x+1)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2+\\frac{528 x}{7}-\\frac{16320}{49}$", + "Output Answer": [ + "$-3 \\left(x-\\frac{136}{7}\\right) \\left(x-\\frac{40}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2+((528*x)/7)-(16320/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sqrt{6 x+2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{6} \\left(y^2-2\\right)\\text{ if }y>0$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, sqrt(6*x+2))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{11}{7}-\\frac{64 x}{7}}+\\sqrt{-\\frac{39 x}{7}-\\frac{17}{7}}=\\frac{90}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{175} \\left(-33176+36 \\sqrt{798085}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((11/7)-((64*x)/7))+sqrt(-((39*x)/7)-(17/7)), (90/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{17 x}{7}+5}+\\sqrt{7 x+\\frac{15}{7}}=\\frac{64}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{56} \\left(2147-8 \\sqrt{58422}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((17*x)/7)+5)+sqrt(7*x+(15/7)), (64/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $3 \\sqrt{2} x^2-5 \\sqrt{2} x-6 \\sqrt{2}$", + "Output Answer": [ + "$3 \\sqrt{2} \\left(x-\\frac{5}{6}\\right)^2-6 \\sqrt{2}-\\frac{25}{6 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (3*math.sqrt(2)*x**2-5*math.sqrt(2)*x-6*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 x^2-4 x+2$ and $q(x) = 9 x^2-10 x-6$", + "Output Answer": [ + "$36 x^4-76 x^3+34 x^2+4 x-12$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*x**2-4*x+2\nq = 9*x**2-10*x-6\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{3} \\left(162 t^2-936 t+1343\\right)^2, x(t)=27 t^2-156 t+\\frac{676}{3}$", + "Output Answer": [ + "$y=12 x^2-36 x+27$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/3)*(162*t**2-936*t+1343)**2\nx_t = 27*t**2-156*t+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{7}{2} \\left(\\sin \\left(\\frac{11 \\pi }{90}\\right)-i \\cos \\left(\\frac{11 \\pi }{90}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{282475249 \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)+i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)}{1024}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(7/2)*(math.sin(((11*math.pi)/90))-1j*math.cos(((11*math.pi)/90))))**10)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-9 \\sqrt{3} x^2+3 \\sqrt{3} x+\\sqrt{3}$", + "Output Answer": [ + "$\\frac{5 \\sqrt{3}}{4}-9 \\sqrt{3} \\left(x-\\frac{1}{6}\\right)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-9*math.sqrt(3)*x**2+3*math.sqrt(3)*x+math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{17}{2} e^{-\\frac{7 i \\pi }{36}}$.", + "Output Answer": [ + "Norm: $\\frac{17}{2}$\nArgument: $\\frac{29 \\pi }{36}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(17/2)*math.e**(-((7*i*math.pi)/36))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x^4-3 x^3-\\frac{5 x^2}{2}+x$ and $-5 x^3+3 x^2+\\frac{5 x}{2}-1$.", + "Output Answer": [ + "$5 x^3-3 x^2-\\frac{5 x}{2}+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x**4-3*x**3-((5*x**2)/2)+x, -5*x**3+3*x**2+((5*x)/2)-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{3}{20}$, and $a_n=a_{n-1}+-\\frac{14}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$12 \\left(-\\frac{3}{10}-\\frac{322}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(3/20) # initial value\nd = -(14/(math.sqrt(3))) # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(3/20) # initial value\nd = -(14/(math.sqrt(3))) # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^5+2 x^4-8 x^3+8 x^2+x+5$ when divided by $6 x-3$.", + "Output Answer": [ + "$\\frac{4 x^4}{3}+x^3-\\frac{5 x^2}{6}+\\frac{11 x}{12}+\\frac{5}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**5+2*x**4-8*x**3+8*x**2+x+5\nq = 6*x-3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{20 x}{\\sqrt{3}}-\\frac{11}{\\sqrt{3}}\\right| =3 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((20*x)/(sqrt(3)))-(11/(sqrt(3)))), 3*sqrt(3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-8 e^{-\\frac{9 i \\pi }{10}}$.", + "Output Answer": [ + "Norm: $8$\nArgument: $\\tan ^{-1}\\left(\\frac{\\Im\\left(e^{-\\frac{9 i \\pi }{10}}\\right)}{\\Re\\left(e^{-\\frac{9 i \\pi }{10}}\\right)}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -8*math.e**(-((9*i*math.pi)/10))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 8 x^2-\\frac{17 x}{2}+\\frac{21}{2}$ and $q(x) = -\\frac{31 x^2}{4}+\\frac{37 x}{4}-\\frac{7}{2}$", + "Output Answer": [ + "$-62 x^4+\\frac{1119 x^3}{8}-188 x^2+\\frac{1015 x}{8}-\\frac{147}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 8*x**2-((17*x)/2)+(21/2)\nq = -((31*x**2)/4)+((37*x)/4)-(7/2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{23}{35}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$\\frac{184}{35}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (23/35) # initial value\nd = 0 # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (23/35) # initial value\nd = 0 # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{729} \\left(6400 t^2+36000 t+50499\\right)^2, x(t)=\\frac{256 t^2}{9}+160 t+225$", + "Output Answer": [ + "$y=\\frac{625 x^2}{9}-\\frac{700 x}{9}+\\frac{196}{9}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/729)*(6400*t**2+36000*t+50499)**2\nx_t = ((256*t**2)/9)+160*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = x^2+8 x-1$, $q(x) = (2-3 x) x$", + "Output Answer": [ + "$-2 x^2+10 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**2+8*x-1\nq = (2-3*x)*x\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{26 x^2}{3}-8 x+\\frac{4}{3}$ and $2$.", + "Output Answer": [ + "$\\frac{2}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((26*x**2)/3)-8*x+(4/3), 2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{6-17 i}{\\sqrt{3}}$ and $y=-\\frac{9-4 i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{122}{97}-\\frac{129 i}{97}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((6-17*i)/(math.sqrt(3)))\ny = -((9-4*i)/(math.sqrt(3)))\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^5-\\frac{23 x^4}{5}-4 x^3-9 x^2+\\frac{41 x}{5}+\\frac{16}{5}$ when divided by $-\\frac{23 x^3}{5}+4 x^2+\\frac{16 x}{5}-\\frac{22}{5}$.", + "Output Answer": [ + "$-\\frac{15 x^2}{23}+\\frac{229 x}{529}+\\frac{9640}{12167}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**5-((23*x**4)/5)-4*x**3-9*x**2+((41*x)/5)+(16/5)\nq = -((23*x**3)/5)+4*x**2+((16*x)/5)-(22/5)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{25}{34}$, and $a_n=a_{n-1}+-\\frac{19}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$-\\frac{57024}{17}$" + ], + "Output Program": [ + "a = -(25/34) # initial value\nd = -(19/2) # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(25/34) # initial value\nd = -(19/2) # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\sqrt{5} x^2+4 \\sqrt{5} x-4 \\sqrt{5}\\right| =-8 \\sqrt{5}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-sqrt(5)*x**2+4*sqrt(5)*x-4*sqrt(5)), -8*sqrt(5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -x^2+7 x+14$, $q(x) = -12 x^2-7 x-7$", + "Output Answer": [ + "$7-13 x^2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**2+7*x+14\nq = -12*x**2-7*x-7\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-5 \\sqrt{2} x+10 \\sqrt{2} y-4 \\sqrt{2}=0$, $-10 \\sqrt{2} x-9 \\sqrt{2} y-\\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{46}{145}$, $y=\\frac{7}{29}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-5*sqrt(2)*x+10*sqrt(2)*y-4*sqrt(2), -10*sqrt(2)*x-9*sqrt(2)*y-sqrt(2)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{13}{89}$, and $a_n=a_{n-1}+-\\frac{7}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$-\\frac{43883}{89}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(13/89) # initial value\nd = -(7/3) # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(13/89) # initial value\nd = -(7/3) # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x-1}+\\sqrt{9 x+8}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(677-196 \\sqrt{11}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x-1)+sqrt(9*x+8), 14), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 x^2-11 x-14$ and $q(x) = 9 x^2+11 x+7$", + "Output Answer": [ + "$45 x^4-44 x^3-212 x^2-231 x-98$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*x**2-11*x-14\nq = 9*x**2+11*x+7\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$16 x-7 y+5=0$, $-18 x-10 y-20=0$", + "Output Answer": [ + "$x=-\\frac{95}{143}$, $y=-\\frac{115}{143}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((16*x-7*y+5, -18*x-10*y-20), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2-2 x+4 y+7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-7 x^2-2 x+4 y=-7$\nVertex: $\\left\\{-\\frac{1}{7},-\\frac{25}{14}\\right\\}$\nDirectrix: $y=-\\frac{27}{14}$\nFocal Parameter: $\\frac{2}{7}$\nFocus: $\\left\\{-\\frac{1}{7},-\\frac{23}{14}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2-2*x+4*y+7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{66 x}{5}-\\frac{39}{5}\\right| =\\frac{94}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{6}\\right\\},\\left\\{x\\to \\frac{133}{66}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((66*x)/5)-(39/5)), (94/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $11 x^2-x-14$", + "Output Answer": [ + "$x=\\frac{1}{22} \\left(1-\\sqrt{617}\\right)\\lor x=\\frac{1}{22} \\left(1+\\sqrt{617}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(11*x**2-x-14, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{408 x^2-\\frac{3447 x}{4}+\\frac{6237}{16}}{\\frac{799 x}{2}-\\frac{4653}{8}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{21}{32}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((408*x**2-((3447*x)/4)+(6237/16))/(((799*x)/2)-(4653/8))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{13 x-7}+\\sqrt{14 x-3}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{55141}{6071+30 \\sqrt{40891}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(13*x-7)+sqrt(14*x-3), 15), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{3}{5}$, and $a_n=a_{n-1}+-3 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$\\frac{13}{2} \\left(\\frac{6}{5}-36 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (3/5) # initial value\nd = -3*math.sqrt(2) # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (3/5) # initial value\nd = -3*math.sqrt(2) # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2+20 x-30$", + "Output Answer": [ + "$-10 (1-x) (x+3)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2+20*x-30, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-7$ and $-\\frac{7}{2}$.", + "Output Answer": [ + "$\\frac{7}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-7, -(7/2)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{2}{5}+\\frac{16 i}{5}$.", + "Output Answer": [ + "Norm: $2 \\sqrt{\\frac{13}{5}}$\nArgument: $\\tan ^{-1}(8)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (2/5)+((16*i)/5)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{2} \\left(77 t+8 \\sqrt{2}+147\\right), x(t)=-\\frac{11 t}{\\sqrt{2}}-\\frac{21}{\\sqrt{2}}$", + "Output Answer": [ + "$y=4 \\sqrt{2}-\\frac{7 x}{\\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/2)*(77*t+8*sqrt(2)+147)\nx_t = -((11*t)/(sqrt(2)))-(21/(sqrt(2)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 x^2+3 x+3$ and $q(x) = -3 x^2+10 x+8$", + "Output Answer": [ + "$-12 x^4+31 x^3+53 x^2+54 x+24$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*x**2+3*x+3\nq = -3*x**2+10*x+8\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = x^2+15 x-6$ and $q(x) = -11 x^2+x-12$", + "Output Answer": [ + "$-11 x^4-164 x^3+69 x^2-186 x+72$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = x**2+15*x-6\nq = -11*x**2+x-12\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(\\sin \\left(\\frac{\\pi }{90}\\right)-i \\cos \\left(\\frac{\\pi }{90}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$15625 \\left(-\\cos \\left(\\frac{\\pi }{15}\\right)-i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(math.sin((math.pi/90))-1j*math.cos((math.pi/90))))**6)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{144 x}{7}+\\frac{139}{7}\\right| =\\frac{13}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{19}{18}\\right\\},\\left\\{x\\to -\\frac{7}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((144*x)/7)+(139/7)), (13/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{34 x}{\\sqrt{3}}+\\frac{10 y}{\\sqrt{3}}-13 \\sqrt{3} z+\\frac{26}{\\sqrt{3}}=0$, $\\frac{19 x}{\\sqrt{3}}-\\frac{41 y}{\\sqrt{3}}+\\frac{11 z}{\\sqrt{3}}=0$, $-\\frac{19 x}{\\sqrt{3}}-\\frac{10 y}{\\sqrt{3}}-\\frac{38 z}{\\sqrt{3}}+4 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{8500}{4597}$, $y=\\frac{2978}{4597}$, $z=-\\frac{3582}{4597}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((34*x)/(sqrt(3)))+((10*y)/(sqrt(3)))-13*sqrt(3)*z+(26/(sqrt(3))), ((19*x)/(sqrt(3)))-((41*y)/(sqrt(3)))+((11*z)/(sqrt(3))), -((19*x)/(sqrt(3)))-((10*y)/(sqrt(3)))-((38*z)/(sqrt(3)))+4*sqrt(3))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-5 x^2+9 x-5 y^2-7 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Circle\nEquation: $-5 \\left(x-\\frac{9}{10}\\right)^2-5 \\left(y+\\frac{7}{10}\\right)^2=-\\frac{25}{2}$\nRadius: $\\sqrt{\\frac{5}{2}}$\nCircumference: $\\sqrt{10} \\pi$\nCenter: $\\left\\{\\frac{9}{10},-\\frac{7}{10}\\right\\}$\nArea Enclosed: $\\frac{5 \\pi }{2}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-5*x**2+9*x-5*y**2-7*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{20-7}{((19-10)+16)-23}$.", + "Output Answer": [ + "$\\frac{13}{2}$" + ], + "Output Program": [ + "try: \n print(((20-7)/(((19-10)+16)-23)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{8 x}{3}+\\frac{23}{3}}+\\sqrt{\\frac{23 x}{3}-\\frac{43}{3}}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{15} \\left(686-4 \\sqrt{22765}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((8*x)/3)+(23/3))+sqrt(((23*x)/3)-(43/3)), 10), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-22 x+y-22 z-6=0$, $-2 x+14 y-17 z-18=0$, $22 x+8 y-23 z+14=0$", + "Output Answer": [ + "$x=-\\frac{331}{450}$, $y=\\frac{83}{45}$, $z=\\frac{41}{75}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-22*x+y-22*z-6, -2*x+14*y-17*z-18, 22*x+8*y-23*z+14)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(22+4) \\left(\\left((18+10)^2-6\\right)+5\\right)$.", + "Output Answer": [ + "$20358$" + ], + "Output Program": [ + "try: \n print((22+4)*(((18+10)**2-6)+5))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{x}{\\sqrt{\\pi }}-\\frac{24 x^2}{\\sqrt{\\pi }}$ and $q(x) = \\frac{21 x^2}{\\sqrt{\\pi }}-\\frac{5 x}{\\sqrt{\\pi }}+\\frac{16}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{504 x^4}{\\pi }+\\frac{141 x^3}{\\pi }-\\frac{389 x^2}{\\pi }+\\frac{16 x}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = (x/(sqrt(pi)))-((24*x**2)/(sqrt(pi)))\nq = ((21*x**2)/(sqrt(pi)))-((5*x)/(sqrt(pi)))+(16/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x-5}+\\sqrt{5 x+6}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(43-6 \\sqrt{14}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x-5)+sqrt(5*x+6), 6), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-12 x^4-\\frac{51 x^3}{2}+\\frac{13 x^2}{2}+\\frac{65 x}{2}+\\frac{45}{4}$ and $3 x^3+3 x^2-5 x-\\frac{5}{2}$.", + "Output Answer": [ + "$\\frac{3 x^3}{2}+\\frac{3 x^2}{2}-\\frac{5 x}{2}-\\frac{5}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-12*x**4-((51*x**3)/2)+((13*x**2)/2)+((65*x)/2)+(45/4), 3*x**3+3*x**2-5*x-(5/2)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{14 x}{3}+\\frac{14}{3}}+\\sqrt{\\frac{40 x}{3}-\\frac{40}{3}}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{338} \\left(10503-220 \\sqrt{1743}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((14*x)/3)+(14/3))+sqrt(((40*x)/3)-(40/3)), 11), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{11 x^2}{\\sqrt{3}}+2 \\sqrt{3} x-\\frac{25}{\\sqrt{3}}}{\\frac{7 x^2}{\\sqrt{3}}+\\frac{5 x}{\\sqrt{3}}-\\frac{14}{\\sqrt{3}}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{11} \\left(-3-2 \\sqrt{71}\\right)\\right\\},\\left\\{x\\to \\frac{1}{11} \\left(-3+2 \\sqrt{71}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((11*x**2)/(sqrt(3)))+2*sqrt(3)*x-(25/(sqrt(3))))/(((7*x**2)/(sqrt(3)))+((5*x)/(sqrt(3)))-(14/(sqrt(3))))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{52}{95}$, and $a_n=a_{n-1}+5$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$\\frac{108581}{95}$" + ], + "Output Program": [ + "a = -(52/95) # initial value\nd = 5 # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(52/95) # initial value\nd = 5 # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $12 x^2-\\frac{21 x}{2}-\\frac{19}{2}$", + "Output Answer": [ + "$x=\\frac{1}{48} \\left(21-\\sqrt{2265}\\right)\\lor x=\\frac{1}{48} \\left(21+\\sqrt{2265}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(12*x**2-((21*x)/2)-(19/2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\left(-\\sin \\left(\\frac{\\pi }{45}\\right)-i \\cos \\left(\\frac{\\pi }{45}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1024 \\left(-\\cos \\left(\\frac{2 \\pi }{9}\\right)+i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*(-math.sin((math.pi/45))-1j*math.cos((math.pi/45))))**10)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2 \\sqrt{2} \\left(\\sin \\left(\\frac{\\pi }{180}\\right)-i \\cos \\left(\\frac{\\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $2 \\sqrt{2 \\left(\\sin ^2\\left(\\frac{\\pi }{180}\\right)+\\cos ^2\\left(\\frac{\\pi }{180}\\right)\\right)}$\nArgument: $-\\frac{89 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2*math.sqrt(2)*(math.sin((math.pi/180))-i*math.cos((math.pi/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{13 x^3}{2}-8 x^2+\\frac{x}{2}-\\frac{3}{2}$ when divided by $8 x-\\frac{19}{2}$.", + "Output Answer": [ + "$-\\frac{13 x^2}{16}-\\frac{503 x}{256}-\\frac{9301}{4096}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((13*x**3)/2)-8*x**2+(x/2)-(3/2)\nq = 8*x-(19/2)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{380 x^3}{3}-39 x^2+539 x-\\frac{185}{3}}{180 x^2-333 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{38} \\left(-41-3 \\sqrt{229}\\right)\\right\\},\\left\\{x\\to \\frac{1}{38} \\left(-41+3 \\sqrt{229}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((380*x**3)/3)-39*x**2+539*x-(185/3))/(180*x**2-333*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-8+9 i$ and $y=4+i$", + "Output Answer": [ + "$-12+8 i$" + ], + "Output Program": [ + "i = 1j\nx = -8+9*i\ny = 4+i\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x-11}+\\sqrt{8 x+11}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{11}{4} \\left(31-2 \\sqrt{209}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x-11)+sqrt(8*x+11), 11), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2-34 x$", + "Output Answer": [ + "$-4 \\left(\\frac{17}{2}-x\\right) x$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2-34*x, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $(-1+2 i) \\sqrt{2}$.", + "Output Answer": [ + "Norm: $\\sqrt{10}$\nArgument: $\\pi -\\tan ^{-1}(2)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (-1+2*i)*math.sqrt(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(9 \\left(\\cos \\left(\\frac{19}{10}\\right)+i \\sin \\left(\\frac{19}{10}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$6561 \\left(\\cos \\left(\\frac{38}{5}\\right)+i \\sin \\left(\\frac{38}{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((9*(math.cos((19/10))+1j*math.sin((19/10))))**4)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{3}}, 9, 4)$", + "Output Answer": [ + "$\\left\\{2 \\sqrt{\\frac{73}{3}},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{61}{3}}}{2}\\right),\\tan ^{-1}\\left(9 \\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(3)))\ny = 9\nz = 4\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-11 x^2+2 x-\\frac{10}{3}$", + "Output Answer": [ + "$x=\\frac{1}{33} \\left(3-i \\sqrt{321}\\right)\\lor x=\\frac{1}{33} \\left(3+i \\sqrt{321}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-11*x**2+2*x-(10/3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 x^2-4$", + "Output Answer": [ + "$-2 x^2-4$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*x**2-4), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{8 \\left(\\cos \\left(\\frac{7 \\pi }{30}\\right)-i \\sin \\left(\\frac{7 \\pi }{30}\\right)\\right)}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $8 \\sqrt{\\frac{\\sin ^2\\left(\\frac{7 \\pi }{30}\\right)+\\cos ^2\\left(\\frac{7 \\pi }{30}\\right)}{\\pi }}$\nArgument: $-\\frac{7 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((8*(math.cos(((7*math.pi)/30))-i*math.sin(((7*math.pi)/30))))/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -2 \\sqrt{3} x^2+\\sqrt{3} x+4 \\sqrt{3}$ and $q(x) = 4 \\sqrt{3} x^2-\\sqrt{3} x+6 \\sqrt{3}$", + "Output Answer": [ + "$-24 x^4+18 x^3+9 x^2+6 x+72$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -2*sqrt(3)*x**2+sqrt(3)*x+4*sqrt(3)\nq = 4*sqrt(3)*x**2-sqrt(3)*x+6*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{12}{55}$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$\\frac{4974}{11}$" + ], + "Output Program": [ + "a = (12/55) # initial value\nd = 10 # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (12/55) # initial value\nd = 10 # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(19-22)+((2-24)+23)$.", + "Output Answer": [ + "$-2$" + ], + "Output Program": [ + "try: \n print((19-22)+((2-24)+23))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $11 x^2+4 x+7$", + "Output Answer": [ + "$11 \\left(x+\\frac{2}{11}\\right)^2+\\frac{73}{11}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (11*x**2+4*x+7), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 2 x+9, q(x) = 5 x+8$", + "Output Answer": [ + "$7 x+17$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x+9\nq = 5*x+8\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-6-9 i$ and $y=-5-8 i$", + "Output Answer": [ + "$\\frac{102}{89}-\\frac{3 i}{89}$" + ], + "Output Program": [ + "i = 1j\nx = -6-9*i\ny = -5-8*i\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| -25 x-16| =2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{18}{25}\\right\\},\\left\\{x\\to -\\frac{14}{25}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-25*x-16), 2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{6}{5} \\left(-\\cos \\left(\\frac{2 \\pi }{15}\\right)-i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{60466176 \\left(-\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)}{9765625}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((6/5)*(-math.cos(((2*math.pi)/15))-1j*math.sin(((2*math.pi)/15))))**10)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{97}{38}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$\\frac{61803}{38}$" + ], + "Output Program": [ + "a = -(97/38) # initial value\nd = 8 # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(97/38) # initial value\nd = 8 # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 x^2+3 x+13$, $q(x) = 4 x^2+13 x-14$", + "Output Answer": [ + "$8 x^2+16 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**2+3*x+13\nq = 4*x**2+13*x-14\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\tan (8 x+6)$", + "Output Answer": [ + "$\\frac{8 x+6}{\\pi }+\\frac{1}{2}\\notin \\mathbb{Z}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = tan(8*x+6)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-13 x-8 y-15=0$, $-19 x-19 y+21=0$", + "Output Answer": [ + "$x=-\\frac{453}{95}$, $y=\\frac{558}{95}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-13*x-8*y-15, -19*x-19*y+21), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 x^2-2 x-12$ and $q(x) = 6-5 x^2$", + "Output Answer": [ + "$-25 x^4+10 x^3+90 x^2-12 x-72$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*x**2-2*x-12\nq = 6-5*x**2\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2+4 x-140$", + "Output Answer": [ + "$-((10-x) (x+14))$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2+4*x-140, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-48 x^2+158 x-19}{171-54 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-48*x**2+158*x-19)/(171-54*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 x^2-12 x+6$", + "Output Answer": [ + "$x=-1-\\sqrt{2}\\lor x=\\sqrt{2}-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*x**2-12*x+6, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{7-10}{2+8}$.", + "Output Answer": [ + "$-\\frac{3}{10}$" + ], + "Output Program": [ + "try: \n print(((7-10)/(2+8)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-4 x-6$", + "Output Answer": [ + "$x=-\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-4*x-6, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{5} \\left(74 x^2-23 x-60\\right)$, $q(x) = \\frac{1}{5} \\left(-67 x^2-33 x+29\\right)$", + "Output Answer": [ + "$\\frac{7 x^2}{5}-\\frac{56 x}{5}-\\frac{31}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/5)*(74*x**2-23*x-60)\nq = (1/5)*(-67*x**2-33*x+29)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{16 x^2}{7}+\\frac{50 x}{7}+\\frac{86}{7}$", + "Output Answer": [ + "$\\frac{16}{7} \\left(x+\\frac{25}{16}\\right)^2+\\frac{751}{112}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((16*x**2)/7)+((50*x)/7)+(86/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{64}}{\\sqrt{\\sqrt{195}}}$.", + "Output Answer": [ + "$\\frac{8}{\\sqrt[4]{195}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(64))/(sqrt(sqrt(195)))))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 \\sqrt{2} x^2-\\frac{3 x}{\\sqrt{2}}-\\frac{7}{\\sqrt{2}}$ and $q(x) = 4 \\sqrt{2} x^2-\\sqrt{2} x+10 \\sqrt{2}$", + "Output Answer": [ + "$24 x^4-18 x^3+35 x^2-23 x-70$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*sqrt(2)*x**2-((3*x)/(sqrt(2)))-(7/(sqrt(2)))\nq = 4*sqrt(2)*x**2-sqrt(2)*x+10*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-14-5 i) \\log (2)$ and $y=(-3+13 i) \\log (2)$", + "Output Answer": [ + "$-\\frac{23}{178}+\\frac{197 i}{178}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-14-5*i)*math.log10(2)\ny = (-3+13*i)*math.log10(2)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 15 x+7| =4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{11}{15}\\right\\},\\left\\{x\\to -\\frac{1}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(15*x+7), 4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^4+7 x^3-6 x^2+7 x-2$ when divided by $x+7$.", + "Output Answer": [ + "$9 x^3-56 x^2+386 x-2695$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**4+7*x**3-6*x**2+7*x-2\nq = x+7\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{26 x^2}{3}+\\frac{11 x}{3}-\\frac{20}{3}$", + "Output Answer": [ + "$\\frac{26}{3} \\left(x+\\frac{11}{52}\\right)^2-\\frac{2201}{312}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((26*x**2)/3)+((11*x)/3)-(20/3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-2 \\sqrt{5} x^2-10 \\sqrt{5} x+4 \\sqrt{5}}{3 \\sqrt{5}-6 \\sqrt{5} x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-5-\\sqrt{33}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(-5+\\sqrt{33}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-2*sqrt(5)*x**2-10*sqrt(5)*x+4*sqrt(5))/(3*sqrt(5)-6*sqrt(5)*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2-x+y^2-4 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x-\\frac{1}{20}\\right)^2+(y-2)^2=\\frac{481}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{20} & 2-\\frac{3 \\sqrt{481}}{20} \\\\\n \\frac{1}{20} & 2+\\frac{3 \\sqrt{481}}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{10}}$\nCenter: $\\left\\{\\frac{1}{20},2\\right\\}$\nArea Enclosed: $\\frac{481 \\pi }{40 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2-x+y**2-4*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-6 x^2-8 x+12$", + "Output Answer": [ + "$\\frac{44}{3}-6 \\left(x+\\frac{2}{3}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-6*x**2-8*x+12), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-12 x^2-3 x+7}{9-23 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{24} \\left(-3-\\sqrt{345}\\right)\\right\\},\\left\\{x\\to \\frac{1}{24} \\left(-3+\\sqrt{345}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-12*x**2-3*x+7)/(9-23*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{22+7}{\\frac{\\frac{7+1}{17}}{5}-20}$.", + "Output Answer": [ + "$-\\frac{2465}{1692}$" + ], + "Output Program": [ + "try: \n print(((22+7)/((((7+1)/17)/5)-20)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-4-4 i) \\sqrt{5}$ and $y=(-4-3 i) \\sqrt{5}$", + "Output Answer": [ + "$\\frac{28}{25}+\\frac{4 i}{25}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-4-4*i)*math.sqrt(5)\ny = (-4-3*i)*math.sqrt(5)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(\\cos \\left(\\frac{103}{90}\\right)+i \\sin \\left(\\frac{103}{90}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$27 \\left(\\cos \\left(\\frac{103}{30}\\right)+i \\sin \\left(\\frac{103}{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(math.cos((103/90))+1j*math.sin((103/90))))**3)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-14 x^2-3 x-11$", + "Output Answer": [ + "$-14 \\left(x+\\frac{3}{28}\\right)^2-\\frac{607}{56}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-14*x**2-3*x-11), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x-1}+\\sqrt{12 x-2}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(109-72 \\sqrt{2}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x-1)+sqrt(12*x-2), 6), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+132 \\sqrt{3} x-1188$", + "Output Answer": [ + "$11 \\left(6 \\sqrt{3}-x\\right) \\left(x-6 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+132*sqrt(3)*x-1188, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\log (\\log (8 x+8))$", + "Output Answer": [ + "$x>-\\frac{7}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = log(log(8*x+8))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{101 x}{7}-\\frac{37}{7}}+\\sqrt{\\frac{103 x}{7}+\\frac{69}{7}}=\\frac{62}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(195673-186 \\sqrt{1106617}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((101*x)/7)-(37/7))+sqrt(((103*x)/7)+(69/7)), (62/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{79}{28}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$-\\frac{4724}{7}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (79/28) # initial value\nd = -6 # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (79/28) # initial value\nd = -6 # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-4 x-6 y^2-9 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x-\\frac{2}{5}\\right)^2-6 \\left(y+\\frac{3}{4}\\right)^2=-\\frac{63}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{2}{5} & -\\frac{3}{4}-\\frac{\\sqrt{231}}{20} \\\\\n \\frac{2}{5} & \\frac{1}{20} \\left(\\sqrt{231}-15\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{11}{5}}$\nCenter: $\\left\\{\\frac{2}{5},\\frac{1}{2} \\left(-\\frac{3}{4}-\\frac{\\sqrt{231}}{20}+\\frac{1}{20} \\left(\\sqrt{231}-15\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{60} \\left(4 \\sqrt{30}-45\\right)-\\sqrt{\\frac{5}{6}} x,y=\\sqrt{\\frac{5}{6}} x+\\frac{1}{60} \\left(-45-4 \\sqrt{30}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-4*x-6*y**2-9*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$14 x-17 y+23=0$, $7 x-20 y-3=0$", + "Output Answer": [ + "$x=-\\frac{73}{23}$, $y=-\\frac{29}{23}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((14*x-17*y+23, 7*x-20*y-3), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-6 \\sqrt{5} x-11 \\sqrt{5} y-5 \\sqrt{5} z-6 \\sqrt{5}=0$, $6 \\sqrt{5} x-7 \\sqrt{5} y-7 \\sqrt{5} z-3 \\sqrt{5}=0$, $-6 \\sqrt{5} x-2 \\sqrt{5} y+8 \\sqrt{5} z-3 \\sqrt{5}=0$", + "Output Answer": [ + "$x=0$, $y=-\\frac{9}{14}$, $z=\\frac{3}{14}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-6*sqrt(5)*x-11*sqrt(5)*y-5*sqrt(5)*z-6*sqrt(5), 6*sqrt(5)*x-7*sqrt(5)*y-7*sqrt(5)*z-3*sqrt(5), -6*sqrt(5)*x-2*sqrt(5)*y+8*sqrt(5)*z-3*sqrt(5))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2+198 x-949$", + "Output Answer": [ + "$8 \\left(\\frac{73}{4}-x\\right) \\left(x-\\frac{13}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2+198*x-949, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^6-x^5+x^4+17 x^3+19 x^2+15 x+9$ and $x^4-x^2-4 x-3$.", + "Output Answer": [ + "$x^4-x^2-4 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**6-x**5+x**4+17*x**3+19*x**2+15*x+9, x**4-x**2-4*x-3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{32}}{\\sqrt{133}}$.", + "Output Answer": [ + "$4 \\sqrt{\\frac{2}{133}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(32))/(sqrt(133))))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2-8 x+20$", + "Output Answer": [ + "$(2-x) (x+10)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2-8*x+20, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-14 x^2+8 x-11$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(4-i \\sqrt{138}\\right)\\lor x=\\frac{1}{14} \\left(4+i \\sqrt{138}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-14*x**2+8*x-11, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2-4 x+9 y^2-8 y+9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(y-\\frac{4}{9}\\right)^2-9 \\left(x+\\frac{2}{9}\\right)^2=-\\frac{23}{3}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{9} \\left(-2-\\sqrt{138}\\right) & \\frac{4}{9} \\\\\n \\frac{1}{9} \\left(\\sqrt{138}-2\\right) & \\frac{4}{9} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{9} \\left(-2-\\sqrt{138}\\right)+\\frac{1}{9} \\left(\\sqrt{138}-2\\right)\\right),\\frac{4}{9}\\right\\}$\nAsymptotes: $\\left\\{y=x+\\frac{2}{3},y=\\frac{2}{9}-x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2-4*x+9*y**2-8*y+9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{18-4}{19}+16\\right)+((11-25)+19)$.", + "Output Answer": [ + "$\\frac{413}{19}$" + ], + "Output Program": [ + "try: \n print((((18-4)/19)+16)+((11-25)+19))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{15 x^2}{2}-\\frac{9 x}{2}-\\frac{27}{2}}{-\\frac{31 x}{2}-1}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(3-3 \\sqrt{21}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(3+3 \\sqrt{21}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((15*x**2)/2)-((9*x)/2)-(27/2))/(-((31*x)/2)-1)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((25+24)-10)-4) (18-23)^2$.", + "Output Answer": [ + "$875$" + ], + "Output Program": [ + "try: \n print((((25+24)-10)-4)*(18-23)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2$ and $x^3-x^2+4 x+4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2, x**3-x**2+4*x+4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((9+2)-23)+((13+25)-18)$.", + "Output Answer": [ + "$8$" + ], + "Output Program": [ + "try: \n print(((9+2)-23)+((13+25)-18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\sqrt{2} \\left(\\cos \\left(\\frac{11}{15}\\right)+i \\sin \\left(\\frac{11}{15}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1889568 \\left(\\cos \\left(\\frac{22}{3}\\right)+i \\sin \\left(\\frac{22}{3}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*math.sqrt(2)*(math.cos((11/15))+1j*math.sin((11/15))))**10)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 18 x+25| =15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{20}{9}\\right\\},\\left\\{x\\to -\\frac{5}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(18*x+25), 15), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{1}{15} (17+10)^2+12\\right)+((((14+1)-7)-1)-4)$.", + "Output Answer": [ + "$\\frac{318}{5}$" + ], + "Output Program": [ + "try: \n print(((1/15)*(17+10)**2+12)+((((14+1)-7)-1)-4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\sqrt{2} \\left(\\cos \\left(\\frac{7}{15}\\right)+i \\sin \\left(\\frac{7}{15}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$9604 \\left(\\cos \\left(\\frac{28}{15}\\right)+i \\sin \\left(\\frac{28}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*math.sqrt(2)*(math.cos((7/15))+1j*math.sin((7/15))))**4)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-492 x^2+\\frac{1551 x}{8}+\\frac{45}{2}}{\\frac{1353 x}{4}-165}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{32}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-492*x**2+((1551*x)/8)+(45/2))/(((1353*x)/4)-165)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(1-5 i) \\log (2)$ and $y=(2-2 i) \\log (2)$", + "Output Answer": [ + "$(-1-3 i) \\log (2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (1-5*i)*math.log10(2)\ny = (2-2*i)*math.log10(2)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 x^2+15 x+1$ and $q(x) = 2 x^2-12 x-1$", + "Output Answer": [ + "$-10 x^4+90 x^3-173 x^2-27 x-1$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -5*x**2+15*x+1\nq = 2*x**2-12*x-1\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 x^2+x+12$, $q(x) = 5 x^2-14 x-13$", + "Output Answer": [ + "$14 x^2-13 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**2+x+12\nq = 5*x**2-14*x-13\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2-5 x+10 y^2+7 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(y+\\frac{7}{20}\\right)^2-6 \\left(x+\\frac{5}{12}\\right)^2=\\frac{191}{60}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{12} & \\frac{1}{60} \\left(-21-4 \\sqrt{191}\\right) \\\\\n -\\frac{5}{12} & \\frac{1}{60} \\left(4 \\sqrt{191}-21\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{-\\frac{5}{12},\\frac{1}{2} \\left(\\frac{1}{60} \\left(-21-4 \\sqrt{191}\\right)+\\frac{1}{60} \\left(4 \\sqrt{191}-21\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{60} \\left(-21-5 \\sqrt{15}\\right)-\\sqrt{\\frac{3}{5}} x,y=\\sqrt{\\frac{3}{5}} x+\\frac{1}{60} \\left(5 \\sqrt{15}-21\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2-5*x+10*y**2+7*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-15 \\sqrt{2} x^2+12 \\sqrt{2} x+17 \\sqrt{2}}{-10 \\sqrt{2} x^2+18 \\sqrt{2} x+5 \\sqrt{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{15} \\left(6-\\sqrt{291}\\right)\\right\\},\\left\\{x\\to \\frac{1}{15} \\left(6+\\sqrt{291}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-15*sqrt(2)*x**2+12*sqrt(2)*x+17*sqrt(2))/(-10*sqrt(2)*x**2+18*sqrt(2)*x+5*sqrt(2))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(14+12)-(15-14)$.", + "Output Answer": [ + "$25$" + ], + "Output Program": [ + "try: \n print((14+12)-(15-14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| -15 x-22| =-19$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-15*x-22), -19), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{377}{7}-\\frac{276 t}{49}, x(t)=\\frac{12 t}{7}-15$", + "Output Answer": [ + "$y=\\frac{32}{7}-\\frac{23 x}{7}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (377/7)-((276*t)/49)\nx_t = ((12*t)/7)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x-\\frac{7}{3}$ and $\\frac{11 x}{3}+1$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x-(7/3), ((11*x)/3)+1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{25}{23}$, and $a_n=a_{n-1}+5$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$\\frac{12450}{23}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (25/23) # initial value\nd = 5 # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (25/23) # initial value\nd = 5 # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$-\\sqrt[3]{2} \\sqrt[3]{x^4}$", + "Output Answer": [ + "$\\frac{3 \\left(x+2\\ 2^{2/3}\\right)^2}{128 \\sqrt[3]{2}}+\\frac{3 \\left(x+2\\ 2^{2/3}\\right)}{4\\ 2^{2/3}}-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, -cbrt(2)*cbrt(x**4))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2-3 x-7 y^2+y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x-\\frac{3}{14}\\right)^2-7 \\left(y-\\frac{1}{14}\\right)^2=-\\frac{5}{7}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{14} & \\frac{1}{14} \\left(1-2 \\sqrt{10}\\right) \\\\\n \\frac{3}{14} & \\frac{1}{14} \\left(1+2 \\sqrt{10}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{3}{14},\\frac{1}{2} \\left(\\frac{1}{14} \\left(1-2 \\sqrt{10}\\right)+\\frac{1}{14} \\left(1+2 \\sqrt{10}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2}{7}-x,y=x-\\frac{1}{7}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2-3*x-7*y**2+y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{9 x}{2}-\\frac{11}{2}}+\\sqrt{8 x-3}=\\frac{17}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{98} \\left(7155-68 \\sqrt{9977}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((9*x)/2)-(11/2))+sqrt(8*x-3), (17/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{3 \\left(-\\cos \\left(\\frac{\\pi }{30}\\right)+i \\sin \\left(\\frac{\\pi }{30}\\right)\\right)}{\\sqrt{2}}\\right)^2$", + "Output Answer": [ + "$\\frac{9}{2} \\left(\\cos \\left(\\frac{\\pi }{15}\\right)-i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((3*(-math.cos((math.pi/30))+1j*math.sin((math.pi/30))))/(math.sqrt(2))))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(9 \\left(\\cos \\left(\\frac{11}{10}\\right)+i \\sin \\left(\\frac{11}{10}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$387420489 \\left(\\cos \\left(\\frac{99}{10}\\right)+i \\sin \\left(\\frac{99}{10}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((9*(math.cos((11/10))+1j*math.sin((11/10))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 \\sqrt{5} x^2-6 \\sqrt{5} x+3 \\sqrt{5}$", + "Output Answer": [ + "$6 \\sqrt{5}-3 \\sqrt{5} (x+1)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*math.sqrt(5)*x**2-6*math.sqrt(5)*x+3*math.sqrt(5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3-12 x}+\\sqrt{-3 x-4}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{27} \\left(-479+140 \\sqrt{7}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3-12*x)+sqrt(-3*x-4), 10), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11-11 x}+3 \\sqrt{-x}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-479+21 \\sqrt{517}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11-11*x)+3*sqrt(-x), 7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-15 x^4+25 x^3-20 x^2-15 x-15$ and $-3 x^4+5 x^3-4 x^2-3 x-3$.", + "Output Answer": [ + "$3 x^4-5 x^3+4 x^2+3 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-15*x**4+25*x**3-20*x**2-15*x-15, -3*x**4+5*x**3-4*x**2-3*x-3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{53 x^2}{5}-\\frac{8 x}{5}-\\frac{1}{5}$", + "Output Answer": [ + "$x=\\frac{1}{53} \\left(-4-i \\sqrt{37}\\right)\\lor x=\\frac{1}{53} \\left(-4+i \\sqrt{37}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((53*x**2)/5)-((8*x)/5)-(1/5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\log \\left(9 x-\\frac{1}{3}\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{4}{27}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(log(9*x-(1/3)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-13 x-5}+\\sqrt{-12 x-10}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -5620+30 \\sqrt{35030}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-13*x-5)+sqrt(-12*x-10), 15), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^2+2 x-9$ when divided by $9 x+1$.", + "Output Answer": [ + "$\\frac{23}{81}-\\frac{5 x}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**2+2*x-9\nq = 9*x+1\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2+4 x+4 y^2-9 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(y-\\frac{9}{8}\\right)^2-8 \\left(x-\\frac{1}{4}\\right)^2=\\frac{121}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{4} & \\frac{1}{16} \\left(18-11 \\sqrt{6}\\right) \\\\\n \\frac{1}{4} & \\frac{1}{16} \\left(18+11 \\sqrt{6}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{2}}$\nCenter: $\\left\\{\\frac{1}{4},\\frac{1}{2} \\left(\\frac{1}{16} \\left(18-11 \\sqrt{6}\\right)+\\frac{1}{16} \\left(18+11 \\sqrt{6}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{8} \\left(9+2 \\sqrt{2}\\right)-\\sqrt{2} x,y=\\sqrt{2} x+\\frac{1}{8} \\left(9-2 \\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2+4*x+4*y**2-9*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((3-22)+16)-(((22-9)+19)+9)$.", + "Output Answer": [ + "$-44$" + ], + "Output Program": [ + "try: \n print(((3-22)+16)-(((22-9)+19)+9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2 x^4+11 x^3-9 x^2+2 x$ and $x^3-5 x^2+2 x$.", + "Output Answer": [ + "$x^3-5 x^2+2 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2*x**4+11*x**3-9*x**2+2*x, x**3-5*x**2+2*x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-6 x+12 y-20=0$, $16 x-20 y+7=0$", + "Output Answer": [ + "$x=\\frac{79}{18}$, $y=\\frac{139}{36}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-6*x+12*y-20, 16*x-20*y+7), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$9 x-21 y+11 z+22=0$, $-12 x+3 y-19 z+10=0$, $-17 x-21 y-19 z+11=0$", + "Output Answer": [ + "$x=-\\frac{2051}{461}$, $y=\\frac{893}{922}$, $z=\\frac{3217}{922}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((9*x-21*y+11*z+22, -12*x+3*y-19*z+10, -17*x-21*y-19*z+11)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 12 x-12| =-9$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(12*x-12), -9), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{9}{89}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$-\\frac{27}{89}$" + ], + "Output Program": [ + "a = -(9/89) # initial value\nd = 0 # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(9/89) # initial value\nd = 0 # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $3 x^2-15 x-12$", + "Output Answer": [ + "$3 \\left(x-\\frac{5}{2}\\right)^2-\\frac{123}{4}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (3*x**2-15*x-12), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{15 x^5}{4}-\\frac{5 x^4}{4}+\\frac{15 x^3}{2}+\\frac{25 x^2}{4}-\\frac{45 x}{4}-\\frac{15}{2}$ and $-\\frac{3 x^5}{2}-\\frac{x^4}{2}+3 x^3+\\frac{5 x^2}{2}-\\frac{9 x}{2}-3$.", + "Output Answer": [ + "$\\frac{3 x^5}{4}+\\frac{x^4}{4}-\\frac{3 x^3}{2}-\\frac{5 x^2}{4}+\\frac{9 x}{4}+\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((15*x**5)/4)-((5*x**4)/4)+((15*x**3)/2)+((25*x**2)/4)-((45*x)/4)-(15/2), -((3*x**5)/2)-((x**4)/2)+3*x**3+((5*x**2)/2)-((9*x)/2)-3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=1-\\frac{7 i}{2}$ and $y=-\\frac{11}{2}-\\frac{9 i}{2}$", + "Output Answer": [ + "$-\\frac{85}{4}+\\frac{59 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = 1-((7*i)/2)\ny = -(11/2)-((9*i)/2)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x^2+2 x+1$ and $4 x^5-x^4+4 x^3-x^2+4 x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x**2+2*x+1, 4*x**5-x**4+4*x**3-x**2+4*x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 10 x^2+8 x-5$ and $q(x) = -11 x^2-10 x+5$", + "Output Answer": [ + "$-110 x^4-188 x^3+25 x^2+90 x-25$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 10*x**2+8*x-5\nq = -11*x**2-10*x+5\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{32 x}{7}+\\frac{60}{7}\\right| =-\\frac{155}{7}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((32*x)/7)+(60/7)), -(155/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{35 x^3+80 x^2-235 x+120}{55 x-55}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{14} \\left(-23-\\sqrt{1201}\\right)\\right\\},\\left\\{x\\to \\frac{1}{14} \\left(-23+\\sqrt{1201}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((35*x**3+80*x**2-235*x+120)/(55*x-55)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-6 t^2+180 t-1351, x(t)=t^2-30 t+225$", + "Output Answer": [ + "$y=-6 x-1$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -6*t**2+180*t-1351\nx_t = t**2-30*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -3 x^2-4 x+13$ and $q(x) = -4 x^2-4 x+12$", + "Output Answer": [ + "$12 x^4+28 x^3-72 x^2-100 x+156$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -3*x**2-4*x+13\nq = -4*x**2-4*x+12\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -8 x^2+4 x+13$ and $q(x) = -4 x^2-x-13$", + "Output Answer": [ + "$32 x^4-8 x^3+48 x^2-65 x-169$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -8*x**2+4*x+13\nq = -4*x**2-x-13\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -2 e x^2+5 e x+5 e$ and $q(x) = 4 e x^2-e x+4 e$", + "Output Answer": [ + "$-8 e^2 x^4+22 e^2 x^3+7 e^2 x^2+15 e^2 x+20 e^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -2*math.e*x**2+5*math.e*x+5*math.e\nq = 4*math.e*x**2-math.e*x+4*math.e\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{11}{10}$, and $a_n=a_{n-1}+-3$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$-\\frac{553}{10}$" + ], + "Output Program": [ + "a = (11/10) # initial value\nd = -3 # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (11/10) # initial value\nd = -3 # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2-\\frac{36 x}{5}-1128$", + "Output Answer": [ + "$-12 (10-x) \\left(x+\\frac{47}{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2-((36*x)/5)-1128, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{x^2}{\\sqrt{2}}+5 \\sqrt{2} x+\\frac{15}{\\sqrt{2}}$", + "Output Answer": [ + "$20 \\sqrt{2}-\\frac{(x-5)^2}{\\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((x**2)/(math.sqrt(2)))+5*math.sqrt(2)*x+(15/(math.sqrt(2)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{162 x^2}{7}+\\frac{145 x}{7}-\\frac{85}{7}}{-\\frac{169 x}{7}-\\frac{111}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{324} \\left(-145-\\sqrt{76105}\\right)\\right\\},\\left\\{x\\to \\frac{1}{324} \\left(-145+\\sqrt{76105}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((162*x**2)/7)+((145*x)/7)-(85/7))/(-((169*x)/7)-(111/7))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 x^2-13 x-5$ and $q(x) = -5 x^2-12 x+13$", + "Output Answer": [ + "$25 x^4+125 x^3+116 x^2-109 x-65$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -5*x**2-13*x-5\nq = -5*x**2-12*x+13\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{31 x}{\\sqrt{3}}+\\frac{13}{\\sqrt{3}}\\right| =\\frac{32}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{45}{31}\\right\\},\\left\\{x\\to \\frac{19}{31}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((31*x)/(sqrt(3)))+(13/(sqrt(3)))), (32/(sqrt(3)))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 22-16 x| =13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{9}{16}\\right\\},\\left\\{x\\to \\frac{35}{16}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(22-16*x), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(14-19)-(19+2)$.", + "Output Answer": [ + "$-26$" + ], + "Output Program": [ + "try: \n print((14-19)-(19+2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\sqrt{3} \\left(\\cos \\left(\\frac{23}{18}\\right)+i \\sin \\left(\\frac{23}{18}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-3 \\sqrt{3} \\left(\\cos \\left(\\frac{23}{6}\\right)+i \\sin \\left(\\frac{23}{6}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-math.sqrt(3)*(math.cos((23/18))+1j*math.sin((23/18))))**3)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=e^{6 x^3+8}-\\cos (5)$ at the point $x=-9$", + "Output Answer": [ + "$\\frac{1}{e^{4366}}-\\cos (5) = -0.284$" + ], + "Output Program": [ + "import math\n\nx = -9\ntry: \n f = math.e**(6*x**3+8)-math.cos(5)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 x^2+9 x+\\frac{17}{2}$", + "Output Answer": [ + "$\\frac{149}{8}-2 \\left(x-\\frac{9}{4}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*x**2+9*x+(17/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(((16-8)-22)^2+17\\right)-((8+22)-2)$.", + "Output Answer": [ + "$185$" + ], + "Output Program": [ + "try: \n print((((16-8)-22)**2+17)-((8+22)-2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{7 x^2}{2}+\\frac{5 x}{2}-\\frac{5}{2}$ when divided by $\\frac{3 x^2}{2}-\\frac{x}{2}-9$.", + "Output Answer": [ + "$-\\frac{7}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((7*x**2)/2)+((5*x)/2)-(5/2)\nq = ((3*x**2)/2)-(x/2)-9\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-11 x-1}+\\sqrt{15-x}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{50} \\left(-374+7 \\sqrt{2199}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-11*x-1)+sqrt(15-x), 7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{53}{4}-\\frac{13 x}{4}}+\\sqrt{\\frac{55 x}{4}+\\frac{27}{4}}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{578} \\left(746-15 \\sqrt{4183}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((53/4)-((13*x)/4))+sqrt(((55*x)/4)+(27/4)), 5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $6 x^2+40 \\sqrt{3} x-312$", + "Output Answer": [ + "$6 \\left(-x-\\frac{26}{\\sqrt{3}}\\right) \\left(2 \\sqrt{3}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(6*x**2+40*sqrt(3)*x-312, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\frac{\\log (5 x-7)}{\\sqrt[3]{\\frac{17 x}{3}+\\frac{4}{3}}}$", + "Output Answer": [ + "$x>\\frac{7}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = ((log(5*x-7))/(cbrt(((17*x)/3)+(4/3))))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{32 x^4}{5}+\\frac{32 x^3}{5}-3 x^2+\\frac{37 x}{5}+\\frac{47}{5}$ when divided by $-\\frac{12 x^4}{5}-\\frac{31 x^2}{5}-\\frac{48 x}{5}+\\frac{9}{5}$.", + "Output Answer": [ + "$-\\frac{8}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((32*x**4)/5)+((32*x**3)/5)-3*x**2+((37*x)/5)+(47/5)\nq = -((12*x**4)/5)-((31*x**2)/5)-((48*x)/5)+(9/5)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2+64 x+1672$", + "Output Answer": [ + "$-8 (x-19) (x+11)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2+64*x+1672, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$16 \\sqrt{2} x-13 \\sqrt{2} y+\\sqrt{2}=0$, $6 \\sqrt{2} x+14 \\sqrt{2} y+2 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{20}{151}$, $y=-\\frac{13}{151}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((16*sqrt(2)*x-13*sqrt(2)*y+sqrt(2), 6*sqrt(2)*x+14*sqrt(2)*y+2*sqrt(2)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 e x^2+2 e x-3 e$ and $q(x) = -4 e x^2-4 e x-5 e$", + "Output Answer": [ + "$-12 e^2 x^4-20 e^2 x^3-11 e^2 x^2+2 e^2 x+15 e^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = 3*math.e*x**2+2*math.e*x-3*math.e\nq = -4*math.e*x**2-4*math.e*x-5*math.e\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{27}{\\sqrt{2}}-3 \\sqrt{2} x\\right| =11 \\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5}{6}\\right\\},\\left\\{x\\to \\frac{49}{6}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs((27/(sqrt(2)))-3*sqrt(2)*x), 11*sqrt(2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$20 x+19 y-6=0$, $-19 x-4 y+9=0$", + "Output Answer": [ + "$x=\\frac{147}{281}$, $y=-\\frac{66}{281}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((20*x+19*y-6, -19*x-4*y+9), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-2 x^2+9 x+8}{19 x-25}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(9-\\sqrt{145}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(9+\\sqrt{145}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-2*x**2+9*x+8)/(19*x-25)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{11}{37}$, and $a_n=a_{n-1}+7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$\\frac{31256}{37}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (11/37) # initial value\nd = 7 # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (11/37) # initial value\nd = 7 # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(9 \\left(\\cos \\left(\\frac{41}{90}\\right)+i \\sin \\left(\\frac{41}{90}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$3486784401 \\left(\\cos \\left(\\frac{41}{9}\\right)+i \\sin \\left(\\frac{41}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((9*(math.cos((41/90))+1j*math.sin((41/90))))**10)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{3}{5}$ and $\\frac{14 x^5}{5}-\\frac{13 x^4}{5}-\\frac{24 x^3}{5}+\\frac{16 x^2}{5}-\\frac{8 x}{5}-\\frac{8}{5}$.", + "Output Answer": [ + "$\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd((3/5), ((14*x**5)/5)-((13*x**4)/5)-((24*x**3)/5)+((16*x**2)/5)-((8*x)/5)-(8/5)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{1}{20} ((9+17)+24)^2+8\\right)-\\left(\\left(\\left(\\frac{5}{20}-10\\right)+20\\right)+7\\right)$.", + "Output Answer": [ + "$\\frac{463}{4}$" + ], + "Output Program": [ + "try: \n print(((1/20)*((9+17)+24)**2+8)-((((5/20)-10)+20)+7))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$19 x-4 y-8 z+4=0$, $-9 x+y-24=0$, $-20 x-22 y-5 z-5=0$", + "Output Answer": [ + "$x=-\\frac{1268}{553}$, $y=\\frac{1860}{553}$, $z=-\\frac{3665}{553}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((19*x-4*y-8*z+4, -9*x+y-24, -20*x-22*y-5*z-5)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2+384 x+3060$", + "Output Answer": [ + "$-12 (-x-15) (x+17)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2+384*x+3060, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-14 x-6 y+20=0$, $-20 x-y+25=0$", + "Output Answer": [ + "$x=\\frac{65}{53}$, $y=\\frac{25}{53}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-14*x-6*y+20, -20*x-y+25), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-6 x^2-2 x-15$", + "Output Answer": [ + "$-6 \\left(x+\\frac{1}{6}\\right)^2-\\frac{89}{6}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-6*x**2-2*x-15), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{22-18 i}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{2 \\sqrt{202}}{\\pi }$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{9}{11}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((22-18*i)/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+x+8 y^2+4 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x+\\frac{1}{8}\\right)^2+8 \\left(y+\\frac{1}{4}\\right)^2=\\frac{121}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{16} \\left(-2-11 \\sqrt{2}\\right) & -\\frac{1}{4} \\\\\n \\frac{1}{16} \\left(11 \\sqrt{2}-2\\right) & -\\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{16} \\left(-2-11 \\sqrt{2}\\right)+\\frac{1}{16} \\left(11 \\sqrt{2}-2\\right)\\right),-\\frac{1}{4}\\right\\}$\nArea Enclosed: $\\frac{121 \\pi }{64 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+x+8*y**2+4*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((21+21)+15) \\left(\\frac{1}{7} ((15+18)-8)\\right)$.", + "Output Answer": [ + "$\\frac{1425}{7}$" + ], + "Output Program": [ + "try: \n print(((21+21)+15)*((1/7)*((15+18)-8)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $10 x^2-15 x-5$", + "Output Answer": [ + "$10 \\left(x-\\frac{3}{4}\\right)^2-\\frac{85}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (10*x**2-15*x-5), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-3+\\frac{13 i}{3}$ and $y=-8+\\frac{13 i}{3}$", + "Output Answer": [ + "$-11+\\frac{26 i}{3}$" + ], + "Output Program": [ + "i = 1j\nx = -3+((13*i)/3)\ny = -8+((13*i)/3)\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{9 \\left(\\frac{\\sqrt{3}}{2}-\\frac{i}{2}\\right)}{\\sqrt{2}}\\right)^8$", + "Output Answer": [ + "$\\frac{43046721}{16} \\left(-\\frac{1}{2}+\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((9*(((math.sqrt(3))/2)-(i/2)))/(math.sqrt(2))))**8)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{11}{2} \\left(-\\cos \\left(\\frac{2 \\pi }{15}\\right)-i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$\\frac{3138428376721 \\left(\\frac{1}{4} \\left(\\sqrt{5}-1\\right)-i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)}{4096}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(11/2)*(-math.cos(((2*math.pi)/15))-1j*math.sin(((2*math.pi)/15))))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8 x-10}+\\sqrt{10 x-7}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(897-20 \\sqrt{1978}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8*x-10)+sqrt(10*x-7), 10), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$23 x-8 y-8=0$, $x-7 y-11=0$", + "Output Answer": [ + "$x=-\\frac{32}{153}$, $y=-\\frac{245}{153}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((23*x-8*y-8, x-7*y-11), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 \\sqrt{3} (x-1), q(x) = 75 x^2$", + "Output Answer": [ + "$75 x^2+4 \\sqrt{3} x-4 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*sqrt(3)*(x-1)\nq = 75*x**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^5-2 x^4-7 x^3+x^2-10 x+3$ when divided by $-6 x^2+x+9$.", + "Output Answer": [ + "$x^3+\\frac{x^2}{2}+\\frac{11 x}{4}+\\frac{25}{24}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**5-2*x**4-7*x**3+x**2-10*x+3\nq = -6*x**2+x+9\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $4 \\sqrt{2} x^2+6 \\sqrt{2} x+9 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{3}{4} \\left(-1-i \\sqrt{3}\\right)\\lor x=\\frac{3}{4} \\left(-1+i \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(4*sqrt(2)*x**2+6*sqrt(2)*x+9*sqrt(2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=e^{-x-1}$ at the point $x=3$", + "Output Answer": [ + "$\\frac{1}{e^4} = 0.018$" + ], + "Output Program": [ + "import math\n\nx = 3\ntry: \n f = math.e**(-x-1)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -4 x^2+14 x-13\\right| =14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(7-\\sqrt{53}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(7+\\sqrt{53}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-4*x**2+14*x-13), 14), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8 x-4}+\\sqrt{14 x-1}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(925-26 \\sqrt{1165}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8*x-4)+sqrt(14*x-1), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{8 x+2}{\\sqrt{3}}, q(x) = \\frac{1}{9} (1-7 x)^4$", + "Output Answer": [ + "$\\frac{2401 x^4}{9}-\\frac{1372 x^3}{9}+\\frac{98 x^2}{3}+\\frac{8 x}{\\sqrt{3}}-\\frac{28 x}{9}+\\frac{2}{\\sqrt{3}}+\\frac{1}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((8*x+2)/(sqrt(3)))\nq = (1/9)*(1-7*x)**4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -6 \\sqrt{2} x^2+6 \\sqrt{2} x+6 \\sqrt{2}$ and $q(x) = 8 \\sqrt{2} x^2+2 \\sqrt{2} x-7 \\sqrt{2}$", + "Output Answer": [ + "$-96 x^4+72 x^3+204 x^2-60 x-84$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -6*sqrt(2)*x**2+6*sqrt(2)*x+6*sqrt(2)\nq = 8*sqrt(2)*x**2+2*sqrt(2)*x-7*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(-\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1048576 \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)+i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(-math.cos(((2*math.pi)/9))-1j*math.sin(((2*math.pi)/9))))**10)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2+12 x-2880$", + "Output Answer": [ + "$-12 (15-x) (x+16)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2+12*x-2880, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-144 t^2+720 t-893, x(t)=36 t^2-180 t+225$", + "Output Answer": [ + "$y=7-4 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -144*t**2+720*t-893\nx_t = 36*t**2-180*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{3}, \\frac{1}{\\sqrt{2}}, 8)$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{\\frac{1163}{2}}}{3},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{11}{2}}}{24}\\right),\\tan ^{-1}\\left(\\frac{3}{\\sqrt{2}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/3)\ny = (1/(math.sqrt(2)))\nz = 8\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{(21-2)+25}{(((11-24)+5)-2)-11}$.", + "Output Answer": [ + "$-\\frac{44}{21}$" + ], + "Output Program": [ + "try: \n print((((21-2)+25)/((((11-24)+5)-2)-11)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{11-12 i}{\\sqrt{3}}$ and $y=\\frac{1-4 i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{37}{3}+\\frac{56 i}{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((11-12*i)/(math.sqrt(3)))\ny = ((1-4*i)/(math.sqrt(3)))\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{120}+\\sqrt{160}$.", + "Output Answer": [ + "$2 \\sqrt{10} \\left(2+\\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(120)+sqrt(160))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 21 x-12| =7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5}{21}\\right\\},\\left\\{x\\to \\frac{19}{21}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(21*x-12), 7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=e^{\\tan (6-4 x)}$ at the point $x=3$", + "Output Answer": [ + "$e^{-\\tan (6)} = 1.338$" + ], + "Output Program": [ + "import math\n\nx = 3\ntry: \n f = math.e**(math.tan(6-4*x))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -11 x^2-13 x-6$ and $q(x) = -4 x^2+4 x+14$", + "Output Answer": [ + "$44 x^4+8 x^3-182 x^2-206 x-84$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -11*x**2-13*x-6\nq = -4*x**2+4*x+14\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-20 x^4-15 x^3-15 x-10$ and $4 x^4+3 x^3+3 x+2$.", + "Output Answer": [ + "$4 x^4+3 x^3+3 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-20*x**4-15*x**3-15*x-10, 4*x**4+3*x**3+3*x+2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -x^2+14 x+1$ and $q(x) = 12 x^2-8 x-8$", + "Output Answer": [ + "$-12 x^4+176 x^3-92 x^2-120 x-8$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -x**2+14*x+1\nq = 12*x**2-8*x-8\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{25 x^2-5 x+4}{\\sqrt{3}}$, $q(x) = \\frac{-23 x^2-24 x+26}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{2 x^2}{\\sqrt{3}}-8 \\sqrt{3} x-\\frac{5 x}{\\sqrt{3}}+10 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((25*x**2-5*x+4)/(sqrt(3)))\nq = ((-23*x**2-24*x+26)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-6 x+3 y^2-3 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-6 x+3 y^2-3 y=5$\nVertex: $\\left\\{-\\frac{23}{24},\\frac{1}{2}\\right\\}$\nDirectrix: $x=-\\frac{35}{24}$\nFocal Parameter: $1$\nFocus: $\\left\\{-\\frac{11}{24},\\frac{1}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x+3*y**2-3*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=5 t^2-150 t+1128, x(t)=t^2-30 t+225$", + "Output Answer": [ + "$y=5 x+3$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 5*t**2-150*t+1128\nx_t = t**2-30*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{4}{5}+\\frac{24 i}{5}$ and $y=9+7 i$", + "Output Answer": [ + "$\\frac{102}{325}+\\frac{94 i}{325}$" + ], + "Output Program": [ + "i = 1j\nx = (4/5)+((24*i)/5)\ny = 9+7*i\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-27 t+\\sqrt{3}+81, x(t)=3 \\sqrt{3} t-9 \\sqrt{3}$", + "Output Answer": [ + "$y=\\sqrt{3}-3 \\sqrt{3} x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -27*t+sqrt(3)+81\nx_t = 3*sqrt(3)*t-9*sqrt(3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{150 x}{7}+\\frac{125}{7}\\right| =\\frac{81}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{103}{75}\\right\\},\\left\\{x\\to -\\frac{22}{75}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((150*x)/7)+(125/7)), (81/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=8-\\frac{27 i}{5}$ and $y=-\\frac{34}{5}+\\frac{23 i}{5}$", + "Output Answer": [ + "$\\frac{6}{5}-\\frac{4 i}{5}$" + ], + "Output Program": [ + "i = 1j\nx = 8-((27*i)/5)\ny = -(34/5)+((23*i)/5)\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{4} (17-4 x)^2, q(x) = \\frac{1}{16} (21 x+22)^2$", + "Output Answer": [ + "$\\frac{505 x^2}{16}+\\frac{95 x}{4}+\\frac{205}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/4)*(17-4*x)**2\nq = (1/16)*(21*x+22)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+4 x+8 y^2-6 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $7 \\left(x+\\frac{2}{7}\\right)^2+8 \\left(y-\\frac{3}{8}\\right)^2=\\frac{375}{56}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{7}-\\frac{5 \\sqrt{15}}{56} & \\frac{3}{8} \\\\\n \\frac{5 \\sqrt{15}}{56}-\\frac{2}{7} & \\frac{3}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{2 \\sqrt{2}}$\nCenter: $\\left\\{-\\frac{2}{7},\\frac{3}{8}\\right\\}$\nArea Enclosed: $\\frac{375 \\pi }{112 \\sqrt{14}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+4*x+8*y**2-6*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^4+7 x^3-8 x^2+7 x-2$ when divided by $9$.", + "Output Answer": [ + "$-\\frac{7 x^4}{9}+\\frac{7 x^3}{9}-\\frac{8 x^2}{9}+\\frac{7 x}{9}-\\frac{2}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**4+7*x**3-8*x**2+7*x-2\nq = 9\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(17+19)+((10-7)-6)$.", + "Output Answer": [ + "$33$" + ], + "Output Program": [ + "try: \n print((17+19)+((10-7)-6))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{7-9 x}+\\sqrt{4 x+14}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{169} \\left(-271+12 \\sqrt{706}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(7-9*x)+sqrt(4*x+14), 6), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{260 x^2-151 x-\\frac{57}{2}}{-140 x^2+49 x+\\frac{21}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{19}{26}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((260*x**2-151*x-(57/2))/(-140*x**2+49*x+(21/2))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^6-6 x^5+7 x^4+4 x^3+9 x^2-9 x+1$ when divided by $-5$.", + "Output Answer": [ + "$\\frac{6 x^6}{5}+\\frac{6 x^5}{5}-\\frac{7 x^4}{5}-\\frac{4 x^3}{5}-\\frac{9 x^2}{5}+\\frac{9 x}{5}-\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**6-6*x**5+7*x**4+4*x**3+9*x**2-9*x+1\nq = -5\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=0$ and $y=(1+2 i) \\sqrt{3}$", + "Output Answer": [ + "$(1+2 i) \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = 0\ny = (1+2*i)*math.sqrt(3)\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 7 \\sqrt{2} x^2+3 \\sqrt{2} x-5 \\sqrt{2}\\right| =5 \\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{10}{7}\\right\\},\\left\\{x\\to -\\frac{3}{7}\\right\\},\\{x\\to 0\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(7*sqrt(2)*x**2+3*sqrt(2)*x-5*sqrt(2)), 5*sqrt(2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3$ and $-4 x^4-x^3-5 x^2+3 x+1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3, -4*x**4-x**3-5*x**2+3*x+1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{72 x^2}{5}-\\frac{19 x}{5}+\\frac{56}{5}$", + "Output Answer": [ + "$x=\\frac{1}{144} \\left(19-i \\sqrt{15767}\\right)\\lor x=\\frac{1}{144} \\left(19+i \\sqrt{15767}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((72*x**2)/5)-((19*x)/5)+(56/5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 (1-2 x)^4, q(x) = 324$", + "Output Answer": [ + "$64 x^4-128 x^3+96 x^2-32 x+328$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*(1-2*x)**4\nq = 324\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{77}-\\sqrt{48}\\right)-\\sqrt{\\sqrt{145}+\\sqrt{57}}$.", + "Output Answer": [ + "$-4 \\sqrt{3}+\\sqrt{77}-\\sqrt{\\sqrt{57}+\\sqrt{145}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(77)-sqrt(48))-sqrt(sqrt(145)+sqrt(57)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $9 x^2-81 \\sqrt{2} x+252$", + "Output Answer": [ + "$9 \\left(2 \\sqrt{2}-x\\right) \\left(7 \\sqrt{2}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(9*x**2-81*sqrt(2)*x+252, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $x^2-4 x-2$", + "Output Answer": [ + "$(x-2)^2-6$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (x**2-4*x-2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(2+i) \\pi$ and $y=-2 i \\pi$", + "Output Answer": [ + "$-\\frac{1}{2}+i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (2+i)*math.pi\ny = -2*i*math.pi\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{10 x^2}{7}+\\frac{18 x}{7}+\\frac{101}{7}$", + "Output Answer": [ + "$\\frac{1091}{70}-\\frac{10}{7} \\left(x-\\frac{9}{10}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((10*x**2)/7)+((18*x)/7)+(101/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11-14 x}+\\sqrt{11-12 x}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1625}{2 \\left(-169-2 \\sqrt{7109}\\right)}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11-14*x)+sqrt(11-12*x), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{11}{2}$, and $a_n=a_{n-1}+-5$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$-184$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(11/2) # initial value\nd = -5 # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(11/2) # initial value\nd = -5 # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{20 x^2}{\\pi }-\\frac{40 x}{\\pi }-\\frac{2}{\\pi }$ and $q(x) = \\frac{4 x^2}{\\pi }+\\frac{14 x}{\\pi }-\\frac{6}{\\pi }$", + "Output Answer": [ + "$-\\frac{80 x^4}{\\pi ^2}-\\frac{440 x^3}{\\pi ^2}-\\frac{448 x^2}{\\pi ^2}+\\frac{212 x}{\\pi ^2}+\\frac{12}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((20*x**2)/pi)-((40*x)/pi)-(2/pi)\nq = ((4*x**2)/pi)+((14*x)/pi)-(6/pi)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{1}{343} (41 x-62)^3, q(x) = \\frac{(x-37)^4}{2401}$", + "Output Answer": [ + "$\\frac{x^4}{2401}-\\frac{482595 x^3}{2401}+\\frac{2196876 x^2}{2401}-\\frac{3512296 x}{2401}+\\frac{3542457}{2401}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(1/343)*(41*x-62)**3\nq = (((x-37)**4)/2401)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $x^4-9 x^3-8 x^2-8 x+4$ when divided by $5 x+1$.", + "Output Answer": [ + "$\\frac{x^3}{5}-\\frac{46 x^2}{25}-\\frac{154 x}{125}-\\frac{846}{625}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**4-9*x**3-8*x**2-8*x+4\nq = 5*x+1\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\tan (9-8 x)$", + "Output Answer": [ + "$\\frac{9-8 x}{\\pi }+\\frac{1}{2}\\notin \\mathbb{Z}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = tan(9-8*x)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $5 x^2-85 x+330$", + "Output Answer": [ + "$-5 (6-x) (x-11)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(5*x**2-85*x+330, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -x (13 x+9)$, $q(x) = 13 x^2-6 x+7$", + "Output Answer": [ + "$7-15 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x*(13*x+9)\nq = 13*x**2-6*x+7\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$2 x+24 y+10=0$, $-25 x-3 y-16=0$", + "Output Answer": [ + "$x=-\\frac{59}{99}$, $y=-\\frac{109}{297}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((2*x+24*y+10, -25*x-3*y-16), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{12 x^2+9 x+7}{x-17}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((12*x**2+9*x+7)/(x-17)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-5 \\sqrt{3} x^2+4 \\sqrt{3} x-\\frac{10}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{5} \\left(2+i \\sqrt{\\frac{38}{3}}\\right)\\lor x=\\frac{1}{5} \\left(2-i \\sqrt{\\frac{38}{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-5*sqrt(3)*x**2+4*sqrt(3)*x-(10/(sqrt(3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2+7 x+9 y^2-7 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(y-\\frac{7}{18}\\right)^2-8 \\left(x-\\frac{7}{16}\\right)^2=-\\frac{1489}{288}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{144} \\left(63-\\sqrt{25313}\\right) & \\frac{7}{18} \\\\\n \\frac{1}{144} \\left(63+\\sqrt{25313}\\right) & \\frac{7}{18} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{17}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{144} \\left(63-\\sqrt{25313}\\right)+\\frac{1}{144} \\left(63+\\sqrt{25313}\\right)\\right),\\frac{7}{18}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2 \\sqrt{2} x}{3}-\\frac{7}{72} \\left(3 \\sqrt{2}-4\\right),y=\\frac{7}{72} \\left(4+3 \\sqrt{2}\\right)-\\frac{2 \\sqrt{2} x}{3}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2+7*x+9*y**2-7*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-12 \\sqrt{2} x^2-17 \\sqrt{2} x-2 \\sqrt{2}}{14 \\sqrt{2} x+12 \\sqrt{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{24} \\left(-17-\\sqrt{193}\\right)\\right\\},\\left\\{x\\to \\frac{1}{24} \\left(-17+\\sqrt{193}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-12*sqrt(2)*x**2-17*sqrt(2)*x-2*sqrt(2))/(14*sqrt(2)*x+12*sqrt(2))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2-165 x+154$", + "Output Answer": [ + "$-11 (1-x) (x-14)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2-165*x+154, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{13 e^{-\\frac{17 i \\pi }{60}}}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $\\frac{13}{\\sqrt{\\pi }}$\nArgument: $-\\frac{17 \\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((13*math.e**(-((17*i*math.pi)/60)))/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$9 x-19 y+9 z-4=0$, $-24 x-16 z-16=0$, $-13 x-3 y+14 z-6=0$", + "Output Answer": [ + "$x=-\\frac{62}{115}$, $y=-\\frac{64}{115}$, $z=-\\frac{22}{115}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((9*x-19*y+9*z-4, -24*x-16*z-16, -13*x-3*y+14*z-6)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 \\sqrt{3} x^2-3 \\sqrt{3} x-7 \\sqrt{3}$", + "Output Answer": [ + "$-2 \\sqrt{3} \\left(x+\\frac{3}{4}\\right)^2-\\frac{47 \\sqrt{3}}{8}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*math.sqrt(3)*x**2-3*math.sqrt(3)*x-7*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\sqrt{3}, \\pi, \\frac{1}{5})$", + "Output Answer": [ + "$\\left\\{\\sqrt{\\frac{76}{25}+\\pi ^2},\\tan ^{-1}\\left(5 \\sqrt{3+\\pi ^2}\\right),\\tan ^{-1}\\left(\\frac{\\pi }{\\sqrt{3}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.sqrt(3)\ny = math.pi\nz = (1/5)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{8 \\left(\\cos \\left(\\frac{13 \\pi }{60}\\right)+i \\sin \\left(\\frac{13 \\pi }{60}\\right)\\right)}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $8 \\sqrt{\\frac{1}{3} \\left(\\sin ^2\\left(\\frac{13 \\pi }{60}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{60}\\right)\\right)}$\nArgument: $\\frac{13 \\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((8*(math.cos(((13*math.pi)/60))+i*math.sin(((13*math.pi)/60))))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2+108 \\sqrt{2} x+462$", + "Output Answer": [ + "$12 \\left(-x-\\frac{11}{\\sqrt{2}}\\right) \\left(-x-\\frac{7}{\\sqrt{2}}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2+108*sqrt(2)*x+462, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2-16 x+280$", + "Output Answer": [ + "$-8 (x-5) (x+7)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2-16*x+280, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{4} \\left(18 t^2+180 t+457\\right)^2, x(t)=9 t^2+90 t+225$", + "Output Answer": [ + "$y=x^2+7 x+\\frac{49}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/4)*(18*t**2+180*t+457)**2\nx_t = 9*t**2+90*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=3-8 i$ and $y=5-9 i$", + "Output Answer": [ + "$\\frac{87}{106}-\\frac{13 i}{106}$" + ], + "Output Program": [ + "i = 1j\nx = 3-8*i\ny = 5-9*i\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{9 x}{7}-\\frac{25}{7}}+\\sqrt{\\frac{72 x}{7}-12}=\\frac{32}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{12107-128 \\sqrt{627}}{3087}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((9*x)/7)-(25/7))+sqrt(((72*x)/7)-12), (32/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{12 x^2-25 x+6}{-8 x^2+x-2}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{24} \\left(25-\\sqrt{337}\\right)\\right\\},\\left\\{x\\to \\frac{1}{24} \\left(25+\\sqrt{337}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((12*x**2-25*x+6)/(-8*x**2+x-2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -e x^2-e x+4 e$ and $q(x) = -5 e x^2-3 e x$", + "Output Answer": [ + "$5 e^2 x^4+8 e^2 x^3-17 e^2 x^2-12 e^2 x$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -math.e*x**2-math.e*x+4*math.e\nq = -5*math.e*x**2-3*math.e*x\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x+11}+\\sqrt{7 x+3}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{4}{25} \\left(451-7 \\sqrt{3099}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x+11)+sqrt(7*x+3), 14), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^5-3 x^4-12 x^3+15 x^2+9 x-9$ and $x^3-3 x^2+3$.", + "Output Answer": [ + "$x^3-3 x^2+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**5-3*x**4-12*x**3+15*x**2+9*x-9, x**3-3*x**2+3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $10-4 x$", + "Output Answer": [ + "$x=\\frac{5}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(10-4*x, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 x^2+3 x-2$ and $q(x) = 5 x^2+4 x-4$", + "Output Answer": [ + "$-20 x^4-x^3+18 x^2-20 x+8$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*x**2+3*x-2\nq = 5*x**2+4*x-4\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $1-5 x$ and $-5 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(1-5*x, -5*x-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{361}{729} \\left(323 t^2+1530 t+1809\\right)^2, x(t)=\\frac{361 t^2}{9}+190 t+225$", + "Output Answer": [ + "$y=\\frac{289 x^2}{9}-\\frac{68 x}{3}+4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (361/729)*(323*t**2+1530*t+1809)**2\nx_t = ((361*t**2)/9)+190*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(2 t+39)^2, x(t)=-t-15$", + "Output Answer": [ + "$y=4 x^2-36 x+81$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (2*t+39)**2\nx_t = -t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{4 x^2}{3}-13 x-\\frac{28}{3}$", + "Output Answer": [ + "$\\frac{1073}{48}-\\frac{4}{3} \\left(x+\\frac{39}{8}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((4*x**2)/3)-13*x-(28/3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=9$, and $a_n=a_{n-1}+-\\frac{23}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$-\\frac{423}{5}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 9 # initial value\nd = -(23/5) # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = 9 # initial value\nd = -(23/5) # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{19 x^5}{3}-\\frac{20 x^4}{3}+\\frac{16 x^3}{3}-\\frac{29 x^2}{3}+\\frac{11 x}{3}-8$ when divided by $\\frac{5 x^5}{3}-\\frac{19 x^4}{3}-5 x^3+x-9$.", + "Output Answer": [ + "$\\frac{19}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((19*x**5)/3)-((20*x**4)/3)+((16*x**3)/3)-((29*x**2)/3)+((11*x)/3)-8\nq = ((5*x**5)/3)-((19*x**4)/3)-5*x**3+x-9\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-4 y^2+8 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 x^2-4 (y-1)^2=-10$\nFoci: $\\left(\n\\begin{array}{cc}\n 0 & 1-\\frac{5}{\\sqrt{6}} \\\\\n 0 & 1+\\frac{5}{\\sqrt{6}} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{3}}$\nCenter: $\\{0,1\\}$\nAsymptotes: $\\left\\{y=1-\\sqrt{\\frac{3}{2}} x,y=\\sqrt{\\frac{3}{2}} x+1\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-4*y**2+8*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^3+6 x^2-3 x-4$ when divided by $6 x^3+3 x^2-7 x+9$.", + "Output Answer": [ + "$-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**3+6*x**2-3*x-4\nq = 6*x**3+3*x**2-7*x+9\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{135}+\\sqrt{30}}{\\sqrt{69}}$.", + "Output Answer": [ + "$\\sqrt{\\frac{5}{23}} \\left(3+\\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(135)+sqrt(30))/(sqrt(69))))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 x$, $q(x) = -5 x^2+9 x-14$", + "Output Answer": [ + "$-5 x^2+13 x-14$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x\nq = -5*x**2+9*x-14\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $9 x-3$", + "Output Answer": [ + "$x=\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(9*x-3, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9 x-2}+\\sqrt{12 x+12}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(553-72 \\sqrt{58}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9*x-2)+sqrt(12*x+12), 9), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{7 \\left(\\cos \\left(\\frac{17 \\pi }{90}\\right)-i \\sin \\left(\\frac{17 \\pi }{90}\\right)\\right)}{\\sqrt{2}}\\right)^7$", + "Output Answer": [ + "$-\\frac{823543 \\left(-\\sin \\left(\\frac{8 \\pi }{45}\\right)+i \\cos \\left(\\frac{8 \\pi }{45}\\right)\\right)}{8 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((7*(math.cos(((17*math.pi)/90))-1j*math.sin(((17*math.pi)/90))))/(math.sqrt(2))))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $7 e^{\\frac{4 i \\pi }{5}}$.", + "Output Answer": [ + "Norm: $7$\nArgument: $\\frac{4 \\pi }{5}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 7*math.e**((4*i*math.pi)/5)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\left(\\cos \\left(\\frac{1}{18}\\right)+i \\sin \\left(\\frac{1}{18}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$36 \\left(\\cos \\left(\\frac{1}{9}\\right)+i \\sin \\left(\\frac{1}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*(math.cos((1/18))+1j*math.sin((1/18))))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $3 \\sqrt{2} x^2+9 \\sqrt{2} x-9 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(-3-\\sqrt{21}\\right)\\lor x=\\frac{1}{2} \\left(\\sqrt{21}-3\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(3*sqrt(2)*x**2+9*sqrt(2)*x-9*sqrt(2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{45}{2}$, and $a_n=a_{n-1}+-10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$-\\frac{7125}{2}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(45/2) # initial value\nd = -10 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(45/2) # initial value\nd = -10 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-10 x-y^2-7 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x-\\frac{5}{6}\\right)^2-\\left(y+\\frac{7}{2}\\right)^2=-\\frac{49}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{6} & -\\frac{7}{12} \\left(6+\\sqrt{14}\\right) \\\\\n \\frac{5}{6} & \\frac{7}{12} \\left(\\sqrt{14}-6\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{6}}$\nCenter: $\\left\\{\\frac{5}{6},\\frac{1}{2} \\left(\\frac{7}{12} \\left(\\sqrt{14}-6\\right)-\\frac{7}{12} \\left(6+\\sqrt{14}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{6} \\left(5 \\sqrt{6}-21\\right)-\\sqrt{6} x,y=\\sqrt{6} x+\\frac{1}{6} \\left(-21-5 \\sqrt{6}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-10*x-y**2-7*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{27 x^2}{\\sqrt{2}}-17 \\sqrt{2} x+\\frac{9}{\\sqrt{2}}}{-16 \\sqrt{2} x^2-\\frac{5 x}{\\sqrt{2}}-\\frac{31}{\\sqrt{2}}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{27} \\left(17-\\sqrt{46}\\right)\\right\\},\\left\\{x\\to \\frac{1}{27} \\left(17+\\sqrt{46}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((27*x**2)/(sqrt(2)))-17*sqrt(2)*x+(9/(sqrt(2))))/(-16*sqrt(2)*x**2-((5*x)/(sqrt(2)))-(31/(sqrt(2))))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$e^{5-\\frac{9 x}{2}}$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = math.e**(5-((9*x)/2))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-12 x^3-16 x^2-4 x+4$ and $3 x^3+4 x^2+x-1$.", + "Output Answer": [ + "$3 x^3+4 x^2+x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-12*x**3-16*x**2-4*x+4, 3*x**3+4*x**2+x-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-6 x^2+34 \\sqrt{3} x-144$", + "Output Answer": [ + "$6 \\left(3 \\sqrt{3}-x\\right) \\left(x-\\frac{8}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-6*x**2+34*sqrt(3)*x-144, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^5+9 x^4-x^3+\\frac{9 x^2}{2}-9 x-2$ when divided by $6-x$.", + "Output Answer": [ + "$-6 x^4-45 x^3-269 x^2-\\frac{3237 x}{2}-9702$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**5+9*x**4-x**3+((9*x**2)/2)-9*x-2\nq = 6-x\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $3-\\frac{32 i}{5}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{1249}}{5}$\nArgument: $-\\tan ^{-1}\\left(\\frac{32}{15}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 3-((32*i)/5)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt[3]{\\frac{5 x^3}{3}-\\frac{2}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\sqrt[3]{\\frac{2}{5}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(cbrt(((5*x**3)/3)-(2/3)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $1-3 x$ and $1-3 x$.", + "Output Answer": [ + "$3 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(1-3*x, 1-3*x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-8 x-3}+\\sqrt{12-8 x}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{793}{242}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-8*x-3)+sqrt(12-8*x), 11), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-x^5+4 x^4+2 x^3+4 x^2+x-7$ when divided by $-x^5+6 x^4+7 x^3+9 x^2+x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**5+4*x**4+2*x**3+4*x**2+x-7\nq = -x**5+6*x**4+7*x**3+9*x**2+x-3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{47 x^2}{5}-\\frac{29 x}{5}-5$, $q(x) = \\frac{1}{5} \\left(-18 x^2+9 x-46\\right)$", + "Output Answer": [ + "$-13 x^2-4 x-\\frac{71}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((47*x**2)/5)-((29*x)/5)-5\nq = (1/5)*(-18*x**2+9*x-46)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\left(\\cos \\left(\\frac{62}{45}\\right)+i \\sin \\left(\\frac{62}{45}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$279936 \\left(\\cos \\left(\\frac{434}{45}\\right)+i \\sin \\left(\\frac{434}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*(math.cos((62/45))+1j*math.sin((62/45))))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{89 x}{4}-\\frac{97}{4}\\right| =\\frac{49}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{89}\\right\\},\\left\\{x\\to \\frac{195}{89}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((89*x)/4)-(97/4)), (49/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-5 x+8 y^2+y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x-\\frac{5}{8}\\right)^2+8 \\left(y+\\frac{1}{16}\\right)^2=\\frac{339}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{8}-\\frac{\\sqrt{339}}{16} & -\\frac{1}{16} \\\\\n \\frac{1}{16} \\left(10+\\sqrt{339}\\right) & -\\frac{1}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{5}{8}-\\frac{\\sqrt{339}}{16}+\\frac{1}{16} \\left(10+\\sqrt{339}\\right)\\right),-\\frac{1}{16}\\right\\}$\nArea Enclosed: $\\frac{339 \\pi }{128 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-5*x+8*y**2+y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{3}}, 7, 2)$", + "Output Answer": [ + "$\\left\\{4 \\sqrt{\\frac{10}{3}},\\tan ^{-1}\\left(\\sqrt{\\frac{37}{3}}\\right),\\tan ^{-1}\\left(7 \\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(3)))\ny = 7\nz = 2\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2-6 x-2 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $2 x^2-6 x-2 y=4$\nVertex: $\\left\\{\\frac{3}{2},-\\frac{17}{4}\\right\\}$\nDirectrix: $y=-\\frac{9}{2}$\nFocal Parameter: $\\frac{1}{2}$\nFocus: $\\left\\{\\frac{3}{2},-4\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2-6*x-2*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left((19-6)^2-2\\right) ((((15-4)+2)-25)-21)$.", + "Output Answer": [ + "$-5511$" + ], + "Output Program": [ + "try: \n print(((19-6)**2-2)*((((15-4)+2)-25)-21))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{8} \\left(576 t^2-3024 t+3977\\right)^2, x(t)=32 t^2-168 t+\\frac{441}{2}$", + "Output Answer": [ + "$y=\\frac{81 x^2}{2}+36 x+8$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/8)*(576*t**2-3024*t+3977)**2\nx_t = 32*t**2-168*t+(441/2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-5 x^2-x+10 y^2+4 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(y+\\frac{1}{5}\\right)^2-5 \\left(x+\\frac{1}{10}\\right)^2=\\frac{207}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{10} & \\frac{1}{20} \\left(-4-3 \\sqrt{138}\\right) \\\\\n -\\frac{1}{10} & \\frac{1}{20} \\left(3 \\sqrt{138}-4\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{3}$\nCenter: $\\left\\{-\\frac{1}{10},\\frac{1}{2} \\left(\\frac{1}{20} \\left(-4-3 \\sqrt{138}\\right)+\\frac{1}{20} \\left(3 \\sqrt{138}-4\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{20} \\left(-4-\\sqrt{2}\\right)-\\frac{x}{\\sqrt{2}},y=\\frac{x}{\\sqrt{2}}+\\frac{1}{20} \\left(\\sqrt{2}-4\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-5*x**2-x+10*y**2+4*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-4 \\sqrt{3} x-6 \\sqrt{3} y+5 \\sqrt{3}=0$, $3 \\sqrt{3} x-9 \\sqrt{3} y-14 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{43}{18}$, $y=-\\frac{41}{54}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-4*sqrt(3)*x-6*sqrt(3)*y+5*sqrt(3), 3*sqrt(3)*x-9*sqrt(3)*y-14*sqrt(3)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\pi$ and $y=2 \\pi$", + "Output Answer": [ + "$-\\pi$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = math.pi\ny = 2*math.pi\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $x^2-4 x-2 y^2+3 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $(x-2)^2-2 \\left(y-\\frac{3}{4}\\right)^2=\\frac{63}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n 2-\\frac{3 \\sqrt{21}}{4} & \\frac{3}{4} \\\\\n 2+\\frac{3 \\sqrt{21}}{4} & \\frac{3}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{2}}$\nCenter: $\\left\\{2,\\frac{3}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{2}}-\\sqrt{2}+\\frac{3}{4},y=\\frac{1}{4} \\left(3+4 \\sqrt{2}\\right)-\\frac{x}{\\sqrt{2}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-4*x-2*y**2+3*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-6 x+5 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $5 x^2-6 x+5 y=5$\nVertex: $\\left\\{\\frac{3}{5},\\frac{34}{25}\\right\\}$\nDirectrix: $y=\\frac{161}{100}$\nFocal Parameter: $\\frac{1}{2}$\nFocus: $\\left\\{\\frac{3}{5},\\frac{111}{100}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-6*x+5*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $8 x^3-96 x^2+288 x$", + "Output Answer": [ + "$-8 (6-x) (x-6) x$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(8*x**3-96*x**2+288*x, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3-8 x}+\\sqrt{14}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-90+13 \\sqrt{14}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3-8*x)+sqrt(14), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^5-3 x^4-5 x^3+10 x^2+9 x+4$ when divided by $8 x^5+x^4-8 x^3+6 x^2-2 x$.", + "Output Answer": [ + "$\\frac{7}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**5-3*x**4-5*x**3+10*x**2+9*x+4\nq = 8*x**5+x**4-8*x**3+6*x**2-2*x\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 135 \\sqrt{5} (x+1)^3, q(x) = 2025$", + "Output Answer": [ + "$135 \\sqrt{5} x^3+405 \\sqrt{5} x^2+405 \\sqrt{5} x+135 \\sqrt{5}+2025$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 135*sqrt(5)*(x+1)**3\nq = 2025\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-5 \\sqrt{5} x^2+4 \\sqrt{5} x+5 \\sqrt{5}$", + "Output Answer": [ + "$x=\\frac{1}{5} \\left(2-\\sqrt{29}\\right)\\lor x=\\frac{1}{5} \\left(2+\\sqrt{29}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-5*sqrt(5)*x**2+4*sqrt(5)*x+5*sqrt(5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x-14}+\\sqrt{2 x+7}=7$", + "Output Answer": [ + "$\\{\\{x\\to 9\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x-14)+sqrt(2*x+7), 7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x-5$ and $\\frac{5 x^4}{2}-\\frac{5 x^3}{2}-\\frac{3 x^2}{2}-4 x-1$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x-5, ((5*x**4)/2)-((5*x**3)/2)-((3*x**2)/2)-4*x-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{102 x^2}{5}-\\frac{68 x}{5}+\\frac{14}{5}}{\\frac{124 x}{5}+\\frac{4}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{51} \\left(-17-\\sqrt{646}\\right)\\right\\},\\left\\{x\\to \\frac{1}{51} \\left(-17+\\sqrt{646}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((102*x**2)/5)-((68*x)/5)+(14/5))/(((124*x)/5)+(4/5))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=15 (t+3), x(t)=-5 t-15$", + "Output Answer": [ + "$y=-3 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 15*(t+3)\nx_t = -5*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(1-6 i) \\sqrt{2}$ and $y=(-6-7 i) \\sqrt{2}$", + "Output Answer": [ + "$(7+i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (1-6*i)*math.sqrt(2)\ny = (-6-7*i)*math.sqrt(2)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-130 x^2+184 x+42}{130 x^2-353 x+231}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-130*x**2+184*x+42)/(130*x**2-353*x+231)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{5}{2}-4 i$ and $y=\\frac{19}{2}+\\frac{9 i}{2}$", + "Output Answer": [ + "$-\\frac{167}{442}-\\frac{107 i}{442}$" + ], + "Output Program": [ + "i = 1j\nx = -(5/2)-4*i\ny = (19/2)+((9*i)/2)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{8 x^2}{\\sqrt{3}}-\\frac{22 x}{\\sqrt{3}}-\\frac{20}{\\sqrt{3}}$ and $q(x) = \\frac{26 x^2}{\\sqrt{3}}+\\frac{x}{\\sqrt{3}}+3 \\sqrt{3}$", + "Output Answer": [ + "$-\\frac{208 x^4}{3}-\\frac{580 x^3}{3}-\\frac{614 x^2}{3}-\\frac{218 x}{3}-60$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((8*x**2)/(sqrt(3)))-((22*x)/(sqrt(3)))-(20/(sqrt(3)))\nq = ((26*x**2)/(sqrt(3)))+(x/(sqrt(3)))+3*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 1, q(x) = -(6 x+1)^3$", + "Output Answer": [ + "$-216 x^3-108 x^2-18 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 1\nq = -(6*x+1)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-17 \\sqrt{2} x-8 \\sqrt{2} y-4 \\sqrt{2} z+17 \\sqrt{2}=0$, $-15 \\sqrt{2} x-10 \\sqrt{2} y+17 \\sqrt{2} z+12 \\sqrt{2}=0$, $5 \\sqrt{2} x+10 \\sqrt{2} y-15 \\sqrt{2} z-4 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{389}{465}$, $y=\\frac{119}{465}$, $z=\\frac{17}{93}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-17*sqrt(2)*x-8*sqrt(2)*y-4*sqrt(2)*z+17*sqrt(2), -15*sqrt(2)*x-10*sqrt(2)*y+17*sqrt(2)*z+12*sqrt(2), 5*sqrt(2)*x+10*sqrt(2)*y-15*sqrt(2)*z-4*sqrt(2))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{((24-16)+9)+15}{(((24-16)-23)+3)^2}$.", + "Output Answer": [ + "$\\frac{2}{9}$" + ], + "Output Program": [ + "try: \n print(((((24-16)+9)+15)/((((24-16)-23)+3)**2)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-20 x^4+8 x^3+8 x^2+16 x+20$ and $5 x^4-2 x^3-2 x^2-4 x-5$.", + "Output Answer": [ + "$5 x^4-2 x^3-2 x^2-4 x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-20*x**4+8*x**3+8*x**2+16*x+20, 5*x**4-2*x**3-2*x**2-4*x-5))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-i \\pi$ and $y=(-1+i) \\pi$", + "Output Answer": [ + "$-\\frac{1}{2}+\\frac{i}{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -i*math.pi\ny = (-1+i)*math.pi\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{15-4 x}+\\sqrt{2-3 x}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{452}{-165-7 \\sqrt{551}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(15-4*x)+sqrt(2-3*x), 7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^3-3 x^2+8 x+3$ when divided by $-3 x^2+7 x+10$.", + "Output Answer": [ + "$-x-\\frac{4}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**3-3*x**2+8*x+3\nq = -3*x**2+7*x+10\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2+8 x+y^2+8 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $(y+4)^2-9 \\left(x-\\frac{4}{9}\\right)^2=\\frac{191}{9}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{4}{9} & -4-\\frac{\\sqrt{1910}}{9} \\\\\n \\frac{4}{9} & \\frac{\\sqrt{1910}}{9}-4 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{10}}{3}$\nCenter: $\\left\\{\\frac{4}{9},-4\\right\\}$\nAsymptotes: $\\left\\{y=-3 x-\\frac{8}{3},y=3 x-\\frac{16}{3}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2+8*x+y**2+8*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-2 x-y^2-8 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x-\\frac{1}{5}\\right)^2-(y+4)^2=-\\frac{34}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{5} & -\\frac{2}{5} \\left(10+\\sqrt{51}\\right) \\\\\n \\frac{1}{5} & \\frac{2 \\sqrt{51}}{5}-4 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{6}{5}}$\nCenter: $\\left\\{\\frac{1}{5},\\frac{1}{2} \\left(-4+\\frac{2 \\sqrt{51}}{5}-\\frac{2}{5} \\left(10+\\sqrt{51}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\sqrt{5} x+\\frac{1}{\\sqrt{5}}-4,y=\\sqrt{5} x-\\frac{1}{\\sqrt{5}}-4\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-2*x-y**2-8*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 7 x+6, q(x) = 5 x-8$", + "Output Answer": [ + "$12 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x+6\nq = 5*x-8\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-4 x^2-8 x-10$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(-2-i \\sqrt{6}\\right)\\lor x=\\frac{1}{2} \\left(-2+i \\sqrt{6}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-4*x**2-8*x-10, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\sqrt{3} \\left(\\sin \\left(\\frac{\\pi }{15}\\right)+i \\cos \\left(\\frac{\\pi }{15}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$24 \\sqrt{3} \\left(-\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(-1-\\sqrt{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*math.sqrt(3)*(math.sin((math.pi/15))+1j*math.cos((math.pi/15))))**3)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{37}{3}-\\frac{38 x}{3}}+\\sqrt{\\frac{35}{3}-2 x}=\\frac{35}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{768} \\left(-13427+105 \\sqrt{10713}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((37/3)-((38*x)/3))+sqrt((35/3)-2*x), (35/3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$e^{6 x^3+2}+\\tanh ^{-1}(6-5 x)$", + "Output Answer": [ + "$1 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $3 \\sqrt{5}-\\sqrt{5} x^2$", + "Output Answer": [ + "$x=\\sqrt{3}\\lor x=-\\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(3*sqrt(5)-sqrt(5)*x**2, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\sqrt{3} \\left(\\cos \\left(\\frac{61}{90}\\right)+i \\sin \\left(\\frac{61}{90}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$2985984 \\left(\\cos \\left(\\frac{122}{15}\\right)+i \\sin \\left(\\frac{122}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*math.sqrt(3)*(math.cos((61/90))+1j*math.sin((61/90))))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{5}{3}+\\frac{5 i}{3}$ and $y=-\\frac{7}{3}+8 i$", + "Output Answer": [ + "$\\frac{31}{125}+\\frac{17 i}{125}$" + ], + "Output Program": [ + "i = 1j\nx = -(5/3)+((5*i)/3)\ny = -(7/3)+8*i\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{4}{7}$, and $a_n=a_{n-1}+-5$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$-\\frac{1224}{7}$" + ], + "Output Program": [ + "a = (4/7) # initial value\nd = -5 # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (4/7) # initial value\nd = -5 # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-10 x-4 y-5=0$, $-6 x-2 y+6=0$", + "Output Answer": [ + "$x=\\frac{17}{2}$, $y=-\\frac{45}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-10*x-4*y-5, -6*x-2*y+6), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 21 x^2 \\log (2)-x \\log (2)-10 \\log (2)$ and $q(x) = 3 x^2 \\log (2)+12 \\log (2)$", + "Output Answer": [ + "$63 x^4 \\log ^2(2)-3 x^3 \\log ^2(2)+222 x^2 \\log ^2(2)-12 x \\log ^2(2)-120 \\log ^2(2)$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 21*x**2*log(2)-x*log(2)-10*log(2)\nq = 3*x**2*log(2)+12*log(2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{75 x^2}{7}+\\frac{104 x}{7}+\\frac{104}{7}$", + "Output Answer": [ + "$x=\\frac{2}{75} \\left(-26-7 i \\sqrt{26}\\right)\\lor x=\\frac{2}{75} \\left(-26+7 i \\sqrt{26}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((75*x**2)/7)+((104*x)/7)+(104/7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -8 x^2+12 x+13$, $q(x) = -5 x^2+3 x-7$", + "Output Answer": [ + "$-13 x^2+15 x+6$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**2+12*x+13\nq = -5*x**2+3*x-7\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$24 x-7 y+21 z+10=0$, $16 y+18 z-7=0$, $4 x+13 y+24 z+2=0$", + "Output Answer": [ + "$x=\\frac{837}{584}$, $y=\\frac{299}{146}$, $z=-\\frac{209}{146}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((24*x-7*y+21*z+10, 16*y+18*z-7, 4*x+13*y+24*z+2)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x^2+2 x+4$ and $-5 x^5-3 x^4-4 x^3+2 x^2+3 x-2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x**2+2*x+4, -5*x**5-3*x**4-4*x**3+2*x**2+3*x-2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{66 x^2}{7}-\\frac{41 x}{7}-\\frac{75}{7}$", + "Output Answer": [ + "$x=\\frac{1}{132} \\left(-41-i \\sqrt{18119}\\right)\\lor x=\\frac{1}{132} \\left(-41+i \\sqrt{18119}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((66*x**2)/7)-((41*x)/7)-(75/7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{45}{4}-\\frac{41 x}{4}}+\\sqrt{\\frac{29}{4}-\\frac{33 x}{4}}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{10}{329+3 \\sqrt{12029}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((45/4)-((41*x)/4))+sqrt((29/4)-((33*x)/4)), 6), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -8 x^2-13 x+14$ and $q(x) = -5 x^2+14 x+15$", + "Output Answer": [ + "$40 x^4-47 x^3-372 x^2+x+210$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -8*x**2-13*x+14\nq = -5*x**2+14*x+15\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=10-\\frac{13 i}{2}$ and $y=-\\frac{1}{2}+9 i$", + "Output Answer": [ + "$\\frac{21}{2}-\\frac{31 i}{2}$" + ], + "Output Program": [ + "i = 1j\nx = 10-((13*i)/2)\ny = -(1/2)+9*i\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 18 x-4| =13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{2}\\right\\},\\left\\{x\\to \\frac{17}{18}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(18*x-4), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2-\\frac{52 x}{5}-\\frac{30456}{25}$", + "Output Answer": [ + "$4 \\left(-x-\\frac{81}{5}\\right) \\left(\\frac{94}{5}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2-((52*x)/5)-(30456/25), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-10 \\left(-\\frac{i}{4}+\\frac{i \\sqrt{5}}{4}-\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)$.", + "Output Answer": [ + "Norm: $10 \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}+\\left(\\frac{\\sqrt{5}}{4}-\\frac{1}{4}\\right)^2}$\nArgument: $\\tan ^{-1}\\left(\\frac{\\frac{1}{4}-\\frac{\\sqrt{5}}{4}}{\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -10*(-(i/4)+((i*math.sqrt(5))/4)-math.sqrt((5/8)+((math.sqrt(5))/8)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2-\\frac{57 x}{4}+\\frac{7}{4}$ and $q(x) = -\\frac{13 x^2}{4}-\\frac{35 x}{4}-2$", + "Output Answer": [ + "$\\frac{91 x^4}{2}+\\frac{2701 x^3}{16}+147 x^2+\\frac{211 x}{16}-\\frac{7}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2-((57*x)/4)+(7/4)\nq = -((13*x**2)/4)-((35*x)/4)-2\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -2 e x-3 e$ and $q(x) = -5 e$", + "Output Answer": [ + "$10 e^2 x+15 e^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -2*math.e*x-3*math.e\nq = -5*math.e\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{x^2-\\frac{111 x}{5}+\\frac{67}{5}}{14 x^2+\\frac{123 x}{5}+\\frac{1}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(111-\\sqrt{10981}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(111+\\sqrt{10981}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((x**2-((111*x)/5)+(67/5))/(14*x**2+((123*x)/5)+(1/5))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$6 x-10 y+21 z-17=0$, $-2 x+y+5 z+9=0$, $20 x-19 y+5 z-2=0$", + "Output Answer": [ + "$x=-\\frac{4699}{122}$, $y=-\\frac{2618}{61}$, $z=-\\frac{526}{61}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((6*x-10*y+21*z-17, -2*x+y+5*z+9, 20*x-19*y+5*z-2)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{89}{37}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$-\\frac{43960}{37}$" + ], + "Output Program": [ + "a = -(89/37) # initial value\nd = -6 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(89/37) # initial value\nd = -6 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{7 \\left(-\\sin \\left(\\frac{2 \\pi }{9}\\right)+i \\cos \\left(\\frac{2 \\pi }{9}\\right)\\right)}{\\sqrt{3}}\\right)^11$", + "Output Answer": [ + "$\\frac{1977326743 \\left(\\cos \\left(\\frac{\\pi }{18}\\right)-i \\sin \\left(\\frac{\\pi }{18}\\right)\\right)}{243 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((7*(-math.sin(((2*math.pi)/9))+1j*math.cos(((2*math.pi)/9))))/(math.sqrt(3))))**11)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{5}{3} \\left(\\cos \\left(\\frac{7}{18}\\right)+i \\sin \\left(\\frac{7}{18}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-\\frac{48828125 \\left(\\cos \\left(\\frac{77}{18}\\right)+i \\sin \\left(\\frac{77}{18}\\right)\\right)}{177147}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(5/3)*(math.cos((7/18))+1j*math.sin((7/18))))**11)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((23+3)-25)-6)^2-\\left(\\left(\\frac{7}{13}+4\\right)+19\\right)$.", + "Output Answer": [ + "$\\frac{19}{13}$" + ], + "Output Program": [ + "try: \n print((((23+3)-25)-6)**2-(((7/13)+4)+19))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-4 x+3 y+19 z+7=0$, $21 x+6 y-5 z-19=0$, $4 x+7 y+3 z-3=0$", + "Output Answer": [ + "$x=\\frac{799}{938}$, $y=\\frac{23}{938}$, $z=-\\frac{181}{938}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-4*x+3*y+19*z+7, 21*x+6*y-5*z-19, 4*x+7*y+3*z-3)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 2 \\sqrt{5} \\left(x^2+x+3\\right)$, $q(x) = 2 \\sqrt{5} \\left(x^2-2\\right)$", + "Output Answer": [ + "$4 \\sqrt{5} x^2+2 \\sqrt{5} x+2 \\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*sqrt(5)*(x**2+x+3)\nq = 2*sqrt(5)*(x**2-2)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{82}{59}$, and $a_n=a_{n-1}+\\frac{42}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$\\frac{50808}{59}$" + ], + "Output Program": [ + "a = -(82/59) # initial value\nd = (42/5) # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(82/59) # initial value\nd = (42/5) # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\sqrt{2} \\left(2 t^2-44 t+241\\right), x(t)=2 t^2-44 t+242$", + "Output Answer": [ + "$y=\\sqrt{2} x-\\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = sqrt(2)*(2*t**2-44*t+241)\nx_t = 2*t**2-44*t+242\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -24 x^2+18 x+13\\right| =-19$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-24*x**2+18*x+13), -19), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2-11 x-2310$", + "Output Answer": [ + "$11 (x-15) (x+14)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2-11*x-2310, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-10 x-5}+\\sqrt{-9 x-9}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -1212+48 \\sqrt{635}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-10*x-5)+sqrt(-9*x-9), 8), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-14 x^2+9 x-4$", + "Output Answer": [ + "$x=\\frac{1}{28} \\left(9-i \\sqrt{143}\\right)\\lor x=\\frac{1}{28} \\left(9+i \\sqrt{143}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-14*x**2+9*x-4, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{10 x^2+26 x+16}{-110 x-176}=0$", + "Output Answer": [ + "$\\{\\{x\\to -1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((10*x**2+26*x+16)/(-110*x-176)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $7 \\sqrt{2} x^2+6 \\sqrt{2} x-7 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{7} \\left(-3-\\sqrt{58}\\right)\\lor x=\\frac{1}{7} \\left(\\sqrt{58}-3\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(7*sqrt(2)*x**2+6*sqrt(2)*x-7*sqrt(2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{10 x-7 x^2}{x^2-2 x+15}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to 0\\},\\left\\{x\\to \\frac{10}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((10*x-7*x**2)/(x**2-2*x+15)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-8 x^3+104 x^2+688 x+576$", + "Output Answer": [ + "$-8 (-x-4) (-x-1) (x-18)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-8*x**3+104*x**2+688*x+576, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^3+6 x^2-10 x-5$ when divided by $5 x+10$.", + "Output Answer": [ + "$\\frac{6 x^2}{5}-\\frac{6 x}{5}+\\frac{2}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**3+6*x**2-10*x-5\nq = 5*x+10\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-4 x^2+6 x-13$", + "Output Answer": [ + "$x=\\frac{1}{4} \\left(3-i \\sqrt{43}\\right)\\lor x=\\frac{1}{4} \\left(3+i \\sqrt{43}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-4*x**2+6*x-13, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{5+12 i}{\\sqrt{2}}$.", + "Output Answer": [ + "Norm: $\\frac{13}{\\sqrt{2}}$\nArgument: $\\tan ^{-1}\\left(\\frac{12}{5}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((5+12*i)/(math.sqrt(2)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{24 x^2-17 x-15}{\\sqrt{3}}$, $q(x) = \\frac{-17 x^2+9 x-18}{\\sqrt{3}}$", + "Output Answer": [ + "$8 \\sqrt{3} x^2-\\frac{17 x^2}{\\sqrt{3}}+3 \\sqrt{3} x-\\frac{17 x}{\\sqrt{3}}-11 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((24*x**2-17*x-15)/(sqrt(3)))\nq = ((-17*x**2+9*x-18)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{27 x}{5}+\\frac{2 y}{5}+13=0$, $-\\frac{x}{5}+\\frac{114 y}{5}+\\frac{91}{5}=0$", + "Output Answer": [ + "$x=-\\frac{1807}{770}$, $y=-\\frac{1261}{1540}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((27*x)/5)+((2*y)/5)+13, -(x/5)+((114*y)/5)+(91/5)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2-2 x-8 y^2+9 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(x-\\frac{1}{10}\\right)^2-8 \\left(y-\\frac{9}{16}\\right)^2=-\\frac{549}{160}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{10} & -\\frac{9}{80} \\left(\\sqrt{61}-5\\right) \\\\\n \\frac{1}{10} & \\frac{9}{80} \\left(5+\\sqrt{61}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{5}}$\nCenter: $\\left\\{\\frac{1}{10},\\frac{1}{2} \\left(\\frac{9}{80} \\left(5+\\sqrt{61}\\right)-\\frac{9}{80} \\left(\\sqrt{61}-5\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{80} \\left(45+4 \\sqrt{5}\\right)-\\frac{\\sqrt{5} x}{2},y=\\frac{\\sqrt{5} x}{2}+\\frac{1}{80} \\left(45-4 \\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2-2*x-8*y**2+9*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 \\sqrt{2} x^2+\\frac{x}{\\sqrt{2}}-\\frac{9}{\\sqrt{2}}$", + "Output Answer": [ + "$x=-\\frac{-\\frac{1}{\\sqrt{2}}-i \\sqrt{\\frac{431}{2}}}{12 \\sqrt{2}}\\lor x=-\\frac{-\\frac{1}{\\sqrt{2}}+i \\sqrt{\\frac{431}{2}}}{12 \\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*sqrt(2)*x**2+(x/(sqrt(2)))-(9/(sqrt(2))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x-7}+\\sqrt{5 x+13}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5}{2} \\left(13-\\sqrt{77}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x-7)+sqrt(5*x+13), 10), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{16 x^2}{\\sqrt{3}}-\\frac{8}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{16 x^2}{\\sqrt{3}}-\\frac{8}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((16*x**2)/(math.sqrt(3)))-(8/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{7}{50}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=28$.", + "Output Answer": [ + "$\\frac{75698}{25}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (7/50) # initial value\nd = 8 # second term\nn = 28 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (7/50) # initial value\nd = 8 # second term\nn = 28 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{8-11 i}{\\sqrt{3}}$ and $y=\\frac{16+16 i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{24+5 i}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((8-11*i)/(math.sqrt(3)))\ny = ((16+16*i)/(math.sqrt(3)))\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the fourth order series of the inverse of the following function around 4:\n$\\frac{1}{3 x}$", + "Output Answer": [ + "$-81 \\left(x+\\frac{1}{3}\\right)^4-27 \\left(x+\\frac{1}{3}\\right)^3-9 \\left(x+\\frac{1}{3}\\right)^2-3 \\left(x+\\frac{1}{3}\\right)-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, (1/(3*x)))\nprint(solve(f, x)[0].series(y, 4, 4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 e x^2-e x-4 e$ and $q(x) = 3 e x^2+5 e x-2 e$", + "Output Answer": [ + "$15 e^2 x^4+22 e^2 x^3-27 e^2 x^2-18 e^2 x+8 e^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = 5*math.e*x**2-math.e*x-4*math.e\nq = 3*math.e*x**2+5*math.e*x-2*math.e\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((22-23)+13)+21)-(((7-3)-17)+24)$.", + "Output Answer": [ + "$22$" + ], + "Output Program": [ + "try: \n print((((22-23)+13)+21)-(((7-3)-17)+24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = x^2+15 x-13$ and $q(x) = 7 x^2-2 x-1$", + "Output Answer": [ + "$7 x^4+103 x^3-122 x^2+11 x+13$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = x**2+15*x-13\nq = 7*x**2-2*x-1\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{13}{2}-\\frac{x^2}{2}$", + "Output Answer": [ + "$x=\\sqrt{13}\\lor x=-\\sqrt{13}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve((13/2)-((x**2)/2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-6 x-\\frac{17}{5}}+\\sqrt{-\\frac{19 x}{5}-\\frac{8}{5}}=\\frac{6}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{605} \\left(-2259+12 \\sqrt{25085}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-6*x-(17/5))+sqrt(-((19*x)/5)-(8/5)), (6/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-x^2-2 x+8 y^2+10 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y+\\frac{5}{8}\\right)^2-(x+1)^2=\\frac{33}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -1 & \\frac{1}{8} \\left(-5-3 \\sqrt{33}\\right) \\\\\n -1 & \\frac{1}{8} \\left(3 \\sqrt{33}-5\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $3$\nCenter: $\\left\\{-1,\\frac{1}{2} \\left(\\frac{1}{8} \\left(-5-3 \\sqrt{33}\\right)+\\frac{1}{8} \\left(3 \\sqrt{33}-5\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{8} \\left(-5-2 \\sqrt{2}\\right)-\\frac{x}{2 \\sqrt{2}},y=\\frac{x}{2 \\sqrt{2}}+\\frac{1}{8} \\left(2 \\sqrt{2}-5\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-x**2-2*x+8*y**2+10*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{37 x}{4}-\\frac{43}{4}}+\\sqrt{10 x-10}=\\frac{57}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(27793-76 \\sqrt{133490}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((37*x)/4)-(43/4))+sqrt(10*x-10), (57/4)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{73}{48}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$-\\frac{3675}{16}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(73/48) # initial value\nd = -6 # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(73/48) # initial value\nd = -6 # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{25}{4}-\\frac{19 x}{2}}+\\sqrt{7-2 x}=\\frac{7}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{225} \\left(-293+7 \\sqrt{2551}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((25/4)-((19*x)/2))+sqrt(7-2*x), (7/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((12-11)+15)+\\left((((5-17)-11)+3)^2+10\\right)$.", + "Output Answer": [ + "$426$" + ], + "Output Program": [ + "try: \n print(((12-11)+15)+((((5-17)-11)+3)**2+10))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $x^5-9 x^4-x^3+9 x^2+2 x$ when divided by $5 x^4-7 x^3-6 x^2+5 x+10$.", + "Output Answer": [ + "$\\frac{x}{5}-\\frac{38}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**5-9*x**4-x**3+9*x**2+2*x\nq = 5*x**4-7*x**3-6*x**2+5*x+10\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-3 \\sqrt{5} x^2+6 \\sqrt{5} x+2 \\sqrt{5}$", + "Output Answer": [ + "$x=\\frac{1}{3} \\left(3-\\sqrt{15}\\right)\\lor x=\\frac{1}{3} \\left(3+\\sqrt{15}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-3*sqrt(5)*x**2+6*sqrt(5)*x+2*sqrt(5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$-\\sin \\left(7 x^3\\right)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = -sin(7*x**3)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2+\\frac{182 x}{5}-\\frac{352}{5}$", + "Output Answer": [ + "$2 \\left(\\frac{11}{5}-x\\right) (x-16)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2+((182*x)/5)-(352/5), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{90 x^3-275 x^2+80 x+195}{-200 x^2+380 x-120}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(7-\\sqrt{166}\\right)\\right\\},\\left\\{x\\to \\frac{1}{9} \\left(7+\\sqrt{166}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((90*x**3-275*x**2+80*x+195)/(-200*x**2+380*x-120)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{95}{69}$, and $a_n=a_{n-1}+-7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$-\\frac{34475}{23}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(95/69) # initial value\nd = -7 # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(95/69) # initial value\nd = -7 # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\sqrt{2} \\left(-\\sin \\left(\\frac{4 \\pi }{45}\\right)+i \\cos \\left(\\frac{4 \\pi }{45}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$63274455776 \\sqrt{2} \\left(\\sin \\left(\\frac{\\pi }{45}\\right)+i \\cos \\left(\\frac{\\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*math.sqrt(2)*(-math.sin(((4*math.pi)/45))+1j*math.cos(((4*math.pi)/45))))**11)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $9 x^3-\\frac{99 x^2}{2}+63 x$", + "Output Answer": [ + "$-9 (2-x) \\left(x-\\frac{7}{2}\\right) x$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(9*x**3-((99*x**2)/2)+63*x, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+8 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $7 x^2+8 y=2$\nVertex: $\\left\\{0,\\frac{1}{4}\\right\\}$\nDirectrix: $y=\\frac{15}{28}$\nFocal Parameter: $\\frac{4}{7}$\nFocus: $\\left\\{0,-\\frac{1}{28}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+8*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3-3 x$ and $-5 x^3+4 x^2-x+2$.", + "Output Answer": [ + "$x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3-3*x, -5*x**3+4*x**2-x+2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{39 x^2}{4}-\\frac{25 x}{4}-\\frac{17}{4}$", + "Output Answer": [ + "$x=\\frac{1}{78} \\left(-25-i \\sqrt{2027}\\right)\\lor x=\\frac{1}{78} \\left(-25+i \\sqrt{2027}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((39*x**2)/4)-((25*x)/4)-(17/4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sin \\left(\\frac{5 x^2}{3}+7\\right)+\\cos \\left(\\frac{11}{3}-\\frac{25 x}{3}\\right)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sin(((5*x**2)/3)+7)+cos((11/3)-((25*x)/3))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{8 x^2}{\\sqrt{3}}-\\frac{20 x}{\\sqrt{3}}+\\sqrt{3}$ and $q(x) = 6 \\sqrt{3} x^2-\\frac{2 x}{\\sqrt{3}}-\\frac{4}{\\sqrt{3}}$", + "Output Answer": [ + "$-48 x^4-\\frac{344 x^3}{3}+42 x^2+\\frac{74 x}{3}-4$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((8*x**2)/(sqrt(3)))-((20*x)/(sqrt(3)))+sqrt(3)\nq = 6*sqrt(3)*x**2-((2*x)/(sqrt(3)))-(4/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2+4 x-2$ and $x^5-x^4+4 x^3-x^2+2 x-4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2+4*x-2, x**5-x**4+4*x**3-x**2+2*x-4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{7-17}{\\left(\\left((12-21)^2+14\\right)^2-22\\right)+10}$.", + "Output Answer": [ + "$-\\frac{10}{9013}$" + ], + "Output Program": [ + "try: \n print(((7-17)/((((12-21)**2+14)**2-22)+10)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -3 x^2-12 x-5$ and $q(x) = -10 x^2-12 x-2$", + "Output Answer": [ + "$30 x^4+156 x^3+200 x^2+84 x+10$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -3*x**2-12*x-5\nq = -10*x**2-12*x-2\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{\\log \\left(x^4-6\\right)}$ at the point $x=8$", + "Output Answer": [ + "$\\sqrt[3]{\\log (4090)} = 2.026$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 8\ntry: \n f = np.cbrt(math.log(x**4-6))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $6 x^2+7 x+8$", + "Output Answer": [ + "$x=\\frac{1}{12} \\left(-7-i \\sqrt{143}\\right)\\lor x=\\frac{1}{12} \\left(-7+i \\sqrt{143}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(6*x**2+7*x+8, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{35 x}{4}-\\frac{y}{4}+\\frac{49}{2}=0$, $-\\frac{9 x}{2}-\\frac{43 y}{4}-\\frac{41}{4}=0$", + "Output Answer": [ + "$x=-\\frac{4255}{1523}$, $y=\\frac{329}{1523}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((35*x)/4)-(y/4)+(49/2), -((9*x)/2)-((43*y)/4)-(41/4)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{6 x^5}{5}-\\frac{33 x^4}{5}-5 x^3-\\frac{36 x^2}{5}-\\frac{2 x}{5}-3$ when divided by $\\frac{32 x^5}{5}+\\frac{22 x^4}{5}-2 x^3-\\frac{x^2}{5}-\\frac{21 x}{5}-\\frac{36}{5}$.", + "Output Answer": [ + "$-\\frac{3}{16}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((6*x**5)/5)-((33*x**4)/5)-5*x**3-((36*x**2)/5)-((2*x)/5)-3\nq = ((32*x**5)/5)+((22*x**4)/5)-2*x**3-((x**2)/5)-((21*x)/5)-(36/5)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-12 x-13 y+3=0$, $-23 x-25 y+9=0$", + "Output Answer": [ + "$x=-42$, $y=39$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-12*x-13*y+3, -23*x-25*y+9), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{12 x^2+24 x-4}{-13 x^2-12}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-3-2 \\sqrt{3}\\right)\\right\\},\\left\\{x\\to \\frac{1}{3} \\left(-3+2 \\sqrt{3}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((12*x**2+24*x-4)/(-13*x**2-12)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{14 x^3}{9}-\\frac{23 x^2}{3}-\\frac{1283 x}{9}+\\frac{106}{3}}{-\\frac{490 x}{9}-\\frac{3710}{9}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(25-\\sqrt{577}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(25+\\sqrt{577}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((14*x**3)/9)-((23*x**2)/3)-((1283*x)/9)+(106/3))/(-((490*x)/9)-(3710/9))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left((((12+24)+12)+23)^2+21\\right) \\left((13-8)^2+4\\right)$.", + "Output Answer": [ + "$146798$" + ], + "Output Program": [ + "try: \n print(((((12+24)+12)+23)**2+21)*((13-8)**2+4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-5 \\left(\\cos \\left(\\frac{13}{10}\\right)+i \\sin \\left(\\frac{13}{10}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-78125 \\left(\\cos \\left(\\frac{91}{10}\\right)+i \\sin \\left(\\frac{91}{10}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-5*(math.cos((13/10))+1j*math.sin((13/10))))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\tanh (\\tanh (1))-\\sqrt[3]{3 x+8}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(\\tanh ^3(\\tanh (1))-8\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(tanh*(tanh*1)-cbrt(3*x+8), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $6 x^2+42 \\sqrt{5} x-240$", + "Output Answer": [ + "$6 \\left(x-\\sqrt{5}\\right) \\left(x+8 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(6*x**2+42*sqrt(5)*x-240, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2-16 x+55$", + "Output Answer": [ + "$-((5-x) (x-11))$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2-16*x+55, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-4 e^{\\frac{131 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $4$\nArgument: $-\\frac{49 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -4*math.e**((131*i*math.pi)/180)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{x^3}{2}-3 x^2-10 x-8$ when divided by $4 x^2-6 x+7$.", + "Output Answer": [ + "$\\frac{x}{8}-\\frac{9}{16}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((x**3)/2)-3*x**2-10*x-8\nq = 4*x**2-6*x+7\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{81}{4} (2-3 x)^4, q(x) = \\frac{1}{2} (11-5 x)^2$", + "Output Answer": [ + "$\\frac{6561 x^4}{4}-4374 x^3+\\frac{8773 x^2}{2}-1999 x+\\frac{769}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (81/4)*(2-3*x)**4\nq = (1/2)*(11-5*x)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 10 x^2-6 x-15$ and $q(x) = -2 x^2-4 x-3$", + "Output Answer": [ + "$-20 x^4-28 x^3+24 x^2+78 x+45$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 10*x**2-6*x-15\nq = -2*x**2-4*x-3\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{4 x^2-4 x+1}{-5 x-11}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2}\\right\\},\\left\\{x\\to \\frac{1}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((4*x**2-4*x+1)/(-5*x-11)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{1}{2} ((5+7)+8)+1\\right) ((24+8)+16)$.", + "Output Answer": [ + "$528$" + ], + "Output Program": [ + "try: \n print(((1/2)*((5+7)+8)+1)*((24+8)+16))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{23 x}{\\sqrt{3}}-9 \\sqrt{3} y-\\frac{25 z}{\\sqrt{3}}+\\frac{4}{\\sqrt{3}}=0$, $\\frac{40 x}{\\sqrt{3}}-\\frac{16 z}{\\sqrt{3}}+13 \\sqrt{3}=0$, $-\\frac{40 x}{\\sqrt{3}}-6 \\sqrt{3} y-\\frac{11 z}{\\sqrt{3}}-\\frac{8}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{151}{1976}$, $y=-\\frac{39491}{17784}$, $z=\\frac{2597}{988}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((23*x)/(sqrt(3)))-9*sqrt(3)*y-((25*z)/(sqrt(3)))+(4/(sqrt(3))), ((40*x)/(sqrt(3)))-((16*z)/(sqrt(3)))+13*sqrt(3), -((40*x)/(sqrt(3)))-6*sqrt(3)*y-((11*z)/(sqrt(3)))-(8/(sqrt(3))))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{128}-\\sqrt{69}}{\\sqrt{\\sqrt{116}+\\sqrt{29}}}$.", + "Output Answer": [ + "$-\\frac{\\sqrt{69}-8 \\sqrt{2}}{\\sqrt{3} \\sqrt[4]{29}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(128)-sqrt(69))/(sqrt(sqrt(116)+sqrt(29)))))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{7 x^2+3 x+25}{15 x+9}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((7*x**2+3*x+25)/(15*x+9)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2-9 x+6 y^2+7 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x-\\frac{9}{20}\\right)^2+6 \\left(y+\\frac{7}{12}\\right)^2=\\frac{106}{15}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{9}{20} & \\frac{1}{60} \\left(-35-4 \\sqrt{106}\\right) \\\\\n \\frac{9}{20} & \\frac{1}{60} \\left(4 \\sqrt{106}-35\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{5}}$\nCenter: $\\left\\{\\frac{9}{20},\\frac{1}{2} \\left(\\frac{1}{60} \\left(-35-4 \\sqrt{106}\\right)+\\frac{1}{60} \\left(4 \\sqrt{106}-35\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{53 \\pi }{15 \\sqrt{15}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2-9*x+6*y**2+7*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-12 x-5 y+12=0$, $-2 x+19 y-20=0$", + "Output Answer": [ + "$x=\\frac{64}{119}$, $y=\\frac{132}{119}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-12*x-5*y+12, -2*x+19*y-20), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+187 \\sqrt{3} x-2310$", + "Output Answer": [ + "$-11 \\left(x-10 \\sqrt{3}\\right) \\left(x-7 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+187*sqrt(3)*x-2310, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((17-20)+19)+23)^2 ((5-13)+16)$.", + "Output Answer": [ + "$12168$" + ], + "Output Program": [ + "try: \n print((((17-20)+19)+23)**2*((5-13)+16))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $13 x^2-14 x+8$", + "Output Answer": [ + "$x=\\frac{1}{13} \\left(7-i \\sqrt{55}\\right)\\lor x=\\frac{1}{13} \\left(7+i \\sqrt{55}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(13*x**2-14*x+8, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (x+3)^4, q(x) = -4 (x+1)$", + "Output Answer": [ + "$x^4+12 x^3+54 x^2+104 x+77$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (x+3)**4\nq = -4*(x+1)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -10 \\sqrt{3} x^2+\\frac{32 x}{\\sqrt{3}}-\\frac{23}{\\sqrt{3}}\\right| =\\frac{32}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{30} \\left(16-\\sqrt{526}\\right)\\right\\},\\left\\{x\\to \\frac{1}{30} \\left(16+\\sqrt{526}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-10*sqrt(3)*x**2+((32*x)/(sqrt(3)))-(23/(sqrt(3)))), (32/(sqrt(3)))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{89}{7}-\\frac{101 x}{7}}+\\sqrt{-\\frac{89 x}{7}-\\frac{32}{7}}=\\frac{75}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{168} \\left(-176431+25 \\sqrt{49626273}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((89/7)-((101*x)/7))+sqrt(-((89*x)/7)-(32/7)), (75/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-5-3 i) \\sqrt{3}$ and $y=(3-5 i) \\sqrt{3}$", + "Output Answer": [ + "$-i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-5-3*i)*math.sqrt(3)\ny = (3-5*i)*math.sqrt(3)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(9 \\left(\\cos \\left(\\frac{37}{90}\\right)+i \\sin \\left(\\frac{37}{90}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$4782969 \\left(\\cos \\left(\\frac{259}{90}\\right)+i \\sin \\left(\\frac{259}{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((9*(math.cos((37/90))+1j*math.sin((37/90))))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (2 x+1)^3, q(x) = 9 x-8$", + "Output Answer": [ + "$8 x^3+12 x^2+15 x-7$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (2*x+1)**3\nq = 9*x-8\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-8 x+5 y^2+8 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x-\\frac{1}{2}\\right)^2+5 \\left(y+\\frac{4}{5}\\right)^2=\\frac{61}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & \\frac{1}{20} \\left(-16-\\sqrt{366}\\right) \\\\\n \\frac{1}{2} & \\frac{1}{20} \\left(\\sqrt{366}-16\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{3}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{20} \\left(-16-\\sqrt{366}\\right)+\\frac{1}{20} \\left(\\sqrt{366}-16\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{61 \\pi }{10 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-8*x+5*y**2+8*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $10 x^6-\\frac{x^5}{2}-7 x^4+\\frac{13 x^3}{2}+2 x^2-x+\\frac{7}{2}$ when divided by $7 x-7$.", + "Output Answer": [ + "$\\frac{10 x^5}{7}+\\frac{19 x^4}{14}+\\frac{5 x^3}{14}+\\frac{9 x^2}{7}+\\frac{11 x}{7}+\\frac{10}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x**6-((x**5)/2)-7*x**4+((13*x**3)/2)+2*x**2-x+(7/2)\nq = 7*x-7\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 \\sqrt{2} x^2+2 \\sqrt{2} x-\\frac{3}{\\sqrt{2}}$ and $q(x) = -9 \\sqrt{2} x^2-\\frac{9 x}{\\sqrt{2}}+\\sqrt{2}$", + "Output Answer": [ + "$-36 x^4-54 x^3+13 x^2+\\frac{35 x}{2}-3$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*sqrt(2)*x**2+2*sqrt(2)*x-(3/(sqrt(2)))\nq = -9*sqrt(2)*x**2-((9*x)/(sqrt(2)))+sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{12 x+3}+\\sqrt{15 x+14}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(889-20 \\sqrt{1959}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(12*x+3)+sqrt(15*x+14), 10), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{56 x}{5}-\\frac{17 y}{5}-\\frac{34}{5}=0$, $-\\frac{59 x}{5}+17 y+\\frac{13}{5}=0$", + "Output Answer": [ + "$x=\\frac{157}{221}$, $y=\\frac{1278}{3757}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((56*x)/5)-((17*y)/5)-(34/5), -((59*x)/5)+17*y+(13/5)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2$ and $-4 x^3+2 x^2-3 x-2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2, -4*x**3+2*x**2-3*x-2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{40 x^2}{7}-\\frac{5 x}{7}+\\frac{37}{7}$ and $q(x) = -\\frac{86 x^2}{7}-5 x-\\frac{17}{7}$", + "Output Answer": [ + "$-\\frac{3440 x^4}{49}-\\frac{970 x^3}{49}-\\frac{3687 x^2}{49}-\\frac{1210 x}{49}-\\frac{629}{49}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((40*x**2)/7)-((5*x)/7)+(37/7)\nq = -((86*x**2)/7)-5*x-(17/7)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2+\\frac{27 x}{\\sqrt{2}}-13$", + "Output Answer": [ + "$\\left(\\frac{1}{\\sqrt{2}}-x\\right) \\left(x-13 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2+((27*x)/(sqrt(2)))-13, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{23}-\\sqrt{40}\\right)-\\sqrt{150}$.", + "Output Answer": [ + "$-5 \\sqrt{6}-2 \\sqrt{10}+\\sqrt{23}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(23)-sqrt(40))-sqrt(150))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{7} \\sqrt{x^2}-(x+4)^4$ at the point $x=1$", + "Output Answer": [ + "$-625+\\sqrt{7} = -622.354$" + ], + "Output Program": [ + "import math\n\nx = 1\ntry: \n f = math.sqrt(7)*math.sqrt(x**2)-(x+4)**4\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-6 \\sqrt{5} x-9 \\sqrt{5} y+6 \\sqrt{5}=0$, $-6 \\sqrt{5} x-3 \\sqrt{5} y+8 \\sqrt{5}=0$", + "Output Answer": [ + "$x=\\frac{3}{2}$, $y=-\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-6*sqrt(5)*x-9*sqrt(5)*y+6*sqrt(5), -6*sqrt(5)*x-3*sqrt(5)*y+8*sqrt(5)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2+3 x+3 y^2-10 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x+\\frac{3}{10}\\right)^2+3 \\left(y-\\frac{5}{3}\\right)^2=\\frac{767}{60}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{10} & \\frac{1}{30} \\left(50-\\sqrt{1534}\\right) \\\\\n -\\frac{3}{10} & \\frac{1}{30} \\left(50+\\sqrt{1534}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{5}}$\nCenter: $\\left\\{-\\frac{3}{10},\\frac{1}{2} \\left(\\frac{1}{30} \\left(50-\\sqrt{1534}\\right)+\\frac{1}{30} \\left(50+\\sqrt{1534}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{767 \\pi }{60 \\sqrt{15}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2+3*x+3*y**2-10*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 14 \\sqrt{3} x^2+\\sqrt{3} x+\\sqrt{3}\\right| =-5 \\sqrt{3}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(14*sqrt(3)*x**2+sqrt(3)*x+sqrt(3)), -5*sqrt(3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $10 x^6-2 x^5+8 x^4+3 x^3-10 x^2-9 x+1$ when divided by $3 x+2$.", + "Output Answer": [ + "$\\frac{10 x^5}{3}-\\frac{26 x^4}{9}+\\frac{124 x^3}{27}-\\frac{167 x^2}{81}-\\frac{476 x}{243}-\\frac{1235}{729}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x**6-2*x**5+8*x**4+3*x**3-10*x**2-9*x+1\nq = 3*x+2\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-10 \\left(-\\sin \\left(\\frac{\\pi }{9}\\right)+i \\cos \\left(\\frac{\\pi }{9}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-100000000000 \\left(-\\sin \\left(\\frac{2 \\pi }{9}\\right)+i \\cos \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-10*(-math.sin((math.pi/9))+1j*math.cos((math.pi/9))))**11)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$-\\tan \\left(\\frac{5}{2}-3 x\\right)$", + "Output Answer": [ + "$y\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(-tan((5/2)-3*x), x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-4 e^{-\\frac{89 i \\pi }{90}} \\log (2)$.", + "Output Answer": [ + "Norm: $4 \\log (2)$\nArgument: $\\frac{\\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -4*math.e**(-((89*i*math.pi)/90))*math.log(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\log (-9 x-4)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-e^y-4\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, log(-9*x-4))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^2-2 x-2$ and $1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**2-2*x-2, 1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2-x-7 y^2-3 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(x-\\frac{1}{4}\\right)^2-7 \\left(y+\\frac{3}{14}\\right)^2=\\frac{325}{56}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{28} \\left(7-15 \\sqrt{13}\\right) & -\\frac{3}{14} \\\\\n \\frac{1}{28} \\left(7+15 \\sqrt{13}\\right) & -\\frac{3}{14} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{28} \\left(7-15 \\sqrt{13}\\right)+\\frac{1}{28} \\left(7+15 \\sqrt{13}\\right)\\right),-\\frac{3}{14}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{2}{7}} x+\\frac{1}{28} \\left(-6-\\sqrt{14}\\right),y=\\frac{1}{28} \\left(\\sqrt{14}-6\\right)-\\sqrt{\\frac{2}{7}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2-x-7*y**2-3*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$21 x-2 y+7 z+13=0$, $-21 x+2 y-19=0$, $25 x+13 y-4 z+17=0$", + "Output Answer": [ + "$x=-\\frac{101}{119}$, $y=\\frac{10}{17}$, $z=\\frac{6}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((21*x-2*y+7*z+13, -21*x+2*y-19, 25*x+13*y-4*z+17)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((14+17)+21)^2-\\left(\\left(\\left(\\frac{18}{18}-7\\right)-18\\right)-16\\right)$.", + "Output Answer": [ + "$2744$" + ], + "Output Program": [ + "try: \n print(((14+17)+21)**2-((((18/18)-7)-18)-16))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{2+16}{13}-\\left(\\left((7+22)^2-22\\right)-9\\right)$.", + "Output Answer": [ + "$-\\frac{10512}{13}$" + ], + "Output Program": [ + "try: \n print(((2+16)/13)-(((7+22)**2-22)-9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{3}}, \\frac{1}{3}, 5)$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{229}}{3},\\tan ^{-1}\\left(\\frac{2}{15}\\right),\\frac{\\pi }{6}\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(3)))\ny = (1/3)\nz = 5\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-4 x^2+84 x-440$", + "Output Answer": [ + "$-4 (10-x) (11-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-4*x**2+84*x-440, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-9+i$ and $y=-9$", + "Output Answer": [ + "$-18+i$" + ], + "Output Program": [ + "i = 1j\nx = -9+i\ny = -9\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{9}{2}-7 i$ and $y=-\\frac{17}{2}+\\frac{19 i}{2}$", + "Output Answer": [ + "$\\frac{419}{4}+\\frac{67 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = -(9/2)-7*i\ny = -(17/2)+((19*i)/2)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-4 x-4 y^2+y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(x-\\frac{1}{2}\\right)^2-4 \\left(y-\\frac{1}{8}\\right)^2=-\\frac{1}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & \\frac{1}{8} \\left(1-\\sqrt{2}\\right) \\\\\n \\frac{1}{2} & \\frac{1}{8} \\left(1+\\sqrt{2}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{8} \\left(1-\\sqrt{2}\\right)+\\frac{1}{8} \\left(1+\\sqrt{2}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{5}{8}-x,y=x-\\frac{3}{8}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-4*x-4*y**2+y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $2 \\sqrt{2} x^2+2 \\sqrt{2} x+5 \\sqrt{2}$", + "Output Answer": [ + "$x=-\\frac{1}{2}-\\frac{3 i}{2}\\lor x=-\\frac{1}{2}+\\frac{3 i}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(2*sqrt(2)*x**2+2*sqrt(2)*x+5*sqrt(2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{6-x}{17 x^2+25 x+10}=0$", + "Output Answer": [ + "$\\{\\{x\\to 6\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((6-x)/(17*x**2+25*x+10)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((6+22)+14)+14)-\\left(\\left(((14+8)+20)^2+4\\right)-8\\right)$.", + "Output Answer": [ + "$-1704$" + ], + "Output Program": [ + "try: \n print((((6+22)+14)+14)-((((14+8)+20)**2+4)-8))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((((16-6)+3)-1)+14)-((19+22)-3)$.", + "Output Answer": [ + "$-12$" + ], + "Output Program": [ + "try: \n print(((((16-6)+3)-1)+14)-((19+22)-3))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2+4 x-1$ and $q(x) = -12 x^2-13 x-7$", + "Output Answer": [ + "$168 x^4+134 x^3+58 x^2-15 x+7$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2+4*x-1\nq = -12*x**2-13*x-7\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$e^{-3 x/2}$", + "Output Answer": [ + "$y>0$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(math.e**(-3*x/2), x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{39}{7} \\left(\\cos \\left(\\frac{13 \\pi }{180}\\right)+i \\sin \\left(\\frac{13 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{39}{7} \\sqrt{\\sin ^2\\left(\\frac{13 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{180}\\right)}$\nArgument: $\\frac{13 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (39/7)*(math.cos(((13*math.pi)/180))+i*math.sin(((13*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{18}{11}$, and $a_n=a_{n-1}+4 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$\\frac{7}{2} \\left(\\frac{36}{11}+24 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (18/11) # initial value\nd = 4*math.sqrt(2) # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (18/11) # initial value\nd = 4*math.sqrt(2) # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\sqrt{5} x^2+2 \\sqrt{5} x$ and $q(x) = -5 \\sqrt{5} x^2-3 \\sqrt{5} x-5 \\sqrt{5}$", + "Output Answer": [ + "$-25 x^4-65 x^3-55 x^2-50 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = sqrt(5)*x**2+2*sqrt(5)*x\nq = -5*sqrt(5)*x**2-3*sqrt(5)*x-5*sqrt(5)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{5} \\left(-6 x^2+4 x-3\\right)$, $q(x) = \\sqrt{5} \\left(4 x^2+5 x-2\\right)$", + "Output Answer": [ + "$-2 \\sqrt{5} x^2+9 \\sqrt{5} x-5 \\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(5)*(-6*x**2+4*x-3)\nq = sqrt(5)*(4*x**2+5*x-2)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\log (8 x-8) \\left(-\\tan ^{-1}\\left(6 x^3+4\\right)\\right)$ at the point $x=6$", + "Output Answer": [ + "$-\\tan ^{-1}(1300) \\log (40) = -5.792$" + ], + "Output Program": [ + "import math\n\nx = 6\ntry: \n f = math.log(8*x-8)*(-math.atan(6*x**3+4))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{42 x^6}{5}-\\frac{48 x^5}{5}+\\frac{41 x^4}{5}-\\frac{36 x^3}{5}+\\frac{33 x^2}{5}-x-\\frac{39}{5}$ when divided by $-\\frac{29 x^3}{5}+\\frac{31 x^2}{5}-\\frac{6 x}{5}+\\frac{34}{5}$.", + "Output Answer": [ + "$\\frac{42 x^3}{29}+\\frac{2694 x^2}{841}+\\frac{41725 x}{24389}+\\frac{2903671}{707281}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((42*x**6)/5)-((48*x**5)/5)+((41*x**4)/5)-((36*x**3)/5)+((33*x**2)/5)-x-(39/5)\nq = -((29*x**3)/5)+((31*x**2)/5)-((6*x)/5)+(34/5)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-2-5 i) \\sqrt{3}$ and $y=(5-4 i) \\sqrt{3}$", + "Output Answer": [ + "$(-7-i) \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-2-5*i)*math.sqrt(3)\ny = (5-4*i)*math.sqrt(3)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $10 x^2-9 x+5$", + "Output Answer": [ + "$10 \\left(x-\\frac{9}{20}\\right)^2+\\frac{119}{40}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (10*x**2-9*x+5), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{21 x}{5}+\\frac{26}{5}}+\\sqrt{\\frac{36 x}{5}-\\frac{19}{5}}=\\frac{31}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{375} \\left(19384-62 \\sqrt{91849}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((21*x)/5)+(26/5))+sqrt(((36*x)/5)-(19/5)), (31/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\log (5 x+9)$ at the point $x=5$", + "Output Answer": [ + "$\\log (34) = 3.526$" + ], + "Output Program": [ + "import math\n\nx = 5\ntry: \n f = math.log(5*x+9)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-2 x+5 y^2-2 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x-\\frac{1}{4}\\right)^2+5 \\left(y-\\frac{1}{5}\\right)^2=\\frac{169}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{5} & \\frac{1}{5} \\\\\n \\frac{9}{10} & \\frac{1}{5} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{5}}$\nCenter: $\\left\\{\\frac{1}{4},\\frac{1}{5}\\right\\}$\nArea Enclosed: $\\frac{169 \\pi }{40 \\sqrt{5}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-2*x+5*y**2-2*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{9}{4} (77-5 t)^2, x(t)=t-15$", + "Output Answer": [ + "$y=\\frac{225 x^2}{4}-45 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (9/4)*(77-5*t)**2\nx_t = t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{2 x^2}{\\sqrt{3}}+\\frac{40 x}{\\sqrt{3}}+6 \\sqrt{3}}{\\frac{10 x}{\\sqrt{3}}-\\frac{25}{\\sqrt{3}}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 10-\\sqrt{109}\\right\\},\\left\\{x\\to 10+\\sqrt{109}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((2*x**2)/(sqrt(3)))+((40*x)/(sqrt(3)))+6*sqrt(3))/(((10*x)/(sqrt(3)))-(25/(sqrt(3))))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{425 x^3}{2}-\\frac{499 x^2}{2}-\\frac{661 x}{2}+385}{-\\frac{527 x^2}{2}+52 x+374}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{50} \\left(-3-11 \\sqrt{29}\\right)\\right\\},\\left\\{x\\to \\frac{1}{50} \\left(-3+11 \\sqrt{29}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((425*x**3)/2)-((499*x**2)/2)-((661*x)/2)+385)/(-((527*x**2)/2)+52*x+374)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=53$, and $a_n=a_{n-1}+-\\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$5 \\left(106-9 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 53 # initial value\nd = -math.sqrt(2) # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = 53 # initial value\nd = -math.sqrt(2) # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{2} \\left(225 t^2+900 t+893\\right), x(t)=\\frac{225 t^2}{4}+225 t+225$", + "Output Answer": [ + "$y=2 x-\\frac{7}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/2)*(225*t**2+900*t+893)\nx_t = ((225*t**2)/4)+225*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $10 \\sqrt{2} x^2+9 \\sqrt{2} x+3 \\sqrt{2}$", + "Output Answer": [ + "$10 \\sqrt{2} \\left(x+\\frac{9}{20}\\right)^2+3 \\sqrt{2}-\\frac{81}{20 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (10*math.sqrt(2)*x**2+9*math.sqrt(2)*x+3*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt{-2 x-8}-\\sqrt{5 x+6}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sqrt(-2*x-8)-sqrt(5*x+6)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{12-5}{(3-14)-18}$.", + "Output Answer": [ + "$-\\frac{7}{29}$" + ], + "Output Program": [ + "try: \n print(((12-5)/((3-14)-18)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{59}{7}-\\frac{i}{7}$ and $y=\\frac{12}{7}-\\frac{69 i}{7}$", + "Output Answer": [ + "$\\frac{71}{7}-10 i$" + ], + "Output Program": [ + "i = 1j\nx = (59/7)-(i/7)\ny = (12/7)-((69*i)/7)\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{93}{13}$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{48141}{13}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (93/13) # initial value\nd = 10 # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (93/13) # initial value\nd = 10 # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{40 x^2}{3}+6 x+\\frac{40}{3}$ and $q(x) = -\\frac{14 x^2}{3}+\\frac{32 x}{3}-6$", + "Output Answer": [ + "$-\\frac{560 x^4}{9}+\\frac{1028 x^3}{9}-\\frac{704 x^2}{9}+\\frac{956 x}{9}-80$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((40*x**2)/3)+6*x+(40/3)\nq = -((14*x**2)/3)+((32*x)/3)-6\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-4 (2 t+15)^2, x(t)=4 t^2+60 t+225$", + "Output Answer": [ + "$y=-4 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -4*(2*t+15)**2\nx_t = 4*t**2+60*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{2 x^6}{5}-\\frac{11 x^5}{5}-4 x^4-\\frac{38 x^3}{5}-2 x^2+9 x+\\frac{24}{5}$ when divided by $\\frac{48 x^4}{5}+7 x^3-\\frac{16 x^2}{5}-\\frac{18 x}{5}-\\frac{39}{5}$.", + "Output Answer": [ + "$-\\frac{x^2}{24}-\\frac{229 x}{1152}-\\frac{15793}{55296}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((2*x**6)/5)-((11*x**5)/5)-4*x**4-((38*x**3)/5)-2*x**2+9*x+(24/5)\nq = ((48*x**4)/5)+7*x**3-((16*x**2)/5)-((18*x)/5)-(39/5)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=105-14 t, x(t)=2 t-15$", + "Output Answer": [ + "$y=-7 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 105-14*t\nx_t = 2*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^3-2 x^2-10 x-6$ when divided by $-6$.", + "Output Answer": [ + "$\\frac{x^3}{3}+\\frac{x^2}{3}+\\frac{5 x}{3}+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**3-2*x**2-10*x-6\nq = -6\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$18 x+9 y+18=0$, $-17 x-19 y-3=0$", + "Output Answer": [ + "$x=-\\frac{5}{3}$, $y=\\frac{4}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((18*x+9*y+18, -17*x-19*y-3), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\sin \\left(3 x^3+1\\right)-\\cos \\left(8-5 x^3\\right)$ at the point $x=1$", + "Output Answer": [ + "$-\\cos (3)-\\sin (4) = 1.747$" + ], + "Output Program": [ + "import math\n\nx = 1\ntry: \n f = -math.sin(3*x**3+1)-math.cos(8-5*x**3)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{120 x^2+55 x}{120 x^2+35 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{11}{24}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((120*x**2+55*x)/(120*x**2+35*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-9 x^2+3 x+12$", + "Output Answer": [ + "$x=\\frac{4}{3}\\lor x=-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-9*x**2+3*x+12, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-8-7 i$ and $y=-4+7 i$", + "Output Answer": [ + "$81-28 i$" + ], + "Output Program": [ + "i = 1j\nx = -8-7*i\ny = -4+7*i\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $7 e^{\\frac{71 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $7$\nArgument: $\\frac{71 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 7*math.e**((71*i*math.pi)/180)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$11 x+11 y+22=0$, $-19 x+19 y+1=0$", + "Output Answer": [ + "$x=-\\frac{37}{38}$, $y=-\\frac{39}{38}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((11*x+11*y+22, -19*x+19*y+1), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $x^2-13 x+13$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(13-3 \\sqrt{13}\\right)\\lor x=\\frac{1}{2} \\left(13+3 \\sqrt{13}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(x**2-13*x+13, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{32}{83}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$\\frac{52208}{83}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (32/83) # initial value\nd = 8 # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (32/83) # initial value\nd = 8 # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-8 x+3 y+13=0$, $9 x-\\frac{19 y}{2}-23=0$", + "Output Answer": [ + "$x=\\frac{109}{98}$, $y=-\\frac{67}{49}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-8*x+3*y+13, 9*x-((19*y)/2)-23), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-10 x+6 y^2-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Circle\nEquation: $6 \\left(x-\\frac{5}{6}\\right)^2+6 y^2=\\frac{43}{6}$\nRadius: $\\frac{\\sqrt{43}}{6}$\nCircumference: $\\frac{\\sqrt{43} \\pi }{3}$\nCenter: $\\left\\{\\frac{5}{6},0\\right\\}$\nArea Enclosed: $\\frac{43 \\pi }{36}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-10*x+6*y**2-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-7 \\sqrt{2} x^2-8 \\sqrt{2} x$", + "Output Answer": [ + "$\\frac{16 \\sqrt{2}}{7}-7 \\sqrt{2} \\left(x+\\frac{4}{7}\\right)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-7*math.sqrt(2)*x**2-8*math.sqrt(2)*x), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-x^3-6 x^2+3 x-2$ when divided by $5 x^3-5 x^2-4 x-2$.", + "Output Answer": [ + "$-\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**3-6*x**2+3*x-2\nq = 5*x**3-5*x**2-4*x-2\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{13}{33}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{13}{3}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (13/33) # initial value\nd = 0 # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (13/33) # initial value\nd = 0 # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^3-9 x^2+5 x-4$ and $4-x$.", + "Output Answer": [ + "$x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**3-9*x**2+5*x-4, 4-x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2-115 \\sqrt{2} x+450$", + "Output Answer": [ + "$10 \\left(x-\\frac{5}{\\sqrt{2}}\\right) \\left(x-9 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2-115*sqrt(2)*x+450, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^4-8 x^3-7 x^2+8 x-2$ when divided by $6 x^2-5 x-1$.", + "Output Answer": [ + "$\\frac{4 x^2}{3}-\\frac{2 x}{9}-\\frac{61}{54}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**4-8*x**3-7*x**2+8*x-2\nq = 6*x**2-5*x-1\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{288 x^2-108 x+10}{180 x-30}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5}{24}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((288*x**2-108*x+10)/(180*x-30)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2-10 x+7 y^2+3 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(y+\\frac{3}{14}\\right)^2-3 \\left(x+\\frac{5}{3}\\right)^2=-\\frac{925}{84}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{42} \\left(14+\\sqrt{370}\\right) & -\\frac{3}{14} \\\\\n \\frac{5}{42} \\left(\\sqrt{370}-14\\right) & -\\frac{3}{14} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{10}{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{5}{42} \\left(\\sqrt{370}-14\\right)-\\frac{5}{42} \\left(14+\\sqrt{370}\\right)\\right),-\\frac{3}{14}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{3}{7}} x+\\frac{1}{42} \\left(10 \\sqrt{21}-9\\right),y=\\frac{1}{42} \\left(-9-10 \\sqrt{21}\\right)-\\sqrt{\\frac{3}{7}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2-10*x+7*y**2+3*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the first order series of the inverse of the following function around 1:\n$\\frac{625 x^4}{16}$", + "Output Answer": [ + "$\\frac{x-625}{1250}+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, ((625*x**4)/16))\nprint(solve(f, x)[0].series(y, 1, 1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{6 x^2-x+15}{21 x^2-13 x+1}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((6*x**2-x+15)/(21*x**2-13*x+1)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{149 x^2}{7}-\\frac{4 x}{7}+2}{-\\frac{48 x^2}{7}-\\frac{89 x}{7}+\\frac{26}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{149} \\left(-2-\\sqrt{2090}\\right)\\right\\},\\left\\{x\\to \\frac{1}{149} \\left(-2+\\sqrt{2090}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((149*x**2)/7)-((4*x)/7)+2)/(-((48*x**2)/7)-((89*x)/7)+(26/7))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^6-\\frac{x^5}{2}-\\frac{17 x^4}{2}+2 x^3-9 x^2+\\frac{9 x}{2}-\\frac{13}{2}$ when divided by $-5 x^5+\\frac{13 x^4}{2}+\\frac{9 x^3}{2}-\\frac{15 x^2}{2}-\\frac{11 x}{2}+\\frac{9}{2}$.", + "Output Answer": [ + "$x+\\frac{7}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**6-((x**5)/2)-((17*x**4)/2)+2*x**3-9*x**2+((9*x)/2)-(13/2)\nq = -5*x**5+((13*x**4)/2)+((9*x**3)/2)-((15*x**2)/2)-((11*x)/2)+(9/2)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-15 x-8 y-14 z+21=0$, $-3 x-11 y-5 z-1=0$, $x-25 y+11 z+6=0$", + "Output Answer": [ + "$x=\\frac{1048}{377}$, $y=-\\frac{541}{2262}$, $z=-\\frac{3035}{2262}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-15*x-8*y-14*z+21, -3*x-11*y-5*z-1, x-25*y+11*z+6)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2-9 x+y^2+y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $9 \\left(x-\\frac{1}{2}\\right)^2+\\left(y+\\frac{1}{2}\\right)^2=\\frac{11}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & \\frac{1}{6} \\left(-3-4 \\sqrt{11}\\right) \\\\\n \\frac{1}{2} & \\frac{1}{6} \\left(4 \\sqrt{11}-3\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2 \\sqrt{2}}{3}$\nCenter: $\\left\\{\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{6} \\left(-3-4 \\sqrt{11}\\right)+\\frac{1}{6} \\left(4 \\sqrt{11}-3\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{11 \\pi }{6}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2-9*x+y**2+y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{2 \\left(\\cos \\left(\\frac{121}{90}\\right)+i \\sin \\left(\\frac{121}{90}\\right)\\right)}{\\sqrt{3}}\\right)^5$", + "Output Answer": [ + "$\\frac{32 \\left(\\cos \\left(\\frac{121}{18}\\right)+i \\sin \\left(\\frac{121}{18}\\right)\\right)}{9 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((2*(math.cos((121/90))+1j*math.sin((121/90))))/(math.sqrt(3))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 7 \\sqrt{3} x^2-4 \\sqrt{3} x-\\sqrt{3}$ and $q(x) = -7 \\sqrt{3} x^2+\\sqrt{3} x-3 \\sqrt{3}$", + "Output Answer": [ + "$-147 x^4+105 x^3-54 x^2+33 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 7*sqrt(3)*x**2-4*sqrt(3)*x-sqrt(3)\nq = -7*sqrt(3)*x**2+sqrt(3)*x-3*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{19}{2} \\left(\\cos \\left(\\frac{64}{45}\\right)+i \\sin \\left(\\frac{64}{45}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$\\frac{361}{4} \\left(\\cos \\left(\\frac{128}{45}\\right)+i \\sin \\left(\\frac{128}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(19/2)*(math.cos((64/45))+1j*math.sin((64/45))))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^5-7 x^4-2 x^3+3 x^2+7 x-5$ when divided by $-6 x^3+x^2-3 x-8$.", + "Output Answer": [ + "$\\frac{5 x^2}{6}+\\frac{47 x}{36}+\\frac{29}{216}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**5-7*x**4-2*x**3+3*x**2+7*x-5\nq = -6*x**3+x**2-3*x-8\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-10 x^6-7 x^5+4 x^4+\\frac{17 x^3}{3}-\\frac{8 x^2}{3}-7 x-6$ when divided by $\\frac{19 x^4}{3}-\\frac{x^3}{3}+\\frac{26 x^2}{3}+2 x+3$.", + "Output Answer": [ + "$-\\frac{30 x^2}{19}-\\frac{429 x}{361}+\\frac{18723}{6859}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -10*x**6-7*x**5+4*x**4+((17*x**3)/3)-((8*x**2)/3)-7*x-6\nq = ((19*x**4)/3)-((x**3)/3)+((26*x**2)/3)+2*x+3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{391 x^2+415 x+76}{529 x+437}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{4}{17}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((391*x**2+415*x+76)/(529*x+437)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\left((19-10)^2-9\\right)-7}{(2+17)-20}$.", + "Output Answer": [ + "$-65$" + ], + "Output Program": [ + "try: \n print(((((19-10)**2-9)-7)/((2+17)-20)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{47}{22}$, and $a_n=a_{n-1}+\\frac{17}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$13 \\left(\\frac{425}{\\sqrt{3}}-\\frac{47}{11}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(47/22) # initial value\nd = (17/(math.sqrt(3))) # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(47/22) # initial value\nd = (17/(math.sqrt(3))) # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-21 x+10 y-21 z-19=0$, $14 x-19 y+3 z-1=0$, $-5 x+22 y-24 z-20=0$", + "Output Answer": [ + "$x=\\frac{64}{3151}$, $y=-\\frac{626}{3151}$, $z=-\\frac{3213}{3151}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-21*x+10*y-21*z-19, 14*x-19*y+3*z-1, -5*x+22*y-24*z-20)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\pi$ and $y=(3+i) \\pi$", + "Output Answer": [ + "$(4+i) \\pi$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = math.pi\ny = (3+i)*math.pi\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2+7 x+3 y^2+10 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x+\\frac{7}{10}\\right)^2+3 \\left(y+\\frac{5}{3}\\right)^2=\\frac{887}{60}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{7}{10} & \\frac{1}{30} \\left(-50-\\sqrt{1774}\\right) \\\\\n -\\frac{7}{10} & \\frac{1}{30} \\left(\\sqrt{1774}-50\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{5}}$\nCenter: $\\left\\{-\\frac{7}{10},\\frac{1}{2} \\left(\\frac{1}{30} \\left(-50-\\sqrt{1774}\\right)+\\frac{1}{30} \\left(\\sqrt{1774}-50\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{887 \\pi }{60 \\sqrt{15}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2+7*x+3*y**2+10*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -7 x^2-5 x+10$ and $q(x) = -14 x^2-x-4$", + "Output Answer": [ + "$98 x^4+77 x^3-107 x^2+10 x-40$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -7*x**2-5*x+10\nq = -14*x**2-x-4\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-20 x^4-8 x^3+5 x+2$ and $1-4 x^3$.", + "Output Answer": [ + "$4 x^3-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-20*x**4-8*x**3+5*x+2, 1-4*x**3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $14 x^2-\\frac{19 x}{5}+7$", + "Output Answer": [ + "$x=\\frac{1}{140} \\left(19-i \\sqrt{9439}\\right)\\lor x=\\frac{1}{140} \\left(19+i \\sqrt{9439}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(14*x**2-((19*x)/5)+7, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^5-9 x^4+6 x^2+5 x+7$ when divided by $-2 x^4-10 x^3-5 x+7$.", + "Output Answer": [ + "$27-\\frac{9 x}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**5-9*x**4+6*x**2+5*x+7\nq = -2*x**4-10*x**3-5*x+7\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{6 x^2+17 x-\\frac{63}{4}}{-3 x^2-6 x-\\frac{9}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(-17-\\sqrt{667}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(-17+\\sqrt{667}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((6*x**2+17*x-(63/4))/(-3*x**2-6*x-(9/2))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^4+5 x^3+6 x^2+5 x-7$ when divided by $10 x^4+6 x^3-x^2-7 x+2$.", + "Output Answer": [ + "$\\frac{9}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**4+5*x**3+6*x**2+5*x-7\nq = 10*x**4+6*x**3-x**2-7*x+2\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-1+3 i) \\sqrt{2}$ and $y=-2 \\sqrt{2}$", + "Output Answer": [ + "$(1+3 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-1+3*i)*math.sqrt(2)\ny = -2*math.sqrt(2)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $8 \\sqrt{3} x^2+4 \\sqrt{3} x+5 \\sqrt{3}$", + "Output Answer": [ + "$8 \\sqrt{3} \\left(x+\\frac{1}{4}\\right)^2+\\frac{9 \\sqrt{3}}{2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (8*math.sqrt(3)*x**2+4*math.sqrt(3)*x+5*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 17-x| =7$", + "Output Answer": [ + "$\\{\\{x\\to 10\\},\\{x\\to 24\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(17-x), 7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{9+6 i}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{3 \\sqrt{13}}{\\pi }$\nArgument: $\\tan ^{-1}\\left(\\frac{2}{3}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((9+6*i)/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{2-2 x} \\left(6 x^2-1\\right)$ at the point $x=-9$", + "Output Answer": [ + "$970 \\sqrt{5} = 2168.99$" + ], + "Output Program": [ + "import math\n\nx = -9\ntry: \n f = math.sqrt(2-2*x)*(6*x**2-1)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\sqrt{2} \\left(\\cos \\left(\\frac{77}{90}\\right)+i \\sin \\left(\\frac{77}{90}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$2 \\sqrt{2} \\left(\\cos \\left(\\frac{77}{30}\\right)+i \\sin \\left(\\frac{77}{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.sqrt(2)*(math.cos((77/90))+1j*math.sin((77/90))))**3)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((9+17)+10) \\left(\\frac{1}{24} (((6+3)+20)+23)\\right)$.", + "Output Answer": [ + "$78$" + ], + "Output Program": [ + "try: \n print(((9+17)+10)*((1/24)*(((6+3)+20)+23)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2+8 x+3 y^2+5 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(y+\\frac{5}{6}\\right)^2-9 \\left(x-\\frac{4}{9}\\right)^2=-\\frac{169}{36}$\nFoci: $\\left(\n\\begin{array}{cc}\n -1 & -\\frac{5}{6} \\\\\n \\frac{17}{9} & -\\frac{5}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2$\nCenter: $\\left\\{\\frac{4}{9},-\\frac{5}{6}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{3} x+\\frac{1}{18} \\left(-15-8 \\sqrt{3}\\right),y=\\frac{1}{18} \\left(8 \\sqrt{3}-15\\right)-\\sqrt{3} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2+8*x+3*y**2+5*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-13 x^2+4 x+15$", + "Output Answer": [ + "$\\frac{199}{13}-13 \\left(x-\\frac{2}{13}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-13*x**2+4*x+15), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2+66 x-315$", + "Output Answer": [ + "$3 (15-x) (x-7)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2+66*x-315, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt[3]{51}}{\\sqrt[3]{27}}$.", + "Output Answer": [ + "$\\frac{\\sqrt[3]{17}}{3^{2/3}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((cbrt(51))/(cbrt(27))))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{9 x}{2}+\\frac{21}{2}}+\\sqrt{11 x+10}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{169} \\left(3051-28 \\sqrt{11535}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((9*x)/2)+(21/2))+sqrt(11*x+10), 7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{5}}{\\sqrt{147}-\\sqrt{34}}$.", + "Output Answer": [ + "$\\frac{\\sqrt{5}}{7 \\sqrt{3}-\\sqrt{34}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(5))/(sqrt(147)-sqrt(34))))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^6-10 x^5-4 x^4+4 x^3+3 x^2-8 x-10$ when divided by $6 x$.", + "Output Answer": [ + "$-\\frac{5 x^5}{6}-\\frac{5 x^4}{3}-\\frac{2 x^3}{3}+\\frac{2 x^2}{3}+\\frac{x}{2}-\\frac{4}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**6-10*x**5-4*x**4+4*x**3+3*x**2-8*x-10\nq = 6*x\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the seventh order series of the inverse of the following function around 7:\n$\\frac{1}{9 x^2}$", + "Output Answer": [ + "$\\frac{1}{3 \\sqrt{x}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, (1/(9*x**2)))\nprint(solve(f, x)[0].series(y, 7, 6))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{38}{5} \\left(-\\sin \\left(\\frac{13 \\pi }{90}\\right)-i \\cos \\left(\\frac{13 \\pi }{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$\\frac{79235168 \\left(-\\cos \\left(\\frac{2 \\pi }{9}\\right)+i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)}{3125}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((38/5)*(-math.sin(((13*math.pi)/90))-1j*math.cos(((13*math.pi)/90))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{11 \\left(\\cos \\left(\\frac{1}{15}\\right)+i \\sin \\left(\\frac{1}{15}\\right)\\right)}{\\sqrt{2}}\\right)^8$", + "Output Answer": [ + "$\\frac{214358881}{16} \\left(\\cos \\left(\\frac{8}{15}\\right)+i \\sin \\left(\\frac{8}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((11*(math.cos((1/15))+1j*math.sin((1/15))))/(math.sqrt(2))))**8)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{3 x^3}{2}+\\frac{x^2}{2}-2 x-4$ and $-\\frac{3 x^3}{2}-\\frac{x^2}{2}+2 x+4$.", + "Output Answer": [ + "$\\frac{3 x^3}{2}+\\frac{x^2}{2}-2 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((3*x**3)/2)+((x**2)/2)-2*x-4, -((3*x**3)/2)-((x**2)/2)+2*x+4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-12 x-13 y+6 z-15=0$, $12 x+10 y-6 z+14=0$, $-3 x-4 y-18 z+23=0$", + "Output Answer": [ + "$x=-\\frac{23}{117}$, $y=-\\frac{1}{3}$, $z=\\frac{18}{13}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-12*x-13*y+6*z-15, 12*x+10*y-6*z+14, -3*x-4*y-18*z+23)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{88}{69}$, and $a_n=a_{n-1}+\\frac{2}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$\\frac{3342}{161}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(88/69) # initial value\nd = (2/7) # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(88/69) # initial value\nd = (2/7) # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(-\\cos \\left(\\frac{8 \\pi }{45}\\right)+i \\sin \\left(\\frac{8 \\pi }{45}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$27 \\left(\\sin \\left(\\frac{\\pi }{30}\\right)+i \\cos \\left(\\frac{\\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(-math.cos(((8*math.pi)/45))+1j*math.sin(((8*math.pi)/45))))**3)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{18}{17} ((18+12)-9)^2$.", + "Output Answer": [ + "$\\frac{7938}{17}$" + ], + "Output Program": [ + "try: \n print((18/17)*((18+12)-9)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $5 x^2-45 \\sqrt{3} x+300$", + "Output Answer": [ + "$5 \\left(x-5 \\sqrt{3}\\right) \\left(x-4 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(5*x**2-45*sqrt(3)*x+300, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+11 \\sqrt{2} x+2420$", + "Output Answer": [ + "$11 \\left(11 \\sqrt{2}-x\\right) \\left(x+10 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+11*sqrt(2)*x+2420, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $10 x+6$ when divided by $-5 x-3$.", + "Output Answer": [ + "$-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 10*x+6\nq = -5*x-3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{18}{5}$, and $a_n=a_{n-1}+-\\frac{55}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$-\\frac{16511}{35}$" + ], + "Output Program": [ + "a = -(18/5) # initial value\nd = -(55/7) # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(18/5) # initial value\nd = -(55/7) # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{12}+\\sqrt{\\sqrt{154}}$.", + "Output Answer": [ + "$2 \\sqrt{3}+\\sqrt[4]{154}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(12)+sqrt(sqrt(154)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 144, q(x) = -\\sqrt{3} (2 x+1)$", + "Output Answer": [ + "$-2 \\sqrt{3} x-\\sqrt{3}+144$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 144\nq = -sqrt(3)*(2*x+1)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x^4-5 x^3+3 x^2+2 x-4$ and $x^4-5 x^3+3 x^2+2 x-4$.", + "Output Answer": [ + "$x^4-5 x^3+3 x^2+2 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x**4-5*x**3+3*x**2+2*x-4, x**4-5*x**3+3*x**2+2*x-4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $7 x^2+7 \\sqrt{2} x-84$", + "Output Answer": [ + "$-7 \\left(2 \\sqrt{2}-x\\right) \\left(x+3 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(7*x**2+7*sqrt(2)*x-84, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{1}{2} \\left(\\sin \\left(\\frac{19 \\pi }{90}\\right)-i \\cos \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$\\frac{1}{16} \\left(-\\cos \\left(\\frac{7 \\pi }{45}\\right)+i \\sin \\left(\\frac{7 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((1/2)*(math.sin(((19*math.pi)/90))-1j*math.cos(((19*math.pi)/90))))**4)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{5}}, 9, \\frac{1}{5})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{2031}}{5},\\tan ^{-1}\\left(\\sqrt{2030}\\right),\\tan ^{-1}\\left(9 \\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(5)))\ny = 9\nz = (1/5)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{34 x}{\\sqrt{3}}-5 \\sqrt{3}\\right| =\\frac{25}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{20}{17}\\right\\},\\left\\{x\\to \\frac{5}{17}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((34*x)/(sqrt(3)))-5*sqrt(3)), (25/(sqrt(3)))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-6 x^2+10 x+14$", + "Output Answer": [ + "$\\frac{109}{6}-6 \\left(x-\\frac{5}{6}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-6*x**2+10*x+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (3 x+7)^4, q(x) = (1-7 x)^4$", + "Output Answer": [ + "$2482 x^4-616 x^3+2940 x^2+4088 x+2402$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (3*x+7)**4\nq = (1-7*x)**4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-7 x+10 y^2+9 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x-\\frac{7}{8}\\right)^2+10 \\left(y+\\frac{9}{20}\\right)^2=\\frac{727}{80}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{7}{8}-\\frac{\\sqrt{2181}}{40} & -\\frac{9}{20} \\\\\n \\frac{1}{40} \\left(35+\\sqrt{2181}\\right) & -\\frac{9}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{7}{8}-\\frac{\\sqrt{2181}}{40}+\\frac{1}{40} \\left(35+\\sqrt{2181}\\right)\\right),-\\frac{9}{20}\\right\\}$\nArea Enclosed: $\\frac{727 \\pi }{160 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-7*x+10*y**2+9*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-6 x-6 y+11 z-11=0$, $25 x-y+24 z-10=0$, $18 x-21 y+3 z+9=0$", + "Output Answer": [ + "$x=-\\frac{1526}{3575}$, $y=\\frac{668}{3575}$, $z=\\frac{239}{275}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-6*x-6*y+11*z-11, 25*x-y+24*z-10, 18*x-21*y+3*z+9)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$-\\frac{1000 x^{15}}{27}$", + "Output Answer": [ + "$\\frac{7 (x-531441000)^2}{21182215236075000000}+\\frac{531441000-x}{2657205000}-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, -((1000*x**15)/27))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-1-i) \\pi$ and $y=2 \\pi$", + "Output Answer": [ + "$-\\frac{1}{2}-\\frac{i}{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-1-i)*math.pi\ny = 2*math.pi\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\left(5 x^2+21 x+19\\right) \\log (2)$, $q(x) = 2 \\left(8 x^2-3 x-6\\right) \\log (2)$", + "Output Answer": [ + "$21 x^2 \\log (2)+15 x \\log (2)+7 \\log (2)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (5*x**2+21*x+19)*log(2)\nq = 2*(8*x**2-3*x-6)*log(2)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{22 x}{3}-\\frac{13}{3}}+\\sqrt{10 x-15}=\\frac{19}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{48} \\left(4885-19 \\sqrt{63165}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((22*x)/3)-(13/3))+sqrt(10*x-15), (19/3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8 x-14}+1=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{57}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8*x-14)+1, 11), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-15 x-21 y+18=0$, $10 x+20 y-12=0$", + "Output Answer": [ + "$x=\\frac{6}{5}$, $y=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-15*x-21*y+18, 10*x+20*y-12), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^6-\\frac{10 x^5}{3}+\\frac{x^4}{3}+\\frac{13 x^3}{3}-\\frac{20 x^2}{3}-\\frac{4 x}{3}+\\frac{1}{3}$ when divided by $x^3+\\frac{17 x^2}{3}-\\frac{10 x}{3}+\\frac{14}{3}$.", + "Output Answer": [ + "$-7 x^3+\\frac{109 x^2}{3}-\\frac{2060 x}{9}+\\frac{39289}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**6-((10*x**5)/3)+((x**4)/3)+((13*x**3)/3)-((20*x**2)/3)-((4*x)/3)+(1/3)\nq = x**3+((17*x**2)/3)-((10*x)/3)+(14/3)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $9 x^2-13 x+\\frac{16}{3}$", + "Output Answer": [ + "$x=\\frac{1}{18} \\left(13-i \\sqrt{23}\\right)\\lor x=\\frac{1}{18} \\left(13+i \\sqrt{23}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(9*x**2-13*x+(16/3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4$ and $-3 x^5+3 x^4+2 x^3-3 x^2+5 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4, -3*x**5+3*x**4+2*x**3-3*x**2+5*x-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{4} (8 t+25)^2, x(t)=-4 t-15$", + "Output Answer": [ + "$y=x^2+5 x+\\frac{25}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/4)*(8*t+25)**2\nx_t = -4*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3 x+2}+\\sqrt{10 x+10}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(269-20 \\sqrt{170}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3*x+2)+sqrt(10*x+10), 5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{135 x^2}{7}+\\frac{166 x}{7}+\\frac{118}{7}}{\\frac{69}{7}-\\frac{122 x}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{135} \\left(83-\\sqrt{22819}\\right)\\right\\},\\left\\{x\\to \\frac{1}{135} \\left(83+\\sqrt{22819}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((135*x**2)/7)+((166*x)/7)+(118/7))/((69/7)-((122*x)/7))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{30 x^2+86 x-88}{144 x^2+516 x-44}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{4}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((30*x**2+86*x-88)/(144*x**2+516*x-44)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{2 \\left(72 t^2+312 t+341\\right)}{3 \\sqrt{3}}, x(t)=48 t^2+208 t+\\frac{676}{3}$", + "Output Answer": [ + "$y=-\\frac{x}{\\sqrt{3}}-\\frac{2}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -((2*(72*t**2+312*t+341))/(3*sqrt(3)))\nx_t = 48*t**2+208*t+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $8 x^2+8 x-\\frac{2397}{2}$", + "Output Answer": [ + "$8 \\left(-x-\\frac{51}{4}\\right) \\left(\\frac{47}{4}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(8*x**2+8*x-(2397/2), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt[3]{107} \\left(192+\\sqrt[3]{6}\\right)$.", + "Output Answer": [ + "$\\sqrt[3]{107} \\left(192+\\sqrt[3]{6}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint(cbrt(107)*(192+cbrt(6)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{58 x^2}{5}+\\frac{49 x}{5}+\\frac{7}{5}$ and $q(x) = -\\frac{37 x^2}{5}+\\frac{16 x}{5}+\\frac{24}{5}$", + "Output Answer": [ + "$\\frac{2146 x^4}{25}-\\frac{2741 x^3}{25}-\\frac{867 x^2}{25}+\\frac{1288 x}{25}+\\frac{168}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((58*x**2)/5)+((49*x)/5)+(7/5)\nq = -((37*x**2)/5)+((16*x)/5)+(24/5)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{2 \\left(\\sin \\left(\\frac{17 \\pi }{90}\\right)+i \\cos \\left(\\frac{17 \\pi }{90}\\right)\\right)}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{2 \\sqrt{\\sin ^2\\left(\\frac{17 \\pi }{90}\\right)+\\cos ^2\\left(\\frac{17 \\pi }{90}\\right)}}{\\pi }$\nArgument: $-\\frac{31 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((2*(math.sin(((17*math.pi)/90))+i*math.cos(((17*math.pi)/90))))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 (71-18 t)^2, x(t)=4 t-15$", + "Output Answer": [ + "$y=81 x^2-126 x+49$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*(71-18*t)**2\nx_t = 4*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^2+4 x-9$ when divided by $6 x^2+5 x+8$.", + "Output Answer": [ + "$-\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**2+4*x-9\nq = 6*x**2+5*x+8\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9 x-14}+\\sqrt{9 x-13}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{49001}{7056}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9*x-14)+sqrt(9*x-13), 14), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{7 x^2}{\\sqrt{2}}-\\frac{3}{\\sqrt{2}}$", + "Output Answer": [ + "$x=i \\sqrt{\\frac{3}{7}}\\lor x=-i \\sqrt{\\frac{3}{7}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((7*x**2)/(sqrt(2)))-(3/(sqrt(2))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{5} (3 x-1), q(x) = \\sqrt{5} (1-2 x)$", + "Output Answer": [ + "$\\sqrt{5} x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(5)*(3*x-1)\nq = sqrt(5)*(1-2*x)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{40}{17}$, and $a_n=a_{n-1}+-3 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$15 \\left(\\frac{80}{17}-87 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (40/17) # initial value\nd = -3*math.sqrt(5) # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (40/17) # initial value\nd = -3*math.sqrt(5) # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=21 t+50, x(t)=-7 t-15$", + "Output Answer": [ + "$y=5-3 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 21*t+50\nx_t = -7*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x-2$ and $5 x^5+3 x^3+4 x^2+5 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x-2, 5*x**5+3*x**3+4*x**2+5*x-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{69}{77}$, and $a_n=a_{n-1}+3 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=28$.", + "Output Answer": [ + "$14 \\left(81 \\sqrt{5}-\\frac{138}{77}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(69/77) # initial value\nd = 3*math.sqrt(5) # second term\nn = 28 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(69/77) # initial value\nd = 3*math.sqrt(5) # second term\nn = 28 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{58}{43}$, and $a_n=a_{n-1}+\\frac{17}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$\\frac{9}{2} \\left(\\frac{136}{\\sqrt{3}}-\\frac{116}{43}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(58/43) # initial value\nd = (17/(math.sqrt(3))) # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(58/43) # initial value\nd = (17/(math.sqrt(3))) # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{18-3 i}{e}$.", + "Output Answer": [ + "Norm: $\\frac{3 \\sqrt{37}}{e}$\nArgument: $-\\tan ^{-1}\\left(\\frac{1}{6}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((18-3*i)/math.e)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $x^2-10 x-3 y^2+4 y+9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $(x-5)^2-3 \\left(y-\\frac{2}{3}\\right)^2=\\frac{44}{3}$\nFoci: $\\left(\n\\begin{array}{cc}\n 5-\\frac{4 \\sqrt{11}}{3} & \\frac{2}{3} \\\\\n 5+\\frac{4 \\sqrt{11}}{3} & \\frac{2}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{3}}$\nCenter: $\\left\\{5,\\frac{2}{3}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{3}}+\\frac{1}{3} \\left(2-5 \\sqrt{3}\\right),y=\\frac{1}{3} \\left(2+5 \\sqrt{3}\\right)-\\frac{x}{\\sqrt{3}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-10*x-3*y**2+4*y+9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{9}{37}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$-\\frac{171}{37}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(9/37) # initial value\nd = 0 # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(9/37) # initial value\nd = 0 # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-25 x^4+30 x^3-3 x^2+18 x-8$ and $5 x^3-4 x^2-x-4$.", + "Output Answer": [ + "$5 x^3-4 x^2-x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-25*x**4+30*x**3-3*x**2+18*x-8, 5*x**3-4*x**2-x-4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{91 x^2}{5}+x+\\frac{123}{5}}{-\\frac{109 x}{5}-\\frac{4}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{182} \\left(5-\\sqrt{44797}\\right)\\right\\},\\left\\{x\\to \\frac{1}{182} \\left(5+\\sqrt{44797}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((91*x**2)/5)+x+(123/5))/(-((109*x)/5)-(4/5))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-16 x^5+12 x^4-\\frac{20 x^3}{3}+\\frac{40 x^2}{3}-\\frac{32 x}{3}-\\frac{44}{3}$ and $-4 x^5+3 x^4-\\frac{5 x^3}{3}+\\frac{10 x^2}{3}-\\frac{8 x}{3}-\\frac{11}{3}$.", + "Output Answer": [ + "$4 x^5-3 x^4+\\frac{5 x^3}{3}-\\frac{10 x^2}{3}+\\frac{8 x}{3}+\\frac{11}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-16*x**5+12*x**4-((20*x**3)/3)+((40*x**2)/3)-((32*x)/3)-(44/3), -4*x**5+3*x**4-((5*x**3)/3)+((10*x**2)/3)-((8*x)/3)-(11/3)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^6-6 x^5-5 x^4+9 x^3-7 x^2+8 x+6$ when divided by $-4 x^4+8 x^3-7 x^2+7 x-9$.", + "Output Answer": [ + "$-2 x^2-\\frac{5 x}{2}-\\frac{1}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**6-6*x**5-5*x**4+9*x**3-7*x**2+8*x+6\nq = -4*x**4+8*x**3-7*x**2+7*x-9\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $8 x^2-64$", + "Output Answer": [ + "$8 \\left(-x-2 \\sqrt{2}\\right) \\left(2 \\sqrt{2}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(8*x**2-64, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^6+7 x^4+x^3+7 x^2+9 x-4$ when divided by $-4 x^3-8 x^2+5 x+2$.", + "Output Answer": [ + "$x^3-2 x^2+\\frac{7 x}{2}-\\frac{37}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**6+7*x**4+x**3+7*x**2+9*x-4\nq = -4*x**3-8*x**2+5*x+2\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-e^{-x-8} \\sin (x+2)$ at the point $x=3$", + "Output Answer": [ + "$-\\frac{\\sin (5)}{e^{11}} = 0.$" + ], + "Output Program": [ + "import math\n\nx = 3\ntry: \n f = -math.e**(-x-8)*math.sin(x+2)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$16 x+3 y+15=0$, $9 x+4 y+12=0$", + "Output Answer": [ + "$x=-\\frac{24}{37}$, $y=-\\frac{57}{37}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((16*x+3*y+15, 9*x+4*y+12), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 3 x^2+5 x+11\\right| =12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(-5-\\sqrt{37}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(-5+\\sqrt{37}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(3*x**2+5*x+11), 12), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-12 x^2+8 x-11$", + "Output Answer": [ + "$-12 \\left(x-\\frac{1}{3}\\right)^2-\\frac{29}{3}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-12*x**2+8*x-11), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+3 x+3 y^2-3 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x+\\frac{3}{8}\\right)^2+3 \\left(y-\\frac{1}{2}\\right)^2=\\frac{165}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{8} & \\frac{1}{8} \\left(4-\\sqrt{55}\\right) \\\\\n -\\frac{3}{8} & \\frac{1}{8} \\left(4+\\sqrt{55}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{2}$\nCenter: $\\left\\{-\\frac{3}{8},\\frac{1}{2} \\left(\\frac{1}{8} \\left(4-\\sqrt{55}\\right)+\\frac{1}{8} \\left(4+\\sqrt{55}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{55 \\sqrt{3} \\pi }{32}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+3*x+3*y**2-3*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{8-4 x^2}{6 x^2-16 x+24}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\sqrt{2}\\right\\},\\left\\{x\\to \\sqrt{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((8-4*x**2)/(6*x**2-16*x+24)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{45 x}{4}+\\frac{29}{4}}+\\sqrt{\\frac{55 x}{4}-\\frac{31}{4}}=\\frac{15}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{8} \\left(166-\\sqrt{27059}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((45*x)/4)+(29/4))+sqrt(((55*x)/4)-(31/4)), (15/4)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -27 (x-1)^3, q(x) = 49$", + "Output Answer": [ + "$-27 x^3+81 x^2-81 x+76$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -27*(x-1)**3\nq = 49\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2-4 x+2 y^2-10 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(y-\\frac{5}{2}\\right)^2-9 \\left(x+\\frac{2}{9}\\right)^2=\\frac{307}{18}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{9} & \\frac{5}{2}-\\frac{\\sqrt{3377}}{18} \\\\\n -\\frac{2}{9} & \\frac{1}{18} \\left(45+\\sqrt{3377}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{11}}{3}$\nCenter: $\\left\\{-\\frac{2}{9},\\frac{1}{2} \\left(\\frac{5}{2}-\\frac{\\sqrt{3377}}{18}+\\frac{1}{18} \\left(45+\\sqrt{3377}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{6} \\left(15-2 \\sqrt{2}\\right)-\\frac{3 x}{\\sqrt{2}},y=\\frac{3 x}{\\sqrt{2}}+\\frac{1}{6} \\left(15+2 \\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2-4*x+2*y**2-10*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{104 x}{7}-3}+\\sqrt{\\frac{16}{7}-\\frac{25 x}{7}}=\\frac{16}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-53485+608 \\sqrt{5197}}{43687}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((104*x)/7)-3)+sqrt((16/7)-((25*x)/7)), (16/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{17 x^6}{2}-\\frac{x^5}{2}-x^4-\\frac{3 x^3}{2}+\\frac{11 x^2}{2}-7 x+\\frac{5}{2}$ when divided by $\\frac{3 x^5}{2}-\\frac{11 x^4}{2}-\\frac{9 x^3}{2}+\\frac{3 x^2}{2}+8 x$.", + "Output Answer": [ + "$\\frac{17 x}{3}+\\frac{184}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((17*x**6)/2)-((x**5)/2)-x**4-((3*x**3)/2)+((11*x**2)/2)-7*x+(5/2)\nq = ((3*x**5)/2)-((11*x**4)/2)-((9*x**3)/2)+((3*x**2)/2)+8*x\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $7 x^2+49 x-\\frac{1449}{4}$", + "Output Answer": [ + "$-7 \\left(\\frac{9}{2}-x\\right) \\left(x+\\frac{23}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(7*x**2+49*x-(1449/4), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{50 x^2}{3}+\\frac{29 x}{3}-\\frac{26}{3}}{-\\frac{31 x^2}{3}+7 x+8}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{100} \\left(-29-\\sqrt{6041}\\right)\\right\\},\\left\\{x\\to \\frac{1}{100} \\left(-29+\\sqrt{6041}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((50*x**2)/3)+((29*x)/3)-(26/3))/(-((31*x**2)/3)+7*x+8)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (7-4 x)^2, q(x) = (9-8 x)^2$", + "Output Answer": [ + "$80 x^2-200 x+130$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (7-4*x)**2\nq = (9-8*x)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-2 x^2+3 x+2 y^2-4 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 (y-1)^2-2 \\left(x-\\frac{3}{4}\\right)^2=-\\frac{41}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{4} \\left(3-\\sqrt{82}\\right) & 1 \\\\\n \\frac{1}{4} \\left(3+\\sqrt{82}\\right) & 1 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{4} \\left(3-\\sqrt{82}\\right)+\\frac{1}{4} \\left(3+\\sqrt{82}\\right)\\right),1\\right\\}$\nAsymptotes: $\\left\\{y=x+\\frac{1}{4},y=\\frac{7}{4}-x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x**2+3*x+2*y**2-4*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-19 x+20 y-23=0$, $-21 x+23 y-10=0$", + "Output Answer": [ + "$x=-\\frac{329}{17}$, $y=-\\frac{293}{17}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-19*x+20*y-23, -21*x+23*y-10), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{34}{5} \\left(\\cos \\left(\\frac{26}{45}\\right)+i \\sin \\left(\\frac{26}{45}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{2064377754059776 \\left(\\cos \\left(\\frac{52}{9}\\right)+i \\sin \\left(\\frac{52}{9}\\right)\\right)}{9765625}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((34/5)*(math.cos((26/45))+1j*math.sin((26/45))))**10)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2 \\pi \\left(\\cos \\left(\\frac{13 \\pi }{180}\\right)-i \\sin \\left(\\frac{13 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $2 \\pi \\sqrt{\\sin ^2\\left(\\frac{13 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{180}\\right)}$\nArgument: $-\\frac{13 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2*math.pi*(math.cos(((13*math.pi)/180))-i*math.sin(((13*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{6+10 i}{\\sqrt{3}}$ and $y=\\frac{7+9 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-16+\\frac{124 i}{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((6+10*i)/(math.sqrt(3)))\ny = ((7+9*i)/(math.sqrt(3)))\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{9 x^2}{e}+\\frac{15 x}{e}+\\frac{20}{e}$ and $q(x) = \\frac{36 x^2}{e}+\\frac{40 x}{e}-\\frac{39}{e}$", + "Output Answer": [ + "$\\frac{324 x^4}{e^2}+\\frac{900 x^3}{e^2}+\\frac{969 x^2}{e^2}+\\frac{215 x}{e^2}-\\frac{780}{e^2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = ((9*x**2)/math.e)+((15*x)/math.e)+(20/math.e)\nq = ((36*x**2)/math.e)+((40*x)/math.e)-(39/math.e)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{89 x^2}{7}-\\frac{50 x}{7}-\\frac{57}{7}$", + "Output Answer": [ + "$x=\\frac{1}{89} \\left(-25-4 i \\sqrt{278}\\right)\\lor x=\\frac{1}{89} \\left(-25+4 i \\sqrt{278}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((89*x**2)/7)-((50*x)/7)-(57/7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(10+3)^2+((20+8)-19)$.", + "Output Answer": [ + "$178$" + ], + "Output Program": [ + "try: \n print((10+3)**2+((20+8)-19))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{44 x^2}{3}+13 x+\\frac{7}{3}$", + "Output Answer": [ + "$x=-\\frac{7}{11}\\lor x=-\\frac{1}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((44*x**2)/3)+13*x+(7/3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{42}{5}+\\frac{34 i}{5}$.", + "Output Answer": [ + "Norm: $2 \\sqrt{\\frac{146}{5}}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{17}{21}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(42/5)+((34*i)/5)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-18 x^2+16 x-3}{-14 x^2+21 x-18}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(8-\\sqrt{10}\\right)\\right\\},\\left\\{x\\to \\frac{1}{18} \\left(8+\\sqrt{10}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-18*x**2+16*x-3)/(-14*x**2+21*x-18)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $7 x^2+161 x+532$", + "Output Answer": [ + "$7 (-x-19) (-x-4)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(7*x**2+161*x+532, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-5 x^3+\\frac{295 x^2}{2}-600 x-\\frac{14625}{2}$", + "Output Answer": [ + "$5 (-x-5) (15-x) \\left(\\frac{39}{2}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-5*x**3+((295*x**2)/2)-600*x-(14625/2), a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{x^2}{5}-9 x+\\frac{69}{5}$ and $q(x) = -\\frac{59 x^2}{5}+\\frac{47 x}{5}+\\frac{13}{5}$", + "Output Answer": [ + "$\\frac{59 x^4}{25}+\\frac{2608 x^3}{25}-\\frac{6199 x^2}{25}+\\frac{2658 x}{25}+\\frac{897}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((x**2)/5)-9*x+(69/5)\nq = -((59*x**2)/5)+((47*x)/5)+(13/5)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{5}, 5, 7)$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{1851}}{5},\\tan ^{-1}\\left(\\frac{\\sqrt{626}}{35}\\right),\\tan ^{-1}(25)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/5)\ny = 5\nz = 7\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\pi, \\frac{1}{4}, \\frac{1}{2})$", + "Output Answer": [ + "$\\left\\{\\sqrt{\\frac{5}{16}+\\pi ^2},\\tan ^{-1}\\left(2 \\sqrt{\\frac{1}{16}+\\pi ^2}\\right),\\tan ^{-1}\\left(\\frac{1}{4 \\pi }\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.pi\ny = (1/4)\nz = (1/2)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^5+5 x^4-6 x^3+6 x^2+9 x-7$ when divided by $-9 x^3-2 x^2+2 x+7$.", + "Output Answer": [ + "$\\frac{2 x^2}{9}-\\frac{49 x}{81}+\\frac{620}{729}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**5+5*x**4-6*x**3+6*x**2+9*x-7\nq = -9*x**3-2*x**2+2*x+7\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=38-12 t, x(t)=6 t-15$", + "Output Answer": [ + "$y=8-2 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 38-12*t\nx_t = 6*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{10}{77}$, and $a_n=a_{n-1}+-\\frac{42}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$-\\frac{210470}{77}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(10/77) # initial value\nd = -(42/5) # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(10/77) # initial value\nd = -(42/5) # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -x^2+5 x+15$, $q(x) = -2 x^2-3 x+10$", + "Output Answer": [ + "$-3 x^2+2 x+25$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**2+5*x+15\nq = -2*x**2-3*x+10\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{9 x^2}{2}+\\frac{27 x}{2}+\\frac{21}{2}$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(-9-i \\sqrt{3}\\right)\\lor x=\\frac{1}{6} \\left(-9+i \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((9*x**2)/2)+((27*x)/2)+(21/2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2+9 x-4 y^2+2 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x+\\frac{9}{10}\\right)^2-4 \\left(y-\\frac{1}{4}\\right)^2=\\frac{24}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{10} \\left(3+2 \\sqrt{6}\\right) & \\frac{1}{4} \\\\\n \\frac{3}{10} \\left(2 \\sqrt{6}-3\\right) & \\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{3}{10} \\left(2 \\sqrt{6}-3\\right)-\\frac{3}{10} \\left(3+2 \\sqrt{6}\\right)\\right),\\frac{1}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{5} x}{2}+\\frac{1}{20} \\left(5+9 \\sqrt{5}\\right),y=\\frac{1}{20} \\left(5-9 \\sqrt{5}\\right)-\\frac{\\sqrt{5} x}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2+9*x-4*y**2+2*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{87 x^2}{7}+\\frac{48 x}{7}+\\frac{46}{7}$", + "Output Answer": [ + "$\\frac{87}{7} \\left(x+\\frac{8}{29}\\right)^2+\\frac{1142}{203}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((87*x**2)/7)+((48*x)/7)+(46/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -3 \\sqrt{2} x^2-3 \\sqrt{2} x-9 \\sqrt{2}$ and $q(x) = -4 \\sqrt{2} x^2-4 \\sqrt{2} x-7 \\sqrt{2}$", + "Output Answer": [ + "$24 x^4+48 x^3+138 x^2+114 x+126$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -3*sqrt(2)*x**2-3*sqrt(2)*x-9*sqrt(2)\nq = -4*sqrt(2)*x**2-4*sqrt(2)*x-7*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\sqrt{5}, \\frac{1}{\\sqrt{5}}, \\frac{1}{\\sqrt{2}})$", + "Output Answer": [ + "$\\left\\{\\sqrt{\\frac{57}{10}},\\tan ^{-1}\\left(2 \\sqrt{\\frac{13}{5}}\\right),\\tan ^{-1}\\left(\\frac{1}{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.sqrt(5)\ny = (1/(math.sqrt(5)))\nz = (1/(math.sqrt(2)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{11}{49}$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$-\\frac{117875}{49}$" + ], + "Output Program": [ + "a = -(11/49) # initial value\nd = -8 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(11/49) # initial value\nd = -8 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-8 \\left(\\cos \\left(\\frac{17}{30}\\right)+i \\sin \\left(\\frac{17}{30}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$16777216 \\left(\\cos \\left(\\frac{68}{15}\\right)+i \\sin \\left(\\frac{68}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-8*(math.cos((17/30))+1j*math.sin((17/30))))**8)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{4} (90 t-293), x(t)=5 t-15$", + "Output Answer": [ + "$y=\\frac{9 x}{2}-\\frac{23}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/4)*(90*t-293)\nx_t = 5*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{8}{21}-\\left(\\frac{24}{15}-21\\right)$.", + "Output Answer": [ + "$\\frac{2077}{105}$" + ], + "Output Program": [ + "try: \n print((8/21)-((24/15)-21))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(\\sin \\left(\\frac{19 \\pi }{90}\\right)+i \\cos \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$1024 \\left(-\\sin \\left(\\frac{\\pi }{18}\\right)-i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(math.sin(((19*math.pi)/90))+1j*math.cos(((19*math.pi)/90))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 x^2+12 x+9$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(2-\\sqrt{10}\\right)\\lor x=\\frac{1}{2} \\left(2+\\sqrt{10}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*x**2+12*x+9, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left(16 \\frac{1}{1}-17\\right)+3\\right)+1\\right)-\\frac{24}{14}$.", + "Output Answer": [ + "$\\frac{9}{7}$" + ], + "Output Program": [ + "try: \n print((((16*(1/1)-17)+3)+1)-(24/14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^4+\\frac{75 x^3}{4}-16 x^2+\\frac{15 x}{2}-1$ and $\\frac{x^2}{2}+5 x-1$.", + "Output Answer": [ + "$\\frac{x^2}{4}+\\frac{5 x}{2}-\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**4+((75*x**3)/4)-16*x**2+((15*x)/2)-1, ((x**2)/2)+5*x-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{3}{4} \\left(\\cos \\left(\\frac{11}{9}\\right)+i \\sin \\left(\\frac{11}{9}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$\\frac{81}{256} \\left(\\cos \\left(\\frac{44}{9}\\right)+i \\sin \\left(\\frac{44}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((3/4)*(math.cos((11/9))+1j*math.sin((11/9))))**4)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{13 x^2}{\\sqrt{2}}-\\frac{21 x}{\\sqrt{2}}+8 \\sqrt{2}$", + "Output Answer": [ + "$-\\frac{13 \\left(x+\\frac{21}{26}\\right)^2}{\\sqrt{2}}+8 \\sqrt{2}+\\frac{441}{52 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((13*x**2)/(math.sqrt(2)))-((21*x)/(math.sqrt(2)))+8*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((9-2)+4)-5) ((9-7)-14)$.", + "Output Answer": [ + "$-72$" + ], + "Output Program": [ + "try: \n print((((9-2)+4)-5)*((9-7)-14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{59}{25}$, and $a_n=a_{n-1}+2 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$3 \\left(\\frac{118}{25}+10 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\na = (59/25) # initial value\nd = 2*math.pi # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (59/25) # initial value\nd = 2*math.pi # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 7 \\sqrt{5} x+6 \\sqrt{5}\\right| =10 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{16}{7}\\right\\},\\left\\{x\\to \\frac{4}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(7*sqrt(5)*x+6*sqrt(5)), 10*sqrt(5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 \\sqrt{5} x^2-2 \\sqrt{5} x-6 \\sqrt{5}$ and $q(x) = -\\sqrt{5} x^2-2 \\sqrt{5} x+3 \\sqrt{5}$", + "Output Answer": [ + "$-25 x^4-40 x^3+125 x^2+30 x-90$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*sqrt(5)*x**2-2*sqrt(5)*x-6*sqrt(5)\nq = -sqrt(5)*x**2-2*sqrt(5)*x+3*sqrt(5)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$14 x+6 y+14 z+1=0$, $13 x+8 z-9=0$, $-14 x-8 y+z-16=0$", + "Output Answer": [ + "$x=\\frac{179}{655}$, $y=-\\frac{627}{262}$, $z=\\frac{446}{655}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((14*x+6*y+14*z+1, 13*x+8*z-9, -14*x-8*y+z-16)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-9.56347-0.836695 i$.", + "Output Answer": [ + "Norm: $9.6$\nArgument: $-3.05433$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -9.56347-0.836695*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2-2 x+9 y^2+6 y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(y+\\frac{1}{3}\\right)^2-6 \\left(x+\\frac{1}{6}\\right)^2=-\\frac{7}{6}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{18} \\left(-3-\\sqrt{105}\\right) & -\\frac{1}{3} \\\\\n \\frac{1}{18} \\left(\\sqrt{105}-3\\right) & -\\frac{1}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{18} \\left(-3-\\sqrt{105}\\right)+\\frac{1}{18} \\left(\\sqrt{105}-3\\right)\\right),-\\frac{1}{3}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{2}{3}} x+\\frac{1}{18} \\left(\\sqrt{6}-6\\right),y=\\frac{1}{18} \\left(-6-\\sqrt{6}\\right)-\\sqrt{\\frac{2}{3}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2-2*x+9*y**2+6*y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $e^{4 x}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{\\log (y)}{4}\\text{ if }y>0$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, math.e**(4*x))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(27 t+133)^2, x(t)=-3 t-15$", + "Output Answer": [ + "$y=81 x^2+36 x+4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (27*t+133)**2\nx_t = -3*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x-\\frac{25}{4}}+\\sqrt{\\frac{25 x}{4}-\\frac{39}{4}}=\\frac{47}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{73849-564 \\sqrt{11681}}{1156}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x-(25/4))+sqrt(((25*x)/4)-(39/4)), (47/4)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-282 x^3+\\frac{232 x^2}{3}+\\frac{748 x}{3}-\\frac{304}{3}}{264 x-\\frac{352}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{47} \\left(-4-\\sqrt{1802}\\right)\\right\\},\\left\\{x\\to \\frac{1}{47} \\left(-4+\\sqrt{1802}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-282*x**3+((232*x**2)/3)+((748*x)/3)-(304/3))/(264*x-(352/3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $2 x^2+x+12$", + "Output Answer": [ + "$2 \\left(x+\\frac{1}{4}\\right)^2+\\frac{95}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (2*x**2+x+12), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-528 x^2-534 x-63}{-96 x-84}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{22}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-528*x**2-534*x-63)/(-96*x-84)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{49}{40}$, and $a_n=a_{n-1}+-2 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$2 \\left(\\frac{49}{20}-6 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\na = (49/40) # initial value\nd = -2*math.sqrt(5) # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (49/40) # initial value\nd = -2*math.sqrt(5) # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{17}{26}$, and $a_n=a_{n-1}+5$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$\\frac{33281}{26}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (17/26) # initial value\nd = 5 # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (17/26) # initial value\nd = 5 # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $8 x^2-4 x+5$", + "Output Answer": [ + "$x=\\frac{1}{4}-\\frac{3 i}{4}\\lor x=\\frac{1}{4}+\\frac{3 i}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(8*x**2-4*x+5, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 x^2-7 x-7$", + "Output Answer": [ + "$x=\\frac{1}{12} \\left(-7-i \\sqrt{119}\\right)\\lor x=\\frac{1}{12} \\left(-7+i \\sqrt{119}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*x**2-7*x-7, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2+7 x+6 y^2+10 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y+\\frac{5}{6}\\right)^2-9 \\left(x-\\frac{7}{18}\\right)^2=\\frac{209}{36}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{7}{18} & \\frac{1}{36} \\left(-30-\\sqrt{2090}\\right) \\\\\n \\frac{7}{18} & \\frac{1}{36} \\left(\\sqrt{2090}-30\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{3}}$\nCenter: $\\left\\{\\frac{7}{18},\\frac{1}{2} \\left(\\frac{1}{36} \\left(-30-\\sqrt{2090}\\right)+\\frac{1}{36} \\left(\\sqrt{2090}-30\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{36} \\left(7 \\sqrt{6}-30\\right)-\\sqrt{\\frac{3}{2}} x,y=\\sqrt{\\frac{3}{2}} x+\\frac{1}{36} \\left(-30-7 \\sqrt{6}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2+7*x+6*y**2+10*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{221 x^2+161 x-22}{170 x^2-139 x+14}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{11}{13}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((221*x**2+161*x-22)/(170*x**2-139*x+14)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+2 x-7 y^2-3 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x+\\frac{1}{7}\\right)^2-7 \\left(y+\\frac{3}{14}\\right)^2=\\frac{23}{28}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{14} \\left(-2-\\sqrt{46}\\right) & -\\frac{3}{14} \\\\\n \\frac{1}{14} \\left(\\sqrt{46}-2\\right) & -\\frac{3}{14} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{14} \\left(-2-\\sqrt{46}\\right)+\\frac{1}{14} \\left(\\sqrt{46}-2\\right)\\right),-\\frac{3}{14}\\right\\}$\nAsymptotes: $\\left\\{y=x-\\frac{1}{14},y=-x-\\frac{5}{14}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+2*x-7*y**2-3*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=16 \\left(t^2-30 t+227\\right)^2, x(t)=t^2-30 t+225$", + "Output Answer": [ + "$y=16 x^2+64 x+64$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 16*(t**2-30*t+227)**2\nx_t = t**2-30*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2+9 x-2 y^2-7 y+7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x+\\frac{9}{10}\\right)^2-2 \\left(y+\\frac{7}{4}\\right)^2=-\\frac{363}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{9}{10} & -\\frac{7}{4}-\\frac{11 \\sqrt{21}}{20} \\\\\n -\\frac{9}{10} & \\frac{11 \\sqrt{21}}{20}-\\frac{7}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{5}}$\nCenter: $\\left\\{-\\frac{9}{10},-\\frac{7}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{20} \\left(-35-9 \\sqrt{10}\\right)-\\sqrt{\\frac{5}{2}} x,y=\\sqrt{\\frac{5}{2}} x+\\frac{1}{20} \\left(9 \\sqrt{10}-35\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2+9*x-2*y**2-7*y+7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2+10 \\sqrt{3} x+945$", + "Output Answer": [ + "$5 \\left(-x-7 \\sqrt{3}\\right) \\left(x-9 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2+10*sqrt(3)*x+945, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-63 x^3-558 x^2-221 x+450}{-39 x^2-376 x-425}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{42} \\left(-11-\\sqrt{1633}\\right)\\right\\},\\left\\{x\\to \\frac{1}{42} \\left(-11+\\sqrt{1633}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-63*x**3-558*x**2-221*x+450)/(-39*x**2-376*x-425)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{8 \\left(\\sin \\left(\\frac{3 \\pi }{20}\\right)+i \\cos \\left(\\frac{3 \\pi }{20}\\right)\\right)}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $8 \\sqrt{\\frac{1}{3} \\left(\\sin ^2\\left(\\frac{3 \\pi }{20}\\right)+\\cos ^2\\left(\\frac{3 \\pi }{20}\\right)\\right)}$\nArgument: $\\frac{7 \\pi }{20}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((8*(math.sin(((3*math.pi)/20))+i*math.cos(((3*math.pi)/20))))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{\\sin (x+4)}{e}$ at the point $x=2$", + "Output Answer": [ + "$\\frac{\\sin (6)}{e} = -0.103$" + ], + "Output Program": [ + "import math\n\nx = 2\ntry: \n f = ((math.sin(x+4))/math.e)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $e^{2-5 x}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{5} \\log \\left(\\frac{1}{y}\\right)+\\frac{2}{5}\\text{ if }y>0$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, math.e**(2-5*x))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -4 x^2+7 x+6$, $q(x) = -2 x^2-8 x+3$", + "Output Answer": [ + "$-6 x^2-x+9$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**2+7*x+6\nq = -2*x**2-8*x+3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{37}{36}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{85475}{36}$" + ], + "Output Program": [ + "a = -(37/36) # initial value\nd = 8 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(37/36) # initial value\nd = 8 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $3 x^2+5 x+5$", + "Output Answer": [ + "$3 \\left(x+\\frac{5}{6}\\right)^2+\\frac{35}{12}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (3*x**2+5*x+5), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $6 x^2+3 x-3$ and $2 x-1$.", + "Output Answer": [ + "$2 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(6*x**2+3*x-3, 2*x-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $8 x^2+\\frac{5 x}{3}-4$", + "Output Answer": [ + "$8 \\left(x+\\frac{5}{48}\\right)^2-\\frac{1177}{288}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (8*x**2+((5*x)/3)-4), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$6 x-2 y+19 z-\\frac{1}{2}=0$, $12 x-3 y+7 z-10=0$, $-\\frac{x}{2}-\\frac{19 y}{2}-z+2=0$", + "Output Answer": [ + "$x=\\frac{7505}{7178}$, $y=\\frac{1331}{7178}$, $z=-\\frac{2041}{7178}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((6*x-2*y+19*z-(1/2), 12*x-3*y+7*z-10, -(x/2)-((19*y)/2)-z+2)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\frac{16+17}{24}+14\\right)-1\\right)^2+\\frac{1}{12} \\left((2-17)^2+9\\right)$.", + "Output Answer": [ + "$\\frac{14473}{64}$" + ], + "Output Program": [ + "try: \n print(((((16+17)/24)+14)-1)**2+(1/12)*((2-17)**2+9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=4+\\frac{13 i}{2}$ and $y=\\frac{17}{2}+\\frac{9 i}{2}$", + "Output Answer": [ + "$\\frac{253}{370}+\\frac{149 i}{370}$" + ], + "Output Program": [ + "i = 1j\nx = 4+((13*i)/2)\ny = (17/2)+((9*i)/2)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{33}{7}-8 i$.", + "Output Answer": [ + "Norm: $\\frac{65}{7}$\nArgument: $-\\tan ^{-1}\\left(\\frac{56}{33}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (33/7)-8*i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{41 x^2}{3}-\\frac{14 x}{3}+\\frac{25}{3}$ and $q(x) = \\frac{2 x^2}{3}-6 x-5$", + "Output Answer": [ + "$\\frac{82 x^4}{9}-\\frac{766 x^3}{9}-\\frac{313 x^2}{9}-\\frac{80 x}{3}-\\frac{125}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((41*x**2)/3)-((14*x)/3)+(25/3)\nq = ((2*x**2)/3)-6*x-5\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{37 x}{4}-\\frac{15}{4}\\right| =\\frac{11}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{37}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((37*x)/4)-(15/4)), (11/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{15}{2} \\left(\\cos \\left(\\frac{\\pi }{18}\\right)-i \\sin \\left(\\frac{\\pi }{18}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-\\frac{8649755859375 \\left(-\\sin \\left(\\frac{\\pi }{9}\\right)-i \\cos \\left(\\frac{\\pi }{9}\\right)\\right)}{2048}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(15/2)*(math.cos((math.pi/18))-1j*math.sin((math.pi/18))))**11)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{14 x+14}+\\sqrt{3}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(55-11 \\sqrt{3}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(14*x+14)+sqrt(3), 11), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{89 x}{4}-20 y-\\frac{9 z}{2}+\\frac{67}{4}=0$, $\\frac{x}{2}-20 y+\\frac{43 z}{2}-\\frac{69}{4}=0$, $-\\frac{27 x}{4}+7 y+\\frac{19 z}{4}-\\frac{5}{2}=0$", + "Output Answer": [ + "$x=-\\frac{6252}{3073}$, $y=-\\frac{32873}{24584}$, $z=-\\frac{2423}{6146}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((89*x)/4)-20*y-((9*z)/2)+(67/4), (x/2)-20*y+((43*z)/2)-(69/4), -((27*x)/4)+7*y+((19*z)/4)-(5/2))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{19 x}{4}-\\frac{15}{2}}+\\sqrt{\\frac{15}{2}}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{19} \\left(844-56 \\sqrt{30}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((19*x)/4)-(15/2))+sqrt((15/2)), 14), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-e \\left(-\\sin \\left(\\frac{\\pi }{20}\\right)-i \\cos \\left(\\frac{\\pi }{20}\\right)\\right)$.", + "Output Answer": [ + "Norm: $e \\sqrt{\\sin ^2\\left(\\frac{\\pi }{20}\\right)+\\cos ^2\\left(\\frac{\\pi }{20}\\right)}$\nArgument: $\\frac{9 \\pi }{20}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.e*(-math.sin((math.pi/20))-i*math.cos((math.pi/20)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-1+i) \\pi$ and $y=(-3+i) \\pi$", + "Output Answer": [ + "$2 \\pi$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-1+i)*math.pi\ny = (-3+i)*math.pi\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -7 \\sqrt{3} x-6 \\sqrt{3}\\right| =12 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{18}{7}\\right\\},\\left\\{x\\to \\frac{6}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-7*sqrt(3)*x-6*sqrt(3)), 12*sqrt(3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\sqrt{2} \\left(\\cos \\left(\\frac{64}{45}\\right)+i \\sin \\left(\\frac{64}{45}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$16 \\sqrt{2} \\left(\\cos \\left(\\frac{64}{15}\\right)+i \\sin \\left(\\frac{64}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*math.sqrt(2)*(math.cos((64/45))+1j*math.sin((64/45))))**3)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{\\sqrt{80}}}{\\sqrt{105}}$.", + "Output Answer": [ + "$\\frac{2}{\\sqrt[4]{5} \\sqrt{21}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(sqrt(80)))/(sqrt(105))))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the first order series of the inverse of the following function around 1:\n$e^{-7 x/3}$", + "Output Answer": [ + "$1-\\frac{3}{7} e^{7/3} \\left(x-\\frac{1}{e^{7/3}}\\right)$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, math.e**(-7*x/3))\nprint(solve(f, x)[0].series(y, 1, 1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^4-2 x^3+4 x^2+7 x-3$ when divided by $-3 x^3-8 x^2+10 x-3$.", + "Output Answer": [ + "$\\frac{2 x}{3}-\\frac{10}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**4-2*x**3+4*x**2+7*x-3\nq = -3*x**3-8*x**2+10*x-3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11 x-3}+\\sqrt{13 x-10}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{24529}{2 \\left(1735+12 \\sqrt{20734}\\right)}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11*x-3)+sqrt(13*x-10), 12), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{3}{7}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=17$.", + "Output Answer": [ + "$\\frac{51}{7}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (3/7) # initial value\nd = 0 # second term\nn = 17 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (3/7) # initial value\nd = 0 # second term\nn = 17 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x^4-7 x^3+8 x^2+20 x$ and $-x^3-4 x^2-4 x$.", + "Output Answer": [ + "$x^3+4 x^2+4 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x**4-7*x**3+8*x**2+20*x, -x**3-4*x**2-4*x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{26 x^2}{7}-\\frac{x}{7}-\\frac{101}{7}$", + "Output Answer": [ + "$x=\\frac{1}{52} \\left(1-\\sqrt{10505}\\right)\\lor x=\\frac{1}{52} \\left(1+\\sqrt{10505}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((26*x**2)/7)-(x/7)-(101/7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{250 x^3-165 x^2-133 x+48}{-525 x^2-161 x+112}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{10}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((250*x**3-165*x**2-133*x+48)/(-525*x**2-161*x+112)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^6+9 x^5+4 x^4+7 x^3-2 x^2-8 x-5$ when divided by $3 x+2$.", + "Output Answer": [ + "$\\frac{4 x^5}{3}+\\frac{19 x^4}{9}-\\frac{2 x^3}{27}+\\frac{193 x^2}{81}-\\frac{548 x}{243}-\\frac{848}{729}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**6+9*x**5+4*x**4+7*x**3-2*x**2-8*x-5\nq = 3*x+2\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{19 x^2}{2}+\\frac{21 x}{2}+\\frac{27}{2}$ and $q(x) = x^2-x+4$", + "Output Answer": [ + "$-\\frac{19 x^4}{2}+20 x^3-35 x^2+\\frac{57 x}{2}+54$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((19*x**2)/2)+((21*x)/2)+(27/2)\nq = x**2-x+4\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\log (7-7 x)-\\sqrt{-2 x-3}$ at the point $x=-8$", + "Output Answer": [ + "$-\\sqrt{13}+\\log (63) = 0.538$" + ], + "Output Program": [ + "import math\n\nx = -8\ntry: \n f = math.log(7-7*x)-math.sqrt(-2*x-3)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{1}{(6-x)^2}$ at the point $x=9$", + "Output Answer": [ + "$\\frac{1}{9} = 0.111$" + ], + "Output Program": [ + "x = 9\ntry: \n f = (1/((6-x)**2))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $8 x^2+14 x+14$", + "Output Answer": [ + "$8 \\left(x+\\frac{7}{8}\\right)^2+\\frac{63}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (8*x**2+14*x+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 11 x^2-x+3$ and $q(x) = -15 x^2-14 x+6$", + "Output Answer": [ + "$-165 x^4-139 x^3+35 x^2-48 x+18$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 11*x**2-x+3\nq = -15*x**2-14*x+6\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{5}}, 8, 7)$", + "Output Answer": [ + "$\\left\\{\\sqrt{\\frac{566}{5}},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{321}{5}}}{7}\\right),\\tan ^{-1}\\left(8 \\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(5)))\ny = 8\nz = 7\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $15 x^5+23 x^4+20 x^3+10 x^2+4 x$ and $5 x^3+x^2+2 x$.", + "Output Answer": [ + "$5 x^3+x^2+2 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(15*x**5+23*x**4+20*x**3+10*x**2+4*x, 5*x**3+x**2+2*x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-5 x^5+6 x^4+13 x^3-4 x^2+12 x-1$ and $\\frac{5 x^5}{3}-2 x^4-\\frac{13 x^3}{3}+\\frac{4 x^2}{3}-4 x+\\frac{1}{3}$.", + "Output Answer": [ + "$\\frac{5 x^5}{3}-2 x^4-\\frac{13 x^3}{3}+\\frac{4 x^2}{3}-4 x+\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-5*x**5+6*x**4+13*x**3-4*x**2+12*x-1, ((5*x**5)/3)-2*x**4-((13*x**3)/3)+((4*x**2)/3)-4*x+(1/3)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$2 x+5=0$, $-7 x+6 y+6=0$", + "Output Answer": [ + "$x=-\\frac{5}{2}$, $y=-\\frac{47}{12}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((2*x+5, -7*x+6*y+6), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{5}, \\frac{1}{4}, 9)$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{32441}}{20},\\tan ^{-1}\\left(\\frac{\\sqrt{41}}{180}\\right),\\tan ^{-1}\\left(\\frac{5}{4}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/5)\ny = (1/4)\nz = 9\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{38}{99}$, and $a_n=a_{n-1}+4 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$7 \\left(\\frac{76}{99}+52 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (38/99) # initial value\nd = 4*math.sqrt(5) # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (38/99) # initial value\nd = 4*math.sqrt(5) # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^2-4 x+10$ when divided by $-6 x^2+8 x+10$.", + "Output Answer": [ + "$\\frac{5}{6}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**2-4*x+10\nq = -6*x**2+8*x+10\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{5 x^2}{2}-10$", + "Output Answer": [ + "$x=2\\lor x=-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((5*x**2)/2)-10, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-11 x^2+6 x+1$", + "Output Answer": [ + "$\\frac{20}{11}-11 \\left(x-\\frac{3}{11}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-11*x**2+6*x+1), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2-20 \\sqrt{5} x+525$", + "Output Answer": [ + "$-5 \\left(x-3 \\sqrt{5}\\right) \\left(x+7 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2-20*sqrt(5)*x+525, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{80}{27}$, and $a_n=a_{n-1}+-9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$-\\frac{1055}{9}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (80/27) # initial value\nd = -9 # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (80/27) # initial value\nd = -9 # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $2 x^2+\\frac{46 x}{5}-\\frac{2}{5}$", + "Output Answer": [ + "$x=\\frac{1}{10} \\left(-23-3 \\sqrt{61}\\right)\\lor x=\\frac{1}{10} \\left(3 \\sqrt{61}-23\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(2*x**2+((46*x)/5)-(2/5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\frac{1}{-\\frac{17 x}{3}-\\frac{10}{3}}+\\frac{1}{-\\frac{17 x}{3}-\\frac{19}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{29}{34}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve((1/(-((17*x)/3)-(10/3)))+(1/(-((17*x)/3)-(19/3))), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x^3+2 x^2-6 x+6$ and $2 x^3+x^2-3 x+3$.", + "Output Answer": [ + "$2 x^3+x^2-3 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x**3+2*x**2-6*x+6, 2*x**3+x**2-3*x+3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{1}{2}$, and $a_n=a_{n-1}+-\\frac{19}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$-240$" + ], + "Output Program": [ + "a = (1/2) # initial value\nd = -(19/7) # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (1/2) # initial value\nd = -(19/7) # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x-2}+\\sqrt{6 x+4}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{187}{200}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x-2)+sqrt(6*x+4), 5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10 x+7}+\\sqrt{14 x+\\frac{57}{4}}=\\frac{41}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{64} \\left(9970-41 \\sqrt{58123}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10*x+7)+sqrt(14*x+(57/4)), (41/4)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-9 x^3+414 x^2-6192 x+30240$", + "Output Answer": [ + "$-9 (12-x) (20-x) (x-14)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-9*x**3+414*x**2-6192*x+30240, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{33}{10}$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$-\\frac{6669}{10}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(33/10) # initial value\nd = -8 # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(33/10) # initial value\nd = -8 # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{5+6 i}{\\sqrt{3}}$ and $y=\\frac{10-8 i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{1}{82}+\\frac{25 i}{41}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((5+6*i)/(math.sqrt(3)))\ny = ((10-8*i)/(math.sqrt(3)))\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\log \\left(9 x^4-5\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\sqrt[4]{\\frac{2}{3}}\\right\\},\\left\\{x\\to -i \\sqrt[4]{\\frac{2}{3}}\\right\\},\\left\\{x\\to i \\sqrt[4]{\\frac{2}{3}}\\right\\},\\left\\{x\\to \\sqrt[4]{\\frac{2}{3}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(log(9*x**4-5), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 4 x^2+17 x-17\\right| =-13$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(4*x**2+17*x-17), -13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{133}-\\sqrt{49}}{\\sqrt{146}}$.", + "Output Answer": [ + "$\\frac{\\sqrt{133}-7}{\\sqrt{146}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(133)-sqrt(49))/(sqrt(146))))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{6 x}{5}+\\frac{6}{5}$ when divided by $-\\frac{19}{5}$.", + "Output Answer": [ + "$-\\frac{6 x}{19}-\\frac{6}{19}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((6*x)/5)+(6/5)\nq = -(19/5)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(((18-9)+13)^2-22\\right)^2+3\\right)+\\left(\\frac{15}{18}-5\\right)$.", + "Output Answer": [ + "$\\frac{1280657}{6}$" + ], + "Output Program": [ + "try: \n print(((((18-9)+13)**2-22)**2+3)+((15/18)-5))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{53}{25}$, and $a_n=a_{n-1}+-\\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$3 \\left(\\frac{106}{25}-5 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (53/25) # initial value\nd = -math.sqrt(3) # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (53/25) # initial value\nd = -math.sqrt(3) # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{7 x^2}{\\sqrt{2}}-\\frac{15 x}{\\sqrt{2}}-\\frac{9}{\\sqrt{2}}$", + "Output Answer": [ + "$x=\\frac{3}{14} \\left(-5-i \\sqrt{3}\\right)\\lor x=\\frac{3}{14} \\left(-5+i \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((7*x**2)/(sqrt(2)))-((15*x)/(sqrt(2)))-(9/(sqrt(2))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 e x^2$ and $q(x) = e x^2+5 e x-e$", + "Output Answer": [ + "$5 e^2 x^4+25 e^2 x^3-5 e^2 x^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = 5*math.e*x**2\nq = math.e*x**2+5*math.e*x-math.e\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -10.669 x^2-1.918 x+2.309$, $q(x) = 13.425 x^2+5.119 x-12.787$", + "Output Answer": [ + "$2.756 x^2+3.201 x-10.478$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -10.669*x**2-1.918*x+2.309\nq = 13.425*x**2+5.119*x-12.787\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2-5 x+8 y^2-y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y-\\frac{1}{16}\\right)^2-3 \\left(x+\\frac{5}{6}\\right)^2=-\\frac{101}{96}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{6}-\\frac{\\sqrt{1111}}{48} & \\frac{1}{16} \\\\\n \\frac{1}{48} \\left(\\sqrt{1111}-40\\right) & \\frac{1}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{11}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{5}{6}-\\frac{\\sqrt{1111}}{48}+\\frac{1}{48} \\left(\\sqrt{1111}-40\\right)\\right),\\frac{1}{16}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{2} \\sqrt{\\frac{3}{2}} x+\\frac{1}{48} \\left(3+10 \\sqrt{6}\\right),y=\\frac{1}{48} \\left(3-10 \\sqrt{6}\\right)-\\frac{1}{2} \\sqrt{\\frac{3}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2-5*x+8*y**2-y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $7 x^2+\\frac{7 x}{2}-\\frac{25}{2}$", + "Output Answer": [ + "$x=\\frac{1}{28} \\left(-7-3 \\sqrt{161}\\right)\\lor x=\\frac{1}{28} \\left(3 \\sqrt{161}-7\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(7*x**2+((7*x)/2)-(25/2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$23 x+18 y-4 z+18=0$, $21 x+4 y-8 z-24=0$, $-5 x-22 y+7 z-10=0$", + "Output Answer": [ + "$x=-\\frac{236}{1781}$, $y=-\\frac{3155}{1781}$, $z=-\\frac{580}{137}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((23*x+18*y-4*z+18, 21*x+4*y-8*z-24, -5*x-22*y+7*z-10)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$4 \\sqrt{2} x-4 \\sqrt{2} y+17 \\sqrt{2}=0$, $12 \\sqrt{2} x-5 \\sqrt{2} y+17 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{17}{28}$, $y=\\frac{34}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((4*sqrt(2)*x-4*sqrt(2)*y+17*sqrt(2), 12*sqrt(2)*x-5*sqrt(2)*y+17*sqrt(2)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $-\\sin ^{-1}\\left(\\frac{42}{5}-\\frac{19 x}{5}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{19} (5 \\sin (y)+42)\\text{ if }-\\frac{\\pi }{2}\\leq y\\leq \\frac{\\pi }{2}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, -asin((42/5)-((19*x)/5)))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $7 x^2-4 x+6$", + "Output Answer": [ + "$7 \\left(x-\\frac{2}{7}\\right)^2+\\frac{38}{7}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (7*x**2-4*x+6), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\sqrt{5} x^2-5 \\sqrt{5} x+4 \\sqrt{5}$ and $q(x) = -6 \\sqrt{5} x^2-3 \\sqrt{5} x-7 \\sqrt{5}$", + "Output Answer": [ + "$30 x^4+165 x^3-10 x^2+115 x-140$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -sqrt(5)*x**2-5*sqrt(5)*x+4*sqrt(5)\nq = -6*sqrt(5)*x**2-3*sqrt(5)*x-7*sqrt(5)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$8 x+7 y-13=0$, $-9 x+6 y+11=0$", + "Output Answer": [ + "$x=\\frac{155}{111}$, $y=\\frac{29}{111}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((8*x+7*y-13, -9*x+6*y+11), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{159 x}{7}+14 y+\\frac{10 z}{7}+\\frac{164}{7}=0$, $\\frac{144 x}{7}+14 y-\\frac{26 z}{7}-\\frac{78}{7}=0$, $\\frac{17 x}{7}+\\frac{101 y}{7}-\\frac{95 z}{7}+12=0$", + "Output Answer": [ + "$x=\\frac{183124}{30279}$, $y=-\\frac{1915349}{181674}$, $z=-\\frac{1679063}{181674}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((159*x)/7)+14*y+((10*z)/7)+(164/7), ((144*x)/7)+14*y-((26*z)/7)-(78/7), ((17*x)/7)+((101*y)/7)-((95*z)/7)+12)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-15 x-\\frac{43 y}{2}-6=0$, $-4 x+\\frac{41 y}{2}+\\frac{45}{2}=0$", + "Output Answer": [ + "$x=\\frac{1443}{1574}$, $y=-\\frac{723}{787}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-15*x-((43*y)/2)-6, -4*x+((41*y)/2)+(45/2)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{24}{5} \\left(\\cos \\left(\\frac{1}{18}\\right)+i \\sin \\left(\\frac{1}{18}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$\\frac{110075314176 \\left(\\cos \\left(\\frac{4}{9}\\right)+i \\sin \\left(\\frac{4}{9}\\right)\\right)}{390625}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((24/5)*(math.cos((1/18))+1j*math.sin((1/18))))**8)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{(5 x-2)^3}{2 \\sqrt{2}}, q(x) = \\frac{1}{4} (12 x+7)^4$", + "Output Answer": [ + "$5184 x^4-\\frac{125 x^3}{2 \\sqrt{2}}+12096 x^3+\\frac{75 x^2}{\\sqrt{2}}+10584 x^2-15 \\sqrt{2} x+4116 x+2 \\sqrt{2}+\\frac{2401}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(((5*x-2)**3)/(2*sqrt(2)))\nq = (1/4)*(12*x+7)**4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 19 x^2 \\log (2)+21 x \\log (2)-\\log (2)$ and $q(x) = 18 x^2 \\log (2)+15 x \\log (2)-5 \\log (2)$", + "Output Answer": [ + "$342 x^4 \\log ^2(2)+663 x^3 \\log ^2(2)+202 x^2 \\log ^2(2)-120 x \\log ^2(2)+5 \\log ^2(2)$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 19*x**2*log(2)+21*x*log(2)-log(2)\nq = 18*x**2*log(2)+15*x*log(2)-5*log(2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4$ and $-4 x^3+2 x^2-3 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4, -4*x**3+2*x**2-3*x-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{21 x^2}{\\pi }+\\frac{43 x}{\\pi }-\\frac{13}{\\pi }$ and $q(x) = -\\frac{19 x^2}{\\pi }-\\frac{6 x}{\\pi }+\\frac{15}{\\pi }$", + "Output Answer": [ + "$-\\frac{399 x^4}{\\pi ^2}-\\frac{943 x^3}{\\pi ^2}+\\frac{304 x^2}{\\pi ^2}+\\frac{723 x}{\\pi ^2}-\\frac{195}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((21*x**2)/pi)+((43*x)/pi)-(13/pi)\nq = -((19*x**2)/pi)-((6*x)/pi)+(15/pi)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((((23+18)-15)+2)+3)+\\left(\\left(\\frac{3}{24}-12\\right)+11\\right)^2$.", + "Output Answer": [ + "$\\frac{2033}{64}$" + ], + "Output Program": [ + "try: \n print(((((23+18)-15)+2)+3)+(((3/24)-12)+11)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{53 x^2}{5}-\\frac{63 x}{5}+13}{-\\frac{53 x^2}{5}-\\frac{114 x}{5}-\\frac{31}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{106} \\left(-63-\\sqrt{17749}\\right)\\right\\},\\left\\{x\\to \\frac{1}{106} \\left(-63+\\sqrt{17749}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((53*x**2)/5)-((63*x)/5)+13)/(-((53*x**2)/5)-((114*x)/5)-(31/5))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{9 x}{2}-1$ and $4 x^4+\\frac{x^3}{2}-\\frac{9 x^2}{2}+x+\\frac{5}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((9*x)/2)-1, 4*x**4+((x**3)/2)-((9*x**2)/2)+x+(5/2)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{100}{87}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$\\frac{100}{3}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (100/87) # initial value\nd = 0 # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (100/87) # initial value\nd = 0 # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{25 x^2}{3}-\\frac{50 x}{9}+\\frac{20}{9}$ and $-5 x^2-\\frac{10 x}{3}+\\frac{4}{3}$.", + "Output Answer": [ + "$\\frac{5 x^2}{3}+\\frac{10 x}{9}-\\frac{4}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((25*x**2)/3)-((50*x)/9)+(20/9), -5*x**2-((10*x)/3)+(4/3)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-14 x-1}+\\sqrt{8-2 x}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{36} \\left(-283+8 \\sqrt{790}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-14*x-1)+sqrt(8-2*x), 8), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-2 x^2+4 x+4 y^2-2 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(y-\\frac{1}{4}\\right)^2-2 (x-1)^2=-\\frac{3}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{4} & \\frac{1}{4} \\\\\n \\frac{7}{4} & \\frac{1}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{2}}$\nCenter: $\\left\\{1,\\frac{1}{4}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{2}}-\\frac{1}{\\sqrt{2}}+\\frac{1}{4},y=\\frac{1}{4} \\left(1+2 \\sqrt{2}\\right)-\\frac{x}{\\sqrt{2}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x**2+4*x+4*y**2-2*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-6 x^2-\\frac{180 x}{7}+\\frac{24786}{49}$", + "Output Answer": [ + "$-6 \\left(x-\\frac{51}{7}\\right) \\left(x+\\frac{81}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-6*x**2-((180*x)/7)+(24786/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{17 x}{2}+13}+\\sqrt{10 x-\\frac{3}{2}}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(1271-56 \\sqrt{514}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((17*x)/2)+13)+sqrt(10*x-(3/2)), 4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-40 x^2+304 x+504}{-140 x^2-416 x-308}=0$", + "Output Answer": [ + "$\\{\\{x\\to 9\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-40*x**2+304*x+504)/(-140*x**2-416*x-308)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-21 x+3 y-14=0$, $-9 x-20 y+13=0$", + "Output Answer": [ + "$x=-\\frac{241}{447}$, $y=\\frac{133}{149}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-21*x+3*y-14, -9*x-20*y+13), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-6 x-\\frac{9}{2}}+\\sqrt{-4 x-\\frac{5}{2}}=\\frac{7}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(-253+140 \\sqrt{3}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-6*x-(9/2))+sqrt(-4*x-(5/2)), (7/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^2+3 x-1$ when divided by $7 x-3$.", + "Output Answer": [ + "$-\\frac{8 x}{7}-\\frac{3}{49}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**2+3*x-1\nq = 7*x-3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\left(\\cos \\left(\\frac{109}{90}\\right)+i \\sin \\left(\\frac{109}{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$362797056 \\left(\\cos \\left(\\frac{1199}{90}\\right)+i \\sin \\left(\\frac{1199}{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*(math.cos((109/90))+1j*math.sin((109/90))))**11)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\left(\\cos \\left(\\frac{179}{90}\\right)+i \\sin \\left(\\frac{179}{90}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$216 \\left(\\cos \\left(\\frac{179}{30}\\right)+i \\sin \\left(\\frac{179}{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*(math.cos((179/90))+1j*math.sin((179/90))))**3)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-2 x^2+10 x-4$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(5-\\sqrt{17}\\right)\\lor x=\\frac{1}{2} \\left(5+\\sqrt{17}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-2*x**2+10*x-4, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{23 x}{3}-\\frac{7}{3}}+\\sqrt{\\frac{43}{3}-\\frac{4 x}{3}}=\\frac{31}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-28797+62 \\sqrt{146381}}{1083}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((23*x)/3)-(7/3))+sqrt((43/3)-((4*x)/3)), (31/3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sin ^{-1}\\left(\\log \\left(3 x-\\frac{13}{3}\\right)\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{9} \\left(13+3 e^{\\sin (y)}\\right)\\text{ if }-\\frac{\\pi }{2}\\leq y\\leq \\frac{\\pi }{2}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, asin(log(3*x-(13/3))))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{72 x^5}{25}-18 x^4+\\frac{144 x^3}{25}+\\frac{342 x^2}{25}-\\frac{288 x}{25}-\\frac{162}{25}$ and $\\frac{4 x^5}{5}-5 x^4+\\frac{8 x^3}{5}+\\frac{19 x^2}{5}-\\frac{16 x}{5}-\\frac{9}{5}$.", + "Output Answer": [ + "$\\frac{4 x^5}{25}-x^4+\\frac{8 x^3}{25}+\\frac{19 x^2}{25}-\\frac{16 x}{25}-\\frac{9}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((72*x**5)/25)-18*x**4+((144*x**3)/25)+((342*x**2)/25)-((288*x)/25)-(162/25), ((4*x**5)/5)-5*x**4+((8*x**3)/5)+((19*x**2)/5)-((16*x)/5)-(9/5)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 16 \\sqrt{2} x-2 \\sqrt{2}\\right| =-16 \\sqrt{2}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(16*sqrt(2)*x-2*sqrt(2)), -16*sqrt(2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 x^2+9 x+1$ and $q(x) = 11 x^2+8 x-14$", + "Output Answer": [ + "$44 x^4+131 x^3+27 x^2-118 x-14$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*x**2+9*x+1\nq = 11*x**2+8*x-14\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left((((9+9)-12)-22)^2-18\\right) ((((1-9)-25)+13)+22)^2$.", + "Output Answer": [ + "$952$" + ], + "Output Program": [ + "try: \n print(((((9+9)-12)-22)**2-18)*((((1-9)-25)+13)+22)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $10 x-2$ and $-2$.", + "Output Answer": [ + "$2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(10*x-2, -2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{119 x}{5}-\\frac{47 y}{5}-\\frac{14}{5}=0$, $-\\frac{3 x}{5}+\\frac{49 y}{5}+\\frac{54}{5}=0$", + "Output Answer": [ + "$x=\\frac{463}{1493}$, $y=-\\frac{1617}{1493}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((119*x)/5)-((47*y)/5)-(14/5), -((3*x)/5)+((49*y)/5)+(54/5)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\tan (5-6 x)+\\tan (5 x)$ at the point $x=3$", + "Output Answer": [ + "$-\\tan (13)+\\tan (15) = -1.319$" + ], + "Output Program": [ + "import math\n\nx = 3\ntry: \n f = math.tan(5-6*x)+math.tan(5*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{61}{5}-\\frac{36 x}{5}}+\\sqrt{\\frac{3 x}{5}+\\frac{69}{5}}=\\frac{38}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-16404+76 \\sqrt{40457}}{2535}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((61/5)-((36*x)/5))+sqrt(((3*x)/5)+(69/5)), (38/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{14}+\\sqrt{80}\\right)+\\left(\\sqrt{69}-\\sqrt{9}\\right)$.", + "Output Answer": [ + "$-3+4 \\sqrt{5}+\\sqrt{14}+\\sqrt{69}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(14)+sqrt(80))+(sqrt(69)-sqrt(9)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$16 x-8 y+12 z-4=0$, $24 x+22 y-4 z+12=0$, $11 x+14 y+6 z+6=0$", + "Output Answer": [ + "$x=-\\frac{56}{705}$, $y=-\\frac{304}{705}$, $z=\\frac{107}{705}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((16*x-8*y+12*z-4, 24*x+22*y-4*z+12, 11*x+14*y+6*z+6)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{23}{73}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$\\frac{122157}{73}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(23/73) # initial value\nd = 8 # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(23/73) # initial value\nd = 8 # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (4, 5, \\frac{1}{\\sqrt{3}})$", + "Output Answer": [ + "$\\left\\{2 \\sqrt{\\frac{31}{3}},\\tan ^{-1}\\left(\\sqrt{123}\\right),\\tan ^{-1}\\left(\\frac{5}{4}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 4\ny = 5\nz = (1/(math.sqrt(3)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((17-1)-22)-1)+\\left(\\frac{1}{5} ((9-16)+10)+3\\right)$.", + "Output Answer": [ + "$-\\frac{17}{5}$" + ], + "Output Program": [ + "try: \n print((((17-1)-22)-1)+((1/5)*((9-16)+10)+3))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{240 x^2-100 x-500}{420 x^2+765 x+300}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{5}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((240*x**2-100*x-500)/(420*x**2+765*x+300)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{37}{64}$, and $a_n=a_{n-1}+-\\frac{10}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$7 \\left(-\\frac{37}{32}-\\frac{130}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(37/64) # initial value\nd = -(10/(math.sqrt(3))) # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(37/64) # initial value\nd = -(10/(math.sqrt(3))) # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{19 e^{-\\frac{2 i \\pi }{5}}}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{19}{\\pi }$\nArgument: $\\pi +\\tan ^{-1}\\left(\\frac{\\Im\\left(e^{-\\frac{2 i \\pi }{5}}\\right)}{\\Re\\left(e^{-\\frac{2 i \\pi }{5}}\\right)}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((19*math.e**(-((2*i*math.pi)/5)))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $-\\sinh \\left(\\frac{11}{3}-\\frac{2 x}{3}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{2} \\sinh ^{-1}(y)+\\frac{11}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, -sinh((11/3)-((2*x)/3)))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-3 x^6-2 x^5-5 x^4+5 x^3-5 x-2$ when divided by $-x^5-2 x^4-3 x^3-8 x^2-3 x-10$.", + "Output Answer": [ + "$3 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x**6-2*x**5-5*x**4+5*x**3-5*x-2\nq = -x**5-2*x**4-3*x**3-8*x**2-3*x-10\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2-10 x+5 y^2-2 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $7 \\left(x-\\frac{5}{7}\\right)^2+5 \\left(y-\\frac{1}{5}\\right)^2=\\frac{167}{35}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{7} & \\frac{1}{35} \\left(7-\\sqrt{334}\\right) \\\\\n \\frac{5}{7} & \\frac{1}{35} \\left(7+\\sqrt{334}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{7}}$\nCenter: $\\left\\{\\frac{5}{7},\\frac{1}{2} \\left(\\frac{1}{35} \\left(7-\\sqrt{334}\\right)+\\frac{1}{35} \\left(7+\\sqrt{334}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{167 \\pi }{35 \\sqrt{35}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2-10*x+5*y**2-2*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 8 (3 x-2)^3, q(x) = 125$", + "Output Answer": [ + "$216 x^3-432 x^2+288 x+61$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*(3*x-2)**3\nq = 125\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-35 x^2+55 x+30}{140 x+60}=0$", + "Output Answer": [ + "$\\{\\{x\\to 2\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-35*x**2+55*x+30)/(140*x+60)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{19}{98}$, and $a_n=a_{n-1}+-2 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$15 \\left(-\\frac{19}{49}-58 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(19/98) # initial value\nd = -2*math.sqrt(5) # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(19/98) # initial value\nd = -2*math.sqrt(5) # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 3 x^2-13 x+4$, $q(x) = 2 (6 x+7)$", + "Output Answer": [ + "$3 x^2-x+18$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**2-13*x+4\nq = 2*(6*x+7)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-7 x^2+22 x-14}{20-23 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(11-\\sqrt{23}\\right)\\right\\},\\left\\{x\\to \\frac{1}{7} \\left(11+\\sqrt{23}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-7*x**2+22*x-14)/(20-23*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2-18 x+1755$", + "Output Answer": [ + "$-9 (-x-15) (13-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2-18*x+1755, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{((7-8)-24)^2}{(10-24)^2}$.", + "Output Answer": [ + "$\\frac{625}{196}$" + ], + "Output Program": [ + "try: \n print(((((7-8)-24)**2)/((10-24)**2)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -3 x^2-8 x-9$, $q(x) = 11 x^2+5 x+5$", + "Output Answer": [ + "$8 x^2-3 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x**2-8*x-9\nq = 11*x**2+5*x+5\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7\\right)^6$", + "Output Answer": [ + "$117649$" + ], + "Output Program": [ + "i = 1j\nprint((-7)**6)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=4+8 i$ and $y=\\frac{11}{3}+5 i$", + "Output Answer": [ + "$\\frac{246}{173}+\\frac{42 i}{173}$" + ], + "Output Program": [ + "i = 1j\nx = 4+8*i\ny = (11/3)+5*i\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-5 x^2-7 x-13$", + "Output Answer": [ + "$x=\\frac{1}{10} \\left(-7-i \\sqrt{211}\\right)\\lor x=\\frac{1}{10} \\left(-7+i \\sqrt{211}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-5*x**2-7*x-13, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$\\sqrt{2} \\sqrt{x}+1$", + "Output Answer": [ + "$\\frac{1}{2} (x-3)^2+2 (x-3)+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, sqrt(2)*sqrt(x)+1)\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^2-x-3$ and $-4 x^3-3 x-2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**2-x-3, -4*x**3-3*x-2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 7 x^2-15 x+6$ and $q(x) = 8 x^2-6 x-1$", + "Output Answer": [ + "$56 x^4-162 x^3+131 x^2-21 x-6$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 7*x**2-15*x+6\nq = 8*x**2-6*x-1\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+165 x+836$", + "Output Answer": [ + "$-11 (x-19) (x+4)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+165*x+836, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-7 \\sqrt{2} \\left(\\cos \\left(\\frac{37 \\pi }{180}\\right)+i \\sin \\left(\\frac{37 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $7 \\sqrt{2 \\left(\\sin ^2\\left(\\frac{37 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{37 \\pi }{180}\\right)\\right)}$\nArgument: $-\\frac{143 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -7*math.sqrt(2)*(math.cos(((37*math.pi)/180))+i*math.sin(((37*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{26 x^2}{\\sqrt{3}}+\\frac{5 x}{\\sqrt{3}}-2 \\sqrt{3}\\right| =\\frac{41}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{52} \\left(-5-17 \\sqrt{17}\\right)\\right\\},\\left\\{x\\to \\frac{1}{52} \\left(-5+17 \\sqrt{17}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((26*x**2)/(sqrt(3)))+((5*x)/(sqrt(3)))-2*sqrt(3)), (41/(sqrt(3)))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $8 x^2-40 \\sqrt{3} x-1200$", + "Output Answer": [ + "$-8 \\left(-x-5 \\sqrt{3}\\right) \\left(x-10 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(8*x**2-40*sqrt(3)*x-1200, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-2 x^2+10 x+7 y^2-10 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(y-\\frac{5}{7}\\right)^2-2 \\left(x-\\frac{5}{2}\\right)^2=-\\frac{237}{14}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{2}-\\frac{3 \\sqrt{237}}{14} & \\frac{5}{7} \\\\\n \\frac{5}{2}+\\frac{3 \\sqrt{237}}{14} & \\frac{5}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{7}}$\nCenter: $\\left\\{\\frac{5}{2},\\frac{5}{7}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{2}{7}} x-\\frac{5}{14} \\left(\\sqrt{14}-2\\right),y=\\frac{5}{14} \\left(2+\\sqrt{14}\\right)-\\sqrt{\\frac{2}{7}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x**2+10*x+7*y**2-10*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x^4+4 x^3+4 x^2-4 x-4$ and $2 x^4+2 x^3+2 x^2-2 x-2$.", + "Output Answer": [ + "$2 x^4+2 x^3+2 x^2-2 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x**4+4*x**3+4*x**2-4*x-4, 2*x**4+2*x**3+2*x**2-2*x-2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=12 t+3 \\sqrt{2}+44, x(t)=-3 \\sqrt{2} t-11 \\sqrt{2}$", + "Output Answer": [ + "$y=3 \\sqrt{2}-2 \\sqrt{2} x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 12*t+3*sqrt(2)+44\nx_t = -3*sqrt(2)*t-11*sqrt(2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $(-7+4 i) \\sqrt{2}$.", + "Output Answer": [ + "Norm: $\\sqrt{130}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{4}{7}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (-7+4*i)*math.sqrt(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $7 \\sqrt{2} x^2-6 \\sqrt{2} x-10 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{7} \\left(3-\\sqrt{79}\\right)\\lor x=\\frac{1}{7} \\left(3+\\sqrt{79}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(7*sqrt(2)*x**2-6*sqrt(2)*x-10*sqrt(2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $10 x^2-14 x-6$", + "Output Answer": [ + "$10 \\left(x-\\frac{7}{10}\\right)^2-\\frac{109}{10}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (10*x**2-14*x-6), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{x^2}{5}+\\frac{66 x}{5}+\\frac{52}{5}$", + "Output Answer": [ + "$x=-33-\\sqrt{1037}\\lor x=\\sqrt{1037}-33$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((x**2)/5)+((66*x)/5)+(52/5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$8 \\sqrt{3} x+2 \\sqrt{3} y-\\sqrt{3}=0$, $-8 \\sqrt{3} x-13 \\sqrt{3} y+7 \\sqrt{3}=0$", + "Output Answer": [ + "$x=-\\frac{1}{88}$, $y=\\frac{6}{11}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((8*sqrt(3)*x+2*sqrt(3)*y-sqrt(3), -8*sqrt(3)*x-13*sqrt(3)*y+7*sqrt(3)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2+9 x+6 y^2-10 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y-\\frac{5}{6}\\right)^2-10 \\left(x-\\frac{9}{20}\\right)^2=\\frac{737}{120}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{9}{20} & \\frac{1}{30} \\left(25-\\sqrt{1474}\\right) \\\\\n \\frac{9}{20} & \\frac{1}{30} \\left(25+\\sqrt{1474}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{5}}$\nCenter: $\\left\\{\\frac{9}{20},\\frac{1}{2} \\left(\\frac{1}{30} \\left(25-\\sqrt{1474}\\right)+\\frac{1}{30} \\left(25+\\sqrt{1474}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{60} \\left(50+9 \\sqrt{15}\\right)-\\sqrt{\\frac{5}{3}} x,y=\\sqrt{\\frac{5}{3}} x+\\frac{1}{60} \\left(50-9 \\sqrt{15}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2+9*x+6*y**2-10*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 11 x^2-5 x+2\\right| =19$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{22} \\left(5-\\sqrt{773}\\right)\\right\\},\\left\\{x\\to \\frac{1}{22} \\left(5+\\sqrt{773}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11*x**2-5*x+2), 19), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{64}{67}$, and $a_n=a_{n-1}+\\frac{19}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=17$.", + "Output Answer": [ + "$\\frac{176392}{201}$" + ], + "Output Program": [ + "a = (64/67) # initial value\nd = (19/3) # second term\nn = 17 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (64/67) # initial value\nd = (19/3) # second term\nn = 17 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2+6 x+5 y^2+7 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(y+\\frac{7}{10}\\right)^2-4 \\left(x-\\frac{3}{4}\\right)^2=\\frac{31}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{4} & \\frac{1}{10} \\left(-7-3 \\sqrt{31}\\right) \\\\\n \\frac{3}{4} & \\frac{1}{10} \\left(3 \\sqrt{31}-7\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2}$\nCenter: $\\left\\{\\frac{3}{4},\\frac{1}{2} \\left(\\frac{1}{10} \\left(-7-3 \\sqrt{31}\\right)+\\frac{1}{10} \\left(3 \\sqrt{31}-7\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{10} \\left(3 \\sqrt{5}-7\\right)-\\frac{2 x}{\\sqrt{5}},y=\\frac{2 x}{\\sqrt{5}}+\\frac{1}{10} \\left(-7-3 \\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2+6*x+5*y**2+7*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{24 x^2-25 x-231}{-21 x^2+83 x-22}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{21}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((24*x**2-25*x-231)/(-21*x**2+83*x-22)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{80}{7}-\\frac{20 x}{7}}+\\sqrt{\\frac{76 x}{7}+\\frac{83}{7}}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1189-5 \\sqrt{208705}}{1152}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((80/7)-((20*x)/7))+sqrt(((76*x)/7)+(83/7)), 5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{37 x^2}{3}+\\frac{4 x}{3}+\\frac{38}{3}$ and $q(x) = -\\frac{5 x^2}{3}+\\frac{29 x}{3}+3$", + "Output Answer": [ + "$-\\frac{185 x^4}{9}+117 x^3+\\frac{259 x^2}{9}+\\frac{1138 x}{9}+38$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((37*x**2)/3)+((4*x)/3)+(38/3)\nq = -((5*x**2)/3)+((29*x)/3)+3\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+77 x+2508$", + "Output Answer": [ + "$11 (19-x) (x+12)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+77*x+2508, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -4 x-5$, $q(x) = \\frac{1}{5} \\left(-74 x^2-31 x+57\\right)$", + "Output Answer": [ + "$-\\frac{74 x^2}{5}-\\frac{51 x}{5}+\\frac{32}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x-5\nq = (1/5)*(-74*x**2-31*x+57)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{6 x-6}-\\tan ^{-1}(8 x+6)$ at the point $x=5$", + "Output Answer": [ + "$2 \\sqrt[3]{3}-\\tan ^{-1}(46) = 1.335$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 5\ntry: \n f = np.cbrt(6*x-6)-math.atan(8*x+6)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $8 x^2-272 x+2262$", + "Output Answer": [ + "$-8 \\left(\\frac{39}{2}-x\\right) \\left(x-\\frac{29}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(8*x**2-272*x+2262, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -6. x^2+9.4 x-9.1$, $q(x) = 14.7 x^2-2.1 x-5.7$", + "Output Answer": [ + "$8.7 x^2+7.3 x-14.8$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6.*x**2+9.4*x-9.1\nq = 14.7*x**2-2.1*x-5.7\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{17 x^2}{4}+\\frac{9 x}{2}-1$, $q(x) = 2 x^2-x-\\frac{5}{2}$", + "Output Answer": [ + "$-\\frac{9 x^2}{4}+\\frac{7 x}{2}-\\frac{7}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((17*x**2)/4)+((9*x)/2)-1\nq = 2*x**2-x-(5/2)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (2-5 x)^2, q(x) = (x-5)^2$", + "Output Answer": [ + "$26 x^2-30 x+29$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (2-5*x)**2\nq = (x-5)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$9 \\sqrt{2} x+12 \\sqrt{2} y+17 \\sqrt{2}=0$, $-10 \\sqrt{2} x-7 \\sqrt{2} y-16 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{73}{57}$, $y=-\\frac{26}{57}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((9*sqrt(2)*x+12*sqrt(2)*y+17*sqrt(2), -10*sqrt(2)*x-7*sqrt(2)*y-16*sqrt(2)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{28 x^6}{3}-5 x^5+\\frac{13 x^4}{3}-\\frac{23 x^3}{3}+\\frac{25 x^2}{3}+\\frac{19 x}{3}+6$ when divided by $\\frac{25 x^5}{3}+\\frac{16 x^4}{3}-9 x^3+\\frac{23 x^2}{3}-\\frac{25 x}{3}-\\frac{4}{3}$.", + "Output Answer": [ + "$\\frac{73}{625}-\\frac{28 x}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((28*x**6)/3)-5*x**5+((13*x**4)/3)-((23*x**3)/3)+((25*x**2)/3)+((19*x)/3)+6\nq = ((25*x**5)/3)+((16*x**4)/3)-9*x**3+((23*x**2)/3)-((25*x)/3)-(4/3)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^5+7 x^4+9 x^2-4 x-5$ when divided by $-4 x^5-2 x^4-6 x^3+10 x^2+x+10$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**5+7*x**4+9*x**2-4*x-5\nq = -4*x**5-2*x**4-6*x**3+10*x**2+x+10\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{26}{3}+\\frac{26 i}{3}$ and $y=-\\frac{25}{3}+\\frac{28 i}{3}$", + "Output Answer": [ + "$\\frac{1378}{1409}+\\frac{78 i}{1409}$" + ], + "Output Program": [ + "i = 1j\nx = -(26/3)+((26*i)/3)\ny = -(25/3)+((28*i)/3)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 8 x+4, q(x) = 4 (3-4 x)^2$", + "Output Answer": [ + "$64 x^2-88 x+40$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x+4\nq = 4*(3-4*x)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{45 x^2}{2}-\\frac{23 x}{2}+15}{-\\frac{31 x^2}{2}-7 x+\\frac{17}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{10}{9}\\right\\},\\left\\{x\\to \\frac{3}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((45*x**2)/2)-((23*x)/2)+15)/(-((31*x**2)/2)-7*x+(17/2))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$6 \\sqrt{3} x+\\frac{31 y}{\\sqrt{3}}+\\frac{16 z}{\\sqrt{3}}+\\frac{34}{\\sqrt{3}}=0$, $-\\frac{x}{\\sqrt{3}}-\\frac{29 y}{\\sqrt{3}}-\\frac{43 z}{\\sqrt{3}}-\\frac{17}{\\sqrt{3}}=0$, $-\\frac{17 x}{\\sqrt{3}}-10 \\sqrt{3} y-\\frac{34 z}{\\sqrt{3}}-\\frac{32}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{7714}{8727}$, $y=-\\frac{5222}{8727}$, $z=\\frac{251}{8727}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((6*sqrt(3)*x+((31*y)/(sqrt(3)))+((16*z)/(sqrt(3)))+(34/(sqrt(3))), -(x/(sqrt(3)))-((29*y)/(sqrt(3)))-((43*z)/(sqrt(3)))-(17/(sqrt(3))), -((17*x)/(sqrt(3)))-10*sqrt(3)*y-((34*z)/(sqrt(3)))-(32/(sqrt(3))))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$9 \\sqrt{3} x+3 \\sqrt{3} y-9 \\sqrt{3} z-9 \\sqrt{3}=0$, $-2 \\sqrt{3} x+\\sqrt{3} y+13 \\sqrt{3} z+6 \\sqrt{3}=0$, $-14 \\sqrt{3} x+6 \\sqrt{3} y-4 \\sqrt{3} z-9 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{9}{221}$, $y=\\frac{543}{442}$, $z=-\\frac{243}{442}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((9*sqrt(3)*x+3*sqrt(3)*y-9*sqrt(3)*z-9*sqrt(3), -2*sqrt(3)*x+sqrt(3)*y+13*sqrt(3)*z+6*sqrt(3), -14*sqrt(3)*x+6*sqrt(3)*y-4*sqrt(3)*z-9*sqrt(3))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-7 \\sqrt{3} x+\\frac{13 y}{\\sqrt{3}}+\\frac{41}{\\sqrt{3}}=0$, $\\frac{38 x}{\\sqrt{3}}-14 \\sqrt{3} y+\\frac{17}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{1943}{388}$, $y=\\frac{1915}{388}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-7*sqrt(3)*x+((13*y)/(sqrt(3)))+(41/(sqrt(3))), ((38*x)/(sqrt(3)))-14*sqrt(3)*y+(17/(sqrt(3)))), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\cosh \\left(\\tan ^{-1}(6-8 x)\\right)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = cosh(atan(6-8*x))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2-6 x-6 y^2+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x-\\frac{3}{7}\\right)^2-6 y^2=-\\frac{33}{7}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{7} & -\\frac{\\sqrt{\\frac{143}{2}}}{7} \\\\\n \\frac{3}{7} & \\frac{\\sqrt{\\frac{143}{2}}}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{13}{7}}$\nCenter: $\\left\\{\\frac{3}{7},0\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{3}{14}}-\\sqrt{\\frac{7}{6}} x,y=\\sqrt{\\frac{7}{6}} x-\\sqrt{\\frac{3}{14}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2-6*x-6*y**2+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{7 x-14}+\\sqrt{15 x-11}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(536-7 \\sqrt{4879}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(7*x-14)+sqrt(15*x-11), 14), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{38 x^5}{5}-9 x^4-\\frac{4 x^3}{5}-\\frac{24 x^2}{5}+\\frac{29 x}{5}-6$ when divided by $9-8 x$.", + "Output Answer": [ + "$\\frac{19 x^4}{20}+\\frac{351 x^3}{160}+\\frac{3287 x^2}{1280}+\\frac{35727 x}{10240}+\\frac{262151}{81920}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((38*x**5)/5)-9*x**4-((4*x**3)/5)-((24*x**2)/5)+((29*x)/5)-6\nq = 9-8*x\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{15 x^2}{2}+5 x-\\frac{25}{2}$", + "Output Answer": [ + "$-\\frac{15}{2} \\left(x-\\frac{1}{3}\\right)^2-\\frac{35}{3}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((15*x**2)/2)+5*x-(25/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{16}{7}-\\frac{57 i}{7}$ and $y=\\frac{6}{7}-\\frac{68 i}{7}$", + "Output Answer": [ + "$\\frac{189}{233}-\\frac{143 i}{466}$" + ], + "Output Program": [ + "i = 1j\nx = -(16/7)-((57*i)/7)\ny = (6/7)-((68*i)/7)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| -14 x-9| =7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{8}{7}\\right\\},\\left\\{x\\to -\\frac{1}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-14*x-9), 7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(12+12)-(12-5)$.", + "Output Answer": [ + "$17$" + ], + "Output Program": [ + "try: \n print((12+12)-(12-5))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -9 x^2-4 x-10$ and $q(x) = 6 x^2-3 x-4$", + "Output Answer": [ + "$-54 x^4+3 x^3-12 x^2+46 x+40$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -9*x**2-4*x-10\nq = 6*x**2-3*x-4\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{19}{49}$, and $a_n=a_{n-1}+\\frac{13}{4}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{35871}{196}$" + ], + "Output Program": [ + "a = (19/49) # initial value\nd = (13/4) # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (19/49) # initial value\nd = (13/4) # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{11}{4} \\left(\\cos \\left(\\frac{173}{90}\\right)+i \\sin \\left(\\frac{173}{90}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$\\frac{19487171 \\left(\\cos \\left(\\frac{1211}{90}\\right)+i \\sin \\left(\\frac{1211}{90}\\right)\\right)}{16384}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((11/4)*(math.cos((173/90))+1j*math.sin((173/90))))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $1$ and $-5 x^4+3 x^3+3 x^2+3 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(1, -5*x**4+3*x**3+3*x**2+3*x-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $8 x^2+6 x-9$", + "Output Answer": [ + "$8 \\left(x+\\frac{3}{8}\\right)^2-\\frac{81}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (8*x**2+6*x-9), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{14 x^2+3 x+15}{-16 x^2-6 x+19}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((14*x**2+3*x+15)/(-16*x**2-6*x+19)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((2-21)-18)+\\left(\\left(\\frac{2+25}{9}-15\\right)-24\\right)$.", + "Output Answer": [ + "$-73$" + ], + "Output Program": [ + "try: \n print(((2-21)-18)+((((2+25)/9)-15)-24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-x^2-4 x$", + "Output Answer": [ + "$4-(x+2)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-x**2-4*x), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x$ and $-3$.", + "Output Answer": [ + "$3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x, -3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\cos \\left(\\frac{26}{45}\\right)+i \\sin \\left(\\frac{26}{45}\\right)\\right)^2$", + "Output Answer": [ + "$\\cos \\left(\\frac{52}{45}\\right)+i \\sin \\left(\\frac{52}{45}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.cos((26/45))+1j*math.sin((26/45)))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -12 x^2+13 x+13\\right| =-6$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-12*x**2+13*x+13), -6), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((6-21)-10)-(1-8)^2$.", + "Output Answer": [ + "$-74$" + ], + "Output Program": [ + "try: \n print(((6-21)-10)-(1-8)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-460 x^3-963 x^2-297 x+216}{483 x+504}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{40} \\left(-21-3 \\sqrt{129}\\right)\\right\\},\\left\\{x\\to \\frac{1}{40} \\left(-21+3 \\sqrt{129}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-460*x**3-963*x**2-297*x+216)/(483*x+504)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{8 x^2}{\\sqrt{3}}-2 \\sqrt{3}$", + "Output Answer": [ + "$\\frac{8 x^2}{\\sqrt{3}}-2 \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((8*x**2)/(math.sqrt(3)))-2*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^4-11 x^3+25 x^2-37 x+20$ and $x^3-2 x^2+5 x-4$.", + "Output Answer": [ + "$x^3-2 x^2+5 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**4-11*x**3+25*x**2-37*x+20, x**3-2*x**2+5*x-4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{20-4}{21}}{13}-\\left(\\left(\\left(\\frac{5}{14}+19\\right)^2-20\\right)+25\\right)$.", + "Output Answer": [ + "$-\\frac{2901971}{7644}$" + ], + "Output Program": [ + "try: \n print((((20-4)/21)/13)-((((5/14)+19)**2-20)+25))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -12 x^2+14 x+4$ and $q(x) = -5 x^2+3 x-10$", + "Output Answer": [ + "$60 x^4-106 x^3+142 x^2-128 x-40$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -12*x**2+14*x+4\nq = -5*x**2+3*x-10\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^4-7 x^3-6 x$ when divided by $8 x^2+9 x-6$.", + "Output Answer": [ + "$\\frac{5 x^2}{8}-\\frac{101 x}{64}+\\frac{1149}{512}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**4-7*x**3-6*x\nq = 8*x**2+9*x-6\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-14 x^2-11 x+14$", + "Output Answer": [ + "$\\frac{905}{56}-14 \\left(x+\\frac{11}{28}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-14*x**2-11*x+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 8 x-9| =10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{8}\\right\\},\\left\\{x\\to \\frac{19}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(8*x-9), 10), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2+14 x-13$ and $q(x) = -x^2-9 x-8$", + "Output Answer": [ + "$14 x^4+112 x^3-x^2+5 x+104$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2+14*x-13\nq = -x**2-9*x-8\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{45}{16}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$-\\frac{4053}{8}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (45/16) # initial value\nd = -6 # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (45/16) # initial value\nd = -6 # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 13 x^2+14 x+13$, $q(x) = -7 x^2+14 x-11$", + "Output Answer": [ + "$6 x^2+28 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 13*x**2+14*x+13\nq = -7*x**2+14*x-11\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-8 x^2+19 x-5}{-20 x-21}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(19-\\sqrt{201}\\right)\\right\\},\\left\\{x\\to \\frac{1}{16} \\left(19+\\sqrt{201}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-8*x**2+19*x-5)/(-20*x-21)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-3 \\sqrt{2} x-11 \\sqrt{2} y-8 \\sqrt{2}=0$, $\\frac{19 x}{\\sqrt{2}}+3 \\sqrt{2} y-17 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{422}{191}$, $y=-\\frac{254}{191}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-3*sqrt(2)*x-11*sqrt(2)*y-8*sqrt(2), ((19*x)/(sqrt(2)))+3*sqrt(2)*y-17*sqrt(2)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2} \\sqrt{x}+\\sqrt{3 x+8}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\left(-4 \\sqrt{2}+2 \\sqrt{10}\\right)^2\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2)*sqrt(x)+sqrt(3*x+8), 4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $3 x^2+\\frac{291 x}{4}+\\frac{675}{2}$", + "Output Answer": [ + "$-3 \\left(-x-\\frac{25}{4}\\right) (x+18)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(3*x**2+((291*x)/4)+(675/2), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{1}{3}$, and $a_n=a_{n-1}+-5$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$-\\frac{3443}{3}$" + ], + "Output Program": [ + "a = (1/3) # initial value\nd = -5 # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (1/3) # initial value\nd = -5 # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{182 x^2}{3}+\\frac{1292 x}{3}+480}{\\frac{130 x^2}{3}-148 x-288}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{40}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((182*x**2)/3)+((1292*x)/3)+480)/(((130*x**2)/3)-148*x-288)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $8 \\sqrt{2} x^2-5 \\sqrt{2} x-\\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{16} \\left(5-\\sqrt{57}\\right)\\lor x=\\frac{1}{16} \\left(5+\\sqrt{57}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(8*sqrt(2)*x**2-5*sqrt(2)*x-sqrt(2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $x^2+6 x+2 y^2-6 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $(x+3)^2+2 \\left(y-\\frac{3}{2}\\right)^2=\\frac{37}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n -3-\\frac{\\sqrt{37}}{2} & \\frac{3}{2} \\\\\n \\frac{1}{2} \\left(\\sqrt{37}-6\\right) & \\frac{3}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-3-\\frac{\\sqrt{37}}{2}+\\frac{1}{2} \\left(\\sqrt{37}-6\\right)\\right),\\frac{3}{2}\\right\\}$\nArea Enclosed: $\\frac{37 \\pi }{2 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2+6*x+2*y**2-6*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{1}{25} \\left((15-15)^2+4\\right)+25\\right)-\\left((14-7)^2-14\\right)$.", + "Output Answer": [ + "$-\\frac{246}{25}$" + ], + "Output Program": [ + "try: \n print(((1/25)*((15-15)**2+4)+25)-((14-7)**2-14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{29}{24}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$-\\frac{87}{4}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(29/24) # initial value\nd = 0 # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(29/24) # initial value\nd = 0 # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left((10-11)^2+14\\right)-19\\right) (((14-12)+16)+5)$.", + "Output Answer": [ + "$-92$" + ], + "Output Program": [ + "try: \n print((((10-11)**2+14)-19)*(((14-12)+16)+5))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -2 \\left(7 x^2+x+2\\right)$, $q(x) = 11 x^2-x+4$", + "Output Answer": [ + "$-3 x^2-3 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*(7*x**2+x+2)\nq = 11*x**2-x+4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{24 x^2-14 x-17}{-8 x^2+23 x-18}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{24} \\left(7-\\sqrt{457}\\right)\\right\\},\\left\\{x\\to \\frac{1}{24} \\left(7+\\sqrt{457}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((24*x**2-14*x-17)/(-8*x**2+23*x-18)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2+64 x+384$", + "Output Answer": [ + "$8 (-x-4) (x-12)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2+64*x+384, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{9}{4}+i$ and $y=-\\frac{19}{2}-\\frac{15 i}{4}$", + "Output Answer": [ + "$-\\frac{402}{1669}-\\frac{17 i}{1669}$" + ], + "Output Program": [ + "i = 1j\nx = (9/4)+i\ny = -(19/2)-((15*i)/4)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{6}{5}$, and $a_n=a_{n-1}+-\\frac{9}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$-\\frac{2013}{35}$" + ], + "Output Program": [ + "a = (6/5) # initial value\nd = -(9/7) # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (6/5) # initial value\nd = -(9/7) # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\log \\left(e^{-7 x-4}\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{7} (2 i \\pi c_1-4)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(log(math.e**(-7*x-4)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{1}{13}$, and $a_n=a_{n-1}+3$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$\\frac{812}{13}$" + ], + "Output Program": [ + "a = -(1/13) # initial value\nd = 3 # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(1/13) # initial value\nd = 3 # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^4-5 x^3-2 x^2+4 x+9$ when divided by $x^2-5 x-3$.", + "Output Answer": [ + "$8 x^2+35 x+197$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**4-5*x**3-2*x**2+4*x+9\nq = x**2-5*x-3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{38 x}{\\sqrt{3}}-\\frac{35 y}{\\sqrt{3}}+8 \\sqrt{3}=0$, $2 \\sqrt{3} x-\\frac{10 y}{\\sqrt{3}}-\\frac{22}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{101}{59}$, $y=-\\frac{346}{295}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((38*x)/(sqrt(3)))-((35*y)/(sqrt(3)))+8*sqrt(3), 2*sqrt(3)*x-((10*y)/(sqrt(3)))-(22/(sqrt(3)))), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{66 x}{7}-5}+\\sqrt{\\frac{66 x}{7}+9}=\\frac{51}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{6216205}{4806648}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((66*x)/7)-5)+sqrt(((66*x)/7)+9), (51/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\sqrt{2} \\left(\\cos \\left(\\frac{179}{90}\\right)+i \\sin \\left(\\frac{179}{90}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$18 \\left(\\cos \\left(\\frac{179}{45}\\right)+i \\sin \\left(\\frac{179}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*math.sqrt(2)*(math.cos((179/90))+1j*math.sin((179/90))))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{49} (135 t+304)^2, x(t)=-\\frac{45 t}{7}-15$", + "Output Answer": [ + "$y=9 x^2+\\frac{66 x}{7}+\\frac{121}{49}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/49)*(135*t+304)**2\nx_t = -((45*t)/7)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$8 \\sqrt{2} x-\\sqrt{2} y-\\frac{15 z}{\\sqrt{2}}-9 \\sqrt{2}=0$, $-13 \\sqrt{2} x+16 \\sqrt{2} y+\\frac{19 z}{\\sqrt{2}}-\\frac{15}{\\sqrt{2}}=0$, $\\frac{31 x}{\\sqrt{2}}-16 \\sqrt{2} y-\\frac{35 z}{\\sqrt{2}}-13 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{4213}{2575}$, $y=\\frac{4967}{5150}$, $z=-\\frac{1583}{515}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((8*sqrt(2)*x-sqrt(2)*y-((15*z)/(sqrt(2)))-9*sqrt(2), -13*sqrt(2)*x+16*sqrt(2)*y+((19*z)/(sqrt(2)))-(15/(sqrt(2))), ((31*x)/(sqrt(2)))-16*sqrt(2)*y-((35*z)/(sqrt(2)))-13*sqrt(2))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left(\\frac{16}{15}+10\\right)+17\\right)+12\\right) (14-23)$.", + "Output Answer": [ + "$-\\frac{1803}{5}$" + ], + "Output Program": [ + "try: \n print(((((16/15)+10)+17)+12)*(14-23))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{42}{71}$, and $a_n=a_{n-1}+-\\frac{5}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$\\frac{23}{2} \\left(-\\frac{84}{71}-\\frac{110}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(42/71) # initial value\nd = -(5/(math.sqrt(3))) # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(42/71) # initial value\nd = -(5/(math.sqrt(3))) # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{11 x^2}{3}+21 x-\\frac{35}{3}}{-\\frac{68 x}{3}-\\frac{31}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{22} \\left(63-\\sqrt{2429}\\right)\\right\\},\\left\\{x\\to \\frac{1}{22} \\left(63+\\sqrt{2429}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((11*x**2)/3)+21*x-(35/3))/(-((68*x)/3)-(31/3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{23 x^2}{3}+x+\\frac{8}{3}$", + "Output Answer": [ + "$x=\\frac{1}{46} \\left(-3-i \\sqrt{727}\\right)\\lor x=\\frac{1}{46} \\left(-3+i \\sqrt{727}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((23*x**2)/3)+x+(8/3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{11 x^2+10 x+20}{\\sqrt{3}}$, $q(x) = \\frac{-3 x^2-5 x+16}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\sqrt{3} x^2-\\frac{11 x^2}{\\sqrt{3}}-5 \\sqrt{3} x-\\frac{4}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((11*x**2+10*x+20)/(sqrt(3)))\nq = ((-3*x**2-5*x+16)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $(-3 x-2)^3-\\sqrt{4-6 x^3}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\text{Root}\\left[243 \\text{$\\#$1}^6+972 \\text{$\\#$1}^5+1620 \\text{$\\#$1}^4+1442 \\text{$\\#$1}^3+720 \\text{$\\#$1}^2+192 \\text{$\\#$1}+20\\&,1\\right]\\right\\},\\left\\{x\\to \\text{Root}\\left[243 \\text{$\\#$1}^6+972 \\text{$\\#$1}^5+1620 \\text{$\\#$1}^4+1442 \\text{$\\#$1}^3+720 \\text{$\\#$1}^2+192 \\text{$\\#$1}+20\\&,5\\right]\\right\\},\\left\\{x\\to \\text{Root}\\left[243 \\text{$\\#$1}^6+972 \\text{$\\#$1}^5+1620 \\text{$\\#$1}^4+1442 \\text{$\\#$1}^3+720 \\text{$\\#$1}^2+192 \\text{$\\#$1}+20\\&,6\\right]\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve((-3*x-2)**3-sqrt(4-6*x**3), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{5 \\left(\\cos \\left(\\frac{8}{9}\\right)+i \\sin \\left(\\frac{8}{9}\\right)\\right)}{\\sqrt{2}}\\right)^6$", + "Output Answer": [ + "$\\frac{15625}{8} \\left(\\cos \\left(\\frac{16}{3}\\right)+i \\sin \\left(\\frac{16}{3}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((5*(math.cos((8/9))+1j*math.sin((8/9))))/(math.sqrt(2))))**6)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\frac{e^{3 x-2}}{\\sqrt{-8 x-3}}$ at the point $x=-2$", + "Output Answer": [ + "$\\frac{1}{\\sqrt{13} e^8} = 0.$" + ], + "Output Program": [ + "import math\n\nx = -2\ntry: \n f = ((math.e**(3*x-2))/(math.sqrt(-8*x-3)))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{7 x^2+23 x-16}{15 x^2+9 x+5}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{14} \\left(-23-\\sqrt{977}\\right)\\right\\},\\left\\{x\\to \\frac{1}{14} \\left(-23+\\sqrt{977}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((7*x**2+23*x-16)/(15*x**2+9*x+5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{1}{41}$, and $a_n=a_{n-1}+\\frac{16}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$7 \\left(\\frac{2}{41}+\\frac{208}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\na = (1/41) # initial value\nd = (16/(math.sqrt(3))) # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (1/41) # initial value\nd = (16/(math.sqrt(3))) # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-19 x+6 y+2 z-16=0$, $-13 x+y-23 z-19=0$, $-3 x+18 y+21 z-5=0$", + "Output Answer": [ + "$x=-\\frac{182}{267}$, $y=\\frac{862}{1335}$, $z=-\\frac{551}{1335}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-19*x+6*y+2*z-16, -13*x+y-23*z-19, -3*x+18*y+21*z-5)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\cosh ^{-1}(-2 x-2)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(acosh(-2*x-2), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{32}{81}$, and $a_n=a_{n-1}+-\\frac{5}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$\\frac{23}{2} \\left(-\\frac{64}{81}-\\frac{110}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(32/81) # initial value\nd = -(5/(math.sqrt(3))) # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(32/81) # initial value\nd = -(5/(math.sqrt(3))) # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{23 x^2-14 x-9}{14 x-14 x^2}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{9}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((23*x**2-14*x-9)/(14*x-14*x**2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $15 x^2+5$", + "Output Answer": [ + "$x=\\frac{i}{\\sqrt{3}}\\lor x=-\\frac{i}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(15*x**2+5, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 18 x+1| =3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{2}{9}\\right\\},\\left\\{x\\to \\frac{1}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(18*x+1), 3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{47}{\\pi }$, $q(x) = \\frac{5 x^2-41}{\\pi }$", + "Output Answer": [ + "$\\frac{5 x^2}{\\pi }-\\frac{88}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(47/pi)\nq = ((5*x**2-41)/pi)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^3+9 x^2+5 x-8$ when divided by $1$.", + "Output Answer": [ + "$-5 x^3+9 x^2+5 x-8$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**3+9*x**2+5*x-8\nq = 1\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{55 x^2}{4}-\\frac{17 x}{2}+14$", + "Output Answer": [ + "$\\frac{3369}{220}-\\frac{55}{4} \\left(x+\\frac{17}{55}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((55*x**2)/4)-((17*x)/2)+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-2-\\frac{18 i}{5}$ and $y=\\frac{33}{5}+\\frac{24 i}{5}$", + "Output Answer": [ + "$-\\frac{43}{5}-\\frac{42 i}{5}$" + ], + "Output Program": [ + "i = 1j\nx = -2-((18*i)/5)\ny = (33/5)+((24*i)/5)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| x^2+4 x+24\\right| =-17$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(x**2+4*x+24), -17), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{5}{7}+\\frac{64 i}{7}$ and $y=-\\frac{22}{7}-\\frac{50 i}{7}$", + "Output Answer": [ + "$\\frac{17}{7}+\\frac{114 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = -(5/7)+((64*i)/7)\ny = -(22/7)-((50*i)/7)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{19}{8}$, and $a_n=a_{n-1}+1$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$\\frac{275}{4}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (19/8) # initial value\nd = 1 # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (19/8) # initial value\nd = 1 # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-11 x-5}+\\sqrt{-10 x-1}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{10196}{-1030-7 \\sqrt{21599}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-11*x-5)+sqrt(-10*x-1), 14), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{26}{59}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$-\\frac{88964}{59}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (26/59) # initial value\nd = -6 # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (26/59) # initial value\nd = -6 # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{5}}, 9, 6)$", + "Output Answer": [ + "$\\left\\{\\sqrt{\\frac{586}{5}},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{203}{10}}}{3}\\right),\\tan ^{-1}\\left(9 \\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(5)))\ny = 9\nz = 6\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{23}{5} \\left(\\sin \\left(\\frac{\\pi }{45}\\right)-i \\cos \\left(\\frac{\\pi }{45}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$\\frac{279841}{625} \\left(\\cos \\left(\\frac{4 \\pi }{45}\\right)+i \\sin \\left(\\frac{4 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(23/5)*(math.sin((math.pi/45))-1j*math.cos((math.pi/45))))**4)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3-8 x}+\\sqrt{-6 x-2}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -281+9 \\sqrt{955}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3-8*x)+sqrt(-6*x-2), 9), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2-128 x-224$", + "Output Answer": [ + "$-8 (-x-14) (-x-2)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2-128*x-224, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-9+4 i$ and $y=6+6 i$", + "Output Answer": [ + "$-\\frac{5}{12}+\\frac{13 i}{12}$" + ], + "Output Program": [ + "i = 1j\nx = -9+4*i\ny = 6+6*i\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((((23+5)-8)-19)+1)-(7-11)^2$.", + "Output Answer": [ + "$-14$" + ], + "Output Program": [ + "try: \n print(((((23+5)-8)-19)+1)-(7-11)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{38}{63}$, and $a_n=a_{n-1}+12$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$\\frac{9904}{9}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (38/63) # initial value\nd = 12 # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (38/63) # initial value\nd = 12 # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{22 x^2}{5}-\\frac{39 x}{5}-3$", + "Output Answer": [ + "$\\frac{22}{5} \\left(x-\\frac{39}{44}\\right)^2-\\frac{2841}{440}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((22*x**2)/5)-((39*x)/5)-3), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{253 x^2+\\frac{1207 x}{3}+\\frac{248}{3}}{-\\frac{782 x^2}{3}-681 x-\\frac{1333}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{8}{33}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((253*x**2+((1207*x)/3)+(248/3))/(-((782*x**2)/3)-681*x-(1333/3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{6 x^2}{\\sqrt{\\pi }}-\\frac{4 x}{\\sqrt{\\pi }}+\\frac{13}{\\sqrt{\\pi }}$ and $q(x) = -\\frac{6 x^2}{\\sqrt{\\pi }}-\\frac{12 x}{\\sqrt{\\pi }}+\\frac{9}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{36 x^4}{\\pi }-\\frac{48 x^3}{\\pi }+\\frac{24 x^2}{\\pi }-\\frac{192 x}{\\pi }+\\frac{117}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((6*x**2)/(sqrt(pi)))-((4*x)/(sqrt(pi)))+(13/(sqrt(pi)))\nq = -((6*x**2)/(sqrt(pi)))-((12*x)/(sqrt(pi)))+(9/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{1}{2} \\left(\\cos \\left(\\frac{49}{90}\\right)+i \\sin \\left(\\frac{49}{90}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$\\frac{1}{512} \\left(\\cos \\left(\\frac{49}{10}\\right)+i \\sin \\left(\\frac{49}{10}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((1/2)*(math.cos((49/90))+1j*math.sin((49/90))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{3}{4} \\left(19 x^2-x+6\\right)$, $q(x) = \\frac{27 x^2}{4}+x+\\frac{29}{2}$", + "Output Answer": [ + "$21 x^2+\\frac{x}{4}+19$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (3/4)*(19*x**2-x+6)\nq = ((27*x**2)/4)+x+(29/2)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-2 \\log (2)$.", + "Output Answer": [ + "Norm: $2 \\log (2)$\nArgument: $\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -2*math.log(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\sqrt{3} \\left(\\sin \\left(\\frac{2 \\pi }{9}\\right)-i \\cos \\left(\\frac{2 \\pi }{9}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$3 \\left(-\\sin \\left(\\frac{\\pi }{18}\\right)-i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-math.sqrt(3)*(math.sin(((2*math.pi)/9))-1j*math.cos(((2*math.pi)/9))))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\left(\\cos \\left(\\frac{49}{30}\\right)+i \\sin \\left(\\frac{49}{30}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$7776 \\left(\\cos \\left(\\frac{49}{6}\\right)+i \\sin \\left(\\frac{49}{6}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*(math.cos((49/30))+1j*math.sin((49/30))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{(((6-8)+16)+23)^2+8}{\\frac{1}{14} (((10+12)-4)+8)}$.", + "Output Answer": [ + "$\\frac{9639}{13}$" + ], + "Output Program": [ + "try: \n print((((((6-8)+16)+23)**2+8)/((1/14)*(((10+12)-4)+8))))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 3 x^2+14 x-13$, $q(x) = 3 x (5 x-1)$", + "Output Answer": [ + "$18 x^2+11 x-13$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**2+14*x-13\nq = 3*x*(5*x-1)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{71}{61}$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$\\frac{236685}{61}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(71/61) # initial value\nd = 9 # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(71/61) # initial value\nd = 9 # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt[3]{5 x+2}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{2}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(cbrt(5*x+2), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(-\\sin \\left(\\frac{7 \\pi }{45}\\right)+i \\cos \\left(\\frac{7 \\pi }{45}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$729 \\left(\\cos \\left(\\frac{\\pi }{15}\\right)-i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(-math.sin(((7*math.pi)/45))+1j*math.cos(((7*math.pi)/45))))**6)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $9 \\sqrt{2} x^2-\\frac{19 x}{\\sqrt{2}}+3 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{\\frac{19}{\\sqrt{2}}-i \\sqrt{\\frac{71}{2}}}{18 \\sqrt{2}}\\lor x=\\frac{\\frac{19}{\\sqrt{2}}+i \\sqrt{\\frac{71}{2}}}{18 \\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(9*sqrt(2)*x**2-((19*x)/(sqrt(2)))+3*sqrt(2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-12 e^{-1+\\frac{i \\pi }{10}}$.", + "Output Answer": [ + "Norm: $\\frac{12}{e}$\nArgument: $-\\pi +\\tan ^{-1}\\left(\\frac{\\Im\\left(e^{-1+\\frac{i \\pi }{10}}\\right)}{\\Re\\left(e^{-1+\\frac{i \\pi }{10}}\\right)}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -12*math.e**(-1+((i*math.pi)/10))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{9} \\left(7056 t^2-2184 \\left(\\sqrt{3}-14\\right) t-4732 \\sqrt{3}+33631\\right), x(t)=-4 \\sqrt{3} t-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=\\frac{49 x^2}{3}+\\frac{182 x}{3}+\\frac{169}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/9)*(7056*t**2-2184*(sqrt(3)-14)*t-4732*sqrt(3)+33631)\nx_t = -4*sqrt(3)*t-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 12 x^2+3 x-13$, $q(x) = (5-8 x) x$", + "Output Answer": [ + "$4 x^2+8 x-13$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 12*x**2+3*x-13\nq = (5-8*x)*x\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{7} \\left(-23 x^2-41 x-22\\right)$, $q(x) = -3 x^2-\\frac{99 x}{7}+\\frac{16}{7}$", + "Output Answer": [ + "$-\\frac{44 x^2}{7}-20 x-\\frac{6}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/7)*(-23*x**2-41*x-22)\nq = -3*x**2-((99*x)/7)+(16/7)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 12 x^2+6 x-15$ and $q(x) = 11 x^2-x-13$", + "Output Answer": [ + "$132 x^4+54 x^3-327 x^2-63 x+195$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 12*x**2+6*x-15\nq = 11*x**2-x-13\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 x^2+14 x+7$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(7-\\sqrt{91}\\right)\\lor x=\\frac{1}{6} \\left(7+\\sqrt{91}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*x**2+14*x+7, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = x^2-10 x+12$ and $q(x) = -10 x^2-12$", + "Output Answer": [ + "$-10 x^4+100 x^3-132 x^2+120 x-144$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = x**2-10*x+12\nq = -10*x**2-12\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2-3 x+6 y^2+3 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x-\\frac{3}{20}\\right)^2+6 \\left(y+\\frac{1}{4}\\right)^2=\\frac{48}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{20} & -\\frac{21}{20} \\\\\n \\frac{3}{20} & \\frac{11}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{5}}$\nCenter: $\\left\\{\\frac{3}{20},-\\frac{1}{4}\\right\\}$\nArea Enclosed: $\\frac{8}{5} \\sqrt{\\frac{3}{5}} \\pi$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2-3*x+6*y**2+3*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{8+16 i}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $8 \\sqrt{\\frac{5}{\\pi }}$\nArgument: $\\tan ^{-1}(2)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((8+16*i)/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2-2 x+10 y^2+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 y^2-9 \\left(x+\\frac{1}{9}\\right)^2=-\\frac{73}{9}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{90} \\left(-10-\\sqrt{13870}\\right) & 0 \\\\\n \\frac{1}{90} \\left(\\sqrt{13870}-10\\right) & 0 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{19}{10}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{90} \\left(-10-\\sqrt{13870}\\right)+\\frac{1}{90} \\left(\\sqrt{13870}-10\\right)\\right),0\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3 x}{\\sqrt{10}}+\\frac{1}{3 \\sqrt{10}},y=-\\frac{3 x}{\\sqrt{10}}-\\frac{1}{3 \\sqrt{10}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2-2*x+10*y**2+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left((21+23)^2+2\\right)+(25+4)$.", + "Output Answer": [ + "$1967$" + ], + "Output Program": [ + "try: \n print(((21+23)**2+2)+(25+4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $5 e^{-1+\\frac{23 i \\pi }{45}}$.", + "Output Answer": [ + "Norm: $\\frac{5}{e}$\nArgument: $\\frac{23 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 5*math.e**(-1+((23*i*math.pi)/45))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 5 (2 x+3)^2, q(x) = 25 (x+3)^4$", + "Output Answer": [ + "$25 x^4+300 x^3+1370 x^2+2760 x+2070$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*(2*x+3)**2\nq = 25*(x+3)**4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(19-19) ((((22-5)-24)+10)-20)$.", + "Output Answer": [ + "$0$" + ], + "Output Program": [ + "try: \n print((19-19)*((((22-5)-24)+10)-20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{92}{97}$, and $a_n=a_{n-1}+2$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{65610}{97}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(92/97) # initial value\nd = 2 # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(92/97) # initial value\nd = 2 # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-5 x^2+2 x+8 y^2-6 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y-\\frac{3}{8}\\right)^2-5 \\left(x-\\frac{1}{5}\\right)^2=\\frac{397}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{5} & \\frac{3}{8}-\\frac{\\sqrt{5161}}{40} \\\\\n \\frac{1}{5} & \\frac{1}{40} \\left(15+\\sqrt{5161}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{13}{5}}$\nCenter: $\\left\\{\\frac{1}{5},\\frac{1}{2} \\left(\\frac{3}{8}-\\frac{\\sqrt{5161}}{40}+\\frac{1}{40} \\left(15+\\sqrt{5161}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{40} \\left(15+2 \\sqrt{10}\\right)-\\frac{1}{2} \\sqrt{\\frac{5}{2}} x,y=\\frac{1}{2} \\sqrt{\\frac{5}{2}} x+\\frac{1}{40} \\left(15-2 \\sqrt{10}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-5*x**2+2*x+8*y**2-6*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-2 \\sqrt{3} x-10 \\sqrt{3} y+14 \\sqrt{3}=0$, $9 \\sqrt{3} x-13 \\sqrt{3} y+6 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{61}{58}$, $y=\\frac{69}{58}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-2*sqrt(3)*x-10*sqrt(3)*y+14*sqrt(3), 9*sqrt(3)*x-13*sqrt(3)*y+6*sqrt(3)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{13 x}{3}+1\\right| =\\frac{35}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{38}{13}\\right\\},\\left\\{x\\to \\frac{32}{13}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((13*x)/3)+1), (35/3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $13 x^2+14 x+2$", + "Output Answer": [ + "$x=\\frac{1}{13} \\left(-7-\\sqrt{23}\\right)\\lor x=\\frac{1}{13} \\left(\\sqrt{23}-7\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(13*x**2+14*x+2, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $2 x^2-13 x+4$", + "Output Answer": [ + "$2 \\left(x-\\frac{13}{4}\\right)^2-\\frac{137}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (2*x**2-13*x+4), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{95}{82}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$\\frac{2185}{82}$" + ], + "Output Program": [ + "a = (95/82) # initial value\nd = 0 # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (95/82) # initial value\nd = 0 # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $5 x^2-\\frac{5445}{4}$", + "Output Answer": [ + "$-5 \\left(\\frac{33}{2}-x\\right) \\left(x+\\frac{33}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(5*x**2-(5445/4), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $8 x^2-2 x-3$ and $2 x+1$.", + "Output Answer": [ + "$2 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(8*x**2-2*x-3, 2*x+1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 25 (x-4)^4, q(x) = 135 \\sqrt{5} (x+1)^3$", + "Output Answer": [ + "$25 x^4+135 \\sqrt{5} x^3-400 x^3+405 \\sqrt{5} x^2+2400 x^2+405 \\sqrt{5} x-6400 x+135 \\sqrt{5}+6400$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 25*(x-4)**4\nq = 135*sqrt(5)*(x+1)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(8 \\left(\\cos \\left(\\frac{109}{90}\\right)+i \\sin \\left(\\frac{109}{90}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$262144 \\left(\\cos \\left(\\frac{109}{15}\\right)+i \\sin \\left(\\frac{109}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((8*(math.cos((109/90))+1j*math.sin((109/90))))**6)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $x^2+9 y^2-4 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $x^2+9 \\left(y-\\frac{2}{9}\\right)^2=\\frac{22}{9}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{4 \\sqrt{11}}{9} & \\frac{2}{9} \\\\\n \\frac{4 \\sqrt{11}}{9} & \\frac{2}{9} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2 \\sqrt{2}}{3}$\nCenter: $\\left\\{0,\\frac{2}{9}\\right\\}$\nArea Enclosed: $\\frac{22 \\pi }{27}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2+9*y**2-4*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{11+11 i}{\\sqrt{3}}$ and $y=(-4+4 i) \\sqrt{3}$", + "Output Answer": [ + "$-88$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((11+11*i)/(math.sqrt(3)))\ny = (-4+4*i)*math.sqrt(3)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-12 x^5+6 x^4-6 x^3-3 x$ and $4 x^5-2 x^4+2 x^3+x$.", + "Output Answer": [ + "$4 x^5-2 x^4+2 x^3+x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-12*x**5+6*x**4-6*x**3-3*x, 4*x**5-2*x**4+2*x**3+x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$23 x-21 y-21=0$, $11 x+22 y-10=0$", + "Output Answer": [ + "$x=\\frac{672}{737}$, $y=-\\frac{1}{737}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((23*x-21*y-21, 11*x+22*y-10), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{35 x}{2}+\\frac{23 y}{2}+21 z=0$, $5 x+\\frac{9 y}{2}+\\frac{37 z}{2}+\\frac{17}{2}=0$, $-13 x+\\frac{45 y}{2}-16 z-9=0$", + "Output Answer": [ + "$x=\\frac{36128}{54393}$, $y=\\frac{15274}{54393}$, $z=-\\frac{38471}{54393}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((35*x)/2)+((23*y)/2)+21*z, 5*x+((9*y)/2)+((37*z)/2)+(17/2), -13*x+((45*y)/2)-16*z-9)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$16 x+19 y-19 z+10=0$, $-17 x-6 y-10 z+23=0$, $12 x+12 y+15 z+9=0$", + "Output Answer": [ + "$x=\\frac{4745}{1851}$, $y=-\\frac{1829}{617}$, $z=-\\frac{517}{1851}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((16*x+19*y-19*z+10, -17*x-6*y-10*z+23, 12*x+12*y+15*z+9)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\cos \\left(4-4 x^5\\right)-\\tan \\left(5-\\frac{x^4}{2}\\right)$ at the point $x=-9$", + "Output Answer": [ + "$-\\cos (236200)+\\tan \\left(\\frac{6551}{2}\\right) = -1.635$" + ], + "Output Program": [ + "import math\n\nx = -9\ntry: \n f = -math.cos(4-4*x**5)-math.tan(5-((x**4)/2))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $5 \\left(-\\cos \\left(\\frac{11 \\pi }{180}\\right)+i \\sin \\left(\\frac{11 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $5 \\sqrt{\\sin ^2\\left(\\frac{11 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{11 \\pi }{180}\\right)}$\nArgument: $\\frac{169 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 5*(-math.cos(((11*math.pi)/180))+i*math.sin(((11*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -6 \\sqrt{3} x^2-\\frac{20 x}{\\sqrt{3}}+\\frac{22}{\\sqrt{3}}$ and $q(x) = -\\frac{13 x^2}{\\sqrt{3}}+\\frac{8 x}{\\sqrt{3}}-\\frac{7}{\\sqrt{3}}$", + "Output Answer": [ + "$78 x^4+\\frac{116 x^3}{3}-\\frac{320 x^2}{3}+\\frac{316 x}{3}-\\frac{154}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -6*sqrt(3)*x**2-((20*x)/(sqrt(3)))+(22/(sqrt(3)))\nq = -((13*x**2)/(sqrt(3)))+((8*x)/(sqrt(3)))-(7/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^6+2 x^5-7 x^4-3 x^3-6 x^2+5 x-5$ when divided by $-8$.", + "Output Answer": [ + "$-\\frac{3 x^6}{8}-\\frac{x^5}{4}+\\frac{7 x^4}{8}+\\frac{3 x^3}{8}+\\frac{3 x^2}{4}-\\frac{5 x}{8}+\\frac{5}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**6+2*x**5-7*x**4-3*x**3-6*x**2+5*x-5\nq = -8\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $16 x^2+8 x-4$ and $-4 x^2-2 x+1$.", + "Output Answer": [ + "$4 x^2+2 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(16*x**2+8*x-4, -4*x**2-2*x+1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{40 x^2}{7}-\\frac{20 x}{7}+\\frac{115}{7}}{\\frac{101 x^2}{7}-2 x-\\frac{170}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-1-\\sqrt{47}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(-1+\\sqrt{47}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((40*x**2)/7)-((20*x)/7)+(115/7))/(((101*x**2)/7)-2*x-(170/7))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-5 e^{-\\frac{113 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $5$\nArgument: $\\frac{67 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -5*math.e**(-((113*i*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$7 x-y+4 z+2=0$, $3 x-2 y+13 z-11=0$, $12 x-5 y-4 z-2=0$", + "Output Answer": [ + "$x=-\\frac{420}{379}$, $y=-\\frac{1330}{379}$, $z=\\frac{213}{379}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((7*x-y+4*z+2, 3*x-2*y+13*z-11, 12*x-5*y-4*z-2)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 7 x^2+12 x+3$ and $q(x) = 2 x^2-x-13$", + "Output Answer": [ + "$14 x^4+17 x^3-97 x^2-159 x-39$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 7*x**2+12*x+3\nq = 2*x**2-x-13\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-x^2+10 x+8 y^2-9 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y-\\frac{9}{16}\\right)^2-(x-5)^2=-\\frac{655}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n 5-\\frac{3 \\sqrt{655}}{16} & \\frac{9}{16} \\\\\n 5+\\frac{3 \\sqrt{655}}{16} & \\frac{9}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2 \\sqrt{2}}$\nCenter: $\\left\\{5,\\frac{9}{16}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{2 \\sqrt{2}}+\\frac{1}{16} \\left(9-20 \\sqrt{2}\\right),y=\\frac{1}{16} \\left(9+20 \\sqrt{2}\\right)-\\frac{x}{2 \\sqrt{2}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-x**2+10*x+8*y**2-9*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt{-4 x-7}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{4}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(sqrt(-4*x-7), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{10 x^2}{3}-\\frac{10 x}{3}+13$ and $q(x) = 12 x^2+\\frac{44 x}{3}-\\frac{5}{3}$", + "Output Answer": [ + "$-40 x^4-\\frac{800 x^3}{9}+\\frac{338 x^2}{3}+\\frac{1766 x}{9}-\\frac{65}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((10*x**2)/3)-((10*x)/3)+13\nq = 12*x**2+((44*x)/3)-(5/3)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{32}{5} \\left(\\cos \\left(\\frac{47}{30}\\right)+i \\sin \\left(\\frac{47}{30}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$-\\frac{32768}{125} \\left(\\cos \\left(\\frac{47}{10}\\right)+i \\sin \\left(\\frac{47}{10}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(32/5)*(math.cos((47/30))+1j*math.sin((47/30))))**3)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| -19 x-4| =0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{4}{19}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-19*x-4), 0), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $x^5-4 x^4+x^2+3 x-3$ and $x^5-4 x^4+x^2+3 x-3$.", + "Output Answer": [ + "$x^5-4 x^4+x^2+3 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(x**5-4*x**4+x**2+3*x-3, x**5-4*x**4+x**2+3*x-3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{29}{3}-\\frac{26 i}{3}$ and $y=3-\\frac{10 i}{3}$", + "Output Answer": [ + "$\\frac{20}{3}-\\frac{16 i}{3}$" + ], + "Output Program": [ + "i = 1j\nx = (29/3)-((26*i)/3)\ny = 3-((10*i)/3)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$-\\frac{5}{14 x}$", + "Output Answer": [ + "$-980 \\left(x-\\frac{1}{14}\\right)^2+70 \\left(x-\\frac{1}{14}\\right)-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, -(5/(14*x)))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$13 x-2 y+22 z-9=0$, $9 x+8 y+9 z-16=0$, $24 x-24 y+21 z-17=0$", + "Output Answer": [ + "$x=\\frac{3809}{2019}$, $y=\\frac{410}{673}$, $z=-\\frac{1313}{2019}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((13*x-2*y+22*z-9, 9*x+8*y+9*z-16, 24*x-24*y+21*z-17)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -12 x^2-14 x-1$, $q(x) = -x^2+15 x+12$", + "Output Answer": [ + "$-13 x^2+x+11$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -12*x**2-14*x-1\nq = -x**2+15*x+12\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 12 x^2+\\frac{54 x}{5}-\\frac{6}{5}$ and $q(x) = 9 x^2+\\frac{14 x}{5}-\\frac{59}{5}$", + "Output Answer": [ + "$108 x^4+\\frac{654 x^3}{5}-\\frac{3054 x^2}{25}-\\frac{654 x}{5}+\\frac{354}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 12*x**2+((54*x)/5)-(6/5)\nq = 9*x**2+((14*x)/5)-(59/5)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the fourth order series of the inverse of the following function around 4:\n$\\tan \\left(\\frac{3 x}{2}\\right)$", + "Output Answer": [ + "$\\frac{2 x}{3}-\\frac{2 x^3}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, tan(((3*x)/2)))\nprint(solve(f, x)[0].series(y, 4, 4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=16 \\left(5 t^2+75 t+279\\right)^2, x(t)=4 t^2+60 t+225$", + "Output Answer": [ + "$y=25 x^2-90 x+81$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 16*(5*t**2+75*t+279)**2\nx_t = 4*t**2+60*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -9 x^2+x-14$ and $q(x) = -4 x^2-7 x+1$", + "Output Answer": [ + "$36 x^4+59 x^3+40 x^2+99 x-14$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -9*x**2+x-14\nq = -4*x**2-7*x+1\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^2-3 x+5$ when divided by $-9 x-3$.", + "Output Answer": [ + "$\\frac{4 x}{9}+\\frac{5}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**2-3*x+5\nq = -9*x-3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{78}{5}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$\\frac{4716}{5}$" + ], + "Output Program": [ + "a = -(78/5) # initial value\nd = 8 # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(78/5) # initial value\nd = 8 # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(((1-9)-13)^2+21\\right)+((((3-16)+20)+16)+15)$.", + "Output Answer": [ + "$500$" + ], + "Output Program": [ + "try: \n print((((1-9)-13)**2+21)+((((3-16)+20)+16)+15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{13 x}{7}-4}+\\sqrt{\\frac{72 x}{7}-\\frac{30}{7}}=\\frac{75}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{478951-150 \\sqrt{4593462}}{24367}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((13*x)/7)-4)+sqrt(((72*x)/7)-(30/7)), (75/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{12 x^2-\\frac{15 x}{2}-\\frac{15}{4}}{\\frac{x^2}{2}-\\frac{47 x}{4}-\\frac{73}{4}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(5-\\sqrt{105}\\right)\\right\\},\\left\\{x\\to \\frac{1}{16} \\left(5+\\sqrt{105}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((12*x**2-((15*x)/2)-(15/4))/(((x**2)/2)-((47*x)/4)-(73/4))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $7 x-8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{y}{7}+\\frac{8}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, 7*x-8)\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-14+11 i) \\log (2)$ and $y=(10-7 i) \\log (2)$", + "Output Answer": [ + "$-\\frac{217}{149}+\\frac{12 i}{149}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-14+11*i)*math.log10(2)\ny = (10-7*i)*math.log10(2)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $(-9 x-6)^3=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{2}{3}\\right\\},\\left\\{x\\to -\\frac{2}{3}\\right\\},\\left\\{x\\to -\\frac{2}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve((-9*x-6)**3, x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 10 \\sqrt{2}-10 \\sqrt{2} x\\right| =2 \\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{4}{5}\\right\\},\\left\\{x\\to \\frac{6}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(10*sqrt(2)-10*sqrt(2)*x), 2*sqrt(2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{59}{5}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$\\frac{3322}{5}$" + ], + "Output Program": [ + "a = -(59/5) # initial value\nd = 4 # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(59/5) # initial value\nd = 4 # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(\\frac{1}{2}+\\frac{i \\sqrt{3}}{2}\\right)\\right)^5$", + "Output Answer": [ + "$3125 \\left(\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*((1/2)+((1j*math.sqrt(3))/2)))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left((((25-8)-9)+22)^2-22\\right) (((3-24)+14)-5)$.", + "Output Answer": [ + "$-10536$" + ], + "Output Program": [ + "try: \n print(((((25-8)-9)+22)**2-22)*(((3-24)+14)-5))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{8}{3}-\\frac{13 i}{3}$ and $y=\\frac{1}{3}-\\frac{19 i}{3}$", + "Output Answer": [ + "$\\frac{239}{362}-\\frac{165 i}{362}$" + ], + "Output Program": [ + "i = 1j\nx = -(8/3)-((13*i)/3)\ny = (1/3)-((19*i)/3)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 \\sqrt{2} x^2-6 \\sqrt{2} x$ and $q(x) = \\sqrt{2} x^2-6 \\sqrt{2} x$", + "Output Answer": [ + "$8 x^4-60 x^3+72 x^2$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*sqrt(2)*x**2-6*sqrt(2)*x\nq = sqrt(2)*x**2-6*sqrt(2)*x\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 9 x^2-x+7$ and $q(x) = -9 x^2+3 x-3$", + "Output Answer": [ + "$-81 x^4+36 x^3-93 x^2+24 x-21$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 9*x**2-x+7\nq = -9*x**2+3*x-3\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| -20 x-9| =7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{4}{5}\\right\\},\\left\\{x\\to -\\frac{1}{10}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-20*x-9), 7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{4-4 i}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $4 \\sqrt{\\frac{2}{3}}$\nArgument: $\\frac{3 \\pi }{4}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((4-4*i)/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-9 x-9 y^2-8 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x-\\frac{9}{10}\\right)^2-9 \\left(y+\\frac{4}{9}\\right)^2=\\frac{769}{180}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{90} \\left(81-\\sqrt{10766}\\right) & -\\frac{4}{9} \\\\\n \\frac{1}{90} \\left(81+\\sqrt{10766}\\right) & -\\frac{4}{9} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{14}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{90} \\left(81-\\sqrt{10766}\\right)+\\frac{1}{90} \\left(81+\\sqrt{10766}\\right)\\right),-\\frac{4}{9}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{5} x}{3}+\\frac{1}{90} \\left(-40-27 \\sqrt{5}\\right),y=\\frac{1}{90} \\left(27 \\sqrt{5}-40\\right)-\\frac{\\sqrt{5} x}{3}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-9*x-9*y**2-8*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-6 x^2-42 \\sqrt{2} x+936$", + "Output Answer": [ + "$-6 \\left(-x-13 \\sqrt{2}\\right) \\left(6 \\sqrt{2}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-6*x**2-42*sqrt(2)*x+936, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{805 x^3}{9}+\\frac{793 x^2}{3}+\\frac{931 x}{9}-\\frac{460}{9}}{\\frac{115 x^2}{3}-\\frac{475 x}{3}-\\frac{500}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{70} \\left(-73-\\sqrt{8549}\\right)\\right\\},\\left\\{x\\to \\frac{1}{70} \\left(-73+\\sqrt{8549}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((805*x**3)/9)+((793*x**2)/3)+((931*x)/9)-(460/9))/(((115*x**2)/3)-((475*x)/3)-(500/3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{1}{84}$, and $a_n=a_{n-1}+\\frac{13}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=12$.", + "Output Answer": [ + "$6 \\left(\\frac{1}{42}+\\frac{143}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\na = (1/84) # initial value\nd = (13/(math.sqrt(3))) # second term\nn = 12 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (1/84) # initial value\nd = (13/(math.sqrt(3))) # second term\nn = 12 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-12 x^2+\\frac{41 x}{3}+\\frac{20}{3}$", + "Output Answer": [ + "$x=\\frac{1}{72} \\left(41-\\sqrt{4561}\\right)\\lor x=\\frac{1}{72} \\left(41+\\sqrt{4561}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-12*x**2+((41*x)/3)+(20/3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{1-8 i}{\\sqrt{3}}$ and $y=-\\frac{4 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-2-\\frac{i}{4}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((1-8*i)/(math.sqrt(3)))\ny = -((4*i)/(math.sqrt(3)))\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -9 x^2-\\frac{88 x}{7}-\\frac{71}{7}$, $q(x) = \\frac{1}{7} \\left(23 x^2+37 x+84\\right)$", + "Output Answer": [ + "$-\\frac{40 x^2}{7}-\\frac{51 x}{7}+\\frac{13}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**2-((88*x)/7)-(71/7)\nq = (1/7)*(23*x**2+37*x+84)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{25 x^2}{4}-\\frac{7 x}{4}+\\frac{37}{4}$", + "Output Answer": [ + "$x=\\frac{1}{50} \\left(7-i \\sqrt{3651}\\right)\\lor x=\\frac{1}{50} \\left(7+i \\sqrt{3651}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((25*x**2)/4)-((7*x)/4)+(37/4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{133}-\\sqrt{79}$.", + "Output Answer": [ + "$\\sqrt{133}-\\sqrt{79}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(133)-sqrt(79))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $6 \\sqrt{5} x^2+6 \\sqrt{5} x-6 \\sqrt{5}$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(-1-\\sqrt{5}\\right)\\lor x=\\frac{1}{2} \\left(\\sqrt{5}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(6*sqrt(5)*x**2+6*sqrt(5)*x-6*sqrt(5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-8 x-3}+\\sqrt{2-2 x}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(-65+4 \\sqrt{177}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-8*x-3)+sqrt(2-2*x), 6), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{39 x^2}{5}-\\frac{48 x}{5}-\\frac{67}{5}$", + "Output Answer": [ + "$x=\\frac{1}{39} \\left(-24-i \\sqrt{2037}\\right)\\lor x=\\frac{1}{39} \\left(-24+i \\sqrt{2037}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((39*x**2)/5)-((48*x)/5)-(67/5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 12 x^2-10 x-7$, $q(x) = 5 x^2+x+8$", + "Output Answer": [ + "$17 x^2-9 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 12*x**2-10*x-7\nq = 5*x**2+x+8\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{11 x}{2}-\\frac{1}{2}}+\\sqrt{-\\frac{19 x}{4}-14}=\\frac{35}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{36} \\left(-49577+70 \\sqrt{497722}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((11*x)/2)-(1/2))+sqrt(-((19*x)/4)-14), (35/4)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{\\left(7056 t^2-37800 t+50875\\right)^2}{15625}, x(t)=\\frac{784 t^2}{25}-168 t+225$", + "Output Answer": [ + "$y=\\frac{81 x^2}{25}+\\frac{36 x}{5}+4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (((7056*t**2-37800*t+50875)**2)/15625)\nx_t = ((784*t**2)/25)-168*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{13}{2} (7 t+16), x(t)=-7 t-15$", + "Output Answer": [ + "$y=\\frac{13 x}{2}-\\frac{13}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -(13/2)*(7*t+16)\nx_t = -7*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 8-x$ and $q(x) = x-4 x^2$", + "Output Answer": [ + "$4 x^3-33 x^2+8 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 8-x\nq = x-4*x**2\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 \\sqrt{5} x^2-\\sqrt{5} x+2 \\sqrt{5}$ and $q(x) = 6 \\sqrt{5} x^2+6 \\sqrt{5} x-\\sqrt{5}$", + "Output Answer": [ + "$150 x^4+120 x^3+5 x^2+65 x-10$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*sqrt(5)*x**2-sqrt(5)*x+2*sqrt(5)\nq = 6*sqrt(5)*x**2+6*sqrt(5)*x-sqrt(5)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{13 x^2}{\\sqrt{2}}-3 \\sqrt{2} x-\\frac{15}{\\sqrt{2}}$", + "Output Answer": [ + "$\\frac{13 \\left(x-\\frac{3}{13}\\right)^2}{\\sqrt{2}}-\\frac{102 \\sqrt{2}}{13}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((13*x**2)/(math.sqrt(2)))-3*math.sqrt(2)*x-(15/(math.sqrt(2)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{4 x^2}{\\sqrt{3}}-\\frac{25 x}{\\sqrt{3}}+\\sqrt{3}$", + "Output Answer": [ + "$-\\frac{4 \\left(x+\\frac{25}{8}\\right)^2}{\\sqrt{3}}+\\sqrt{3}+\\frac{625}{16 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((4*x**2)/(math.sqrt(3)))-((25*x)/(math.sqrt(3)))+math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\pi (x-4) x$, $q(x) = \\pi \\left(4 x^2+2 x+5\\right)$", + "Output Answer": [ + "$3 \\pi x^2+6 \\pi x+5 \\pi$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -pi*(x-4)*x\nq = pi*(4*x**2+2*x+5)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 11 \\sqrt{3} x^2+2 \\sqrt{3} x-2 \\sqrt{3}\\right| =7 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\{x\\to -1\\},\\left\\{x\\to \\frac{9}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11*sqrt(3)*x**2+2*sqrt(3)*x-2*sqrt(3)), 7*sqrt(3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -18 x^2-6 x+24\\right| =-11$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-18*x**2-6*x+24), -11), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{(21-24)+2}{24+21}$.", + "Output Answer": [ + "$-\\frac{1}{45}$" + ], + "Output Program": [ + "try: \n print((((21-24)+2)/(24+21)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{13-6 x}+\\sqrt{-2 x-12}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-425+15 \\sqrt{577}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(13-6*x)+sqrt(-2*x-12), 15), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 13 x^2+4 x-5$ and $q(x) = -8 x^2-4 x-3$", + "Output Answer": [ + "$-104 x^4-84 x^3-15 x^2+8 x+15$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 13*x**2+4*x-5\nq = -8*x**2-4*x-3\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{19}{2}+2 i$ and $y=\\frac{5}{2}+3 i$", + "Output Answer": [ + "$-\\frac{71}{61}+\\frac{134 i}{61}$" + ], + "Output Program": [ + "i = 1j\nx = -(19/2)+2*i\ny = (5/2)+3*i\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{2 x^2}{7}+\\frac{162 x}{7}-\\frac{106}{7}}{-\\frac{68 x}{7}-21}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-81-\\sqrt{6773}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(-81+\\sqrt{6773}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((2*x**2)/7)+((162*x)/7)-(106/7))/(-((68*x)/7)-21)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| -19 x-11| =2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{13}{19}\\right\\},\\left\\{x\\to -\\frac{9}{19}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-19*x-11), 2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{3+22 i}{\\pi }$ and $y=-\\frac{26-12 i}{\\pi }$", + "Output Answer": [ + "$-\\frac{93}{410}+\\frac{152 i}{205}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((3+22*i)/math.pi)\ny = -((26-12*i)/math.pi)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{3}{35}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$\\frac{9}{5}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (3/35) # initial value\nd = 0 # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (3/35) # initial value\nd = 0 # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{2}{7}-3 i$ and $y=\\frac{20}{7}-5 i$", + "Output Answer": [ + "$-\\frac{22}{7}+2 i$" + ], + "Output Program": [ + "i = 1j\nx = -(2/7)-3*i\ny = (20/7)-5*i\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 x^2-11 x-\\frac{3}{2}$", + "Output Answer": [ + "$\\frac{109}{8}-2 \\left(x+\\frac{11}{4}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*x**2-11*x-(3/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2+9$ and $3$.", + "Output Answer": [ + "$3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2+9, 3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\cos \\left(\\frac{8 \\pi }{45}\\right)+i \\sin \\left(\\frac{8 \\pi }{45}\\right)\\right)^7$", + "Output Answer": [ + "$\\cos \\left(\\frac{11 \\pi }{45}\\right)-i \\sin \\left(\\frac{11 \\pi }{45}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-math.cos(((8*math.pi)/45))+1j*math.sin(((8*math.pi)/45)))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{67 x^2}{5}-5 x-\\frac{18}{5}$", + "Output Answer": [ + "$\\frac{67}{5} \\left(x-\\frac{25}{134}\\right)^2-\\frac{5449}{1340}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((67*x**2)/5)-5*x-(18/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-2 \\sqrt{3} x^2+8 \\sqrt{3} x+2 \\sqrt{3}$", + "Output Answer": [ + "$x=2-\\sqrt{5}\\lor x=2+\\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-2*sqrt(3)*x**2+8*sqrt(3)*x+2*sqrt(3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\sqrt{2} x-10 \\sqrt{2} y+8 \\sqrt{2} z+14 \\sqrt{2}=0$, $-17 \\sqrt{2} x+15 \\sqrt{2} y+11 \\sqrt{2} z+7 \\sqrt{2}=0$, $14 \\sqrt{2} y+4 \\sqrt{2} z-3 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{73}{415}$, $y=\\frac{433}{830}$, $z=-\\frac{893}{830}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-sqrt(2)*x-10*sqrt(2)*y+8*sqrt(2)*z+14*sqrt(2), -17*sqrt(2)*x+15*sqrt(2)*y+11*sqrt(2)*z+7*sqrt(2), 14*sqrt(2)*y+4*sqrt(2)*z-3*sqrt(2))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -10 x^2-4 x+12$ and $q(x) = 3 x^2+4 x+8$", + "Output Answer": [ + "$-30 x^4-52 x^3-60 x^2+16 x+96$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -10*x**2-4*x+12\nq = 3*x**2+4*x+8\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{8 x-2} \\tan (4 x+4)$ at the point $x=-2$", + "Output Answer": [ + "$\\sqrt[3]{2} 3^{2/3} \\tan (4) = 3.034$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = -2\ntry: \n f = np.cbrt(8*x-2)*math.tan(4*x+4)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(2-7)+((13+9)-7)$.", + "Output Answer": [ + "$10$" + ], + "Output Program": [ + "try: \n print((2-7)+((13+9)-7))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 (2 x+3)^4, q(x) = 75 (x+1)^2$", + "Output Answer": [ + "$144 x^4+864 x^3+2019 x^2+2094 x+804$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*(2*x+3)**4\nq = 75*(x+1)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt{\\tan \\left(\\frac{17}{2}-\\frac{9 x}{2}\\right)}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{9} (2 \\pi c_1+17)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(sqrt(tan((17/2)-((9*x)/2))), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{11 x}{2}, q(x) = (4 x+1)^3$", + "Output Answer": [ + "$64 x^3+48 x^2+\\frac{35 x}{2}+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((11*x)/2)\nq = (4*x+1)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{43 x}{\\sqrt{3}}+6 \\sqrt{3}\\right| =6 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{36}{43}\\right\\},\\{x\\to 0\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((43*x)/(sqrt(3)))+6*sqrt(3)), 6*sqrt(3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{x}{7}+\\frac{130 y}{7}+\\frac{59}{7}=0$, $\\frac{76 x}{7}+\\frac{101 y}{7}-\\frac{85}{7}=0$", + "Output Answer": [ + "$x=\\frac{17009}{9981}$, $y=-\\frac{4399}{9981}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-(x/7)+((130*y)/7)+(59/7), ((76*x)/7)+((101*y)/7)-(85/7)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8 x+3}+\\sqrt{\\frac{29 x}{2}+\\frac{23}{2}}=\\frac{11}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{338} \\left(5003-220 \\sqrt{511}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8*x+3)+sqrt(((29*x)/2)+(23/2)), (11/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{19 x}{\\sqrt{2}}+\\frac{1}{\\sqrt{2}}\\right| =\\frac{7}{\\sqrt{2}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{8}{19}\\right\\},\\left\\{x\\to \\frac{6}{19}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((19*x)/(sqrt(2)))+(1/(sqrt(2)))), (7/(sqrt(2)))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 6-17 x| =\\frac{16}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{51}\\right\\},\\left\\{x\\to \\frac{2}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(6-17*x), (16/3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 (1-4 x)^2, q(x) = 1296 (x-1)^4$", + "Output Answer": [ + "$1296 x^4-5184 x^3+7840 x^2-5216 x+1300$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*(1-4*x)**2\nq = 1296*(x-1)**4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-243 x^2-387 x-154}{-288 x^2-233 x-7}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{22}{27}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-243*x**2-387*x-154)/(-288*x**2-233*x-7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-7 e^{-\\frac{7 i \\pi }{45}}$.", + "Output Answer": [ + "Norm: $7$\nArgument: $\\frac{38 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -7*math.e**(-((7*i*math.pi)/45))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x-3}+\\sqrt{15 x-3}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{169} \\left(3825-30 \\sqrt{6243}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x-3)+sqrt(15*x-3), 15), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{2 x^2}{5}-\\frac{21}{5}\\right| =\\frac{64}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\sqrt{\\frac{43}{2}}\\right\\},\\left\\{x\\to \\sqrt{\\frac{43}{2}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((2*x**2)/5)-(21/5)), (64/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-15 x-10$ and $3 x+2$.", + "Output Answer": [ + "$3 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-15*x-10, 3*x+2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\left(8 t^2+240 t+1797\\right)^2, x(t)=t^2+30 t+225$", + "Output Answer": [ + "$y=64 x^2-48 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (8*t**2+240*t+1797)**2\nx_t = t**2+30*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{12}{23}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$\\frac{240}{23}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (12/23) # initial value\nd = 0 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (12/23) # initial value\nd = 0 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(-\\sin \\left(\\frac{4 \\pi }{45}\\right)-i \\cos \\left(\\frac{4 \\pi }{45}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$13841287201 \\left(-\\cos \\left(\\frac{\\pi }{15}\\right)+i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(-math.sin(((4*math.pi)/45))-1j*math.cos(((4*math.pi)/45))))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\tan ^{-1}(x+2)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\tan (y)-2\\text{ if }-\\frac{\\pi }{2} 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $6 x^5+6 x^4-10 x^3-4 x^2-10 x+2$ and $-3 x^5-3 x^4+5 x^3+2 x^2+5 x-1$.", + "Output Answer": [ + "$3 x^5+3 x^4-5 x^3-2 x^2-5 x+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(6*x**5+6*x**4-10*x**3-4*x**2-10*x+2, -3*x**5-3*x**4+5*x**3+2*x**2+5*x-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{27 x}{\\sqrt{2}}+8 \\sqrt{2} y+\\frac{11}{\\sqrt{2}}=0$, $-\\frac{27 x}{\\sqrt{2}}-\\frac{33 y}{\\sqrt{2}}-4 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{235}{1323}$, $y=-\\frac{19}{49}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((27*x)/(sqrt(2)))+8*sqrt(2)*y+(11/(sqrt(2))), -((27*x)/(sqrt(2)))-((33*y)/(sqrt(2)))-4*sqrt(2)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{169 x}{7}+\\frac{43 y}{7}+\\frac{54}{7}=0$, $\\frac{31 x}{7}+\\frac{25 y}{7}-\\frac{131}{7}=0$", + "Output Answer": [ + "$x=\\frac{6983}{5558}$, $y=\\frac{20465}{5558}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((169*x)/7)+((43*y)/7)+(54/7), ((31*x)/7)+((25*y)/7)-(131/7)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{76}{51}$, and $a_n=a_{n-1}+\\frac{26}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$\\frac{1478}{17}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (76/51) # initial value\nd = (26/5) # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (76/51) # initial value\nd = (26/5) # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2+9 x+9 y^2-6 y+9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(y-\\frac{1}{3}\\right)^2-3 \\left(x-\\frac{3}{2}\\right)^2=-\\frac{59}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{6} \\left(9-2 \\sqrt{59}\\right) & \\frac{1}{3} \\\\\n \\frac{1}{6} \\left(9+2 \\sqrt{59}\\right) & \\frac{1}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{6} \\left(9-2 \\sqrt{59}\\right)+\\frac{1}{6} \\left(9+2 \\sqrt{59}\\right)\\right),\\frac{1}{3}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{3}}+\\frac{1}{6} \\left(2-3 \\sqrt{3}\\right),y=\\frac{1}{6} \\left(2+3 \\sqrt{3}\\right)-\\frac{x}{\\sqrt{3}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2+9*x+9*y**2-6*y+9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{5 x^2}{2}+\\frac{5 x}{2}-\\frac{27}{2}$", + "Output Answer": [ + "$x=\\frac{1}{10} \\left(-5-\\sqrt{565}\\right)\\lor x=\\frac{1}{10} \\left(\\sqrt{565}-5\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((5*x**2)/2)+((5*x)/2)-(27/2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{4-2 x} \\cos ^{-1}(4 x+2)$ at the point $x=2$", + "Output Answer": [ + "$0 = 0.$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 2\ntry: \n f = np.cbrt(4-2*x)*math.acos(4*x+2)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((18-15)-13)+9) \\left(\\left(\\frac{19+24}{24}-21\\right)+24\\right)$.", + "Output Answer": [ + "$-\\frac{115}{24}$" + ], + "Output Program": [ + "try: \n print((((18-15)-13)+9)*((((19+24)/24)-21)+24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 7 x^2+5 x-1$ and $q(x) = -2 x^2+x+4$", + "Output Answer": [ + "$-14 x^4-3 x^3+35 x^2+19 x-4$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 7*x**2+5*x-1\nq = -2*x**2+x+4\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-4 x-21 y+7=0$, $16 x-24 y+15=0$", + "Output Answer": [ + "$x=-\\frac{49}{144}$, $y=\\frac{43}{108}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-4*x-21*y+7, 16*x-24*y+15), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $-\\cos ^{-1}(2) \\cot (7-6 x)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{6} \\left(\\pi c_1+\\frac{\\pi }{2}+7\\right)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(-acos2*cot(7-6*x), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-15 x^2+8 x-8$", + "Output Answer": [ + "$-15 \\left(x-\\frac{4}{15}\\right)^2-\\frac{104}{15}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-15*x**2+8*x-8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=4-4 i$ and $y=-6+i$", + "Output Answer": [ + "$-20+28 i$" + ], + "Output Program": [ + "i = 1j\nx = 4-4*i\ny = -6+i\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((((10+3)-12)+17)-24) ((((4-22)-1)-6)+17)$.", + "Output Answer": [ + "$48$" + ], + "Output Program": [ + "try: \n print(((((10+3)-12)+17)-24)*((((4-22)-1)-6)+17))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{86}{47}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$\\frac{14310}{47}$" + ], + "Output Program": [ + "a = (86/47) # initial value\nd = 8 # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (86/47) # initial value\nd = 8 # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{175} \\sqrt{11}$.", + "Output Answer": [ + "$5 \\sqrt{77}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(175)*sqrt(11))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{13}{5}-\\frac{66 x}{5}}+\\sqrt{-\\frac{26 x}{5}-\\frac{32}{5}}=\\frac{54}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-32409+108 \\sqrt{70529}}{1000}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((13/5)-((66*x)/5))+sqrt(-((26*x)/5)-(32/5)), (54/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{22 x^2}{\\sqrt{3}}+\\frac{17 x}{\\sqrt{3}}-\\frac{4}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{44} \\left(-17-\\sqrt{641}\\right)\\lor x=\\frac{1}{44} \\left(\\sqrt{641}-17\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((22*x**2)/(sqrt(3)))+((17*x)/(sqrt(3)))-(4/(sqrt(3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(79-35 t)^2, x(t)=7 t-15$", + "Output Answer": [ + "$y=25 x^2-40 x+16$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (79-35*t)**2\nx_t = 7*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2+240 x+432$", + "Output Answer": [ + "$12 (-x-18) (-x-2)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2+240*x+432, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{4 x^2}{\\sqrt{3}}+8 \\sqrt{3} x-\\frac{1}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{4 (x-3)^2}{\\sqrt{3}}+12 \\sqrt{3}-\\frac{1}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((4*x**2)/(math.sqrt(3)))+8*math.sqrt(3)*x-(1/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 19-13 x| =-18$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(19-13*x), -18), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{41 x}{7}-\\frac{10}{7}}+\\sqrt{\\frac{64}{7}-\\frac{40 x}{7}}=\\frac{50}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(-203018+400 \\sqrt{257573}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((41*x)/7)-(10/7))+sqrt((64/7)-((40*x)/7)), (50/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^6-4 x^5+6 x^4+9 x^3+9 x^2+4 x$ when divided by $6 x^4+2 x^3-9 x^2-9 x-3$.", + "Output Answer": [ + "$-\\frac{x^2}{3}-\\frac{5 x}{9}+\\frac{37}{54}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**6-4*x**5+6*x**4+9*x**3+9*x**2+4*x\nq = 6*x**4+2*x**3-9*x**2-9*x-3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{7 x-2}+\\sqrt{8 x-6}=14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 2944-28 \\sqrt{11002}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(7*x-2)+sqrt(8*x-6), 14), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{61}{7}-\\frac{53 x}{7}}+\\sqrt{-\\frac{43 x}{7}-\\frac{97}{7}}=\\frac{36}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{175} \\left(-28339+36 \\sqrt{602526}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((61/7)-((53*x)/7))+sqrt(-((43*x)/7)-(97/7)), (36/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-3 \\left(-\\sin \\left(\\frac{\\pi }{30}\\right)+i \\cos \\left(\\frac{\\pi }{30}\\right)\\right)$.", + "Output Answer": [ + "Norm: $3 \\sqrt{\\sin ^2\\left(\\frac{\\pi }{30}\\right)+\\cos ^2\\left(\\frac{\\pi }{30}\\right)}$\nArgument: $-\\frac{7 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -3*(-math.sin((math.pi/30))+i*math.cos((math.pi/30)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{64}{17}$, and $a_n=a_{n-1}+-\\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$\\frac{25}{2} \\left(-\\frac{128}{17}-24 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(64/17) # initial value\nd = -math.sqrt(5) # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(64/17) # initial value\nd = -math.sqrt(5) # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-4 x^2-\\frac{356 x}{7}-\\frac{7800}{49}$", + "Output Answer": [ + "$-4 \\left(-x-\\frac{50}{7}\\right) \\left(-x-\\frac{39}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-4*x**2-((356*x)/7)-(7800/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2+120 x-675$", + "Output Answer": [ + "$5 (15-x) (x-9)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2+120*x-675, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $200-8 x^2$", + "Output Answer": [ + "$8 (5-x) (x+5)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(200-8*x**2, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -4 x^2+9 x-4$, $q(x) = -x^2+12 x-7$", + "Output Answer": [ + "$-5 x^2+21 x-11$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**2+9*x-4\nq = -x**2+12*x-7\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-11 x-3}+\\sqrt{-10 x-7}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{55141}{-4721-30 \\sqrt{24703}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-11*x-3)+sqrt(-10*x-7), 15), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $-\\sin \\left(8 x+\\frac{7}{2}\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{16} (4 \\pi c_1-7)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\},\\left\\{x\\to \\fbox{$\\frac{1}{16} (2 (2 \\pi c_1+\\pi )-7)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(-sin(8*x+(7/2)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -7 x^2-5 x+3$, $q(x) = -12 x^2-11 x+1$", + "Output Answer": [ + "$-19 x^2-16 x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**2-5*x+3\nq = -12*x**2-11*x+1\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-2-i$ and $y=-\\frac{8}{3}+\\frac{28 i}{3}$", + "Output Answer": [ + "$\\frac{2}{3}-\\frac{31 i}{3}$" + ], + "Output Program": [ + "i = 1j\nx = -2-i\ny = -(8/3)+((28*i)/3)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{256} (25-22 x)^4, q(x) = \\frac{1}{4} (5 x+3)$", + "Output Answer": [ + "$\\frac{14641 x^4}{16}-\\frac{33275 x^3}{8}+\\frac{226875 x^2}{32}-\\frac{171835 x}{32}+\\frac{390817}{256}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/256)*(25-22*x)**4\nq = (1/4)*(5*x+3)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{72}{19}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$\\frac{576}{19}$" + ], + "Output Program": [ + "a = (72/19) # initial value\nd = 0 # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (72/19) # initial value\nd = 0 # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{323 x^2}{3}-\\frac{3491 x}{9}-\\frac{598}{3}}{-\\frac{17 x^2}{3}+\\frac{x}{3}+92}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{26}{57}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((323*x**2)/3)-((3491*x)/9)-(598/3))/(-((17*x**2)/3)+(x/3)+92)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{351 x^2}{2}+\\frac{1983 x}{8}-\\frac{3145}{8}}{-\\frac{243 x^2}{2}-\\frac{729 x}{8}+\\frac{7395}{16}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{37}{39}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((351*x**2)/2)+((1983*x)/8)-(3145/8))/(-((243*x**2)/2)-((729*x)/8)+(7395/16))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{10 x^2}{\\sqrt{3}}-8 \\sqrt{3} x+\\sqrt{3}$", + "Output Answer": [ + "$\\frac{29 \\sqrt{3}}{5}-\\frac{10 \\left(x+\\frac{6}{5}\\right)^2}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((10*x**2)/(math.sqrt(3)))-8*math.sqrt(3)*x+math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{21 x^2}{e}-\\frac{21 x}{e}-\\frac{18}{e}$ and $q(x) = \\frac{15 x^2}{e}+\\frac{5 x}{e}+\\frac{5}{e}$", + "Output Answer": [ + "$\\frac{315 x^4}{e^2}-\\frac{210 x^3}{e^2}-\\frac{270 x^2}{e^2}-\\frac{195 x}{e^2}-\\frac{90}{e^2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = ((21*x**2)/math.e)-((21*x)/math.e)-(18/math.e)\nq = ((15*x**2)/math.e)+((5*x)/math.e)+(5/math.e)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$-\\sinh (2 x+6)$", + "Output Answer": [ + "$y\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(-sinh(2*x+6), x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $2 x^5+2 x^4+6 x^3-x^2-7 x$ when divided by $-6 x-1$.", + "Output Answer": [ + "$-\\frac{x^4}{3}-\\frac{5 x^3}{18}-\\frac{103 x^2}{108}+\\frac{211 x}{648}+\\frac{4325}{3888}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**5+2*x**4+6*x**3-x**2-7*x\nq = -6*x-1\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -5 e x (x+1)$, $q(x) = e (3-2 x)$", + "Output Answer": [ + "$-5 e x^2-7 e x+3 e$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x\n\np = -5*math.e*x*(x+1)\nq = math.e*(3-2*x)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-12 x^2-84 x+1305$", + "Output Answer": [ + "$12 \\left(-x-\\frac{29}{2}\\right) \\left(x-\\frac{15}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-12*x**2-84*x+1305, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^3-4 x^2+2 x$ and $4 x^3+4 x^2-2 x$.", + "Output Answer": [ + "$4 x^3+4 x^2-2 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**3-4*x**2+2*x, 4*x**3+4*x**2-2*x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -(8 x+1)^3, q(x) = 5 x-4$", + "Output Answer": [ + "$-512 x^3-192 x^2-19 x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(8*x+1)**3\nq = 5*x-4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sinh (3 x)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{2 i \\pi c_1}{3}\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\},\\left\\{x\\to \\fbox{$\\frac{1}{3} (2 i \\pi c_1+i \\pi )\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(sinh*(3*x), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+3 x-6 y^2+7 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x+\\frac{1}{6}\\right)^2-6 \\left(y-\\frac{7}{12}\\right)^2=-\\frac{139}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{6} & \\frac{1}{36} \\left(21-\\sqrt{2085}\\right) \\\\\n -\\frac{1}{6} & \\frac{1}{36} \\left(21+\\sqrt{2085}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{3}}$\nCenter: $\\left\\{-\\frac{1}{6},\\frac{1}{2} \\left(\\frac{1}{36} \\left(21-\\sqrt{2085}\\right)+\\frac{1}{36} \\left(21+\\sqrt{2085}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{12} \\left(7-\\sqrt{6}\\right)-\\sqrt{\\frac{3}{2}} x,y=\\sqrt{\\frac{3}{2}} x+\\frac{1}{12} \\left(7+\\sqrt{6}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+3*x-6*y**2+7*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-11 x-\\frac{9}{2}}+\\sqrt{-9 x-\\frac{3}{2}}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-163+16 \\sqrt{102}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-11*x-(9/2))+sqrt(-9*x-(3/2)), 4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{3}{125} \\left(1331 t^2+18150 t+61775\\right), x(t)=\\frac{121 t^2}{25}+66 t+225$", + "Output Answer": [ + "$y=\\frac{12}{5}-\\frac{33 x}{5}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -(3/125)*(1331*t**2+18150*t+61775)\nx_t = ((121*t**2)/25)+66*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{16-i}{\\sqrt{\\pi }}$ and $y=-\\frac{1-9 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{15+8 i}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((16-i)/(math.sqrt(math.pi)))\ny = -((1-9*i)/(math.sqrt(math.pi)))\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{28}{25}$, and $a_n=a_{n-1}+-7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$-\\frac{71862}{25}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(28/25) # initial value\nd = -7 # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(28/25) # initial value\nd = -7 # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-2 t^2-60 t-453, x(t)=t^2+30 t+225$", + "Output Answer": [ + "$y=-2 x-3$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -2*t**2-60*t-453\nx_t = t**2+30*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-8 \\sqrt{3} x+\\frac{17 y}{\\sqrt{3}}+13 \\sqrt{3} z+\\frac{28}{\\sqrt{3}}=0$, $-9 \\sqrt{3} x+10 \\sqrt{3} y-\\frac{8 z}{\\sqrt{3}}-\\frac{43}{\\sqrt{3}}=0$, $-\\frac{4 x}{\\sqrt{3}}-\\sqrt{3} y-7 \\sqrt{3} z-\\frac{8}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{2273}{1805}$, $y=\\frac{835}{361}$, $z=-\\frac{1717}{1805}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-8*sqrt(3)*x+((17*y)/(sqrt(3)))+13*sqrt(3)*z+(28/(sqrt(3))), -9*sqrt(3)*x+10*sqrt(3)*y-((8*z)/(sqrt(3)))-(43/(sqrt(3))), -((4*x)/(sqrt(3)))-sqrt(3)*y-7*sqrt(3)*z-(8/(sqrt(3))))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{3 \\left(\\cos \\left(\\frac{\\pi }{36}\\right)-i \\sin \\left(\\frac{\\pi }{36}\\right)\\right)}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $3 \\sqrt{\\frac{\\sin ^2\\left(\\frac{\\pi }{36}\\right)+\\cos ^2\\left(\\frac{\\pi }{36}\\right)}{\\pi }}$\nArgument: $-\\frac{\\pi }{36}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((3*(math.cos((math.pi/36))-i*math.sin((math.pi/36))))/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{54}{41}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$-\\frac{270}{41}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(54/41) # initial value\nd = 0 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(54/41) # initial value\nd = 0 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\log \\left(4 x-\\frac{13}{2}\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{15}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(log(4*x-(13/2)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{26}}{\\sqrt{62}}$.", + "Output Answer": [ + "$\\sqrt{\\frac{13}{31}}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(26))/(sqrt(62))))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $10 x^4-8 x^3+4 x^2+8 x+6$ and $-5 x^4+4 x^3-2 x^2-4 x-3$.", + "Output Answer": [ + "$5 x^4-4 x^3+2 x^2+4 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(10*x**4-8*x**3+4*x**2+8*x+6, -5*x**4+4*x**3-2*x**2-4*x-3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{57}{7}+\\frac{43 i}{7}$ and $y=\\frac{15}{7}+2 i$", + "Output Answer": [ + "$-6+\\frac{57 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = -(57/7)+((43*i)/7)\ny = (15/7)+2*i\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{17 x^2}{\\sqrt{2}}-\\frac{9 x}{\\sqrt{2}}+\\frac{21}{\\sqrt{2}}$", + "Output Answer": [ + "$x=\\frac{1}{34} \\left(9-i \\sqrt{1347}\\right)\\lor x=\\frac{1}{34} \\left(9+i \\sqrt{1347}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((17*x**2)/(sqrt(2)))-((9*x)/(sqrt(2)))+(21/(sqrt(2))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9-3 x}+\\sqrt{10 x-12}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{169} \\left(385-8 \\sqrt{222}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9-3*x)+sqrt(10*x-12), 4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -9 x^2+6 x+7$, $q(x) = 2 \\left(7 x^2-5 x-4\\right)$", + "Output Answer": [ + "$5 x^2-4 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**2+6*x+7\nq = 2*(7*x**2-5*x-4)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{19 x^2}{3}+\\frac{37 x}{3}-13$", + "Output Answer": [ + "$x=\\frac{1}{38} \\left(37-i \\sqrt{1595}\\right)\\lor x=\\frac{1}{38} \\left(37+i \\sqrt{1595}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((19*x**2)/3)+((37*x)/3)-13, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^2+9 x+7$ when divided by $-x^2+5 x-6$.", + "Output Answer": [ + "$-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**2+9*x+7\nq = -x**2+5*x-6\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{121}+\\left(\\sqrt{25}-\\sqrt{63}\\right)$.", + "Output Answer": [ + "$16-3 \\sqrt{7}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(121)+(sqrt(25)-sqrt(63)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{21 x^2}{\\sqrt{\\pi }}+\\frac{7 x}{\\sqrt{\\pi }}+\\frac{20}{\\sqrt{\\pi }}$ and $q(x) = \\frac{18 x^2}{\\sqrt{\\pi }}+\\frac{9 x}{\\sqrt{\\pi }}+\\frac{20}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{378 x^4}{\\pi }+\\frac{315 x^3}{\\pi }+\\frac{843 x^2}{\\pi }+\\frac{320 x}{\\pi }+\\frac{400}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((21*x**2)/(sqrt(pi)))+((7*x)/(sqrt(pi)))+(20/(sqrt(pi)))\nq = ((18*x**2)/(sqrt(pi)))+((9*x)/(sqrt(pi)))+(20/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $3 x^2-57 x+54$", + "Output Answer": [ + "$-3 (1-x) (x-18)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(3*x**2-57*x+54, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $2-12 x^2$", + "Output Answer": [ + "$2-12 x^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (2-12*x**2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\sqrt{3} \\left(\\cos \\left(\\frac{11}{90}\\right)+i \\sin \\left(\\frac{11}{90}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-442368 \\sqrt{3} \\left(\\cos \\left(\\frac{77}{90}\\right)+i \\sin \\left(\\frac{77}{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*math.sqrt(3)*(math.cos((11/90))+1j*math.sin((11/90))))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4-14 x}+\\sqrt{\\frac{19}{2}-8 x}=\\frac{17}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{72} \\left(-3245+34 \\sqrt{8698}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4-14*x)+sqrt((19/2)-8*x), (17/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-2 \\pi$ and $y=(-2+i) \\pi$", + "Output Answer": [ + "$(-4+i) \\pi$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -2*math.pi\ny = (-2+i)*math.pi\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the third order series of the inverse of the following function around 3:\n$\\log \\left(-\\frac{5 x}{2}\\right)$", + "Output Answer": [ + "$-\\frac{1}{3} (x-\\log (5))^3-(x-\\log (5))^2-2 (x-\\log (5))-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, log(-((5*x)/2)))\nprint(solve(f, x)[0].series(y, 3, 3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $10 x^2+12 x-6$", + "Output Answer": [ + "$x=\\frac{1}{5} \\left(-3-2 \\sqrt{6}\\right)\\lor x=\\frac{1}{5} \\left(2 \\sqrt{6}-3\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(10*x**2+12*x-6, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-5 \\sqrt{2} \\left(-\\sin \\left(\\frac{19 \\pi }{90}\\right)-i \\cos \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$-12500 \\sqrt{2} \\left(\\sin \\left(\\frac{\\pi }{18}\\right)+i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-5*math.sqrt(2)*(-math.sin(((19*math.pi)/90))-1j*math.cos(((19*math.pi)/90))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{2}{7} \\left(\\cos \\left(\\frac{13 \\pi }{180}\\right)+i \\sin \\left(\\frac{13 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{2}{7} \\sqrt{\\sin ^2\\left(\\frac{13 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{180}\\right)}$\nArgument: $\\frac{13 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (2/7)*(math.cos(((13*math.pi)/180))+i*math.sin(((13*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{10}{\\sqrt{3}}-5 \\sqrt{3} x$ and $q(x) = \\frac{11 x^2}{\\sqrt{3}}-\\frac{10 x}{\\sqrt{3}}+\\frac{7}{\\sqrt{3}}$", + "Output Answer": [ + "$-55 x^3+\\frac{260 x^2}{3}-\\frac{205 x}{3}+\\frac{70}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = (10/(sqrt(3)))-5*sqrt(3)*x\nq = ((11*x**2)/(sqrt(3)))-((10*x)/(sqrt(3)))+(7/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-3 x-8 y^2+2 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x-\\frac{3}{10}\\right)^2-8 \\left(y-\\frac{1}{8}\\right)^2=\\frac{253}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{40} \\left(12-\\sqrt{3289}\\right) & \\frac{1}{8} \\\\\n \\frac{1}{40} \\left(12+\\sqrt{3289}\\right) & \\frac{1}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{13}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{40} \\left(12-\\sqrt{3289}\\right)+\\frac{1}{40} \\left(12+\\sqrt{3289}\\right)\\right),\\frac{1}{8}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{2} \\sqrt{\\frac{5}{2}} x+\\frac{1}{40} \\left(5-3 \\sqrt{10}\\right),y=\\frac{1}{40} \\left(5+3 \\sqrt{10}\\right)-\\frac{1}{2} \\sqrt{\\frac{5}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-3*x-8*y**2+2*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 10 x^2+6 x+8$ and $q(x) = 10 x^2-4 x-15$", + "Output Answer": [ + "$100 x^4+20 x^3-94 x^2-122 x-120$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 10*x**2+6*x+8\nq = 10*x**2-4*x-15\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 9 x^2+12 x-14$ and $q(x) = -9 x^2-4 x+6$", + "Output Answer": [ + "$-81 x^4-144 x^3+132 x^2+128 x-84$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 9*x**2+12*x-14\nq = -9*x**2-4*x+6\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{\\frac{19+24}{16}}{10}-22\\right)-(21-19)$.", + "Output Answer": [ + "$-\\frac{3797}{160}$" + ], + "Output Program": [ + "try: \n print(((((19+24)/16)/10)-22)-(21-19))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $2 x^3-26 x^2-316 x+720$", + "Output Answer": [ + "$-2 (-x-9) (2-x) (20-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(2*x**3-26*x**2-316*x+720, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 17 \\sqrt{2} x^2+17 \\sqrt{2} x+7 \\sqrt{2}\\right| =11 \\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{34} \\left(-17-\\sqrt{561}\\right)\\right\\},\\left\\{x\\to \\frac{1}{34} \\left(-17+\\sqrt{561}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(17*sqrt(2)*x**2+17*sqrt(2)*x+7*sqrt(2)), 11*sqrt(2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{10+6 i}{\\sqrt{\\pi }}$ and $y=\\frac{13+4 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{154}{185}-\\frac{38 i}{185}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((10+6*i)/(math.sqrt(math.pi)))\ny = ((13+4*i)/(math.sqrt(math.pi)))\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-3 \\left(-\\cos \\left(\\frac{\\pi }{90}\\right)+i \\sin \\left(\\frac{\\pi }{90}\\right)\\right)$.", + "Output Answer": [ + "Norm: $3 \\sqrt{\\sin ^2\\left(\\frac{\\pi }{90}\\right)+\\cos ^2\\left(\\frac{\\pi }{90}\\right)}$\nArgument: $-\\frac{\\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -3*(-math.cos((math.pi/90))+i*math.sin((math.pi/90)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\cos \\left(\\frac{6}{5}\\right)+i \\sin \\left(\\frac{6}{5}\\right)\\right)^7$", + "Output Answer": [ + "$\\cos \\left(\\frac{42}{5}\\right)+i \\sin \\left(\\frac{42}{5}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.cos((6/5))+1j*math.sin((6/5)))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $8 x^2-\\frac{18 x}{5}+\\frac{37}{5}$", + "Output Answer": [ + "$x=\\frac{1}{40} \\left(9-i \\sqrt{1399}\\right)\\lor x=\\frac{1}{40} \\left(9+i \\sqrt{1399}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(8*x**2-((18*x)/5)+(37/5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 8 x^2+5$ and $q(x) = 8 x^2-3 x+13$", + "Output Answer": [ + "$64 x^4-24 x^3+144 x^2-15 x+65$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 8*x**2+5\nq = 8*x**2-3*x+13\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\log (-6 x-1)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(log(-6*x-1), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{25}{4}-\\frac{33 x}{4}}+\\sqrt{\\frac{27}{4}-\\frac{x}{2}}=\\frac{13}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{961} \\left(-5977+130 \\sqrt{1489}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((25/4)-((33*x)/4))+sqrt((27/4)-(x/2)), (13/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $8 x^2+16 x$ and $2 x^2+4 x$.", + "Output Answer": [ + "$2 x^2+4 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(8*x**2+16*x, 2*x**2+4*x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-40 x^2-10 x+180}{-104 x^2-146 x+198}=0$", + "Output Answer": [ + "$\\{\\{x\\to 2\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-40*x**2-10*x+180)/(-104*x**2-146*x+198)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{13 \\left(\\frac{\\sqrt{3}}{2}-\\frac{i}{2}\\right)}{\\sqrt{3}}\\right)^7$", + "Output Answer": [ + "$\\frac{62748517 \\left(-\\frac{\\sqrt{3}}{2}+\\frac{i}{2}\\right)}{27 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((13*(((math.sqrt(3))/2)-(i/2)))/(math.sqrt(3))))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 14 x^2-8 x-11$ and $q(x) = 7 x^2+x+8$", + "Output Answer": [ + "$98 x^4-42 x^3+27 x^2-75 x-88$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 14*x**2-8*x-11\nq = 7*x**2+x+8\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{12}{7}+\\frac{13 i}{7}$ and $y=-\\frac{18}{7}-\\frac{39 i}{7}$", + "Output Answer": [ + "$\\frac{291}{49}-\\frac{702 i}{49}$" + ], + "Output Program": [ + "i = 1j\nx = (12/7)+((13*i)/7)\ny = -(18/7)-((39*i)/7)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-242 x^2-187 x+289}{418 x-323}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{17}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-242*x**2-187*x+289)/(418*x-323)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{26 x^2}{5}+\\frac{49 x}{5}-\\frac{31}{5}$ and $q(x) = -\\frac{38 x^2}{5}+\\frac{72 x}{5}+\\frac{14}{5}$", + "Output Answer": [ + "$-\\frac{988 x^4}{25}+\\frac{2 x^3}{5}+\\frac{1014 x^2}{5}-\\frac{1546 x}{25}-\\frac{434}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((26*x**2)/5)+((49*x)/5)-(31/5)\nq = -((38*x**2)/5)+((72*x)/5)+(14/5)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 10 \\sqrt{5} x-10 \\sqrt{5}\\right| =-3 \\sqrt{5}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(10*sqrt(5)*x-10*sqrt(5)), -3*sqrt(5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $(-4 x-2)^5=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{2}\\right\\},\\left\\{x\\to -\\frac{1}{2}\\right\\},\\left\\{x\\to -\\frac{1}{2}\\right\\},\\left\\{x\\to -\\frac{1}{2}\\right\\},\\left\\{x\\to -\\frac{1}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve((-4*x-2)**5, x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2-16 x+306$", + "Output Answer": [ + "$2 (9-x) (x+17)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2-16*x+306, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2+8 x+5 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-4 x^2+8 x+5 y=-1$\nVertex: $\\{1,-1\\}$\nDirectrix: $y=-\\frac{21}{16}$\nFocal Parameter: $\\frac{5}{8}$\nFocus: $\\left\\{1,-\\frac{11}{16}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2+8*x+5*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{31 x^2}{\\pi }+\\frac{17 x}{\\pi }+\\frac{23}{\\pi }$ and $q(x) = \\frac{34 x^2}{\\pi }+\\frac{11 x}{\\pi }+\\frac{38}{\\pi }$", + "Output Answer": [ + "$\\frac{1054 x^4}{\\pi ^2}+\\frac{919 x^3}{\\pi ^2}+\\frac{2147 x^2}{\\pi ^2}+\\frac{899 x}{\\pi ^2}+\\frac{874}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((31*x**2)/pi)+((17*x)/pi)+(23/pi)\nq = ((34*x**2)/pi)+((11*x)/pi)+(38/pi)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{13 x^2}{5}+\\frac{7 x}{5}-\\frac{18}{5}$ and $\\frac{6 x}{5}-\\frac{22}{5}$.", + "Output Answer": [ + "$\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((13*x**2)/5)+((7*x)/5)-(18/5), ((6*x)/5)-(22/5)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2+26 x-28$", + "Output Answer": [ + "$2 (-x-14) (1-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2+26*x-28, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt[3]{\\frac{7 x}{5}+\\frac{16}{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{16}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(cbrt(((7*x)/5)+(16/5)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x-15$ and $3-x$.", + "Output Answer": [ + "$x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x-15, 3-x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^2-x$ when divided by $-8 x^2+3 x+5$.", + "Output Answer": [ + "$\\frac{5}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**2-x\nq = -8*x**2+3*x+5\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sin (8-x)=0$", + "Output Answer": [ + "$\\{\\{x\\to \\fbox{$2 \\pi c_1+8\\text{ if }c_1\\in \\mathbb{Z}$}\\},\\{x\\to \\fbox{$2 \\pi c_1+\\pi +8\\text{ if }c_1\\in \\mathbb{Z}$}\\}\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(sin(8-x), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2-2 x+5 y^2+9 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(y+\\frac{9}{10}\\right)^2-4 \\left(x+\\frac{1}{4}\\right)^2=\\frac{59}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{4} & -\\frac{3}{10} \\left(3+\\sqrt{59}\\right) \\\\\n -\\frac{1}{4} & \\frac{3}{10} \\left(\\sqrt{59}-3\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{2}$\nCenter: $\\left\\{-\\frac{1}{4},\\frac{1}{2} \\left(\\frac{3}{10} \\left(\\sqrt{59}-3\\right)-\\frac{3}{10} \\left(3+\\sqrt{59}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{10} \\left(-9-\\sqrt{5}\\right)-\\frac{2 x}{\\sqrt{5}},y=\\frac{2 x}{\\sqrt{5}}+\\frac{1}{10} \\left(\\sqrt{5}-9\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2-2*x+5*y**2+9*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{4}{5} e^{-\\frac{5 i \\pi }{9}}$.", + "Output Answer": [ + "Norm: $\\frac{4}{5}$\nArgument: $-\\frac{5 \\pi }{9}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (4/5)*math.e**(-((5*i*math.pi)/9))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -13 x^2+9 x-4$, $q(x) = -2 \\left(5 x^2+x+7\\right)$", + "Output Answer": [ + "$-23 x^2+7 x-18$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -13*x**2+9*x-4\nq = -2*(5*x**2+x+7)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-5 x-21 y+23 z+17=0$, $-3 x-23 y-10 z+21=0$, $-15 x+3 y+19 z+14=0$", + "Output Answer": [ + "$x=\\frac{13255}{10454}$, $y=\\frac{7103}{10454}$, $z=\\frac{820}{5227}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-5*x-21*y+23*z+17, -3*x-23*y-10*z+21, -15*x+3*y+19*z+14)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{9 x^2-15}{-19 x^2-19 x+20}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\sqrt{\\frac{5}{3}}\\right\\},\\left\\{x\\to \\sqrt{\\frac{5}{3}}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((9*x**2-15)/(-19*x**2-19*x+20)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\sqrt{2} \\left(\\cos \\left(\\frac{11}{18}\\right)+i \\sin \\left(\\frac{11}{18}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$2239488 \\sqrt{2} \\left(\\cos \\left(\\frac{77}{18}\\right)+i \\sin \\left(\\frac{77}{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*math.sqrt(2)*(math.cos((11/18))+1j*math.sin((11/18))))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$-\\sin ^{-1}(7 x+1) \\sin (3-7 x)$", + "Output Answer": [ + "$-\\frac{2}{7}\\leq x\\leq 0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = -asin(7*x+1)*sin(3-7*x)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 x^2+11 x+13$, $q(x) = 3 x^2-4 x-2$", + "Output Answer": [ + "$12 x^2+7 x+11$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**2+11*x+13\nq = 3*x**2-4*x-2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{16 x^2}{7}+x+\\frac{67}{7}$", + "Output Answer": [ + "$x=\\frac{1}{32} \\left(-7-3 i \\sqrt{471}\\right)\\lor x=\\frac{1}{32} \\left(-7+3 i \\sqrt{471}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((16*x**2)/7)+x+(67/7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{32}{41}$, and $a_n=a_{n-1}+-\\frac{10}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{27}{2} \\left(\\frac{64}{41}-\\frac{260}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\na = (32/41) # initial value\nd = -(10/(math.sqrt(3))) # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (32/41) # initial value\nd = -(10/(math.sqrt(3))) # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\sqrt{5} x^2-3 \\sqrt{5} x+4 \\sqrt{5}$", + "Output Answer": [ + "$x=-4\\lor x=1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-sqrt(5)*x**2-3*sqrt(5)*x+4*sqrt(5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (7 x+5)^4, q(x) = 4 (x+2)^2$", + "Output Answer": [ + "$2401 x^4+6860 x^3+7354 x^2+3516 x+641$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (7*x+5)**4\nq = 4*(x+2)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\frac{\\sqrt[3]{4 x+7}}{\\log (4-2 x)}$", + "Output Answer": [ + "$x<\\frac{3}{2}\\lor \\frac{3}{2} 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{6 x^2-18 x+8}{4-24 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(9-\\sqrt{33}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(9+\\sqrt{33}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((6*x**2-18*x+8)/(4-24*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{85}-\\sqrt{41}$.", + "Output Answer": [ + "$\\sqrt{85}-\\sqrt{41}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(85)-sqrt(41))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -7 x^2+x-12$, $q(x) = 2 \\left(5 x^2-7 x+1\\right)$", + "Output Answer": [ + "$3 x^2-13 x-10$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**2+x-12\nq = 2*(5*x**2-7*x+1)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2-4 x+7 y^2-9 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(y-\\frac{9}{14}\\right)^2-7 \\left(x+\\frac{2}{7}\\right)^2=\\frac{345}{28}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{7} & \\frac{1}{14} \\left(9-\\sqrt{690}\\right) \\\\\n -\\frac{2}{7} & \\frac{1}{14} \\left(9+\\sqrt{690}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{-\\frac{2}{7},\\frac{1}{2} \\left(\\frac{1}{14} \\left(9-\\sqrt{690}\\right)+\\frac{1}{14} \\left(9+\\sqrt{690}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{5}{14}-x,y=x+\\frac{13}{14}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2-4*x+7*y**2-9*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$e^{\\sqrt{2} \\sqrt{x}}$", + "Output Answer": [ + "$x\\geq 0$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = math.e**(sqrt(2)*sqrt(x))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{29}{3}-9 x}+\\sqrt{\\frac{19}{3}-\\frac{10 x}{3}}=2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{289} \\left(-274+4 \\sqrt{21093}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((29/3)-9*x)+sqrt((19/3)-((10*x)/3)), 2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(\\sin \\left(\\frac{2 \\pi }{45}\\right)+i \\cos \\left(\\frac{2 \\pi }{45}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$125 \\left(-\\sin \\left(\\frac{2 \\pi }{15}\\right)-i \\cos \\left(\\frac{2 \\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(math.sin(((2*math.pi)/45))+1j*math.cos(((2*math.pi)/45))))**3)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\left(\\sin \\left(\\frac{\\pi }{9}\\right)+i \\cos \\left(\\frac{\\pi }{9}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$19683 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*(math.sin((math.pi/9))+1j*math.cos((math.pi/9))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{21 x^3}{5}+\\frac{24 x^2}{5}-\\frac{46 x}{5}+\\frac{46}{5}$ when divided by $\\frac{17 x^3}{5}+8 x^2+\\frac{2 x}{5}-\\frac{9}{5}$.", + "Output Answer": [ + "$-\\frac{21}{17}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((21*x**3)/5)+((24*x**2)/5)-((46*x)/5)+(46/5)\nq = ((17*x**3)/5)+8*x**2+((2*x)/5)-(9/5)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $7 \\sqrt{3} x^2+2 \\sqrt{3} x$", + "Output Answer": [ + "$x=0\\lor x=-\\frac{2}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(7*sqrt(3)*x**2+2*sqrt(3)*x, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{19}{2} \\left(-\\sin \\left(\\frac{2 \\pi }{45}\\right)-i \\cos \\left(\\frac{2 \\pi }{45}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$\\frac{322687697779}{512} \\left(-\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(1-\\sqrt{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((19/2)*(-math.sin(((2*math.pi)/45))-1j*math.cos(((2*math.pi)/45))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{13 e^{\\frac{59 i \\pi }{180}}}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\frac{13}{\\sqrt{3}}$\nArgument: $-\\frac{121 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((13*math.e**((59*i*math.pi)/180))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{(8+13)-2}{((((15-21)-23)-14)-18)^2}$.", + "Output Answer": [ + "$\\frac{19}{3721}$" + ], + "Output Program": [ + "try: \n print((((8+13)-2)/(((((15-21)-23)-14)-18)**2)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((((7+18)-8)-3)+22)-\\frac{1}{3} (((13-12)+19)-23)$.", + "Output Answer": [ + "$37$" + ], + "Output Program": [ + "try: \n print(((((7+18)-8)-3)+22)-(1/3)*(((13-12)+19)-23))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\tan (8-4 x)+81=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{4} \\left(\\pi c_1+\\tan ^{-1}(81)+8\\right)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(tan(8-4*x)+81, x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 11 x^2-6 x+13$ and $q(x) = 6 x^2+4 x-13$", + "Output Answer": [ + "$66 x^4+8 x^3-89 x^2+130 x-169$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 11*x**2-6*x+13\nq = 6*x**2+4*x-13\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-x^2-13 x+4$", + "Output Answer": [ + "$\\frac{185}{4}-\\left(x+\\frac{13}{2}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-x**2-13*x+4), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 20 x-9| =2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{7}{20}\\right\\},\\left\\{x\\to \\frac{11}{20}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(20*x-9), 2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$-\\sin \\left(\\frac{12 x}{5}+5\\right)$", + "Output Answer": [ + "$-1\\leq y\\leq 1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(-sin(((12*x)/5)+5), x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 \\sqrt{2} x^2+\\sqrt{2} x-4 \\sqrt{2}$", + "Output Answer": [ + "$-2 \\sqrt{2} \\left(x-\\frac{1}{4}\\right)^2-4 \\sqrt{2}+\\frac{1}{4 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*math.sqrt(2)*x**2+math.sqrt(2)*x-4*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 5 \\left(2 x^2+x-2\\right)$, $q(x) = 9 x^2+9 x-3$", + "Output Answer": [ + "$19 x^2+14 x-13$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*(2*x**2+x-2)\nq = 9*x**2+9*x-3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2+x+6 y^2+2 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y+\\frac{1}{6}\\right)^2-4 \\left(x-\\frac{1}{8}\\right)^2=-\\frac{283}{48}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{24} \\left(3-\\sqrt{1415}\\right) & -\\frac{1}{6} \\\\\n \\frac{1}{24} \\left(3+\\sqrt{1415}\\right) & -\\frac{1}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{24} \\left(3-\\sqrt{1415}\\right)+\\frac{1}{24} \\left(3+\\sqrt{1415}\\right)\\right),-\\frac{1}{6}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{2}{3}} x+\\frac{1}{24} \\left(-4-\\sqrt{6}\\right),y=\\frac{1}{24} \\left(\\sqrt{6}-4\\right)-\\sqrt{\\frac{2}{3}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2+x+6*y**2+2*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 (x+2)^4, q(x) = 9 (3-2 x)^4$", + "Output Answer": [ + "$153 x^4-792 x^3+2160 x^2-1656 x+873$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*(x+2)**4\nq = 9*(3-2*x)**4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4$ and $3 x^2+x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4, 3*x**2+x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=i \\sqrt{2}$ and $y=(-6+5 i) \\sqrt{2}$", + "Output Answer": [ + "$(6-4 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = i*math.sqrt(2)\ny = (-6+5*i)*math.sqrt(2)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-10 x^2-14 x-13$", + "Output Answer": [ + "$x=-\\frac{7}{10}-\\frac{9 i}{10}\\lor x=-\\frac{7}{10}+\\frac{9 i}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-10*x**2-14*x-13, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{5}{3} \\left(-\\cos \\left(\\frac{\\pi }{90}\\right)-i \\sin \\left(\\frac{\\pi }{90}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$\\frac{244140625 \\left(\\cos \\left(\\frac{2 \\pi }{15}\\right)+i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)}{531441}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(5/3)*(-math.cos((math.pi/90))-1j*math.sin((math.pi/90))))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-12 x+20 y+2=0$, $9 x-7 y+14=0$", + "Output Answer": [ + "$x=-\\frac{49}{16}$, $y=-\\frac{31}{16}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-12*x+20*y+2, 9*x-7*y+14), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-20 x-4 y-2 z+18=0$, $8 x-22 y+14 z+2=0$, $-18 x+3 y-17 z-15=0$", + "Output Answer": [ + "$x=\\frac{916}{679}$, $y=-\\frac{680}{679}$, $z=-\\frac{1689}{679}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-20*x-4*y-2*z+18, 8*x-22*y+14*z+2, -18*x+3*y-17*z-15)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\left(\\cos \\left(\\frac{11}{30}\\right)+i \\sin \\left(\\frac{11}{30}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-19683 \\left(\\cos \\left(\\frac{33}{10}\\right)+i \\sin \\left(\\frac{33}{10}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*(math.cos((11/30))+1j*math.sin((11/30))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$18 x+2 y+15 z-11=0$, $-14 x+14 y-4 z=0$, $-8 x-10 y-15 z+21=0$", + "Output Answer": [ + "$x=-\\frac{457}{269}$, $y=-\\frac{235}{269}$, $z=\\frac{777}{269}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((18*x+2*y+15*z-11, -14*x+14*y-4*z, -8*x-10*y-15*z+21)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{53 x}{4}-\\frac{43}{4}}+\\sqrt{\\frac{41}{4}-\\frac{19 x}{4}}=\\frac{29}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-35988+29 \\sqrt{1253527}}{2312}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((53*x)/4)-(43/4))+sqrt((41/4)-((19*x)/4)), (29/4)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{11}{3} \\left(\\cos \\left(\\frac{2}{9}\\right)+i \\sin \\left(\\frac{2}{9}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$\\frac{121}{9} \\left(\\cos \\left(\\frac{4}{9}\\right)+i \\sin \\left(\\frac{4}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((11/3)*(math.cos((2/9))+1j*math.sin((2/9))))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\cos (6 x+5)$ at the point $x=-2$", + "Output Answer": [ + "$\\cos (7) = 0.754$" + ], + "Output Program": [ + "import math\n\nx = -2\ntry: \n f = math.cos(6*x+5)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5$ and $4 x^4+5 x^3+4 x+4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5, 4*x**4+5*x**3+4*x+4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $7 x-\\frac{44}{5}$ when divided by $\\frac{48}{5}$.", + "Output Answer": [ + "$\\frac{35 x}{48}-\\frac{11}{12}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x-(44/5)\nq = (48/5)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\left(\\sin \\left(\\frac{2 \\pi }{9}\\right)+i \\cos \\left(\\frac{2 \\pi }{9}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1048576 \\left(-\\cos \\left(\\frac{2 \\pi }{9}\\right)+i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*(math.sin(((2*math.pi)/9))+1j*math.cos(((2*math.pi)/9))))**10)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 (x+4)^2, q(x) = -x-2$", + "Output Answer": [ + "$4 x^2+31 x+62$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*(x+4)**2\nq = -x-2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=(113-35 t)^2, x(t)=5 t-15$", + "Output Answer": [ + "$y=49 x^2-112 x+64$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (113-35*t)**2\nx_t = 5*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2+5 x+5 y^2+2 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(y+\\frac{1}{5}\\right)^2-7 \\left(x-\\frac{5}{14}\\right)^2=-\\frac{237}{140}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{70} \\left(25-6 \\sqrt{79}\\right) & -\\frac{1}{5} \\\\\n \\frac{1}{70} \\left(25+6 \\sqrt{79}\\right) & -\\frac{1}{5} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{3}{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{70} \\left(25-6 \\sqrt{79}\\right)+\\frac{1}{70} \\left(25+6 \\sqrt{79}\\right)\\right),-\\frac{1}{5}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{7}{5}} x+\\frac{1}{70} \\left(-14-5 \\sqrt{35}\\right),y=\\frac{1}{70} \\left(5 \\sqrt{35}-14\\right)-\\sqrt{\\frac{7}{5}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2+5*x+5*y**2+2*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x+15}+\\sqrt{10 x+5}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(686-39 \\sqrt{295}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x+15)+sqrt(10*x+5), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^4-5 x^3+\\frac{19 x^2}{2}-x+\\frac{3}{2}$ when divided by $-x^4+8 x^3-9 x^2-\\frac{5 x}{2}-\\frac{19}{2}$.", + "Output Answer": [ + "$7$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**4-5*x**3+((19*x**2)/2)-x+(3/2)\nq = -x**4+8*x**3-9*x**2-((5*x)/2)-(19/2)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 x^2-5 x-12$ and $q(x) = 8 x^2-5 x+6$", + "Output Answer": [ + "$-32 x^4-20 x^3-95 x^2+30 x-72$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*x**2-5*x-12\nq = 8*x**2-5*x+6\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{10 x^2}{\\sqrt{\\pi }}-\\frac{19 x}{\\sqrt{\\pi }}-\\frac{15}{\\sqrt{\\pi }}$ and $q(x) = \\frac{2 x^2}{\\sqrt{\\pi }}-\\frac{11 x}{\\sqrt{\\pi }}-\\frac{25}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{20 x^4}{\\pi }-\\frac{148 x^3}{\\pi }-\\frac{71 x^2}{\\pi }+\\frac{640 x}{\\pi }+\\frac{375}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((10*x**2)/(sqrt(pi)))-((19*x)/(sqrt(pi)))-(15/(sqrt(pi)))\nq = ((2*x**2)/(sqrt(pi)))-((11*x)/(sqrt(pi)))-(25/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\cos (2-6 x) \\tan \\left(\\sqrt[3]{3 x+1}\\right)$ at the point $x=-4$", + "Output Answer": [ + "$-\\cos (26) \\tan \\left(\\sqrt[3]{11}\\right) = 0.845$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = -4\ntry: \n f = math.cos(2-6*x)*math.tan(np.cbrt(3*x+1))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\sin \\left(3-9 x^2\\right)$ at the point $x=3$", + "Output Answer": [ + "$\\sin (78) = 0.514$" + ], + "Output Program": [ + "import math\n\nx = 3\ntry: \n f = -math.sin(3-9*x**2)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-5 x+3 y-14 z-9=0$, $-20 x+7 y-17 z+16=0$, $22 x-14 y+11 z-2=0$", + "Output Answer": [ + "$x=\\frac{3963}{1421}$, $y=\\frac{5044}{1421}$, $z=-\\frac{1248}{1421}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-5*x+3*y-14*z-9, -20*x+7*y-17*z+16, 22*x-14*y+11*z-2)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\sqrt{3} \\left(x^2-6 x+1\\right)$, $q(x) = \\sqrt{3} \\left(2 x^2-3 x-6\\right)$", + "Output Answer": [ + "$\\sqrt{3} x^2+3 \\sqrt{3} x-7 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -sqrt(3)*(x**2-6*x+1)\nq = sqrt(3)*(2*x**2-3*x-6)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{31}{3}-\\frac{37 x}{3}}+2 \\sqrt{\\frac{11}{3}}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{37} \\left(-313+40 \\sqrt{33}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((31/3)-((37*x)/3))+2*sqrt((11/3)), 10), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -13 x^2+x+12$ and $q(x) = -5 x^2+12 x+12$", + "Output Answer": [ + "$65 x^4-161 x^3-204 x^2+156 x+144$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -13*x**2+x+12\nq = -5*x**2+12*x+12\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{11 x^2-5 x-1}{16-14 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{22} \\left(5-\\sqrt{69}\\right)\\right\\},\\left\\{x\\to \\frac{1}{22} \\left(5+\\sqrt{69}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((11*x**2-5*x-1)/(16-14*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $6 x^2-8 x+2$ and $3 x-1$.", + "Output Answer": [ + "$3 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(6*x**2-8*x+2, 3*x-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $3 \\sqrt{5} x^2-\\sqrt{5} x-4 \\sqrt{5}$", + "Output Answer": [ + "$3 \\sqrt{5} \\left(x-\\frac{1}{6}\\right)^2-\\frac{49 \\sqrt{5}}{12}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (3*math.sqrt(5)*x**2-math.sqrt(5)*x-4*math.sqrt(5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{41}{7}$, and $a_n=a_{n-1}+-\\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=17$.", + "Output Answer": [ + "$\\frac{17}{2} \\left(\\frac{82}{7}-16 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\na = (41/7) # initial value\nd = -math.sqrt(2) # second term\nn = 17 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (41/7) # initial value\nd = -math.sqrt(2) # second term\nn = 17 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 2 \\sqrt{2} (x-5)^3, q(x) = 4 (5-2 x)^4$", + "Output Answer": [ + "$64 x^4+2 \\sqrt{2} x^3-640 x^3-30 \\sqrt{2} x^2+2400 x^2+150 \\sqrt{2} x-4000 x-250 \\sqrt{2}+2500$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*sqrt(2)*(x-5)**3\nq = 4*(5-2*x)**4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$6 \\sqrt{2} x-15 \\sqrt{2} y+5 \\sqrt{2}=0$, $15 \\sqrt{2} x-12 \\sqrt{2} y-8 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{20}{17}$, $y=\\frac{41}{51}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((6*sqrt(2)*x-15*sqrt(2)*y+5*sqrt(2), 15*sqrt(2)*x-12*sqrt(2)*y-8*sqrt(2)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{80 x^2-484 x+24}{72 x^2-396 x-216}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{20}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((80*x**2-484*x+24)/(72*x**2-396*x-216)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{3}{58}$, and $a_n=a_{n-1}+-\\frac{8}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$-\\frac{35631}{145}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(3/58) # initial value\nd = -(8/5) # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(3/58) # initial value\nd = -(8/5) # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $12 x^3+3 x^2+12 x+12$ and $-4 x^3-x^2-4 x-4$.", + "Output Answer": [ + "$4 x^3+x^2+4 x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(12*x**3+3*x**2+12*x+12, -4*x**3-x**2-4*x-4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $4 \\left(-\\sin \\left(\\frac{19 \\pi }{180}\\right)-i \\cos \\left(\\frac{19 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $4 \\sqrt{\\sin ^2\\left(\\frac{19 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{19 \\pi }{180}\\right)}$\nArgument: $-\\frac{109 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 4*(-math.sin(((19*math.pi)/180))-i*math.cos(((19*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{7 \\left(\\cos \\left(\\frac{11 \\pi }{90}\\right)-i \\sin \\left(\\frac{11 \\pi }{90}\\right)\\right)}{\\sqrt{3}}\\right)^3$", + "Output Answer": [ + "$\\frac{343 \\left(\\sin \\left(\\frac{2 \\pi }{15}\\right)-i \\cos \\left(\\frac{2 \\pi }{15}\\right)\\right)}{3 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((7*(math.cos(((11*math.pi)/90))-1j*math.sin(((11*math.pi)/90))))/(math.sqrt(3))))**3)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -3 e x^2-5 e x-3 e$ and $q(x) = 4 e x^2-2 e x+2 e$", + "Output Answer": [ + "$-12 e^2 x^4-14 e^2 x^3-8 e^2 x^2-4 e^2 x-6 e^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -3*math.e*x**2-5*math.e*x-3*math.e\nq = 4*math.e*x**2-2*math.e*x+2*math.e\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -9.9 x^2+2.7 x+12.3$, $q(x) = -11.4 x^2+13.7 x+4.2$", + "Output Answer": [ + "$-21.3 x^2+16.4 x+16.5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9.9*x**2+2.7*x+12.3\nq = -11.4*x**2+13.7*x+4.2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{23}{21}$, and $a_n=a_{n-1}+2 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$\\frac{5}{2} \\left(8 \\sqrt{5}-\\frac{46}{21}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(23/21) # initial value\nd = 2*math.sqrt(5) # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(23/21) # initial value\nd = 2*math.sqrt(5) # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+4 y^2+10 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $7 x^2+4 \\left(y+\\frac{5}{4}\\right)^2=\\frac{29}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n 0 & -\\frac{5}{4}-\\frac{\\sqrt{\\frac{87}{7}}}{4} \\\\\n 0 & \\frac{1}{28} \\left(\\sqrt{609}-35\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{7}}$\nCenter: $\\left\\{0,\\frac{1}{2} \\left(-\\frac{5}{4}-\\frac{\\sqrt{\\frac{87}{7}}}{4}+\\frac{1}{28} \\left(\\sqrt{609}-35\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{29 \\pi }{8 \\sqrt{7}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+4*y**2+10*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{2-4 i}{\\sqrt{3}}$ and $y=\\frac{2+i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{8}{3}-2 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((2-4*i)/(math.sqrt(3)))\ny = ((2+i)/(math.sqrt(3)))\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-10 y-13 z-10=0$, $12 x-18 y-z-13=0$, $9 x+13 y+6 z+9=0$", + "Output Answer": [ + "$x=\\frac{117}{1108}$, $y=-\\frac{705}{1108}$, $z=-\\frac{155}{554}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-10*y-13*z-10, 12*x-18*y-z-13, 9*x+13*y+6*z+9)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{11 x^4}{2}-6 x^3-\\frac{17 x^2}{2}-3 x-7$ when divided by $-\\frac{x^3}{2}+\\frac{9 x^2}{2}-\\frac{x}{2}+\\frac{5}{2}$.", + "Output Answer": [ + "$-11 x-87$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((11*x**4)/2)-6*x**3-((17*x**2)/2)-3*x-7\nq = -((x**3)/2)+((9*x**2)/2)-(x/2)+(5/2)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -11 x^2-4 x+7$, $q(x) = 9 x^2+7 x-5$", + "Output Answer": [ + "$-2 x^2+3 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -11*x**2-4*x+7\nq = 9*x**2+7*x-5\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^6-6 x^5-4 x^3+8 x^2-3 x-9$ when divided by $x^4-9 x^3-1$.", + "Output Answer": [ + "$8 x^2+66 x+594$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**6-6*x**5-4*x**3+8*x**2-3*x-9\nq = x**4-9*x**3-1\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+3 x+7 y^2-6 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $6 \\left(x+\\frac{1}{4}\\right)^2+7 \\left(y-\\frac{3}{7}\\right)^2=\\frac{597}{56}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{28} \\left(-7-\\sqrt{199}\\right) & \\frac{3}{7} \\\\\n \\frac{1}{28} \\left(\\sqrt{199}-7\\right) & \\frac{3}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{28} \\left(-7-\\sqrt{199}\\right)+\\frac{1}{28} \\left(\\sqrt{199}-7\\right)\\right),\\frac{3}{7}\\right\\}$\nArea Enclosed: $\\frac{199}{56} \\sqrt{\\frac{3}{14}} \\pi$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+3*x+7*y**2-6*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^3-9 x^2-4 x-8$ when divided by $2-9 x$.", + "Output Answer": [ + "$-\\frac{5 x^2}{9}+\\frac{71 x}{81}+\\frac{466}{729}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**3-9*x**2-4*x-8\nq = 2-9*x\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{23}{2}-\\frac{19 x}{2}}+\\sqrt{\\frac{5}{2}-x}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{289} \\left(-1206+12 \\sqrt{7138}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((23/2)-((19*x)/2))+sqrt((5/2)-x), 6), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\frac{\\cos (5 x+3)}{\\left(-7 x^4-8\\right)^2}$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = ((cos(5*x+3))/((-7*x**4-8)**2))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $8 x^4+4 x^3-5 x^2-3 x+2$ when divided by $4 x^2+5 x-2$.", + "Output Answer": [ + "$2 x^2-\\frac{3 x}{2}+\\frac{13}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**4+4*x**3-5*x**2-3*x+2\nq = 4*x**2+5*x-2\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-2 (9 t+49), x(t)=-3 t-15$", + "Output Answer": [ + "$y=6 x-8$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -2*(9*t+49)\nx_t = -3*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{5}}, \\frac{1}{5}, 5)$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{631}}{5},\\tan ^{-1}\\left(\\frac{\\sqrt{6}}{25}\\right),\\tan ^{-1}\\left(\\frac{1}{\\sqrt{5}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(5)))\ny = (1/5)\nz = 5\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{25 x^2+23 x}{-2 x^2+16 x-22}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{23}{25}\\right\\},\\{x\\to 0\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((25*x**2+23*x)/(-2*x**2+16*x-22)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{5 \\sqrt{5} x+2 \\sqrt{5}}{8 \\sqrt{5} x-4 \\sqrt{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{2}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((5*sqrt(5)*x+2*sqrt(5))/(8*sqrt(5)*x-4*sqrt(5))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-7 x^2+\\frac{385 x}{\\sqrt{3}}-\\frac{5152}{3}$", + "Output Answer": [ + "$-7 \\left(\\frac{23}{\\sqrt{3}}-x\\right) \\left(\\frac{32}{\\sqrt{3}}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-7*x**2+((385*x)/(sqrt(3)))-(5152/3), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\sqrt{3} \\left(-\\sin \\left(\\frac{\\pi }{15}\\right)-i \\cos \\left(\\frac{\\pi }{15}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$5308416 \\left(-\\sin \\left(\\frac{\\pi }{30}\\right)-i \\cos \\left(\\frac{\\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*math.sqrt(3)*(-math.sin((math.pi/15))-1j*math.cos((math.pi/15))))**8)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-6 x^2+2 x-8$ and $-2$.", + "Output Answer": [ + "$2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-6*x**2+2*x-8, -2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $7 x^2-\\frac{329 x}{3}+\\frac{3724}{9}$", + "Output Answer": [ + "$-7 \\left(\\frac{28}{3}-x\\right) \\left(x-\\frac{19}{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(7*x**2-((329*x)/3)+(3724/9), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$23 x-20 y+6 z+16=0$, $-20 x+20 y+19 z-9=0$, $5 x+2 y-4 z+4=0$", + "Output Answer": [ + "$x=-\\frac{1638}{1927}$, $y=-\\frac{445}{1927}$, $z=-\\frac{343}{1927}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((23*x-20*y+6*z+16, -20*x+20*y+19*z-9, 5*x+2*y-4*z+4)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-6 x^2-\\frac{24 x}{5}+174$", + "Output Answer": [ + "$-6 (x-5) \\left(x+\\frac{29}{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-6*x**2-((24*x)/5)+174, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 \\sqrt{3} x^2+4 \\sqrt{3} x-2 \\sqrt{3}$ and $q(x) = -3 \\sqrt{3} x^2-5 \\sqrt{3} x+4 \\sqrt{3}$", + "Output Answer": [ + "$45 x^4+39 x^3-102 x^2+78 x-24$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -5*sqrt(3)*x**2+4*sqrt(3)*x-2*sqrt(3)\nq = -3*sqrt(3)*x**2-5*sqrt(3)*x+4*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x-3 y^2+y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $5 x-3 y^2+y=-6$\nVertex: $\\left\\{-\\frac{73}{60},\\frac{1}{6}\\right\\}$\nDirectrix: $x=-\\frac{49}{30}$\nFocal Parameter: $\\frac{5}{6}$\nFocus: $\\left\\{-\\frac{4}{5},\\frac{1}{6}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x-3*y**2+y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 12 x^2+3 x+10\\right| =14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{24} \\left(-3-\\sqrt{201}\\right)\\right\\},\\left\\{x\\to \\frac{1}{24} \\left(-3+\\sqrt{201}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(12*x**2+3*x+10), 14), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\left(\\cos \\left(\\frac{143}{90}\\right)+i \\sin \\left(\\frac{143}{90}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-279936 \\left(\\cos \\left(\\frac{1001}{90}\\right)+i \\sin \\left(\\frac{1001}{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*(math.cos((143/90))+1j*math.sin((143/90))))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{76 x}{7}-\\frac{81}{7}}+\\sqrt{12-\\frac{44 x}{7}}=\\frac{104}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{224} \\left(-41715+52 \\sqrt{599954}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((76*x)/7)-(81/7))+sqrt(12-((44*x)/7)), (104/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{3 x^2}{2}+7 x+\\frac{9}{2}$ and $q(x) = 5 x^2+8 x-4$", + "Output Answer": [ + "$-\\frac{15 x^4}{2}+23 x^3+\\frac{169 x^2}{2}+8 x-18$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((3*x**2)/2)+7*x+(9/2)\nq = 5*x**2+8*x-4\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-2 x^2+x+4$", + "Output Answer": [ + "$x=\\frac{1}{4} \\left(1-\\sqrt{33}\\right)\\lor x=\\frac{1}{4} \\left(1+\\sqrt{33}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-2*x**2+x+4, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{3}, 3, 8)$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{658}}{3},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{41}{2}}}{12}\\right),\\tan ^{-1}(9)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/3)\ny = 3\nz = 8\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{44 x^4}{25}-\\frac{104 x^3}{25}+\\frac{208 x^2}{25}+\\frac{48 x}{25}+\\frac{144}{25}$ and $-\\frac{2 x^2}{5}-\\frac{4 x}{5}+\\frac{12}{5}$.", + "Output Answer": [ + "$\\frac{2 x^2}{25}+\\frac{4 x}{25}-\\frac{12}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((44*x**4)/25)-((104*x**3)/25)+((208*x**2)/25)+((48*x)/25)+(144/25), -((2*x**2)/5)-((4*x)/5)+(12/5)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-108 x^2-162 x-54}{-24 x-24}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{2}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-108*x**2-162*x-54)/(-24*x-24)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((16-19)+24)+(((3+10)-24)-7)$.", + "Output Answer": [ + "$3$" + ], + "Output Program": [ + "try: \n print(((16-19)+24)+(((3+10)-24)-7))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2+\\frac{244 x}{5}+194$", + "Output Answer": [ + "$-2 (-x-5) \\left(x+\\frac{97}{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2+((244*x)/5)+194, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{2 x^2}{5}+\\frac{57 x}{5}+\\frac{59}{5}$ and $q(x) = \\frac{21 x^2}{5}-5 x+\\frac{59}{5}$", + "Output Answer": [ + "$\\frac{42 x^4}{25}+\\frac{1147 x^3}{25}-\\frac{68 x^2}{25}+\\frac{1888 x}{25}+\\frac{3481}{25}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((2*x**2)/5)+((57*x)/5)+(59/5)\nq = ((21*x**2)/5)-5*x+(59/5)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{83}{41}$, and $a_n=a_{n-1}+-3 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$2 \\left(-\\frac{166}{41}-9 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(83/41) # initial value\nd = -3*math.sqrt(2) # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(83/41) # initial value\nd = -3*math.sqrt(2) # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{26}{59}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$-\\frac{624}{59}$" + ], + "Output Program": [ + "a = -(26/59) # initial value\nd = 0 # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(26/59) # initial value\nd = 0 # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=2 \\left(256 t^2+960 t+899\\right), x(t)=64 t^2+240 t+225$", + "Output Answer": [ + "$y=8 x-2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 2*(256*t**2+960*t+899)\nx_t = 64*t**2+240*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-2 x^2+2 x+5 y^2+5 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(y+\\frac{1}{2}\\right)^2-2 \\left(x-\\frac{1}{2}\\right)^2=\\frac{31}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & \\frac{1}{20} \\left(-10-\\sqrt{2170}\\right) \\\\\n \\frac{1}{2} & \\frac{1}{20} \\left(\\sqrt{2170}-10\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{2}}$\nCenter: $\\left\\{\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{20} \\left(-10-\\sqrt{2170}\\right)+\\frac{1}{20} \\left(\\sqrt{2170}-10\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{10} \\left(\\sqrt{10}-5\\right)-\\sqrt{\\frac{2}{5}} x,y=\\sqrt{\\frac{2}{5}} x+\\frac{1}{10} \\left(-5-\\sqrt{10}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x**2+2*x+5*y**2+5*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-462 x^2+502 x-136}{252 x-144}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{17}{33}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-462*x**2+502*x-136)/(252*x-144)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^3-3 x^2+8 x-5$ when divided by $5-2 x$.", + "Output Answer": [ + "$x^2+4 x+6$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**3-3*x**2+8*x-5\nq = 5-2*x\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\sqrt{2} x^2+4 \\sqrt{2} x-10 \\sqrt{2}$ and $q(x) = 5 \\sqrt{2} x^2-10 \\sqrt{2} x-4 \\sqrt{2}$", + "Output Answer": [ + "$-10 x^4+60 x^3-172 x^2+168 x+80$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -sqrt(2)*x**2+4*sqrt(2)*x-10*sqrt(2)\nq = 5*sqrt(2)*x**2-10*sqrt(2)*x-4*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -3 \\pi x^2+2 \\pi x+4 \\pi$ and $q(x) = -3 \\pi x^2-4 \\pi x+3 \\pi$", + "Output Answer": [ + "$9 \\pi ^2 x^4+6 \\pi ^2 x^3-29 \\pi ^2 x^2-10 \\pi ^2 x+12 \\pi ^2$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -3*pi*x**2+2*pi*x+4*pi\nq = -3*pi*x**2-4*pi*x+3*pi\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2 \\sqrt{2} \\left(\\cos \\left(\\frac{\\pi }{60}\\right)+i \\sin \\left(\\frac{\\pi }{60}\\right)\\right)$.", + "Output Answer": [ + "Norm: $2 \\sqrt{2 \\left(\\sin ^2\\left(\\frac{\\pi }{60}\\right)+\\cos ^2\\left(\\frac{\\pi }{60}\\right)\\right)}$\nArgument: $\\frac{\\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2*math.sqrt(2)*(math.cos((math.pi/60))+i*math.sin((math.pi/60)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{7 x^2}{\\sqrt{\\pi }}+\\frac{12 x}{\\sqrt{\\pi }}+\\frac{15}{\\sqrt{\\pi }}$ and $q(x) = \\frac{21 x^2}{\\sqrt{\\pi }}-\\frac{13 x}{\\sqrt{\\pi }}+\\frac{21}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{147 x^4}{\\pi }+\\frac{161 x^3}{\\pi }+\\frac{306 x^2}{\\pi }+\\frac{57 x}{\\pi }+\\frac{315}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((7*x**2)/(sqrt(pi)))+((12*x)/(sqrt(pi)))+(15/(sqrt(pi)))\nq = ((21*x**2)/(sqrt(pi)))-((13*x)/(sqrt(pi)))+(21/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x+3$ and $x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x+3, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(15+16)+(17+4)$.", + "Output Answer": [ + "$52$" + ], + "Output Program": [ + "try: \n print((15+16)+(17+4))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x-4 y^2-8 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $5 x-4 y^2-8 y=1$\nVertex: $\\left\\{-\\frac{3}{5},-1\\right\\}$\nDirectrix: $x=-\\frac{73}{80}$\nFocal Parameter: $\\frac{5}{8}$\nFocus: $\\left\\{-\\frac{23}{80},-1\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x-4*y**2-8*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(3+3 i) \\pi$ and $y=(1+2 i) \\pi$", + "Output Answer": [ + "$(2+i) \\pi$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (3+3*i)*math.pi\ny = (1+2*i)*math.pi\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11-12 x}+\\sqrt{14} \\sqrt{-x}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -1104+65 \\sqrt{287}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11-12*x)+sqrt(14)*sqrt(-x), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{7}, 2, \\frac{1}{5})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{4974}}{35},\\tan ^{-1}\\left(\\frac{5 \\sqrt{197}}{7}\\right),\\tan ^{-1}(14)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/7)\ny = 2\nz = (1/5)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-2 x^2+3 x+4 y^2+5 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(y+\\frac{5}{8}\\right)^2-2 \\left(x-\\frac{3}{4}\\right)^2=\\frac{119}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{4} & \\frac{1}{8} \\left(-5-\\sqrt{357}\\right) \\\\\n \\frac{3}{4} & \\frac{1}{8} \\left(\\sqrt{357}-5\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{3}$\nCenter: $\\left\\{\\frac{3}{4},\\frac{1}{2} \\left(\\frac{1}{8} \\left(-5-\\sqrt{357}\\right)+\\frac{1}{8} \\left(\\sqrt{357}-5\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{8} \\left(3 \\sqrt{2}-5\\right)-\\frac{x}{\\sqrt{2}},y=\\frac{x}{\\sqrt{2}}+\\frac{1}{8} \\left(-5-3 \\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x**2+3*x+4*y**2+5*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-20 x-22=0$, $23 x-21 y-11=0$", + "Output Answer": [ + "$x=-\\frac{11}{10}$, $y=-\\frac{121}{70}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-20*x-22, 23*x-21*y-11), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$7 x-22 y-11 z+4=0$, $11 x-16 y+2 z+11=0$, $-16 x-15 y-24 z-7=0$", + "Output Answer": [ + "$x=\\frac{797}{2425}$, $y=\\frac{1911}{2425}$, $z=-\\frac{2433}{2425}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((7*x-22*y-11*z+4, 11*x-16*y+2*z+11, -16*x-15*y-24*z-7)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $x^5+9 x^4+2 x^3+5 x+3$ when divided by $-7 x^5+3 x^4-6 x^3+2 x^2-5 x+1$.", + "Output Answer": [ + "$-\\frac{1}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**5+9*x**4+2*x**3+5*x+3\nq = -7*x**5+3*x**4-6*x**3+2*x**2-5*x+1\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^3-2 x^2-3 x-1$ when divided by $x^3-7 x+3$.", + "Output Answer": [ + "$-9$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**3-2*x**2-3*x-1\nq = x**3-7*x+3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| x^2-16 x+16\\right| =2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 8-5 \\sqrt{2}\\right\\},\\left\\{x\\to 8+5 \\sqrt{2}\\right\\},\\left\\{x\\to 8-\\sqrt{46}\\right\\},\\left\\{x\\to 8+\\sqrt{46}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(x**2-16*x+16), 2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-6 \\sqrt{3} x+6 \\sqrt{3} y+3 \\sqrt{3} z-12 \\sqrt{3}=0$, $-4 \\sqrt{3} x+10 \\sqrt{3} y-12 \\sqrt{3} z+2 \\sqrt{3}=0$, $11 \\sqrt{3} x+8 \\sqrt{3} y+3 \\sqrt{3} z-7 \\sqrt{3}=0$", + "Output Answer": [ + "$x=-\\frac{131}{317}$, $y=\\frac{321}{317}$, $z=\\frac{364}{317}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-6*sqrt(3)*x+6*sqrt(3)*y+3*sqrt(3)*z-12*sqrt(3), -4*sqrt(3)*x+10*sqrt(3)*y-12*sqrt(3)*z+2*sqrt(3), 11*sqrt(3)*x+8*sqrt(3)*y+3*sqrt(3)*z-7*sqrt(3))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -10 x^2-7 x+11$ and $q(x) = 2 x^2+14 x-10$", + "Output Answer": [ + "$-20 x^4-154 x^3+24 x^2+224 x-110$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -10*x**2-7*x+11\nq = 2*x**2+14*x-10\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\frac{28 x}{5}-\\frac{23}{5}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{23}{28}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(((28*x)/5)-(23/5), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{49 x^7}{9}-\\frac{56 x^6}{3}+\\frac{109 x^5}{9}-\\frac{38 x^4}{9}+\\frac{58 x^3}{3}+8 x+2$ and $-\\frac{7 x^5}{3}+4 x^4+\\frac{2 x^3}{3}+\\frac{14 x^2}{3}+2$.", + "Output Answer": [ + "$\\frac{7 x^5}{9}-\\frac{4 x^4}{3}-\\frac{2 x^3}{9}-\\frac{14 x^2}{9}-\\frac{2}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((49*x**7)/9)-((56*x**6)/3)+((109*x**5)/9)-((38*x**4)/9)+((58*x**3)/3)+8*x+2, -((7*x**5)/3)+4*x**4+((2*x**3)/3)+((14*x**2)/3)+2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{11 \\left(\\cos \\left(\\frac{143}{90}\\right)+i \\sin \\left(\\frac{143}{90}\\right)\\right)}{\\sqrt{2}}\\right)^9$", + "Output Answer": [ + "$-\\frac{2357947691 \\left(\\cos \\left(\\frac{143}{10}\\right)+i \\sin \\left(\\frac{143}{10}\\right)\\right)}{16 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((11*(math.cos((143/90))+1j*math.sin((143/90))))/(math.sqrt(2))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{1}{4} \\left(\\cos \\left(\\frac{25}{18}\\right)+i \\sin \\left(\\frac{25}{18}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$\\frac{\\cos \\left(\\frac{25}{2}\\right)+i \\sin \\left(\\frac{25}{2}\\right)}{262144}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((1/4)*(math.cos((25/18))+1j*math.sin((25/18))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -13 x^2-10 x-5$ and $q(x) = 4 x^2-x+7$", + "Output Answer": [ + "$-52 x^4-27 x^3-101 x^2-65 x-35$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -13*x**2-10*x-5\nq = 4*x**2-x+7\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^3-6 x^2+6 x-8$ when divided by $9 x^3+8 x^2+3 x+8$.", + "Output Answer": [ + "$-\\frac{2}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**3-6*x**2+6*x-8\nq = 9*x**3+8*x**2+3*x+8\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{138}+\\left(\\sqrt{42}+22\\right)$.", + "Output Answer": [ + "$22+\\sqrt{42}+\\sqrt{138}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(138)+(sqrt(42)+22))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{5}{63}$, and $a_n=a_{n-1}+\\frac{40}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{19745}{63}$" + ], + "Output Program": [ + "a = -(5/63) # initial value\nd = (40/7) # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(5/63) # initial value\nd = (40/7) # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((13+10)+1)-25)-((12+17)-19)$.", + "Output Answer": [ + "$-11$" + ], + "Output Program": [ + "try: \n print((((13+10)+1)-25)-((12+17)-19))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{14 \\left(-\\sin \\left(\\frac{13 \\pi }{90}\\right)-i \\cos \\left(\\frac{13 \\pi }{90}\\right)\\right)}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{14 \\sqrt{\\sin ^2\\left(\\frac{13 \\pi }{90}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{90}\\right)}}{\\pi }$\nArgument: $\\frac{16 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((14*(-math.sin(((13*math.pi)/90))-i*math.cos(((13*math.pi)/90))))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2+2 x+8 y^2+8 y+10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y+\\frac{1}{2}\\right)^2-9 \\left(x-\\frac{1}{9}\\right)^2=-\\frac{73}{9}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{36} \\left(4-\\sqrt{2482}\\right) & -\\frac{1}{2} \\\\\n \\frac{1}{36} \\left(4+\\sqrt{2482}\\right) & -\\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{17}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{36} \\left(4-\\sqrt{2482}\\right)+\\frac{1}{36} \\left(4+\\sqrt{2482}\\right)\\right),-\\frac{1}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3 x}{2 \\sqrt{2}}+\\frac{1}{12} \\left(-6-\\sqrt{2}\\right),y=\\frac{1}{12} \\left(\\sqrt{2}-6\\right)-\\frac{3 x}{2 \\sqrt{2}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2+2*x+8*y**2+8*y+10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\left(\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(1+\\sqrt{5}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$9 \\left(\\frac{1}{4} \\left(1-\\sqrt{5}\\right)+i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*(math.sqrt((5/8)-((math.sqrt(5))/8))+(1/4)*1j*(1+math.sqrt(5))))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt[3]{-7 x-4}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{4}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(cbrt(-7*x-4), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{3}, \\frac{1}{2}, 4)$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{589}}{6},\\tan ^{-1}\\left(\\frac{\\sqrt{13}}{24}\\right),\\tan ^{-1}\\left(\\frac{3}{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/3)\ny = (1/2)\nz = 4\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$16 x-15 y+15=0$, $13 x+11 y+23=0$", + "Output Answer": [ + "$x=-\\frac{510}{371}$, $y=-\\frac{173}{371}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((16*x-15*y+15, 13*x+11*y+23), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sin ^{-1}\\left(\\frac{19}{3}-\\frac{26 x}{3}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{26} (19-3 \\sin (y))\\text{ if }-\\frac{\\pi }{2}\\leq y\\leq \\frac{\\pi }{2}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, asin((19/3)-((26*x)/3)))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{68 x^6}{25}-\\frac{84 x^5}{5}-\\frac{79 x^4}{5}-\\frac{92 x^3}{25}-\\frac{261 x^2}{25}-\\frac{7 x}{25}+\\frac{1}{25}$ and $\\frac{17 x^4}{5}+4 x^3+\\frac{3 x^2}{5}+\\frac{13 x}{5}+\\frac{1}{5}$.", + "Output Answer": [ + "$\\frac{17 x^4}{25}+\\frac{4 x^3}{5}+\\frac{3 x^2}{25}+\\frac{13 x}{25}+\\frac{1}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((68*x**6)/25)-((84*x**5)/5)-((79*x**4)/5)-((92*x**3)/25)-((261*x**2)/25)-((7*x)/25)+(1/25), ((17*x**4)/5)+4*x**3+((3*x**2)/5)+((13*x)/5)+(1/5)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{7 x^2}{\\sqrt{2}}+\\sqrt{2} x+7 \\sqrt{2}$", + "Output Answer": [ + "$x=-\\frac{-\\sqrt{2}-3 \\sqrt{22}}{7 \\sqrt{2}}\\lor x=-\\frac{3 \\sqrt{22}-\\sqrt{2}}{7 \\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((7*x**2)/(sqrt(2)))+sqrt(2)*x+7*sqrt(2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 23 x-5| =21$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{16}{23}\\right\\},\\left\\{x\\to \\frac{26}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(23*x-5), 21), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{49 x}{2}+\\frac{73}{4}\\right| =\\frac{87}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{80}{49}\\right\\},\\left\\{x\\to \\frac{1}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((49*x)/2)+(73/4)), (87/4)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$4 x-20 y-3 z-7=0$, $22 x-5 y-19 z+7=0$, $-20 x+15 y-6 z+19=0$", + "Output Answer": [ + "$x=\\frac{715}{1934}$, $y=-\\frac{1991}{4835}$, $z=\\frac{875}{967}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((4*x-20*y-3*z-7, 22*x-5*y-19*z+7, -20*x+15*y-6*z+19)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\cos \\left(\\frac{22}{15}\\right)+i \\sin \\left(\\frac{22}{15}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$1977326743 \\left(\\cos \\left(\\frac{242}{15}\\right)+i \\sin \\left(\\frac{242}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.cos((22/15))+1j*math.sin((22/15))))**11)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -17 x^2 \\log (2)+x \\log (2)-7 \\log (2)$ and $q(x) = -2 x^2 \\log (2)-16 x \\log (2)-6 \\log (2)$", + "Output Answer": [ + "$34 x^4 \\log ^2(2)+270 x^3 \\log ^2(2)+100 x^2 \\log ^2(2)+106 x \\log ^2(2)+42 \\log ^2(2)$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -17*x**2*log(2)+x*log(2)-7*log(2)\nq = -2*x**2*log(2)-16*x*log(2)-6*log(2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 7 x^2-11 x+10$ and $q(x) = -5 x^2+9 x+14$", + "Output Answer": [ + "$-35 x^4+118 x^3-51 x^2-64 x+140$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 7*x**2-11*x+10\nq = -5*x**2+9*x+14\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^5-2 x^4-7 x^3+10 x^2-6 x$ when divided by $-9 x^4+5 x^3-8 x^2+4 x+3$.", + "Output Answer": [ + "$\\frac{2 x}{3}+\\frac{16}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**5-2*x**4-7*x**3+10*x**2-6*x\nq = -9*x**4+5*x**3-8*x**2+4*x+3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{22 x^2}{\\sqrt{3}}-3 \\sqrt{3} x-\\frac{7}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{22 \\left(x+\\frac{9}{44}\\right)^2}{\\sqrt{3}}+\\frac{27 \\sqrt{3}}{88}-\\frac{7}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((22*x**2)/(math.sqrt(3)))-3*math.sqrt(3)*x-(7/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((10-6)+7)+\\left(\\left(\\left(\\frac{7}{14}+1\\right)+12\\right)-24\\right)$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "try: \n print(((10-6)+7)+((((7/14)+1)+12)-24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{7-6 i}{\\sqrt{3}}$ and $y=-\\frac{14+5 i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{4}{13}-\\frac{7 i}{13}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((7-6*i)/(math.sqrt(3)))\ny = -((14+5*i)/(math.sqrt(3)))\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{14 x^2}{\\sqrt{3}}+\\frac{22 x}{\\sqrt{3}}+\\frac{1}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{14} \\left(-11-\\sqrt{107}\\right)\\lor x=\\frac{1}{14} \\left(\\sqrt{107}-11\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((14*x**2)/(sqrt(3)))+((22*x)/(sqrt(3)))+(1/(sqrt(3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{2 x^2}{\\sqrt{3}}+4 \\sqrt{3} x-6 \\sqrt{3}$", + "Output Answer": [ + "$x=3\\lor x=3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((2*x**2)/(sqrt(3)))+4*sqrt(3)*x-6*sqrt(3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 16 x^2-10 x-2\\right| =4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{8}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(16*x**2-10*x-2), 4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-9 x^3+99 x^2+2290 x-25568$", + "Output Answer": [ + "$-9 \\left(x-\\frac{47}{3}\\right) \\left(x-\\frac{34}{3}\\right) (x+16)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-9*x**3+99*x**2+2290*x-25568, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left(\\frac{2}{20}-22\\right)+24\\right)+4\\right)^2-(1-17)$.", + "Output Answer": [ + "$\\frac{5321}{100}$" + ], + "Output Program": [ + "try: \n print(((((2/20)-22)+24)+4)**2-(1-17))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-4 x^2-6 x-8$", + "Output Answer": [ + "$-4 \\left(x+\\frac{3}{4}\\right)^2-\\frac{23}{4}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-4*x**2-6*x-8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\log (7-2 x)$", + "Output Answer": [ + "$y\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(log(7-2*x), x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$16 \\left(-\\cos \\left(\\frac{\\pi }{9}\\right)-i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(math.cos(((2*math.pi)/9))-1j*math.sin(((2*math.pi)/9))))**4)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{73}{39}$, and $a_n=a_{n-1}+-\\frac{58}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=17$.", + "Output Answer": [ + "$-\\frac{316319}{273}$" + ], + "Output Program": [ + "a = -(73/39) # initial value\nd = -(58/7) # second term\nn = 17 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(73/39) # initial value\nd = -(58/7) # second term\nn = 17 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\left(\\cos \\left(\\frac{19 \\pi }{90}\\right)+i \\sin \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$7776 \\left(-\\cos \\left(\\frac{\\pi }{18}\\right)-i \\sin \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*(math.cos(((19*math.pi)/90))+1j*math.sin(((19*math.pi)/90))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(8+17)+((5+14)-18)$.", + "Output Answer": [ + "$26$" + ], + "Output Program": [ + "try: \n print((8+17)+((5+14)-18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-12 x-3}=2$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{12}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-12*x-3), 2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-1+i) \\pi$ and $y=(1-2 i) \\pi$", + "Output Answer": [ + "$-\\frac{3}{5}-\\frac{i}{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-1+i)*math.pi\ny = (1-2*i)*math.pi\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $14 x^2-4 x+6$", + "Output Answer": [ + "$x=\\frac{1}{7} \\left(1-2 i \\sqrt{5}\\right)\\lor x=\\frac{1}{7} \\left(1+2 i \\sqrt{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(14*x**2-4*x+6, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{7}{3}+\\frac{19 i}{3}$ and $y=-\\frac{10}{3}+\\frac{19 i}{3}$", + "Output Answer": [ + "$-\\frac{97}{3}-\\frac{323 i}{9}$" + ], + "Output Program": [ + "i = 1j\nx = -(7/3)+((19*i)/3)\ny = -(10/3)+((19*i)/3)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $x^4+6 x^3-5 x^2-3 x-9$ when divided by $4-4 x$.", + "Output Answer": [ + "$-\\frac{x^3}{4}-\\frac{7 x^2}{4}-\\frac{x}{2}+\\frac{1}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**4+6*x**3-5*x**2-3*x-9\nq = 4-4*x\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{44 x^5}{5}+\\frac{72 x^4}{5}-4 x^3+\\frac{28 x^2}{5}-\\frac{36 x}{5}+\\frac{96}{5}$ and $\\frac{11 x^5}{5}+\\frac{18 x^4}{5}-x^3+\\frac{7 x^2}{5}-\\frac{9 x}{5}+\\frac{24}{5}$.", + "Output Answer": [ + "$\\frac{11 x^5}{5}+\\frac{18 x^4}{5}-x^3+\\frac{7 x^2}{5}-\\frac{9 x}{5}+\\frac{24}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((44*x**5)/5)+((72*x**4)/5)-4*x**3+((28*x**2)/5)-((36*x)/5)+(96/5), ((11*x**5)/5)+((18*x**4)/5)-x**3+((7*x**2)/5)-((9*x)/5)+(24/5)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{93 x^2}{4}+\\frac{29 x}{4}+4\\right| =21$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{186} \\left(29-\\sqrt{38041}\\right)\\right\\},\\left\\{x\\to \\frac{1}{186} \\left(29+\\sqrt{38041}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((93*x**2)/4)+((29*x)/4)+4), 21), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(4-11 i) \\log (2)$ and $y=9 i \\log (2)$", + "Output Answer": [ + "$(4-20 i) \\log (2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (4-11*i)*math.log10(2)\ny = 9*i*math.log10(2)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $9 \\sqrt{2} x^2-10 \\sqrt{2} x+4 \\sqrt{2}$", + "Output Answer": [ + "$9 \\sqrt{2} \\left(x-\\frac{5}{9}\\right)^2+\\frac{11 \\sqrt{2}}{9}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (9*math.sqrt(2)*x**2-10*math.sqrt(2)*x+4*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2-297 x+1870$", + "Output Answer": [ + "$-11 (10-x) (x-17)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2-297*x+1870, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-12 x-8}+\\sqrt{3 x+15}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{15} \\left(-38+8 \\sqrt{10}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-12*x-8)+sqrt(3*x+15), 5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 24 x^2+12 x+4\\right| =-2$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(24*x**2+12*x+4), -2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-13 x^2-12 x+6$", + "Output Answer": [ + "$x=\\frac{1}{13} \\left(-6-\\sqrt{114}\\right)\\lor x=\\frac{1}{13} \\left(\\sqrt{114}-6\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-13*x**2-12*x+6, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=102-63 t, x(t)=9 t-15$", + "Output Answer": [ + "$y=-7 x-3$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 102-63*t\nx_t = 9*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-8 \\sqrt{5} x-5 \\sqrt{5} y+8 \\sqrt{5}=0$, $2 \\sqrt{5} x-6 \\sqrt{5} y-2 \\sqrt{5}=0$", + "Output Answer": [ + "$x=1$, $y=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-8*sqrt(5)*x-5*sqrt(5)*y+8*sqrt(5), 2*sqrt(5)*x-6*sqrt(5)*y-2*sqrt(5)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10 x-13}+\\sqrt{14 x-8}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(481-9 \\sqrt{2733}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10*x-13)+sqrt(14*x-8), 9), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\left(\\cos \\left(\\frac{5}{18}\\right)+i \\sin \\left(\\frac{5}{18}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1024 \\left(\\cos \\left(\\frac{25}{9}\\right)+i \\sin \\left(\\frac{25}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*(math.cos((5/18))+1j*math.sin((5/18))))**10)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{7 x^2}{\\sqrt{\\pi }}+\\frac{23 x}{\\sqrt{\\pi }}-\\frac{5}{\\sqrt{\\pi }}$ and $q(x) = \\frac{3 x^2}{\\sqrt{\\pi }}+\\frac{24 x}{\\sqrt{\\pi }}-\\frac{16}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{21 x^4}{\\pi }+\\frac{237 x^3}{\\pi }+\\frac{425 x^2}{\\pi }-\\frac{488 x}{\\pi }+\\frac{80}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((7*x**2)/(sqrt(pi)))+((23*x)/(sqrt(pi)))-(5/(sqrt(pi)))\nq = ((3*x**2)/(sqrt(pi)))+((24*x)/(sqrt(pi)))-(16/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^4-3 x^3-10 x^2+x-8$ when divided by $-1$.", + "Output Answer": [ + "$-4 x^4+3 x^3+10 x^2-x+8$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**4-3*x**3-10*x**2+x-8\nq = -1\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x^2-10 x-10$ and $-5$.", + "Output Answer": [ + "$5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x**2-10*x-10, -5))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2-2 x+2 y^2+4 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 (y+1)^2-7 \\left(x+\\frac{1}{7}\\right)^2=\\frac{48}{7}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{7} & -1-\\frac{6 \\sqrt{6}}{7} \\\\\n -\\frac{1}{7} & \\frac{6 \\sqrt{6}}{7}-1 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{7}}$\nCenter: $\\left\\{-\\frac{1}{7},-1\\right\\}$\nAsymptotes: $\\left\\{y=-\\sqrt{\\frac{7}{2}} x-\\frac{1}{\\sqrt{14}}-1,y=\\sqrt{\\frac{7}{2}} x+\\frac{1}{\\sqrt{14}}-1\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2-2*x+2*y**2+4*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2 x^2+3 x+4$ and $1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2*x**2+3*x+4, 1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-4 x+23 y+3 z+4=0$, $5 x+3 y-9 z+5=0$, $-23 x+20 y-23 z-12=0$", + "Output Answer": [ + "$x=-\\frac{5981}{7469}$, $y=-\\frac{335}{1067}$, $z=\\frac{45}{7469}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-4*x+23*y+3*z+4, 5*x+3*y-9*z+5, -23*x+20*y-23*z-12)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1-13 x}{\\sqrt{3}}, q(x) = -\\frac{(5 x-16)^3}{3 \\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{125 x^3}{3 \\sqrt{3}}+\\frac{400 x^2}{\\sqrt{3}}-431 \\sqrt{3} x+\\frac{4099}{3 \\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((1-13*x)/(sqrt(3)))\nq = -(((5*x-16)**3)/(3*sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -x (7 x+8)$, $q(x) = -2 x^2-4 x-3$", + "Output Answer": [ + "$-9 x^2-12 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x*(7*x+8)\nq = -2*x**2-4*x-3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{625} (11-20 x)^4, q(x) = \\frac{1}{5} (31-27 x)$", + "Output Answer": [ + "$256 x^4-\\frac{2816 x^3}{5}+\\frac{11616 x^2}{25}-\\frac{21971 x}{125}+\\frac{18516}{625}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/625)*(11-20*x)**4\nq = (1/5)*(31-27*x)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=8 \\left(50 t^2-10 \\left(22+\\sqrt{2}\\right) t+22 \\sqrt{2}+243\\right), x(t)=5 \\sqrt{2} t-11 \\sqrt{2}$", + "Output Answer": [ + "$y=8 x^2-16 x+8$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 8*(50*t**2-10*(22+sqrt(2))*t+22*sqrt(2)+243)\nx_t = 5*sqrt(2)*t-11*sqrt(2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $x^3+2 x^2+3 x-6$ when divided by $-1$.", + "Output Answer": [ + "$-x^3-2 x^2-3 x+6$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**3+2*x**2+3*x-6\nq = -1\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3$ and $x^2+5 x-2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3, x**2+5*x-2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((6-4)-24)+(20-15)$.", + "Output Answer": [ + "$-17$" + ], + "Output Program": [ + "try: \n print(((6-4)-24)+(20-15))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{117}-51\\right)-\\left(\\sqrt{50}+\\sqrt{77}\\right)$.", + "Output Answer": [ + "$-51-5 \\sqrt{2}+3 \\sqrt{13}-\\sqrt{77}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(117)-51)-(sqrt(50)+sqrt(77)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{149 x}{7}-\\frac{20}{7}\\right| =\\frac{18}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{149}\\right\\},\\left\\{x\\to \\frac{38}{149}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((149*x)/7)-(20/7)), (18/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $2 \\sqrt{3} x^2+\\frac{2 x}{\\sqrt{3}}-\\frac{5}{\\sqrt{3}}$", + "Output Answer": [ + "$2 \\sqrt{3} \\left(x+\\frac{1}{6}\\right)^2-\\frac{31}{6 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (2*math.sqrt(3)*x**2+((2*x)/(math.sqrt(3)))-(5/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2+3 x+5 y^2+9 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(y+\\frac{9}{10}\\right)^2-7 \\left(x-\\frac{3}{14}\\right)^2=\\frac{401}{70}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{14} & \\frac{1}{70} \\left(-63-2 \\sqrt{2406}\\right) \\\\\n \\frac{3}{14} & \\frac{1}{70} \\left(2 \\sqrt{2406}-63\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{3}{7}}$\nCenter: $\\left\\{\\frac{3}{14},\\frac{1}{2} \\left(\\frac{1}{70} \\left(-63-2 \\sqrt{2406}\\right)+\\frac{1}{70} \\left(2 \\sqrt{2406}-63\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3}{70} \\left(\\sqrt{35}-21\\right)-\\sqrt{\\frac{7}{5}} x,y=\\sqrt{\\frac{7}{5}} x-\\frac{3}{70} \\left(21+\\sqrt{35}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2+3*x+5*y**2+9*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{-25 x^2-26 x+7}{\\sqrt{\\pi }}$, $q(x) = \\frac{-22 x^2-10 x+25}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{47 x^2}{\\sqrt{\\pi }}-\\frac{36 x}{\\sqrt{\\pi }}+\\frac{32}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((-25*x**2-26*x+7)/(sqrt(pi)))\nq = ((-22*x**2-10*x+25)/(sqrt(pi)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(\\sin \\left(\\frac{19 \\pi }{90}\\right)-i \\cos \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$-2048 \\left(-\\cos \\left(\\frac{8 \\pi }{45}\\right)+i \\sin \\left(\\frac{8 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(math.sin(((19*math.pi)/90))-1j*math.cos(((19*math.pi)/90))))**11)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2-2 x-168$", + "Output Answer": [ + "$(-x-12) (14-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2-2*x-168, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-475 x^2-118 x+21}{323 x+119}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{25}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-475*x**2-118*x+21)/(323*x+119)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{2} (4 x+3)^2, q(x) = \\frac{(11 x-12)^3}{2 \\sqrt{2}}$", + "Output Answer": [ + "$\\frac{1331 x^3}{2 \\sqrt{2}}-1089 \\sqrt{2} x^2+8 x^2+1188 \\sqrt{2} x+12 x-432 \\sqrt{2}+\\frac{9}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/2)*(4*x+3)**2\nq = (((11*x-12)**3)/(2*sqrt(2)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $4 x^2+3 x+8$", + "Output Answer": [ + "$x=\\frac{1}{8} \\left(-3-i \\sqrt{119}\\right)\\lor x=\\frac{1}{8} \\left(-3+i \\sqrt{119}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(4*x**2+3*x+8, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{67 x^2}{7}+\\frac{38 x}{7}-\\frac{89}{7}$", + "Output Answer": [ + "$-\\frac{67}{7} \\left(x-\\frac{19}{67}\\right)^2-\\frac{5602}{469}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((67*x**2)/7)+((38*x)/7)-(89/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 6 x^2-5 x-5$ and $q(x) = 9 x^2+13 x+8$", + "Output Answer": [ + "$54 x^4+33 x^3-62 x^2-105 x-40$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 6*x**2-5*x-5\nq = 9*x**2+13*x+8\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2 e^{-\\frac{23 i \\pi }{180}} \\pi$.", + "Output Answer": [ + "Norm: $2 \\pi$\nArgument: $-\\frac{23 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2*math.e**(-((23*i*math.pi)/180))*math.pi\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{14 x^2}{\\sqrt{3}}+\\frac{7 x}{\\sqrt{3}}+\\frac{5}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{28} \\left(-7-i \\sqrt{231}\\right)\\lor x=\\frac{1}{28} \\left(-7+i \\sqrt{231}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((14*x**2)/(sqrt(3)))+((7*x)/(sqrt(3)))+(5/(sqrt(3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(4+4 i) \\sqrt{3}$ and $y=(-3-6 i) \\sqrt{3}$", + "Output Answer": [ + "$36-108 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (4+4*i)*math.sqrt(3)\ny = (-3-6*i)*math.sqrt(3)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8-14 x}+\\sqrt{14-13 x}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -3894+240 \\sqrt{263}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8-14*x)+sqrt(14-13*x), 12), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{24 x^2}{7}-15 x+\\frac{41}{7}$ and $q(x) = \\frac{62 x^2}{7}+\\frac{93 x}{7}+\\frac{2}{7}$", + "Output Answer": [ + "$\\frac{1488 x^4}{49}-\\frac{4278 x^3}{49}-\\frac{1025 x^2}{7}+\\frac{3603 x}{49}+\\frac{82}{49}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((24*x**2)/7)-15*x+(41/7)\nq = ((62*x**2)/7)+((93*x)/7)+(2/7)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\log (-5 x-5)$ at the point $x=-3$", + "Output Answer": [ + "$\\log (10) = 2.303$" + ], + "Output Program": [ + "import math\n\nx = -3\ntry: \n f = math.log(-5*x-5)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-11 x^2-7$", + "Output Answer": [ + "$x=i \\sqrt{\\frac{7}{11}}\\lor x=-i \\sqrt{\\frac{7}{11}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-11*x**2-7, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4$ and $2 x^3+2 x^2+1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4, 2*x**3+2*x**2+1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{(((6-12)-8)-22)^2+11}{(14-5)^2}$.", + "Output Answer": [ + "$\\frac{1307}{81}$" + ], + "Output Program": [ + "try: \n print((((((6-12)-8)-22)**2+11)/((14-5)**2)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{8 x^2+14 x-3}{6-19 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(-7-\\sqrt{73}\\right)\\right\\},\\left\\{x\\to \\frac{1}{8} \\left(-7+\\sqrt{73}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((8*x**2+14*x-3)/(6-19*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-2 x^2-11 x+22}{19 x^2+6 x+7}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-11-3 \\sqrt{33}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(-11+3 \\sqrt{33}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-2*x**2-11*x+22)/(19*x**2+6*x+7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-5 x^2+8 x-5 y^2-2 y+10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Circle\nEquation: $-5 \\left(x-\\frac{4}{5}\\right)^2-5 \\left(y+\\frac{1}{5}\\right)^2=-\\frac{67}{5}$\nRadius: $\\frac{\\sqrt{67}}{5}$\nCircumference: $\\frac{2 \\sqrt{67} \\pi }{5}$\nCenter: $\\left\\{\\frac{4}{5},-\\frac{1}{5}\\right\\}$\nArea Enclosed: $\\frac{67 \\pi }{25}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-5*x**2+8*x-5*y**2-2*y+10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-9 t-46, x(t)=-3 t-15$", + "Output Answer": [ + "$y=3 x-1$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -9*t-46\nx_t = -3*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-5 x+4 y+22=0$, $8 x+14 y-19=0$", + "Output Answer": [ + "$x=\\frac{64}{17}$, $y=-\\frac{27}{34}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-5*x+4*y+22, 8*x+14*y-19), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(-\\cos \\left(\\frac{2 \\pi }{15}\\right)+i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$81 \\left(-\\sin \\left(\\frac{\\pi }{30}\\right)-i \\cos \\left(\\frac{\\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(-math.cos(((2*math.pi)/15))+1j*math.sin(((2*math.pi)/15))))**4)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-2-5 i) \\sqrt{3}$ and $y=(-2+i) \\sqrt{3}$", + "Output Answer": [ + "$-\\frac{1}{5}+\\frac{12 i}{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-2-5*i)*math.sqrt(3)\ny = (-2+i)*math.sqrt(3)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(9 \\left(\\cos \\left(\\frac{19 \\pi }{90}\\right)+i \\sin \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$59049 \\left(-\\cos \\left(\\frac{\\pi }{18}\\right)-i \\sin \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((9*(math.cos(((19*math.pi)/90))+1j*math.sin(((19*math.pi)/90))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -14 x^2-9 x+14$, $q(x) = -11 x^2+3 x+1$", + "Output Answer": [ + "$-25 x^2-6 x+15$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -14*x**2-9*x+14\nq = -11*x**2+3*x+1\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 12 \\sqrt{3} x-2 \\sqrt{3}\\right| =-5 \\sqrt{3}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(12*sqrt(3)*x-2*sqrt(3)), -5*sqrt(3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-14 x^2+17 x-3}{23 x+6}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{14}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-14*x**2+17*x-3)/(23*x+6)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2-5 x-5 y^2+9 y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x-\\frac{5}{14}\\right)^2-5 \\left(y-\\frac{9}{10}\\right)^2=-\\frac{361}{70}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{14} & \\frac{1}{70} \\left(63-38 \\sqrt{6}\\right) \\\\\n \\frac{5}{14} & \\frac{1}{70} \\left(63+38 \\sqrt{6}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{3}{7}}$\nCenter: $\\left\\{\\frac{5}{14},\\frac{1}{2} \\left(\\frac{1}{70} \\left(63-38 \\sqrt{6}\\right)+\\frac{1}{70} \\left(63+38 \\sqrt{6}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{70} \\left(63+5 \\sqrt{35}\\right)-\\sqrt{\\frac{7}{5}} x,y=\\sqrt{\\frac{7}{5}} x+\\frac{1}{70} \\left(63-5 \\sqrt{35}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2-5*x-5*y**2+9*y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 14 x^2-12 x-13$ and $q(x) = 9 x^2-5 x+6$", + "Output Answer": [ + "$126 x^4-178 x^3+27 x^2-7 x-78$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 14*x**2-12*x-13\nq = 9*x**2-5*x+6\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 2 x^2-13 x+8$, $q(x) = 6 x^2+11 x-6$", + "Output Answer": [ + "$8 x^2-2 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**2-13*x+8\nq = 6*x**2+11*x-6\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-2 x^2+4 x+y^2-6 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $(y-3)^2-2 (x-1)^2=-1$\nFoci: $\\left(\n\\begin{array}{cc}\n 1-\\sqrt{\\frac{3}{2}} & 3 \\\\\n 1+\\sqrt{\\frac{3}{2}} & 3 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{3}$\nCenter: $\\{1,3\\}$\nAsymptotes: $\\left\\{y=\\sqrt{2} x-\\sqrt{2}+3,y=-\\sqrt{2} x+\\sqrt{2}+3\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x**2+4*x+y**2-6*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{43}{7}-\\frac{59 i}{7}$ and $y=-\\frac{31}{7}+\\frac{3 i}{7}$", + "Output Answer": [ + "$-\\frac{74}{7}-8 i$" + ], + "Output Program": [ + "i = 1j\nx = -(43/7)-((59*i)/7)\ny = -(31/7)+((3*i)/7)\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $5 x^2-\\frac{50 x}{7}-\\frac{80520}{49}$", + "Output Answer": [ + "$5 \\left(x-\\frac{132}{7}\\right) \\left(x+\\frac{122}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(5*x**2-((50*x)/7)-(80520/49), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{7 x^2}{\\sqrt{3}}+2 \\sqrt{3} x+\\frac{8}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{7 \\left(x-\\frac{3}{7}\\right)^2}{\\sqrt{3}}+\\frac{3 \\sqrt{3}}{7}+\\frac{8}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((7*x**2)/(math.sqrt(3)))+2*math.sqrt(3)*x+(8/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{12-8 x}+\\sqrt{-4 x-14}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-137+40 \\sqrt{10}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(12-8*x)+sqrt(-4*x-14), 10), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^6+8 x^5-7 x^4-2 x^3-3 x^2+8 x+6$ when divided by $-x^3+x^2-4 x-7$.", + "Output Answer": [ + "$8 x^3-25 x-79$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**6+8*x**5-7*x**4-2*x**3-3*x**2+8*x+6\nq = -x**3+x**2-4*x-7\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$25 x+2 y-7 z+9=0$, $14 x-7 y-19 z-23=0$, $22 x-20 z-25=0$", + "Output Answer": [ + "$x=-\\frac{2515}{2146}$, $y=\\frac{2709}{2146}$, $z=-\\frac{5449}{2146}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((25*x+2*y-7*z+9, 14*x-7*y-19*z-23, 22*x-20*z-25)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{76}{85}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$-\\frac{4742}{17}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(76/85) # initial value\nd = -6 # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(76/85) # initial value\nd = -6 # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{17 x^2}{\\sqrt{2}}-\\frac{13 x}{\\sqrt{2}}-\\frac{17}{\\sqrt{2}}$", + "Output Answer": [ + "$-\\frac{17 \\left(x+\\frac{13}{34}\\right)^2}{\\sqrt{2}}-\\frac{987}{68 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((17*x**2)/(math.sqrt(2)))-((13*x)/(math.sqrt(2)))-(17/(math.sqrt(2)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{4}{27} \\left(98 t^2-364 t+359\\right)^2, x(t)=\\frac{196 t^2}{3}-\\frac{728 t}{3}+\\frac{676}{3}$", + "Output Answer": [ + "$y=\\frac{x^2}{3}+\\frac{28 x}{3}+\\frac{196}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (4/27)*(98*t**2-364*t+359)**2\nx_t = ((196*t**2)/3)-((728*t)/3)+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 2-5 x| =15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{13}{5}\\right\\},\\left\\{x\\to \\frac{17}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(2-5*x), 15), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2-45 x+450$", + "Output Answer": [ + "$9 (5-x) (x+10)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2-45*x+450, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{5 x^2}{\\sqrt{3}}+\\frac{8 x}{\\sqrt{3}}-5 \\sqrt{3}$ and $q(x) = \\frac{14 x^2}{\\sqrt{3}}+\\frac{10 x}{\\sqrt{3}}+\\frac{16}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{70 x^4}{3}+\\frac{62 x^3}{3}-70 x^2-\\frac{22 x}{3}-80$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((5*x**2)/(sqrt(3)))+((8*x)/(sqrt(3)))-5*sqrt(3)\nq = ((14*x**2)/(sqrt(3)))+((10*x)/(sqrt(3)))+(16/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-2 x^2-6 x+8 y^2+3 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y+\\frac{3}{16}\\right)^2-2 \\left(x+\\frac{3}{2}\\right)^2=-\\frac{71}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{2}-\\frac{\\sqrt{355}}{16} & -\\frac{3}{16} \\\\\n \\frac{1}{16} \\left(\\sqrt{355}-24\\right) & -\\frac{3}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{3}{2}-\\frac{\\sqrt{355}}{16}+\\frac{1}{16} \\left(\\sqrt{355}-24\\right)\\right),-\\frac{3}{16}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{2}+\\frac{9}{16},y=-\\frac{x}{2}-\\frac{15}{16}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x**2-6*x+8*y**2+3*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-11 x^2+4 x+6$", + "Output Answer": [ + "$\\frac{70}{11}-11 \\left(x-\\frac{2}{11}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-11*x**2+4*x+6), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\sqrt{5}, \\frac{1}{2}, \\frac{1}{\\sqrt{3}})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{\\frac{67}{3}}}{2},\\tan ^{-1}\\left(\\frac{3 \\sqrt{7}}{2}\\right),\\tan ^{-1}\\left(\\frac{1}{2 \\sqrt{5}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.sqrt(5)\ny = (1/2)\nz = (1/(math.sqrt(3)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{11 x}{5}+\\frac{8}{5}$ and $-\\frac{12 x^2}{5}-\\frac{18 x}{5}-\\frac{6}{5}$.", + "Output Answer": [ + "$\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((11*x)/5)+(8/5), -((12*x**2)/5)-((18*x)/5)-(6/5)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-4+7 i$ and $y=-1+7 i$", + "Output Answer": [ + "$\\frac{53}{50}+\\frac{21 i}{50}$" + ], + "Output Program": [ + "i = 1j\nx = -4+7*i\ny = -1+7*i\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-3 x^2-6 x+7}{-19 x^2-2 x-14}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-3-\\sqrt{30}\\right)\\right\\},\\left\\{x\\to \\frac{1}{3} \\left(-3+\\sqrt{30}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-3*x**2-6*x+7)/(-19*x**2-2*x-14)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$\\frac{10}{9 x}$", + "Output Answer": [ + "$-\\frac{162}{25} \\left(x+\\frac{5}{9}\\right)^2-\\frac{18}{5} \\left(x+\\frac{5}{9}\\right)-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, (10/(9*x)))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-5 \\sqrt{5} x^2-4 \\sqrt{5}$", + "Output Answer": [ + "$x=\\frac{2 i}{\\sqrt{5}}\\lor x=-\\frac{2 i}{\\sqrt{5}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-5*sqrt(5)*x**2-4*sqrt(5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-19 x-24 y+\\frac{31}{3}=0$, $\\frac{37 x}{3}-13 y-\\frac{14}{3}=0$", + "Output Answer": [ + "$x=\\frac{739}{1629}$, $y=\\frac{349}{4887}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-19*x-24*y+(31/3), ((37*x)/3)-13*y-(14/3)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 7 \\sqrt{5} x^2+5 \\sqrt{5} x+11 \\sqrt{5}\\right| =2 \\sqrt{5}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(7*sqrt(5)*x**2+5*sqrt(5)*x+11*sqrt(5)), 2*sqrt(5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-14 x^2-4 x+3$", + "Output Answer": [ + "$\\frac{23}{7}-14 \\left(x+\\frac{1}{7}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-14*x**2-4*x+3), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $9 x^2-6 x-11$", + "Output Answer": [ + "$9 \\left(x-\\frac{1}{3}\\right)^2-12$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (9*x**2-6*x-11), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 x^2-3 x-10$ and $q(x) = -10 x^2-9 x-10$", + "Output Answer": [ + "$-20 x^4+12 x^3+107 x^2+120 x+100$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*x**2-3*x-10\nq = -10*x**2-9*x-10\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{85}{94}$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$-\\frac{307777}{94}$" + ], + "Output Program": [ + "a = -(85/94) # initial value\nd = -8 # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(85/94) # initial value\nd = -8 # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left(\\frac{23}{23}-12\\right)+13\\right)+10\\right)-((((3-12)-16)+22)-15)^2$.", + "Output Answer": [ + "$-312$" + ], + "Output Program": [ + "try: \n print(((((23/23)-12)+13)+10)-((((3-12)-16)+22)-15)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $12 x^2-12 x+11$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(3-2 i \\sqrt{6}\\right)\\lor x=\\frac{1}{6} \\left(3+2 i \\sqrt{6}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(12*x**2-12*x+11, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{117 x^3+148 x^2-222 x+11}{260 x-220}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(-19-\\sqrt{397}\\right)\\right\\},\\left\\{x\\to \\frac{1}{18} \\left(-19+\\sqrt{397}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((117*x**3+148*x**2-222*x+11)/(260*x-220)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{132 x^3-352 x^2-154 x+330}{462 x^2+242 x-220}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(11-\\sqrt{31}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(11+\\sqrt{31}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((132*x**3-352*x**2-154*x+330)/(462*x**2+242*x-220)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt[3]{5 x+4} \\sin (9 x+2)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = cbrt(5*x+4)*sin(9*x+2)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{17 x^2}{7}-\\frac{73 x}{7}+\\frac{20}{7}$ and $q(x) = -\\frac{27 x^2}{7}-\\frac{3 x}{7}+\\frac{52}{7}$", + "Output Answer": [ + "$\\frac{459 x^4}{49}+\\frac{2022 x^3}{49}-\\frac{1205 x^2}{49}-\\frac{3856 x}{49}+\\frac{1040}{49}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((17*x**2)/7)-((73*x)/7)+(20/7)\nq = -((27*x**2)/7)-((3*x)/7)+(52/7)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2+65 x+340$", + "Output Answer": [ + "$5 (17-x) (x+4)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2+65*x+340, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\sqrt{3} x^2-8 \\sqrt{3} x-8 \\sqrt{3}$", + "Output Answer": [ + "$8 \\sqrt{3}-\\sqrt{3} (x+4)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-math.sqrt(3)*x**2-8*math.sqrt(3)*x-8*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{2} \\left(22 x^2-9 x+23\\right)$, $q(x) = 9 x^2-9 x+\\frac{11}{2}$", + "Output Answer": [ + "$20 x^2-\\frac{27 x}{2}+17$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/2)*(22*x**2-9*x+23)\nq = 9*x**2-9*x+(11/2)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5-14 x}+\\sqrt{-10 x-2}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-89+4 \\sqrt{482}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5-14*x)+sqrt(-10*x-2), 4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{13}{3}$ and $-\\frac{x^5}{3}+\\frac{4 x^4}{3}+\\frac{7 x^3}{3}-x^2-\\frac{8 x}{3}-\\frac{10}{3}$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-(13/3), -((x**5)/3)+((4*x**4)/3)+((7*x**3)/3)-x**2-((8*x)/3)-(10/3)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{22 x^2-x-18}{-13 x^2-15 x+16}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{44} \\left(1-\\sqrt{1585}\\right)\\right\\},\\left\\{x\\to \\frac{1}{44} \\left(1+\\sqrt{1585}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((22*x**2-x-18)/(-13*x**2-15*x+16)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{26}{25}$, and $a_n=a_{n-1}+-10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$-\\frac{43244}{25}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(26/25) # initial value\nd = -10 # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(26/25) # initial value\nd = -10 # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-3 x^2+8 x-9$ when divided by $4 x+3$.", + "Output Answer": [ + "$\\frac{41}{16}-\\frac{3 x}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x**2+8*x-9\nq = 4*x+3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2-\\frac{44 x}{5}+\\frac{8}{5}$", + "Output Answer": [ + "$-4 (2-x) \\left(x-\\frac{1}{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2-((44*x)/5)+(8/5), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-2 \\sqrt{5} x^2-9 \\sqrt{5} x-8 \\sqrt{5}}{3 \\sqrt{5} x^2+9 \\sqrt{5} x-\\sqrt{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-9-\\sqrt{17}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(-9+\\sqrt{17}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-2*sqrt(5)*x**2-9*sqrt(5)*x-8*sqrt(5))/(3*sqrt(5)*x**2+9*sqrt(5)*x-sqrt(5))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -15 x^2+4 x-14$ and $q(x) = 12 x-2$", + "Output Answer": [ + "$-180 x^3+78 x^2-176 x+28$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -15*x**2+4*x-14\nq = 12*x-2\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 16 x^2 \\log (2)+x \\log (2)-10 \\log (2)$ and $q(x) = 7 x^2 \\log (2)+4 x \\log (2)+\\log (2)$", + "Output Answer": [ + "$112 x^4 \\log ^2(2)+71 x^3 \\log ^2(2)-50 x^2 \\log ^2(2)-39 x \\log ^2(2)-10 \\log ^2(2)$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 16*x**2*log(2)+x*log(2)-10*log(2)\nq = 7*x**2*log(2)+4*x*log(2)+log(2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-10 x^2-130 x-400$", + "Output Answer": [ + "$10 (-x-5) (x+8)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-10*x**2-130*x-400, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| -6 x-7| =-11$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-6*x-7), -11), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{41 x}{2}+\\frac{13 y}{4}+\\frac{33 z}{2}+\\frac{75}{4}=0$, $\\frac{35 x}{4}+\\frac{49 y}{2}-\\frac{93 z}{4}-\\frac{9}{2}=0$, $-24 x-\\frac{69 y}{4}+12 z+3=0$", + "Output Answer": [ + "$x=\\frac{42465}{232076}$, $y=-\\frac{36384}{58019}$, $z=-\\frac{182297}{232076}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((41*x)/2)+((13*y)/4)+((33*z)/2)+(75/4), ((35*x)/4)+((49*y)/2)-((93*z)/4)-(9/2), -24*x-((69*y)/4)+12*z+3)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left((13-6)^2-8\\right)+11\\right)+7\\right)+(15-3)$.", + "Output Answer": [ + "$71$" + ], + "Output Program": [ + "try: \n print(((((13-6)**2-8)+11)+7)+(15-3))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((9+3)-11)+8)-\\frac{24}{22}$.", + "Output Answer": [ + "$\\frac{87}{11}$" + ], + "Output Program": [ + "try: \n print((((9+3)-11)+8)-(24/22))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^5-3 x^4-2 x^3-6 x^2+x-7$ when divided by $5 x^5-2 x^4-x^3+5 x^2-3 x+1$.", + "Output Answer": [ + "$\\frac{6}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**5-3*x**4-2*x**3-6*x**2+x-7\nq = 5*x**5-2*x**4-x**3+5*x**2-3*x+1\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{25 x^2}{3}+\\frac{14 x}{3}+5$", + "Output Answer": [ + "$x=\\frac{1}{25} \\left(-7-i \\sqrt{326}\\right)\\lor x=\\frac{1}{25} \\left(-7+i \\sqrt{326}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((25*x**2)/3)+((14*x)/3)+5, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-x-9 y+20 z+22=0$, $6 x-23 y-15 z+10=0$, $x-y-15 z+21=0$", + "Output Answer": [ + "$x=\\frac{3641}{133}$, $y=\\frac{761}{133}$, $z=\\frac{1891}{665}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-x-9*y+20*z+22, 6*x-23*y-15*z+10, x-y-15*z+21)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(21+7)-(1-24)$.", + "Output Answer": [ + "$51$" + ], + "Output Program": [ + "try: \n print((21+7)-(1-24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $15 | x| =10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{2}{3}\\right\\},\\left\\{x\\to \\frac{2}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(15*abs(x), 10), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x-3$ and $-2 x^4+3 x^2-3 x+2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x-3, -2*x**4+3*x**2-3*x+2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -6 x^2+\\frac{25 x}{3}+\\frac{22}{3}\\right| =-12$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-6*x**2+((25*x)/3)+(22/3)), -12), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{83 x^2}{7}-\\frac{92 x}{7}-\\frac{59}{7}$", + "Output Answer": [ + "$-\\frac{83}{7} \\left(x+\\frac{46}{83}\\right)^2-\\frac{2781}{581}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((83*x**2)/7)-((92*x)/7)-(59/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $e^{\\sqrt[3]{-3 x-7}}-2=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-7-\\log ^3(2)\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(math.e**(cbrt(-3*x-7))-2, x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((12-5)-20) \\left(\\frac{1}{9} (((14-24)-12)+7)\\right)$.", + "Output Answer": [ + "$\\frac{65}{3}$" + ], + "Output Program": [ + "try: \n print(((12-5)-20)*((1/9)*(((14-24)-12)+7)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+4 x+7 y^2-10 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x+\\frac{1}{2}\\right)^2+7 \\left(y-\\frac{5}{7}\\right)^2=\\frac{60}{7}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{2}-\\frac{3 \\sqrt{5}}{7} & \\frac{5}{7} \\\\\n \\frac{3 \\sqrt{5}}{7}-\\frac{1}{2} & \\frac{5}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{7}}$\nCenter: $\\left\\{-\\frac{1}{2},\\frac{5}{7}\\right\\}$\nArea Enclosed: $\\frac{30 \\pi }{7 \\sqrt{7}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+4*x+7*y**2-10*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2-7 x-5 y^2+6 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x-\\frac{1}{2}\\right)^2-5 \\left(y-\\frac{3}{5}\\right)^2=\\frac{19}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2}-\\frac{\\sqrt{\\frac{57}{7}}}{5} & \\frac{3}{5} \\\\\n \\frac{1}{2}+\\frac{\\sqrt{\\frac{57}{7}}}{5} & \\frac{3}{5} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{3}{5}}$\nCenter: $\\left\\{\\frac{1}{2},\\frac{3}{5}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{7}{5}} x+\\frac{1}{10} \\left(6-\\sqrt{35}\\right),y=\\frac{1}{10} \\left(6+\\sqrt{35}\\right)-\\sqrt{\\frac{7}{5}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2-7*x-5*y**2+6*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3 x-3}+\\sqrt{8 x+5}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{25} \\left(1819-78 \\sqrt{429}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3*x-3)+sqrt(8*x+5), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$21 x+4 y-11 z+23=0$, $4 x+4 y+19 z+6=0$, $-3 x+23 y-9 z-9=0$", + "Output Answer": [ + "$x=-\\frac{13261}{11161}$, $y=\\frac{2172}{11161}$, $z=-\\frac{1190}{11161}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((21*x+4*y-11*z+23, 4*x+4*y+19*z+6, -3*x+23*y-9*z-9)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sinh (3-2 x)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{2}-\\frac{1}{2} \\sinh ^{-1}(y)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, sinh(3-2*x))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{34}{5}+8 i$ and $y=-3+4 i$", + "Output Answer": [ + "$-\\frac{19}{5}+4 i$" + ], + "Output Program": [ + "i = 1j\nx = -(34/5)+8*i\ny = -3+4*i\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{(22-25)-7}{((25+4)+10)+14}$.", + "Output Answer": [ + "$-\\frac{10}{53}$" + ], + "Output Program": [ + "try: \n print((((22-25)-7)/(((25+4)+10)+14)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^5+5 x^3-3 x^2+8 x+9$ when divided by $4 x^5+9 x^4+9 x^3-7 x^2-2 x+5$.", + "Output Answer": [ + "$-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**5+5*x**3-3*x**2+8*x+9\nq = 4*x**5+9*x**4+9*x**3-7*x**2-2*x+5\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{3-5 i}{\\sqrt{3}}$ and $y=-\\frac{11+9 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{14+4 i}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((3-5*i)/(math.sqrt(3)))\ny = -((11+9*i)/(math.sqrt(3)))\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $9 x^2-126 x-459$", + "Output Answer": [ + "$-9 (-x-3) (x-17)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(9*x**2-126*x-459, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{19}{39}$, and $a_n=a_{n-1}+\\frac{2}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$10 \\left(\\frac{38}{39}+\\frac{38}{\\sqrt{5}}\\right)$" + ], + "Output Program": [ + "import math\n\na = (19/39) # initial value\nd = (2/(math.sqrt(5))) # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (19/39) # initial value\nd = (2/(math.sqrt(5))) # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-14 x-8 y-z-25=0$, $11 x-4 y-6 z-17=0$, $-12 x+10 y-21 z+18=0$", + "Output Answer": [ + "$x=\\frac{109}{2251}$, $y=-\\frac{14079}{4502}$, $z=-\\frac{1485}{2251}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-14*x-8*y-z-25, 11*x-4*y-6*z-17, -12*x+10*y-21*z+18)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{39 x}{4}-\\frac{13}{2}}+\\sqrt{-\\frac{7 x}{2}-\\frac{59}{4}}=\\frac{37}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-69257+1406 \\sqrt{1534}}{2500}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((39*x)/4)-(13/2))+sqrt(-((7*x)/2)-(59/4)), (37/4)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=58-12 t, x(t)=3 t-15$", + "Output Answer": [ + "$y=-4 x-2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 58-12*t\nx_t = 3*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\tan (5-x)$ at the point $x=-5$", + "Output Answer": [ + "$-\\tan (10) = -0.648$" + ], + "Output Program": [ + "import math\n\nx = -5\ntry: \n f = -math.tan(5-x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-5 x-4}+\\sqrt{13-2 x}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-751+20 \\sqrt{1219}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-5*x-4)+sqrt(13-2*x), 10), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{1}{74}$, and $a_n=a_{n-1}+-\\frac{16}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{11}{2} \\left(\\frac{1}{37}-32 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\na = (1/74) # initial value\nd = -(16/(math.sqrt(5))) # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (1/74) # initial value\nd = -(16/(math.sqrt(5))) # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $5-\\frac{8 i}{5}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{689}}{5}$\nArgument: $-\\tan ^{-1}\\left(\\frac{8}{25}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 5-((8*i)/5)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{-7 x-8}-e^{\\frac{7}{2}-\\frac{3 x}{2}}$ at the point $x=9$", + "Output Answer": [ + "$-\\sqrt[3]{71}-\\frac{1}{e^{10}} = -4.141$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = 9\ntry: \n f = np.cbrt(-7*x-8)-math.e**((7/2)-((3*x)/2))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((((25+20)+10)+16)-8)-(11+14)$.", + "Output Answer": [ + "$38$" + ], + "Output Program": [ + "try: \n print(((((25+20)+10)+16)-8)-(11+14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 x^2-15 x-12$ and $q(x) = 4 x^2-10 x-10$", + "Output Answer": [ + "$20 x^4-110 x^3+52 x^2+270 x+120$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*x**2-15*x-12\nq = 4*x**2-10*x-10\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $9 x^3+171 x^2+108 x-972$", + "Output Answer": [ + "$-9 (-x-18) (x-2) (x+3)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(9*x**3+171*x**2+108*x-972, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-10 \\left(-\\sin \\left(\\frac{11 \\pi }{90}\\right)+i \\cos \\left(\\frac{11 \\pi }{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$-100000 \\left(-\\cos \\left(\\frac{\\pi }{9}\\right)-i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-10*(-math.sin(((11*math.pi)/90))+1j*math.cos(((11*math.pi)/90))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(4-4 i) \\sqrt{5}$ and $y=(-3+i) \\sqrt{5}$", + "Output Answer": [ + "$(7-5 i) \\sqrt{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (4-4*i)*math.sqrt(5)\ny = (-3+i)*math.sqrt(5)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{73 x^2}{3}-\\frac{47 x}{3}+7\\right| =-\\frac{2}{3}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((73*x**2)/3)-((47*x)/3)+7), -(2/3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-14 \\sqrt{3} x^2+3 \\sqrt{3} x+11 \\sqrt{3}}{3 \\sqrt{3} x+13 \\sqrt{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{11}{14}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-14*sqrt(3)*x**2+3*sqrt(3)*x+11*sqrt(3))/(3*sqrt(3)*x+13*sqrt(3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{2}{3} \\left(77 t+3 \\sqrt{3}-182\\right), x(t)=\\frac{11 t}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=\\frac{14 x}{\\sqrt{3}}+2 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (2/3)*(77*t+3*sqrt(3)-182)\nx_t = ((11*t)/(sqrt(3)))-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{13}{2} e^{\\frac{31 i \\pi }{36}}$.", + "Output Answer": [ + "Norm: $\\frac{13}{2}$\nArgument: $-\\frac{5 \\pi }{36}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(13/2)*math.e**((31*i*math.pi)/36)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{23}{5} \\left(-\\cos \\left(\\frac{7 \\pi }{30}\\right)+i \\sin \\left(\\frac{7 \\pi }{30}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$\\frac{12167}{125} \\left(\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(1+\\sqrt{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((23/5)*(-math.cos(((7*math.pi)/30))+1j*math.sin(((7*math.pi)/30))))**3)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-21 x^2-15 x}{57 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-21*x**2-15*x)/(57*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+x-y^2-5 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x+\\frac{1}{6}\\right)^2-\\left(y+\\frac{5}{2}\\right)^2=-\\frac{7}{6}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{6} & -\\frac{5}{2}-\\frac{\\sqrt{14}}{3} \\\\\n -\\frac{1}{6} & \\frac{\\sqrt{14}}{3}-\\frac{5}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{3}}$\nCenter: $\\left\\{-\\frac{1}{6},-\\frac{5}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{6} \\left(-15-\\sqrt{3}\\right)-\\sqrt{3} x,y=\\sqrt{3} x+\\frac{1}{6} \\left(\\sqrt{3}-15\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+x-y**2-5*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^3-6 x^2-2 x-7$ when divided by $8 x-7$.", + "Output Answer": [ + "$\\frac{3 x^2}{4}-\\frac{3 x}{32}-\\frac{85}{256}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**3-6*x**2-2*x-7\nq = 8*x-7\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-x^2+x-8 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-x^2+x-8 y=-1$\nVertex: $\\left\\{\\frac{1}{2},\\frac{5}{32}\\right\\}$\nDirectrix: $y=\\frac{69}{32}$\nFocal Parameter: $4$\nFocus: $\\left\\{\\frac{1}{2},-\\frac{59}{32}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-x**2+x-8*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{19 x^2}{2}-\\frac{27 x}{4}-\\frac{19}{4}$", + "Output Answer": [ + "$\\frac{19}{2} \\left(x-\\frac{27}{76}\\right)^2-\\frac{3617}{608}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((19*x**2)/2)-((27*x)/4)-(19/4)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x^3+4 x^2-4 x$ and $4 x^2+4 x-4$.", + "Output Answer": [ + "$4 x^2+4 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x**3+4*x**2-4*x, 4*x**2+4*x-4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^6+6 x^5+3 x^4-8 x^3+2 x^2-7 x-5$ when divided by $4 x-4$.", + "Output Answer": [ + "$-2 x^5-\\frac{x^4}{2}+\\frac{x^3}{4}-\\frac{7 x^2}{4}-\\frac{5 x}{4}-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**6+6*x**5+3*x**4-8*x**3+2*x**2-7*x-5\nq = 4*x-4\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{26 x^2}{3}-\\frac{17 x}{3}-\\frac{43}{3}$", + "Output Answer": [ + "$x=\\frac{1}{52} \\left(-17-i \\sqrt{4183}\\right)\\lor x=\\frac{1}{52} \\left(-17+i \\sqrt{4183}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((26*x**2)/3)-((17*x)/3)-(43/3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{5 x^2}{\\pi }+\\frac{45 x}{\\pi }-\\frac{6}{\\pi }$ and $q(x) = \\frac{5 x^2}{\\pi }-\\frac{38 x}{\\pi }-\\frac{40}{\\pi }$", + "Output Answer": [ + "$-\\frac{25 x^4}{\\pi ^2}+\\frac{415 x^3}{\\pi ^2}-\\frac{1540 x^2}{\\pi ^2}-\\frac{1572 x}{\\pi ^2}+\\frac{240}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((5*x**2)/pi)+((45*x)/pi)-(6/pi)\nq = ((5*x**2)/pi)-((38*x)/pi)-(40/pi)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\sqrt{2} \\left(\\cos \\left(\\frac{26}{45}\\right)+i \\sin \\left(\\frac{26}{45}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$8 \\left(\\cos \\left(\\frac{52}{45}\\right)+i \\sin \\left(\\frac{52}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*math.sqrt(2)*(math.cos((26/45))+1j*math.sin((26/45))))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((25+19)-17)-(5-11)$.", + "Output Answer": [ + "$33$" + ], + "Output Program": [ + "try: \n print(((25+19)-17)-(5-11))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-7+9 i$ and $y=\\frac{28}{3}+\\frac{7 i}{3}$", + "Output Answer": [ + "$-\\frac{57}{119}+\\frac{129 i}{119}$" + ], + "Output Program": [ + "i = 1j\nx = -7+9*i\ny = (28/3)+((7*i)/3)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sin (3)$ at the point $x=-2$", + "Output Answer": [ + "$\\sin (3) = 0.141$" + ], + "Output Program": [ + "import math\n\nx = -2\ntry: \n f = math.sin(3)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$23 x-10 y-16 z+7=0$, $-6 x-10 y-21 z+24=0$, $-10 x+22 y+22 z-4=0$", + "Output Answer": [ + "$x=\\frac{837}{2929}$, $y=-\\frac{4191}{2929}$, $z=\\frac{176}{101}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((23*x-10*y-16*z+7, -6*x-10*y-21*z+24, -10*x+22*y+22*z-4)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{9 \\left(-\\frac{\\sqrt{3}}{2}+\\frac{i}{2}\\right)}{\\sqrt{2}}\\right)^12$", + "Output Answer": [ + "$\\frac{282429536481}{64}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((9*(-((math.sqrt(3))/2)+(i/2)))/(math.sqrt(2))))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{7 x^2}{\\sqrt{2}}-10 \\sqrt{2} x-9 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{2}{7} \\left(5-\\sqrt{\\frac{113}{2}}\\right)\\lor x=\\frac{2}{7} \\left(5+\\sqrt{\\frac{113}{2}}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((7*x**2)/(sqrt(2)))-10*sqrt(2)*x-9*sqrt(2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 x^2+13 x-2$ and $q(x) = -2 x^2-4 x-15$", + "Output Answer": [ + "$-8 x^4-42 x^3-108 x^2-187 x+30$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*x**2+13*x-2\nq = -2*x**2-4*x-15\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(3+3 i) \\sqrt{3}$ and $y=(1+4 i) \\sqrt{3}$", + "Output Answer": [ + "$(2-i) \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (3+3*i)*math.sqrt(3)\ny = (1+4*i)*math.sqrt(3)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-8 x^4-5 x^3+9 x^2+2 x+2$ when divided by $10-3 x$.", + "Output Answer": [ + "$\\frac{8 x^3}{3}+\\frac{95 x^2}{9}+\\frac{869 x}{27}+\\frac{8636}{81}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**4-5*x**3+9*x**2+2*x+2\nq = 10-3*x\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\sqrt{3} \\left(\\frac{1}{4}-\\frac{\\sqrt{5}}{4}-i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)$.", + "Output Answer": [ + "Norm: $\\sqrt{3 \\left(\\frac{5}{8}+\\frac{\\sqrt{5}}{8}+\\left(\\frac{1}{4}-\\frac{\\sqrt{5}}{4}\\right)^2\\right)}$\nArgument: $\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}}{\\frac{\\sqrt{5}}{4}-\\frac{1}{4}}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.sqrt(3)*((1/4)-((math.sqrt(5))/4)-i*math.sqrt((5/8)+((math.sqrt(5))/8)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2+7 x+9 y^2-10 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(y-\\frac{5}{9}\\right)^2-6 \\left(x-\\frac{7}{12}\\right)^2=\\frac{629}{72}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{7}{12} & \\frac{5}{9}-\\frac{\\sqrt{3145}}{36} \\\\\n \\frac{7}{12} & \\frac{1}{36} \\left(20+\\sqrt{3145}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{2}}$\nCenter: $\\left\\{\\frac{7}{12},\\frac{1}{2} \\left(\\frac{5}{9}-\\frac{\\sqrt{3145}}{36}+\\frac{1}{36} \\left(20+\\sqrt{3145}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{36} \\left(20+7 \\sqrt{6}\\right)-\\sqrt{\\frac{2}{3}} x,y=\\sqrt{\\frac{2}{3}} x+\\frac{1}{36} \\left(20-7 \\sqrt{6}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2+7*x+9*y**2-10*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^5+6 x^4-8 x^3+8 x^2+2 x-9$ when divided by $x^3+2 x^2-x-8$.", + "Output Answer": [ + "$-9 x^2+24 x-65$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**5+6*x**4-8*x**3+8*x**2+2*x-9\nq = x**3+2*x**2-x-8\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-3 x^2-7 x$", + "Output Answer": [ + "$x=-\\frac{7}{3}\\lor x=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-3*x**2-7*x, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((17+15)-22)-8) ((2+15)-13)$.", + "Output Answer": [ + "$8$" + ], + "Output Program": [ + "try: \n print((((17+15)-22)-8)*((2+15)-13))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{3+5 i}{\\sqrt{3}}$ and $y=\\frac{6+4 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{2}{3}+14 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((3+5*i)/(math.sqrt(3)))\ny = ((6+4*i)/(math.sqrt(3)))\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11-\\frac{57 x}{4}}+\\sqrt{\\frac{27}{4}-4 x}=\\frac{17}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{34 \\left(-600+\\sqrt{297803}\\right)}{1681}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11-((57*x)/4))+sqrt((27/4)-4*x), (17/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{12 x^2-206 x-418}{380-20 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{11}{6}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((12*x**2-206*x-418)/(380-20*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{19 x}{\\sqrt{3}}+\\frac{31 y}{\\sqrt{3}}+\\frac{4}{\\sqrt{3}}=0$, $\\frac{28 x}{\\sqrt{3}}+\\frac{8 y}{\\sqrt{3}}+3 \\sqrt{3}=0$", + "Output Answer": [ + "$x=-\\frac{247}{1020}$, $y=-\\frac{283}{1020}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((19*x)/(sqrt(3)))+((31*y)/(sqrt(3)))+(4/(sqrt(3))), ((28*x)/(sqrt(3)))+((8*y)/(sqrt(3)))+3*sqrt(3)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 16 (x+1)^2, q(x) = 5 (x+1)$", + "Output Answer": [ + "$16 x^2+37 x+21$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 16*(x+1)**2\nq = 5*(x+1)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{59}{27}$, and $a_n=a_{n-1}+-10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$-\\frac{38560}{9}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (59/27) # initial value\nd = -10 # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (59/27) # initial value\nd = -10 # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-9 x^4-2 x^3+2 x^2+8$ when divided by $-2 x-4$.", + "Output Answer": [ + "$\\frac{9 x^3}{2}-8 x^2+15 x-30$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -9*x**4-2*x**3+2*x**2+8\nq = -2*x-4\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-4 \\sqrt{3} x^2-2 \\sqrt{3} x+4 \\sqrt{3}$", + "Output Answer": [ + "$\\frac{17 \\sqrt{3}}{4}-4 \\sqrt{3} \\left(x+\\frac{1}{4}\\right)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-4*math.sqrt(3)*x**2-2*math.sqrt(3)*x+4*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-50 x^3+220 x^2-50 x-120}{500 x+300}=0$", + "Output Answer": [ + "$\\{\\{x\\to 1\\},\\{x\\to 4\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-50*x**3+220*x**2-50*x-120)/(500*x+300)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{44}{57}$, and $a_n=a_{n-1}+-\\frac{3}{\\sqrt{2}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=17$.", + "Output Answer": [ + "$\\frac{17}{2} \\left(-\\frac{88}{57}-24 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(44/57) # initial value\nd = -(3/(math.sqrt(2))) # second term\nn = 17 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(44/57) # initial value\nd = -(3/(math.sqrt(2))) # second term\nn = 17 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2-\\frac{1488 x}{7}+\\frac{1404}{7}$", + "Output Answer": [ + "$-12 (1-x) \\left(x-\\frac{117}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2-((1488*x)/7)+(1404/7), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $3 \\sqrt{2} \\left(-\\sin \\left(\\frac{29 \\pi }{180}\\right)+i \\cos \\left(\\frac{29 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $3 \\sqrt{2 \\left(\\sin ^2\\left(\\frac{29 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{29 \\pi }{180}\\right)\\right)}$\nArgument: $\\frac{119 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 3*math.sqrt(2)*(-math.sin(((29*math.pi)/180))+i*math.cos(((29*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 14 x^2+5 x+8$ and $q(x) = -14 x^2+11 x+4$", + "Output Answer": [ + "$-196 x^4+84 x^3-x^2+108 x+32$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 14*x**2+5*x+8\nq = -14*x**2+11*x+4\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{5 x+6}{\\sqrt{2}}, q(x) = \\frac{(x+2)^3}{2 \\sqrt{2}}$", + "Output Answer": [ + "$\\frac{x^3}{2 \\sqrt{2}}+\\frac{3 x^2}{\\sqrt{2}}+3 \\sqrt{2} x-\\frac{5 x}{\\sqrt{2}}-\\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((5*x+6)/(sqrt(2)))\nq = (((x+2)**3)/(2*sqrt(2)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\cos \\left(\\frac{\\pi }{9}\\right)+i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$117649 \\left(-\\frac{1}{2}+\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.cos((math.pi/9))+1j*math.sin((math.pi/9))))**6)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{55 x^2}{7}+4 x+\\frac{62}{7}$", + "Output Answer": [ + "$\\frac{3606}{385}-\\frac{55}{7} \\left(x-\\frac{14}{55}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((55*x**2)/7)+4*x+(62/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2-9 x}+\\sqrt{2-8 x}=3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -153+30 \\sqrt{26}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2-9*x)+sqrt(2-8*x), 3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{6-9 i}{\\sqrt{\\pi }}$ and $y=\\frac{17}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{23-9 i}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((6-9*i)/(math.sqrt(math.pi)))\ny = (17/(math.sqrt(math.pi)))\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(15+10)+((19+16)+18)$.", + "Output Answer": [ + "$78$" + ], + "Output Program": [ + "try: \n print((15+10)+((19+16)+18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{4} (1-5 x)^4, q(x) = 8 (x-2)^2$", + "Output Answer": [ + "$\\frac{625 x^4}{4}-125 x^3+\\frac{91 x^2}{2}-37 x+\\frac{129}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/4)*(1-5*x)**4\nq = 8*(x-2)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{21 x^2-x-17}{-20 x^2-18 x+7}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{42} \\left(1-\\sqrt{1429}\\right)\\right\\},\\left\\{x\\to \\frac{1}{42} \\left(1+\\sqrt{1429}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((21*x**2-x-17)/(-20*x**2-18*x+7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-2.3+4.8 i$ and $y=-5.6+5.5 i$", + "Output Answer": [ + "$-7.9+10.3 i$" + ], + "Output Program": [ + "i = 1j\nx = -2.3+4.8*i\ny = -5.6+5.5*i\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{3 x^2}{2}+\\frac{21 x}{4}-9$ and $q(x) = -2 x^2+\\frac{x}{2}-\\frac{27}{4}$", + "Output Answer": [ + "$-3 x^4-\\frac{39 x^3}{4}+\\frac{21 x^2}{2}-\\frac{639 x}{16}+\\frac{243}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((3*x**2)/2)+((21*x)/4)-9\nq = -2*x**2+(x/2)-(27/4)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $1$ and $-4 x^5-\\frac{5 x^4}{2}-3 x^3+\\frac{3 x^2}{2}-\\frac{5 x}{2}+\\frac{5}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(1, -4*x**5-((5*x**4)/2)-3*x**3+((3*x**2)/2)-((5*x)/2)+(5/2)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-9 x^2+7 x-2$", + "Output Answer": [ + "$x=\\frac{1}{18} \\left(7-i \\sqrt{23}\\right)\\lor x=\\frac{1}{18} \\left(7+i \\sqrt{23}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-9*x**2+7*x-2, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{1}{5}-\\frac{33 x}{5}\\right| =\\frac{11}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{10}{33}\\right\\},\\left\\{x\\to \\frac{4}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs((1/5)-((33*x)/5)), (11/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{17 x^2}{\\sqrt{3}}+7 \\sqrt{3} x+\\frac{10}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{34} \\left(-21-i \\sqrt{239}\\right)\\lor x=\\frac{1}{34} \\left(-21+i \\sqrt{239}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((17*x**2)/(sqrt(3)))+7*sqrt(3)*x+(10/(sqrt(3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=45 t-\\frac{159}{2}, x(t)=9 t-15$", + "Output Answer": [ + "$y=5 x-\\frac{9}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 45*t-(159/2)\nx_t = 9*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{875 x^2}{3}+\\frac{20 x}{3}+5}{5-35 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{3}{25}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((875*x**2)/3)+((20*x)/3)+5)/(5-35*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $5 \\left(-\\cos \\left(\\frac{7 \\pi }{180}\\right)+i \\sin \\left(\\frac{7 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $5 \\sqrt{\\sin ^2\\left(\\frac{7 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{7 \\pi }{180}\\right)}$\nArgument: $\\frac{173 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 5*(-math.cos(((7*math.pi)/180))+i*math.sin(((7*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-4 x-3 y^2+6 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(x-\\frac{1}{2}\\right)^2-3 (y-1)^2=-8$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & 1-\\sqrt{\\frac{14}{3}} \\\\\n \\frac{1}{2} & 1+\\sqrt{\\frac{14}{3}} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{7}}{2}$\nCenter: $\\left\\{\\frac{1}{2},1\\right\\}$\nAsymptotes: $\\left\\{y=-\\frac{2 x}{\\sqrt{3}}+\\frac{1}{\\sqrt{3}}+1,y=\\frac{2 x}{\\sqrt{3}}-\\frac{1}{\\sqrt{3}}+1\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-4*x-3*y**2+6*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(14+25)-((((2-15)+3)-21)-24)$.", + "Output Answer": [ + "$94$" + ], + "Output Program": [ + "try: \n print((14+25)-((((2-15)+3)-21)-24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\left(x^2-9 x+1\\right) \\log (2)$, $q(x) = \\left(-5 x^2-10 x+2\\right) \\log (2)$", + "Output Answer": [ + "$-4 x^2 \\log (2)-19 x \\log (2)+3 \\log (2)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (x**2-9*x+1)*log(2)\nq = (-5*x**2-10*x+2)*log(2)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 x^2-4 x-13$ and $q(x) = -8 x^2-6 x+8$", + "Output Answer": [ + "$-16 x^4+20 x^3+144 x^2+46 x-104$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*x**2-4*x-13\nq = -8*x**2-6*x+8\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\frac{\\sqrt{172}}{\\sqrt{97}-21}$.", + "Output Answer": [ + "$\\frac{2 \\sqrt{43}}{\\sqrt{97}-21}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(((sqrt(172))/(sqrt(97)-21)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$\\log \\left(\\frac{7 x}{5}\\right)$", + "Output Answer": [ + "$(x-\\log (7)+\\log (5)-\\log (2))^2+2 (x-\\log (7)+\\log (5)-\\log (2))+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, log(((7*x)/5)))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{2 x^2+19 x-12}{4 x^2+15 x+6}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-19-\\sqrt{457}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(-19+\\sqrt{457}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((2*x**2+19*x-12)/(4*x**2+15*x+6)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{9 x^3}{2}-\\frac{13 x^2}{2}-2 x+5$ when divided by $-8 x^3-\\frac{3 x^2}{2}+\\frac{3 x}{2}-\\frac{13}{2}$.", + "Output Answer": [ + "$-\\frac{9}{16}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((9*x**3)/2)-((13*x**2)/2)-2*x+5\nq = -8*x**3-((3*x**2)/2)+((3*x)/2)-(13/2)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-6+\\frac{5 i}{2}$ and $y=-\\frac{9}{2}-5 i$", + "Output Answer": [ + "$-\\frac{21}{2}-\\frac{5 i}{2}$" + ], + "Output Program": [ + "i = 1j\nx = -6+((5*i)/2)\ny = -(9/2)-5*i\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$7 \\sqrt{5} x+6 \\sqrt{5} y-\\sqrt{5} z+8 \\sqrt{5}=0$, $5 \\sqrt{5} x-5 \\sqrt{5} y+7 \\sqrt{5} z+3 \\sqrt{5}=0$, $-8 \\sqrt{5} x+9 \\sqrt{5} y+6 \\sqrt{5} z-10 \\sqrt{5}=0$", + "Output Answer": [ + "$x=-\\frac{1249}{1172}$, $y=-\\frac{23}{586}$, $z=\\frac{357}{1172}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((7*sqrt(5)*x+6*sqrt(5)*y-sqrt(5)*z+8*sqrt(5), 5*sqrt(5)*x-5*sqrt(5)*y+7*sqrt(5)*z+3*sqrt(5), -8*sqrt(5)*x+9*sqrt(5)*y+6*sqrt(5)*z-10*sqrt(5))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x^5-10 x^4-10 x^2-15 x+10$ and $-x^5+2 x^4+2 x^2+3 x-2$.", + "Output Answer": [ + "$x^5-2 x^4-2 x^2-3 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x**5-10*x**4-10*x**2-15*x+10, -x**5+2*x**4+2*x**2+3*x-2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-4 x^2+4 x-25}{13 x+8}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-4*x**2+4*x-25)/(13*x+8)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{42}{5}-\\frac{27 i}{5}$ and $y=\\frac{32}{5}+\\frac{2 i}{5}$", + "Output Answer": [ + "$\\frac{645}{514}-\\frac{237 i}{257}$" + ], + "Output Program": [ + "i = 1j\nx = (42/5)-((27*i)/5)\ny = (32/5)+((2*i)/5)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 15 x^2+14 x+15$ and $q(x) = -7 x^2+10 x-13$", + "Output Answer": [ + "$-105 x^4+52 x^3-160 x^2-32 x-195$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 15*x**2+14*x+15\nq = -7*x**2+10*x-13\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $8 x^2+128 \\sqrt{3} x+1536$", + "Output Answer": [ + "$8 \\left(x+8 \\sqrt{3}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(8*x**2+128*sqrt(3)*x+1536, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{3}, 5, 9)$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{955}}{3},\\tan ^{-1}\\left(\\frac{\\sqrt{226}}{27}\\right),\\tan ^{-1}(15)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/3)\ny = 5\nz = 9\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $15 x^4+16 x^3-16 x^2-8 x$ and $5 x^2+2 x$.", + "Output Answer": [ + "$5 x^2+2 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(15*x**4+16*x**3-16*x**2-8*x, 5*x**2+2*x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 16 (2-3 x)^4, q(x) = (3 x+7)^2$", + "Output Answer": [ + "$1296 x^4-3456 x^3+3465 x^2-1494 x+305$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 16*(2-3*x)**4\nq = (3*x+7)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+2 x+y^2+7 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $9 \\left(x+\\frac{1}{9}\\right)^2+\\left(y+\\frac{7}{2}\\right)^2=\\frac{661}{36}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{9} & -\\frac{7}{2}-\\frac{\\sqrt{1322}}{9} \\\\\n -\\frac{1}{9} & \\frac{\\sqrt{1322}}{9}-\\frac{7}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2 \\sqrt{2}}{3}$\nCenter: $\\left\\{-\\frac{1}{9},-\\frac{7}{2}\\right\\}$\nArea Enclosed: $\\frac{661 \\pi }{108}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+2*x+y**2+7*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-11 x^2-\\frac{72 x}{7}+\\frac{92}{7}$", + "Output Answer": [ + "$x=\\frac{2}{77} \\left(-18-\\sqrt{2095}\\right)\\lor x=\\frac{2}{77} \\left(\\sqrt{2095}-18\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-11*x**2-((72*x)/7)+(92/7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{((21+23)-23)+23}{\\frac{7}{7}}$.", + "Output Answer": [ + "$44$" + ], + "Output Program": [ + "try: \n print(((((21+23)-23)+23)/(7/7)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 4 \\sqrt{3} x+\\frac{26}{\\sqrt{3}}\\right| =-\\frac{40}{\\sqrt{3}}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(4*sqrt(3)*x+(26/(sqrt(3)))), -(40/(sqrt(3)))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{5}, \\frac{1}{4}, \\frac{1}{7})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{2409}}{140},\\tan ^{-1}\\left(\\frac{7 \\sqrt{41}}{20}\\right),\\tan ^{-1}\\left(\\frac{5}{4}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/5)\ny = (1/4)\nz = (1/7)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{21 x^2+x+1}{\\sqrt{3}}$, $q(x) = \\frac{16 x^2-x-3}{\\sqrt{3}}$", + "Output Answer": [ + "$7 \\sqrt{3} x^2+\\frac{16 x^2}{\\sqrt{3}}-\\sqrt{3}+\\frac{1}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((21*x**2+x+1)/(sqrt(3)))\nq = ((16*x**2-x-3)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2+6 x+7 y^2-4 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x+\\frac{3}{10}\\right)^2+7 \\left(y-\\frac{2}{7}\\right)^2=\\frac{453}{70}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{10} & \\frac{2}{7}-\\frac{3 \\sqrt{151}}{70} \\\\\n -\\frac{3}{10} & \\frac{2}{7}+\\frac{3 \\sqrt{151}}{70} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{10}}$\nCenter: $\\left\\{-\\frac{3}{10},\\frac{2}{7}\\right\\}$\nArea Enclosed: $\\frac{453 \\pi }{70 \\sqrt{70}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2+6*x+7*y**2-4*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2+10 x+3 y^2-10 y+7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(y-\\frac{5}{3}\\right)^2-3 \\left(x-\\frac{5}{3}\\right)^2=-7$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{3} \\left(5-\\sqrt{42}\\right) & \\frac{5}{3} \\\\\n \\frac{1}{3} \\left(5+\\sqrt{42}\\right) & \\frac{5}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{3} \\left(5-\\sqrt{42}\\right)+\\frac{1}{3} \\left(5+\\sqrt{42}\\right)\\right),\\frac{5}{3}\\right\\}$\nAsymptotes: $\\left\\{y=x,y=\\frac{10}{3}-x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2+10*x+3*y**2-10*y+7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\cos ^{-1}\\left(2-\\frac{15 x}{2}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{15} (4-2 \\cos (y))\\text{ if }0\\leq y\\leq \\pi $}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, acos(2-((15*x)/2)))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $-\\sin (8 x+8)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{8} (2 \\pi c_1-8)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\},\\left\\{x\\to \\fbox{$\\frac{1}{8} (2 \\pi c_1+\\pi -8)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(-sin(8*x+8), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 10 x^2-9 x$ and $q(x) = -11 x^2-7 x-1$", + "Output Answer": [ + "$-110 x^4+29 x^3+53 x^2+9 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 10*x**2-9*x\nq = -11*x**2-7*x-1\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6 x-4}+\\sqrt{13 x+3}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(1167-16 \\sqrt{4502}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6*x-4)+sqrt(13*x+3), 8), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{31}{9}$, and $a_n=a_{n-1}+\\frac{17}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{215}{6}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (31/9) # initial value\nd = (17/2) # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (31/9) # initial value\nd = (17/2) # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=\\frac{14-10 i}{\\sqrt{3}}$ and $y=\\frac{16+2 i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{30-8 i}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((14-10*i)/(math.sqrt(3)))\ny = ((16+2*i)/(math.sqrt(3)))\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 17 x-24| =-20$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(17*x-24), -20), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $10 x^2+9 x+8$", + "Output Answer": [ + "$10 \\left(x+\\frac{9}{20}\\right)^2+\\frac{239}{40}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (10*x**2+9*x+8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-12 x^2-13 x+14$", + "Output Answer": [ + "$x=-\\frac{7}{4}\\lor x=\\frac{2}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-12*x**2-13*x+14, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{5}{2} e^{-\\frac{7 i \\pi }{18}}$.", + "Output Answer": [ + "Norm: $\\frac{5}{2}$\nArgument: $-\\frac{7 \\pi }{18}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (5/2)*math.e**(-((7*i*math.pi)/18))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 (1-3 x)^2, q(x) = 16 (x+2)^2$", + "Output Answer": [ + "$52 x^2+40 x+68$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*(1-3*x)**2\nq = 16*(x+2)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -9 x^2-4 x+14$ and $q(x) = -x^2+6 x-\\frac{1}{2}$", + "Output Answer": [ + "$9 x^4-50 x^3-\\frac{67 x^2}{2}+86 x-7$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -9*x**2-4*x+14\nq = -x**2+6*x-(1/2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 \\pi x+5 \\pi$ and $q(x) = \\pi x+5 \\pi$", + "Output Answer": [ + "$3 \\pi ^2 x^2+20 \\pi ^2 x+25 \\pi ^2$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*pi*x+5*pi\nq = pi*x+5*pi\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{15 x}{4}-\\frac{11}{4}}+\\sqrt{\\frac{21 x}{4}+13}=\\frac{19}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(701-19 \\sqrt{1329}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((15*x)/4)-(11/4))+sqrt(((21*x)/4)+13), (19/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\left(\\cos \\left(\\frac{7}{18}\\right)+i \\sin \\left(\\frac{7}{18}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$16777216 \\left(\\cos \\left(\\frac{14}{3}\\right)+i \\sin \\left(\\frac{14}{3}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*(math.cos((7/18))+1j*math.sin((7/18))))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -5 \\sqrt{5} (x+1)^3, q(x) = 135 \\sqrt{5} (x+1)^3$", + "Output Answer": [ + "$130 \\sqrt{5} x^3+390 \\sqrt{5} x^2+390 \\sqrt{5} x+130 \\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*sqrt(5)*(x+1)**3\nq = 135*sqrt(5)*(x+1)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-5 i \\sqrt{3}$ and $y=-\\frac{12-14 i}{\\sqrt{3}}$", + "Output Answer": [ + "$70+60 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -5*i*math.sqrt(3)\ny = -((12-14*i)/(math.sqrt(3)))\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(1-24)+\\frac{1}{14} ((4-20)+19)^2$.", + "Output Answer": [ + "$-\\frac{313}{14}$" + ], + "Output Program": [ + "try: \n print((1-24)+(1/14)*((4-20)+19)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{19 x+15}{\\sqrt{3}}$, $q(x) = -\\frac{2 \\left(5 x^2+x+2\\right)}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{10 x^2}{\\sqrt{3}}+\\frac{17 x}{\\sqrt{3}}+5 \\sqrt{3}-\\frac{4}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((19*x+15)/(sqrt(3)))\nq = -((2*(5*x**2+x+2))/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2-x+9 y^2-9 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(y-\\frac{1}{2}\\right)^2-10 \\left(x+\\frac{1}{20}\\right)^2=\\frac{449}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{20} & \\frac{1}{2}-\\frac{\\sqrt{8531}}{60} \\\\\n -\\frac{1}{20} & \\frac{1}{60} \\left(30+\\sqrt{8531}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{19}{10}}$\nCenter: $\\left\\{-\\frac{1}{20},\\frac{1}{2} \\left(\\frac{1}{2}-\\frac{\\sqrt{8531}}{60}+\\frac{1}{60} \\left(30+\\sqrt{8531}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{60} \\left(30-\\sqrt{10}\\right)-\\frac{\\sqrt{10} x}{3},y=\\frac{\\sqrt{10} x}{3}+\\frac{1}{60} \\left(30+\\sqrt{10}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2-x+9*y**2-9*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 \\sqrt{3} x^2+5 \\sqrt{3} x$ and $q(x) = -8 \\sqrt{3} x^2+6 \\sqrt{3} x+8 \\sqrt{3}$", + "Output Answer": [ + "$-48 x^4-84 x^3+138 x^2+120 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*sqrt(3)*x**2+5*sqrt(3)*x\nq = -8*sqrt(3)*x**2+6*sqrt(3)*x+8*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 6 x^2+11 x+1$ and $q(x) = 12 x^2+13 x-4$", + "Output Answer": [ + "$72 x^4+210 x^3+131 x^2-31 x-4$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 6*x**2+11*x+1\nq = 12*x**2+13*x-4\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$10 x+19 y-15 z-9=0$, $-6 x-9 y-8 z+20=0$, $-24 y+18 z-20=0$", + "Output Answer": [ + "$x=\\frac{4643}{1824}$, $y=-\\frac{193}{912}$, $z=\\frac{63}{76}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((10*x+19*y-15*z-9, -6*x-9*y-8*z+20, -24*y+18*z-20)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -10 x^2-x-4$ and $q(x) = 9 x^2+15 x-7$", + "Output Answer": [ + "$-90 x^4-159 x^3+19 x^2-53 x+28$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -10*x**2-x-4\nq = 9*x**2+15*x-7\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2+3 x+y^2-7 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $\\left(y-\\frac{7}{2}\\right)^2-6 \\left(x-\\frac{1}{4}\\right)^2=\\frac{87}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{4} & \\frac{7}{2}-\\frac{\\sqrt{203}}{4} \\\\\n \\frac{1}{4} & \\frac{1}{4} \\left(14+\\sqrt{203}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{6}}$\nCenter: $\\left\\{\\frac{1}{4},\\frac{1}{2} \\left(\\frac{7}{2}-\\frac{\\sqrt{203}}{4}+\\frac{1}{4} \\left(14+\\sqrt{203}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{4} \\left(14+\\sqrt{6}\\right)-\\sqrt{6} x,y=\\sqrt{6} x+\\frac{1}{4} \\left(14-\\sqrt{6}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2+3*x+y**2-7*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{1}{3}$, and $a_n=a_{n-1}+4 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$\\frac{23}{2} \\left(\\frac{2}{3}+88 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\na = (1/3) # initial value\nd = 4*math.sqrt(5) # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (1/3) # initial value\nd = 4*math.sqrt(5) # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-4 x+10 y^2-7 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x-\\frac{1}{4}\\right)^2+10 \\left(y-\\frac{7}{20}\\right)^2=\\frac{429}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{4}-\\frac{\\sqrt{429}}{40} & \\frac{7}{20} \\\\\n \\frac{1}{40} \\left(10+\\sqrt{429}\\right) & \\frac{7}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{4}-\\frac{\\sqrt{429}}{40}+\\frac{1}{40} \\left(10+\\sqrt{429}\\right)\\right),\\frac{7}{20}\\right\\}$\nArea Enclosed: $\\frac{429 \\pi }{160 \\sqrt{5}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-4*x+10*y**2-7*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-9 x^2-10 x-11$", + "Output Answer": [ + "$x=\\frac{1}{9} \\left(-5-i \\sqrt{74}\\right)\\lor x=\\frac{1}{9} \\left(-5+i \\sqrt{74}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-9*x**2-10*x-11, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{61}{46}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$-\\frac{1525}{46}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(61/46) # initial value\nd = 0 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(61/46) # initial value\nd = 0 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-20 x+19 y-15=0$, $-21 x+7 y-9=0$", + "Output Answer": [ + "$x=-\\frac{66}{259}$, $y=\\frac{135}{259}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-20*x+19*y-15, -21*x+7*y-9), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-6 x-14=0$, $20 x+18 y-5=0$", + "Output Answer": [ + "$x=-\\frac{7}{3}$, $y=\\frac{155}{54}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-6*x-14, 20*x+18*y-5), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(13+9 i) \\log (2)$ and $y=(-10+12 i) \\log (2)$", + "Output Answer": [ + "$(-238+66 i) \\log ^2(2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (13+9*i)*math.log10(2)\ny = (-10+12*i)*math.log10(2)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-3 x^2-\\frac{75 x}{7}-\\frac{92}{7}$", + "Output Answer": [ + "$-3 \\left(x+\\frac{25}{14}\\right)^2-\\frac{701}{196}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-3*x**2-((75*x)/7)-(92/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -54 \\sqrt{2} (2 x-1)^3, q(x) = \\frac{1}{4} (7 x+1)^4$", + "Output Answer": [ + "$\\frac{2401 x^4}{4}-432 \\sqrt{2} x^3+343 x^3+648 \\sqrt{2} x^2+\\frac{147 x^2}{2}-324 \\sqrt{2} x+7 x+54 \\sqrt{2}+\\frac{1}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -54*sqrt(2)*(2*x-1)**3\nq = (1/4)*(7*x+1)**4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-7 \\left(\\cos \\left(\\frac{\\pi }{30}\\right)+i \\sin \\left(\\frac{\\pi }{30}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$13841287201 \\left(\\frac{1}{4} \\left(\\sqrt{5}-1\\right)+i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-7*(math.cos((math.pi/30))+1j*math.sin((math.pi/30))))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{7 x^2+3 x-25}{\\sqrt{3}}$, $q(x) = \\frac{-12 x^2+26 x-19}{\\sqrt{3}}$", + "Output Answer": [ + "$-4 \\sqrt{3} x^2+\\frac{7 x^2}{\\sqrt{3}}+\\sqrt{3} x+\\frac{26 x}{\\sqrt{3}}-\\frac{44}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((7*x**2+3*x-25)/(sqrt(3)))\nq = ((-12*x**2+26*x-19)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(8+6)+\\left(\\frac{5-9}{17}-9\\right)$.", + "Output Answer": [ + "$\\frac{81}{17}$" + ], + "Output Program": [ + "try: \n print((8+6)+(((5-9)/17)-9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $8 x-11 x^2$", + "Output Answer": [ + "$x=\\frac{8}{11}\\lor x=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(8*x-11*x**2, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-3 x-19 y-3=0$, $12 x-16 y-24=0$", + "Output Answer": [ + "$x=\\frac{34}{23}$, $y=-\\frac{9}{23}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-3*x-19*y-3, 12*x-16*y-24), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{17 x^2}{\\sqrt{3}}-\\frac{13 x}{\\sqrt{3}}+\\frac{2}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{1}{34} \\left(13-\\sqrt{33}\\right)\\lor x=\\frac{1}{34} \\left(13+\\sqrt{33}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((17*x**2)/(sqrt(3)))-((13*x)/(sqrt(3)))+(2/(sqrt(3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-2 \\sqrt{3} x-13 \\sqrt{3} y+10 \\sqrt{3}=0$, $-11 \\sqrt{3} x+4 \\sqrt{3} y+10 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{170}{151}$, $y=\\frac{90}{151}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-2*sqrt(3)*x-13*sqrt(3)*y+10*sqrt(3), -11*sqrt(3)*x+4*sqrt(3)*y+10*sqrt(3)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{25 x^2+5 x+9}{\\sqrt{3}}$, $q(x) = \\frac{11 x^2+8 x-26}{\\sqrt{3}}$", + "Output Answer": [ + "$12 \\sqrt{3} x^2+\\frac{13 x}{\\sqrt{3}}+3 \\sqrt{3}-\\frac{26}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((25*x**2+5*x+9)/(sqrt(3)))\nq = ((11*x**2+8*x-26)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-5 x^2-3 x+2$ and $4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-5*x**2-3*x+2, 4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = e x-2 e x^2$ and $q(x) = -5 e x^2-3 e x+e$", + "Output Answer": [ + "$10 e^2 x^4+e^2 x^3-5 e^2 x^2+e^2 x$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = math.e*x-2*math.e*x**2\nq = -5*math.e*x**2-3*math.e*x+math.e\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $10 x^2-5 x+12$", + "Output Answer": [ + "$10 \\left(x-\\frac{1}{4}\\right)^2+\\frac{91}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (10*x**2-5*x+12), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2+3 x+4 y^2-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 y^2-6 \\left(x-\\frac{1}{4}\\right)^2=\\frac{61}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{4} & -\\frac{\\sqrt{\\frac{305}{6}}}{4} \\\\\n \\frac{1}{4} & \\frac{\\sqrt{\\frac{305}{6}}}{4} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{3}}$\nCenter: $\\left\\{\\frac{1}{4},0\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{\\frac{3}{2}}}{4}-\\sqrt{\\frac{3}{2}} x,y=\\sqrt{\\frac{3}{2}} x-\\frac{\\sqrt{\\frac{3}{2}}}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2+3*x+4*y**2-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{10 \\left(\\frac{1}{4} \\left(1-\\sqrt{5}\\right)+i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)}{\\sqrt{3}}\\right)^5$", + "Output Answer": [ + "$-\\frac{100000}{9 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((10*((1/4)*(1-math.sqrt(5))+1j*math.sqrt((5/8)+((math.sqrt(5))/8))))/(math.sqrt(3))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{59}{54}$, and $a_n=a_{n-1}+-\\frac{26}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$-\\frac{4385}{54}$" + ], + "Output Program": [ + "a = (59/54) # initial value\nd = -(26/3) # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (59/54) # initial value\nd = -(26/3) # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{4 \\left(2187 t^2+17010 t+33166\\right)^2}{2401}, x(t)=\\frac{729 t^2}{49}+\\frac{810 t}{7}+225$", + "Output Answer": [ + "$y=36 x^2+\\frac{312 x}{7}+\\frac{676}{49}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = ((4*(2187*t**2+17010*t+33166)**2)/2401)\nx_t = ((729*t**2)/49)+((810*t)/7)+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((21+11)-13)-\\left((1+14)^2-6\\right)$.", + "Output Answer": [ + "$-200$" + ], + "Output Program": [ + "try: \n print(((21+11)-13)-((1+14)**2-6))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 14 \\sqrt{3} x-6 \\sqrt{3}\\right| =-\\frac{13}{\\sqrt{3}}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(14*sqrt(3)*x-6*sqrt(3)), -(13/(sqrt(3)))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\sqrt{2} \\left(\\cos \\left(\\frac{59}{30}\\right)+i \\sin \\left(\\frac{59}{30}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$17496 \\sqrt{2} \\left(\\cos \\left(\\frac{413}{30}\\right)+i \\sin \\left(\\frac{413}{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*math.sqrt(2)*(math.cos((59/30))+1j*math.sin((59/30))))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2-2 x-10 y^2+4 y+9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(x-\\frac{1}{2}\\right)^2-10 \\left(y-\\frac{1}{5}\\right)^2=-\\frac{89}{10}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & \\frac{1}{10} \\left(2-\\sqrt{534}\\right) \\\\\n \\frac{1}{2} & \\frac{1}{10} \\left(2+\\sqrt{534}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{6}$\nCenter: $\\left\\{\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{10} \\left(2-\\sqrt{534}\\right)+\\frac{1}{10} \\left(2+\\sqrt{534}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{10} \\left(2+\\sqrt{5}\\right)-\\frac{x}{\\sqrt{5}},y=\\frac{x}{\\sqrt{5}}+\\frac{1}{10} \\left(2-\\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2-2*x-10*y**2+4*y+9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{11 x^2+\\frac{32 x}{3}-\\frac{26}{3}}{\\frac{10 x}{3}-12}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{33} \\left(-16-\\sqrt{1114}\\right)\\right\\},\\left\\{x\\to \\frac{1}{33} \\left(-16+\\sqrt{1114}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((11*x**2+((32*x)/3)-(26/3))/(((10*x)/3)-12)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{29 x}{2}+4 y+\\frac{21}{2}=0$, $\\frac{37 x}{2}-20 y-\\frac{39}{2}=0$", + "Output Answer": [ + "$x=\\frac{11}{18}$, $y=-\\frac{59}{144}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((29*x)/2)+4*y+(21/2), ((37*x)/2)-20*y-(39/2)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(8+17)+(19+20)$.", + "Output Answer": [ + "$64$" + ], + "Output Program": [ + "try: \n print((8+17)+(19+20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{2 \\left(6 x^2-21 x+4\\right)}{\\pi }$, $q(x) = \\frac{17 x^2-23 x-47}{\\pi }$", + "Output Answer": [ + "$\\frac{5 x^2}{\\pi }+\\frac{19 x}{\\pi }-\\frac{55}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((2*(6*x**2-21*x+4))/pi)\nq = ((17*x**2-23*x-47)/pi)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the third order series of the inverse of the following function around 3:\n$\\frac{1}{81 x^{10}}$", + "Output Answer": [ + "$\\frac{1}{3^{2/5} \\sqrt[10]{x}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, (1/(81*x**10)))\nprint(solve(f, x)[0].series(y, 3, 3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{82}{51}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$\\frac{820}{51}$" + ], + "Output Program": [ + "a = (82/51) # initial value\nd = 0 # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (82/51) # initial value\nd = 0 # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\sqrt{2} \\left(-\\sin \\left(\\frac{17 \\pi }{90}\\right)+i \\cos \\left(\\frac{17 \\pi }{90}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$72 \\left(-\\sin \\left(\\frac{11 \\pi }{90}\\right)-i \\cos \\left(\\frac{11 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*math.sqrt(2)*(-math.sin(((17*math.pi)/90))+1j*math.cos(((17*math.pi)/90))))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{22 \\left(\\sin \\left(\\frac{4 \\pi }{45}\\right)-i \\cos \\left(\\frac{4 \\pi }{45}\\right)\\right)}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{22 \\sqrt{\\sin ^2\\left(\\frac{4 \\pi }{45}\\right)+\\cos ^2\\left(\\frac{4 \\pi }{45}\\right)}}{\\pi }$\nArgument: $-\\frac{37 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((22*(math.sin(((4*math.pi)/45))-i*math.cos(((4*math.pi)/45))))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 64 (x+1)^4, q(x) = -16 \\sqrt{2} (x+1)^3$", + "Output Answer": [ + "$64 x^4-16 \\sqrt{2} x^3+256 x^3-48 \\sqrt{2} x^2+384 x^2-48 \\sqrt{2} x+256 x-16 \\sqrt{2}+64$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 64*(x+1)**4\nq = -16*sqrt(2)*(x+1)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{2 x^2}{\\sqrt{3}}-\\frac{22 x}{\\sqrt{3}}+8 \\sqrt{3}$", + "Output Answer": [ + "$\\frac{2 \\left(x-\\frac{11}{2}\\right)^2}{\\sqrt{3}}+8 \\sqrt{3}-\\frac{121}{2 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((2*x**2)/(math.sqrt(3)))-((22*x)/(math.sqrt(3)))+8*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{29}{4} \\left(\\cos \\left(\\frac{4}{3}\\right)+i \\sin \\left(\\frac{4}{3}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$\\frac{353814783205469041 (\\cos (16)+i \\sin (16))}{16777216}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((29/4)*(math.cos((4/3))+1j*math.sin((4/3))))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{((3+15)-1)-25}{\\left(\\left(\\frac{18}{20}+12\\right)+15\\right)+1}$.", + "Output Answer": [ + "$-\\frac{80}{289}$" + ], + "Output Program": [ + "try: \n print(((((3+15)-1)-25)/((((18/20)+12)+15)+1)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{37}{7}-\\frac{102 x}{7}}+\\sqrt{-\\frac{38 x}{7}-\\frac{87}{7}}=\\frac{82}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-55363+41 \\sqrt{1341049}}{1792}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((37/7)-((102*x)/7))+sqrt(-((38*x)/7)-(87/7)), (82/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{86}{39}$, and $a_n=a_{n-1}+-10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$-\\frac{88198}{39}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (86/39) # initial value\nd = -10 # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (86/39) # initial value\nd = -10 # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{43 x}{5}+\\frac{38 y}{5}+\\frac{111 z}{5}-\\frac{109}{5}=0$, $-\\frac{18 x}{5}+\\frac{64 y}{5}+\\frac{93 z}{5}-23=0$, $-\\frac{11 x}{5}+2 y-\\frac{32 z}{5}+\\frac{109}{5}=0$", + "Output Answer": [ + "$x=\\frac{166009}{62728}$, $y=-\\frac{93745}{125456}$, $z=\\frac{70977}{31364}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((43*x)/5)+((38*y)/5)+((111*z)/5)-(109/5), -((18*x)/5)+((64*y)/5)+((93*z)/5)-23, -((11*x)/5)+2*y-((32*z)/5)+(109/5))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2+24 x+90$", + "Output Answer": [ + "$-2 (-x-3) (15-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2+24*x+90, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-10 x-10 y^2+3 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 (x-1)^2-10 \\left(y-\\frac{3}{20}\\right)^2=\\frac{231}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n 1-\\frac{3 \\sqrt{77}}{20} & \\frac{3}{20} \\\\\n 1+\\frac{3 \\sqrt{77}}{20} & \\frac{3}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{2}}$\nCenter: $\\left\\{1,\\frac{3}{20}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{2}}-\\frac{1}{\\sqrt{2}}+\\frac{3}{20},y=\\frac{1}{20} \\left(3+10 \\sqrt{2}\\right)-\\frac{x}{\\sqrt{2}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-10*x-10*y**2+3*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (9, \\pi, 7)$", + "Output Answer": [ + "$\\left\\{\\sqrt{130+\\pi ^2},\\tan ^{-1}\\left(\\frac{\\sqrt{81+\\pi ^2}}{7}\\right),\\tan ^{-1}\\left(\\frac{\\pi }{9}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 9\ny = math.pi\nz = 7\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $5 x^2-\\frac{55 x}{\\sqrt{3}}-350$", + "Output Answer": [ + "$5 \\left(-x-\\frac{10}{\\sqrt{3}}\\right) \\left(7 \\sqrt{3}-x\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(5*x**2-((55*x)/(sqrt(3)))-350, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-3 x^2+\\frac{7 x}{2}+\\frac{5}{4}}{-\\frac{33 x^2}{4}+\\frac{55 x}{4}-\\frac{3}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(7-\\sqrt{109}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(7+\\sqrt{109}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-3*x**2+((7*x)/2)+(5/4))/(-((33*x**2)/4)+((55*x)/4)-(3/2))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-x+4 y^2-y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x-\\frac{1}{16}\\right)^2+4 \\left(y-\\frac{1}{8}\\right)^2=\\frac{163}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{16} & \\frac{1}{16} \\left(2-\\sqrt{163}\\right) \\\\\n \\frac{1}{16} & \\frac{1}{16} \\left(2+\\sqrt{163}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{\\frac{1}{16},\\frac{1}{2} \\left(\\frac{1}{16} \\left(2-\\sqrt{163}\\right)+\\frac{1}{16} \\left(2+\\sqrt{163}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{163 \\pi }{128 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-x+4*y**2-y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^5-x^4-10 x^3-4 x^2-3 x+1$ when divided by $-7$.", + "Output Answer": [ + "$-\\frac{6 x^5}{7}+\\frac{x^4}{7}+\\frac{10 x^3}{7}+\\frac{4 x^2}{7}+\\frac{3 x}{7}-\\frac{1}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**5-x**4-10*x**3-4*x**2-3*x+1\nq = -7\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-2+2 i) \\sqrt{2}$ and $y=(-2+i) \\sqrt{2}$", + "Output Answer": [ + "$i \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-2+2*i)*math.sqrt(2)\ny = (-2+i)*math.sqrt(2)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{3 x^2}{2}-3 x+9$ and $q(x) = -5 x^2+11 x+10$", + "Output Answer": [ + "$-\\frac{15 x^4}{2}+\\frac{63 x^3}{2}-63 x^2+69 x+90$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((3*x**2)/2)-3*x+9\nq = -5*x**2+11*x+10\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\sqrt{3} \\left(\\cos \\left(\\frac{28}{45}\\right)+i \\sin \\left(\\frac{28}{45}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$21233664 \\sqrt{3} \\left(\\cos \\left(\\frac{28}{5}\\right)+i \\sin \\left(\\frac{28}{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*math.sqrt(3)*(math.cos((28/45))+1j*math.sin((28/45))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{83}{34}$, and $a_n=a_{n-1}+-\\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$5 \\left(-\\frac{83}{17}-9 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\na = -(83/34) # initial value\nd = -math.pi # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(83/34) # initial value\nd = -math.pi # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 x^2-2 x+11$, $q(x) = -5 \\left(x^2-3 x+1\\right)$", + "Output Answer": [ + "$-x^2+13 x+6$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**2-2*x+11\nq = -5*(x**2-3*x+1)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{7 x^2}{4}-\\frac{15 x}{4}-\\frac{35}{4}$ and $q(x) = \\frac{3 x^2}{2}+13 x-\\frac{51}{4}$", + "Output Answer": [ + "$-\\frac{21 x^4}{8}-\\frac{227 x^3}{8}-\\frac{633 x^2}{16}-\\frac{1055 x}{16}+\\frac{1785}{16}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((7*x**2)/4)-((15*x)/4)-(35/4)\nq = ((3*x**2)/2)+13*x-(51/4)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-17 x^2-21 x+\\frac{65}{4}}{-\\frac{51 x^2}{4}+\\frac{3 x}{2}-\\frac{29}{4}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{34} \\left(-21-\\sqrt{1546}\\right)\\right\\},\\left\\{x\\to \\frac{1}{34} \\left(-21+\\sqrt{1546}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-17*x**2-21*x+(65/4))/(-((51*x**2)/4)+((3*x)/2)-(29/4))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{11}{4}-3 i$ and $y=-\\frac{27}{4}-\\frac{11 i}{2}$", + "Output Answer": [ + "$\\frac{561}{1213}+\\frac{82 i}{1213}$" + ], + "Output Program": [ + "i = 1j\nx = -(11/4)-3*i\ny = -(27/4)-((11*i)/2)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{1}{90}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$-\\frac{1}{3}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(1/90) # initial value\nd = 0 # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(1/90) # initial value\nd = 0 # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\sqrt{5} x^2-7 \\sqrt{5} x-6 \\sqrt{5}$", + "Output Answer": [ + "$\\frac{25 \\sqrt{5}}{4}-\\sqrt{5} \\left(x+\\frac{7}{2}\\right)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-math.sqrt(5)*x**2-7*math.sqrt(5)*x-6*math.sqrt(5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8 x+\\frac{17}{2}}+\\sqrt{14 x-\\frac{25}{2}}=\\frac{9}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(127-6 \\sqrt{398}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8*x+(17/2))+sqrt(14*x-(25/2)), (9/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{5}{2} \\left(\\cos \\left(\\frac{8 \\pi }{45}\\right)-i \\sin \\left(\\frac{8 \\pi }{45}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$\\frac{25}{4} \\left(\\sin \\left(\\frac{13 \\pi }{90}\\right)-i \\cos \\left(\\frac{13 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(5/2)*(math.cos(((8*math.pi)/45))-1j*math.sin(((8*math.pi)/45))))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{56 x^2+200 x-96}{-48 x-192}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((56*x**2+200*x-96)/(-48*x-192)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{12 x-2}+\\sqrt{12 x+6}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{193}{100}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(12*x-2)+sqrt(12*x+6), 10), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{73}{7}$, and $a_n=a_{n-1}+-3$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$-\\frac{4044}{7}$" + ], + "Output Program": [ + "a = (73/7) # initial value\nd = -3 # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (73/7) # initial value\nd = -3 # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{16}{3}-\\frac{22 x}{3}}+\\sqrt{9-6 x}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-4331+36 \\sqrt{14358}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((16/3)-((22*x)/3))+sqrt(9-6*x), 12), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(-3-5 i) \\sqrt{2}$ and $y=(-2+4 i) \\sqrt{2}$", + "Output Answer": [ + "$52-4 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-3-5*i)*math.sqrt(2)\ny = (-2+4*i)*math.sqrt(2)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $3 x^4-3 x^3+4 x^2-3$ when divided by $-x^4-3 x^3+3 x^2-6 x+7$.", + "Output Answer": [ + "$-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*x**4-3*x**3+4*x**2-3\nq = -x**4-3*x**3+3*x**2-6*x+7\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $16 x^2-12 x+16$ and $-4 x^2+3 x-4$.", + "Output Answer": [ + "$4 x^2-3 x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(16*x**2-12*x+16, -4*x**2+3*x-4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{6+7 i}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{85}}{\\pi }$\nArgument: $\\tan ^{-1}\\left(\\frac{7}{6}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((6+7*i)/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{((22-8)-14)+25}{8-15}$.", + "Output Answer": [ + "$-\\frac{25}{7}$" + ], + "Output Program": [ + "try: \n print(((((22-8)-14)+25)/(8-15)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(1-19)+\\left(\\left(((2-19)-23)^2-20\\right)+20\\right)$.", + "Output Answer": [ + "$1582$" + ], + "Output Program": [ + "try: \n print((1-19)+((((2-19)-23)**2-20)+20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-6 x-10 y^2+8 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x-\\frac{1}{2}\\right)^2-10 \\left(y-\\frac{2}{5}\\right)^2=-\\frac{81}{10}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{2} & \\frac{1}{5} \\left(2-3 \\sqrt{6}\\right) \\\\\n \\frac{1}{2} & \\frac{1}{5} \\left(2+3 \\sqrt{6}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{5} \\left(2-3 \\sqrt{6}\\right)+\\frac{1}{5} \\left(2+3 \\sqrt{6}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{10} \\left(4+\\sqrt{15}\\right)-\\sqrt{\\frac{3}{5}} x,y=\\sqrt{\\frac{3}{5}} x+\\frac{1}{10} \\left(4-\\sqrt{15}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-6*x-10*y**2+8*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{42}{37}$, and $a_n=a_{n-1}+2 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$\\frac{21}{2} \\left(40 \\sqrt{5}-\\frac{84}{37}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(42/37) # initial value\nd = 2*math.sqrt(5) # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(42/37) # initial value\nd = 2*math.sqrt(5) # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{86}+\\sqrt{163}$.", + "Output Answer": [ + "$\\sqrt{86}+\\sqrt{163}$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(86)+sqrt(163))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{5}{2}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$-\\frac{55}{2}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(5/2) # initial value\nd = 0 # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(5/2) # initial value\nd = 0 # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{22+7 i}{\\pi }$ and $y=-\\frac{11+20 i}{\\pi }$", + "Output Answer": [ + "$\\frac{102+517 i}{\\pi ^2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((22+7*i)/math.pi)\ny = -((11+20*i)/math.pi)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=16 \\left(49 t^2-210 t+227\\right)^2, x(t)=49 t^2-210 t+225$", + "Output Answer": [ + "$y=16 x^2+64 x+64$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 16*(49*t**2-210*t+227)**2\nx_t = 49*t**2-210*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\cos \\left(4-\\frac{26 x^3}{3}\\right)+\\sin \\left(\\frac{4 x}{3}+2\\right)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = cos(4-((26*x**3)/3))+sin(((4*x)/3)+2)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-4 \\sqrt{3} e^{\\frac{47 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $4 \\sqrt{3}$\nArgument: $-\\frac{133 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -4*math.sqrt(3)*math.e**((47*i*math.pi)/180)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2-7 x+8 y^2+10 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y+\\frac{5}{8}\\right)^2-6 \\left(x+\\frac{7}{12}\\right)^2=\\frac{133}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{7}{12} & \\frac{1}{24} \\left(-15-7 \\sqrt{38}\\right) \\\\\n -\\frac{7}{12} & \\frac{1}{24} \\left(7 \\sqrt{38}-15\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{3}}$\nCenter: $\\left\\{-\\frac{7}{12},\\frac{1}{2} \\left(\\frac{1}{24} \\left(-15-7 \\sqrt{38}\\right)+\\frac{1}{24} \\left(7 \\sqrt{38}-15\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{24} \\left(-15-7 \\sqrt{3}\\right)-\\frac{\\sqrt{3} x}{2},y=\\frac{\\sqrt{3} x}{2}+\\frac{1}{24} \\left(7 \\sqrt{3}-15\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2-7*x+8*y**2+10*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^5-7 x^4-x^3+8 x^2-5 x+9$ when divided by $-9 x^5+6 x^4-x^3-7 x^2+8 x-7$.", + "Output Answer": [ + "$-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**5-7*x**4-x**3+8*x**2-5*x+9\nq = -9*x**5+6*x**4-x**3-7*x**2+8*x-7\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $9 x^3+108 x^2-324 x-1008$", + "Output Answer": [ + "$-9 (-x-14) (-x-2) (4-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(9*x**3+108*x**2-324*x-1008, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-4 e^{\\frac{32 i \\pi }{45}}$.", + "Output Answer": [ + "Norm: $4$\nArgument: $-\\frac{13 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -4*math.e**((32*i*math.pi)/45)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-8 \\left(\\cos \\left(\\frac{31}{30}\\right)+i \\sin \\left(\\frac{31}{30}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$16777216 \\left(\\cos \\left(\\frac{124}{15}\\right)+i \\sin \\left(\\frac{124}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-8*(math.cos((31/30))+1j*math.sin((31/30))))**8)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+\\frac{143 x}{\\sqrt{2}}-220$", + "Output Answer": [ + "$-11 \\left(x-\\frac{5}{\\sqrt{2}}\\right) \\left(x-4 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+((143*x)/(sqrt(2)))-220, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 12 x^2+14 x+10$ and $q(x) = 3 x^2+8 x+2$", + "Output Answer": [ + "$36 x^4+138 x^3+166 x^2+108 x+20$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 12*x**2+14*x+10\nq = 3*x**2+8*x+2\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{18+1}{((19-5)-1)-10}$.", + "Output Answer": [ + "$\\frac{19}{3}$" + ], + "Output Program": [ + "try: \n print(((18+1)/(((19-5)-1)-10)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 9 x^2+14 x+1\\right| =22$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-7-\\sqrt{238}\\right)\\right\\},\\left\\{x\\to \\frac{1}{9} \\left(-7+\\sqrt{238}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(9*x**2+14*x+1), 22), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\left(\\cos \\left(\\frac{1}{90}\\right)+i \\sin \\left(\\frac{1}{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$32 \\left(\\cos \\left(\\frac{1}{18}\\right)+i \\sin \\left(\\frac{1}{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*(math.cos((1/90))+1j*math.sin((1/90))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2+10 x+4 y^2+3 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x+\\frac{1}{2}\\right)^2+4 \\left(y+\\frac{3}{8}\\right)^2=\\frac{145}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{2} & \\frac{1}{8} \\left(-3-\\sqrt{87}\\right) \\\\\n -\\frac{1}{2} & \\frac{1}{8} \\left(\\sqrt{87}-3\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{5}}$\nCenter: $\\left\\{-\\frac{1}{2},\\frac{1}{2} \\left(\\frac{1}{8} \\left(-3-\\sqrt{87}\\right)+\\frac{1}{8} \\left(\\sqrt{87}-3\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{29}{32} \\sqrt{\\frac{5}{2}} \\pi$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2+10*x+4*y**2+3*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-12 x-8 y-z-22=0$, $20 x+8 y+25 z-1=0$, $5 x+22 y-22 z+21=0$", + "Output Answer": [ + "$x=-\\frac{2023}{632}$, $y=\\frac{2273}{1264}$, $z=\\frac{160}{79}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-12*x-8*y-z-22, 20*x+8*y+25*z-1, 5*x+22*y-22*z+21)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^3-4 x^2-9$ when divided by $-4 x^3-8 x^2-8 x-7$.", + "Output Answer": [ + "$-\\frac{9}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**3-4*x**2-9\nq = -4*x**3-8*x**2-8*x-7\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$-\\sinh (8 x+6)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = -sinh(8*x+6)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $15 x^2+2 x+\\frac{43}{3}$", + "Output Answer": [ + "$x=\\frac{1}{15} \\left(-1-i \\sqrt{214}\\right)\\lor x=\\frac{1}{15} \\left(-1+i \\sqrt{214}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(15*x**2+2*x+(43/3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2-40 x+40$", + "Output Answer": [ + "$-10 (2-x) (x-2)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2-40*x+40, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{16 e^{-\\frac{23 i \\pi }{90}}}{\\sqrt{\\pi }}$.", + "Output Answer": [ + "Norm: $\\frac{16}{\\sqrt{\\pi }}$\nArgument: $\\frac{67 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((16*math.e**(-((23*i*math.pi)/90)))/(math.sqrt(math.pi)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 18 x^2 \\log (2)-14 x \\log (2)-16 \\log (2)$ and $q(x) = 8 x^2 \\log (2)-5 x \\log (2)-17 \\log (2)$", + "Output Answer": [ + "$144 x^4 \\log ^2(2)-202 x^3 \\log ^2(2)-364 x^2 \\log ^2(2)+318 x \\log ^2(2)+272 \\log ^2(2)$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 18*x**2*log(2)-14*x*log(2)-16*log(2)\nq = 8*x**2*log(2)-5*x*log(2)-17*log(2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{\\frac{9 x^2}{2}-\\frac{5}{2}}$ at the point $x=-2$", + "Output Answer": [ + "$\\sqrt[3]{\\frac{31}{2}} = 2.493$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = -2\ntry: \n f = np.cbrt(((9*x**2)/2)-(5/2))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $8 x^2+4 x-9$", + "Output Answer": [ + "$8 \\left(x+\\frac{1}{4}\\right)^2-\\frac{19}{2}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (8*x**2+4*x-9), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+10 x+3 y^2-8 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x+\\frac{5}{4}\\right)^2+3 \\left(y-\\frac{4}{3}\\right)^2=\\frac{163}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{4} & \\frac{4}{3}-\\frac{\\sqrt{163}}{12} \\\\\n -\\frac{5}{4} & \\frac{1}{12} \\left(16+\\sqrt{163}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{2}$\nCenter: $\\left\\{-\\frac{5}{4},\\frac{1}{2} \\left(\\frac{4}{3}-\\frac{\\sqrt{163}}{12}+\\frac{1}{12} \\left(16+\\sqrt{163}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{163 \\pi }{24 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+10*x+3*y**2-8*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{15-13 i}{\\sqrt{3}}$ and $y=-\\frac{8}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{23-13 i}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((15-13*i)/(math.sqrt(3)))\ny = -(8/(math.sqrt(3)))\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{99}{95}$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$\\frac{32094}{19}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(99/95) # initial value\nd = 9 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(99/95) # initial value\nd = 9 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{37 x^6}{5}+\\frac{24 x^5}{5}-8 x^4+\\frac{24 x^3}{5}-\\frac{23 x^2}{5}+\\frac{34 x}{5}-\\frac{49}{5}$ when divided by $\\frac{36 x^4}{5}+\\frac{39 x^3}{5}+\\frac{49 x^2}{5}-\\frac{23 x}{5}+\\frac{16}{5}$.", + "Output Answer": [ + "$-\\frac{37 x^2}{36}+\\frac{769 x}{432}-\\frac{105}{64}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((37*x**6)/5)+((24*x**5)/5)-8*x**4+((24*x**3)/5)-((23*x**2)/5)+((34*x)/5)-(49/5)\nq = ((36*x**4)/5)+((39*x**3)/5)+((49*x**2)/5)-((23*x)/5)+(16/5)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (5, \\pi, 5)$", + "Output Answer": [ + "$\\left\\{\\sqrt{50+\\pi ^2},\\tan ^{-1}\\left(\\frac{\\sqrt{25+\\pi ^2}}{5}\\right),\\tan ^{-1}\\left(\\frac{\\pi }{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 5\ny = math.pi\nz = 5\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{121 x^3-396 x^2+\\frac{485 x}{3}+\\frac{476}{3}}{\\frac{952}{3}-\\frac{374 x}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{33} \\left(12-\\sqrt{705}\\right)\\right\\},\\left\\{x\\to \\frac{1}{33} \\left(12+\\sqrt{705}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((121*x**3-396*x**2+((485*x)/3)+(476/3))/((952/3)-((374*x)/3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{19 e^{\\frac{13 i \\pi }{90}}}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{19}{\\pi }$\nArgument: $-\\frac{77 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((19*math.e**((13*i*math.pi)/90))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{4} (2-3 x)^4, q(x) = \\frac{7 x-11}{\\sqrt{2}}$", + "Output Answer": [ + "$\\frac{81 x^4}{4}-54 x^3+54 x^2+\\frac{7 x}{\\sqrt{2}}-24 x-\\frac{11}{\\sqrt{2}}+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/4)*(2-3*x)**4\nq = ((7*x-11)/(sqrt(2)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-9 x-3}+\\sqrt{-2 x-5}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(-1570+24 \\sqrt{2319}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-9*x-3)+sqrt(-2*x-5), 12), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{27} (24 x-7)^3, q(x) = \\frac{4}{9} (4 x+7)^2$", + "Output Answer": [ + "$512 x^3-\\frac{3968 x^2}{9}+\\frac{1400 x}{9}+\\frac{245}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/27)*(24*x-7)**3\nq = (4/9)*(4*x+7)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{3-10 i}{\\sqrt{2}}$ and $y=-\\frac{3+3 i}{\\sqrt{2}}$", + "Output Answer": [ + "$\\frac{39}{2}-\\frac{21 i}{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((3-10*i)/(math.sqrt(2)))\ny = -((3+3*i)/(math.sqrt(2)))\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{8 x}{\\sqrt{3}}-\\frac{29 y}{\\sqrt{3}}+\\frac{34}{\\sqrt{3}}=0$, $\\sqrt{3} x+\\frac{2 y}{\\sqrt{3}}-\\frac{38}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=\\frac{1034}{103}$, $y=\\frac{406}{103}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((8*x)/(sqrt(3)))-((29*y)/(sqrt(3)))+(34/(sqrt(3))), sqrt(3)*x+((2*y)/(sqrt(3)))-(38/(sqrt(3)))), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{27}{343} (11 x-10)^3, q(x) = \\frac{16}{49} (x+3)^2$", + "Output Answer": [ + "$\\frac{35937 x^3}{343}-\\frac{97898 x^2}{343}+\\frac{89772 x}{343}-\\frac{25992}{343}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (27/343)*(11*x-10)**3\nq = (16/49)*(x+3)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt[3]{8-7 x^5}-\\sqrt{2-3 x}$ at the point $x=-7$", + "Output Answer": [ + "$-\\sqrt{23}+3^{2/3} \\sqrt[3]{13073} = 44.205$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = -7\ntry: \n f = np.cbrt(8-7*x**5)-math.sqrt(2-3*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2+8 x-7 y^2-6 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x+\\frac{4}{5}\\right)^2-7 \\left(y+\\frac{3}{7}\\right)^2=-\\frac{73}{35}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{4}{5} & -\\frac{3}{7}-\\frac{2 \\sqrt{219}}{35} \\\\\n -\\frac{4}{5} & \\frac{2 \\sqrt{219}}{35}-\\frac{3}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{3}{5}}$\nCenter: $\\left\\{-\\frac{4}{5},-\\frac{3}{7}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{35} \\left(-15-4 \\sqrt{35}\\right)-\\sqrt{\\frac{5}{7}} x,y=\\sqrt{\\frac{5}{7}} x+\\frac{1}{35} \\left(4 \\sqrt{35}-15\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2+8*x-7*y**2-6*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2+4 x+6 y^2+5 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y+\\frac{5}{12}\\right)^2-6 \\left(x-\\frac{1}{3}\\right)^2=\\frac{43}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{3} & \\frac{1}{12} \\left(-5-\\sqrt{258}\\right) \\\\\n \\frac{1}{3} & \\frac{1}{12} \\left(\\sqrt{258}-5\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{3},\\frac{1}{2} \\left(\\frac{1}{12} \\left(-5-\\sqrt{258}\\right)+\\frac{1}{12} \\left(\\sqrt{258}-5\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-x-\\frac{1}{12},y=x-\\frac{3}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2+4*x+6*y**2+5*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^3+3 x^2-3 x+6$ and $x+2$.", + "Output Answer": [ + "$x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**3+3*x**2-3*x+6, x+2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x+12}+\\sqrt{11 x-12}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(47-2 \\sqrt{354}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x+12)+sqrt(11*x-12), 9), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{107 x}{5}-\\frac{1}{5}\\right| =\\frac{112}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{111}{107}\\right\\},\\left\\{x\\to \\frac{113}{107}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((107*x)/5)-(1/5)), (112/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{9-17 i}{\\sqrt{\\pi }}$ and $y=\\frac{2-14 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{220+160 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((9-17*i)/(math.sqrt(math.pi)))\ny = ((2-14*i)/(math.sqrt(math.pi)))\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=2+9 i$ and $y=\\frac{11}{3}-6 i$", + "Output Answer": [ + "$-\\frac{84}{89}+\\frac{81 i}{89}$" + ], + "Output Program": [ + "i = 1j\nx = 2+9*i\ny = (11/3)-6*i\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{25}{3} \\left(20 t^2-104 t+133\\right)^2, x(t)=\\frac{100 t^2}{3}-\\frac{520 t}{3}+\\frac{676}{3}$", + "Output Answer": [ + "$y=3 x^2-22 x+\\frac{121}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (25/3)*(20*t**2-104*t+133)**2\nx_t = ((100*t**2)/3)-((520*t)/3)+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$5 x+22 y-2 z-6=0$, $17 x-3 y+22 z-13=0$, $-23 x-21 y+22 z-6=0$", + "Output Answer": [ + "$x=\\frac{251}{8264}$, $y=\\frac{332}{1033}$, $z=\\frac{10103}{16528}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((5*x+22*y-2*z-6, 17*x-3*y+22*z-13, -23*x-21*y+22*z-6)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-9 x^3-117 x^2+1026 x$", + "Output Answer": [ + "$-9 (-x-19) (6-x) x$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-9*x**3-117*x**2+1026*x, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{7}{99}$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$-\\frac{61685}{99}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (7/99) # initial value\nd = -8 # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (7/99) # initial value\nd = -8 # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{5}{7}$ and $y=4-\\frac{11 i}{7}$", + "Output Answer": [ + "$\\frac{28}{181}+\\frac{11 i}{181}$" + ], + "Output Program": [ + "i = 1j\nx = (5/7)\ny = 4-((11*i)/7)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{4}{3}-\\frac{11 i}{3}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{137}}{3}$\nArgument: $\\tan ^{-1}\\left(\\frac{11}{4}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(4/3)-((11*i)/3)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^5-2 x^4+7 x^3-5 x^2-3 x-4$ when divided by $5$.", + "Output Answer": [ + "$-\\frac{7 x^5}{5}-\\frac{2 x^4}{5}+\\frac{7 x^3}{5}-x^2-\\frac{3 x}{5}-\\frac{4}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**5-2*x**4+7*x**3-5*x**2-3*x-4\nq = 5\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$24 x+19 y+21=0$, $-18 x+15 y+24=0$", + "Output Answer": [ + "$x=\\frac{47}{234}$, $y=-\\frac{53}{39}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((24*x+19*y+21, -18*x+15*y+24), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^2-x-3$ and $-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**2-x-3, -3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -14 x^2-5 x-13$ and $q(x) = -5 x^2+4 x+8$", + "Output Answer": [ + "$70 x^4-31 x^3-67 x^2-92 x-104$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -14*x**2-5*x-13\nq = -5*x**2+4*x+8\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-2 x+7 y^2-9 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x-\\frac{1}{5}\\right)^2+7 \\left(y-\\frac{9}{14}\\right)^2=\\frac{1413}{140}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{70} \\left(14-3 \\sqrt{314}\\right) & \\frac{9}{14} \\\\\n \\frac{1}{70} \\left(14+3 \\sqrt{314}\\right) & \\frac{9}{14} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{70} \\left(14-3 \\sqrt{314}\\right)+\\frac{1}{70} \\left(14+3 \\sqrt{314}\\right)\\right),\\frac{9}{14}\\right\\}$\nArea Enclosed: $\\frac{1413 \\pi }{140 \\sqrt{35}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-2*x+7*y**2-9*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{3+9}{\\left(\\left((10+14)^2-12\\right)-20\\right)-21}$.", + "Output Answer": [ + "$\\frac{12}{523}$" + ], + "Output Program": [ + "try: \n print(((3+9)/((((10+14)**2-12)-20)-21)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\log \\left(\\frac{7 x}{2}-\\frac{1}{2}\\right) \\sin ^{-1}(7 x+6)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{6}{7}\\right\\},\\left\\{x\\to \\frac{3}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(log(((7*x)/2)-(1/2))*asin(7*x+6), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{9 i}{\\sqrt{2}}$ and $y=\\frac{5+5 i}{\\sqrt{2}}$", + "Output Answer": [ + "$-\\frac{9}{10}-\\frac{9 i}{10}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((9*i)/(math.sqrt(2)))\ny = ((5+5*i)/(math.sqrt(2)))\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{45 x^2}{4}+\\frac{21 x}{4}-\\frac{29}{4}$", + "Output Answer": [ + "$\\frac{45}{4} \\left(x+\\frac{7}{30}\\right)^2-\\frac{629}{80}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((45*x**2)/4)+((21*x)/4)-(29/4)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^4+6 x^3+6 x^2+8 x$ when divided by $3 x^4+5 x^3-4 x^2-8 x+10$.", + "Output Answer": [ + "$-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**4+6*x**3+6*x**2+8*x\nq = 3*x**4+5*x**3-4*x**2-8*x+10\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-5+7 i$ and $y=8+9 i$", + "Output Answer": [ + "$\\frac{23}{145}+\\frac{101 i}{145}$" + ], + "Output Program": [ + "i = 1j\nx = -5+7*i\ny = 8+9*i\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $x^2+4 x-10 y^2+9 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $(x+2)^2-10 \\left(y-\\frac{9}{20}\\right)^2=\\frac{279}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n -2-\\frac{3 \\sqrt{341}}{20} & \\frac{9}{20} \\\\\n \\frac{3 \\sqrt{341}}{20}-2 & \\frac{9}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{11}{10}}$\nCenter: $\\left\\{-2,\\frac{9}{20}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{10}}+\\frac{1}{20} \\left(9+4 \\sqrt{10}\\right),y=\\frac{1}{20} \\left(9-4 \\sqrt{10}\\right)-\\frac{x}{\\sqrt{10}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2+4*x-10*y**2+9*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{64}{5}-9 x}+\\sqrt{\\frac{7 x}{5}+\\frac{72}{5}}=\\frac{36}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{845} \\left(-3208+18 \\sqrt{34415}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((64/5)-9*x)+sqrt(((7*x)/5)+(72/5)), (36/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^4+4 x^3-9 x^2+4 x+7$ when divided by $-2 x^3+5 x^2+3 x-1$.", + "Output Answer": [ + "$-2 x-7$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**4+4*x**3-9*x**2+4*x+7\nq = -2*x**3+5*x**2+3*x-1\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x-\\frac{21}{5}}+\\sqrt{\\frac{64 x}{5}+\\frac{47}{5}}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{484} \\left(16997-26 \\sqrt{306595}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x-(21/5))+sqrt(((64*x)/5)+(47/5)), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((19+7)+8)-(((20-13)-21)+21)$.", + "Output Answer": [ + "$27$" + ], + "Output Program": [ + "try: \n print(((19+7)+8)-(((20-13)-21)+21))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-10 x^2+20 \\sqrt{3} x-30$", + "Output Answer": [ + "$-10 \\left(\\sqrt{3}-x\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-10*x**2+20*sqrt(3)*x-30, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{54}{5}-\\frac{2 x}{5}}+\\sqrt{\\frac{24 x}{5}+\\frac{14}{5}}=\\frac{36}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{845} \\left(8428-36 \\sqrt{27478}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((54/5)-((2*x)/5))+sqrt(((24*x)/5)+(14/5)), (36/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{118 x}{5}-20 y+\\frac{61}{5}=0$, $\\frac{122 x}{5}+\\frac{43 y}{5}-\\frac{73}{5}=0$", + "Output Answer": [ + "$x=\\frac{4677}{7126}$, $y=-\\frac{586}{3563}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((118*x)/5)-20*y+(61/5), ((122*x)/5)+((43*y)/5)-(73/5)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{7 \\left(\\cos \\left(\\frac{1}{10}\\right)+i \\sin \\left(\\frac{1}{10}\\right)\\right)}{\\sqrt{3}}\\right)^9$", + "Output Answer": [ + "$\\frac{40353607 \\left(\\cos \\left(\\frac{9}{10}\\right)+i \\sin \\left(\\frac{9}{10}\\right)\\right)}{81 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((7*(math.cos((1/10))+1j*math.sin((1/10))))/(math.sqrt(3))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{38 x^2}{e}-\\frac{13 x}{e}-\\frac{24}{e}$ and $q(x) = \\frac{9 x^2}{e}+\\frac{4 x}{e}+\\frac{7}{e}$", + "Output Answer": [ + "$-\\frac{342 x^4}{e^2}-\\frac{269 x^3}{e^2}-\\frac{534 x^2}{e^2}-\\frac{187 x}{e^2}-\\frac{168}{e^2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -((38*x**2)/math.e)-((13*x)/math.e)-(24/math.e)\nq = ((9*x**2)/math.e)+((4*x)/math.e)+(7/math.e)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\left(\\cos \\left(\\frac{7 \\pi }{90}\\right)-i \\sin \\left(\\frac{7 \\pi }{90}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$1679616 \\left(-\\sin \\left(\\frac{11 \\pi }{90}\\right)-i \\cos \\left(\\frac{11 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*(math.cos(((7*math.pi)/90))-1j*math.sin(((7*math.pi)/90))))**8)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 15 x^2+12 x+1$ and $q(x) = -12 x^2+13 x+2$", + "Output Answer": [ + "$-180 x^4+51 x^3+174 x^2+37 x+2$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 15*x**2+12*x+1\nq = -12*x**2+13*x+2\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(-3-4 i) \\sqrt{3}$ and $y=-\\frac{6+4 i}{\\sqrt{3}}$", + "Output Answer": [ + "$2+36 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-3-4*i)*math.sqrt(3)\ny = -((6+4*i)/(math.sqrt(3)))\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 10-24 x| =-13$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(10-24*x), -13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-4 \\sqrt{2} \\left(6 t^2+66 t+181\\right), x(t)=8 t^2+88 t+242$", + "Output Answer": [ + "$y=2 \\sqrt{2}-3 \\sqrt{2} x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -4*sqrt(2)*(6*t**2+66*t+181)\nx_t = 8*t**2+88*t+242\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\left(-\\sin \\left(\\frac{19 \\pi }{90}\\right)+i \\cos \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$512 \\left(\\frac{1}{4} \\left(\\sqrt{5}-1\\right)+i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*(-math.sin(((19*math.pi)/90))+1j*math.cos(((19*math.pi)/90))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{7 x+3}{\\sqrt{2}}, q(x) = \\frac{1}{4} (7 x+2)^4$", + "Output Answer": [ + "$\\frac{2401 x^4}{4}+686 x^3+294 x^2+\\frac{7 x}{\\sqrt{2}}+56 x+\\frac{3}{\\sqrt{2}}+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((7*x+3)/(sqrt(2)))\nq = (1/4)*(7*x+2)**4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(23-10)-(((17+17)-4)+25)$.", + "Output Answer": [ + "$-42$" + ], + "Output Program": [ + "try: \n print((23-10)-(((17+17)-4)+25))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$\\frac{x^2}{196}$", + "Output Answer": [ + "$\\frac{4802}{27} \\left(x-\\frac{9}{196}\\right)^2-\\frac{98}{3} \\left(x-\\frac{9}{196}\\right)-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, ((x**2)/196))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{4 x}{3}+4}+\\sqrt{\\frac{11 x}{3}+12}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(7437-312 \\sqrt{463}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((4*x)/3)+4)+sqrt(((11*x)/3)+12), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{138 x}{7}-11 y-\\frac{145}{7}=0$, $-\\frac{72 x}{7}+\\frac{93 y}{7}+\\frac{114}{7}=0$", + "Output Answer": [ + "$x=\\frac{523}{810}$, $y=-\\frac{98}{135}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((138*x)/7)-11*y-(145/7), -((72*x)/7)+((93*y)/7)+(114/7)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=10-6 i$ and $y=-1+5 i$", + "Output Answer": [ + "$20+56 i$" + ], + "Output Program": [ + "i = 1j\nx = 10-6*i\ny = -1+5*i\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -3 \\sqrt{2} x-14 \\sqrt{2}\\right| =\\frac{21}{\\sqrt{2}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{49}{6}\\right\\},\\left\\{x\\to -\\frac{7}{6}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-3*sqrt(2)*x-14*sqrt(2)), (21/(sqrt(2)))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((25+1)-23)-(8-20)$.", + "Output Answer": [ + "$15$" + ], + "Output Program": [ + "try: \n print(((25+1)-23)-(8-20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2+4 x+6 y^2+6 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y+\\frac{1}{2}\\right)^2-6 \\left(x-\\frac{1}{3}\\right)^2=-\\frac{19}{6}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{6} \\left(2-\\sqrt{38}\\right) & -\\frac{1}{2} \\\\\n \\frac{1}{6} \\left(2+\\sqrt{38}\\right) & -\\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{6} \\left(2-\\sqrt{38}\\right)+\\frac{1}{6} \\left(2+\\sqrt{38}\\right)\\right),-\\frac{1}{2}\\right\\}$\nAsymptotes: $\\left\\{y=x-\\frac{5}{6},y=-x-\\frac{1}{6}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2+4*x+6*y**2+6*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-13 x^2-13 x+9$", + "Output Answer": [ + "$\\frac{49}{4}-13 \\left(x+\\frac{1}{2}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-13*x**2-13*x+9), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-3 x^2+5 x+7$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(5-\\sqrt{109}\\right)\\lor x=\\frac{1}{6} \\left(5+\\sqrt{109}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-3*x**2+5*x+7, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-14 \\sqrt{3} x+\\frac{23 y}{\\sqrt{3}}-8 \\sqrt{3}=0$, $-\\frac{32 x}{\\sqrt{3}}+\\frac{29 y}{\\sqrt{3}}-\\frac{22}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{95}{241}$, $y=\\frac{78}{241}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-14*sqrt(3)*x+((23*y)/(sqrt(3)))-8*sqrt(3), -((32*x)/(sqrt(3)))+((29*y)/(sqrt(3)))-(22/(sqrt(3)))), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-144 t^2+720 t-906, x(t)=36 t^2-180 t+225$", + "Output Answer": [ + "$y=-4 x-6$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -144*t**2+720*t-906\nx_t = 36*t**2-180*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-12 x^2-96 \\sqrt{2} x-168$", + "Output Answer": [ + "$-12 \\left(-x-7 \\sqrt{2}\\right) \\left(-x-\\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-12*x**2-96*sqrt(2)*x-168, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{2} \\left(5 t^2-210 t+2193\\right)^2, x(t)=\\frac{t^2}{2}-21 t+\\frac{441}{2}$", + "Output Answer": [ + "$y=50 x^2-120 x+72$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/2)*(5*t**2-210*t+2193)**2\nx_t = ((t**2)/2)-21*t+(441/2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{3}{5} \\left(-\\cos \\left(\\frac{7 \\pi }{90}\\right)-i \\sin \\left(\\frac{7 \\pi }{90}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$\\frac{9}{25} \\left(\\cos \\left(\\frac{7 \\pi }{45}\\right)+i \\sin \\left(\\frac{7 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(3/5)*(-math.cos(((7*math.pi)/90))-1j*math.sin(((7*math.pi)/90))))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $3 x^2-13 x+8$", + "Output Answer": [ + "$3 \\left(x-\\frac{13}{6}\\right)^2-\\frac{73}{12}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (3*x**2-13*x+8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{2}{3}$, and $a_n=a_{n-1}+-3 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=13$.", + "Output Answer": [ + "$\\frac{13}{2} \\left(\\frac{4}{3}-36 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\na = (2/3) # initial value\nd = -3*math.sqrt(5) # second term\nn = 13 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (2/3) # initial value\nd = -3*math.sqrt(5) # second term\nn = 13 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 2 x^2+9 x+14$, $q(x) = 8 x^2-15 x+14$", + "Output Answer": [ + "$10 x^2-6 x+28$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**2+9*x+14\nq = 8*x**2-15*x+14\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\tan ^{-1}\\left(9 x+\\frac{5}{2}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{\\tan (y)}{9}-\\frac{5}{18}\\text{ if }-\\frac{\\pi }{2} 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=3$.", + "Output Answer": [ + "$\\frac{162}{77}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (54/77) # initial value\nd = 0 # second term\nn = 3 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (54/77) # initial value\nd = 0 # second term\nn = 3 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 80, q(x) = 40 \\sqrt{5} (x-1)^3$", + "Output Answer": [ + "$40 \\sqrt{5} x^3-120 \\sqrt{5} x^2+120 \\sqrt{5} x-40 \\sqrt{5}+80$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 80\nq = 40*sqrt(5)*(x-1)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-12 x^2-\\frac{25 x}{3}+12$", + "Output Answer": [ + "$x=\\frac{1}{72} \\left(-25-\\sqrt{5809}\\right)\\lor x=\\frac{1}{72} \\left(\\sqrt{5809}-25\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-12*x**2-((25*x)/3)+12, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\frac{(2-2 x) \\sqrt{7-8 x^3}}{\\sqrt{(2-2 x)^2+1}}=0$", + "Output Answer": [ + "$\\left\\{\\{x\\to 1\\},\\left\\{x\\to -\\frac{\\sqrt[3]{-7}}{2}\\right\\},\\left\\{x\\to \\frac{\\sqrt[3]{7}}{2}\\right\\},\\left\\{x\\to \\frac{1}{2} (-1)^{2/3} \\sqrt[3]{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve((((2-2*x)*sqrt(7-8*x**3))/(sqrt((2-2*x)**2+1))), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(-11-12 i) \\log (2)$ and $y=(12+6 i) \\log (2)$", + "Output Answer": [ + "$(-60-210 i) \\log ^2(2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-11-12*i)*math.log10(2)\ny = (12+6*i)*math.log10(2)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{67}{88}$, and $a_n=a_{n-1}+-6 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$3 \\left(\\frac{67}{44}-30 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (67/88) # initial value\nd = -6*math.sqrt(2) # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (67/88) # initial value\nd = -6*math.sqrt(2) # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{16}{81} (x+12)^4, q(x) = \\frac{1}{27} (11 x+14)^3$", + "Output Answer": [ + "$\\frac{16 x^4}{81}+\\frac{529 x^3}{9}+\\frac{3230 x^2}{9}+\\frac{14444 x}{9}+\\frac{113336}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (16/81)*(x+12)**4\nq = (1/27)*(11*x+14)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{79}-\\sqrt{73}\\right) \\sqrt{148}$.", + "Output Answer": [ + "$2 \\sqrt{2923}-2 \\sqrt{2701}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(79)-sqrt(73))*sqrt(148))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x+8}+\\sqrt{13 x-11}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(87-8 \\sqrt{89}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x+8)+sqrt(13*x-11), 6), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((13+20)+17)-17)+(((9-17)+19)+25)$.", + "Output Answer": [ + "$69$" + ], + "Output Program": [ + "try: \n print((((13+20)+17)-17)+(((9-17)+19)+25))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^5+5 x^4+8 x^3+2 x^2-6 x+6$ when divided by $4 x^5-8 x^4-6 x^3+3 x^2+2 x+2$.", + "Output Answer": [ + "$\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**5+5*x**4+8*x**3+2*x**2-6*x+6\nq = 4*x**5-8*x**4-6*x**3+3*x**2+2*x+2\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{45 x^2}{4}+4 x-\\frac{13}{4}$ and $q(x) = 14 x^2+\\frac{29 x}{2}+\\frac{55}{4}$", + "Output Answer": [ + "$\\frac{315 x^4}{2}+\\frac{1753 x^3}{8}+\\frac{2675 x^2}{16}+\\frac{63 x}{8}-\\frac{715}{16}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((45*x**2)/4)+4*x-(13/4)\nq = 14*x**2+((29*x)/2)+(55/4)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((16+15)+10)-(1-1)$.", + "Output Answer": [ + "$41$" + ], + "Output Program": [ + "try: \n print(((16+15)+10)-(1-1))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4-11 x}+\\sqrt{7}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{11} \\left(-39+12 \\sqrt{7}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4-11*x)+sqrt(7), 6), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{47}{18}$, and $a_n=a_{n-1}+-\\frac{48}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$-\\frac{102377}{45}$" + ], + "Output Program": [ + "a = -(47/18) # initial value\nd = -(48/5) # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(47/18) # initial value\nd = -(48/5) # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{9 x^3}{2}+9 x^2+\\frac{9 x}{2}-9$ and $3 x+3$.", + "Output Answer": [ + "$\\frac{3 x}{2}+\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((9*x**3)/2)+9*x**2+((9*x)/2)-9, 3*x+3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=64 (t+7)^2, x(t)=-2 t-15$", + "Output Answer": [ + "$y=16 x^2+32 x+16$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 64*(t+7)**2\nx_t = -2*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{8 x}{\\sqrt{3}}-\\frac{41 y}{\\sqrt{3}}+\\frac{22 z}{\\sqrt{3}}+\\frac{8}{\\sqrt{3}}=0$, $-\\frac{40 x}{\\sqrt{3}}+6 \\sqrt{3} y-\\frac{z}{\\sqrt{3}}-\\frac{13}{\\sqrt{3}}=0$, $-5 \\sqrt{3} x+\\frac{29 y}{\\sqrt{3}}-\\frac{7 z}{\\sqrt{3}}-2 \\sqrt{3}=0$", + "Output Answer": [ + "$x=-\\frac{3209}{9491}$, $y=-\\frac{450}{9491}$, $z=-\\frac{3123}{9491}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((8*x)/(sqrt(3)))-((41*y)/(sqrt(3)))+((22*z)/(sqrt(3)))+(8/(sqrt(3))), -((40*x)/(sqrt(3)))+6*sqrt(3)*y-(z/(sqrt(3)))-(13/(sqrt(3))), -5*sqrt(3)*x+((29*y)/(sqrt(3)))-((7*z)/(sqrt(3)))-2*sqrt(3))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $x^2-2 x-7 y^2-10 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $(x-1)^2-7 \\left(y+\\frac{5}{7}\\right)^2=-\\frac{4}{7}$\nFoci: $\\left(\n\\begin{array}{cc}\n 1 & \\frac{1}{7} \\left(-5-4 \\sqrt{2}\\right) \\\\\n 1 & \\frac{1}{7} \\left(4 \\sqrt{2}-5\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{2}$\nCenter: $\\left\\{1,\\frac{1}{2} \\left(\\frac{1}{7} \\left(-5-4 \\sqrt{2}\\right)+\\frac{1}{7} \\left(4 \\sqrt{2}-5\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{7} \\left(\\sqrt{7}-5\\right)-\\frac{x}{\\sqrt{7}},y=\\frac{x}{\\sqrt{7}}+\\frac{1}{7} \\left(-5-\\sqrt{7}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-2*x-7*y**2-10*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{8-3 i}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\sqrt{\\frac{73}{3}}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{3}{8}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((8-3*i)/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-9 x^2+2 x+6$", + "Output Answer": [ + "$x=\\frac{1}{9} \\left(1-\\sqrt{55}\\right)\\lor x=\\frac{1}{9} \\left(1+\\sqrt{55}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-9*x**2+2*x+6, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $9 x+15$ and $3 x+5$.", + "Output Answer": [ + "$3 x+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(9*x+15, 3*x+5))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\tan (3-7 x)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{7} (\\pi c_1+3)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(tan(3-7*x), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 \\sqrt{5} x^2+\\sqrt{5} x+\\sqrt{5}$ and $q(x) = -2 \\sqrt{5} x^2-6 \\sqrt{5} x+3 \\sqrt{5}$", + "Output Answer": [ + "$-40 x^4-130 x^3+20 x^2-15 x+15$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*sqrt(5)*x**2+sqrt(5)*x+sqrt(5)\nq = -2*sqrt(5)*x**2-6*sqrt(5)*x+3*sqrt(5)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2+2 x+5 y^2-9 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $2 \\left(x+\\frac{1}{2}\\right)^2+5 \\left(y-\\frac{9}{10}\\right)^2=\\frac{151}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{20} \\left(-10-\\sqrt{906}\\right) & \\frac{9}{10} \\\\\n \\frac{1}{20} \\left(\\sqrt{906}-10\\right) & \\frac{9}{10} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{20} \\left(-10-\\sqrt{906}\\right)+\\frac{1}{20} \\left(\\sqrt{906}-10\\right)\\right),\\frac{9}{10}\\right\\}$\nArea Enclosed: $\\frac{151 \\pi }{20 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2+2*x+5*y**2-9*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$e^{-3 x^2}$", + "Output Answer": [ + "$-\\frac{95 e^{96} \\left(x-\\frac{1}{e^{48}}\\right)^2}{4608}+\\frac{1}{24} e^{48} \\left(x-\\frac{1}{e^{48}}\\right)-4$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, math.e**(-3*x**2))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2+3 x+3$ and $5 x^5-5 x^4-4 x^3-3 x^2+4 x+3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2+3*x+3, 5*x**5-5*x**4-4*x**3-3*x**2+4*x+3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{7}{2} \\left(\\sin \\left(\\frac{7 \\pi }{90}\\right)-i \\cos \\left(\\frac{7 \\pi }{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$\\frac{1977326743 \\left(-\\sin \\left(\\frac{13 \\pi }{90}\\right)-i \\cos \\left(\\frac{13 \\pi }{90}\\right)\\right)}{2048}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((7/2)*(math.sin(((7*math.pi)/90))-1j*math.cos(((7*math.pi)/90))))**11)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{2-7 i}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{53}}{\\pi }$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{7}{2}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((2-7*i)/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{62 x}{7}-\\frac{17}{7}}+\\sqrt{-\\frac{38 x}{7}-\\frac{55}{7}}=6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(-506+\\sqrt{230727}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((62*x)/7)-(17/7))+sqrt(-((38*x)/7)-(55/7)), 6), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{64 x^2+172 x-336}{525-400 x}=0$", + "Output Answer": [ + "$\\{\\{x\\to -4\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((64*x**2+172*x-336)/(525-400*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\sqrt{5} \\left(-2 x^2+3 x-1\\right)$, $q(x) = 2 \\sqrt{5} \\left(3 x^2-x+2\\right)$", + "Output Answer": [ + "$4 \\sqrt{5} x^2+\\sqrt{5} x+3 \\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = sqrt(5)*(-2*x**2+3*x-1)\nq = 2*sqrt(5)*(3*x**2-x+2)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{34 x^2}{\\sqrt{3}}-\\frac{22 x}{\\sqrt{3}}-2 \\sqrt{3}}{-\\frac{34 x^2}{\\sqrt{3}}+\\frac{13 x}{\\sqrt{3}}-5 \\sqrt{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{34} \\left(11-5 \\sqrt{13}\\right)\\right\\},\\left\\{x\\to \\frac{1}{34} \\left(11+5 \\sqrt{13}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((34*x**2)/(sqrt(3)))-((22*x)/(sqrt(3)))-2*sqrt(3))/(-((34*x**2)/(sqrt(3)))+((13*x)/(sqrt(3)))-5*sqrt(3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-8 x^2+10 x+\\frac{1}{2}$", + "Output Answer": [ + "$\\frac{29}{8}-8 \\left(x-\\frac{5}{8}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-8*x**2+10*x+(1/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-5 \\sqrt{5} x^2+4 \\sqrt{5} x-3 \\sqrt{5}$", + "Output Answer": [ + "$-5 \\sqrt{5} \\left(x-\\frac{2}{5}\\right)^2-3 \\sqrt{5}+\\frac{4}{\\sqrt{5}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-5*math.sqrt(5)*x**2+4*math.sqrt(5)*x-3*math.sqrt(5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{31 e^{\\frac{3 i \\pi }{10}}}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{31}{\\pi }$\nArgument: $\\frac{3 \\pi }{10}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((31*math.e**((3*i*math.pi)/10))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 9 x+8| =12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{20}{9}\\right\\},\\left\\{x\\to \\frac{4}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(9*x+8), 12), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 \\sqrt{2} x^2-3 \\sqrt{2}$ and $q(x) = -5 \\sqrt{2} x^2+3 \\sqrt{2} x+4 \\sqrt{2}$", + "Output Answer": [ + "$40 x^4-24 x^3-2 x^2-18 x-24$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*sqrt(2)*x**2-3*sqrt(2)\nq = -5*sqrt(2)*x**2+3*sqrt(2)*x+4*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2-88 x+1155$", + "Output Answer": [ + "$-11 (-x-15) (7-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2-88*x+1155, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x+2}+\\sqrt{14 x-10}=\\frac{5}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{676} \\left(999-10 \\sqrt{2326}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x+2)+sqrt(14*x-10), (5/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-13 x^2+2 x-12$", + "Output Answer": [ + "$-13 \\left(x-\\frac{1}{13}\\right)^2-\\frac{155}{13}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-13*x**2+2*x-12), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{31 x^2}{2}-\\frac{21 x}{2}-\\frac{33}{4}}{-\\frac{93 x}{4}-\\frac{15}{4}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{62} \\left(21-\\sqrt{2487}\\right)\\right\\},\\left\\{x\\to \\frac{1}{62} \\left(21+\\sqrt{2487}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((31*x**2)/2)-((21*x)/2)-(33/4))/(-((93*x)/4)-(15/4))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $15 x^3-5 x^2-15 x-5$ and $-3 x^3+x^2+3 x+1$.", + "Output Answer": [ + "$3 x^3-x^2-3 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(15*x**3-5*x**2-15*x-5, -3*x**3+x**2+3*x+1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^4-4 x^3+8 x^2-8 x+1$ when divided by $6 x^3-2 x^2-5 x+7$.", + "Output Answer": [ + "$-\\frac{5 x}{6}-\\frac{17}{18}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**4-4*x**3+8*x**2-8*x+1\nq = 6*x**3-2*x**2-5*x+7\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-6 x-2 y^2+8 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-6 x-2 y^2+8 y=9$\nVertex: $\\left\\{-\\frac{1}{6},2\\right\\}$\nDirectrix: $x=\\frac{7}{12}$\nFocal Parameter: $\\frac{3}{2}$\nFocus: $\\left\\{-\\frac{11}{12},2\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x-2*y**2+8*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-3-3 i) \\pi$ and $y=(2-3 i) \\pi$", + "Output Answer": [ + "$-5 \\pi$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-3-3*i)*math.pi\ny = (2-3*i)*math.pi\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{4}{3} \\left(28 t+3 \\sqrt{3}+91\\right), x(t)=-\\frac{8 t}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=4 \\sqrt{3}-\\frac{14 x}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (4/3)*(28*t+3*sqrt(3)+91)\nx_t = -((8*t)/(sqrt(3)))-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^6-x^5-9 x^4+9 x^3+x^2+9 x+2$ when divided by $-5 x^5+7 x^4-3 x^3-8 x^2-5 x+7$.", + "Output Answer": [ + "$\\frac{7 x}{5}+\\frac{54}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**6-x**5-9*x**4+9*x**3+x**2+9*x+2\nq = -5*x**5+7*x**4-3*x**3-8*x**2-5*x+7\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^5-6 x^4-3 x^3-9 x^2+2 x-10$ when divided by $8$.", + "Output Answer": [ + "$\\frac{9 x^5}{8}-\\frac{3 x^4}{4}-\\frac{3 x^3}{8}-\\frac{9 x^2}{8}+\\frac{x}{4}-\\frac{5}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**5-6*x**4-3*x**3-9*x**2+2*x-10\nq = 8\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{25 x^2}{\\sqrt{3}}-\\frac{17 x}{\\sqrt{3}}-\\frac{7}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{25 \\left(x+\\frac{17}{50}\\right)^2}{\\sqrt{3}}-\\frac{137 \\sqrt{3}}{100}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((25*x**2)/(math.sqrt(3)))-((17*x)/(math.sqrt(3)))-(7/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{1-11 i}{\\sqrt{3}}$ and $y=-\\frac{13-15 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{152}{3}-\\frac{158 i}{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((1-11*i)/(math.sqrt(3)))\ny = -((13-15*i)/(math.sqrt(3)))\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{8 x-6}+\\sqrt{13 x-5}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{25} \\left(331-8 \\sqrt{1474}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(8*x-6)+sqrt(13*x-5), 4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{57 x}{4}-\\frac{85}{4}\\right| =\\frac{27}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{58}{57}\\right\\},\\left\\{x\\to \\frac{112}{57}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((57*x)/4)-(85/4)), (27/4)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((14-14)+11)+\\left(\\frac{10+1}{2}-19\\right)$.", + "Output Answer": [ + "$-\\frac{5}{2}$" + ], + "Output Program": [ + "try: \n print(((14-14)+11)+(((10+1)/2)-19))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{11}{9}$, and $a_n=a_{n-1}+3$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{1364}{9}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(11/9) # initial value\nd = 3 # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(11/9) # initial value\nd = 3 # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{22 x^2+10 x+25}{-23 x^2+25 x-8}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((22*x**2+10*x+25)/(-23*x**2+25*x-8)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-17 x^2+17 x+12}{21 x^2+x+12}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{34} \\left(17-\\sqrt{1105}\\right)\\right\\},\\left\\{x\\to \\frac{1}{34} \\left(17+\\sqrt{1105}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-17*x**2+17*x+12)/(21*x**2+x+12)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-7 x^3-49 x^2+1568 x+3276$", + "Output Answer": [ + "$7 (-x-2) (x-13) (x+18)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-7*x**3-49*x**2+1568*x+3276, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{26 x^5}{3}-\\frac{98 x^4}{9}-\\frac{136 x^3}{9}-\\frac{224 x^2}{9}+\\frac{190 x}{9}+\\frac{14}{9}$ and $-\\frac{13 x^4}{3}-\\frac{14 x^3}{3}-\\frac{10 x^2}{3}+\\frac{14 x}{3}+\\frac{1}{3}$.", + "Output Answer": [ + "$\\frac{13 x^4}{9}+\\frac{14 x^3}{9}+\\frac{10 x^2}{9}-\\frac{14 x}{9}-\\frac{1}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((26*x**5)/3)-((98*x**4)/9)-((136*x**3)/9)-((224*x**2)/9)+((190*x)/9)+(14/9), -((13*x**4)/3)-((14*x**3)/3)-((10*x**2)/3)+((14*x)/3)+(1/3)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{6-11 i}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\sqrt{\\frac{157}{3}}$\nArgument: $-\\tan ^{-1}\\left(\\frac{11}{6}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((6-11*i)/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{80}{23}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$-\\frac{1760}{23}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(80/23) # initial value\nd = 0 # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(80/23) # initial value\nd = 0 # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (7 x+2)^4, q(x) = -4 (x+1)$", + "Output Answer": [ + "$2401 x^4+2744 x^3+1176 x^2+220 x+12$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (7*x+2)**4\nq = -4*(x+1)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((8+20)-22)+((((24-9)-1)+20)+13)^2$.", + "Output Answer": [ + "$2215$" + ], + "Output Program": [ + "try: \n print(((8+20)-22)+((((24-9)-1)+20)+13)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $15 x^3+15 x^2+25$ and $-3 x^3-3 x^2-5$.", + "Output Answer": [ + "$3 x^3+3 x^2+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(15*x**3+15*x**2+25, -3*x**3-3*x**2-5))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{1-14 x}+\\sqrt{6-3 x}=\\frac{15}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{484} \\left(-4045+90 \\sqrt{1446}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(1-14*x)+sqrt(6-3*x), (15/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{6 x^2}{\\sqrt{\\pi }}-\\frac{14 x}{\\sqrt{\\pi }}+\\frac{21}{\\sqrt{\\pi }}$ and $q(x) = -\\frac{4 x^2}{\\sqrt{\\pi }}+\\frac{2 x}{\\sqrt{\\pi }}-\\frac{16}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{24 x^4}{\\pi }+\\frac{44 x^3}{\\pi }-\\frac{16 x^2}{\\pi }+\\frac{266 x}{\\pi }-\\frac{336}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((6*x**2)/(sqrt(pi)))-((14*x)/(sqrt(pi)))+(21/(sqrt(pi)))\nq = -((4*x**2)/(sqrt(pi)))+((2*x)/(sqrt(pi)))-(16/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $3 \\sqrt{3} x^2+5 \\sqrt{3} x-4 \\sqrt{3}$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(-5-\\sqrt{73}\\right)\\lor x=\\frac{1}{6} \\left(\\sqrt{73}-5\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(3*sqrt(3)*x**2+5*sqrt(3)*x-4*sqrt(3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $x^2-x+6 y^2-5 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $\\left(x-\\frac{1}{2}\\right)^2+6 \\left(y-\\frac{5}{12}\\right)^2=\\frac{79}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{12} \\left(6-\\sqrt{395}\\right) & \\frac{5}{12} \\\\\n \\frac{1}{12} \\left(6+\\sqrt{395}\\right) & \\frac{5}{12} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{6}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{12} \\left(6-\\sqrt{395}\\right)+\\frac{1}{12} \\left(6+\\sqrt{395}\\right)\\right),\\frac{5}{12}\\right\\}$\nArea Enclosed: $\\frac{79 \\pi }{24 \\sqrt{6}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-x+6*y**2-5*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$\\frac{49 x^2}{4}$", + "Output Answer": [ + "$-\\frac{2 \\left(x-\\frac{49}{4}\\right)^2}{2401}+\\frac{2}{49} \\left(x-\\frac{49}{4}\\right)+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, ((49*x**2)/4))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{47}{7}-6 x}+\\sqrt{\\frac{86}{7}-\\frac{6 x}{7}}=\\frac{43}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{756} \\left(-8215+43 \\sqrt{36253}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((47/7)-6*x)+sqrt((86/7)-((6*x)/7)), (43/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2-x-10 y^2-4 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Circle\nEquation: $-10 \\left(x+\\frac{1}{20}\\right)^2-10 \\left(y+\\frac{1}{5}\\right)^2=-\\frac{57}{40}$\nRadius: $\\frac{\\sqrt{57}}{20}$\nCircumference: $\\frac{\\sqrt{57} \\pi }{10}$\nCenter: $\\left\\{-\\frac{1}{20},-\\frac{1}{5}\\right\\}$\nArea Enclosed: $\\frac{57 \\pi }{400}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2-x-10*y**2-4*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $8 x^2+4 x-5$", + "Output Answer": [ + "$8 \\left(x+\\frac{1}{4}\\right)^2-\\frac{11}{2}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (8*x**2+4*x-5), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\sqrt{5}-3 \\sqrt{5} x$ and $q(x) = 5 \\sqrt{5} x-3 \\sqrt{5} x^2$", + "Output Answer": [ + "$45 x^3-90 x^2+25 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = sqrt(5)-3*sqrt(5)*x\nq = 5*sqrt(5)*x-3*sqrt(5)*x**2\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{343} \\left(45630 t^2+245700 t+332563\\right), x(t)=\\frac{1521 t^2}{49}+\\frac{1170 t}{7}+225$", + "Output Answer": [ + "$y=\\frac{30 x}{7}+\\frac{37}{7}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/343)*(45630*t**2+245700*t+332563)\nx_t = ((1521*t**2)/49)+((1170*t)/7)+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^3-x^2-2 x+5$ when divided by $-10 x-2$.", + "Output Answer": [ + "$-\\frac{7 x^2}{10}+\\frac{6 x}{25}+\\frac{19}{125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**3-x**2-2*x+5\nq = -10*x-2\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $9 \\sqrt{2} x^2-7 \\sqrt{2} x-6 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{18} \\left(7-\\sqrt{265}\\right)\\lor x=\\frac{1}{18} \\left(7+\\sqrt{265}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(9*sqrt(2)*x**2-7*sqrt(2)*x-6*sqrt(2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-10 x^2+7 x+3 y^2-6 y+7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 (y-1)^2-10 \\left(x-\\frac{7}{20}\\right)^2=-\\frac{209}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{60} \\left(21-\\sqrt{8151}\\right) & 1 \\\\\n \\frac{1}{60} \\left(21+\\sqrt{8151}\\right) & 1 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{13}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{60} \\left(21-\\sqrt{8151}\\right)+\\frac{1}{60} \\left(21+\\sqrt{8151}\\right)\\right),1\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{10}{3}} x+\\frac{1}{60} \\left(60-7 \\sqrt{30}\\right),y=\\frac{1}{60} \\left(60+7 \\sqrt{30}\\right)-\\sqrt{\\frac{10}{3}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x**2+7*x+3*y**2-6*y+7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{16 x^2+18 x+7}{e}$, $q(x) = \\frac{-29 x^2+37 x+17}{e}$", + "Output Answer": [ + "$-\\frac{13 x^2}{e}+\\frac{55 x}{e}+\\frac{24}{e}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.abc import x\n\np = ((16*x**2+18*x+7)/math.e)\nq = ((-29*x**2+37*x+17)/math.e)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\log \\left(-\\frac{11 x}{2}-\\frac{5}{2}\\right)$", + "Output Answer": [ + "$x<-\\frac{5}{11}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = log(-((11*x)/2)-(5/2))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $9 x^2+15 x+4$", + "Output Answer": [ + "$x=-\\frac{4}{3}\\lor x=-\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(9*x**2+15*x+4, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{7}{3} \\left(\\cos \\left(\\frac{61}{45}\\right)+i \\sin \\left(\\frac{61}{45}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-\\frac{40353607 \\left(\\cos \\left(\\frac{61}{5}\\right)+i \\sin \\left(\\frac{61}{5}\\right)\\right)}{19683}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(7/3)*(math.cos((61/45))+1j*math.sin((61/45))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{12 x+5}+\\sqrt{14}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(39-5 \\sqrt{14}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(12*x+5)+sqrt(14), 15), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{13}{5} \\left(\\cos \\left(\\frac{82}{45}\\right)+i \\sin \\left(\\frac{82}{45}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$\\frac{23298085122481 \\left(\\cos \\left(\\frac{328}{15}\\right)+i \\sin \\left(\\frac{328}{15}\\right)\\right)}{244140625}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(13/5)*(math.cos((82/45))+1j*math.sin((82/45))))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{30 x^2}{7}-\\frac{96 x}{7}+\\frac{95}{7}\\right| =-13$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((30*x**2)/7)-((96*x)/7)+(95/7)), -13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\sqrt{3} \\left(\\cos \\left(\\frac{17 \\pi }{90}\\right)-i \\sin \\left(\\frac{17 \\pi }{90}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$2985984 \\left(\\sin \\left(\\frac{7 \\pi }{30}\\right)-i \\cos \\left(\\frac{7 \\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*math.sqrt(3)*(math.cos(((17*math.pi)/90))-1j*math.sin(((17*math.pi)/90))))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x^4+7 x^3+2 x^2-6 x+2$ when divided by $-5 x^2-x+3$.", + "Output Answer": [ + "$\\frac{4 x^2}{5}-\\frac{39 x}{25}+\\frac{49}{125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x**4+7*x**3+2*x**2-6*x+2\nq = -5*x**2-x+3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{91 x}{4}-\\frac{39 y}{2}+\\frac{35 z}{2}+\\frac{31}{2}=0$, $-\\frac{25 x}{4}-\\frac{85 y}{4}-\\frac{13 z}{2}-\\frac{29}{2}=0$, $\\frac{37 x}{2}+\\frac{11 y}{4}-\\frac{49 z}{4}-\\frac{61}{4}=0$", + "Output Answer": [ + "$x=\\frac{33680}{1071713}$, $y=-\\frac{326248}{1071713}$, $z=-\\frac{1356549}{1071713}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((91*x)/4)-((39*y)/2)+((35*z)/2)+(31/2), -((25*x)/4)-((85*y)/4)-((13*z)/2)-(29/2), ((37*x)/2)+((11*y)/4)-((49*z)/4)-(61/4))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{3 x^2}{\\sqrt{2}}-5 \\sqrt{2} x+3 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{5 \\sqrt{2}-\\sqrt{14}}{3 \\sqrt{2}}\\lor x=\\frac{5 \\sqrt{2}+\\sqrt{14}}{3 \\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((3*x**2)/(sqrt(2)))-5*sqrt(2)*x+3*sqrt(2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -3 x^2+6 x-12$ and $q(x) = 11 x^2+14 x-13$", + "Output Answer": [ + "$-33 x^4+24 x^3-9 x^2-246 x+156$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -3*x**2+6*x-12\nq = 11*x**2+14*x-13\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\left(-\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)\\right)^7$", + "Output Answer": [ + "$-2187 \\left(-\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*(-(1/2)-((1j*math.sqrt(3))/2)))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{420 x^3-\\frac{8 x^2}{9}-\\frac{4133 x}{9}-\\frac{1484}{9}}{-\\frac{3430 x}{9}-\\frac{2597}{9}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{108} \\left(41-\\sqrt{7729}\\right)\\right\\},\\left\\{x\\to \\frac{1}{108} \\left(41+\\sqrt{7729}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((420*x**3-((8*x**2)/9)-((4133*x)/9)-(1484/9))/(-((3430*x)/9)-(2597/9))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-13$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$25$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -13 # initial value\nd = 9 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -13 # initial value\nd = 9 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{x}{4}+\\frac{7}{4}}+\\sqrt{x-7}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(995-32 \\sqrt{618}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((x/4)+(7/4))+sqrt(x-7), 12), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 12 x^2-3 x+6$, $q(x) = 12 x^2-9 x+2$", + "Output Answer": [ + "$24 x^2-12 x+8$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 12*x**2-3*x+6\nq = 12*x**2-9*x+2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{3-7 i}{\\sqrt{\\pi }}$ and $y=-\\frac{17+4 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{20-3 i}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((3-7*i)/(math.sqrt(math.pi)))\ny = -((17+4*i)/(math.sqrt(math.pi)))\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-11 x^3-220 x^2-1441 x-3080$", + "Output Answer": [ + "$-11 (-x-8) (-x-5) (x+7)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-11*x**3-220*x**2-1441*x-3080, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{14 e^{\\frac{7 i \\pi }{30}}}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\frac{14}{\\sqrt{3}}$\nArgument: $-\\frac{23 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((14*math.e**((7*i*math.pi)/30))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-10 x^2+5 x-6$", + "Output Answer": [ + "$-10 \\left(x-\\frac{1}{4}\\right)^2-\\frac{43}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-10*x**2+5*x-6), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{73}{5}-\\frac{52 x}{5}}+\\sqrt{\\frac{71}{5}-\\frac{x}{5}}=\\frac{36}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-22726+24 \\sqrt{990237}}{4335}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((73/5)-((52*x)/5))+sqrt((71/5)-(x/5)), (36/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-12 x^4+4 x^3+8 x^2+16 x$ and $3 x^4-x^3-2 x^2-4 x$.", + "Output Answer": [ + "$3 x^4-x^3-2 x^2-4 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-12*x**4+4*x**3+8*x**2+16*x, 3*x**4-x**3-2*x**2-4*x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 8 x^2+\\frac{43 x}{4}-\\frac{1}{4}$, $q(x) = \\frac{1}{4} \\left(59 x^2+53 x-15\\right)$", + "Output Answer": [ + "$\\frac{91 x^2}{4}+24 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8*x**2+((43*x)/4)-(1/4)\nq = (1/4)*(59*x**2+53*x-15)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\sqrt{3} x-4 \\sqrt{3} y-5 \\sqrt{3} z-7 \\sqrt{3}=0$, $-2 \\sqrt{3} x-8 \\sqrt{3} y-4 \\sqrt{3} z+9 \\sqrt{3}=0$, $-14 \\sqrt{3} x+14 \\sqrt{3} y-7 \\sqrt{3} z-13 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{677}{210}$, $y=\\frac{313}{140}$, $z=-\\frac{23}{6}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-sqrt(3)*x-4*sqrt(3)*y-5*sqrt(3)*z-7*sqrt(3), -2*sqrt(3)*x-8*sqrt(3)*y-4*sqrt(3)*z+9*sqrt(3), -14*sqrt(3)*x+14*sqrt(3)*y-7*sqrt(3)*z-13*sqrt(3))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{9-11 x}+\\sqrt{2-2 x}=\\frac{27}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{36} \\left(-1025+18 \\sqrt{1798}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(9-11*x)+sqrt(2-2*x), (27/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $9 x^2-12 x+2$", + "Output Answer": [ + "$x=\\frac{1}{3} \\left(2-\\sqrt{2}\\right)\\lor x=\\frac{1}{3} \\left(2+\\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(9*x**2-12*x+2, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2-5 y^2+4 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 x^2-5 \\left(y-\\frac{2}{5}\\right)^2=-\\frac{44}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n 0 & \\frac{1}{5} \\left(2-\\sqrt{66}\\right) \\\\\n 0 & \\frac{1}{5} \\left(2+\\sqrt{66}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{2}}$\nCenter: $\\left\\{0,\\frac{1}{2} \\left(\\frac{1}{5} \\left(2-\\sqrt{66}\\right)+\\frac{1}{5} \\left(2+\\sqrt{66}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2}{5}-\\sqrt{2} x,y=\\sqrt{2} x+\\frac{2}{5}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2-5*y**2+4*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{23}{38}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$\\frac{17235}{19}$" + ], + "Output Program": [ + "a = -(23/38) # initial value\nd = 6 # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(23/38) # initial value\nd = 6 # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$17 \\sqrt{2} x+12 \\sqrt{2} y=0$, $4 \\sqrt{2} x-4 \\sqrt{2} y+4 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{12}{29}$, $y=\\frac{17}{29}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((17*sqrt(2)*x+12*sqrt(2)*y, 4*sqrt(2)*x-4*sqrt(2)*y+4*sqrt(2)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$10 x+\\frac{37 y}{5}+\\frac{107 z}{5}-\\frac{57}{5}=0$, $-\\frac{92 x}{5}-\\frac{94 y}{5}+\\frac{64 z}{5}+\\frac{21}{5}=0$, $-\\frac{24 x}{5}-\\frac{61 y}{5}-\\frac{2 z}{5}+7=0$", + "Output Answer": [ + "$x=-\\frac{22051}{166684}$, $y=\\frac{25556}{41671}$, $z=\\frac{31875}{83342}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((10*x+((37*y)/5)+((107*z)/5)-(57/5), -((92*x)/5)-((94*y)/5)+((64*z)/5)+(21/5), -((24*x)/5)-((61*y)/5)-((2*z)/5)+7)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^2-3 x-10$ when divided by $9 x^2-9 x-2$.", + "Output Answer": [ + "$\\frac{4}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**2-3*x-10\nq = 9*x**2-9*x-2\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-13 x^2-2 x+10}{9 x-11}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{13} \\left(-1-\\sqrt{131}\\right)\\right\\},\\left\\{x\\to \\frac{1}{13} \\left(-1+\\sqrt{131}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-13*x**2-2*x+10)/(9*x-11)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{12-19 i}{\\pi }$ and $y=-\\frac{20-14 i}{\\pi }$", + "Output Answer": [ + "$\\frac{8+5 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((12-19*i)/math.pi)\ny = -((20-14*i)/math.pi)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $4 x^2+92 x+528$", + "Output Answer": [ + "$-4 (-x-11) (x+12)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(4*x**2+92*x+528, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-18 x-11 y+17=0$, $-5 x+5 y-16=0$", + "Output Answer": [ + "$x=-\\frac{91}{145}$, $y=\\frac{373}{145}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-18*x-11*y+17, -5*x+5*y-16), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $3 x^2+\\frac{30 x}{7}-\\frac{3159}{7}$", + "Output Answer": [ + "$-3 (-x-13) \\left(x-\\frac{81}{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(3*x**2+((30*x)/7)-(3159/7), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-6 x^2+14 x+5$", + "Output Answer": [ + "$\\frac{79}{6}-6 \\left(x-\\frac{7}{6}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-6*x**2+14*x+5), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{((8-9)-15)^2}{(((13-8)-24)+11)-14}$.", + "Output Answer": [ + "$-\\frac{128}{11}$" + ], + "Output Program": [ + "try: \n print(((((8-9)-15)**2)/((((13-8)-24)+11)-14)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-13 x^2-5 x+11$", + "Output Answer": [ + "$\\frac{597}{52}-13 \\left(x+\\frac{5}{26}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-13*x**2-5*x+11), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (x-7)^2, q(x) = 8 (x+3)^3$", + "Output Answer": [ + "$8 x^3+73 x^2+202 x+265$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (x-7)**2\nq = 8*(x+3)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{1}{25} \\left(((7-11)-21)^2-21\\right)}{(13-23)+1}$.", + "Output Answer": [ + "$-\\frac{604}{225}$" + ], + "Output Program": [ + "try: \n print((((1/25)*(((7-11)-21)**2-21))/((13-23)+1)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 2 \\sqrt{2} (6 x-1)^3, q(x) = 2 \\sqrt{2} (5 x-3)^3$", + "Output Answer": [ + "$682 \\sqrt{2} x^3-666 \\sqrt{2} x^2+306 \\sqrt{2} x-56 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*sqrt(2)*(6*x-1)**3\nq = 2*sqrt(2)*(5*x-3)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 x^2+\\frac{49 x}{4}-\\frac{7}{4}$, $q(x) = \\frac{1}{4} \\left(-3 x^2+38 x+45\\right)$", + "Output Answer": [ + "$\\frac{13 x^2}{4}+\\frac{87 x}{4}+\\frac{19}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**2+((49*x)/4)-(7/4)\nq = (1/4)*(-3*x**2+38*x+45)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{5 x^2}{2}+\\frac{95 x}{4}-12}{\\frac{17}{4}-\\frac{17 x}{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{20} \\left(-95-\\sqrt{10945}\\right)\\right\\},\\left\\{x\\to \\frac{1}{20} \\left(-95+\\sqrt{10945}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((5*x**2)/2)+((95*x)/4)-12)/((17/4)-((17*x)/2))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{51 x^2}{5}-\\frac{27 x}{5}+\\frac{61}{5}$", + "Output Answer": [ + "$\\frac{51}{5} \\left(x-\\frac{9}{34}\\right)^2+\\frac{781}{68}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((51*x**2)/5)-((27*x)/5)+(61/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{5}}, \\frac{1}{4}, 4)$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{\\frac{1301}{5}}}{4},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{21}{5}}}{16}\\right),\\tan ^{-1}\\left(\\frac{\\sqrt{5}}{4}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(5)))\ny = (1/4)\nz = 4\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{5 x^6}{2}+\\frac{3 x^5}{4}-\\frac{47 x^4}{2}+\\frac{39 x^3}{4}+\\frac{43 x^2}{4}+\\frac{77 x}{4}+6$ and $5 x^4-\\frac{7 x^3}{2}-\\frac{7 x^2}{2}-5 x-\\frac{3}{2}$.", + "Output Answer": [ + "$\\frac{5 x^4}{2}-\\frac{7 x^3}{4}-\\frac{7 x^2}{4}-\\frac{5 x}{2}-\\frac{3}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((5*x**6)/2)+((3*x**5)/4)-((47*x**4)/2)+((39*x**3)/4)+((43*x**2)/4)+((77*x)/4)+6, 5*x**4-((7*x**3)/2)-((7*x**2)/2)-5*x-(3/2)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{29 x}{3}-\\frac{16}{3}}+\\sqrt{-\\frac{28 x}{3}-\\frac{7}{3}}=\\frac{29}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(-47964+58 \\sqrt{683627}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((29*x)/3)-(16/3))+sqrt(-((28*x)/3)-(7/3)), (29/3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\sqrt{2} \\left(\\cos \\left(\\frac{5}{18}\\right)+i \\sin \\left(\\frac{5}{18}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$645657712 \\sqrt{2} \\left(\\cos \\left(\\frac{5}{2}\\right)+i \\sin \\left(\\frac{5}{2}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*math.sqrt(2)*(math.cos((5/18))+1j*math.sin((5/18))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2+4 x-6 y^2-8 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x+\\frac{2}{7}\\right)^2-6 \\left(y+\\frac{2}{3}\\right)^2=\\frac{82}{21}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{21} \\left(-6-\\sqrt{533}\\right) & -\\frac{2}{3} \\\\\n \\frac{1}{21} \\left(\\sqrt{533}-6\\right) & -\\frac{2}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{13}{6}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{21} \\left(-6-\\sqrt{533}\\right)+\\frac{1}{21} \\left(\\sqrt{533}-6\\right)\\right),-\\frac{2}{3}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{7}{6}} x+\\frac{1}{21} \\left(\\sqrt{42}-14\\right),y=\\frac{1}{21} \\left(-14-\\sqrt{42}\\right)-\\sqrt{\\frac{7}{6}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2+4*x-6*y**2-8*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10 x+9}+\\sqrt{15 x+10}=5$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(124-10 \\sqrt{157}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10*x+9)+sqrt(15*x+10), 5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^6+2 x^5+9 x^4-4 x^3+5 x^2-2 x+10$ when divided by $-4$.", + "Output Answer": [ + "$-\\frac{9 x^6}{4}-\\frac{x^5}{2}-\\frac{9 x^4}{4}+x^3-\\frac{5 x^2}{4}+\\frac{x}{2}-\\frac{5}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**6+2*x**5+9*x**4-4*x**3+5*x**2-2*x+10\nq = -4\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6-9 x}+\\sqrt{11-5 x}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-229+8 \\sqrt{789}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6-9*x)+sqrt(11-5*x), 8), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-x^2-2 x+9$", + "Output Answer": [ + "$x=-1-\\sqrt{10}\\lor x=\\sqrt{10}-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-x**2-2*x+9, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((1+23)+7)-\\left((8+14)^2+24\\right)$.", + "Output Answer": [ + "$-477$" + ], + "Output Program": [ + "try: \n print(((1+23)+7)-((8+14)**2+24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{7+14 i}{\\sqrt{2}}$ and $y=(-3+4 i) \\sqrt{2}$", + "Output Answer": [ + "$-77-14 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((7+14*i)/(math.sqrt(2)))\ny = (-3+4*i)*math.sqrt(2)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{19 x^2-22 x-8}{-5 x^2+12 x-11}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{19} \\left(11-\\sqrt{273}\\right)\\right\\},\\left\\{x\\to \\frac{1}{19} \\left(11+\\sqrt{273}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((19*x**2-22*x-8)/(-5*x**2+12*x-11)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{33 x^2}{5}+\\frac{7 x}{5}-10$", + "Output Answer": [ + "$-\\frac{33}{5} \\left(x-\\frac{7}{66}\\right)^2-\\frac{6551}{660}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((33*x**2)/5)+((7*x)/5)-10), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -8 x^2-5 x+14$, $q(x) = -9 x^2-\\frac{25 x}{4}+\\frac{13}{4}$", + "Output Answer": [ + "$-17 x^2-\\frac{45 x}{4}+\\frac{69}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**2-5*x+14\nq = -9*x**2-((25*x)/4)+(13/4)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{4 \\left(\\sin \\left(\\frac{19 \\pi }{90}\\right)-i \\cos \\left(\\frac{19 \\pi }{90}\\right)\\right)}{\\sqrt{3}}\\right)^11$", + "Output Answer": [ + "$\\frac{4194304 \\left(-\\cos \\left(\\frac{8 \\pi }{45}\\right)+i \\sin \\left(\\frac{8 \\pi }{45}\\right)\\right)}{243 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((4*(math.sin(((19*math.pi)/90))-1j*math.cos(((19*math.pi)/90))))/(math.sqrt(3))))**11)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=42$, and $a_n=a_{n-1}+\\frac{13}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{27}{2} \\left(84+\\frac{338}{\\sqrt{5}}\\right)$" + ], + "Output Program": [ + "import math\n\na = 42 # initial value\nd = (13/(math.sqrt(5))) # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = 42 # initial value\nd = (13/(math.sqrt(5))) # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{26}{3}-\\frac{13 i}{3}$ and $y=-1-2 i$", + "Output Answer": [ + "$\\frac{13 i}{3}$" + ], + "Output Program": [ + "i = 1j\nx = (26/3)-((13*i)/3)\ny = -1-2*i\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2-3 \\sqrt{2} x+308$", + "Output Answer": [ + "$\\left(-x-14 \\sqrt{2}\\right) \\left(x-11 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2-3*sqrt(2)*x+308, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((10+5)-8)+25)-\\left(((19-15)-19)^2+7\\right)$.", + "Output Answer": [ + "$-200$" + ], + "Output Program": [ + "try: \n print((((10+5)-8)+25)-(((19-15)-19)**2+7))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{29}{47}$, and $a_n=a_{n-1}+-7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=6$.", + "Output Answer": [ + "$-\\frac{5109}{47}$" + ], + "Output Program": [ + "a = -(29/47) # initial value\nd = -7 # second term\nn = 6 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(29/47) # initial value\nd = -7 # second term\nn = 6 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{11 x^2+12 x}{-17 x-14}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{12}{11}\\right\\},\\{x\\to 0\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((11*x**2+12*x)/(-17*x-14)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-5 x^2-23 x-12$ and $-x-4$.", + "Output Answer": [ + "$x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-5*x**2-23*x-12, -x-4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -8 x^2+x-13$, $q(x) = -x^2+10 x-7$", + "Output Answer": [ + "$-9 x^2+11 x-20$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*x**2+x-13\nq = -x**2+10*x-7\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{24 x^2-18 x-1}{-19 x-22}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{24} \\left(9-\\sqrt{105}\\right)\\right\\},\\left\\{x\\to \\frac{1}{24} \\left(9+\\sqrt{105}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((24*x**2-18*x-1)/(-19*x-22)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$25 x-3 y+12=0$, $-15 x+24 y+13=0$", + "Output Answer": [ + "$x=-\\frac{109}{185}$, $y=-\\frac{101}{111}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((25*x-3*y+12, -15*x+24*y+13), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $8-2 x$ when divided by $9 x-3$.", + "Output Answer": [ + "$-\\frac{2}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 8-2*x\nq = 9*x-3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2-5 x-2 y^2+4 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x-\\frac{5}{6}\\right)^2-2 (y-1)^2=\\frac{25}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{12} \\left(\\sqrt{10}-2\\right) & 1 \\\\\n \\frac{5}{12} \\left(2+\\sqrt{10}\\right) & 1 \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{5}{12} \\left(2+\\sqrt{10}\\right)-\\frac{5}{12} \\left(\\sqrt{10}-2\\right)\\right),1\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{3}{2}} x+\\frac{1}{12} \\left(12-5 \\sqrt{6}\\right),y=\\frac{1}{12} \\left(12+5 \\sqrt{6}\\right)-\\sqrt{\\frac{3}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2-5*x-2*y**2+4*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{3}{5}+\\frac{9 i}{5}$.", + "Output Answer": [ + "Norm: $3 \\sqrt{\\frac{2}{5}}$\nArgument: $\\tan ^{-1}(3)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (3/5)+((9*i)/5)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{343} \\left(17576 t^2-141960 t+289639\\right), x(t)=\\frac{676 t^2}{49}-\\frac{780 t}{7}+225$", + "Output Answer": [ + "$y=\\frac{26 x}{7}+\\frac{61}{7}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/343)*(17576*t**2-141960*t+289639)\nx_t = ((676*t**2)/49)-((780*t)/7)+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((((5+5)+11)+15)+23)+(((18+24)+3)+16)$.", + "Output Answer": [ + "$120$" + ], + "Output Program": [ + "try: \n print(((((5+5)+11)+15)+23)+(((18+24)+3)+16))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 8 x^2+9 x+6$ and $q(x) = 12 x^2-9 x+1$", + "Output Answer": [ + "$96 x^4+36 x^3-x^2-45 x+6$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 8*x**2+9*x+6\nq = 12*x**2-9*x+1\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -12 x^2+7 x-13$, $q(x) = -9 x^2+x+11$", + "Output Answer": [ + "$-21 x^2+8 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -12*x**2+7*x-13\nq = -9*x**2+x+11\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 15 \\sqrt{2} x^2+4 \\sqrt{2} x-5 \\sqrt{2}\\right| =12 \\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{15} \\left(-2-\\sqrt{259}\\right)\\right\\},\\left\\{x\\to \\frac{1}{15} \\left(-2+\\sqrt{259}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(15*sqrt(2)*x**2+4*sqrt(2)*x-5*sqrt(2)), 12*sqrt(2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 8 \\sqrt{2} x^2-8 \\sqrt{2} x+\\frac{27}{\\sqrt{2}}\\right| =15 \\sqrt{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(2-\\sqrt{7}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(2+\\sqrt{7}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(8*sqrt(2)*x**2-8*sqrt(2)*x+(27/(sqrt(2)))), 15*sqrt(2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{17 x^2}{\\sqrt{2}}+\\frac{19 x}{\\sqrt{2}}+6 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{17} \\left(-\\frac{19}{2}-\\frac{i \\sqrt{455}}{2}\\right)\\lor x=\\frac{1}{17} \\left(-\\frac{19}{2}+\\frac{i \\sqrt{455}}{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((17*x**2)/(sqrt(2)))+((19*x)/(sqrt(2)))+6*sqrt(2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-2 \\sqrt{5} x^2+\\sqrt{5} x-7 \\sqrt{5}$", + "Output Answer": [ + "$x=\\frac{1}{4} \\left(1-i \\sqrt{55}\\right)\\lor x=\\frac{1}{4} \\left(1+i \\sqrt{55}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-2*sqrt(5)*x**2+sqrt(5)*x-7*sqrt(5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$9 x+12 y-8 z+14=0$, $10 x+12 y+3 z-20=0$, $10 x-13 y+17 z+24=0$", + "Output Answer": [ + "$x=-\\frac{8570}{2507}$, $y=\\frac{9188}{2507}$, $z=\\frac{8528}{2507}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((9*x+12*y-8*z+14, 10*x+12*y+3*z-20, 10*x-13*y+17*z+24)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\sqrt{5} x^2-5 \\sqrt{5} x+3 \\sqrt{5}$ and $q(x) = 5 \\sqrt{5} x-2 \\sqrt{5}$", + "Output Answer": [ + "$25 x^3-135 x^2+125 x-30$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = sqrt(5)*x**2-5*sqrt(5)*x+3*sqrt(5)\nq = 5*sqrt(5)*x-2*sqrt(5)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2-85 x$", + "Output Answer": [ + "$-5 x (x+17)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2-85*x, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\sqrt{2} \\left(\\cos \\left(\\frac{23}{15}\\right)+i \\sin \\left(\\frac{23}{15}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$12500 \\sqrt{2} \\left(\\cos \\left(\\frac{23}{3}\\right)+i \\sin \\left(\\frac{23}{3}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*math.sqrt(2)*(math.cos((23/15))+1j*math.sin((23/15))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{75 x^2}{7}+x+\\frac{29}{7}$", + "Output Answer": [ + "$x=\\frac{1}{150} \\left(-7-i \\sqrt{8651}\\right)\\lor x=\\frac{1}{150} \\left(-7+i \\sqrt{8651}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((75*x**2)/7)+x+(29/7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$12 \\sqrt{2} x+11 \\sqrt{2} y+3 \\sqrt{2} z-11 \\sqrt{2}=0$, $-\\sqrt{2} x-10 \\sqrt{2} y+12 \\sqrt{2} z-13 \\sqrt{2}=0$, $16 \\sqrt{2} x+10 \\sqrt{2} y+\\sqrt{2} z+\\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{1345}{1013}$, $y=\\frac{1802}{1013}$, $z=\\frac{2487}{1013}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((12*sqrt(2)*x+11*sqrt(2)*y+3*sqrt(2)*z-11*sqrt(2), -sqrt(2)*x-10*sqrt(2)*y+12*sqrt(2)*z-13*sqrt(2), 16*sqrt(2)*x+10*sqrt(2)*y+sqrt(2)*z+sqrt(2))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -13 x^2+13 x+9$ and $q(x) = 5 x^2-x+8$", + "Output Answer": [ + "$-65 x^4+78 x^3-72 x^2+95 x+72$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -13*x**2+13*x+9\nq = 5*x**2-x+8\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 256 (x-1)^4, q(x) = (8 x+3)^2$", + "Output Answer": [ + "$256 x^4-1024 x^3+1600 x^2-976 x+265$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 256*(x-1)**4\nq = (8*x+3)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-9 x-18 y+9=0$, $22 x-21 y-4=0$", + "Output Answer": [ + "$x=\\frac{29}{65}$, $y=\\frac{18}{65}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-9*x-18*y+9, 22*x-21*y-4), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\cos (8-3 x)$", + "Output Answer": [ + "$-1\\leq y\\leq 1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(cos(8-3*x), x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{65}{79}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$\\frac{1040}{79}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (65/79) # initial value\nd = 0 # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (65/79) # initial value\nd = 0 # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-4 x-10 y^2+6 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x-\\frac{2}{5}\\right)^2-10 \\left(y-\\frac{3}{10}\\right)^2=\\frac{59}{10}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{10} \\left(4-\\sqrt{177}\\right) & \\frac{3}{10} \\\\\n \\frac{1}{10} \\left(4+\\sqrt{177}\\right) & \\frac{3}{10} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{10} \\left(4-\\sqrt{177}\\right)+\\frac{1}{10} \\left(4+\\sqrt{177}\\right)\\right),\\frac{3}{10}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{2}}+\\frac{1}{10} \\left(3-2 \\sqrt{2}\\right),y=\\frac{1}{10} \\left(3+2 \\sqrt{2}\\right)-\\frac{x}{\\sqrt{2}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-4*x-10*y**2+6*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{11 x}{7}-\\frac{82 y}{7}+z+\\frac{148}{7}=0$, $-\\frac{115 x}{7}+5 y-\\frac{102 z}{7}+\\frac{34}{7}=0$, $\\frac{2 x}{7}+\\frac{82 y}{7}+\\frac{54 z}{7}+\\frac{116}{7}=0$", + "Output Answer": [ + "$x=\\frac{1314732}{335893}$, $y=\\frac{322342}{335893}$, $z=-\\frac{1259724}{335893}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((11*x)/7)-((82*y)/7)+z+(148/7), -((115*x)/7)+5*y-((102*z)/7)+(34/7), ((2*x)/7)+((82*y)/7)+((54*z)/7)+(116/7))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -10 x^2+2 x-6$ and $q(x) = 12-9 x^2$", + "Output Answer": [ + "$90 x^4-18 x^3-66 x^2+24 x-72$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -10*x**2+2*x-6\nq = 12-9*x**2\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$22 x-9 y-13 z-22=0$, $24 x-8 y+16 z+10=0$, $-8 x-2 y+11 z-20=0$", + "Output Answer": [ + "$x=-\\frac{3721}{1876}$, $y=-\\frac{5821}{938}$, $z=-\\frac{353}{469}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((22*x-9*y-13*z-22, 24*x-8*y+16*z+10, -8*x-2*y+11*z-20)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{49 x}{5}-\\frac{57}{5}}+\\sqrt{-x-3}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{88} \\left(-1569+5 \\sqrt{25685}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((49*x)/5)-(57/5))+sqrt(-x-3), 11), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(6+5 i) \\log (2)$ and $y=(-12+i) \\log (2)$", + "Output Answer": [ + "$(-77-54 i) \\log ^2(2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (6+5*i)*math.log10(2)\ny = (-12+i)*math.log10(2)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{481 x^3}{3}+\\frac{775 x^2}{3}+\\frac{175 x}{3}-111}{6-\\frac{26 x}{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{37} \\left(17-\\sqrt{1658}\\right)\\right\\},\\left\\{x\\to \\frac{1}{37} \\left(17+\\sqrt{1658}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((481*x**3)/3)+((775*x**2)/3)+((175*x)/3)-111)/(6-((26*x)/3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2+48 x$", + "Output Answer": [ + "$12 x (x+4)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2+48*x, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=6 \\sqrt{2}$ and $y=(5+6 i) \\sqrt{2}$", + "Output Answer": [ + "$\\frac{30}{61}-\\frac{36 i}{61}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = 6*math.sqrt(2)\ny = (5+6*i)*math.sqrt(2)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(\\cos \\left(\\frac{37}{90}\\right)+i \\sin \\left(\\frac{37}{90}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$125 \\left(\\cos \\left(\\frac{37}{30}\\right)+i \\sin \\left(\\frac{37}{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(math.cos((37/90))+1j*math.sin((37/90))))**3)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$23 x+17 y-2=0$, $-17 x+14 y+18=0$", + "Output Answer": [ + "$x=\\frac{334}{611}$, $y=-\\frac{380}{611}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((23*x+17*y-2, -17*x+14*y+18), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{17 x^2+13 x-16}{16 x-19}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{34} \\left(-13-\\sqrt{1257}\\right)\\right\\},\\left\\{x\\to \\frac{1}{34} \\left(-13+\\sqrt{1257}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((17*x**2+13*x-16)/(16*x-19)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -14.4 x^2-4.1 x+3.$, $q(x) = -14.1 x^2-11.5 x-1.4$", + "Output Answer": [ + "$-28.5 x^2-15.6 x+1.6$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -14.4*x**2-4.1*x+3.\nq = -14.1*x**2-11.5*x-1.4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-9+3 i$ and $y=-9+6 i$", + "Output Answer": [ + "$-18+9 i$" + ], + "Output Program": [ + "i = 1j\nx = -9+3*i\ny = -9+6*i\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\left((5+11)^2-19\\right)+17}{3+1}$.", + "Output Answer": [ + "$\\frac{127}{2}$" + ], + "Output Program": [ + "try: \n print(((((5+11)**2-19)+17)/(3+1)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $x^4-7 x^3+3 x^2+3 x-8$ when divided by $5$.", + "Output Answer": [ + "$\\frac{x^4}{5}-\\frac{7 x^3}{5}+\\frac{3 x^2}{5}+\\frac{3 x}{5}-\\frac{8}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**4-7*x**3+3*x**2+3*x-8\nq = 5\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2+x-6 y^2-10 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(x+\\frac{1}{4}\\right)^2-6 \\left(y+\\frac{5}{6}\\right)^2=-\\frac{49}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{4} & -2 \\\\\n -\\frac{1}{4} & \\frac{1}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2$\nCenter: $\\left\\{-\\frac{1}{4},-\\frac{5}{6}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{12} \\left(-10-\\sqrt{3}\\right)-\\frac{x}{\\sqrt{3}},y=\\frac{x}{\\sqrt{3}}+\\frac{1}{12} \\left(\\sqrt{3}-10\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2+x-6*y**2-10*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{19 x}{4}-\\frac{49 y}{2}+\\frac{z}{2}+20=0$, $-\\frac{45 x}{4}-\\frac{45 y}{4}-\\frac{41 z}{4}-\\frac{69}{4}=0$, $\\frac{47 x}{4}-20 y-20 z+\\frac{67}{4}=0$", + "Output Answer": [ + "$x=-\\frac{213209}{136749}$, $y=\\frac{598777}{546996}$, $z=-\\frac{213903}{182332}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((19*x)/4)-((49*y)/2)+(z/2)+20, -((45*x)/4)-((45*y)/4)-((41*z)/4)-(69/4), ((47*x)/4)-20*y-20*z+(67/4))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(\\cos \\left(\\frac{2}{9}\\right)+i \\sin \\left(\\frac{2}{9}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$16 \\left(\\cos \\left(\\frac{8}{9}\\right)+i \\sin \\left(\\frac{8}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(math.cos((2/9))+1j*math.sin((2/9))))**4)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(4+16)+((6+20)-13)$.", + "Output Answer": [ + "$33$" + ], + "Output Program": [ + "try: \n print((4+16)+((6+20)-13))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-1$ and $3 x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-1, 3*x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2-114 x-540$", + "Output Answer": [ + "$10 (x-15) \\left(x+\\frac{18}{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2-114*x-540, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $9 x^4+\\frac{7 x^3}{2}-33 x^2+\\frac{71 x}{4}+\\frac{5}{2}$ and $-2 x^3-3 x^2+4 x+\\frac{1}{2}$.", + "Output Answer": [ + "$x^3+\\frac{3 x^2}{2}-2 x-\\frac{1}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(9*x**4+((7*x**3)/2)-33*x**2+((71*x)/4)+(5/2), -2*x**3-3*x**2+4*x+(1/2)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-8 x-8 y^2-10 y+6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x-\\frac{4}{5}\\right)^2-8 \\left(y+\\frac{5}{8}\\right)^2=-\\frac{237}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{4}{5} & -\\frac{5}{8}-\\frac{\\sqrt{3081}}{40} \\\\\n \\frac{4}{5} & \\frac{1}{40} \\left(\\sqrt{3081}-25\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{13}{5}}$\nCenter: $\\left\\{\\frac{4}{5},\\frac{1}{2} \\left(-\\frac{5}{8}-\\frac{\\sqrt{3081}}{40}+\\frac{1}{40} \\left(\\sqrt{3081}-25\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{40} \\left(8 \\sqrt{10}-25\\right)-\\frac{1}{2} \\sqrt{\\frac{5}{2}} x,y=\\frac{1}{2} \\sqrt{\\frac{5}{2}} x+\\frac{1}{40} \\left(-25-8 \\sqrt{10}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-8*x-8*y**2-10*y+6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{83}{69}$, and $a_n=a_{n-1}+-4 \\sqrt{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=12$.", + "Output Answer": [ + "$6 \\left(\\frac{166}{69}-44 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\na = (83/69) # initial value\nd = -4*math.sqrt(5) # second term\nn = 12 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (83/69) # initial value\nd = -4*math.sqrt(5) # second term\nn = 12 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=16 \\left(9 t^2+135 t+508\\right)^2, x(t)=4 t^2+60 t+225$", + "Output Answer": [ + "$y=81 x^2+126 x+49$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 16*(9*t**2+135*t+508)**2\nx_t = 4*t**2+60*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x-9}+\\sqrt{15 x+4}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{13}{98} \\left(97-\\sqrt{589}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x-9)+sqrt(15*x+4), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{24 x^2}{\\sqrt{\\pi }}+\\frac{11 x}{\\sqrt{\\pi }}+\\frac{14}{\\sqrt{\\pi }}$ and $q(x) = \\frac{17 x^2}{\\sqrt{\\pi }}+\\frac{17 x}{\\sqrt{\\pi }}+\\frac{8}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$-\\frac{408 x^4}{\\pi }-\\frac{221 x^3}{\\pi }+\\frac{233 x^2}{\\pi }+\\frac{326 x}{\\pi }+\\frac{112}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((24*x**2)/(sqrt(pi)))+((11*x)/(sqrt(pi)))+(14/(sqrt(pi)))\nq = ((17*x**2)/(sqrt(pi)))+((17*x)/(sqrt(pi)))+(8/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{4 x^2}{\\sqrt{3}}+\\frac{10 x}{\\sqrt{3}}-3 \\sqrt{3}$ and $q(x) = \\frac{x^2}{\\sqrt{3}}-5 \\sqrt{3} x+\\frac{20}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{4 x^4}{3}+\\frac{70 x^3}{3}-\\frac{239 x^2}{3}+\\frac{335 x}{3}-60$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -((4*x**2)/(sqrt(3)))+((10*x)/(sqrt(3)))-3*sqrt(3)\nq = ((x**2)/(sqrt(3)))-5*sqrt(3)*x+(20/(sqrt(3)))\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-10 \\left(\\cos \\left(\\frac{1}{90}\\right)+i \\sin \\left(\\frac{1}{90}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$1000000 \\left(\\cos \\left(\\frac{1}{15}\\right)+i \\sin \\left(\\frac{1}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-10*(math.cos((1/90))+1j*math.sin((1/90))))**6)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2-\\frac{160 x}{\\sqrt{3}}-1870$", + "Output Answer": [ + "$-10 \\left(-x-\\frac{17}{\\sqrt{3}}\\right) \\left(x-11 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2-((160*x)/(sqrt(3)))-1870, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x+\\frac{19}{3}}+\\sqrt{3 x+15}=\\frac{13}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(767-26 \\sqrt{915}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x+(19/3))+sqrt(3*x+15), (13/3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-x^3+5 x+4$ when divided by $7 x^3+6 x^2-3 x+10$.", + "Output Answer": [ + "$-\\frac{1}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -x**3+5*x+4\nq = 7*x**3+6*x**2-3*x+10\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((((19-25)-17)+13)-23)-\\frac{9+14}{16}$.", + "Output Answer": [ + "$-\\frac{551}{16}$" + ], + "Output Program": [ + "try: \n print(((((19-25)-17)+13)-23)-((9+14)/16))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{12 x^2+20 x-11}{-5 x^2-16 x-1}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(-5-\\sqrt{58}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(-5+\\sqrt{58}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((12*x**2+20*x-11)/(-5*x**2-16*x-1)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{1}{23} (((5+24)+14)-14)}{6-10}$.", + "Output Answer": [ + "$-\\frac{29}{92}$" + ], + "Output Program": [ + "try: \n print((((1/23)*(((5+24)+14)-14))/(6-10)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $6 \\sqrt{2} \\left(-\\cos \\left(\\frac{\\pi }{15}\\right)+i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)$.", + "Output Answer": [ + "Norm: $6 \\sqrt{2 \\left(\\sin ^2\\left(\\frac{\\pi }{15}\\right)+\\cos ^2\\left(\\frac{\\pi }{15}\\right)\\right)}$\nArgument: $\\frac{14 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 6*math.sqrt(2)*(-math.cos((math.pi/15))+i*math.sin((math.pi/15)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{89}{74}$, and $a_n=a_{n-1}+-5$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$-\\frac{7880}{37}$" + ], + "Output Program": [ + "a = (89/74) # initial value\nd = -5 # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (89/74) # initial value\nd = -5 # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-x^2+15 x+12$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(15-\\sqrt{273}\\right)\\lor x=\\frac{1}{2} \\left(15+\\sqrt{273}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-x**2+15*x+12, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$25 x+21 y-14=0$, $14 x+5 y-16=0$", + "Output Answer": [ + "$x=\\frac{266}{169}$, $y=-\\frac{204}{169}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((25*x+21*y-14, 14*x+5*y-16), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{16 x^2}{5}+\\frac{16 x}{5}+\\frac{1}{5}$", + "Output Answer": [ + "$x=\\frac{1}{4} \\left(-2-\\sqrt{3}\\right)\\lor x=\\frac{1}{4} \\left(\\sqrt{3}-2\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((16*x**2)/5)+((16*x)/5)+(1/5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $6 x^2+64 x-280$", + "Output Answer": [ + "$-6 (-x-14) \\left(x-\\frac{10}{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(6*x**2+64*x-280, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\left(\\cos \\left(\\frac{7}{6}\\right)+i \\sin \\left(\\frac{7}{6}\\right)\\right)\\right)^3$", + "Output Answer": [ + "$125 \\left(\\cos \\left(\\frac{7}{2}\\right)+i \\sin \\left(\\frac{7}{2}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*(math.cos((7/6))+1j*math.sin((7/6))))**3)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\sqrt{107} \\left(\\sqrt{53}-54\\right)$.", + "Output Answer": [ + "$\\sqrt{107} \\left(\\sqrt{53}-54\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint(sqrt(107)*(sqrt(53)-54))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\log \\left(2 x-\\frac{13}{3}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(3 e^y+13\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, log(2*x-(13/3)))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -9 \\sqrt{3} x-\\sqrt{3}\\right| =5 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{2}{3}\\right\\},\\left\\{x\\to \\frac{4}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-9*sqrt(3)*x-sqrt(3)), 5*sqrt(3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\left(16 t^2-240 t+903\\right)^2, x(t)=4 t^2-60 t+225$", + "Output Answer": [ + "$y=16 x^2+24 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (16*t**2-240*t+903)**2\nx_t = 4*t**2-60*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=(1+3 i) \\sqrt{2}$ and $y=3 i \\sqrt{2}$", + "Output Answer": [ + "$-18+6 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (1+3*i)*math.sqrt(2)\ny = 3*i*math.sqrt(2)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$14 x+9 y+11=0$, $-13 x-17 y-14=0$", + "Output Answer": [ + "$x=-\\frac{61}{121}$, $y=-\\frac{53}{121}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((14*x+9*y+11, -13*x-17*y-14), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -x^2+x-3$ and $q(x) = -4 x^2+7 x+7$", + "Output Answer": [ + "$4 x^4-11 x^3+12 x^2-14 x-21$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -x**2+x-3\nq = -4*x**2+7*x+7\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\sqrt{3} \\left(\\cos \\left(\\frac{11 \\pi }{45}\\right)+i \\sin \\left(\\frac{11 \\pi }{45}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\sqrt{3 \\left(\\sin ^2\\left(\\frac{11 \\pi }{45}\\right)+\\cos ^2\\left(\\frac{11 \\pi }{45}\\right)\\right)}$\nArgument: $-\\frac{34 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.sqrt(3)*(math.cos(((11*math.pi)/45))+i*math.sin(((11*math.pi)/45)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{20}{3}+\\frac{29 i}{3}$ and $y=-\\frac{1}{3}+7 i$", + "Output Answer": [ + "$7+\\frac{8 i}{3}$" + ], + "Output Program": [ + "i = 1j\nx = (20/3)+((29*i)/3)\ny = -(1/3)+7*i\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{43 | x| }{2}=\\frac{39}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{39}{43}\\right\\},\\left\\{x\\to \\frac{39}{43}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(((43*abs(x))/2), (39/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{3 x+6}+\\sqrt{6 x+12}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(294-200 \\sqrt{2}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(3*x+6)+sqrt(6*x+12), 10), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4.1 x^2+0.1 x+12.9$, $q(x) = 14.3 x^2-7.2 x+1.1$", + "Output Answer": [ + "$18.4 x^2-7.1 x+14.$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4.1*x**2+0.1*x+12.9\nq = 14.3*x**2-7.2*x+1.1\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{5 x^2+\\frac{7 x}{3}-\\frac{29}{3}}{\\frac{23 x^2}{3}+\\frac{73 x}{3}-19}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{30} \\left(-7-\\sqrt{1789}\\right)\\right\\},\\left\\{x\\to \\frac{1}{30} \\left(-7+\\sqrt{1789}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((5*x**2+((7*x)/3)-(29/3))/(((23*x**2)/3)+((73*x)/3)-19)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$\\frac{21 x}{2}-\\frac{27 y}{2}-\\frac{43}{2}=0$, $-19 x+\\frac{15 y}{2}+21=0$", + "Output Answer": [ + "$x=\\frac{163}{237}$, $y=-\\frac{752}{711}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((((21*x)/2)-((27*y)/2)-(43/2), -19*x+((15*y)/2)+21), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-x^3+19 x^2+260 x-4800$", + "Output Answer": [ + "$(15-x) (x-20) (x+16)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-x**3+19*x**2+260*x-4800, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 \\left(-12 t+\\sqrt{3}-26\\right), x(t)=-4 \\sqrt{3} t-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=4 \\sqrt{3} x+4 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*(-12*t+sqrt(3)-26)\nx_t = -4*sqrt(3)*t-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-4 x+7 y^2+9 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $6 \\left(x-\\frac{1}{3}\\right)^2+7 \\left(y+\\frac{9}{14}\\right)^2=\\frac{971}{84}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{84} \\left(28-\\sqrt{1942}\\right) & -\\frac{9}{14} \\\\\n \\frac{1}{84} \\left(28+\\sqrt{1942}\\right) & -\\frac{9}{14} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{84} \\left(28-\\sqrt{1942}\\right)+\\frac{1}{84} \\left(28+\\sqrt{1942}\\right)\\right),-\\frac{9}{14}\\right\\}$\nArea Enclosed: $\\frac{971 \\pi }{84 \\sqrt{42}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-4*x+7*y**2+9*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-3 \\sqrt{2} e^{\\frac{2 i \\pi }{3}}$.", + "Output Answer": [ + "Norm: $3 \\sqrt{2}$\nArgument: $-\\frac{\\pi }{3}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -3*math.sqrt(2)*math.e**((2*i*math.pi)/3)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 15 x^2-14 x+6$ and $q(x) = 9 x^2-x+2$", + "Output Answer": [ + "$135 x^4-141 x^3+98 x^2-34 x+12$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 15*x**2-14*x+6\nq = 9*x**2-x+2\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((21-23)-2)-7)-((((13+19)-6)-21)+8)$.", + "Output Answer": [ + "$-24$" + ], + "Output Program": [ + "try: \n print((((21-23)-2)-7)-((((13+19)-6)-21)+8))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{12}{5}-\\frac{52 x}{5}}+\\sqrt{-\\frac{21 x}{5}-\\frac{48}{5}}=\\frac{72}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-369132+288 \\sqrt{1308747}}{4805}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((12/5)-((52*x)/5))+sqrt(-((21*x)/5)-(48/5)), (72/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\left(\\sin \\left(\\frac{7 \\pi }{30}\\right)-i \\cos \\left(\\frac{7 \\pi }{30}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$36 \\left(-\\sin \\left(\\frac{\\pi }{30}\\right)-i \\cos \\left(\\frac{\\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*(math.sin(((7*math.pi)/30))-1j*math.cos(((7*math.pi)/30))))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^4+4 x^3-4 x^2-8 x+8$ when divided by $5 x^3+6 x^2-4 x-1$.", + "Output Answer": [ + "$\\frac{9 x}{5}-\\frac{34}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**4+4*x**3-4*x**2-8*x+8\nq = 5*x**3+6*x**2-4*x-1\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$11 \\sqrt{2} x+\\frac{17 y}{\\sqrt{2}}+\\frac{33 z}{\\sqrt{2}}-\\frac{31}{\\sqrt{2}}=0$, $8 \\sqrt{2} x+6 \\sqrt{2} y-17 \\sqrt{2} z-14 \\sqrt{2}=0$, $-\\frac{25 x}{\\sqrt{2}}+\\frac{23 y}{\\sqrt{2}}+16 \\sqrt{2} z-6 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{15239}{26721}$, $y=\\frac{34301}{26721}$, $z=-\\frac{2728}{26721}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((11*sqrt(2)*x+((17*y)/(sqrt(2)))+((33*z)/(sqrt(2)))-(31/(sqrt(2))), 8*sqrt(2)*x+6*sqrt(2)*y-17*sqrt(2)*z-14*sqrt(2), -((25*x)/(sqrt(2)))+((23*y)/(sqrt(2)))+16*sqrt(2)*z-6*sqrt(2))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 10 x+\\frac{118}{7}\\right| =\\frac{16}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{67}{35}\\right\\},\\left\\{x\\to -\\frac{51}{35}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(10*x+(118/7)), (16/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 15-12 x^2$ and $q(x) = 6 x^2-2$", + "Output Answer": [ + "$-72 x^4+114 x^2-30$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 15-12*x**2\nq = 6*x**2-2\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left((14+13)^2+25\\right)+((((1-9)+11)-8)+7)^2$.", + "Output Answer": [ + "$758$" + ], + "Output Program": [ + "try: \n print(((14+13)**2+25)+((((1-9)+11)-8)+7)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 x^2+9 x-1$ and $q(x) = 6 x^2-6 x+13$", + "Output Answer": [ + "$24 x^4+30 x^3-8 x^2+123 x-13$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*x**2+9*x-1\nq = 6*x**2-6*x+13\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$\\frac{25}{144 x^2}$", + "Output Answer": [ + "$\\frac{7776}{625} \\left(x-\\frac{25}{144}\\right)^2-\\frac{72}{25} \\left(x-\\frac{25}{144}\\right)+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, (25/(144*x**2)))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-14 x^2-3 x+13$", + "Output Answer": [ + "$x=\\frac{1}{28} \\left(-3-\\sqrt{737}\\right)\\lor x=\\frac{1}{28} \\left(\\sqrt{737}-3\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-14*x**2-3*x+13, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{32 x^2}{\\sqrt{3}}-\\frac{17 x}{\\sqrt{3}}-6 \\sqrt{3}}{5 \\sqrt{3}-\\frac{41 x}{\\sqrt{3}}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{64} \\left(17-\\sqrt{2593}\\right)\\right\\},\\left\\{x\\to \\frac{1}{64} \\left(17+\\sqrt{2593}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((32*x**2)/(sqrt(3)))-((17*x)/(sqrt(3)))-6*sqrt(3))/(5*sqrt(3)-((41*x)/(sqrt(3))))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{69}{34}$, and $a_n=a_{n-1}+-\\frac{7}{4}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=28$.", + "Output Answer": [ + "$-\\frac{24423}{34}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(69/34) # initial value\nd = -(7/4) # second term\nn = 28 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(69/34) # initial value\nd = -(7/4) # second term\nn = 28 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{67}{92}$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=9$.", + "Output Answer": [ + "$\\frac{33723}{92}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (67/92) # initial value\nd = 10 # second term\nn = 9 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (67/92) # initial value\nd = 10 # second term\nn = 9 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{9 \\left(-\\sin \\left(\\frac{4 \\pi }{45}\\right)-i \\cos \\left(\\frac{4 \\pi }{45}\\right)\\right)}{\\sqrt{2}}\\right)^2$", + "Output Answer": [ + "$\\frac{81}{2} \\left(-\\cos \\left(\\frac{8 \\pi }{45}\\right)+i \\sin \\left(\\frac{8 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((9*(-math.sin(((4*math.pi)/45))-1j*math.cos(((4*math.pi)/45))))/(math.sqrt(2))))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$12 x-14 y+10 z+22=0$, $11 x-2 y+6 z+11=0$, $-14 y-14 z+4=0$", + "Output Answer": [ + "$x=-\\frac{31}{49}$, $y=\\frac{141}{196}$, $z=-\\frac{85}{196}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((12*x-14*y+10*z+22, 11*x-2*y+6*z+11, -14*y-14*z+4)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=8 t-117, x(t)=t-15$", + "Output Answer": [ + "$y=8 x+3$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 8*t-117\nx_t = t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^5-4 x^4+6 x^3+5 x^2-9 x-9$ when divided by $3 x^3+7 x^2-8 x-6$.", + "Output Answer": [ + "$3 x^2-\\frac{25 x}{3}+\\frac{265}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**5-4*x**4+6*x**3+5*x**2-9*x-9\nq = 3*x**3+7*x**2-8*x-6\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{56 x}{3}+\\frac{68}{3}\\right| =6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{43}{28}\\right\\},\\left\\{x\\to -\\frac{25}{28}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((56*x)/3)+(68/3)), 6), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $6 x^2-9 x+3$ and $3-3 x$.", + "Output Answer": [ + "$3 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(6*x**2-9*x+3, 3-3*x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-13 x+12 y-16 z-13=0$, $-2 x-19 y-19 z+6=0$, $-15 x+12 y+2 z+16=0$", + "Output Answer": [ + "$x=\\frac{6139}{2971}$, $y=\\frac{8793}{5942}$, $z=-\\frac{8209}{5942}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-13*x+12*y-16*z-13, -2*x-19*y-19*z+6, -15*x+12*y+2*z+16)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $2 x^2-9 x-7$", + "Output Answer": [ + "$2 \\left(x-\\frac{9}{4}\\right)^2-\\frac{137}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (2*x**2-9*x-7), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{2}{55}$, and $a_n=a_{n-1}+-\\frac{25}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$-\\frac{54968}{55}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (2/55) # initial value\nd = -(25/3) # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (2/55) # initial value\nd = -(25/3) # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $x^2-3 x-2 y^2-4 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $\\left(x-\\frac{3}{2}\\right)^2-2 (y+1)^2=-\\frac{11}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{2} & \\frac{1}{4} \\left(-4-\\sqrt{66}\\right) \\\\\n \\frac{3}{2} & \\frac{1}{4} \\left(\\sqrt{66}-4\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{3}$\nCenter: $\\left\\{\\frac{3}{2},\\frac{1}{2} \\left(\\frac{1}{4} \\left(-4-\\sqrt{66}\\right)+\\frac{1}{4} \\left(\\sqrt{66}-4\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{4} \\left(3 \\sqrt{2}-4\\right)-\\frac{x}{\\sqrt{2}},y=\\frac{x}{\\sqrt{2}}+\\frac{1}{4} \\left(-4-3 \\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-3*x-2*y**2-4*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\sqrt{2} \\left(-\\sin \\left(\\frac{\\pi }{30}\\right)+i \\cos \\left(\\frac{\\pi }{30}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$32768 \\left(\\frac{1}{4} \\left(-1-\\sqrt{5}\\right)-i \\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*math.sqrt(2)*(-math.sin((math.pi/30))+1j*math.cos((math.pi/30))))**6)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\frac{1}{\\left(-\\frac{3 x}{2}-3\\right)^2}$", + "Output Answer": [ + "$x<-2\\lor x>-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = (1/((-((3*x)/2)-3)**2))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{61}{65}$, and $a_n=a_{n-1}+\\frac{60}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$\\frac{34246}{91}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(61/65) # initial value\nd = (60/7) # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(61/65) # initial value\nd = (60/7) # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$9 \\sqrt{3} x-6 \\sqrt{3} y+4 \\sqrt{3} z-14 \\sqrt{3}=0$, $-\\frac{38 x}{\\sqrt{3}}+\\frac{26 y}{\\sqrt{3}}-\\frac{16 z}{\\sqrt{3}}+\\frac{11}{\\sqrt{3}}=0$, $\\frac{4 x}{\\sqrt{3}}+\\frac{23 y}{\\sqrt{3}}+\\frac{8 z}{\\sqrt{3}}-\\frac{23}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{1585}{42}$, $y=-\\frac{320}{21}$, $z=\\frac{3671}{56}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((9*sqrt(3)*x-6*sqrt(3)*y+4*sqrt(3)*z-14*sqrt(3), -((38*x)/(sqrt(3)))+((26*y)/(sqrt(3)))-((16*z)/(sqrt(3)))+(11/(sqrt(3))), ((4*x)/(sqrt(3)))+((23*y)/(sqrt(3)))+((8*z)/(sqrt(3)))-(23/(sqrt(3))))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{43}{25}$, and $a_n=a_{n-1}+\\frac{37}{4}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=28$.", + "Output Answer": [ + "$\\frac{177233}{50}$" + ], + "Output Program": [ + "a = (43/25) # initial value\nd = (37/4) # second term\nn = 28 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (43/25) # initial value\nd = (37/4) # second term\nn = 28 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-13 \\sqrt{3} y+12 \\sqrt{3} z+5 \\sqrt{3}=0$, $\\sqrt{3} x-4 \\sqrt{3} y+2 \\sqrt{3} z-6 \\sqrt{3}=0$, $-3 \\sqrt{3} x+12 \\sqrt{3} y-6 \\sqrt{3} z-7 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{389}{907}$, $y=-\\frac{2701}{5442}$, $z=-\\frac{493}{907}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-13*sqrt(3)*y+12*sqrt(3)*z+5*sqrt(3), sqrt(3)*x-4*sqrt(3)*y+2*sqrt(3)*z-6*sqrt(3), -3*sqrt(3)*x+12*sqrt(3)*y-6*sqrt(3)*z-7*sqrt(3))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $x^3-x^2-2 x$", + "Output Answer": [ + "$-((2-x) x (x+1))$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(x**3-x**2-2*x, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-x+5 y^2-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $6 \\left(x-\\frac{1}{12}\\right)^2+5 y^2=\\frac{73}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{12} & -\\frac{\\sqrt{\\frac{73}{5}}}{12} \\\\\n \\frac{1}{12} & \\frac{\\sqrt{\\frac{73}{5}}}{12} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{6}}$\nCenter: $\\left\\{\\frac{1}{12},0\\right\\}$\nArea Enclosed: $\\frac{73 \\pi }{24 \\sqrt{30}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-x+5*y**2-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{19}{47}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=17$.", + "Output Answer": [ + "$\\frac{38675}{47}$" + ], + "Output Program": [ + "a = (19/47) # initial value\nd = 6 # second term\nn = 17 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (19/47) # initial value\nd = 6 # second term\nn = 17 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{(10+15)+9}{(((19+15)+20)+2)+4}$.", + "Output Answer": [ + "$\\frac{17}{30}$" + ], + "Output Program": [ + "try: \n print((((10+15)+9)/((((19+15)+20)+2)+4)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2+8 x+3 y^2-10 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x+\\frac{2}{5}\\right)^2+3 \\left(y-\\frac{5}{3}\\right)^2=\\frac{299}{15}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2}{5} & \\frac{1}{30} \\left(50-\\sqrt{4186}\\right) \\\\\n -\\frac{2}{5} & \\frac{1}{30} \\left(50+\\sqrt{4186}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{10}}$\nCenter: $\\left\\{-\\frac{2}{5},\\frac{1}{2} \\left(\\frac{1}{30} \\left(50-\\sqrt{4186}\\right)+\\frac{1}{30} \\left(50+\\sqrt{4186}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{299 \\pi }{15 \\sqrt{30}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2+8*x+3*y**2-10*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2+5 x+8 y^2+y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y+\\frac{1}{16}\\right)^2-3 \\left(x-\\frac{5}{6}\\right)^2=-\\frac{293}{96}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{6}-\\frac{\\sqrt{3223}}{48} & -\\frac{1}{16} \\\\\n \\frac{1}{48} \\left(40+\\sqrt{3223}\\right) & -\\frac{1}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{11}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{5}{6}-\\frac{\\sqrt{3223}}{48}+\\frac{1}{48} \\left(40+\\sqrt{3223}\\right)\\right),-\\frac{1}{16}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{2} \\sqrt{\\frac{3}{2}} x+\\frac{1}{48} \\left(-3-10 \\sqrt{6}\\right),y=\\frac{1}{48} \\left(10 \\sqrt{6}-3\\right)-\\frac{1}{2} \\sqrt{\\frac{3}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2+5*x+8*y**2+y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the third order series of the inverse of the following function around 3:\n$\\tan \\left(\\frac{9 x}{5}\\right)$", + "Output Answer": [ + "$\\frac{5 x}{9}-\\frac{5 x^3}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, tan(((9*x)/5)))\nprint(solve(f, x)[0].series(y, 3, 3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $7 x^2+6 x+3$", + "Output Answer": [ + "$7 \\left(x+\\frac{3}{7}\\right)^2+\\frac{12}{7}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (7*x**2+6*x+3), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{4 x^2}{3}+\\frac{43 x}{3}-9$", + "Output Answer": [ + "$\\frac{1417}{48}-\\frac{4}{3} \\left(x-\\frac{43}{8}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((4*x**2)/3)+((43*x)/3)-9), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{4-25 i}{e}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{641}}{e}$\nArgument: $-\\tan ^{-1}\\left(\\frac{25}{4}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((4-25*i)/math.e)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-21 x+3 y-9 z-9=0$, $4 x-3 y+4 z+20=0$, $18 x-y+23 z+7=0$", + "Output Answer": [ + "$x=\\frac{16}{19}$, $y=\\frac{656}{95}$, $z=-\\frac{63}{95}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-21*x+3*y-9*z-9, 4*x-3*y+4*z+20, 18*x-y+23*z+7)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{58}{25}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=25$.", + "Output Answer": [ + "$-58$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(58/25) # initial value\nd = 0 # second term\nn = 25 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(58/25) # initial value\nd = 0 # second term\nn = 25 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3$ and $-2 x^3-2 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3, -2*x**3-2*x-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-76 x^3+11 x^2+39 x-9}{-52 x^2-123 x-63}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{38} \\left(17-\\sqrt{61}\\right)\\right\\},\\left\\{x\\to \\frac{1}{38} \\left(17+\\sqrt{61}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-76*x**3+11*x**2+39*x-9)/(-52*x**2-123*x-63)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-\\frac{13 x^5}{2}+\\frac{x^4}{2}-6 x^3-\\frac{3 x^2}{2}-2 x-\\frac{17}{2}$ when divided by $\\frac{11 x}{2}+\\frac{17}{2}$.", + "Output Answer": [ + "$-\\frac{13 x^4}{11}+\\frac{232 x^3}{121}-\\frac{5396 x^2}{1331}+\\frac{87739 x}{14641}-\\frac{1550127}{161051}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((13*x**5)/2)+((x**4)/2)-6*x**3-((3*x**2)/2)-2*x-(17/2)\nq = ((11*x)/2)+(17/2)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $7 x^2-\\frac{15 x}{2}+7$", + "Output Answer": [ + "$7 \\left(x-\\frac{15}{28}\\right)^2+\\frac{559}{112}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (7*x**2-((15*x)/2)+7), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=8$ and $y=7-5 i$", + "Output Answer": [ + "$1+5 i$" + ], + "Output Program": [ + "i = 1j\nx = 8\ny = 7-5*i\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{13}{2} \\left(\\cos \\left(\\frac{16}{15}\\right)+i \\sin \\left(\\frac{16}{15}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$\\frac{371293}{32} \\left(\\cos \\left(\\frac{16}{3}\\right)+i \\sin \\left(\\frac{16}{3}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((13/2)*(math.cos((16/15))+1j*math.sin((16/15))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 17 x+21| =0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{21}{17}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(17*x+21), 0), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{-3 x-\\frac{3}{2}}$ at the point $x=-3$", + "Output Answer": [ + "$\\sqrt{\\frac{15}{2}} = 2.739$" + ], + "Output Program": [ + "import math\n\nx = -3\ntry: \n f = math.sqrt(-3*x-(3/2))\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{3}{2} e^{\\frac{4 i \\pi }{5}}$.", + "Output Answer": [ + "Norm: $\\frac{3}{2}$\nArgument: $\\frac{4 \\pi }{5}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (3/2)*math.e**((4*i*math.pi)/5)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{34 x}{\\sqrt{3}}+\\frac{38 y}{\\sqrt{3}}+\\frac{38}{\\sqrt{3}}=0$, $-\\frac{38 x}{\\sqrt{3}}+8 \\sqrt{3} y-\\frac{11}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{665}{314}$, $y=-\\frac{909}{314}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((34*x)/(sqrt(3)))+((38*y)/(sqrt(3)))+(38/(sqrt(3))), -((38*x)/(sqrt(3)))+8*sqrt(3)*y-(11/(sqrt(3)))), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 (x+5)^4, q(x) = \\frac{2 x-9}{\\sqrt{3}}$", + "Output Answer": [ + "$9 x^4+180 x^3+1350 x^2+\\frac{2 x}{\\sqrt{3}}+4500 x-3 \\sqrt{3}+5625$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*(x+5)**4\nq = ((2*x-9)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$x-\\frac{23 y}{2}+10 z+19=0$, $\\frac{43 x}{2}-\\frac{17 y}{2}+24 z+\\frac{31}{2}=0$, $21 x-\\frac{7 y}{2}-\\frac{41 z}{2}-5=0$", + "Output Answer": [ + "$x=\\frac{13321}{76591}$, $y=\\frac{107380}{76591}$, $z=-\\frac{23368}{76591}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((x-((23*y)/2)+10*z+19, ((43*x)/2)-((17*y)/2)+24*z+(31/2), 21*x-((7*y)/2)-((41*z)/2)-5)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\left(125 t^2-750 t+1123\\right)^2, x(t)=25 t^2-150 t+225$", + "Output Answer": [ + "$y=25 x^2-20 x+4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (125*t**2-750*t+1123)**2\nx_t = 25*t**2-150*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-2 x^2+36 x-154$", + "Output Answer": [ + "$-2 (x-11) (x-7)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-2*x**2+36*x-154, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 3 \\left(-5 x^2+x-5\\right)$, $q(x) = 11 x^2-6 x+7$", + "Output Answer": [ + "$-4 x^2-3 x-8$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 3*(-5*x**2+x-5)\nq = 11*x**2-6*x+7\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{9 \\left(-\\cos \\left(\\frac{2 \\pi }{15}\\right)+i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)}{\\sqrt{2}}$.", + "Output Answer": [ + "Norm: $9 \\sqrt{\\frac{1}{2} \\left(\\sin ^2\\left(\\frac{2 \\pi }{15}\\right)+\\cos ^2\\left(\\frac{2 \\pi }{15}\\right)\\right)}$\nArgument: $\\frac{13 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((9*(-math.cos(((2*math.pi)/15))+i*math.sin(((2*math.pi)/15))))/(math.sqrt(2)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $2 x^2-\\frac{76 x}{5}-\\frac{336}{25}$", + "Output Answer": [ + "$-2 \\left(\\frac{42}{5}-x\\right) \\left(x+\\frac{4}{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(2*x**2-((76*x)/5)-(336/25), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{10 x^2}{\\sqrt{3}}-\\frac{8 x}{\\sqrt{3}}+\\frac{14}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{10 \\left(x-\\frac{2}{5}\\right)^2}{\\sqrt{3}}+\\frac{62}{5 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((10*x**2)/(math.sqrt(3)))-((8*x)/(math.sqrt(3)))+(14/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{73}{98}$, and $a_n=a_{n-1}+-\\frac{3}{\\sqrt{2}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$12 \\left(\\frac{73}{49}-\\frac{69}{\\sqrt{2}}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (73/98) # initial value\nd = -(3/(math.sqrt(2))) # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (73/98) # initial value\nd = -(3/(math.sqrt(2))) # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2-26 x-165$", + "Output Answer": [ + "$(-x-11) (x+15)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2-26*x-165, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $11 x^2-6 x-\\frac{21}{5}$", + "Output Answer": [ + "$x=\\frac{1}{55} \\left(15-2 \\sqrt{345}\\right)\\lor x=\\frac{1}{55} \\left(15+2 \\sqrt{345}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(11*x**2-6*x-(21/5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{43}{71}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$\\frac{903}{71}$" + ], + "Output Program": [ + "a = (43/71) # initial value\nd = 0 # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (43/71) # initial value\nd = 0 # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $2 x^2+x-6 y^2+4 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(x+\\frac{1}{4}\\right)^2-6 \\left(y-\\frac{1}{3}\\right)^2=-\\frac{205}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{4} & \\frac{1}{6} \\left(2-\\sqrt{205}\\right) \\\\\n -\\frac{1}{4} & \\frac{1}{6} \\left(2+\\sqrt{205}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2$\nCenter: $\\left\\{-\\frac{1}{4},\\frac{1}{2} \\left(\\frac{1}{6} \\left(2-\\sqrt{205}\\right)+\\frac{1}{6} \\left(2+\\sqrt{205}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{12} \\left(4-\\sqrt{3}\\right)-\\frac{x}{\\sqrt{3}},y=\\frac{x}{\\sqrt{3}}+\\frac{1}{12} \\left(4+\\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(2*x**2+x-6*y**2+4*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{18 x^2+11 x-18}{\\sqrt{\\pi }}$, $q(x) = \\frac{-7 x^2+18 x-7}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{11 x^2}{\\sqrt{\\pi }}+\\frac{29 x}{\\sqrt{\\pi }}-\\frac{25}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((18*x**2+11*x-18)/(sqrt(pi)))\nq = ((-7*x**2+18*x-7)/(sqrt(pi)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{36 x}{5}+\\frac{58}{5}}+\\sqrt{\\frac{52 x}{5}+2}=\\frac{51}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{160} \\left(29091-51 \\sqrt{317597}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((36*x)/5)+(58/5))+sqrt(((52*x)/5)+2), (51/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{8 x^5}{3}+\\frac{80 x^4}{9}+\\frac{32 x^3}{3}+\\frac{112 x^2}{9}+\\frac{8 x}{9}-\\frac{104}{9}$ and $-x^5+\\frac{10 x^4}{3}+4 x^3+\\frac{14 x^2}{3}+\\frac{x}{3}-\\frac{13}{3}$.", + "Output Answer": [ + "$\\frac{x^5}{3}-\\frac{10 x^4}{9}-\\frac{4 x^3}{3}-\\frac{14 x^2}{9}-\\frac{x}{9}+\\frac{13}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((8*x**5)/3)+((80*x**4)/9)+((32*x**3)/3)+((112*x**2)/9)+((8*x)/9)-(104/9), -x**5+((10*x**4)/3)+4*x**3+((14*x**2)/3)+(x/3)-(13/3)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{8 x^2-25 x-4}{21 x^2+x+20}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(25-\\sqrt{753}\\right)\\right\\},\\left\\{x\\to \\frac{1}{16} \\left(25+\\sqrt{753}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((8*x**2-25*x-4)/(21*x**2+x+20)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((((12+9)+24)+4)-7)-(((10+22)-7)+19)^2$.", + "Output Answer": [ + "$-1894$" + ], + "Output Program": [ + "try: \n print(((((12+9)+24)+4)-7)-(((10+22)-7)+19)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 256 (x-1)^4, q(x) = 4 (x+2)^2$", + "Output Answer": [ + "$256 x^4-1024 x^3+1540 x^2-1008 x+272$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 256*(x-1)**4\nq = 4*(x+2)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{25 x^2+18 x+1}{-23 x^2-22 x+21}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{25} \\left(-9-2 \\sqrt{14}\\right)\\right\\},\\left\\{x\\to \\frac{1}{25} \\left(-9+2 \\sqrt{14}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((25*x**2+18*x+1)/(-23*x**2-22*x+21)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-16 x+8 y+22 z+20=0$, $14 x+21 y-13 z-17=0$, $8 x+12 y+7 z=0$", + "Output Answer": [ + "$x=\\frac{631}{1616}$, $y=\\frac{107}{808}$, $z=-\\frac{68}{101}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-16*x+8*y+22*z+20, 14*x+21*y-13*z-17, 8*x+12*y+7*z)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt{\\frac{20}{3}-\\frac{13 x}{3}}+e^{\\frac{22}{3}-\\frac{25 x}{3}}$", + "Output Answer": [ + "$x\\leq \\frac{20}{13}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = sqrt((20/3)-((13*x)/3))+math.e**((22/3)-((25*x)/3))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{9}{64} (9 t+164)^2, x(t)=-\\frac{3 t}{4}-15$", + "Output Answer": [ + "$y=\\frac{81 x^2}{4}+54 x+36$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (9/64)*(9*t+164)**2\nx_t = -((3*t)/4)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{17+8}{\\frac{9-3}{2}-6}$.", + "Output Answer": [ + "$-\\frac{25}{3}$" + ], + "Output Program": [ + "try: \n print(((17+8)/(((9-3)/2)-6)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{3}{20}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$-\\frac{18}{5}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(3/20) # initial value\nd = 0 # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(3/20) # initial value\nd = 0 # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10 x+13}+\\sqrt{15 x-2}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{5} \\left(430-13 \\sqrt{1057}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10*x+13)+sqrt(15*x-2), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{27} \\left(1134 t^2-6552 t+9509\\right)^2, x(t)=27 t^2-156 t+\\frac{676}{3}$", + "Output Answer": [ + "$y=\\frac{196 x^2}{3}+140 x+75$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/27)*(1134*t**2-6552*t+9509)**2\nx_t = 27*t**2-156*t+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{43 x^2+11 x-7}{\\pi }$, $q(x) = \\frac{9 x^2+24 x-44}{\\pi }$", + "Output Answer": [ + "$\\frac{52 x^2}{\\pi }+\\frac{35 x}{\\pi }-\\frac{51}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((43*x**2+11*x-7)/pi)\nq = ((9*x**2+24*x-44)/pi)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 2 x^2-6 x-5$, $q(x) = -11 x^2-10 x-9$", + "Output Answer": [ + "$-9 x^2-16 x-14$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*x**2-6*x-5\nq = -11*x**2-10*x-9\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x-4$ and $4-2 x$.", + "Output Answer": [ + "$2 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x-4, 4-2*x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^4+x^3+5 x^2-2 x+2$ and $3 x^4+x^3+5 x^2-2 x+2$.", + "Output Answer": [ + "$3 x^4+x^3+5 x^2-2 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**4+x**3+5*x**2-2*x+2, 3*x**4+x**3+5*x**2-2*x+2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\tan ^{-1}\\left(\\frac{13}{2}-\\frac{15 x}{2}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{13}{15}-\\frac{2 \\tan (y)}{15}\\text{ if }-\\frac{\\pi }{2} 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$\\frac{3245}{58}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(38/29) # initial value\nd = (25/4) # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(38/29) # initial value\nd = (25/4) # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=4-7 i$ and $y=-7$", + "Output Answer": [ + "$-\\frac{4}{7}+i$" + ], + "Output Program": [ + "i = 1j\nx = 4-7*i\ny = -7\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{((18-25)+21)-24}{8-17}$.", + "Output Answer": [ + "$\\frac{10}{9}$" + ], + "Output Program": [ + "try: \n print(((((18-25)+21)-24)/(8-17)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-9 x-10 y^2+7 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x-\\frac{3}{4}\\right)^2-10 \\left(y-\\frac{7}{20}\\right)^2=\\frac{103}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{60} \\left(45-4 \\sqrt{309}\\right) & \\frac{7}{20} \\\\\n \\frac{1}{60} \\left(45+4 \\sqrt{309}\\right) & \\frac{7}{20} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{2}{5}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{60} \\left(45-4 \\sqrt{309}\\right)+\\frac{1}{60} \\left(45+4 \\sqrt{309}\\right)\\right),\\frac{7}{20}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{3}{5}} x+\\frac{1}{20} \\left(7-3 \\sqrt{15}\\right),y=\\frac{1}{20} \\left(7+3 \\sqrt{15}\\right)-\\sqrt{\\frac{3}{5}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-9*x-10*y**2+7*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-8 x^2-2 x+9 y^2-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 y^2-8 \\left(x+\\frac{1}{8}\\right)^2=\\frac{47}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{8} & -\\frac{\\sqrt{799}}{24} \\\\\n -\\frac{1}{8} & \\frac{\\sqrt{799}}{24} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{17}{2}}}{2}$\nCenter: $\\left\\{-\\frac{1}{8},0\\right\\}$\nAsymptotes: $\\left\\{y=-\\frac{2 \\sqrt{2} x}{3}-\\frac{1}{6 \\sqrt{2}},y=\\frac{2 \\sqrt{2} x}{3}+\\frac{1}{6 \\sqrt{2}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-8*x**2-2*x+9*y**2-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $7 \\sqrt{2} \\left(-\\cos \\left(\\frac{\\pi }{18}\\right)+i \\sin \\left(\\frac{\\pi }{18}\\right)\\right)$.", + "Output Answer": [ + "Norm: $7 \\sqrt{2 \\left(\\sin ^2\\left(\\frac{\\pi }{18}\\right)+\\cos ^2\\left(\\frac{\\pi }{18}\\right)\\right)}$\nArgument: $\\frac{17 \\pi }{18}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 7*math.sqrt(2)*(-math.cos((math.pi/18))+i*math.sin((math.pi/18)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 2 (x+2)^2, q(x) = 2 (6-5 x)^2$", + "Output Answer": [ + "$52 x^2-112 x+80$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 2*(x+2)**2\nq = 2*(6-5*x)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{31}{21}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{341}{21}$" + ], + "Output Program": [ + "a = (31/21) # initial value\nd = 0 # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (31/21) # initial value\nd = 0 # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $12 x^2+24 \\sqrt{5} x-180$", + "Output Answer": [ + "$12 \\left(x-\\sqrt{5}\\right) \\left(x+3 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(12*x**2+24*sqrt(5)*x-180, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-13 x-4}+\\sqrt{\\frac{32}{3}-\\frac{8 x}{3}}=\\frac{41}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-83099+164 \\sqrt{162366}}{2883}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-13*x-4)+sqrt((32/3)-((8*x)/3)), (41/3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2+\\frac{100 x}{\\sqrt{3}}+115$", + "Output Answer": [ + "$-5 \\left(x-\\frac{23}{\\sqrt{3}}\\right) \\left(x+\\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2+((100*x)/(sqrt(3)))+115, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-11 \\sqrt{5} x-4 \\sqrt{5} y-9 \\sqrt{5} z+\\sqrt{5}=0$, $10 \\sqrt{5} x+7 \\sqrt{5} y+9 \\sqrt{5} z+5 \\sqrt{5}=0$, $-4 \\sqrt{5} x-7 \\sqrt{5} y-2 \\sqrt{5} z-6 \\sqrt{5}=0$", + "Output Answer": [ + "$x=\\frac{162}{97}$, $y=-\\frac{140}{97}$, $z=-\\frac{125}{97}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-11*sqrt(5)*x-4*sqrt(5)*y-9*sqrt(5)*z+sqrt(5), 10*sqrt(5)*x+7*sqrt(5)*y+9*sqrt(5)*z+5*sqrt(5), -4*sqrt(5)*x-7*sqrt(5)*y-2*sqrt(5)*z-6*sqrt(5))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (6, 9, 6)$", + "Output Answer": [ + "$\\left\\{3 \\sqrt{17},\\tan ^{-1}\\left(\\frac{\\sqrt{13}}{2}\\right),\\tan ^{-1}\\left(\\frac{3}{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 6\ny = 9\nz = 6\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-6 x^2+5 x+6 y^2+y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y+\\frac{1}{12}\\right)^2-6 \\left(x-\\frac{5}{12}\\right)^2=4$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{12} & -\\frac{1}{12}-\\frac{2}{\\sqrt{3}} \\\\\n \\frac{5}{12} & \\frac{2}{\\sqrt{3}}-\\frac{1}{12} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{5}{12},-\\frac{1}{12}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{3}-x,y=x-\\frac{1}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-6*x**2+5*x+6*y**2+y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{7 x}{\\sqrt{3}}-6 \\sqrt{3} y-\\frac{11}{\\sqrt{3}}=0$, $14 \\sqrt{3} x+\\frac{4 y}{\\sqrt{3}}-4 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{5}{14}$, $y=-\\frac{3}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((7*x)/(sqrt(3)))-6*sqrt(3)*y-(11/(sqrt(3))), 14*sqrt(3)*x+((4*y)/(sqrt(3)))-4*sqrt(3)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-3 x^2+25 x-18}{24 x-23}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(25-\\sqrt{409}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(25+\\sqrt{409}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-3*x**2+25*x-18)/(24*x-23)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\frac{1053 t^2}{8}+\\frac{1755 t}{2}-1471, x(t)=\\frac{81 t^2}{4}-135 t+225$", + "Output Answer": [ + "$y=-\\frac{13 x}{2}-\\frac{17}{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -((1053*t**2)/8)+((1755*t)/2)-1471\nx_t = ((81*t**2)/4)-135*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{160}-\\sqrt{62}\\right)+113$.", + "Output Answer": [ + "$113+4 \\sqrt{10}-\\sqrt{62}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(160)-sqrt(62))+113)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{166}-\\sqrt{73}\\right)+\\left(\\sqrt{76}-\\sqrt{56}\\right)$.", + "Output Answer": [ + "$-2 \\sqrt{14}+2 \\sqrt{19}-\\sqrt{73}+\\sqrt{166}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(166)-sqrt(73))+(sqrt(76)-sqrt(56)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-3 x-6 y^2+7 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(x-\\frac{3}{16}\\right)^2-6 \\left(y-\\frac{7}{12}\\right)^2=\\frac{599}{96}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{48} \\left(9-\\sqrt{4193}\\right) & \\frac{7}{12} \\\\\n \\frac{1}{48} \\left(9+\\sqrt{4193}\\right) & \\frac{7}{12} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{48} \\left(9-\\sqrt{4193}\\right)+\\frac{1}{48} \\left(9+\\sqrt{4193}\\right)\\right),\\frac{7}{12}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2 x}{\\sqrt{3}}+\\frac{1}{24} \\left(14-3 \\sqrt{3}\\right),y=\\frac{1}{24} \\left(14+3 \\sqrt{3}\\right)-\\frac{2 x}{\\sqrt{3}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-3*x-6*y**2+7*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{21 \\left(-\\cos \\left(\\frac{13 \\pi }{90}\\right)+i \\sin \\left(\\frac{13 \\pi }{90}\\right)\\right)}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{21 \\sqrt{\\sin ^2\\left(\\frac{13 \\pi }{90}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{90}\\right)}}{\\pi }$\nArgument: $-\\frac{13 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((21*(-math.cos(((13*math.pi)/90))+i*math.sin(((13*math.pi)/90))))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$\\sqrt[3]{\\frac{5}{2}} \\sqrt[3]{x}+1$", + "Output Answer": [ + "$\\frac{6 \\left(x-\\sqrt[3]{5}-1\\right)^2}{5^{2/3}}+\\frac{6 \\left(x-\\sqrt[3]{5}-1\\right)}{\\sqrt[3]{5}}+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, cbrt(5/2)*cbrt(x)+1)\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $3 x^2-66 x+288$", + "Output Answer": [ + "$-3 (16-x) (x-6)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(3*x**2-66*x+288, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=576 t^2+32 \\left(117+2 \\sqrt{3}\\right) t+208 \\sqrt{3}+\\frac{18268}{3}, x(t)=-\\frac{8 t}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=27 x^2-24 x+\\frac{16}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 576*t**2+32*(117+2*sqrt(3))*t+208*sqrt(3)+(18268/3)\nx_t = -((8*t)/(sqrt(3)))-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\tan ^{-1}(9 x+7)$ at the point $x=-5$", + "Output Answer": [ + "$\\tan ^{-1}(38) = 1.544$" + ], + "Output Program": [ + "import math\n\nx = -5\ntry: \n f = -math.atan(9*x+7)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-7 x^2-3 x+10 y^2+9 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $10 \\left(y+\\frac{9}{20}\\right)^2-7 \\left(x+\\frac{3}{14}\\right)^2=\\frac{1877}{280}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{14} & \\frac{1}{140} \\left(-63-\\sqrt{31909}\\right) \\\\\n -\\frac{3}{14} & \\frac{1}{140} \\left(\\sqrt{31909}-63\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{17}{7}}$\nCenter: $\\left\\{-\\frac{3}{14},\\frac{1}{2} \\left(\\frac{1}{140} \\left(-63-\\sqrt{31909}\\right)+\\frac{1}{140} \\left(\\sqrt{31909}-63\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\sqrt{\\frac{7}{10}} x-\\frac{3}{140} \\left(21+\\sqrt{70}\\right),y=\\sqrt{\\frac{7}{10}} x+\\frac{3}{140} \\left(\\sqrt{70}-21\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-7*x**2-3*x+10*y**2+9*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{24}{5} \\left(\\sin \\left(\\frac{7 \\pi }{45}\\right)-i \\cos \\left(\\frac{7 \\pi }{45}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$\\frac{331776}{625} \\left(-\\sin \\left(\\frac{11 \\pi }{90}\\right)+i \\cos \\left(\\frac{11 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(24/5)*(math.sin(((7*math.pi)/45))-1j*math.cos(((7*math.pi)/45))))**4)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 8 x^2-10 x+15$ and $q(x) = -9 x^2+8 x-12$", + "Output Answer": [ + "$-72 x^4+154 x^3-311 x^2+240 x-180$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 8*x**2-10*x+15\nq = -9*x**2+8*x-12\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x+2$ and $5 x^3-2 x^2-5 x$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x+2, 5*x**3-2*x**2-5*x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-9 x^2-27 x+2430$", + "Output Answer": [ + "$9 (15-x) (x+18)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-9*x**2-27*x+2430, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^3-2 x^2-6 x+4$ and $3 x-2$.", + "Output Answer": [ + "$3 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**3-2*x**2-6*x+4, 3*x-2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-5 \\sqrt{3} x+\\sqrt{3} y+9 \\sqrt{3}=0$, $2 \\sqrt{3} x-9 \\sqrt{3} y+12 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{93}{43}$, $y=\\frac{78}{43}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-5*sqrt(3)*x+sqrt(3)*y+9*sqrt(3), 2*sqrt(3)*x-9*sqrt(3)*y+12*sqrt(3)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 13 x^2-8 x-7$ and $q(x) = -5 x^2-13 x+15$", + "Output Answer": [ + "$-65 x^4-129 x^3+334 x^2-29 x-105$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 13*x**2-8*x-7\nq = -5*x**2-13*x+15\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$15 x+20 y+z-2=0$, $24 x+y-5 z-3=0$, $18 x+25 y-2 z+2=0$", + "Output Answer": [ + "$x=\\frac{643}{1587}$, $y=-\\frac{142}{529}$, $z=\\frac{683}{529}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((15*x+20*y+z-2, 24*x+y-5*z-3, 18*x+25*y-2*z+2)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -10 x^2-12 x+10\\right| =14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(-3-\\sqrt{69}\\right)\\right\\},\\left\\{x\\to \\frac{1}{5} \\left(-3+\\sqrt{69}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-10*x**2-12*x+10), 14), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2-2 x+8 y^2+y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $7 \\left(x-\\frac{1}{7}\\right)^2+8 \\left(y+\\frac{1}{16}\\right)^2=\\frac{1159}{224}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{7}-\\frac{\\sqrt{1159}}{112} & -\\frac{1}{16} \\\\\n \\frac{1}{112} \\left(16+\\sqrt{1159}\\right) & -\\frac{1}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{2 \\sqrt{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{7}-\\frac{\\sqrt{1159}}{112}+\\frac{1}{112} \\left(16+\\sqrt{1159}\\right)\\right),-\\frac{1}{16}\\right\\}$\nArea Enclosed: $\\frac{1159 \\pi }{448 \\sqrt{14}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2-2*x+8*y**2+y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{1}{256} \\left(675 t^2-2700 t+2648\\right)^2, x(t)=\\frac{225 t^2}{4}-225 t+225$", + "Output Answer": [ + "$y=\\frac{9 x^2}{16}-\\frac{39 x}{8}+\\frac{169}{16}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (1/256)*(675*t**2-2700*t+2648)**2\nx_t = ((225*t**2)/4)-225*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -8 x^2-\\frac{5 x}{2}+7\\right| =14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{32} \\left(-5-\\sqrt{2713}\\right)\\right\\},\\left\\{x\\to \\frac{1}{32} \\left(-5+\\sqrt{2713}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-8*x**2-((5*x)/2)+7), 14), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-8 x^5+4 x^4+8 x^3+16 x^2-16 x-8$ and $2 x^5-x^4-2 x^3-4 x^2+4 x+2$.", + "Output Answer": [ + "$2 x^5-x^4-2 x^3-4 x^2+4 x+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-8*x**5+4*x**4+8*x**3+16*x**2-16*x-8, 2*x**5-x**4-2*x**3-4*x**2+4*x+2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $7 \\left(\\frac{1}{4}-\\frac{\\sqrt{5}}{4}+i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)$.", + "Output Answer": [ + "Norm: $7 \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}+\\left(\\frac{1}{4}-\\frac{\\sqrt{5}}{4}\\right)^2}$\nArgument: $\\pi +\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}}{\\frac{1}{4}-\\frac{\\sqrt{5}}{4}}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 7*((1/4)-((math.sqrt(5))/4)+i*math.sqrt((5/8)+((math.sqrt(5))/8)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-300 x^3-370 x^2+170 x+225}{300 x+250}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(-2-\\sqrt{94}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(-2+\\sqrt{94}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-300*x**3-370*x**2+170*x+225)/(300*x+250)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{84 x^2+342 x+330}{108 x^2+414 x+360}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{11}{7}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((84*x**2+342*x+330)/(108*x**2+414*x+360)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2-\\frac{44 x}{3}}+\\sqrt{-\\frac{23 x}{3}-14}=\\frac{31}{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{-61363+62 \\sqrt{847414}}{1323}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2-((44*x)/3))+sqrt(-((23*x)/3)-14), (31/3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{23}{45}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$-\\frac{322}{45}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(23/45) # initial value\nd = 0 # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(23/45) # initial value\nd = 0 # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{12-14 x}+\\sqrt{10-\\frac{19 x}{2}}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{81} \\left(-5980+64 \\sqrt{8629}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(12-14*x)+sqrt(10-((19*x)/2)), 8), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^4-6 x^3-10 x^2-4 x+7$ when divided by $3 x^3+4 x^2-7 x+9$.", + "Output Answer": [ + "$\\frac{5 x}{3}-\\frac{38}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**4-6*x**3-10*x**2-4*x+7\nq = 3*x**3+4*x**2-7*x+9\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 \\sqrt{5} x^2-2 \\sqrt{5} x$ and $q(x) = -\\sqrt{5} x^2+3 \\sqrt{5} x+6 \\sqrt{5}$", + "Output Answer": [ + "$-10 x^4+40 x^3+30 x^2-60 x$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*sqrt(5)*x**2-2*sqrt(5)*x\nq = -sqrt(5)*x**2+3*sqrt(5)*x+6*sqrt(5)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{14 x^4}{3}+\\frac{25 x^3}{3}+\\frac{25 x^2}{3}+\\frac{20 x}{3}-7$ when divided by $4 x^2-\\frac{20 x}{3}-2$.", + "Output Answer": [ + "$\\frac{7 x^2}{6}+\\frac{145 x}{36}+\\frac{1013}{108}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((14*x**4)/3)+((25*x**3)/3)+((25*x**2)/3)+((20*x)/3)-7\nq = 4*x**2-((20*x)/3)-2\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 6-\\frac{11 x}{4}, q(x) = \\frac{1}{64} (16 x-21)^3$", + "Output Answer": [ + "$64 x^3-252 x^2+328 x-\\frac{8877}{64}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6-((11*x)/4)\nq = (1/64)*(16*x-21)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x-3}+\\sqrt{3 x+4}=15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to 2 \\left(559-15 \\sqrt{1333}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x-3)+sqrt(3*x+4), 15), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+7 y^2-6 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $3 x^2+7 \\left(y-\\frac{3}{7}\\right)^2=\\frac{37}{7}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{2 \\sqrt{\\frac{37}{3}}}{7} & \\frac{3}{7} \\\\\n \\frac{2 \\sqrt{\\frac{37}{3}}}{7} & \\frac{3}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{7}}$\nCenter: $\\left\\{0,\\frac{3}{7}\\right\\}$\nArea Enclosed: $\\frac{37 \\pi }{7 \\sqrt{21}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+7*y**2-6*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{17}{19}$, and $a_n=a_{n-1}+\\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$9 \\left(\\frac{34}{19}+17 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (17/19) # initial value\nd = math.pi # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (17/19) # initial value\nd = math.pi # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+7 x-6 y^2-6 y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x+\\frac{7}{6}\\right)^2-6 \\left(y+\\frac{1}{2}\\right)^2=\\frac{151}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{12} \\left(-14-\\sqrt{906}\\right) & -\\frac{1}{2} \\\\\n \\frac{1}{12} \\left(\\sqrt{906}-14\\right) & -\\frac{1}{2} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{2}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{12} \\left(-14-\\sqrt{906}\\right)+\\frac{1}{12} \\left(\\sqrt{906}-14\\right)\\right),-\\frac{1}{2}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{\\sqrt{2}}+\\frac{1}{12} \\left(7 \\sqrt{2}-6\\right),y=\\frac{1}{12} \\left(-6-7 \\sqrt{2}\\right)-\\frac{x}{\\sqrt{2}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+7*x-6*y**2-6*y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 x^2-9 x+7$ and $q(x) = 11-7 x^2$", + "Output Answer": [ + "$-35 x^4+63 x^3+6 x^2-99 x+77$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*x**2-9*x+7\nq = 11-7*x**2\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-15 x-6}+\\sqrt{9-6 x}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{27} \\left(-892+22 \\sqrt{1381}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-15*x-6)+sqrt(9-6*x), 11), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{6 x^2}{\\pi }-\\frac{3 x}{\\pi }+\\frac{28}{\\pi }$ and $q(x) = \\frac{8 x^2}{\\pi }+\\frac{43 x}{\\pi }+\\frac{20}{\\pi }$", + "Output Answer": [ + "$\\frac{48 x^4}{\\pi ^2}+\\frac{234 x^3}{\\pi ^2}+\\frac{215 x^2}{\\pi ^2}+\\frac{1144 x}{\\pi ^2}+\\frac{560}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((6*x**2)/pi)-((3*x)/pi)+(28/pi)\nq = ((8*x**2)/pi)+((43*x)/pi)+(20/pi)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 6 \\sqrt{5} x^2+6 \\sqrt{5} x-2 \\sqrt{5}\\right| =11 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{6} \\left(-3-\\sqrt{87}\\right)\\right\\},\\left\\{x\\to \\frac{1}{6} \\left(-3+\\sqrt{87}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(6*sqrt(5)*x**2+6*sqrt(5)*x-2*sqrt(5)), 11*sqrt(5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{37}{5}+\\frac{26 i}{5}$.", + "Output Answer": [ + "Norm: $\\sqrt{\\frac{409}{5}}$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{26}{37}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(37/5)+((26*i)/5)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 8 x^2+8 x+5$ and $q(x) = 6 x^2-11 x+8$", + "Output Answer": [ + "$48 x^4-40 x^3+6 x^2+9 x+40$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 8*x**2+8*x+5\nq = 6*x**2-11*x+8\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(16-12) \\left(((6+24)-2)^2+19\\right)$.", + "Output Answer": [ + "$3212$" + ], + "Output Program": [ + "try: \n print((16-12)*(((6+24)-2)**2+19))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 8-6 x^2$ and $q(x) = 14 x^2-2 x-13$", + "Output Answer": [ + "$-84 x^4+12 x^3+190 x^2-16 x-104$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 8-6*x**2\nq = 14*x**2-2*x-13\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{21+4}{(13-5)+13}$.", + "Output Answer": [ + "$\\frac{25}{21}$" + ], + "Output Program": [ + "try: \n print(((21+4)/((13-5)+13)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((((2-2)+23)-16)-20) \\left((((22-7)+16)+21)^2+1\\right)$.", + "Output Answer": [ + "$-35165$" + ], + "Output Program": [ + "try: \n print(((((2-2)+23)-16)-20)*((((22-7)+16)+21)**2+1))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{17+13 i}{\\sqrt{\\pi }}$ and $y=-\\frac{2-11 i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{19+2 i}{\\sqrt{\\pi }}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((17+13*i)/(math.sqrt(math.pi)))\ny = -((2-11*i)/(math.sqrt(math.pi)))\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -5 \\sqrt{3} x-14 \\sqrt{3}\\right| =7 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{21}{5}\\right\\},\\left\\{x\\to -\\frac{7}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-5*sqrt(3)*x-14*sqrt(3)), 7*sqrt(3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{2 \\left(9 x^2+7 x+4\\right)}{\\sqrt{3}}$, $q(x) = \\frac{2 \\left(x^2+3 x-5\\right)}{\\sqrt{3}}$", + "Output Answer": [ + "$6 \\sqrt{3} x^2+\\frac{2 x^2}{\\sqrt{3}}+2 \\sqrt{3} x+\\frac{14 x}{\\sqrt{3}}-\\frac{2}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((2*(9*x**2+7*x+4))/(sqrt(3)))\nq = ((2*(x**2+3*x-5))/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-7 x^2+\\frac{13 x}{2}-7$", + "Output Answer": [ + "$x=\\frac{1}{28} \\left(13-i \\sqrt{615}\\right)\\lor x=\\frac{1}{28} \\left(13+i \\sqrt{615}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-7*x**2+((13*x)/2)-7, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2-4 x-9 y^2-4 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x-\\frac{2}{9}\\right)^2-9 \\left(y+\\frac{2}{9}\\right)^2=7$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{9} \\left(2-3 \\sqrt{14}\\right) & -\\frac{2}{9} \\\\\n \\frac{1}{9} \\left(2+3 \\sqrt{14}\\right) & -\\frac{2}{9} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{9} \\left(2-3 \\sqrt{14}\\right)+\\frac{1}{9} \\left(2+3 \\sqrt{14}\\right)\\right),-\\frac{2}{9}\\right\\}$\nAsymptotes: $\\left\\{y=x-\\frac{4}{9},y=-x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2-4*x-9*y**2-4*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{13-11 x}+\\sqrt{2} \\sqrt{-x}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{81} \\left(-91+8 \\sqrt{118}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(13-11*x)+sqrt(2)*sqrt(-x), 4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\frac{1}{\\sqrt{2}}, \\frac{1}{\\sqrt{3}}, \\sqrt{3})$", + "Output Answer": [ + "$\\left\\{\\sqrt{\\frac{23}{6}},\\tan ^{-1}\\left(\\frac{\\sqrt{\\frac{5}{2}}}{3}\\right),\\tan ^{-1}\\left(\\sqrt{\\frac{2}{3}}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = (1/(math.sqrt(2)))\ny = (1/(math.sqrt(3)))\nz = math.sqrt(3)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^3+10 x^2+9 x+6$ when divided by $5 x^3-3 x^2+7 x-8$.", + "Output Answer": [ + "$-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**3+10*x**2+9*x+6\nq = 5*x**3-3*x**2+7*x-8\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{121 t^2+572 t+680}{\\sqrt{3}}, x(t)=\\frac{121 t^2}{3}+\\frac{572 t}{3}+\\frac{676}{3}$", + "Output Answer": [ + "$y=\\sqrt{3} x+\\frac{4}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = ((121*t**2+572*t+680)/(sqrt(3)))\nx_t = ((121*t**2)/3)+((572*t)/3)+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{10}{3} \\left(\\cos \\left(\\frac{17}{90}\\right)+i \\sin \\left(\\frac{17}{90}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$\\frac{1000000000000 \\left(\\cos \\left(\\frac{34}{15}\\right)+i \\sin \\left(\\frac{34}{15}\\right)\\right)}{531441}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(10/3)*(math.cos((17/90))+1j*math.sin((17/90))))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $5 x^2-4 x$ and $-x^5-4 x^4-x^3-3 x^2+2 x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(5*x**2-4*x, -x**5-4*x**4-x**3-3*x**2+2*x-3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+x+3 y^2+4 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x+\\frac{1}{16}\\right)^2+3 \\left(y+\\frac{2}{3}\\right)^2=\\frac{515}{96}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{16} & -\\frac{2}{3}-\\frac{5 \\sqrt{103}}{48} \\\\\n -\\frac{1}{16} & \\frac{5 \\sqrt{103}}{48}-\\frac{2}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{5}{2}}}{2}$\nCenter: $\\left\\{-\\frac{1}{16},-\\frac{2}{3}\\right\\}$\nArea Enclosed: $\\frac{515 \\pi }{192 \\sqrt{6}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+x+3*y**2+4*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 x^2-11 x-12$ and $q(x) = -4 x^2+13 x+13$", + "Output Answer": [ + "$-8 x^4+70 x^3-69 x^2-299 x-156$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*x**2-11*x-12\nq = -4*x**2+13*x+13\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $5-i$.", + "Output Answer": [ + "Norm: $\\sqrt{26}$\nArgument: $-\\tan ^{-1}\\left(\\frac{1}{5}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 5-i\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{((8-1)+17)-7}{((3+13)-1)-9}$.", + "Output Answer": [ + "$\\frac{17}{6}$" + ], + "Output Program": [ + "try: \n print(((((8-1)+17)-7)/(((3+13)-1)-9)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{52 x}{3}+\\frac{55 y}{3}+\\frac{62 z}{3}-13=0$, $-\\frac{65 x}{3}+\\frac{59 y}{3}-\\frac{31 z}{3}+\\frac{23}{3}=0$, $-\\frac{38 x}{3}-\\frac{38 y}{3}+\\frac{11 z}{3}-\\frac{52}{3}=0$", + "Output Answer": [ + "$x=-\\frac{231404}{368751}$, $y=-\\frac{39751}{122917}$, $z=\\frac{531826}{368751}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((52*x)/3)+((55*y)/3)+((62*z)/3)-13, -((65*x)/3)+((59*y)/3)-((31*z)/3)+(23/3), -((38*x)/3)-((38*y)/3)+((11*z)/3)-(52/3))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $2 x^2-9 x+14$", + "Output Answer": [ + "$2 \\left(x-\\frac{9}{4}\\right)^2+\\frac{31}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (2*x**2-9*x+14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2-10 x-2 y^2-9 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(x-\\frac{5}{4}\\right)^2-2 \\left(y+\\frac{9}{4}\\right)^2=-\\frac{71}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{4} & \\frac{1}{8} \\left(-18-\\sqrt{426}\\right) \\\\\n \\frac{5}{4} & \\frac{1}{8} \\left(\\sqrt{426}-18\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{2}}$\nCenter: $\\left\\{\\frac{5}{4},\\frac{1}{2} \\left(\\frac{1}{8} \\left(-18-\\sqrt{426}\\right)+\\frac{1}{8} \\left(\\sqrt{426}-18\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{4} \\left(5 \\sqrt{2}-9\\right)-\\sqrt{2} x,y=\\sqrt{2} x+\\frac{1}{4} \\left(-9-5 \\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2-10*x-2*y**2-9*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $x^2+3 x+4$", + "Output Answer": [ + "$\\left(x+\\frac{3}{2}\\right)^2+\\frac{7}{4}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (x**2+3*x+4), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=1-10 i$ and $y=-6-3 i$", + "Output Answer": [ + "$-36+57 i$" + ], + "Output Program": [ + "i = 1j\nx = 1-10*i\ny = -6-3*i\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2-110 x+1584$", + "Output Answer": [ + "$-11 (x-8) (x+18)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2-110*x+1584, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\log (\\tan (4 x+4))=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{4} \\left(\\pi c_1+\\frac{\\pi }{4}-4\\right)\\text{ if }c_1\\in \\mathbb{Z}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(log(tan(4*x+4)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\pi$ and $y=(2+2 i) \\pi$", + "Output Answer": [ + "$(-2-2 i) \\pi ^2$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -math.pi\ny = (2+2*i)*math.pi\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{17 x+7}{\\sqrt{3}}$, $q(x) = \\frac{7 x^2+22 x-5}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{7 x^2}{\\sqrt{3}}+\\frac{5 x}{\\sqrt{3}}-4 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((17*x+7)/(sqrt(3)))\nq = ((7*x**2+22*x-5)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$10 \\sqrt{3} x+11 \\sqrt{3} y+8 \\sqrt{3} z-5 \\sqrt{3}=0$, $-\\sqrt{3} x+5 \\sqrt{3} y-12 \\sqrt{3} z=0$, $2 \\sqrt{3} x-14 \\sqrt{3} y+9 \\sqrt{3} z+11 \\sqrt{3}=0$", + "Output Answer": [ + "$x=-\\frac{1277}{1363}$, $y=\\frac{1307}{1363}$, $z=\\frac{651}{1363}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((10*sqrt(3)*x+11*sqrt(3)*y+8*sqrt(3)*z-5*sqrt(3), -sqrt(3)*x+5*sqrt(3)*y-12*sqrt(3)*z, 2*sqrt(3)*x-14*sqrt(3)*y+9*sqrt(3)*z+11*sqrt(3))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $14 x^2+7 x-8$", + "Output Answer": [ + "$14 \\left(x+\\frac{1}{4}\\right)^2-\\frac{71}{8}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (14*x**2+7*x-8), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\sqrt{2} \\left(\\cos \\left(\\frac{31}{18}\\right)+i \\sin \\left(\\frac{31}{18}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-4194304 \\sqrt{2} \\left(\\cos \\left(\\frac{31}{2}\\right)+i \\sin \\left(\\frac{31}{2}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*math.sqrt(2)*(math.cos((31/18))+1j*math.sin((31/18))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+3 x-7 y^2+5 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x+\\frac{1}{6}\\right)^2-7 \\left(y-\\frac{5}{14}\\right)^2=\\frac{61}{14}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{42} \\left(-7-4 \\sqrt{122}\\right) & \\frac{5}{14} \\\\\n \\frac{1}{42} \\left(4 \\sqrt{122}-7\\right) & \\frac{5}{14} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{4}{\\sqrt{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{42} \\left(-7-4 \\sqrt{122}\\right)+\\frac{1}{42} \\left(4 \\sqrt{122}-7\\right)\\right),\\frac{5}{14}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3 x}{\\sqrt{7}}+\\frac{1}{14} \\left(5+\\sqrt{7}\\right),y=\\frac{1}{14} \\left(5-\\sqrt{7}\\right)-\\frac{3 x}{\\sqrt{7}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+3*x-7*y**2+5*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left((((3-12)+1)-1)^2+13\\right) \\left(\\left(((7-4)-16)^2-8\\right)^2-9\\right)$.", + "Output Answer": [ + "$2435728$" + ], + "Output Program": [ + "try: \n print(((((3-12)+1)-1)**2+13)*((((7-4)-16)**2-8)**2-9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 10 x^2-23 x+11\\right| =21$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{20} \\left(23-\\sqrt{929}\\right)\\right\\},\\left\\{x\\to \\frac{1}{20} \\left(23+\\sqrt{929}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(10*x**2-23*x+11), 21), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-8 e^{-\\frac{7 i \\pi }{15}}$.", + "Output Answer": [ + "Norm: $8$\nArgument: $\\frac{8 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -8*math.e**(-((7*i*math.pi)/15))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$12 x-8 y-\\frac{17 z}{2}-4=0$, $22 x+4 y+11 z-14=0$, $\\frac{25 x}{2}-\\frac{17 y}{2}+\\frac{7 z}{2}-2=0$", + "Output Answer": [ + "$x=\\frac{3451}{5641}$, $y=\\frac{3359}{5641}$, $z=-\\frac{944}{5641}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((12*x-8*y-((17*z)/2)-4, 22*x+4*y+11*z-14, ((25*x)/2)-((17*y)/2)+((7*z)/2)-2)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{102 x^2}{7}+x+\\frac{44}{7}$", + "Output Answer": [ + "$\\frac{102}{7} \\left(x+\\frac{7}{204}\\right)^2+\\frac{17903}{2856}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((102*x**2)/7)+x+(44/7)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^6-9 x^5+x^4+2 x^3-9 x^2-9 x-3$ when divided by $3$.", + "Output Answer": [ + "$3 x^6-3 x^5+\\frac{x^4}{3}+\\frac{2 x^3}{3}-3 x^2-3 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**6-9*x**5+x**4+2*x**3-9*x**2-9*x-3\nq = 3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(\\cos \\left(\\frac{119}{90}\\right)+i \\sin \\left(\\frac{119}{90}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$243 \\left(\\cos \\left(\\frac{119}{18}\\right)+i \\sin \\left(\\frac{119}{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(math.cos((119/90))+1j*math.sin((119/90))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{81 x^2}{2}, q(x) = 5184 (x-1)^4$", + "Output Answer": [ + "$5184 x^4-20736 x^3+\\frac{62289 x^2}{2}-20736 x+5184$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((81*x**2)/2)\nq = 5184*(x-1)**4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-2 \\left(-\\frac{1}{2}+\\frac{i \\sqrt{3}}{2}\\right)$.", + "Output Answer": [ + "Norm: $2$\nArgument: $-\\frac{\\pi }{3}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -2*(-(1/2)+((i*math.sqrt(3))/2))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\cos ^{-1}\\left(-\\frac{17 x}{2}-\\frac{3}{2}\\right)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{5}{17}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(acos(-((17*x)/2)-(3/2)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(4-3)+\\left(\\frac{24}{12}+21\\right)$.", + "Output Answer": [ + "$24$" + ], + "Output Program": [ + "try: \n print((4-3)+((24/12)+21))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $10 x^3-50 x^2-610 x-550$", + "Output Answer": [ + "$10 (-x-5) (-x-1) (x-11)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(10*x**3-50*x**2-610*x-550, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 \\sqrt{3} x^2-6 \\sqrt{3} x-6 \\sqrt{3}$", + "Output Answer": [ + "$x=-\\sqrt[3]{-1}\\lor x=(-1)^{2/3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*sqrt(3)*x**2-6*sqrt(3)*x-6*sqrt(3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (7, 2, 7)$", + "Output Answer": [ + "$\\left\\{\\sqrt{102},\\tan ^{-1}\\left(\\frac{\\sqrt{53}}{7}\\right),\\tan ^{-1}\\left(\\frac{2}{7}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 7\ny = 2\nz = 7\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$16 x+19 y+15=0$, $18 y-2 x=0$", + "Output Answer": [ + "$x=-\\frac{135}{163}$, $y=-\\frac{15}{163}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((16*x+19*y+15, 18*y-2*x), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{10 x-\\frac{17}{2}}+\\sqrt{\\frac{21 x}{2}+7}=\\frac{11}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(4899-22 \\sqrt{49546}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(10*x-(17/2))+sqrt(((21*x)/2)+7), (11/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -6 \\sqrt{5} x^2+3 \\sqrt{5} x-4 \\sqrt{5}\\right| =7 \\sqrt{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{2}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-6*sqrt(5)*x**2+3*sqrt(5)*x-4*sqrt(5)), 7*sqrt(5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((7+9)-3)+2)^2 ((4-16)-10)$.", + "Output Answer": [ + "$-4950$" + ], + "Output Program": [ + "try: \n print((((7+9)-3)+2)**2*((4-16)-10))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (3 x+7)^3, q(x) = (5 x+6)^4$", + "Output Answer": [ + "$625 x^4+3027 x^3+5589 x^2+4761 x+1639$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (3*x+7)**3\nq = (5*x+6)**4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\sqrt{2} \\left(\\cos \\left(\\frac{8 \\pi }{45}\\right)-i \\sin \\left(\\frac{8 \\pi }{45}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$26873856 \\left(-\\sin \\left(\\frac{7 \\pi }{90}\\right)+i \\cos \\left(\\frac{7 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*math.sqrt(2)*(math.cos(((8*math.pi)/45))-1j*math.sin(((8*math.pi)/45))))**8)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\frac{23-17}{3}+23}{\\frac{1}{10} \\left(\\left((2-19)^2+3\\right)+10\\right)}$.", + "Output Answer": [ + "$\\frac{125}{151}$" + ], + "Output Program": [ + "try: \n print(((((23-17)/3)+23)/((1/10)*(((2-19)**2+3)+10))))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^5-\\frac{37 x^4}{5}-\\frac{2 x^3}{5}-7 x^2+\\frac{2 x}{5}-\\frac{41}{5}$ when divided by $-\\frac{19 x^4}{5}-\\frac{39 x^3}{5}+9 x^2-\\frac{32 x}{5}-9$.", + "Output Answer": [ + "$\\frac{2068}{361}-\\frac{35 x}{19}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**5-((37*x**4)/5)-((2*x**3)/5)-7*x**2+((2*x)/5)-(41/5)\nq = -((19*x**4)/5)-((39*x**3)/5)+9*x**2-((32*x)/5)-9\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{935 x^3}{49}-\\frac{3323 x^2}{49}-\\frac{1510 x}{49}-\\frac{106}{7}}{\\frac{527 x}{49}+\\frac{1643}{49}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((935*x**3)/49)-((3323*x**2)/49)-((1510*x)/49)-(106/7))/(((527*x)/49)+(1643/49))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{16 x^2+x+8}{\\sqrt{3}}$, $q(x) = \\frac{9 x^2+22 x-5}{\\sqrt{3}}$", + "Output Answer": [ + "$3 \\sqrt{3} x^2-\\frac{16 x^2}{\\sqrt{3}}+7 \\sqrt{3} x-\\frac{13}{\\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((16*x**2+x+8)/(sqrt(3)))\nq = ((9*x**2+22*x-5)/(sqrt(3)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\cos \\left(\\frac{5}{3}-\\frac{7 x^4}{3}\\right)$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = cos((5/3)-((7*x**4)/3))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $11 x^2-12 x+7$", + "Output Answer": [ + "$x=\\frac{1}{11} \\left(6-i \\sqrt{41}\\right)\\lor x=\\frac{1}{11} \\left(6+i \\sqrt{41}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(11*x**2-12*x+7, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2+\\frac{243 x}{4}-204$", + "Output Answer": [ + "$-3 \\left(\\frac{17}{4}-x\\right) (16-x)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2+((243*x)/4)-204, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-5 \\sqrt{2} e^{-\\frac{9 i \\pi }{20}}$.", + "Output Answer": [ + "Norm: $5 \\sqrt{2}$\nArgument: $\\frac{11 \\pi }{20}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -5*math.sqrt(2)*math.e**(-((9*i*math.pi)/20))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x-1$ and $-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x-1, -3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\log (-7 x-4)+\\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(-e^{y-\\sqrt{3}}-4\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, log(-7*x-4)+sqrt(3))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -14 x^2+14 x+10\\right| =14$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{14} \\left(7-\\sqrt{385}\\right)\\right\\},\\left\\{x\\to \\frac{1}{14} \\left(7+\\sqrt{385}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-14*x**2+14*x+10), 14), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\cos ^{-1}\\left(-\\frac{16 x}{3}-\\frac{5}{3}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{16} (-3 \\cos (y)-5)\\text{ if }0\\leq y\\leq \\pi $}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, acos(-((16*x)/3)-(5/3)))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-6 \\left(\\left(-\\frac{1}{2}+\\frac{i}{2}\\right) \\sqrt{\\frac{3}{2}}-\\frac{\\frac{1}{2}+\\frac{i}{2}}{\\sqrt{2}}\\right)$.", + "Output Answer": [ + "Norm: $6 \\sqrt{\\left(-\\frac{\\sqrt{\\frac{3}{2}}}{2}-\\frac{1}{2 \\sqrt{2}}\\right)^2+\\left(\\frac{\\sqrt{\\frac{3}{2}}}{2}-\\frac{1}{2 \\sqrt{2}}\\right)^2}$\nArgument: $\\tan ^{-1}\\left(\\frac{\\frac{1}{2 \\sqrt{2}}-\\frac{\\sqrt{\\frac{3}{2}}}{2}}{\\frac{\\sqrt{\\frac{3}{2}}}{2}+\\frac{1}{2 \\sqrt{2}}}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -6*((-(1/2)+(i/2))*math.sqrt((3/2))-(((1/2)+(i/2))/(math.sqrt(2))))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=\\frac{11}{2}-2 i$ and $y=-\\frac{13}{2}-\\frac{25 i}{4}$", + "Output Answer": [ + "$-\\frac{372}{1301}+\\frac{758 i}{1301}$" + ], + "Output Program": [ + "i = 1j\nx = (11/2)-2*i\ny = -(13/2)-((25*i)/4)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\left(\\frac{23-10}{21}-18\\right)+4}{(23+12)+3}$.", + "Output Answer": [ + "$-\\frac{281}{798}$" + ], + "Output Program": [ + "try: \n print((((((23-10)/21)-18)+4)/((23+12)+3)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $10 \\sqrt{2} x^2-4 \\sqrt{2} x-5 \\sqrt{2}$", + "Output Answer": [ + "$x=\\frac{1}{10} \\left(2-3 \\sqrt{6}\\right)\\lor x=\\frac{1}{10} \\left(2+3 \\sqrt{6}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(10*sqrt(2)*x**2-4*sqrt(2)*x-5*sqrt(2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{192 x^3+472 x^2+18 x-112}{-336 x^2-364 x-98}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(-15-\\sqrt{481}\\right)\\right\\},\\left\\{x\\to \\frac{1}{16} \\left(-15+\\sqrt{481}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((192*x**3+472*x**2+18*x-112)/(-336*x**2-364*x-98)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-12 x^2-6 x+1}{-14 x^2+2 x+5}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{12} \\left(-3-\\sqrt{21}\\right)\\right\\},\\left\\{x\\to \\frac{1}{12} \\left(-3+\\sqrt{21}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-12*x**2-6*x+1)/(-14*x**2+2*x+5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $x^5+4 x^4-7 x^3+4 x^2-2 x+1$ when divided by $-3 x^3+7 x^2-2 x+3$.", + "Output Answer": [ + "$-\\frac{x^2}{3}-\\frac{19 x}{9}-\\frac{64}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**5+4*x**4-7*x**3+4*x**2-2*x+1\nq = -3*x**3+7*x**2-2*x+3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 4-24 x| =6$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{12}\\right\\},\\left\\{x\\to \\frac{5}{12}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(4-24*x), 6), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-5 \\sqrt{2} x^2-\\frac{9 x}{\\sqrt{2}}+\\frac{11}{\\sqrt{2}}$", + "Output Answer": [ + "$\\frac{521}{40 \\sqrt{2}}-5 \\sqrt{2} \\left(x+\\frac{9}{20}\\right)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-5*math.sqrt(2)*x**2-((9*x)/(math.sqrt(2)))+(11/(math.sqrt(2)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\sin \\left(\\frac{2 \\pi }{9}\\right)-i \\cos \\left(\\frac{2 \\pi }{9}\\right)\\right)^2$", + "Output Answer": [ + "$-\\sin \\left(\\frac{\\pi }{18}\\right)-i \\cos \\left(\\frac{\\pi }{18}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((math.sin(((2*math.pi)/9))-1j*math.cos(((2*math.pi)/9)))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 i \\sqrt{3}\\right)^11$", + "Output Answer": [ + "$497664 i \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*1j*math.sqrt(3))**11)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-9+i$ and $y=6+10 i$", + "Output Answer": [ + "$-15-9 i$" + ], + "Output Program": [ + "i = 1j\nx = -9+i\ny = 6+10*i\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sqrt{\\frac{13 x}{2}-9}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{13} \\left(2 y^2+18\\right)\\text{ if }y>0$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, sqrt(((13*x)/2)-9))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$10 \\sqrt{5} x+7 \\sqrt{5} y+9 \\sqrt{5} z-5 \\sqrt{5}=0$, $-7 \\sqrt{5} x-5 \\sqrt{5} y-4 \\sqrt{5} z+4 \\sqrt{5}=0$, $6 \\sqrt{5} x-6 \\sqrt{5} y+\\sqrt{5} z+10 \\sqrt{5}=0$", + "Output Answer": [ + "$x=-\\frac{71}{239}$, $y=\\frac{321}{239}$, $z=-\\frac{38}{239}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((10*sqrt(5)*x+7*sqrt(5)*y+9*sqrt(5)*z-5*sqrt(5), -7*sqrt(5)*x-5*sqrt(5)*y-4*sqrt(5)*z+4*sqrt(5), 6*sqrt(5)*x-6*sqrt(5)*y+sqrt(5)*z+10*sqrt(5))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{7 x^2}{\\sqrt{2}}-\\frac{x}{\\sqrt{2}}+4 \\sqrt{2}$ and $q(x) = -\\frac{7 x^2}{\\sqrt{2}}-\\frac{7 x}{\\sqrt{2}}-5 \\sqrt{2}$", + "Output Answer": [ + "$-\\frac{49 x^4}{2}-21 x^3-\\frac{119 x^2}{2}-23 x-40$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((7*x**2)/(sqrt(2)))-(x/(sqrt(2)))+4*sqrt(2)\nq = -((7*x**2)/(sqrt(2)))-((7*x)/(sqrt(2)))-5*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=72 t-114, x(t)=9 t-15$", + "Output Answer": [ + "$y=8 x+6$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 72*t-114\nx_t = 9*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6-14 x}+\\sqrt{9-11 x}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-4234+26 \\sqrt{26206}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6-14*x)+sqrt(9-11*x), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\sqrt{5} x^2+7 \\sqrt{5} x-6 \\sqrt{5}$ and $q(x) = -6 \\sqrt{5} x^2-\\sqrt{5} x-6 \\sqrt{5}$", + "Output Answer": [ + "$30 x^4-205 x^3+175 x^2-180 x+180$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -sqrt(5)*x**2+7*sqrt(5)*x-6*sqrt(5)\nq = -6*sqrt(5)*x**2-sqrt(5)*x-6*sqrt(5)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4$ and $3 x^5+4 x^4-4 x^3+4 x^2-3 x+4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4, 3*x**5+4*x**4-4*x**3+4*x**2-3*x+4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=8-4 i$ and $y=9+6 i$", + "Output Answer": [ + "$\\frac{16}{39}-\\frac{28 i}{39}$" + ], + "Output Program": [ + "i = 1j\nx = 8-4*i\ny = 9+6*i\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{80}{7}-\\frac{94 x}{7}}+\\sqrt{-\\frac{30 x}{7}-\\frac{55}{7}}=\\frac{48}{7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{448} \\left(-3519+12 \\sqrt{48530}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((80/7)-((94*x)/7))+sqrt(-((30*x)/7)-(55/7)), (48/7)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -16 \\sqrt{2} x^2-2 \\sqrt{2} x-2 \\sqrt{2}\\right| =\\sqrt{2}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-16*sqrt(2)*x**2-2*sqrt(2)*x-2*sqrt(2)), sqrt(2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{144 x^7}{25}+\\frac{654 x^6}{25}+\\frac{72 x^5}{5}+\\frac{56 x^4}{25}-\\frac{488 x^3}{25}-\\frac{656 x^2}{25}-\\frac{382 x}{25}-\\frac{368}{25}$ and $\\frac{6 x^5}{5}+\\frac{22 x^4}{5}-2 x^3-2 x^2-\\frac{2 x}{5}-\\frac{16}{5}$.", + "Output Answer": [ + "$\\frac{6 x^5}{25}+\\frac{22 x^4}{25}-\\frac{2 x^3}{5}-\\frac{2 x^2}{5}-\\frac{2 x}{25}-\\frac{16}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((144*x**7)/25)+((654*x**6)/25)+((72*x**5)/5)+((56*x**4)/25)-((488*x**3)/25)-((656*x**2)/25)-((382*x)/25)-(368/25), ((6*x**5)/5)+((22*x**4)/5)-2*x**3-2*x**2-((2*x)/5)-(16/5)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{46}{27}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$-\\frac{23030}{9}$" + ], + "Output Program": [ + "a = (46/27) # initial value\nd = -6 # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (46/27) # initial value\nd = -6 # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{143 t}{3}-4 \\sqrt{3}+\\frac{286}{3}, x(t)=-\\frac{13 t}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}$", + "Output Answer": [ + "$y=-\\frac{11 x}{\\sqrt{3}}-4 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = ((143*t)/3)-4*sqrt(3)+(286/3)\nx_t = -((13*t)/(sqrt(3)))-(26/(sqrt(3)))\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $5 x^2-4 x-7$", + "Output Answer": [ + "$5 \\left(x-\\frac{2}{5}\\right)^2-\\frac{39}{5}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (5*x**2-4*x-7), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $9 x^2+10 x-14$", + "Output Answer": [ + "$9 \\left(x+\\frac{5}{9}\\right)^2-\\frac{151}{9}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (9*x**2+10*x-14), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-8 \\sqrt{2} x^2-8 \\sqrt{2} x-10 \\sqrt{2}$", + "Output Answer": [ + "$-8 \\sqrt{2} \\left(x+\\frac{1}{2}\\right)^2-8 \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-8*math.sqrt(2)*x**2-8*math.sqrt(2)*x-10*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((3-16)-10) (14+5)$.", + "Output Answer": [ + "$-437$" + ], + "Output Program": [ + "try: \n print(((3-16)-10)*(14+5))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $7 x^3-21 x^2-2247 x+2261$", + "Output Answer": [ + "$-7 (1-x) (x-19) (x+17)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(7*x**3-21*x**2-2247*x+2261, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $x^2+8 x+3 y^2-7 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $(x+4)^2+3 \\left(y-\\frac{7}{6}\\right)^2=\\frac{289}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n -4-\\frac{17}{3 \\sqrt{2}} & \\frac{7}{6} \\\\\n \\frac{17}{3 \\sqrt{2}}-4 & \\frac{7}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{3}}$\nCenter: $\\left\\{-4,\\frac{7}{6}\\right\\}$\nArea Enclosed: $\\frac{289 \\pi }{12 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2+8*x+3*y**2-7*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{29}{13}$, and $a_n=a_{n-1}+-3 \\pi$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$9 \\left(-\\frac{58}{13}-51 \\pi \\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(29/13) # initial value\nd = -3*math.pi # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(29/13) # initial value\nd = -3*math.pi # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -\\frac{35 x}{\\sqrt{3}}-\\frac{28}{\\sqrt{3}}\\right| =\\frac{29}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{57}{35}\\right\\},\\left\\{x\\to \\frac{1}{35}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-((35*x)/(sqrt(3)))-(28/(sqrt(3)))), (29/(sqrt(3)))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{54 x^3-102 x^2+4 x+20}{198 x^2-110 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(2-\\sqrt{10}\\right)\\right\\},\\left\\{x\\to \\frac{1}{3} \\left(2+\\sqrt{10}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((54*x**3-102*x**2+4*x+20)/(198*x**2-110*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x+3$ and $-4 x^4-2 x^3+5 x^2-2 x+3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x+3, -4*x**4-2*x**3+5*x**2-2*x+3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{60}{71}$, and $a_n=a_{n-1}+-\\frac{11}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$-\\frac{256945}{142}$" + ], + "Output Program": [ + "a = -(60/71) # initial value\nd = -(11/2) # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(60/71) # initial value\nd = -(11/2) # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 x^2+4 x+11$ and $q(x) = 12-7 x$", + "Output Answer": [ + "$-35 x^3+32 x^2-29 x+132$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*x**2+4*x+11\nq = 12-7*x\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{9 x^2}{2}+\\frac{11 x}{2}+\\frac{27}{2}$", + "Output Answer": [ + "$x=\\frac{1}{18} \\left(-11-i \\sqrt{851}\\right)\\lor x=\\frac{1}{18} \\left(-11+i \\sqrt{851}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((9*x**2)/2)+((11*x)/2)+(27/2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$e^{-5 x-9} \\sin (4)$", + "Output Answer": [ + "$y<0$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(math.e**(-5*x-9)*sin(4), x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^5+3 x^4+8 x^3-4 x+2$ when divided by $7 x^5+2 x^4+7 x^3-x^2-x+8$.", + "Output Answer": [ + "$\\frac{9}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**5+3*x**4+8*x**3-4*x+2\nq = 7*x**5+2*x**4+7*x**3-x**2-x+8\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (7 x+6)^3, q(x) = \\frac{1}{16} (11-6 x)^4$", + "Output Answer": [ + "$81 x^4-251 x^3+\\frac{5031 x^2}{2}-\\frac{2481 x}{2}+\\frac{18097}{16}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (7*x+6)**3\nq = (1/16)*(11-6*x)**4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-2$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$-36$" + ], + "Output Program": [ + "a = -2 # initial value\nd = 0 # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -2 # initial value\nd = 0 # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-8 x^2-7 x-7$", + "Output Answer": [ + "$x=\\frac{1}{16} \\left(-7-5 i \\sqrt{7}\\right)\\lor x=\\frac{1}{16} \\left(-7+5 i \\sqrt{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-8*x**2-7*x-7, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{23+21}{(8+22)+23}$.", + "Output Answer": [ + "$\\frac{44}{53}$" + ], + "Output Program": [ + "try: \n print(((23+21)/((8+22)+23)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $3 x^3-51 x^2-114 x+1080$", + "Output Answer": [ + "$3 (4-x) (18-x) (x+5)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(3*x**3-51*x**2-114*x+1080, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $6 x^6+8 x^5+5 x^4-16 x^3-29 x^2-28 x-12$ and $-2 x^4+x^2+4 x+3$.", + "Output Answer": [ + "$2 x^4-x^2-4 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(6*x**6+8*x**5+5*x**4-16*x**3-29*x**2-28*x-12, -2*x**4+x**2+4*x+3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((19+19)-13)-((5+2)-24)$.", + "Output Answer": [ + "$42$" + ], + "Output Program": [ + "try: \n print(((19+19)-13)-((5+2)-24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 8-25 x| =24$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{16}{25}\\right\\},\\left\\{x\\to \\frac{32}{25}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(8-25*x), 24), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{11 x^5}{3}-\\frac{4 x^4}{3}-\\frac{14 x^3}{3}-\\frac{2 x^2}{3}-\\frac{10 x}{3}-3$ when divided by $\\frac{4 x^5}{3}+\\frac{22 x^4}{3}-2 x^3+\\frac{26 x^2}{3}+4 x-\\frac{28}{3}$.", + "Output Answer": [ + "$\\frac{11}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((11*x**5)/3)-((4*x**4)/3)-((14*x**3)/3)-((2*x**2)/3)-((10*x)/3)-3\nq = ((4*x**5)/3)+((22*x**4)/3)-2*x**3+((26*x**2)/3)+4*x-(28/3)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -4 x^2-5 x-6$ and $q(x) = -3 x^2-8 x+5$", + "Output Answer": [ + "$12 x^4+47 x^3+38 x^2+23 x-30$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -4*x**2-5*x-6\nq = -3*x**2-8*x+5\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-9 x^2-11 x$", + "Output Answer": [ + "$\\frac{121}{36}-9 \\left(x+\\frac{11}{18}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-9*x**2-11*x), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $e^{-\\frac{17 i \\pi }{36}} \\pi$.", + "Output Answer": [ + "Norm: $\\pi$\nArgument: $-\\frac{17 \\pi }{36}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = math.e**(-((17*i*math.pi)/36))*math.pi\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-352 x^3+230 x^2+48 x-6}{110 x-10}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{32} \\left(9-\\sqrt{273}\\right)\\right\\},\\left\\{x\\to \\frac{1}{32} \\left(9+\\sqrt{273}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-352*x**3+230*x**2+48*x-6)/(110*x-10)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(17+3)^2 \\left(\\left(\\left((23-9)^2+13\\right)-17\\right)-13\\right)^2$.", + "Output Answer": [ + "$12816400$" + ], + "Output Program": [ + "try: \n print((17+3)**2*((((23-9)**2+13)-17)-13)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-3 \\sqrt{2} x^2+\\frac{17 x}{\\sqrt{2}}+\\frac{13}{\\sqrt{2}}$", + "Output Answer": [ + "$x=-\\frac{-\\frac{17}{\\sqrt{2}}-\\sqrt{\\frac{601}{2}}}{6 \\sqrt{2}}\\lor x=-\\frac{\\sqrt{\\frac{601}{2}}-\\frac{17}{\\sqrt{2}}}{6 \\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-3*sqrt(2)*x**2+((17*x)/(sqrt(2)))+(13/(sqrt(2))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -4 x^2+8 x+7\\right| =24$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(2-\\sqrt{35}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(2+\\sqrt{35}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-4*x**2+8*x+7), 24), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{10}{13}$, and $a_n=a_{n-1}+\\frac{11}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$\\frac{2863}{26}$" + ], + "Output Program": [ + "a = -(10/13) # initial value\nd = (11/2) # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(10/13) # initial value\nd = (11/2) # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{14 x^3}{3}+\\frac{205 x^2}{3}+\\frac{551 x}{3}-228}{\\frac{91 x^2}{3}+219 x+324}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(-19-3 \\sqrt{57}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(-19+3 \\sqrt{57}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((14*x**3)/3)+((205*x**2)/3)+((551*x)/3)-228)/(((91*x**2)/3)+219*x+324)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(\\cos \\left(\\frac{1}{5}\\right)+i \\sin \\left(\\frac{1}{5}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1048576 (\\cos (2)+i \\sin (2))$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(math.cos((1/5))+1j*math.sin((1/5))))**10)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-4 \\sqrt{3} \\left(\\frac{1}{2}-\\frac{i \\sqrt{3}}{2}\\right)$.", + "Output Answer": [ + "Norm: $4 \\sqrt{3}$\nArgument: $\\frac{2 \\pi }{3}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -4*math.sqrt(3)*((1/2)-((i*math.sqrt(3))/2))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{17 x^2}{\\sqrt{3}}-\\frac{4 x}{\\sqrt{3}}-7 \\sqrt{3}$", + "Output Answer": [ + "$-\\frac{17 \\left(x+\\frac{2}{17}\\right)^2}{\\sqrt{3}}-7 \\sqrt{3}+\\frac{4}{17 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((17*x**2)/(math.sqrt(3)))-((4*x)/(math.sqrt(3)))-7*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{1}{9} ((23-12)+7)+14\\right) \\left(\\frac{11-1}{6}-7\\right)$.", + "Output Answer": [ + "$-\\frac{256}{3}$" + ], + "Output Program": [ + "try: \n print(((1/9)*((23-12)+7)+14)*(((11-1)/6)-7))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sqrt{-4 x-7}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{4} \\left(-y^2-7\\right)\\text{ if }y>0$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, sqrt(-4*x-7))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{527 x^3}{3}-369 x^2+\\frac{761 x}{3}+403}{102 x+234}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{31} \\left(3-\\sqrt{970}\\right)\\right\\},\\left\\{x\\to \\frac{1}{31} \\left(3+\\sqrt{970}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((527*x**3)/3)-369*x**2+((761*x)/3)+403)/(102*x+234)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{69 x^2}{5}-\\frac{41 x}{5}-\\frac{32}{5}$", + "Output Answer": [ + "$x=\\frac{1}{138} \\left(-41-i \\sqrt{7151}\\right)\\lor x=\\frac{1}{138} \\left(-41+i \\sqrt{7151}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((69*x**2)/5)-((41*x)/5)-(32/5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{26}{3} \\left(\\cos \\left(\\frac{59}{45}\\right)+i \\sin \\left(\\frac{59}{45}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-\\frac{5429503678976 \\left(\\cos \\left(\\frac{59}{5}\\right)+i \\sin \\left(\\frac{59}{5}\\right)\\right)}{19683}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(26/3)*(math.cos((59/45))+1j*math.sin((59/45))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-4 x+7 y^2-10 y-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x-\\frac{2}{5}\\right)^2+7 \\left(y-\\frac{5}{7}\\right)^2=\\frac{223}{35}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{2}{5}-\\frac{\\sqrt{446}}{35} & \\frac{5}{7} \\\\\n \\frac{1}{35} \\left(14+\\sqrt{446}\\right) & \\frac{5}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{2}{5}-\\frac{\\sqrt{446}}{35}+\\frac{1}{35} \\left(14+\\sqrt{446}\\right)\\right),\\frac{5}{7}\\right\\}$\nArea Enclosed: $\\frac{223 \\pi }{35 \\sqrt{35}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-4*x+7*y**2-10*y-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $-\\sin ^{-1}\\left(\\frac{15}{2}-\\frac{11 x}{2}\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{11} (2 \\sin (y)+15)\\text{ if }-\\frac{\\pi }{2}\\leq y\\leq \\frac{\\pi }{2}$}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, -asin((15/2)-((11*x)/2)))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((12+20)+10)-22)+((24-18)+20)^2$.", + "Output Answer": [ + "$696$" + ], + "Output Program": [ + "try: \n print((((12+20)+10)-22)+((24-18)+20)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{43}{49}$, and $a_n=a_{n-1}+7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{119232}{49}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(43/49) # initial value\nd = 7 # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(43/49) # initial value\nd = 7 # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-4 \\sqrt{3} \\left(-\\cos \\left(\\frac{\\pi }{9}\\right)-i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-442368 \\sqrt{3} \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)-i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-4*math.sqrt(3)*(-math.cos((math.pi/9))-1j*math.sin((math.pi/9))))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(4-4 i) \\sqrt{2}$ and $y=\\frac{7+10 i}{\\sqrt{2}}$", + "Output Answer": [ + "$\\frac{7+10 i}{\\sqrt{2}}+(4-4 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (4-4*i)*math.sqrt(2)\ny = ((7+10*i)/(math.sqrt(2)))\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{10+15 i}{\\sqrt{3}}$ and $y=-\\frac{5-i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{65}{3}+\\frac{65 i}{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((10+15*i)/(math.sqrt(3)))\ny = -((5-i)/(math.sqrt(3)))\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{68}{5}-5 x}+\\sqrt{\\frac{48 x}{5}-\\frac{12}{5}}=\\frac{24}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{42448-96 \\sqrt{97665}}{26645}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt((68/5)-5*x)+sqrt(((48*x)/5)-(12/5)), (24/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 \\sqrt{3}-2 \\sqrt{3} x^2$ and $q(x) = 8 \\sqrt{3} x^2+9 \\sqrt{3} x+4 \\sqrt{3}$", + "Output Answer": [ + "$-48 x^4-54 x^3+96 x^2+135 x+60$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*sqrt(3)-2*sqrt(3)*x**2\nq = 8*sqrt(3)*x**2+9*sqrt(3)*x+4*sqrt(3)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 5 x^2+19 x+6\\right| =18$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(-19-\\sqrt{601}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(-19+\\sqrt{601}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(5*x**2+19*x+6), 18), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{15}{49}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$\\frac{64090}{49}$" + ], + "Output Program": [ + "a = (15/49) # initial value\nd = 4 # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (15/49) # initial value\nd = 4 # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{20 x}{\\pi }-\\frac{27 x^2}{\\pi }$ and $q(x) = \\frac{29 x^2}{\\pi }-\\frac{32 x}{\\pi }-\\frac{11}{\\pi }$", + "Output Answer": [ + "$-\\frac{783 x^4}{\\pi ^2}+\\frac{1444 x^3}{\\pi ^2}-\\frac{343 x^2}{\\pi ^2}-\\frac{220 x}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((20*x)/pi)-((27*x**2)/pi)\nq = ((29*x**2)/pi)-((32*x)/pi)-(11/pi)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -6 x^2+\\frac{41 x}{2}-\\frac{3}{4}\\right| =-\\frac{71}{4}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-6*x**2+((41*x)/2)-(3/4)), -(71/4)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^2-10 x+8$ when divided by $9 x+9$.", + "Output Answer": [ + "$\\frac{7 x}{9}-\\frac{17}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**2-10*x+8\nq = 9*x+9\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{3-13 i}{\\pi }$ and $y=\\frac{5-22 i}{\\pi }$", + "Output Answer": [ + "$-\\frac{8-35 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((3-13*i)/math.pi)\ny = ((5-22*i)/math.pi)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{24-23 i}{\\pi }$ and $y=\\frac{5+i}{\\pi }$", + "Output Answer": [ + "$-\\frac{97}{26}+\\frac{139 i}{26}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((24-23*i)/math.pi)\ny = ((5+i)/math.pi)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=-\\frac{68}{7}-\\frac{26 i}{7}$ and $y=\\frac{44}{7}-\\frac{64 i}{7}$", + "Output Answer": [ + "$-16+\\frac{38 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = -(68/7)-((26*i)/7)\ny = (44/7)-((64*i)/7)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2-7 x-2 y^2-6 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x-\\frac{7}{10}\\right)^2-2 \\left(y+\\frac{3}{2}\\right)^2=-\\frac{121}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{7}{10} & \\frac{1}{20} \\left(-30-11 \\sqrt{14}\\right) \\\\\n \\frac{7}{10} & \\frac{1}{20} \\left(11 \\sqrt{14}-30\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{7}{5}}$\nCenter: $\\left\\{\\frac{7}{10},\\frac{1}{2} \\left(\\frac{1}{20} \\left(-30-11 \\sqrt{14}\\right)+\\frac{1}{20} \\left(11 \\sqrt{14}-30\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{20} \\left(7 \\sqrt{10}-30\\right)-\\sqrt{\\frac{5}{2}} x,y=\\sqrt{\\frac{5}{2}} x+\\frac{1}{20} \\left(-30-7 \\sqrt{10}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2-7*x-2*y**2-6*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-10 x^2-9 x+7$", + "Output Answer": [ + "$x=-\\frac{7}{5}\\lor x=\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-10*x**2-9*x+7, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{28 x^2}{e}-\\frac{13 x}{e}-\\frac{4}{e}$ and $q(x) = -\\frac{22 x^2}{e}-\\frac{29 x}{e}-\\frac{40}{e}$", + "Output Answer": [ + "$\\frac{616 x^4}{e^2}+\\frac{1098 x^3}{e^2}+\\frac{1585 x^2}{e^2}+\\frac{636 x}{e^2}+\\frac{160}{e^2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -((28*x**2)/math.e)-((13*x)/math.e)-(4/math.e)\nq = -((22*x**2)/math.e)-((29*x)/math.e)-(40/math.e)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-8 x-7 y^2-10 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x-\\frac{2}{3}\\right)^2-7 \\left(y+\\frac{5}{7}\\right)^2=-\\frac{40}{21}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{2}{3} & -\\frac{5}{7}-\\frac{2 \\sqrt{65}}{21} \\\\\n \\frac{2}{3} & \\frac{2 \\sqrt{65}}{21}-\\frac{5}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{13}{6}}$\nCenter: $\\left\\{\\frac{2}{3},-\\frac{5}{7}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{21} \\left(2 \\sqrt{42}-15\\right)-\\sqrt{\\frac{6}{7}} x,y=\\sqrt{\\frac{6}{7}} x+\\frac{1}{21} \\left(-15-2 \\sqrt{42}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-8*x-7*y**2-10*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-13 \\sqrt{2} x-15 \\sqrt{2} y+7 \\sqrt{2}=0$, $8 \\sqrt{2} x-6 \\sqrt{2} y-5 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{13}{22}$, $y=-\\frac{1}{22}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-13*sqrt(2)*x-15*sqrt(2)*y+7*sqrt(2), 8*sqrt(2)*x-6*sqrt(2)*y-5*sqrt(2)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-6-11 i) \\log (2)$ and $y=(11-5 i) \\log (2)$", + "Output Answer": [ + "$(-17-6 i) \\log (2)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-6-11*i)*math.log10(2)\ny = (11-5*i)*math.log10(2)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{2}{3}$, and $a_n=a_{n-1}+8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$2826$" + ], + "Output Program": [ + "a = (2/3) # initial value\nd = 8 # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (2/3) # initial value\nd = 8 # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{9}{2} \\left(\\cos \\left(\\frac{88}{45}\\right)+i \\sin \\left(\\frac{88}{45}\\right)\\right)\\right)^4$", + "Output Answer": [ + "$\\frac{6561}{16} \\left(\\cos \\left(\\frac{352}{45}\\right)+i \\sin \\left(\\frac{352}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(9/2)*(math.cos((88/45))+1j*math.sin((88/45))))**4)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-11 x^2+66 x+176$", + "Output Answer": [ + "$11 (8-x) (x+2)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-11*x**2+66*x+176, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{15 \\sqrt{2} x^2+14 \\sqrt{2} x-8 \\sqrt{2}}{5 \\sqrt{2} x^2-5 \\sqrt{2} x+7 \\sqrt{2}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{4}{3}\\right\\},\\left\\{x\\to \\frac{2}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((15*sqrt(2)*x**2+14*sqrt(2)*x-8*sqrt(2))/(5*sqrt(2)*x**2-5*sqrt(2)*x+7*sqrt(2))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{67}{63}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=8$.", + "Output Answer": [ + "$\\frac{536}{63}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (67/63) # initial value\nd = 0 # second term\nn = 8 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (67/63) # initial value\nd = 0 # second term\nn = 8 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{115 x^2+142 x+40}{90 x+72}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{10}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((115*x**2+142*x+40)/(90*x+72)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{23}{4}-\\frac{11 i}{2}$.", + "Output Answer": [ + "Norm: $\\frac{\\sqrt{1013}}{4}$\nArgument: $\\tan ^{-1}\\left(\\frac{22}{23}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(23/4)-((11*i)/2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-e \\left(-\\sin \\left(\\frac{13 \\pi }{90}\\right)-i \\cos \\left(\\frac{13 \\pi }{90}\\right)\\right)$.", + "Output Answer": [ + "Norm: $e \\sqrt{\\sin ^2\\left(\\frac{13 \\pi }{90}\\right)+\\cos ^2\\left(\\frac{13 \\pi }{90}\\right)}$\nArgument: $\\frac{16 \\pi }{45}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.e*(-math.sin(((13*math.pi)/90))-i*math.cos(((13*math.pi)/90)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-\\frac{11 x^2}{2}-\\frac{11 x}{2}+\\frac{27}{2}$", + "Output Answer": [ + "$\\frac{119}{8}-\\frac{11}{2} \\left(x+\\frac{1}{2}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-((11*x**2)/2)-((11*x)/2)+(27/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^3+5 x^2-1$ and $x^2+2 x-1$.", + "Output Answer": [ + "$x^2+2 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**3+5*x**2-1, x**2+2*x-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{13 \\left(\\cos \\left(\\frac{19}{15}\\right)+i \\sin \\left(\\frac{19}{15}\\right)\\right)}{\\sqrt{3}}\\right)^6$", + "Output Answer": [ + "$\\frac{4826809}{27} \\left(\\cos \\left(\\frac{38}{5}\\right)+i \\sin \\left(\\frac{38}{5}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((13*(math.cos((19/15))+1j*math.sin((19/15))))/(math.sqrt(3))))**6)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 7 x^2-\\frac{86 x}{7}+\\frac{82}{7}$ and $q(x) = \\frac{78 x^2}{7}+\\frac{61 x}{7}+\\frac{59}{7}$", + "Output Answer": [ + "$78 x^4-\\frac{3719 x^3}{49}+\\frac{4041 x^2}{49}-\\frac{72 x}{49}+\\frac{4838}{49}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 7*x**2-((86*x)/7)+(82/7)\nq = ((78*x**2)/7)+((61*x)/7)+(59/7)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-5 x^4-3 x^3-8 x^2+29 x-10$ and $-x^3-x^2-2 x+5$.", + "Output Answer": [ + "$x^3+x^2+2 x-5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-5*x**4-3*x**3-8*x**2+29*x-10, -x**3-x**2-2*x+5))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 x^2+4 x+4$ and $q(x) = -10 x^2+9 x-2$", + "Output Answer": [ + "$-30 x^4-13 x^3-10 x^2+28 x-8$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*x**2+4*x+4\nq = -10*x**2+9*x-2\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{53}{76}$, and $a_n=a_{n-1}+-3 \\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=12$.", + "Output Answer": [ + "$6 \\left(\\frac{53}{38}-33 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (53/76) # initial value\nd = -3*math.sqrt(2) # second term\nn = 12 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (53/76) # initial value\nd = -3*math.sqrt(2) # second term\nn = 12 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 18 x-25| =3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{11}{9}\\right\\},\\left\\{x\\to \\frac{14}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(18*x-25), 3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| x+19| =-22$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(x+19), -22), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $1$ and $-3 x^2+2 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(1, -3*x**2+2*x-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\frac{1}{5-7 x^2}$", + "Output Answer": [ + "$y<0\\lor y\\geq \\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range((1/(5-7*x**2)), x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^2+\\frac{22 x}{3}+9$ when divided by $\\frac{1}{3}-\\frac{26 x}{3}$.", + "Output Answer": [ + "$\\frac{15 x}{26}-\\frac{557}{676}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**2+((22*x)/3)+9\nq = (1/3)-((26*x)/3)\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{3}{4} \\left(\\cos \\left(\\frac{41}{30}\\right)+i \\sin \\left(\\frac{41}{30}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$\\frac{59049 \\left(\\cos \\left(\\frac{41}{3}\\right)+i \\sin \\left(\\frac{41}{3}\\right)\\right)}{1048576}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(3/4)*(math.cos((41/30))+1j*math.sin((41/30))))**10)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\cos \\left(\\frac{\\pi }{45}\\right)-i \\sin \\left(\\frac{\\pi }{45}\\right)\\right)\\right)^6$", + "Output Answer": [ + "$117649 \\left(\\cos \\left(\\frac{2 \\pi }{15}\\right)-i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.cos((math.pi/45))-1j*math.sin((math.pi/45))))**6)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{58}{7} \\left(-\\sin \\left(\\frac{\\pi }{15}\\right)+i \\cos \\left(\\frac{\\pi }{15}\\right)\\right)$.", + "Output Answer": [ + "Norm: $\\frac{58}{7} \\sqrt{\\sin ^2\\left(\\frac{\\pi }{15}\\right)+\\cos ^2\\left(\\frac{\\pi }{15}\\right)}$\nArgument: $-\\frac{13 \\pi }{30}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(58/7)*(-math.sin((math.pi/15))+i*math.cos((math.pi/15)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-2 x+6 y-20=0$, $-4 x-5 y-15=0$", + "Output Answer": [ + "$x=-\\frac{95}{17}$, $y=\\frac{25}{17}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-2*x+6*y-20, -4*x-5*y-15), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-2 \\sqrt{5} e^{\\frac{11 i \\pi }{60}}$.", + "Output Answer": [ + "Norm: $2 \\sqrt{5}$\nArgument: $-\\frac{49 \\pi }{60}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -2*math.sqrt(5)*math.e**((11*i*math.pi)/60)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -\\frac{41 x^2}{4}-9$, $q(x) = \\frac{1}{4} \\left(58 x^2-22 x-3\\right)$", + "Output Answer": [ + "$\\frac{17 x^2}{4}-\\frac{11 x}{2}-\\frac{39}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -((41*x**2)/4)-9\nq = (1/4)*(58*x**2-22*x-3)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 \\sqrt{3} x^2-8 \\sqrt{3} x-5 \\sqrt{3}$", + "Output Answer": [ + "$3 \\sqrt{3}-2 \\sqrt{3} (x+2)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*math.sqrt(3)*x**2-8*math.sqrt(3)*x-5*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2+3 x+2 y^2-y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(y-\\frac{1}{4}\\right)^2-4 \\left(x-\\frac{3}{8}\\right)^2=\\frac{153}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{8} & \\frac{1}{8} \\left(2-3 \\sqrt{51}\\right) \\\\\n \\frac{3}{8} & \\frac{1}{8} \\left(2+3 \\sqrt{51}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{3}{2}}$\nCenter: $\\left\\{\\frac{3}{8},\\frac{1}{2} \\left(\\frac{1}{8} \\left(2-3 \\sqrt{51}\\right)+\\frac{1}{8} \\left(2+3 \\sqrt{51}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{8} \\left(2+3 \\sqrt{2}\\right)-\\sqrt{2} x,y=\\sqrt{2} x+\\frac{1}{8} \\left(2-3 \\sqrt{2}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2+3*x+2*y**2-y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{28}{3} \\left(\\cos \\left(\\frac{41}{30}\\right)+i \\sin \\left(\\frac{41}{30}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$-\\frac{10578455953408 \\left(\\cos \\left(\\frac{123}{10}\\right)+i \\sin \\left(\\frac{123}{10}\\right)\\right)}{19683}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-(28/3)*(math.cos((41/30))+1j*math.sin((41/30))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the first order series of the inverse of the following function around 1:\n$-\\frac{13824 x^3}{125}$", + "Output Answer": [ + "$-\\frac{125 \\left(x-\\frac{110592}{125}\\right)}{165888}-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, -((13824*x**3)/125))\nprint(solve(f, x)[0].series(y, 1, 1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{10 \\sqrt{3} x^2+4 \\sqrt{3} x-8 \\sqrt{3}}{11 \\sqrt{3} x-\\sqrt{3}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(-1-\\sqrt{21}\\right)\\right\\},\\left\\{x\\to \\frac{1}{5} \\left(-1+\\sqrt{21}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((10*sqrt(3)*x**2+4*sqrt(3)*x-8*sqrt(3))/(11*sqrt(3)*x-sqrt(3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2+10 x-7 y^2-y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(x+\\frac{5}{9}\\right)^2-7 \\left(y+\\frac{1}{14}\\right)^2=\\frac{1699}{252}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{9}-\\frac{2 \\sqrt{1699}}{63} & -\\frac{1}{14} \\\\\n \\frac{2 \\sqrt{1699}}{63}-\\frac{5}{9} & -\\frac{1}{14} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{4}{\\sqrt{7}}$\nCenter: $\\left\\{-\\frac{5}{9},-\\frac{1}{14}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{3 x}{\\sqrt{7}}+\\frac{1}{42} \\left(10 \\sqrt{7}-3\\right),y=\\frac{1}{42} \\left(-3-10 \\sqrt{7}\\right)-\\frac{3 x}{\\sqrt{7}}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2+10*x-7*y**2-y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x-\\frac{7 x^2}{3}$ and $-\\frac{11}{3}$.", + "Output Answer": [ + "$\\frac{1}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x-((7*x**2)/3), -(11/3)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\cos \\left(\\frac{19}{10}\\right)+i \\sin \\left(\\frac{19}{10}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$282475249 (\\cos (19)+i \\sin (19))$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.cos((19/10))+1j*math.sin((19/10))))**10)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{57 x}{5}+\\frac{7 y}{5}-\\frac{92 z}{5}+\\frac{48}{5}=0$, $\\frac{94 x}{5}+21 y+23 z-12=0$, $-13 x-17 y+z+\\frac{38}{5}=0$", + "Output Answer": [ + "$x=\\frac{934}{1177}$, $y=-\\frac{934}{5885}$, $z=\\frac{106}{5885}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((57*x)/5)+((7*y)/5)-((92*z)/5)+(48/5), ((94*x)/5)+21*y+23*z-12, -13*x-17*y+z+(38/5))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-3 \\pi \\left(\\cos \\left(\\frac{41 \\pi }{180}\\right)-i \\sin \\left(\\frac{41 \\pi }{180}\\right)\\right)$.", + "Output Answer": [ + "Norm: $3 \\pi \\sqrt{\\sin ^2\\left(\\frac{41 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{41 \\pi }{180}\\right)}$\nArgument: $\\frac{139 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -3*math.pi*(math.cos(((41*math.pi)/180))-i*math.sin(((41*math.pi)/180)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{11 \\left(-\\cos \\left(\\frac{\\pi }{9}\\right)-i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)}{\\sqrt{2}}\\right)^9$", + "Output Answer": [ + "$\\frac{2357947691}{16 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((((11*(-math.cos((math.pi/9))-1j*math.sin((math.pi/9))))/(math.sqrt(2))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\tan (8-9 x)-\\tan (2 x+1)$ at the point $x=5$", + "Output Answer": [ + "$-\\tan (11)+\\tan (37) = 225.11$" + ], + "Output Program": [ + "import math\n\nx = 5\ntry: \n f = -math.tan(8-9*x)-math.tan(2*x+1)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -13 x^2+11 x-9$ and $q(x) = -13 x^2+8 x-5$", + "Output Answer": [ + "$169 x^4-247 x^3+270 x^2-127 x+45$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -13*x**2+11*x-9\nq = -13*x**2+8*x-5\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{11 \\left(-\\frac{i}{4}+\\frac{i \\sqrt{5}}{4}+\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)}{\\sqrt{3}}$.", + "Output Answer": [ + "Norm: $\\frac{11}{\\sqrt{\\frac{3}{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}+\\left(\\frac{\\sqrt{5}}{4}-\\frac{1}{4}\\right)^2}}}$\nArgument: $-\\pi -\\tan ^{-1}\\left(\\frac{\\frac{1}{4}-\\frac{\\sqrt{5}}{4}}{\\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -((11*(-(i/4)+((i*math.sqrt(5))/4)+math.sqrt((5/8)+((math.sqrt(5))/8))))/(math.sqrt(3)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $12 x^3-20 x^2+16 x$ and $-3 x^2+5 x-4$.", + "Output Answer": [ + "$3 x^2-5 x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(12*x**3-20*x**2+16*x, -3*x**2+5*x-4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{-29 x^2+41 x+34}{\\pi }$, $q(x) = \\frac{-3 x^2+9 x+24}{\\pi }$", + "Output Answer": [ + "$-\\frac{32 x^2}{\\pi }+\\frac{50 x}{\\pi }+\\frac{58}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((-29*x**2+41*x+34)/pi)\nq = ((-3*x**2+9*x+24)/pi)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 9 x^2-12 x+5$ and $q(x) = -10 x^2+15 x-15$", + "Output Answer": [ + "$-90 x^4+255 x^3-365 x^2+255 x-75$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 9*x**2-12*x+5\nq = -10*x**2+15*x-15\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\sqrt{3} \\left(\\cos \\left(\\frac{14}{15}\\right)+i \\sin \\left(\\frac{14}{15}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-59049 \\sqrt{3} \\left(\\cos \\left(\\frac{98}{15}\\right)+i \\sin \\left(\\frac{98}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*math.sqrt(3)*(math.cos((14/15))+1j*math.sin((14/15))))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $x^2-4 x-5 y^2-4 y+9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $(x-2)^2-5 \\left(y+\\frac{2}{5}\\right)^2=-\\frac{29}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n 2 & \\frac{1}{5} \\left(-2-\\sqrt{174}\\right) \\\\\n 2 & \\frac{1}{5} \\left(\\sqrt{174}-2\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{6}$\nCenter: $\\left\\{2,\\frac{1}{2} \\left(\\frac{1}{5} \\left(-2-\\sqrt{174}\\right)+\\frac{1}{5} \\left(\\sqrt{174}-2\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2}{5} \\left(\\sqrt{5}-1\\right)-\\frac{x}{\\sqrt{5}},y=\\frac{x}{\\sqrt{5}}-\\frac{2}{5} \\left(1+\\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(x**2-4*x-5*y**2-4*y+9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{4 x^2}{\\sqrt{3}}-8 \\sqrt{3} x+\\frac{16}{\\sqrt{3}}$", + "Output Answer": [ + "$x=3-\\sqrt{5}\\lor x=3+\\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((4*x**2)/(sqrt(3)))-8*sqrt(3)*x+(16/(sqrt(3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\cos \\left(\\frac{173}{90}\\right)+i \\sin \\left(\\frac{173}{90}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$40353607 \\left(\\cos \\left(\\frac{173}{10}\\right)+i \\sin \\left(\\frac{173}{10}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.cos((173/90))+1j*math.sin((173/90))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -6 x^2+8 x-3$, $q(x) = 4 x^2-7 x-8$", + "Output Answer": [ + "$-2 x^2+x-11$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**2+8*x-3\nq = 4*x**2-7*x-8\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$17 x-22 y+18=0$, $24 x+17 y-9=0$", + "Output Answer": [ + "$x=-\\frac{108}{817}$, $y=\\frac{585}{817}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((17*x-22*y+18, 24*x+17*y-9), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-8 x^2+8 x+2$", + "Output Answer": [ + "$4-8 \\left(x-\\frac{1}{2}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-8*x**2+8*x+2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=-\\frac{25+12 i}{\\pi }$ and $y=-\\frac{19-25 i}{\\pi }$", + "Output Answer": [ + "$-\\frac{44-13 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((25+12*i)/math.pi)\ny = -((19-25*i)/math.pi)\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=3-i$ and $y=\\frac{4}{3}+\\frac{17 i}{3}$", + "Output Answer": [ + "$\\frac{29}{3}+\\frac{47 i}{3}$" + ], + "Output Program": [ + "i = 1j\nx = 3-i\ny = (4/3)+((17*i)/3)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((((6+18)-13)-21)+13)-(23-22)$.", + "Output Answer": [ + "$2$" + ], + "Output Program": [ + "try: \n print(((((6+18)-13)-21)+13)-(23-22))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-6 t-5 \\sqrt{2}-22, x(t)=-3 \\sqrt{2} t-11 \\sqrt{2}$", + "Output Answer": [ + "$y=\\sqrt{2} x-5 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -6*t-5*sqrt(2)-22\nx_t = -3*sqrt(2)*t-11*sqrt(2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $12 x-15 x^2$", + "Output Answer": [ + "$\\frac{12}{5}-15 \\left(x-\\frac{2}{5}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (12*x-15*x**2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-2 \\sqrt{3} x^2+3 \\sqrt{3} x-2 \\sqrt{3}$", + "Output Answer": [ + "$x=\\frac{1}{4} \\left(3-i \\sqrt{7}\\right)\\lor x=\\frac{1}{4} \\left(3+i \\sqrt{7}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-2*sqrt(3)*x**2+3*sqrt(3)*x-2*sqrt(3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -(2 x+1)^3, q(x) = (x+5)^3$", + "Output Answer": [ + "$-7 x^3+3 x^2+69 x+124$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -(2*x+1)**3\nq = (x+5)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x$ and $-3 x^5+3 x^4-3 x^3+2 x^2-x+1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x, -3*x**5+3*x**4-3*x**3+2*x**2-x+1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{125} (3 x-37)^3, q(x) = \\frac{1}{25} (23 x+11)^2$", + "Output Answer": [ + "$\\frac{27 x^3}{125}+\\frac{1646 x^2}{125}+\\frac{14851 x}{125}-\\frac{50048}{125}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/125)*(3*x-37)**3\nq = (1/25)*(23*x+11)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $7 x^4-7 x^2+x+7$ when divided by $-10 x^4-2 x^3-2 x^2-6 x+5$.", + "Output Answer": [ + "$-\\frac{7}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 7*x**4-7*x**2+x+7\nq = -10*x**4-2*x**3-2*x**2-6*x+5\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2-x+9 y^2+3 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(y+\\frac{1}{6}\\right)^2-4 \\left(x+\\frac{1}{8}\\right)^2=-\\frac{77}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{24} \\left(-3-\\sqrt{1001}\\right) & -\\frac{1}{6} \\\\\n \\frac{1}{24} \\left(\\sqrt{1001}-3\\right) & -\\frac{1}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{13}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{24} \\left(-3-\\sqrt{1001}\\right)+\\frac{1}{24} \\left(\\sqrt{1001}-3\\right)\\right),-\\frac{1}{6}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{2 x}{3}-\\frac{1}{12},y=-\\frac{2 x}{3}-\\frac{1}{4}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2-x+9*y**2+3*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{x^2}{2}+\\frac{27 x}{2}-\\frac{49}{2}}{-3 x-11}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(27-\\sqrt{533}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(27+\\sqrt{533}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((x**2)/2)+((27*x)/2)-(49/2))/(-3*x-11)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $4 \\sqrt{5} e^{\\frac{4 i \\pi }{15}}$.", + "Output Answer": [ + "Norm: $4 \\sqrt{5}$\nArgument: $\\frac{4 \\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 4*math.sqrt(5)*math.e**((4*i*math.pi)/15)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 (x+3)^2, q(x) = 4 (1-2 x)^2$", + "Output Answer": [ + "$25 x^2+38 x+85$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*(x+3)**2\nq = 4*(1-2*x)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2+70 x+600$", + "Output Answer": [ + "$-5 (x-20) (x+6)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2+70*x+600, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(2-4 i) \\sqrt{3}$ and $y=(1-i) \\sqrt{3}$", + "Output Answer": [ + "$3-i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (2-4*i)*math.sqrt(3)\ny = (1-i)*math.sqrt(3)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((12-20)-11)^2-((5-1)+18)^2$.", + "Output Answer": [ + "$-123$" + ], + "Output Program": [ + "try: \n print(((12-20)-11)**2-((5-1)+18)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-396 x-234}{360 x+108}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{13}{22}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-396*x-234)/(360*x+108)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-16 \\sqrt{2} x-\\sqrt{2} y+12 \\sqrt{2} z+2 \\sqrt{2}=0$, $-16 \\sqrt{2} x-13 \\sqrt{2} y-9 \\sqrt{2} z-4 \\sqrt{2}=0$, $-4 \\sqrt{2} x-4 \\sqrt{2} y-16 \\sqrt{2} z+9 \\sqrt{2}=0$", + "Output Answer": [ + "$x=\\frac{695}{796}$, $y=-\\frac{390}{199}$, $z=\\frac{166}{199}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-16*sqrt(2)*x-sqrt(2)*y+12*sqrt(2)*z+2*sqrt(2), -16*sqrt(2)*x-13*sqrt(2)*y-9*sqrt(2)*z-4*sqrt(2), -4*sqrt(2)*x-4*sqrt(2)*y-16*sqrt(2)*z+9*sqrt(2))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{5}{7}+\\frac{25 i}{7}$ and $y=\\frac{67}{7}-\\frac{69 i}{7}$", + "Output Answer": [ + "$\\frac{2060}{49}+\\frac{190 i}{7}$" + ], + "Output Program": [ + "i = 1j\nx = (5/7)+((25*i)/7)\ny = (67/7)-((69*i)/7)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2-8 x+9 y^2+5 y-3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x-\\frac{2}{5}\\right)^2+9 \\left(y+\\frac{5}{18}\\right)^2=\\frac{953}{180}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{2}{5} & \\frac{1}{180} \\left(-50-\\sqrt{1906}\\right) \\\\\n \\frac{2}{5} & \\frac{1}{180} \\left(\\sqrt{1906}-50\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{10}}$\nCenter: $\\left\\{\\frac{2}{5},\\frac{1}{2} \\left(\\frac{1}{180} \\left(-50-\\sqrt{1906}\\right)+\\frac{1}{180} \\left(\\sqrt{1906}-50\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{953 \\pi }{540 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2-8*x+9*y**2+5*y-3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\cos \\left(\\frac{19}{30}\\right)+i \\sin \\left(\\frac{19}{30}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$49 \\left(\\cos \\left(\\frac{19}{15}\\right)+i \\sin \\left(\\frac{19}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.cos((19/30))+1j*math.sin((19/30))))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-6-5 i$ and $y=-6+i$", + "Output Answer": [ + "$41+24 i$" + ], + "Output Program": [ + "i = 1j\nx = -6-5*i\ny = -6+i\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(3-4 i) \\sqrt{3}$ and $y=\\frac{8-4 i}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{8-4 i}{\\sqrt{3}}+(3-4 i) \\sqrt{3}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (3-4*i)*math.sqrt(3)\ny = ((8-4*i)/(math.sqrt(3)))\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-3 x+9 y^2+5 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-3 x+9 y^2+5 y=4$\nVertex: $\\left\\{-\\frac{169}{108},-\\frac{5}{18}\\right\\}$\nDirectrix: $x=-\\frac{89}{54}$\nFocal Parameter: $\\frac{1}{6}$\nFocus: $\\left\\{-\\frac{40}{27},-\\frac{5}{18}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x+9*y**2+5*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (\\sqrt{5}, 5, \\frac{1}{5})$", + "Output Answer": [ + "$\\left\\{\\frac{\\sqrt{751}}{5},\\tan ^{-1}\\left(5 \\sqrt{30}\\right),\\tan ^{-1}\\left(\\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = math.sqrt(5)\ny = 5\nz = (1/5)\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(7-5)^2 ((((14-5)+3)+11)+2)$.", + "Output Answer": [ + "$100$" + ], + "Output Program": [ + "try: \n print((7-5)**2*((((14-5)+3)+11)+2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{2}{23}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$\\frac{4120}{23}$" + ], + "Output Program": [ + "a = -(2/23) # initial value\nd = 4 # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(2/23) # initial value\nd = 4 # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 11.4 x^2-11.7 x+7.9$, $q(x) = -1.5 x^2+12.1 x+4.9$", + "Output Answer": [ + "$9.9 x^2+0.4 x+12.8$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 11.4*x**2-11.7*x+7.9\nq = -1.5*x**2+12.1*x+4.9\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{45 x^2}{4}+\\frac{29 x}{2}+\\frac{15}{2}$", + "Output Answer": [ + "$x=\\frac{1}{45} \\left(29-\\sqrt{2191}\\right)\\lor x=\\frac{1}{45} \\left(29+\\sqrt{2191}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((45*x**2)/4)+((29*x)/2)+(15/2), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{928 x^3}{49}-\\frac{2134 x^2}{49}-\\frac{6673 x}{49}+\\frac{592}{7}}{\\frac{3973 x}{49}-\\frac{2192}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{32} \\left(-25-3 \\sqrt{201}\\right)\\right\\},\\left\\{x\\to \\frac{1}{32} \\left(-25+3 \\sqrt{201}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((928*x**3)/49)-((2134*x**2)/49)-((6673*x)/49)+(592/7))/(((3973*x)/49)-(2192/7))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^2+x-2$ and $4 x-2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**2+x-2, 4*x-2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{59 x^2}{5}+\\frac{21 x}{5}-\\frac{28}{5}$", + "Output Answer": [ + "$x=\\frac{1}{118} \\left(-21-\\sqrt{7049}\\right)\\lor x=\\frac{1}{118} \\left(\\sqrt{7049}-21\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((59*x**2)/5)+((21*x)/5)-(28/5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\frac{e^{-8 x^5-7}}{4 x+6}$", + "Output Answer": [ + "$x<-\\frac{3}{2}\\lor x>-\\frac{3}{2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = ((math.e**(-8*x**5-7))/(4*x+6))\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2+4 x+3 y^2+5 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x+\\frac{1}{4}\\right)^2+3 \\left(y+\\frac{5}{6}\\right)^2=\\frac{103}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{4} & \\frac{1}{24} \\left(-20-\\sqrt{1030}\\right) \\\\\n -\\frac{1}{4} & \\frac{1}{24} \\left(\\sqrt{1030}-20\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{5}{2}}}{2}$\nCenter: $\\left\\{-\\frac{1}{4},\\frac{1}{2} \\left(\\frac{1}{24} \\left(-20-\\sqrt{1030}\\right)+\\frac{1}{24} \\left(\\sqrt{1030}-20\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{103 \\pi }{24 \\sqrt{6}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2+4*x+3*y**2+5*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 2 x^2+7 x+1$ and $q(x) = 7 x^2+x-7$", + "Output Answer": [ + "$14 x^4+51 x^3-48 x-7$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 2*x**2+7*x+1\nq = 7*x**2+x-7\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-5 x^2+13 x-11$", + "Output Answer": [ + "$-5 \\left(x-\\frac{13}{10}\\right)^2-\\frac{51}{20}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-5*x**2+13*x-11), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{26}{83}$, and $a_n=a_{n-1}+4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$\\frac{70266}{83}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (26/83) # initial value\nd = 4 # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (26/83) # initial value\nd = 4 # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\left(\\cos \\left(\\frac{2 \\pi }{15}\\right)+i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$531441 \\left(\\frac{1}{4} \\left(\\sqrt{5}-1\\right)-i \\sqrt{\\frac{5}{8}+\\frac{\\sqrt{5}}{8}}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*(math.cos(((2*math.pi)/15))+1j*math.sin(((2*math.pi)/15))))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2-x-7 y^2+y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x-\\frac{1}{6}\\right)^2-7 \\left(y-\\frac{1}{14}\\right)^2=\\frac{127}{21}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{42} \\left(7-2 \\sqrt{1270}\\right) & \\frac{1}{14} \\\\\n \\frac{1}{42} \\left(7+2 \\sqrt{1270}\\right) & \\frac{1}{14} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{10}{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{42} \\left(7-2 \\sqrt{1270}\\right)+\\frac{1}{42} \\left(7+2 \\sqrt{1270}\\right)\\right),\\frac{1}{14}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{3}{7}} x+\\frac{1}{42} \\left(3-\\sqrt{21}\\right),y=\\frac{1}{42} \\left(3+\\sqrt{21}\\right)-\\sqrt{\\frac{3}{7}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2-x-7*y**2+y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4-2 x}+\\sqrt{15 x+14}=3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{289} \\left(-53-6 \\sqrt{1226}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4-2*x)+sqrt(15*x+14), 3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2+9 x-190$", + "Output Answer": [ + "$(x-10) (x+19)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2+9*x-190, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\sqrt{2} \\left(\\cos \\left(\\frac{163}{90}\\right)+i \\sin \\left(\\frac{163}{90}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$1073741824 \\left(\\cos \\left(\\frac{326}{15}\\right)+i \\sin \\left(\\frac{326}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*math.sqrt(2)*(math.cos((163/90))+1j*math.sin((163/90))))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{13 \\left(\\cos \\left(\\frac{\\pi }{20}\\right)+i \\sin \\left(\\frac{\\pi }{20}\\right)\\right)}{\\sqrt{2}}$.", + "Output Answer": [ + "Norm: $13 \\sqrt{\\frac{1}{2} \\left(\\sin ^2\\left(\\frac{\\pi }{20}\\right)+\\cos ^2\\left(\\frac{\\pi }{20}\\right)\\right)}$\nArgument: $\\frac{\\pi }{20}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((13*(math.cos((math.pi/20))+i*math.sin((math.pi/20))))/(math.sqrt(2)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-4 x-8$ when divided by $8$.", + "Output Answer": [ + "$-\\frac{x}{2}-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -4*x-8\nq = 8\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{-15 x^2-12 x+16}{\\sqrt{2}}$, $q(x) = \\frac{-11 x^2+4 x-13}{\\sqrt{2}}$", + "Output Answer": [ + "$-13 \\sqrt{2} x^2-4 \\sqrt{2} x+8 \\sqrt{2}-\\frac{13}{\\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((-15*x**2-12*x+16)/(sqrt(2)))\nq = ((-11*x**2+4*x-13)/(sqrt(2)))\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-12 x^4-4 x^3-4 x^2+14 x-4$ and $-4 x^3-4 x^2-4 x+2$.", + "Output Answer": [ + "$4 x^3+4 x^2+4 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-12*x**4-4*x**3-4*x**2+14*x-4, -4*x**3-4*x**2-4*x+2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{1}{70}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=19$.", + "Output Answer": [ + "$\\frac{71839}{70}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (1/70) # initial value\nd = 6 # second term\nn = 19 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (1/70) # initial value\nd = 6 # second term\nn = 19 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{9 \\sqrt{5} x^2+4 \\sqrt{5} x-8 \\sqrt{5}}{\\sqrt{5} x+2 \\sqrt{5}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-2-2 \\sqrt{19}\\right)\\right\\},\\left\\{x\\to \\frac{1}{9} \\left(-2+2 \\sqrt{19}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((9*sqrt(5)*x**2+4*sqrt(5)*x-8*sqrt(5))/(sqrt(5)*x+2*sqrt(5))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-\\frac{7 x}{\\sqrt{3}}+\\frac{20 y}{\\sqrt{3}}+13 \\sqrt{3}=0$, $-\\frac{38 x}{\\sqrt{3}}-\\frac{31 y}{\\sqrt{3}}+13 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{1989}{977}$, $y=-\\frac{1209}{977}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-((7*x)/(sqrt(3)))+((20*y)/(sqrt(3)))+13*sqrt(3), -((38*x)/(sqrt(3)))-((31*y)/(sqrt(3)))+13*sqrt(3)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{27}{20}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$\\frac{108}{5}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (27/20) # initial value\nd = 0 # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (27/20) # initial value\nd = 0 # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(8-1)+(((1-24)+1)+18)$.", + "Output Answer": [ + "$3$" + ], + "Output Program": [ + "try: \n print((8-1)+(((1-24)+1)+18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2+8 x+3 y^2-2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $5 \\left(x+\\frac{4}{5}\\right)^2+3 y^2=\\frac{26}{5}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{4}{5} & -\\frac{2 \\sqrt{\\frac{13}{3}}}{5} \\\\\n -\\frac{4}{5} & \\frac{2 \\sqrt{\\frac{13}{3}}}{5} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{2}{5}}$\nCenter: $\\left\\{-\\frac{4}{5},0\\right\\}$\nArea Enclosed: $\\frac{26 \\pi }{5 \\sqrt{15}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2+8*x+3*y**2-2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(8-10)-((22+15)-2)$.", + "Output Answer": [ + "$-37$" + ], + "Output Program": [ + "try: \n print((8-10)-((22+15)-2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=15 \\sqrt{5} (7-2 t)^2, x(t)=20 t^2-140 t+245$", + "Output Answer": [ + "$y=3 \\sqrt{5} x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 15*sqrt(5)*(7-2*t)**2\nx_t = 20*t**2-140*t+245\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-9 x^2-3 x+1$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(-1-\\sqrt{5}\\right)\\lor x=\\frac{1}{6} \\left(\\sqrt{5}-1\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-9*x**2-3*x+1, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-5 x^5+15 x^3-20 x^2+15 x+20$ and $x^5-3 x^3+4 x^2-3 x-4$.", + "Output Answer": [ + "$x^5-3 x^3+4 x^2-3 x-4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-5*x**5+15*x**3-20*x**2+15*x+20, x**5-3*x**3+4*x**2-3*x-4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-6 x^2-72 \\sqrt{2} x-420$", + "Output Answer": [ + "$6 \\left(-x-5 \\sqrt{2}\\right) \\left(x+7 \\sqrt{2}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-6*x**2-72*sqrt(2)*x-420, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-6 x^2+13 x-6$", + "Output Answer": [ + "$x=\\frac{2}{3}\\lor x=\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-6*x**2+13*x-6, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-12 x^2-102 x+114}{30 x^2+325 x+380}=0$", + "Output Answer": [ + "$\\{\\{x\\to 1\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-12*x**2-102*x+114)/(30*x**2+325*x+380)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -\\frac{19 x^2}{e}-\\frac{22 x}{e}-\\frac{25}{e}$ and $q(x) = \\frac{23 x^2}{e}-\\frac{19 x}{e}+\\frac{25}{e}$", + "Output Answer": [ + "$-\\frac{437 x^4}{e^2}-\\frac{145 x^3}{e^2}-\\frac{632 x^2}{e^2}-\\frac{75 x}{e^2}-\\frac{625}{e^2}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = -((19*x**2)/math.e)-((22*x)/math.e)-(25/math.e)\nq = ((23*x**2)/math.e)-((19*x)/math.e)+(25/math.e)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 11 x^2-9 x+9$ and $q(x) = 7 x^2-12 x+6$", + "Output Answer": [ + "$77 x^4-195 x^3+237 x^2-162 x+54$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 11*x**2-9*x+9\nq = 7*x**2-12*x+6\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{64 x}{5}-\\frac{53}{5}\\right| =-\\frac{86}{5}$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((64*x)/5)-(53/5)), -(86/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{63 x^2}{5}+\\frac{13 x}{5}+\\frac{32}{5}$", + "Output Answer": [ + "$x=\\frac{1}{126} \\left(-13-i \\sqrt{7895}\\right)\\lor x=\\frac{1}{126} \\left(-13+i \\sqrt{7895}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((63*x**2)/5)+((13*x)/5)+(32/5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\frac{\\sqrt{3}}{2}+\\frac{i}{2}\\right)^7$", + "Output Answer": [ + "$\\frac{\\sqrt{3}}{2}-\\frac{i}{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-((math.sqrt(3))/2)+(i/2))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $8$ and $2$.", + "Output Answer": [ + "$2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(8, 2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^2-6 x-4$ and $2$.", + "Output Answer": [ + "$2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**2-6*x-4, 2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 7 x^2-10 x+21\\right| =20$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{7} \\left(5-3 \\sqrt{2}\\right)\\right\\},\\left\\{x\\to \\frac{1}{7} \\left(5+3 \\sqrt{2}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(7*x**2-10*x+21), 20), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-3 \\left(\\cos \\left(\\frac{17}{30}\\right)+i \\sin \\left(\\frac{17}{30}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$-243 \\left(\\cos \\left(\\frac{17}{6}\\right)+i \\sin \\left(\\frac{17}{6}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-3*(math.cos((17/30))+1j*math.sin((17/30))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^4+9 x^3+x^2+9 x+2$ when divided by $-3 x^2+x-9$.", + "Output Answer": [ + "$\\frac{7 x^2}{3}-\\frac{20 x}{9}-\\frac{218}{27}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**4+9*x**3+x**2+9*x+2\nq = -3*x**2+x-9\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=2+3 i$ and $y=-7$", + "Output Answer": [ + "$-14-21 i$" + ], + "Output Program": [ + "i = 1j\nx = 2+3*i\ny = -7\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=245 t^2-1050 t+1131, x(t)=49 t^2-210 t+225$", + "Output Answer": [ + "$y=5 x+6$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 245*t**2-1050*t+1131\nx_t = 49*t**2-210*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the fifth order series of the inverse of the following function around 5:\n$5 x$", + "Output Answer": [ + "$\\frac{x-10}{5}+2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, 5*x)\nprint(solve(f, x)[0].series(y, 5, 5))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=-\\frac{11}{3}+\\frac{28 i}{3}$ and $y=8+\\frac{23 i}{3}$", + "Output Answer": [ + "$-\\frac{908}{9}+\\frac{419 i}{9}$" + ], + "Output Program": [ + "i = 1j\nx = -(11/3)+((28*i)/3)\ny = 8+((23*i)/3)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(2 \\left(\\cos \\left(\\frac{71}{45}\\right)+i \\sin \\left(\\frac{71}{45}\\right)\\right)\\right)^12$", + "Output Answer": [ + "$4096 \\left(\\cos \\left(\\frac{284}{15}\\right)+i \\sin \\left(\\frac{284}{15}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((2*(math.cos((71/45))+1j*math.sin((71/45))))**12)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $3 \\sqrt{3} x^2-2 \\sqrt{3} x+4 \\sqrt{3}$", + "Output Answer": [ + "$3 \\sqrt{3} \\left(x-\\frac{1}{3}\\right)^2+4 \\sqrt{3}-\\frac{1}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (3*math.sqrt(3)*x**2-2*math.sqrt(3)*x+4*math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^4+10 x^3-10 x^2-5 x-9$ when divided by $-9 x^3+2 x^2+5 x+8$.", + "Output Answer": [ + "$-\\frac{4 x}{9}-\\frac{98}{81}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**4+10*x**3-10*x**2-5*x-9\nq = -9*x**3+2*x**2+5*x+8\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $7 x^2-8 x-5 y^2+6 y+3=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(x-\\frac{4}{7}\\right)^2-5 \\left(y-\\frac{3}{5}\\right)^2=-\\frac{88}{35}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{4}{7} & \\frac{3}{5}-\\frac{4 \\sqrt{66}}{35} \\\\\n \\frac{4}{7} & \\frac{3}{5}+\\frac{4 \\sqrt{66}}{35} \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{\\frac{3}{7}}$\nCenter: $\\left\\{\\frac{4}{7},\\frac{3}{5}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{35} \\left(21+4 \\sqrt{35}\\right)-\\sqrt{\\frac{7}{5}} x,y=\\sqrt{\\frac{7}{5}} x+\\frac{1}{35} \\left(21-4 \\sqrt{35}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(7*x**2-8*x-5*y**2+6*y+3, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-24 x^2+188 x+252}{-72 x-84}=0$", + "Output Answer": [ + "$\\{\\{x\\to 9\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-24*x**2+188*x+252)/(-72*x-84)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6-2 x}+\\sqrt{3}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-61+16 \\sqrt{3}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6-2*x)+sqrt(3), 8), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 11 x-4| =24$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{20}{11}\\right\\},\\left\\{x\\to \\frac{28}{11}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11*x-4), 24), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -5 x^2+\\frac{23 x}{2}+\\frac{15}{2}$ and $q(x) = -\\frac{25 x^2}{2}+\\frac{17 x}{2}+\\frac{5}{2}$", + "Output Answer": [ + "$\\frac{125 x^4}{2}-\\frac{745 x^3}{4}-\\frac{17 x^2}{2}+\\frac{185 x}{2}+\\frac{75}{4}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -5*x**2+((23*x)/2)+(15/2)\nq = -((25*x**2)/2)+((17*x)/2)+(5/2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 6 \\sqrt{3} x-\\frac{26}{\\sqrt{3}}\\right| =\\frac{43}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{17}{18}\\right\\},\\left\\{x\\to \\frac{23}{6}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(6*sqrt(3)*x-(26/(sqrt(3)))), (43/(sqrt(3)))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{81} (19-15 x)^4, q(x) = -\\frac{1}{27} (10 x+21)^3$", + "Output Answer": [ + "$625 x^4-\\frac{86500 x^3}{27}+\\frac{17350 x^2}{3}-\\frac{150410 x}{27}+\\frac{102538}{81}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/81)*(19-15*x)**4\nq = -(1/27)*(10*x+21)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{47}{28}$, and $a_n=a_{n-1}+-\\frac{26}{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=28$.", + "Output Answer": [ + "$-3229$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (47/28) # initial value\nd = -(26/3) # second term\nn = 28 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (47/28) # initial value\nd = -(26/3) # second term\nn = 28 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$19 x-21 y-14 z+23=0$, $-11 x+20 y-6 z-9=0$, $-10 x-12 y+14 z-9=0$", + "Output Answer": [ + "$x=-\\frac{1514}{2595}$, $y=\\frac{688}{2595}$, $z=\\frac{2353}{5190}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((19*x-21*y-14*z+23, -11*x+20*y-6*z-9, -10*x-12*y+14*z-9)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-64 t^2+480 t-899, x(t)=16 t^2-120 t+225$", + "Output Answer": [ + "$y=1-4 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -64*t**2+480*t-899\nx_t = 16*t**2-120*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{7 x}{2}-3$ and $\\frac{9 x^2}{2}+\\frac{5}{2}$.", + "Output Answer": [ + "$\\frac{1}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((7*x)/2)-3, ((9*x**2)/2)+(5/2)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the second order series of the inverse of the following function around 2:\n$-\\frac{1331 x^3}{27}$", + "Output Answer": [ + "$-\\frac{(x+1331)^2}{5314683}+\\frac{-x-1331}{1331}+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, -((1331*x**3)/27))\nprint(solve(f, x)[0].series(y, 2, 2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^3+9 x^2+8 x+3$ when divided by $7 x^2+7 x-10$.", + "Output Answer": [ + "$\\frac{15}{7}-\\frac{6 x}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**3+9*x**2+8*x+3\nq = 7*x**2+7*x-10\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(3-4 i) \\sqrt{2}$ and $y=(6-i) \\sqrt{2}$", + "Output Answer": [ + "$(-3-3 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (3-4*i)*math.sqrt(2)\ny = (6-i)*math.sqrt(2)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{30 x^2-18 x-13}{\\pi }$, $q(x) = \\frac{-10 x^2+13 x-31}{\\pi }$", + "Output Answer": [ + "$\\frac{20 x^2}{\\pi }-\\frac{5 x}{\\pi }-\\frac{44}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((30*x**2-18*x-13)/pi)\nq = ((-10*x**2+13*x-31)/pi)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$13 \\sqrt{3} x+\\frac{43 y}{\\sqrt{3}}+4 \\sqrt{3} z-\\frac{35}{\\sqrt{3}}=0$, $-\\frac{35 x}{\\sqrt{3}}+\\frac{2 y}{\\sqrt{3}}-13 \\sqrt{3} z-11 \\sqrt{3}=0$, $-\\frac{22 x}{\\sqrt{3}}+\\frac{34 y}{\\sqrt{3}}+\\frac{14 z}{\\sqrt{3}}-\\frac{26}{\\sqrt{3}}=0$", + "Output Answer": [ + "$x=-\\frac{1619}{48509}$, $y=\\frac{51268}{48509}$, $z=-\\frac{36964}{48509}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((13*sqrt(3)*x+((43*y)/(sqrt(3)))+4*sqrt(3)*z-(35/(sqrt(3))), -((35*x)/(sqrt(3)))+((2*y)/(sqrt(3)))-13*sqrt(3)*z-11*sqrt(3), -((22*x)/(sqrt(3)))+((34*y)/(sqrt(3)))+((14*z)/(sqrt(3)))-(26/(sqrt(3))))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{30976}{49} \\left(4 t^2+15 t+14\\right)^2, x(t)=64 t^2+240 t+225$", + "Output Answer": [ + "$y=\\frac{121 x^2}{49}-\\frac{242 x}{49}+\\frac{121}{49}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (30976/49)*(4*t**2+15*t+14)**2\nx_t = 64*t**2+240*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $12 x^2+8 x-5$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(-2-\\sqrt{19}\\right)\\lor x=\\frac{1}{6} \\left(\\sqrt{19}-2\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(12*x**2+8*x-5, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-11 x+20 y-8=0$, $-x+y+10=0$", + "Output Answer": [ + "$x=\\frac{208}{9}$, $y=\\frac{118}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-11*x+20*y-8, -x+y+10), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt{4-4 x} \\tan ^{-1}(8 x+7)=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{7}{8}\\right\\},\\{x\\to 1\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(sqrt(4-4*x)*atan(8*x+7), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$24 x-24 y-14=0$, $22 x-25 y-11=0$", + "Output Answer": [ + "$x=\\frac{43}{36}$, $y=\\frac{11}{18}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((24*x-24*y-14, 22*x-25*y-11), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{147}-\\sqrt{79}\\right)+\\left(\\sqrt{148}-\\sqrt{62}\\right)$.", + "Output Answer": [ + "$7 \\sqrt{3}+2 \\sqrt{37}-\\sqrt{62}-\\sqrt{79}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(147)-sqrt(79))+(sqrt(148)-sqrt(62)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\left(((6-11)+19)^2-11\\right)+19}{(7+15)+23}$.", + "Output Answer": [ + "$\\frac{68}{15}$" + ], + "Output Program": [ + "try: \n print((((((6-11)+19)**2-11)+19)/((7+15)+23)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $12 x^2-4 x-12$", + "Output Answer": [ + "$x=\\frac{1}{6} \\left(1-\\sqrt{37}\\right)\\lor x=\\frac{1}{6} \\left(1+\\sqrt{37}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(12*x**2-4*x-12, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$3 x+18 y+6=0$, $-3 x-23 y-5=0$", + "Output Answer": [ + "$x=-\\frac{16}{5}$, $y=\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((3*x+18*y+6, -3*x-23*y-5), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 \\pi x+3 \\pi$ and $q(x) = 3 \\pi x^2-3 \\pi x-2 \\pi$", + "Output Answer": [ + "$12 \\pi ^2 x^3-3 \\pi ^2 x^2-17 \\pi ^2 x-6 \\pi ^2$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*pi*x+3*pi\nq = 3*pi*x**2-3*pi*x-2*pi\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=-\\frac{15+17 i}{\\sqrt{3}}$ and $y=\\frac{7+6 i}{\\sqrt{3}}$", + "Output Answer": [ + "$-\\frac{207}{85}-\\frac{29 i}{85}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = -((15+17*i)/(math.sqrt(3)))\ny = ((7+6*i)/(math.sqrt(3)))\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following cubic polynomial: $-8 x^3-48 x^2+1496 x+6240$", + "Output Answer": [ + "$-8 (-x-15) (-x-4) (x-13)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c, d = symbols('x a b c d')\n\n(a, b, c, d), *_ = solve(Eq(-8*x**3-48*x**2+1496*x+6240, a*(x+b)*(x+c)*(x+d)), [a,b,c,d])\n\nprint(f'{a}(x+{b})(x+{c})(x+{d})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{5}{6}$, and $a_n=a_{n-1}+-9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=10$.", + "Output Answer": [ + "$-\\frac{1190}{3}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (5/6) # initial value\nd = -9 # second term\nn = 10 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (5/6) # initial value\nd = -9 # second term\nn = 10 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-6$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=7$.", + "Output Answer": [ + "$-42$" + ], + "Output Program": [ + "a = -6 # initial value\nd = 0 # second term\nn = 7 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -6 # initial value\nd = 0 # second term\nn = 7 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{5}{4}$, and $a_n=a_{n-1}+-\\frac{14}{\\sqrt{3}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$9 \\left(-\\frac{5}{2}-\\frac{238}{\\sqrt{3}}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(5/4) # initial value\nd = -(14/(math.sqrt(3))) # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(5/4) # initial value\nd = -(14/(math.sqrt(3))) # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(4 \\left(-\\cos \\left(\\frac{\\pi }{30}\\right)-i \\sin \\left(\\frac{\\pi }{30}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$16384 \\left(-\\cos \\left(\\frac{7 \\pi }{30}\\right)-i \\sin \\left(\\frac{7 \\pi }{30}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((4*(-math.cos((math.pi/30))-1j*math.sin((math.pi/30))))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 5 x^2-14 x-3$ and $q(x) = -11 x^2+12 x+12$", + "Output Answer": [ + "$-55 x^4+214 x^3-75 x^2-204 x-36$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 5*x**2-14*x-3\nq = -11*x**2+12*x+12\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{7 x^2+13 x-13}{4 x-6}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{14} \\left(-13-\\sqrt{533}\\right)\\right\\},\\left\\{x\\to \\frac{1}{14} \\left(-13+\\sqrt{533}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((7*x**2+13*x-13)/(4*x-6)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{79}+33\\right) \\left(\\sqrt{7}-\\sqrt{40}\\right)$.", + "Output Answer": [ + "$\\left(\\sqrt{7}-2 \\sqrt{10}\\right) \\left(33+\\sqrt{79}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(79)+33)*(sqrt(7)-sqrt(40)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^2-3 x+4$ and $3 x+3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**2-3*x+4, 3*x+3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{100}{23}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$\\frac{400}{23}$" + ], + "Output Program": [ + "a = (100/23) # initial value\nd = 0 # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (100/23) # initial value\nd = 0 # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $10 x^6+19 x^5-24 x^4-43 x^3-3 x^2+14 x+15$ and $2 x^4+3 x^3-4 x^2-4 x-3$.", + "Output Answer": [ + "$2 x^4+3 x^3-4 x^2-4 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(10*x**6+19*x**5-24*x**4-43*x**3-3*x**2+14*x+15, 2*x**4+3*x**3-4*x**2-4*x-3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{18 x^2}{5}+\\frac{74 x}{5}-\\frac{11}{5}$", + "Output Answer": [ + "$\\frac{18}{5} \\left(x+\\frac{37}{18}\\right)^2-\\frac{1567}{90}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((18*x**2)/5)+((74*x)/5)-(11/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{28 x^6}{9}+\\frac{55 x^5}{9}-\\frac{85 x^4}{9}-\\frac{83 x^3}{9}+\\frac{137 x^2}{9}-\\frac{2 x}{9}-\\frac{104}{9}$ and $\\frac{4 x^4}{3}+3 x^3-\\frac{5 x^2}{3}-x+\\frac{13}{3}$.", + "Output Answer": [ + "$\\frac{4 x^4}{9}+x^3-\\frac{5 x^2}{9}-\\frac{x}{3}+\\frac{13}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((28*x**6)/9)+((55*x**5)/9)-((85*x**4)/9)-((83*x**3)/9)+((137*x**2)/9)-((2*x)/9)-(104/9), ((4*x**4)/3)+3*x**3-((5*x**2)/3)-x+(13/3)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-5 x^2+10 x+24}{11-4 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(5-\\sqrt{145}\\right)\\right\\},\\left\\{x\\to \\frac{1}{5} \\left(5+\\sqrt{145}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-5*x**2+10*x+24)/(11-4*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(\\frac{23}{4} \\left(\\sin \\left(\\frac{19 \\pi }{90}\\right)-i \\cos \\left(\\frac{19 \\pi }{90}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$\\frac{78310985281 \\left(\\sin \\left(\\frac{17 \\pi }{90}\\right)-i \\cos \\left(\\frac{17 \\pi }{90}\\right)\\right)}{65536}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint(((23/4)*(math.sin(((19*math.pi)/90))-1j*math.cos(((19*math.pi)/90))))**8)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2-2 x+y^2-9 y-5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $\\left(y-\\frac{9}{2}\\right)^2-3 \\left(x+\\frac{1}{3}\\right)^2=\\frac{299}{12}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{1}{3} & \\frac{9}{2}-\\frac{\\sqrt{299}}{3} \\\\\n -\\frac{1}{3} & \\frac{9}{2}+\\frac{\\sqrt{299}}{3} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{2}{\\sqrt{3}}$\nCenter: $\\left\\{-\\frac{1}{3},\\frac{9}{2}\\right\\}$\nAsymptotes: $\\left\\{y=-\\sqrt{3} x-\\frac{1}{\\sqrt{3}}+\\frac{9}{2},y=\\sqrt{3} x+\\frac{1}{6} \\left(27+2 \\sqrt{3}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2-2*x+y**2-9*y-5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-2 \\sqrt{2} x^2+8 \\sqrt{2} x+6 \\sqrt{2}$", + "Output Answer": [ + "$14 \\sqrt{2}-2 \\sqrt{2} (x-2)^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-2*math.sqrt(2)*x**2+8*math.sqrt(2)*x+6*math.sqrt(2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -20 x^2-6 x+13\\right| =18$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{20} \\left(-3-\\sqrt{629}\\right)\\right\\},\\left\\{x\\to \\frac{1}{20} \\left(-3+\\sqrt{629}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-20*x**2-6*x+13), 18), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-5 x^2-23 x+12}{5 x+14}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(-23-\\sqrt{769}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(-23+\\sqrt{769}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-5*x**2-23*x+12)/(5*x+14)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$2 x-15 y-16 z-7=0$, $24 y-12 z+14=0$, $-18 x+12 y+16 z+12=0$", + "Output Answer": [ + "$x=\\frac{156}{379}$, $y=-\\frac{601}{1137}$, $z=\\frac{83}{758}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((2*x-15*y-16*z-7, 24*y-12*z+14, -18*x+12*y+16*z+12)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-8 x-2}+\\sqrt{15} \\sqrt{-x}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{49} \\left(-354+24 \\sqrt{190}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-8*x-2)+sqrt(15)*sqrt(-x), 4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-8 x^2+48 x+728$", + "Output Answer": [ + "$8 (-x-7) (x-13)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-8*x**2+48*x+728, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$15 x-19 y+21=0$, $12 x+14 y+10=0$", + "Output Answer": [ + "$x=-\\frac{242}{219}$, $y=\\frac{17}{73}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((15*x-19*y+21, 12*x+14*y+10), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((3+6)+14) ((1+18)-2)$.", + "Output Answer": [ + "$391$" + ], + "Output Program": [ + "try: \n print(((3+6)+14)*((1+18)-2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{53}{27}$, and $a_n=a_{n-1}+\\frac{67}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=22$.", + "Output Answer": [ + "$\\frac{60863}{27}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (53/27) # initial value\nd = (67/7) # second term\nn = 22 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (53/27) # initial value\nd = (67/7) # second term\nn = 22 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-19 x^2-22 x+13}{-23 x^2-17 x+11}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{19} \\left(-11-4 \\sqrt{23}\\right)\\right\\},\\left\\{x\\to \\frac{1}{19} \\left(-11+4 \\sqrt{23}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-19*x**2-22*x+13)/(-23*x**2-17*x+11)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{13}{18}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=24$.", + "Output Answer": [ + "$-\\frac{52}{3}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(13/18) # initial value\nd = 0 # second term\nn = 24 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(13/18) # initial value\nd = 0 # second term\nn = 24 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $5 x^2+10 x-12$", + "Output Answer": [ + "$5 (x+1)^2-17$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (5*x**2+10*x-12), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -23 x^2+13 x-5\\right| =4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{46} \\left(13-\\sqrt{77}\\right)\\right\\},\\left\\{x\\to \\frac{1}{46} \\left(13+\\sqrt{77}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-23*x**2+13*x-5), 4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4 x$ and $-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4*x, -1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $2 \\sqrt{5} x^2+\\sqrt{5} x-3 \\sqrt{5}$", + "Output Answer": [ + "$x=-\\frac{3}{2}\\lor x=1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(2*sqrt(5)*x**2+sqrt(5)*x-3*sqrt(5), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^6-6 x^5+4 x^4+11 x^3-6 x^2-13 x+5$ and $2 x^4+x^3-2 x^2-3 x+5$.", + "Output Answer": [ + "$2 x^4+x^3-2 x^2-3 x+5$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**6-6*x**5+4*x**4+11*x**3-6*x**2-13*x+5, 2*x**4+x**3-2*x**2-3*x+5))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=9 \\left(16 t^2+120 t+227\\right)^2, x(t)=16 t^2+120 t+225$", + "Output Answer": [ + "$y=9 x^2+36 x+36$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 9*(16*t**2+120*t+227)**2\nx_t = 16*t**2+120*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{65}{37}$, and $a_n=a_{n-1}+9$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=18$.", + "Output Answer": [ + "$\\frac{52119}{37}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (65/37) # initial value\nd = 9 # second term\nn = 18 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (65/37) # initial value\nd = 9 # second term\nn = 18 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-5 x^3-10 x^2+3 x+2$ when divided by $-4 x^3+4 x^2+9$.", + "Output Answer": [ + "$\\frac{5}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -5*x**3-10*x**2+3*x+2\nq = -4*x**3+4*x**2+9\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $6 \\sqrt{2} e^{-\\frac{67 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $6 \\sqrt{2}$\nArgument: $-\\frac{67 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 6*math.sqrt(2)*math.e**(-((67*i*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4 x^5-3 x^4-22 x^3-10 x^2-12 x-9$ and $-x^3-x^2-5 x-3$.", + "Output Answer": [ + "$x^3+x^2+5 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4*x**5-3*x**4-22*x**3-10*x**2-12*x-9, -x**3-x**2-5*x-3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $14 x-4 x^2$", + "Output Answer": [ + "$x=\\frac{7}{2}\\lor x=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(14*x-4*x**2, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{17}{20}$, and $a_n=a_{n-1}+-4$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$-743$" + ], + "Output Program": [ + "a = (17/20) # initial value\nd = -4 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (17/20) # initial value\nd = -4 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{26 x^2}{3}+5 x-\\frac{37}{3}$", + "Output Answer": [ + "$\\frac{26}{3} \\left(x+\\frac{15}{52}\\right)^2-\\frac{4073}{312}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((26*x**2)/3)+5*x-(37/3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-10 e^{\\frac{41 i \\pi }{90}}$.", + "Output Answer": [ + "Norm: $10$\nArgument: $-\\frac{49 \\pi }{90}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -10*math.e**((41*i*math.pi)/90)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$5 x-12 y+5 z-7=0$, $-2 x+16 y+13 z+2=0$, $7 x-23 y-19 z+1=0$", + "Output Answer": [ + "$x=-\\frac{887}{991}$, $y=-\\frac{706}{991}$, $z=\\frac{580}{991}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((5*x-12*y+5*z-7, -2*x+16*y+13*z+2, 7*x-23*y-19*z+1)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $4 e^{\\frac{i \\pi }{9}}$.", + "Output Answer": [ + "Norm: $4$\nArgument: $\\frac{\\pi }{9}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 4*math.e**((i*math.pi)/9)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2+6 x-8 y^2+y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(x+\\frac{1}{2}\\right)^2-8 \\left(y-\\frac{1}{16}\\right)^2=\\frac{303}{32}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{16} \\left(-8-\\sqrt{707}\\right) & \\frac{1}{16} \\\\\n \\frac{1}{16} \\left(\\sqrt{707}-8\\right) & \\frac{1}{16} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{7}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{16} \\left(-8-\\sqrt{707}\\right)+\\frac{1}{16} \\left(\\sqrt{707}-8\\right)\\right),\\frac{1}{16}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{\\sqrt{3} x}{2}+\\frac{1}{16} \\left(1+4 \\sqrt{3}\\right),y=\\frac{1}{16} \\left(1-4 \\sqrt{3}\\right)-\\frac{\\sqrt{3} x}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2+6*x-8*y**2+y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $\\frac{11 x^5}{2}-x^4+\\frac{7 x^3}{2}+\\frac{3 x^2}{2}-9 x+\\frac{5}{2}$ when divided by $x^4+4 x^3-6 x^2-\\frac{x}{2}-3$.", + "Output Answer": [ + "$\\frac{11 x}{2}-23$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((11*x**5)/2)-x**4+((7*x**3)/2)+((3*x**2)/2)-9*x+(5/2)\nq = x**4+4*x**3-6*x**2-(x/2)-3\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-23 x-11 y-20=0$, $-12 x+8 y+21=0$", + "Output Answer": [ + "$x=\\frac{71}{316}$, $y=-\\frac{723}{316}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-23*x-11*y-20, -12*x+8*y+21), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-18 t-5 \\sqrt{3}-81, x(t)=-2 \\sqrt{3} t-9 \\sqrt{3}$", + "Output Answer": [ + "$y=3 \\sqrt{3} x-5 \\sqrt{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -18*t-5*sqrt(3)-81\nx_t = -2*sqrt(3)*t-9*sqrt(3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{29}{3}$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$\\frac{11339}{3}$" + ], + "Output Program": [ + "a = -(29/3) # initial value\nd = 10 # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(29/3) # initial value\nd = 10 # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2+\\frac{11 x}{\\sqrt{3}}+190$", + "Output Answer": [ + "$-\\left(\\left(x+\\frac{19}{\\sqrt{3}}\\right) \\left(x-10 \\sqrt{3}\\right)\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2+((11*x)/(sqrt(3)))+190, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{1}{2}$, and $a_n=a_{n-1}+-6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$-\\frac{125}{2}$" + ], + "Output Program": [ + "a = -(1/2) # initial value\nd = -6 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(1/2) # initial value\nd = -6 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-10 x^4+19 x^3+2 x^2-8 x-6$ and $-5 x^3+2 x^2+4 x+2$.", + "Output Answer": [ + "$5 x^3-2 x^2-4 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-10*x**4+19*x**3+2*x**2-8*x-6, -5*x**3+2*x**2+4*x+2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $5 x^2+6 x-9 y^2-2 y+8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $5 \\left(x+\\frac{3}{5}\\right)^2-9 \\left(y+\\frac{1}{9}\\right)^2=-\\frac{284}{45}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{5} & \\frac{1}{45} \\left(-5-2 \\sqrt{994}\\right) \\\\\n -\\frac{3}{5} & \\frac{1}{45} \\left(2 \\sqrt{994}-5\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{14}{5}}$\nCenter: $\\left\\{-\\frac{3}{5},\\frac{1}{2} \\left(\\frac{1}{45} \\left(-5-2 \\sqrt{994}\\right)+\\frac{1}{45} \\left(2 \\sqrt{994}-5\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\frac{\\sqrt{5} x}{3}-\\frac{1}{\\sqrt{5}}-\\frac{1}{9},y=\\frac{\\sqrt{5} x}{3}+\\frac{1}{45} \\left(9 \\sqrt{5}-5\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(5*x**2+6*x-9*y**2-2*y+8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=47-9 t, x(t)=3 t-15$", + "Output Answer": [ + "$y=2-3 x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 47-9*t\nx_t = 3*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-2 x^2+2 y^2-2 y-6=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $2 \\left(y-\\frac{1}{2}\\right)^2-2 x^2=\\frac{13}{2}$\nFoci: $\\left(\n\\begin{array}{cc}\n 0 & \\frac{1}{2} \\left(1-\\sqrt{26}\\right) \\\\\n 0 & \\frac{1}{2} \\left(1+\\sqrt{26}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{0,\\frac{1}{2} \\left(\\frac{1}{2} \\left(1-\\sqrt{26}\\right)+\\frac{1}{2} \\left(1+\\sqrt{26}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{2}-x,y=x+\\frac{1}{2}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x**2+2*y**2-2*y-6, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{43}{33}$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=26$.", + "Output Answer": [ + "$-\\frac{84682}{33}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (43/33) # initial value\nd = -8 # second term\nn = 26 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (43/33) # initial value\nd = -8 # second term\nn = 26 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((6+6)-24)-\\left(\\frac{13+24}{12}-23\\right)$.", + "Output Answer": [ + "$\\frac{95}{12}$" + ], + "Output Program": [ + "try: \n print(((6+6)-24)-(((13+24)/12)-23))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-\\frac{25 x^3}{2}+\\frac{135 x^2}{4}-\\frac{75 x}{4}+\\frac{5}{2}$ and $5 x^2-\\frac{7 x}{2}+\\frac{1}{2}$.", + "Output Answer": [ + "$\\frac{5 x^2}{2}-\\frac{7 x}{4}+\\frac{1}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-((25*x**3)/2)+((135*x**2)/4)-((75*x)/4)+(5/2), 5*x**2-((7*x)/2)+(1/2)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^5-5 x^4+4 x^3-6 x^2+8 x+2$ when divided by $-7 x^3+10 x^2-10 x-6$.", + "Output Answer": [ + "$\\frac{2 x^2}{7}+\\frac{55 x}{49}+\\frac{214}{343}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**5-5*x**4+4*x**3-6*x**2+8*x+2\nq = -7*x**3+10*x**2-10*x-6\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4$ and $-5 x^3-4 x+4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4, -5*x**3-4*x+4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-x^2-7 x-11}{-24 x^2-14 x-12}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-7-\\sqrt{5}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(-7+\\sqrt{5}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-x**2-7*x-11)/(-24*x**2-14*x-12)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (8, 7, \\pi)$", + "Output Answer": [ + "$\\left\\{\\sqrt{113+\\pi ^2},\\tan ^{-1}\\left(\\frac{\\sqrt{113}}{\\pi }\\right),\\tan ^{-1}\\left(\\frac{7}{8}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 8\ny = 7\nz = math.pi\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{1}{25}$, and $a_n=a_{n-1}+10$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$\\frac{22736}{25}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(1/25) # initial value\nd = 10 # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(1/25) # initial value\nd = 10 # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $12 x^2-x+12$", + "Output Answer": [ + "$12 \\left(x-\\frac{1}{24}\\right)^2+\\frac{575}{48}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (12*x**2-x+12), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{x+10}+\\sqrt{3 x-\\frac{17}{2}}=\\frac{29}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{8} \\left(1756-29 \\sqrt{2831}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(x+10)+sqrt(3*x-(17/2)), (29/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $1-x$ and $x-2 x^2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(1-x, x-2*x**2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{3}{5}-\\frac{37 i}{5}$ and $y=\\frac{27}{5}-\\frac{13 i}{5}$", + "Output Answer": [ + "$-\\frac{24}{5}-\\frac{24 i}{5}$" + ], + "Output Program": [ + "i = 1j\nx = (3/5)-((37*i)/5)\ny = (27/5)-((13*i)/5)\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\frac{x^2}{2}+\\frac{11 x}{2}+4$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(-11-\\sqrt{89}\\right)\\lor x=\\frac{1}{2} \\left(\\sqrt{89}-11\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((x**2)/2)+((11*x)/2)+4, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{1-2 x} \\sqrt[3]{2-6 x^2}$ at the point $x=-6$", + "Output Answer": [ + "$-\\sqrt{13} \\sqrt[3]{214} = -21.566$" + ], + "Output Program": [ + "import numpy as np\n\nimport math\n\nx = -6\ntry: \n f = math.sqrt(1-2*x)*np.cbrt(2-6*x**2)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^2-4 x+5$ and $-4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**2-4*x+5, -4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-2$ and $x^5-x^4+x^3-4 x^2-5 x-4$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-2, x**5-x**4+x**3-4*x**2-5*x-4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -2.982 x^2-13.387 x-5.827$, $q(x) = 9.333 x^2+4.776 x+1.319$", + "Output Answer": [ + "$6.351 x^2-8.611 x-4.508$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2.982*x**2-13.387*x-5.827\nq = 9.333*x**2+4.776*x+1.319\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{20}{17}$, and $a_n=a_{n-1}+-2$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=20$.", + "Output Answer": [ + "$-\\frac{6860}{17}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(20/17) # initial value\nd = -2 # second term\nn = 20 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(20/17) # initial value\nd = -2 # second term\nn = 20 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{4 x^2}{\\sqrt{3}}-2 \\sqrt{3} x+5 \\sqrt{3}\\right| =\\frac{16}{\\sqrt{3}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(3-\\sqrt{13}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(3+\\sqrt{13}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((4*x**2)/(sqrt(3)))-2*sqrt(3)*x+5*sqrt(3)), (16/(sqrt(3)))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{4}{63}$, and $a_n=a_{n-1}+-2 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=29$.", + "Output Answer": [ + "$\\frac{29}{2} \\left(-\\frac{8}{63}-56 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(4/63) # initial value\nd = -2*math.sqrt(3) # second term\nn = 29 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = -(4/63) # initial value\nd = -2*math.sqrt(3) # second term\nn = 29 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$\\sqrt[3]{2 x-2}$", + "Output Answer": [ + "$x\\in \\mathbb{R}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = cbrt(2*x-2)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{13 x^2}{7}-14 x+\\frac{40}{7}$", + "Output Answer": [ + "$x=\\frac{1}{13} \\left(-49-\\sqrt{2921}\\right)\\lor x=\\frac{1}{13} \\left(\\sqrt{2921}-49\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((13*x**2)/7)-14*x+(40/7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5-x}+\\sqrt{7 x-14}=3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{32} \\left(103-3 \\sqrt{105}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5-x)+sqrt(7*x-14), 3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-x^2-5 x+7 y^2-5 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $7 \\left(y-\\frac{5}{14}\\right)^2-\\left(x+\\frac{5}{2}\\right)^2=\\frac{51}{14}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{2} & \\frac{1}{14} \\left(5-4 \\sqrt{51}\\right) \\\\\n -\\frac{5}{2} & \\frac{1}{14} \\left(5+4 \\sqrt{51}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $2 \\sqrt{2}$\nCenter: $\\left\\{-\\frac{5}{2},\\frac{1}{2} \\left(\\frac{1}{14} \\left(5-4 \\sqrt{51}\\right)+\\frac{1}{14} \\left(5+4 \\sqrt{51}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-\\frac{x}{\\sqrt{7}}-\\frac{5}{14} \\left(\\sqrt{7}-1\\right),y=\\frac{x}{\\sqrt{7}}+\\frac{5}{14} \\left(1+\\sqrt{7}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-x**2-5*x+7*y**2-5*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{4 x+9}+\\sqrt{11 x+3}=8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{2}{49} \\left(501-40 \\sqrt{137}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(4*x+9)+sqrt(11*x+3), 8), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{25 x^2}{\\sqrt{3}}+\\frac{5 x}{\\sqrt{3}}-3 \\sqrt{3}\\right| =10 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(-1-\\sqrt{157}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(-1+\\sqrt{157}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((25*x**2)/(sqrt(3)))+((5*x)/(sqrt(3)))-3*sqrt(3)), 10*sqrt(3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-5 x^2-10 x+4 y^2-9 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $4 \\left(y-\\frac{9}{8}\\right)^2-5 (x+1)^2=\\frac{113}{16}$\nFoci: $\\left(\n\\begin{array}{cc}\n -1 & -\\frac{3}{40} \\left(\\sqrt{565}-15\\right) \\\\\n -1 & \\frac{3}{40} \\left(15+\\sqrt{565}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{3}{\\sqrt{5}}$\nCenter: $\\left\\{-1,\\frac{1}{2} \\left(\\frac{3}{40} \\left(15+\\sqrt{565}\\right)-\\frac{3}{40} \\left(\\sqrt{565}-15\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{8} \\left(9-4 \\sqrt{5}\\right)-\\frac{\\sqrt{5} x}{2},y=\\frac{\\sqrt{5} x}{2}+\\frac{1}{8} \\left(9+4 \\sqrt{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-5*x**2-10*x+4*y**2-9*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -24 x^2-18 x-10\\right| =15$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{24} \\left(-9-\\sqrt{201}\\right)\\right\\},\\left\\{x\\to \\frac{1}{24} \\left(-9+\\sqrt{201}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-24*x**2-18*x-10), 15), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(8 \\left(-\\cos \\left(\\frac{\\pi }{90}\\right)-i \\sin \\left(\\frac{\\pi }{90}\\right)\\right)\\right)^11$", + "Output Answer": [ + "$8589934592 \\left(-\\cos \\left(\\frac{11 \\pi }{90}\\right)-i \\sin \\left(\\frac{11 \\pi }{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((8*(-math.cos((math.pi/90))-1j*math.sin((math.pi/90))))**11)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{11}{27}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=5$.", + "Output Answer": [ + "$-\\frac{55}{27}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(11/27) # initial value\nd = 0 # second term\nn = 5 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(11/27) # initial value\nd = 0 # second term\nn = 5 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-3 x^2+5 x+8 y^2-10 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y-\\frac{5}{8}\\right)^2-3 \\left(x-\\frac{5}{6}\\right)^2=-\\frac{95}{24}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{5}{6}-\\frac{\\sqrt{1045}}{24} & \\frac{5}{8} \\\\\n \\frac{1}{24} \\left(20+\\sqrt{1045}\\right) & \\frac{5}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{11}{2}}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{5}{6}-\\frac{\\sqrt{1045}}{24}+\\frac{1}{24} \\left(20+\\sqrt{1045}\\right)\\right),\\frac{5}{8}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{1}{2} \\sqrt{\\frac{3}{2}} x-\\frac{5}{24} \\left(\\sqrt{6}-3\\right),y=\\frac{5}{24} \\left(3+\\sqrt{6}\\right)-\\frac{1}{2} \\sqrt{\\frac{3}{2}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-3*x**2+5*x+8*y**2-10*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-2 x^2+12 x+2$", + "Output Answer": [ + "$x=3-\\sqrt{10}\\lor x=3+\\sqrt{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-2*x**2+12*x+2, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=8+\\frac{15 i}{2}$ and $y=\\frac{3}{2}+\\frac{19 i}{2}$", + "Output Answer": [ + "$-\\frac{237}{4}+\\frac{349 i}{4}$" + ], + "Output Program": [ + "i = 1j\nx = 8+((15*i)/2)\ny = (3/2)+((19*i)/2)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\left(\\left((20+6)^2+16\\right)+25\\right)-1}{((24-10)-18)+13}$.", + "Output Answer": [ + "$\\frac{716}{9}$" + ], + "Output Program": [ + "try: \n print((((((20+6)**2+16)+25)-1)/(((24-10)-18)+13)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$17 x-6 y+2=0$, $-3 x+20 y+3=0$", + "Output Answer": [ + "$x=-\\frac{29}{161}$, $y=-\\frac{57}{322}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((17*x-6*y+2, -3*x+20*y+3), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(\\cos \\left(\\frac{5}{9}\\right)+i \\sin \\left(\\frac{5}{9}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$256 \\left(\\cos \\left(\\frac{40}{9}\\right)+i \\sin \\left(\\frac{40}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(math.cos((5/9))+1j*math.sin((5/9))))**8)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-8 x-\\frac{151 y}{7}-18 z+\\frac{127}{7}=0$, $\\frac{67 x}{7}+\\frac{113 y}{7}+\\frac{157 z}{7}-\\frac{88}{7}=0$, $\\frac{162 x}{7}-\\frac{64 y}{7}-21 z-\\frac{41}{7}=0$", + "Output Answer": [ + "$x=\\frac{798432}{2113361}$, $y=\\frac{1945919}{2113361}$, $z=-\\frac{556739}{2113361}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-8*x-((151*y)/7)-18*z+(127/7), ((67*x)/7)+((113*y)/7)+((157*z)/7)-(88/7), ((162*x)/7)-((64*y)/7)-21*z-(41/7))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(6 \\left(\\cos \\left(\\frac{11}{45}\\right)+i \\sin \\left(\\frac{11}{45}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$7776 \\left(\\cos \\left(\\frac{11}{9}\\right)+i \\sin \\left(\\frac{11}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((6*(math.cos((11/45))+1j*math.sin((11/45))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{71}{27}$, and $a_n=a_{n-1}+-\\frac{21}{5}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$-\\frac{46627}{135}$" + ], + "Output Program": [ + "a = (71/27) # initial value\nd = -(21/5) # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (71/27) # initial value\nd = -(21/5) # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(9 \\left(\\cos \\left(\\frac{109}{90}\\right)+i \\sin \\left(\\frac{109}{90}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$43046721 \\left(\\cos \\left(\\frac{436}{45}\\right)+i \\sin \\left(\\frac{436}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((9*(math.cos((109/90))+1j*math.sin((109/90))))**8)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{49 x^2}{4}+3 x+\\frac{11}{4}$", + "Output Answer": [ + "$x=\\frac{1}{49} \\left(6-5 \\sqrt{23}\\right)\\lor x=\\frac{1}{49} \\left(6+5 \\sqrt{23}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((49*x**2)/4)+3*x+(11/4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 13 x^2-8 x+14$, $q(x) = 13 x^2-11 x-10$", + "Output Answer": [ + "$26 x^2-19 x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 13*x**2-8*x+14\nq = 13*x**2-11*x-10\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{13}{10}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=16$.", + "Output Answer": [ + "$\\frac{104}{5}$" + ], + "Output Program": [ + "a = (13/10) # initial value\nd = 0 # second term\nn = 16 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (13/10) # initial value\nd = 0 # second term\nn = 16 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-4 \\left(-\\cos \\left(\\frac{\\pi }{15}\\right)+i \\sin \\left(\\frac{\\pi }{15}\\right)\\right)$.", + "Output Answer": [ + "Norm: $4 \\sqrt{\\sin ^2\\left(\\frac{\\pi }{15}\\right)+\\cos ^2\\left(\\frac{\\pi }{15}\\right)}$\nArgument: $-\\frac{\\pi }{15}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -4*(-math.cos((math.pi/15))+i*math.sin((math.pi/15)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$\\frac{48 x}{5}+13 y+\\frac{104 z}{5}-5=0$, $\\frac{26 x}{5}-\\frac{27 y}{5}-\\frac{44 z}{5}-\\frac{122}{5}=0$, $\\frac{18 x}{5}-\\frac{y}{5}-\\frac{111 z}{5}-\\frac{58}{5}=0$", + "Output Answer": [ + "$x=\\frac{938351}{325694}$, $y=-\\frac{273361}{162847}$, $z=-\\frac{6546}{162847}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((((48*x)/5)+13*y+((104*z)/5)-5, ((26*x)/5)-((27*y)/5)-((44*z)/5)-(122/5), ((18*x)/5)-(y/5)-((111*z)/5)-(58/5))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{11 x+5}+\\sqrt{14 x-6}=10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(2533-160 \\sqrt{247}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(11*x+5)+sqrt(14*x-6), 10), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-6 x^5+4 x^4+5 x^3+10 x^2+4 x-1$ when divided by $-5 x^4-6 x^3-5 x^2+8 x-9$.", + "Output Answer": [ + "$\\frac{6 x}{5}-\\frac{56}{25}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -6*x**5+4*x**4+5*x**3+10*x**2+4*x-1\nq = -5*x**4-6*x**3-5*x**2+8*x-9\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-6 x^2+9 x-3$ and $3 x-3$.", + "Output Answer": [ + "$3 x-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-6*x**2+9*x-3, 3*x-3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 18 x+4| =8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{2}{3}\\right\\},\\left\\{x\\to \\frac{2}{9}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(18*x+4), 8), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\sqrt{2} \\left(\\cos \\left(\\frac{\\pi }{9}\\right)-i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1934917632 \\left(-\\cos \\left(\\frac{\\pi }{9}\\right)+i \\sin \\left(\\frac{\\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*math.sqrt(2)*(math.cos((math.pi/9))-1j*math.sin((math.pi/9))))**10)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2+2 y+5=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $10 x^2+2 y=-5$\nVertex: $\\left\\{0,-\\frac{5}{2}\\right\\}$\nDirectrix: $y=-\\frac{49}{20}$\nFocal Parameter: $\\frac{1}{10}$\nFocus: $\\left\\{0,-\\frac{51}{20}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2+2*y+5, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{6-5 x}+\\sqrt{14-2 x}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{9} \\left(-1207+52 \\sqrt{466}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(6-5*x)+sqrt(14-2*x), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 9 x^2+8 x+15$, $q(x) = -7 x^2+5 x+9$", + "Output Answer": [ + "$2 x^2+13 x+24$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**2+8*x+15\nq = -7*x**2+5*x+9\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-\\frac{9 x^2}{\\sqrt{2}}-\\frac{27 x}{\\sqrt{2}}+\\frac{27}{\\sqrt{2}}}{\\frac{7 x^2}{\\sqrt{2}}+3 \\sqrt{2} x-\\frac{19}{\\sqrt{2}}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-3-\\sqrt{21}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(-3+\\sqrt{21}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-((9*x**2)/(sqrt(2)))-((27*x)/(sqrt(2)))+(27/(sqrt(2))))/(((7*x**2)/(sqrt(2)))+3*sqrt(2)*x-(19/(sqrt(2))))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $4 x^3-8 x^2-7 x$ when divided by $8$.", + "Output Answer": [ + "$\\frac{x^3}{2}-x^2-\\frac{7 x}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*x**3-8*x**2-7*x\nq = 8\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-2 x^4-6 x^3+2 x^2+x-6$ when divided by $-2 x^3-3 x^2-5 x-8$.", + "Output Answer": [ + "$x+\\frac{3}{2}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -2*x**4-6*x**3+2*x**2+x-6\nq = -2*x**3-3*x**2-5*x-8\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{16 x^2-21 x-11}{21 x-20}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{32} \\left(21-\\sqrt{1145}\\right)\\right\\},\\left\\{x\\to \\frac{1}{32} \\left(21+\\sqrt{1145}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((16*x**2-21*x-11)/(21*x-20)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{25}{36}$, and $a_n=a_{n-1}+\\sqrt{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=14$.", + "Output Answer": [ + "$7 \\left(13 \\sqrt{2}-\\frac{25}{18}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(25/36) # initial value\nd = math.sqrt(2) # second term\nn = 14 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(25/36) # initial value\nd = math.sqrt(2) # second term\nn = 14 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $6 x^5+9 x^4+3 x^3+5 x^2+x+10$ when divided by $-x^4-8 x^3-4 x^2-7 x-9$.", + "Output Answer": [ + "$39-6 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 6*x**5+9*x**4+3*x**3+5*x**2+x+10\nq = -x**4-8*x**3-4*x**2-7*x-9\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $9 x^4-18 x^3+17 x^2-9 x+2$ and $-3 x^3+4 x^2-3 x+1$.", + "Output Answer": [ + "$3 x^3-4 x^2+3 x-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(9*x**4-18*x**3+17*x**2-9*x+2, -3*x**3+4*x**2-3*x+1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{13}{2}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=27$.", + "Output Answer": [ + "$\\frac{351}{2}$" + ], + "Output Program": [ + "a = (13/2) # initial value\nd = 0 # second term\nn = 27 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (13/2) # initial value\nd = 0 # second term\nn = 27 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{11 t^2-462 t+4845}{2 \\sqrt{2}}, x(t)=\\frac{t^2}{2}-21 t+\\frac{441}{2}$", + "Output Answer": [ + "$y=\\frac{11 x}{\\sqrt{2}}-\\frac{3}{\\sqrt{2}}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = ((11*t**2-462*t+4845)/(2*sqrt(2)))\nx_t = ((t**2)/2)-21*t+(441/2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-3 x-3$ and $2 x^2+4 x+3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-3*x-3, 2*x**2+4*x+3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{\\frac{82 x^2}{7}+\\frac{156 x}{7}-\\frac{108}{7}}{\\frac{62 x^2}{7}-\\frac{64 x}{7}+\\frac{160}{7}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{41} \\left(-39-3 \\sqrt{415}\\right)\\right\\},\\left\\{x\\to \\frac{1}{41} \\left(-39+3 \\sqrt{415}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((((82*x**2)/7)+((156*x)/7)-(108/7))/(((62*x**2)/7)-((64*x)/7)+(160/7))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -8 (2 x-1)^3, q(x) = (2 x+7)^3$", + "Output Answer": [ + "$-56 x^3+180 x^2+246 x+351$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -8*(2*x-1)**3\nq = (2*x+7)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\sqrt{2} e^{-\\frac{i \\pi }{3}}$.", + "Output Answer": [ + "Norm: $\\sqrt{2}$\nArgument: $-\\frac{\\pi }{3}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = math.sqrt(2)*math.e**(-((i*math.pi)/3))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $4$ and $x^2-2 x+2$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(4, x**2-2*x+2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x-11}+\\sqrt{15 x-3}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(330-13 \\sqrt{447}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x-11)+sqrt(15*x-3), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{(22+21)^2}{16+16}$.", + "Output Answer": [ + "$\\frac{1849}{32}$" + ], + "Output Program": [ + "try: \n print((((22+21)**2)/(16+16)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5 x-\\frac{3}{2}}+\\sqrt{10 x-\\frac{3}{4}}=\\frac{11}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{80} \\left(351-22 \\sqrt{206}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5*x-(3/2))+sqrt(10*x-(3/4)), (11/4)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $x^2-33 x+272$", + "Output Answer": [ + "$-((17-x) (x-16))$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(x**2-33*x+272, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-6 x^2+\\frac{56 x}{5}-\\frac{63}{5}$", + "Output Answer": [ + "$-6 \\left(x-\\frac{14}{15}\\right)^2-\\frac{553}{75}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-6*x**2+((56*x)/5)-(63/5)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-16 x^2+2 x+20}{22 x+10}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{16} \\left(1-\\sqrt{321}\\right)\\right\\},\\left\\{x\\to \\frac{1}{16} \\left(1+\\sqrt{321}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-16*x**2+2*x+20)/(22*x+10)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{15 \\sqrt{2} x^2+10 \\sqrt{2} x+11 \\sqrt{2}}{-9 \\sqrt{2} x-9 \\sqrt{2}}=0$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((15*sqrt(2)*x**2+10*sqrt(2)*x+11*sqrt(2))/(-9*sqrt(2)*x-9*sqrt(2))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-4 x^2-8 x-4$", + "Output Answer": [ + "$-4 (x+1)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-4*x**2-8*x-4), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{6 x^2}{\\sqrt{\\pi }}+\\frac{11 x}{\\sqrt{\\pi }}+\\frac{19}{\\sqrt{\\pi }}$ and $q(x) = \\frac{6 x^2}{\\sqrt{\\pi }}+\\frac{10 x}{\\sqrt{\\pi }}+\\frac{8}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{36 x^4}{\\pi }+\\frac{126 x^3}{\\pi }+\\frac{272 x^2}{\\pi }+\\frac{278 x}{\\pi }+\\frac{152}{\\pi }$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((6*x**2)/(sqrt(pi)))+((11*x)/(sqrt(pi)))+(19/(sqrt(pi)))\nq = ((6*x**2)/(sqrt(pi)))+((10*x)/(sqrt(pi)))+(8/(sqrt(pi)))\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$8 e^{2 x^4-3}$", + "Output Answer": [ + "$y\\geq \\frac{8}{e^3}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(8*math.e**(2*x**4-3), x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the first order series of the inverse of the following function around 1:\n$\\sin \\left(4 x^3\\right)$", + "Output Answer": [ + "$\\frac{1}{108} \\sec (108) (x+\\sin (108))-3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nf = Eq(y, sin(4*x**3))\nprint(solve(f, x)[0].series(y, 1, 1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(5 \\sqrt{3} \\left(-\\cos \\left(\\frac{4 \\pi }{45}\\right)-i \\sin \\left(\\frac{4 \\pi }{45}\\right)\\right)\\right)^5$", + "Output Answer": [ + "$28125 \\sqrt{3} \\left(-\\sin \\left(\\frac{\\pi }{18}\\right)-i \\cos \\left(\\frac{\\pi }{18}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((5*math.sqrt(3)*(-math.cos(((4*math.pi)/45))-1j*math.sin(((4*math.pi)/45))))**5)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4 (x+2), q(x) = 16 (3-4 x)^4$", + "Output Answer": [ + "$4096 x^4-12288 x^3+13824 x^2-6908 x+1304$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4*(x+2)\nq = 16*(3-4*x)**4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-7 x^3+7 x^2-7 x-9$ when divided by $-3 x^2-x+4$.", + "Output Answer": [ + "$\\frac{7 x}{3}-\\frac{28}{9}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -7*x**3+7*x**2-7*x-9\nq = -3*x**2-x+4\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-6 x^2-90 x+96$", + "Output Answer": [ + "$6 (-x-16) (x-1)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-6*x**2-90*x+96, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-3 x^3-6 x^2+7 x-6$ when divided by $3-7 x^2$.", + "Output Answer": [ + "$\\frac{3 x}{7}+\\frac{6}{7}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x**3-6*x**2+7*x-6\nq = 3-7*x**2\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-1-4 i) \\sqrt{2}$ and $y=7 \\sqrt{2}$", + "Output Answer": [ + "$-\\frac{1}{7}-\\frac{4 i}{7}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-1-4*i)*math.sqrt(2)\ny = 7*math.sqrt(2)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\sqrt{3} e^{\\frac{17 i \\pi }{18}}$.", + "Output Answer": [ + "Norm: $\\sqrt{3}$\nArgument: $-\\frac{\\pi }{18}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -math.sqrt(3)*math.e**((17*i*math.pi)/18)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $7 x^2+2 x+6$", + "Output Answer": [ + "$7 \\left(x+\\frac{1}{7}\\right)^2+\\frac{41}{7}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (7*x**2+2*x+6), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^4-6 x^3-6 x^2+18 x+8$ and $-2 x^2+4 x+2$.", + "Output Answer": [ + "$2 x^2-4 x-2$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**4-6*x**3-6*x**2+18*x+8, -2*x**2+4*x+2))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{5-10 x}+\\sqrt{2-4 x}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(-103+32 \\sqrt{10}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(5-10*x)+sqrt(2-4*x), 4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{7-5 x}+\\sqrt{4-2 x}=3$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -6+4 \\sqrt{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(7-5*x)+sqrt(4-2*x), 3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-9 x^2-10 x+9 y^2-y-10=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $9 \\left(y-\\frac{1}{18}\\right)^2-9 \\left(x+\\frac{5}{9}\\right)^2=\\frac{29}{4}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{9} & \\frac{1}{18} \\left(1-3 \\sqrt{58}\\right) \\\\\n -\\frac{5}{9} & \\frac{1}{18} \\left(1+3 \\sqrt{58}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{2}$\nCenter: $\\left\\{-\\frac{5}{9},\\frac{1}{2} \\left(\\frac{1}{18} \\left(1-3 \\sqrt{58}\\right)+\\frac{1}{18} \\left(1+3 \\sqrt{58}\\right)\\right)\\right\\}$\nAsymptotes: $\\left\\{y=-x-\\frac{1}{2},y=x+\\frac{11}{18}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-9*x**2-10*x+9*y**2-y-10, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{((6+17)-8)+8}{((20-1)-4)-25}$.", + "Output Answer": [ + "$-\\frac{23}{10}$" + ], + "Output Program": [ + "try: \n print(((((6+17)-8)+8)/(((20-1)-4)-25)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=6 t-3 \\sqrt{2}+22, x(t)=-3 \\sqrt{2} t-11 \\sqrt{2}$", + "Output Answer": [ + "$y=-\\sqrt{2} x-3 \\sqrt{2}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 6*t-3*sqrt(2)+22\nx_t = -3*sqrt(2)*t-11*sqrt(2)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((2-9)+10) (25-25)$.", + "Output Answer": [ + "$0$" + ], + "Output Program": [ + "try: \n print(((2-9)+10)*(25-25))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $2 x-7 x^2$", + "Output Answer": [ + "$\\frac{1}{7}-7 \\left(x-\\frac{1}{7}\\right)^2$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (2*x-7*x**2), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{25 x^2-16 x-24}{-4 x^2+11 x-14}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{25} \\left(8-2 \\sqrt{166}\\right)\\right\\},\\left\\{x\\to \\frac{1}{25} \\left(8+2 \\sqrt{166}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((25*x**2-16*x-24)/(-4*x**2+11*x-14)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{6-13}{(((4+15)+19)-12)+11}$.", + "Output Answer": [ + "$-\\frac{7}{37}$" + ], + "Output Program": [ + "try: \n print(((6-13)/((((4+15)+19)-12)+11)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $11 x^2-121 \\sqrt{5} x+1540$", + "Output Answer": [ + "$-11 \\left(4 \\sqrt{5}-x\\right) \\left(x-7 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(11*x**2-121*sqrt(5)*x+1540, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-16$, and $a_n=a_{n-1}+-8$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$-112$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -16 # initial value\nd = -8 # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -16 # initial value\nd = -8 # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $| 11 x+10| =10$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{20}{11}\\right\\},\\{x\\to 0\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(11*x+10), 10), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-10 x-y^2+4 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $-10 x-y^2+4 y=-1$\nVertex: $\\left\\{\\frac{1}{2},2\\right\\}$\nDirectrix: $x=3$\nFocal Parameter: $5$\nFocus: $\\{-2,2\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-10*x-y**2+4*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $-\\frac{\\sin ^{-1}\\left(\\frac{16}{5}-\\frac{23 x}{5}\\right)}{\\log \\left(\\frac{31}{5}-5 x\\right)}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{16}{23}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(-((asin((16/5)-((23*x)/5)))/(log((31/5)-5*x))), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $3 x^2+\\frac{x}{5}+4$ and $-\\frac{2 x^3}{5}+\\frac{6 x^2}{5}-2 x-\\frac{22}{5}$.", + "Output Answer": [ + "$\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(3*x**2+(x/5)+4, -((2*x**3)/5)+((6*x**2)/5)-2*x-(22/5)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{29}{7}-\\frac{297}{343} (9 t+35)^2, x(t)=\\frac{729 t^2}{49}+\\frac{810 t}{7}+225$", + "Output Answer": [ + "$y=\\frac{29}{7}-\\frac{33 x}{7}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (29/7)-(297/343)*(9*t+35)**2\nx_t = ((729*t**2)/49)+((810*t)/7)+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{45 x^2+101 x-22}{-54 x-132}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((45*x**2+101*x-22)/(-54*x-132)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 \\sqrt{2} x^2-6 \\sqrt{2} x+\\frac{3}{\\sqrt{2}}$ and $q(x) = \\frac{15 x^2}{\\sqrt{2}}-\\sqrt{2} x-7 \\sqrt{2}$", + "Output Answer": [ + "$60 x^4-98 x^3-\\frac{43 x^2}{2}+81 x-21$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 4*sqrt(2)*x**2-6*sqrt(2)*x+(3/(sqrt(2)))\nq = ((15*x**2)/(sqrt(2)))-sqrt(2)*x-7*sqrt(2)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 4096 (x-1)^4, q(x) = 7 x+1$", + "Output Answer": [ + "$4096 x^4-16384 x^3+24576 x^2-16377 x+4097$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 4096*(x-1)**4\nq = 7*x+1\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $\\frac{9 x}{2}+1$ and $-\\frac{9 x}{2}-1$.", + "Output Answer": [ + "$\\frac{9 x}{2}+1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(((9*x)/2)+1, -((9*x)/2)-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $4 x^2+5 x+9 y^2+2 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $4 \\left(x+\\frac{5}{8}\\right)^2+9 \\left(y+\\frac{1}{9}\\right)^2=\\frac{1537}{144}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{8}-\\frac{\\sqrt{7685}}{72} & -\\frac{1}{9} \\\\\n \\frac{1}{72} \\left(\\sqrt{7685}-45\\right) & -\\frac{1}{9} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{3}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{5}{8}-\\frac{\\sqrt{7685}}{72}+\\frac{1}{72} \\left(\\sqrt{7685}-45\\right)\\right),-\\frac{1}{9}\\right\\}$\nArea Enclosed: $\\frac{1537 \\pi }{864}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(4*x**2+5*x+9*y**2+2*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-2 x^2-4 x+8 y^2+2 y+1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $8 \\left(y+\\frac{1}{8}\\right)^2-2 (x+1)^2=-\\frac{23}{8}$\nFoci: $\\left(\n\\begin{array}{cc}\n -1-\\frac{\\sqrt{115}}{8} & -\\frac{1}{8} \\\\\n \\frac{1}{8} \\left(\\sqrt{115}-8\\right) & -\\frac{1}{8} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{5}}{2}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-1-\\frac{\\sqrt{115}}{8}+\\frac{1}{8} \\left(\\sqrt{115}-8\\right)\\right),-\\frac{1}{8}\\right\\}$\nAsymptotes: $\\left\\{y=\\frac{x}{2}+\\frac{3}{8},y=-\\frac{x}{2}-\\frac{5}{8}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-2*x**2-4*x+8*y**2+2*y+1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-12 x-10}+\\sqrt{2-x}=9$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{121} \\left(-1185+18 \\sqrt{1346}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-12*x-10)+sqrt(2-x), 9), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-2 x^2-4 x-12$", + "Output Answer": [ + "$x=-1-i \\sqrt{5}\\lor x=-1+i \\sqrt{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-2*x**2-4*x-12, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=80 \\left(5 t^2+35 t+61\\right)^2, x(t)=20 t^2+140 t+245$", + "Output Answer": [ + "$y=5 x^2-10 x+5$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 80*(5*t**2+35*t+61)**2\nx_t = 20*t**2+140*t+245\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$2 x+4 y+19=0$, $-13 x+20 y+8=0$", + "Output Answer": [ + "$x=-\\frac{87}{23}$, $y=-\\frac{263}{92}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((2*x+4*y+19, -13*x+20*y+8), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(3 \\sqrt{2} \\left(\\cos \\left(\\frac{7}{30}\\right)+i \\sin \\left(\\frac{7}{30}\\right)\\right)\\right)^9$", + "Output Answer": [ + "$314928 \\sqrt{2} \\left(\\cos \\left(\\frac{21}{10}\\right)+i \\sin \\left(\\frac{21}{10}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((3*math.sqrt(2)*(math.cos((7/30))+1j*math.sin((7/30))))**9)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$-14 \\sqrt{3} x+13 \\sqrt{3} y+9 \\sqrt{3}=0$, $4 \\sqrt{3} x-8 \\sqrt{3} y+3 \\sqrt{3}=0$", + "Output Answer": [ + "$x=\\frac{37}{20}$, $y=\\frac{13}{10}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((-14*sqrt(3)*x+13*sqrt(3)*y+9*sqrt(3), 4*sqrt(3)*x-8*sqrt(3)*y+3*sqrt(3)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-\\sqrt{3} \\left(96 t^2+432 t+481\\right), x(t)=48 t^2+216 t+243$", + "Output Answer": [ + "$y=5 \\sqrt{3}-2 \\sqrt{3} x$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -sqrt(3)*(96*t**2+432*t+481)\nx_t = 48*t**2+216*t+243\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\sqrt[3]{3-\\frac{3 x}{2}}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{3} \\left(6-2 y^3\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, cbrt(3-((3*x)/2)))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(1+i) \\sqrt{3}$ and $y=(-5-5 i) \\sqrt{3}$", + "Output Answer": [ + "$-\\frac{1}{5}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (1+i)*math.sqrt(3)\ny = (-5-5*i)*math.sqrt(3)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{361 x^2}{9}, q(x) = 6 x-\\frac{2}{3}$", + "Output Answer": [ + "$\\frac{361 x^2}{9}+6 x-\\frac{2}{3}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = ((361*x**2)/9)\nq = 6*x-(2/3)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\frac{29 e^{\\frac{97 i \\pi }{180}}}{\\pi }$.", + "Output Answer": [ + "Norm: $\\frac{29}{\\pi }$\nArgument: $\\frac{97 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = ((29*math.e**((97*i*math.pi)/180))/math.pi)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-4 x^2+106 x-\\frac{2745}{4}$", + "Output Answer": [ + "$4 \\left(\\frac{45}{4}-x\\right) \\left(x-\\frac{61}{4}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-4*x**2+106*x-(2745/4), a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{19 x^2}{\\sqrt{3}}+\\frac{5 x}{\\sqrt{3}}-\\sqrt{3}$", + "Output Answer": [ + "$\\frac{19 \\left(x+\\frac{5}{38}\\right)^2}{\\sqrt{3}}-\\sqrt{3}-\\frac{25}{76 \\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((19*x**2)/(math.sqrt(3)))+((5*x)/(math.sqrt(3)))-math.sqrt(3)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{25 x}{2}+6\\right| =\\frac{29}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{41}{25}\\right\\},\\left\\{x\\to \\frac{17}{25}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((25*x)/2)+6), (29/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-1$, and $a_n=a_{n-1}+-7$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=4$.", + "Output Answer": [ + "$-46$" + ], + "Output Program": [ + "a = -1 # initial value\nd = -7 # second term\nn = 4 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -1 # initial value\nd = -7 # second term\nn = 4 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the domain of the following function:\n$-\\tan (6 x+8)-\\tanh (6 x+4)$", + "Output Answer": [ + "$\\frac{6 x+8}{\\pi }+\\frac{1}{2}\\notin \\mathbb{Z}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import continuous_domain\nfrom sympy.abc import x\n\nf = -tan(6*x+8)-tanh(6*x+4)\nprint(continuous_domain(f, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{7} (4 x-47), q(x) = \\frac{81}{49} (2 x+3)^2$", + "Output Answer": [ + "$\\frac{324 x^2}{49}+\\frac{1000 x}{49}+\\frac{400}{49}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/7)*(4*x-47)\nq = (81/49)*(2*x+3)**2\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((3-5)-2)^2-(15+3)$.", + "Output Answer": [ + "$-2$" + ], + "Output Program": [ + "try: \n print(((3-5)-2)**2-(15+3))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 9 x^2-x+6\\right| =24$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{18} \\left(1-\\sqrt{649}\\right)\\right\\},\\left\\{x\\to \\frac{1}{18} \\left(1+\\sqrt{649}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(9*x**2-x+6), 24), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\cos \\left(\\frac{8 \\pi }{45}\\right)+i \\sin \\left(\\frac{8 \\pi }{45}\\right)\\right)^4$", + "Output Answer": [ + "$-\\sin \\left(\\frac{19 \\pi }{90}\\right)-i \\cos \\left(\\frac{19 \\pi }{90}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-math.cos(((8*math.pi)/45))+1j*math.sin(((8*math.pi)/45)))**4)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$4 \\sqrt{2} x+\\sqrt{2} y-\\sqrt{2} z+13 \\sqrt{2}=0$, $-17 \\sqrt{2} x+16 \\sqrt{2} y-11 \\sqrt{2} z-13 \\sqrt{2}=0$, $-12 \\sqrt{2} x+17 \\sqrt{2} y-6 \\sqrt{2} z-9 \\sqrt{2}=0$", + "Output Answer": [ + "$x=-\\frac{1281}{491}$, $y=-\\frac{309}{491}$, $z=\\frac{950}{491}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((4*sqrt(2)*x+sqrt(2)*y-sqrt(2)*z+13*sqrt(2), -17*sqrt(2)*x+16*sqrt(2)*y-11*sqrt(2)*z-13*sqrt(2), -12*sqrt(2)*x+17*sqrt(2)*y-6*sqrt(2)*z-9*sqrt(2))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x+1$ and $-3 x-1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x+1, -3*x-1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\sqrt{\\frac{9 x^2}{5}+\\frac{29}{5}}$", + "Output Answer": [ + "$y\\geq \\sqrt{\\frac{29}{5}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range(sqrt(((9*x**2)/5)+(29/5)), x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $3 x^2+12 x+7$", + "Output Answer": [ + "$x=\\frac{1}{3} \\left(-6-\\sqrt{15}\\right)\\lor x=\\frac{1}{3} \\left(\\sqrt{15}-6\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(3*x**2+12*x+7, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(((7+18)+10)^2-20\\right)^2+\\left(\\frac{21+9}{22}+24\\right)$.", + "Output Answer": [ + "$\\frac{15972554}{11}$" + ], + "Output Program": [ + "try: \n print((((7+18)+10)**2-20)**2+(((21+9)/22)+24))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (5, \\sqrt{3}, 8)$", + "Output Answer": [ + "$\\left\\{2 \\sqrt{23},\\tan ^{-1}\\left(\\frac{\\sqrt{7}}{4}\\right),\\tan ^{-1}\\left(\\frac{\\sqrt{3}}{5}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 5\ny = math.sqrt(3)\nz = 8\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $\\cos \\left(\\frac{17 \\pi }{180}\\right)+i \\sin \\left(\\frac{17 \\pi }{180}\\right)$.", + "Output Answer": [ + "Norm: $\\sqrt{\\sin ^2\\left(\\frac{17 \\pi }{180}\\right)+\\cos ^2\\left(\\frac{17 \\pi }{180}\\right)}$\nArgument: $\\frac{17 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = math.cos(((17*math.pi)/180))+i*math.sin(((17*math.pi)/180))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $9 x^2-8 x+2 y^2+7 y-7=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $9 \\left(x-\\frac{4}{9}\\right)^2+2 \\left(y+\\frac{7}{4}\\right)^2=\\frac{1073}{72}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{4}{9} & -\\frac{7}{4}-\\frac{\\sqrt{7511}}{36} \\\\\n \\frac{4}{9} & \\frac{1}{36} \\left(\\sqrt{7511}-63\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{7}}{3}$\nCenter: $\\left\\{\\frac{4}{9},\\frac{1}{2} \\left(-\\frac{7}{4}-\\frac{\\sqrt{7511}}{36}+\\frac{1}{36} \\left(\\sqrt{7511}-63\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{1073 \\pi }{216 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(9*x**2-8*x+2*y**2+7*y-7, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=-6 (9 t+16), x(t)=-9 t-15$", + "Output Answer": [ + "$y=6 x-6$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = -6*(9*t+16)\nx_t = -9*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-380 x^3-503 x^2+147 x+255}{-420 x^2-97 x+221}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{38} \\left(-9-\\sqrt{1221}\\right)\\right\\},\\left\\{x\\to \\frac{1}{38} \\left(-9+\\sqrt{1221}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-380*x**3-503*x**2+147*x+255)/(-420*x**2-97*x+221)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $4 x^2-4 x+11$", + "Output Answer": [ + "$x=\\frac{1}{2} \\left(1-i \\sqrt{10}\\right)\\lor x=\\frac{1}{2} \\left(1+i \\sqrt{10}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(4*x**2-4*x+11, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-12 x-14}+\\sqrt{9-12 x}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1365}{484}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-12*x-14)+sqrt(9-12*x), 11), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = \\frac{1}{4} (-5 x-23), q(x) = \\frac{1}{64} (21 x-16)^3$", + "Output Answer": [ + "$\\frac{9261 x^3}{64}-\\frac{1323 x^2}{4}+\\frac{1003 x}{4}-\\frac{279}{4}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (1/4)*(-5*x-23)\nq = (1/64)*(21*x-16)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x+y$ where $x=(4-3 i) \\sqrt{5}$ and $y=(-4+3 i) \\sqrt{5}$", + "Output Answer": [ + "$0$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (4-3*i)*math.sqrt(5)\ny = (-4+3*i)*math.sqrt(5)\nprint(x+y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2+3 x+8 y^2+10 y-1=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x+\\frac{3}{20}\\right)^2+8 \\left(y+\\frac{5}{8}\\right)^2=\\frac{87}{20}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{20} & \\frac{1}{40} \\left(-25-\\sqrt{174}\\right) \\\\\n -\\frac{3}{20} & \\frac{1}{40} \\left(\\sqrt{174}-25\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{5}}$\nCenter: $\\left\\{-\\frac{3}{20},\\frac{1}{2} \\left(\\frac{1}{40} \\left(-25-\\sqrt{174}\\right)+\\frac{1}{40} \\left(\\sqrt{174}-25\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{87 \\pi }{80 \\sqrt{5}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2+3*x+8*y**2+10*y-1, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $3 x^2+7 x-7 y^2+2 y-4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $3 \\left(x+\\frac{7}{6}\\right)^2-7 \\left(y-\\frac{1}{7}\\right)^2=\\frac{667}{84}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{1}{42} \\left(-49-\\sqrt{6670}\\right) & \\frac{1}{7} \\\\\n \\frac{1}{42} \\left(\\sqrt{6670}-49\\right) & \\frac{1}{7} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{10}{7}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(\\frac{1}{42} \\left(-49-\\sqrt{6670}\\right)+\\frac{1}{42} \\left(\\sqrt{6670}-49\\right)\\right),\\frac{1}{7}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{3}{7}} x+\\frac{1}{42} \\left(6+7 \\sqrt{21}\\right),y=\\frac{1}{42} \\left(6-7 \\sqrt{21}\\right)-\\sqrt{\\frac{3}{7}} x\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(3*x**2+7*x-7*y**2+2*y-4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{26 x^2}{\\sqrt{3}}-2 \\sqrt{3} x-\\frac{22}{\\sqrt{3}}$", + "Output Answer": [ + "$\\frac{26 \\left(x-\\frac{3}{26}\\right)^2}{\\sqrt{3}}-\\frac{3 \\sqrt{3}}{26}-\\frac{22}{\\sqrt{3}}$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((26*x**2)/(math.sqrt(3)))-2*math.sqrt(3)*x-(22/(math.sqrt(3)))), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{11 x}{2}-\\frac{25}{2}}+\\sqrt{9 x+\\frac{13}{2}}=\\frac{19}{2}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{98} \\left(9937-76 \\sqrt{15794}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((11*x)/2)-(25/2))+sqrt(9*x+(13/2)), (19/2)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-17 x^2+14 x+18}{20 x+8}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{17} \\left(7-\\sqrt{355}\\right)\\right\\},\\left\\{x\\to \\frac{1}{17} \\left(7+\\sqrt{355}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-17*x**2+14*x+18)/(20*x+8)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $15 x^2+x-15$", + "Output Answer": [ + "$15 \\left(x+\\frac{1}{30}\\right)^2-\\frac{901}{60}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (15*x**2+x-15), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $6 x^2-2 x-10 y+2=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Parabola\nEquation: $6 x^2-2 x-10 y=-2$\nVertex: $\\left\\{\\frac{1}{6},\\frac{11}{60}\\right\\}$\nDirectrix: $y=-\\frac{7}{30}$\nFocal Parameter: $\\frac{5}{6}$\nFocus: $\\left\\{\\frac{1}{6},\\frac{3}{5}\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(6*x**2-2*x-10*y+2, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $8 x^2-3 x+5 y^2-2 y-8=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $8 \\left(x-\\frac{3}{16}\\right)^2+5 \\left(y-\\frac{1}{5}\\right)^2=\\frac{1357}{160}$\nFoci: $\\left(\n\\begin{array}{cc}\n \\frac{3}{16} & \\frac{1}{5}-\\frac{\\sqrt{4071}}{80} \\\\\n \\frac{3}{16} & \\frac{1}{80} \\left(16+\\sqrt{4071}\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{\\sqrt{\\frac{3}{2}}}{2}$\nCenter: $\\left\\{\\frac{3}{16},\\frac{1}{2} \\left(\\frac{1}{5}-\\frac{\\sqrt{4071}}{80}+\\frac{1}{80} \\left(16+\\sqrt{4071}\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{1357 \\pi }{320 \\sqrt{10}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(8*x**2-3*x+5*y**2-2*y-8, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((((9+19)+17)-14)-16)+(((14-22)+23)+2)$.", + "Output Answer": [ + "$32$" + ], + "Output Program": [ + "try: \n print(((((9+19)+17)-14)-16)+(((14-22)+23)+2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 24 x^2+11 x+11\\right| =-18$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(24*x**2+11*x+11), -18), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{58}{99}$, and $a_n=a_{n-1}+-\\frac{19}{\\sqrt{5}}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{11}{2} \\left(-\\frac{116}{99}-38 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\na = -(58/99) # initial value\nd = -(19/(math.sqrt(5))) # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(58/99) # initial value\nd = -(19/(math.sqrt(5))) # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $10 x^2-13 x-\\frac{62}{7}$", + "Output Answer": [ + "$x=\\frac{1}{140} \\left(91-3 \\sqrt{2849}\\right)\\lor x=\\frac{1}{140} \\left(91+3 \\sqrt{2849}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(10*x**2-13*x-(62/7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=-\\sin (5-2 x)$ at the point $x=8$", + "Output Answer": [ + "$\\sin (11) = -1.$" + ], + "Output Program": [ + "import math\n\nx = 8\ntry: \n f = -math.sin(5-2*x)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=16 (27-7 t)^2, x(t)=4 t-15$", + "Output Answer": [ + "$y=49 x^2-42 x+9$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 16*(27-7*t)**2\nx_t = 4*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-\\frac{7}{5} e^{\\frac{103 i \\pi }{180}}$.", + "Output Answer": [ + "Norm: $\\frac{7}{5}$\nArgument: $-\\frac{77 \\pi }{180}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -(7/5)*math.e**((103*i*math.pi)/180)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{70}{33}$, and $a_n=a_{n-1}+-5$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=30$.", + "Output Answer": [ + "$-\\frac{23225}{11}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (70/33) # initial value\nd = -5 # second term\nn = 30 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (70/33) # initial value\nd = -5 # second term\nn = 30 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=1-8 i$ and $y=-10-5 i$", + "Output Answer": [ + "$\\frac{6}{25}+\\frac{17 i}{25}$" + ], + "Output Program": [ + "i = 1j\nx = 1-8*i\ny = -10-5*i\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 7 \\sqrt{3}-12 \\sqrt{3} x\\right| =13 \\sqrt{3}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{1}{2}\\right\\},\\left\\{x\\to \\frac{5}{3}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(7*sqrt(3)-12*sqrt(3)*x), 13*sqrt(3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-3 x^2+75 x-462$", + "Output Answer": [ + "$3 (11-x) (x-14)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-3*x**2+75*x-462, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| 10 x^2-12 x+16\\right| =17$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{10} \\left(6-\\sqrt{46}\\right)\\right\\},\\left\\{x\\to \\frac{1}{10} \\left(6+\\sqrt{46}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(10*x**2-12*x+16), 17), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| \\frac{34 x}{3}-7\\right| =-3$", + "Output Answer": [ + "$\\{\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(((34*x)/3)-7), -3), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $(-3+4 i) e$.", + "Output Answer": [ + "Norm: $5 e$\nArgument: $\\pi -\\tan ^{-1}\\left(\\frac{4}{3}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (-3+4*i)*math.e\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $x^6+4 x^5-3 x^4-6 x^3-6 x^2-4 x+7$ when divided by $-8 x^5+6 x^4-6 x^3-9 x^2+10 x+7$.", + "Output Answer": [ + "$-\\frac{x}{8}-\\frac{19}{32}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = x**6+4*x**5-3*x**4-6*x**3-6*x**2-4*x+7\nq = -8*x**5+6*x**4-6*x**3-9*x**2+10*x+7\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(3+11) ((((8-16)+13)+10)-10)$.", + "Output Answer": [ + "$70$" + ], + "Output Program": [ + "try: \n print((3+11)*((((8-16)+13)+10)-10))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\left(\\left(\\frac{7}{18}-23\\right)+16\\right)+21\\right)+\\left((13-25)^2-14\\right)$.", + "Output Answer": [ + "$\\frac{2599}{18}$" + ], + "Output Program": [ + "try: \n print(((((7/18)-23)+16)+21)+((13-25)**2-14))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{-x^2+2 x+3}{-x-3}=0$", + "Output Answer": [ + "$\\{\\{x\\to -1\\},\\{x\\to 3\\}\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((-x**2+2*x+3)/(-x-3)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\left| -4 x-\\frac{9}{2}\\right| =8$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -\\frac{25}{8}\\right\\},\\left\\{x\\to \\frac{7}{8}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x', real=True)\nprint(solve(Eq(abs(-4*x-(9/2)), 8), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $10 x^5-8 x^4-15 x^3+27 x^2+3 x-12$ and $-2 x^4+3 x^2-3 x-3$.", + "Output Answer": [ + "$2 x^4-3 x^2+3 x+3$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(10*x**5-8*x**4-15*x**3+27*x**2+3*x-12, -2*x**4+3*x**2-3*x-3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 (3 t+41)^2, x(t)=-t-15$", + "Output Answer": [ + "$y=36 x^2+96 x+64$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*(3*t+41)**2\nx_t = -t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\left(75 t^2+450 t+676\\right)^2, x(t)=25 t^2+150 t+225$", + "Output Answer": [ + "$y=9 x^2+6 x+1$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (75*t**2+450*t+676)**2\nx_t = 25*t**2+150*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\left(\\left((10+10)^2+4\\right)+8\\right)-24}{(24-5)+22}$.", + "Output Answer": [ + "$\\frac{388}{41}$" + ], + "Output Program": [ + "try: \n print((((((10+10)**2+4)+8)-24)/((24-5)+22)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{25 x}{4}-\\frac{15}{2}}+\\sqrt{\\frac{29 x}{2}-\\frac{5}{2}}=\\frac{51}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{71081-34 \\sqrt{3574770}}{1452}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((25*x)/4)-(15/2))+sqrt(((29*x)/2)-(5/2)), (51/4)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-14 x-\\frac{52}{5}}+\\sqrt{-7 x-4}=\\frac{49}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{175} \\left(-7363+98 \\sqrt{4862}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-14*x-(52/5))+sqrt(-7*x-4), (49/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{25}{4}+\\frac{15 i}{4}$ and $y=-\\frac{23}{4}-\\frac{15 i}{4}$", + "Output Answer": [ + "$-\\frac{175}{8}-45 i$" + ], + "Output Program": [ + "i = 1j\nx = (25/4)+((15*i)/4)\ny = -(23/4)-((15*i)/4)\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $7 x^2+35 \\sqrt{3} x-294$", + "Output Answer": [ + "$-7 \\left(2 \\sqrt{3}-x\\right) \\left(x+7 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(7*x**2+35*sqrt(3)*x-294, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{23}{42}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$-\\frac{253}{42}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(23/42) # initial value\nd = 0 # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(23/42) # initial value\nd = 0 # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-5 \\sqrt{2} \\left(\\sin \\left(\\frac{\\pi }{45}\\right)-i \\cos \\left(\\frac{\\pi }{45}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-625000 \\sqrt{2} \\left(-\\sin \\left(\\frac{7 \\pi }{45}\\right)+i \\cos \\left(\\frac{7 \\pi }{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-5*math.sqrt(2)*(math.sin((math.pi/45))-1j*math.cos((math.pi/45))))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{4 x^2+\\frac{91 x}{4}-\\frac{51}{4}}{13-\\frac{11 x}{4}}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{32} \\left(-91-\\sqrt{11545}\\right)\\right\\},\\left\\{x\\to \\frac{1}{32} \\left(-91+\\sqrt{11545}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((4*x**2+((91*x)/4)-(51/4))/(13-((11*x)/4))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((15+13)-14)+((((9+4)-4)-4)-22)$.", + "Output Answer": [ + "$-3$" + ], + "Output Program": [ + "try: \n print(((15+13)-14)+((((9+4)-4)-4)-22))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(19+16)-(((1-16)-18)-3)$.", + "Output Answer": [ + "$71$" + ], + "Output Program": [ + "try: \n print((19+16)-(((1-16)-18)-3))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $-3 \\sqrt{5} e^{-\\frac{i \\pi }{12}}$.", + "Output Answer": [ + "Norm: $3 \\sqrt{5}$\nArgument: $\\pi +\\tan ^{-1}\\left(\\frac{\\Im\\left(e^{-\\frac{i \\pi }{12}}\\right)}{\\Re\\left(e^{-\\frac{i \\pi }{12}}\\right)}\\right)$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = -3*math.sqrt(5)*math.e**(-((i*math.pi)/12))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $9 x^4+6 x^3-9 x^2+8 x+6$ when divided by $-8 x^4+4 x^3-7 x^2+9 x$.", + "Output Answer": [ + "$-\\frac{9}{8}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 9*x**4+6*x**3-9*x**2+8*x+6\nq = -8*x**4+4*x**3-7*x**2+9*x\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $-10 x^2-3 x-12$", + "Output Answer": [ + "$-10 \\left(x+\\frac{3}{20}\\right)^2-\\frac{471}{40}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (-10*x**2-3*x-12), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $2 x^2-x-4$ and $1$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(2*x**2-x-4, 1))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$4 \\sqrt{5} x-7 \\sqrt{5} y+8 \\sqrt{5} z+10 \\sqrt{5}=0$, $2 \\sqrt{5} x-7 \\sqrt{5} y-11 \\sqrt{5} z+5 \\sqrt{5}=0$, $-\\sqrt{5} x-5 \\sqrt{5} y-6 \\sqrt{5} z-2 \\sqrt{5}=0$", + "Output Answer": [ + "$x=-\\frac{806}{349}$, $y=\\frac{30}{349}$, $z=-\\frac{7}{349}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((4*sqrt(5)*x-7*sqrt(5)*y+8*sqrt(5)*z+10*sqrt(5), 2*sqrt(5)*x-7*sqrt(5)*y-11*sqrt(5)*z+5*sqrt(5), -sqrt(5)*x-5*sqrt(5)*y-6*sqrt(5)*z-2*sqrt(5))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (4, \\frac{1}{5}, \\frac{1}{\\sqrt{3}})$", + "Output Answer": [ + "$\\left\\{\\frac{2 \\sqrt{\\frac{307}{3}}}{5},\\tan ^{-1}\\left(\\frac{\\sqrt{1203}}{5}\\right),\\tan ^{-1}\\left(\\frac{1}{20}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 4\ny = (1/5)\nz = (1/(math.sqrt(3)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-6 \\sqrt{2} \\left(\\cos \\left(\\frac{2 \\pi }{15}\\right)-i \\sin \\left(\\frac{2 \\pi }{15}\\right)\\right)\\right)^10$", + "Output Answer": [ + "$1934917632 \\left(-\\frac{1}{2}+\\frac{i \\sqrt{3}}{2}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-6*math.sqrt(2)*(math.cos(((2*math.pi)/15))-1j*math.sin(((2*math.pi)/15))))**10)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (8-7 x)^2, q(x) = -(x+4)^3$", + "Output Answer": [ + "$-x^3+37 x^2-160 x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (8-7*x)**2\nq = -(x+4)**3\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = -3 \\sqrt{3} \\left(x^2+x+2\\right)$, $q(x) = 2 \\sqrt{3} \\left(2 x^2+4 x+3\\right)$", + "Output Answer": [ + "$\\sqrt{3} x^2+5 \\sqrt{3} x$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*sqrt(3)*(x**2+x+2)\nq = 2*sqrt(3)*(2*x**2+4*x+3)\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $(-7-11 i) \\log (2)$.", + "Output Answer": [ + "Norm: $\\sqrt{170} \\log (2)$\nArgument: $\\tan ^{-1}\\left(\\frac{11}{7}\\right)-\\pi$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = (-7-11*i)*math.log(2)\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{(((9+22)+25)+13)-18}{((4-9)-20)+19}$.", + "Output Answer": [ + "$-\\frac{17}{2}$" + ], + "Output Program": [ + "try: \n print((((((9+22)+25)+13)-18)/(((4-9)-20)+19)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{7+15}{10}+((((13-2)+6)-3)+18)$.", + "Output Answer": [ + "$\\frac{171}{5}$" + ], + "Output Program": [ + "try: \n print(((7+15)/10)+((((13-2)+6)-3)+18))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=\\frac{13}{\\sqrt{2}}$ and $y=\\frac{3+13 i}{\\sqrt{2}}$", + "Output Answer": [ + "$\\frac{10-13 i}{\\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (13/(math.sqrt(2)))\ny = ((3+13*i)/(math.sqrt(2)))\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{23 x^2}{2}+\\frac{27 x}{4}+\\frac{1}{4}$", + "Output Answer": [ + "$\\frac{23}{2} \\left(x+\\frac{27}{92}\\right)^2-\\frac{545}{736}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((23*x**2)/2)+((27*x)/4)+(1/4)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-\\frac{68 x}{5}-\\frac{7}{5}}+\\sqrt{\\frac{74}{5}-\\frac{6 x}{5}}=13$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{961} \\left(-16888+13 \\sqrt{824185}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-((68*x)/5)-(7/5))+sqrt((74/5)-((6*x)/5)), 13), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{100}{3} \\left(10 t^2+104 t+271\\right)^2, x(t)=\\frac{25 t^2}{3}+\\frac{260 t}{3}+\\frac{676}{3}$", + "Output Answer": [ + "$y=48 x^2+48 x+12$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (100/3)*(10*t**2+104*t+271)**2\nx_t = ((25*t**2)/3)+((260*t)/3)+(676/3)\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the range of the following function:\n$\\left(\\frac{2 x}{3}-\\frac{25}{3}\\right)^4$", + "Output Answer": [ + "$y\\geq 0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.calculus.util import *\n\nx = symbols('x', real=True)\nprint(function_range((((2*x)/3)-(25/3))**4, x, S.Reals))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(7+4 i) \\log (2)$ and $y=(3-2 i) \\log (2)$", + "Output Answer": [ + "$1+2 i$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (7+4*i)*math.log10(2)\ny = (3-2*i)*math.log10(2)\nprint((x/y))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $5 \\sqrt{3} x^2-\\frac{11 x}{\\sqrt{3}}-\\frac{5}{\\sqrt{3}}$", + "Output Answer": [ + "$x=\\frac{\\frac{11}{\\sqrt{3}}-\\sqrt{\\frac{421}{3}}}{10 \\sqrt{3}}\\lor x=\\frac{\\frac{11}{\\sqrt{3}}+\\sqrt{\\frac{421}{3}}}{10 \\sqrt{3}}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(5*sqrt(3)*x**2-((11*x)/(sqrt(3)))-(5/(sqrt(3))), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$19 x-23 y-z-24=0$, $-24 x-11 y+8 z-1=0$, $-20 x+6 y-8 z-5=0$", + "Output Answer": [ + "$x=-\\frac{41}{1844}$, $y=-\\frac{463}{461}$, $z=-\\frac{2439}{1844}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((19*x-23*y-z-24, -24*x-11*y+8*z-1, -20*x+6*y-8*z-5)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{1}{5} \\left(\\left((8-11)^2+2\\right)+23\\right)\\right) \\left(\\left(\\frac{11}{9}+1\\right)+17\\right)$.", + "Output Answer": [ + "$\\frac{5882}{45}$" + ], + "Output Program": [ + "try: \n print(((1/5)*(((8-11)**2+2)+23))*(((11/9)+1)+17))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-8 \\left(\\cos \\left(\\frac{61}{45}\\right)+i \\sin \\left(\\frac{61}{45}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$16777216 \\left(\\cos \\left(\\frac{488}{45}\\right)+i \\sin \\left(\\frac{488}{45}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-8*(math.cos((61/45))+1j*math.sin((61/45))))**8)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConvert the following vector to spherical coordinates $(x, y, z) = (10, 9, \\frac{1}{\\sqrt{2}})$", + "Output Answer": [ + "$\\left\\{11 \\sqrt{\\frac{3}{2}},\\tan ^{-1}\\left(\\sqrt{362}\\right),\\tan ^{-1}\\left(\\frac{9}{10}\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nx = 10\ny = 9\nz = (1/(math.sqrt(2)))\n\nr = math.sqrt(x ** 2 + y ** 2 + z ** 2)\ntheta = math.atan2(y, x)\nphi = math.acos(z / r)\n\nprint(dict(r=r, theta=theta, phi=phi))\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = \\frac{18 x^2}{\\pi }+\\frac{12 x}{\\pi }-\\frac{24}{\\pi }$ and $q(x) = -\\frac{20 x^2}{\\pi }+\\frac{22 x}{\\pi }-\\frac{34}{\\pi }$", + "Output Answer": [ + "$-\\frac{360 x^4}{\\pi ^2}+\\frac{156 x^3}{\\pi ^2}+\\frac{132 x^2}{\\pi ^2}-\\frac{936 x}{\\pi ^2}+\\frac{816}{\\pi ^2}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = ((18*x**2)/pi)+((12*x)/pi)-(24/pi)\nq = -((20*x**2)/pi)+((22*x)/pi)-(34/pi)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nComplete the square for the following quadratic: $\\frac{23 x^2}{2}+\\frac{7 x}{2}-\\frac{25}{2}$", + "Output Answer": [ + "$\\frac{23}{2} \\left(x+\\frac{7}{46}\\right)^2-\\frac{2349}{184}$" + ], + "Output Program": [ + "from sympy import *\n\na, b, c, x = symbols('a, b, c, x')\n# Rewrite in the form $a(x-b)^2+c)$ \n(a, b, c), = solve(a*(x-b)**2+c - (((23*x**2)/2)+((7*x)/2)-(25/2)), [a, b, c])\nprint(a * (x - b) ** 2 + c)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $42 \\sqrt{5} x-6 x^2$", + "Output Answer": [ + "$-6 x \\left(x-7 \\sqrt{5}\\right)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(42*sqrt(5)*x-6*x**2, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-10 x-5}+\\sqrt{6}=7$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{5} \\left(-30+7 \\sqrt{6}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-10*x-5)+sqrt(6), 7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-5 x^2-85 x+90$", + "Output Answer": [ + "$5 (-x-18) (x-1)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-5*x**2-85*x+90, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $\\sqrt{5} x^2-3 \\sqrt{5} x$", + "Output Answer": [ + "$x=3\\lor x=0$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(sqrt(5)*x**2-3*sqrt(5)*x, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $-3 x^4-3 x^3-7 x^2-8 x+1$ when divided by $6 x^2+4 x-7$.", + "Output Answer": [ + "$-\\frac{x^2}{2}-\\frac{x}{6}-\\frac{59}{36}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = -3*x**4-3*x**3-7*x**2-8*x+1\nq = 6*x**2+4*x-7\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-\\frac{95 x^2}{7}+\\frac{38 x}{7}+\\frac{19}{7}$", + "Output Answer": [ + "$x=\\frac{1}{5} \\left(1-\\sqrt{6}\\right)\\lor x=\\frac{1}{5} \\left(1+\\sqrt{6}\\right)$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-((95*x**2)/7)+((38*x)/7)+(19/7), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-5 x-7}+\\sqrt{14-3 x}=11$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(-505+11 \\sqrt{1997}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-5*x-7)+sqrt(14-3*x), 11), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-2 \\left(\\frac{\\sqrt{3}}{2}+\\frac{i}{2}\\right)\\right)^6$", + "Output Answer": [ + "$-64$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-2*(((math.sqrt(3))/2)+(i/2)))**6)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{27}{58}$, and $a_n=a_{n-1}+-2 \\sqrt{3}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=23$.", + "Output Answer": [ + "$\\frac{23}{2} \\left(\\frac{27}{29}-44 \\sqrt{3}\\right)$" + ], + "Output Program": [ + "import math\n\ndef sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (27/58) # initial value\nd = -2*math.sqrt(3) # second term\nn = 23 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "import math\n\na = (27/58) # initial value\nd = -2*math.sqrt(3) # second term\nn = 23 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=64 (5-3 t)^2, x(t)=8 t-15$", + "Output Answer": [ + "$y=9 x^2+30 x+25$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 64*(5-3*t)**2\nx_t = 8*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{(24-24)^2}{\\frac{8-20}{10}}$.", + "Output Answer": [ + "$0$" + ], + "Output Program": [ + "try: \n print((((24-24)**2)/((8-20)/10)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $15 x-13$", + "Output Answer": [ + "$x=\\frac{13}{15}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(15*x-13, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $10 x^2+3 x+5 y^2+2 y-9=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Ellipse\nEquation: $10 \\left(x+\\frac{3}{20}\\right)^2+5 \\left(y+\\frac{1}{5}\\right)^2=\\frac{377}{40}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{3}{20} & \\frac{1}{20} \\left(-4-\\sqrt{377}\\right) \\\\\n -\\frac{3}{20} & \\frac{1}{20} \\left(\\sqrt{377}-4\\right) \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\frac{1}{\\sqrt{2}}$\nCenter: $\\left\\{-\\frac{3}{20},\\frac{1}{2} \\left(\\frac{1}{20} \\left(-4-\\sqrt{377}\\right)+\\frac{1}{20} \\left(\\sqrt{377}-4\\right)\\right)\\right\\}$\nArea Enclosed: $\\frac{377 \\pi }{200 \\sqrt{2}}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(10*x**2+3*x+5*y**2+2*y-9, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(8 \\left(\\sin \\left(\\frac{2 \\pi }{9}\\right)+i \\cos \\left(\\frac{2 \\pi }{9}\\right)\\right)\\right)^8$", + "Output Answer": [ + "$16777216 \\left(\\cos \\left(\\frac{2 \\pi }{9}\\right)+i \\sin \\left(\\frac{2 \\pi }{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((8*(math.sin(((2*math.pi)/9))+1j*math.cos(((2*math.pi)/9))))**8)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{-15 x-11}+\\sqrt{-13 x-13}=4$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to -111+4 \\sqrt{754}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(-15*x-11)+sqrt(-13*x-13), 4), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $12 x^2+22 x+8$ and $3 x+4$.", + "Output Answer": [ + "$3 x+4$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(12*x**2+22*x+8, 3*x+4))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{2 x^2-13 x+13}{9 x+16}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{4} \\left(13-\\sqrt{65}\\right)\\right\\},\\left\\{x\\to \\frac{1}{4} \\left(13+\\sqrt{65}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((2*x**2-13*x+13)/(9*x+16)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\frac{\\left(\\left((19+1)^2+4\\right)-25\\right)-19}{\\left(\\frac{1}{23}-17\\right)^2-24}$.", + "Output Answer": [ + "$\\frac{15870}{11617}$" + ], + "Output Program": [ + "try: \n print((((((19+1)**2+4)-25)-19)/(((1/23)-17)**2-24)))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=361 t^2-1710 t+2029, x(t)=\\frac{361 t^2}{9}-190 t+225$", + "Output Answer": [ + "$y=9 x+4$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 361*t**2-1710*t+2029\nx_t = ((361*t**2)/9)-190*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nEvaluate the function $f(x)=\\sqrt{8 x-1}$ at the point $x=3$", + "Output Answer": [ + "$\\sqrt{23} = 4.796$" + ], + "Output Program": [ + "import math\n\nx = 3\ntry: \n f = math.sqrt(8*x-1)\n print(f)\nexcept ValueError:\n print('out of domain')\nexcept OverflowError:\n print(float('inf'))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the greatest common divisor of $-4$ and $-3 x^3+2 x^2+2 x-3$.", + "Output Answer": [ + "$1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(gcd(-4, -3*x**3+2*x**2+2*x-3))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=4 \\left(196 t^2+840 t+897\\right)^2, x(t)=49 t^2+210 t+225$", + "Output Answer": [ + "$y=64 x^2-96 x+36$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 4*(196*t**2+840*t+897)**2\nx_t = 49*t**2+210*t+225\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = 13.595 x^2-9.392 x+11.311$, $q(x) = 1.263 x^2-5.298 x+14.678$", + "Output Answer": [ + "$14.858 x^2-14.69 x+25.989$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 13.595*x**2-9.392*x+11.311\nq = 1.263*x**2-5.298*x+14.678\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{34 x}{5}-\\frac{11}{5}}+\\sqrt{\\frac{71 x}{5}-\\frac{4}{5}}=\\frac{34}{5}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{120085-68 \\sqrt{2671259}}{6845}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((34*x)/5)-(11/5))+sqrt(((71*x)/5)-(4/5)), (34/5)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $-x^2-6 x-5$", + "Output Answer": [ + "$x=-5\\lor x=-1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(-x**2-6*x-5, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{2 x+14}+\\sqrt{15 x+11}=12$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{169} \\left(2487-48 \\sqrt{1691}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(2*x+14)+sqrt(15*x+11), 12), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-9 \\left(\\cos \\left(\\frac{179}{90}\\right)+i \\sin \\left(\\frac{179}{90}\\right)\\right)\\right)^7$", + "Output Answer": [ + "$-4782969 \\left(\\cos \\left(\\frac{1253}{90}\\right)+i \\sin \\left(\\frac{1253}{90}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-9*(math.cos((179/90))+1j*math.sin((179/90))))**7)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{152 x^3-312 x^2-22 x+2}{-342 x^2-229 x+13}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{2} \\left(2-\\sqrt{5}\\right)\\right\\},\\left\\{x\\to \\frac{1}{2} \\left(2+\\sqrt{5}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((152*x**3-312*x**2-22*x+2)/(-342*x**2-229*x+13)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $-x^2+17 x-30$", + "Output Answer": [ + "$-((2-x) (15-x))$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(-x**2+17*x-30, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the inverse of the following function: $\\cos ^{-1}\\left(-\\frac{17 x}{2}-4\\right)$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\fbox{$\\frac{1}{17} (-2 \\cos (y)-8)\\text{ if }0\\leq y\\leq \\pi $}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.solvers.solveset import *\n\nx, y = symbols('x y', real=True)\nf = Eq(y, acos(-((17*x)/2)-4))\nprint(solve(f, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\sqrt{\\frac{21 x}{4}+\\frac{49}{4}}+\\sqrt{13 x+\\frac{13}{2}}=\\frac{57}{4}$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{240029-228 \\sqrt{949039}}{3844}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import *\n\nprint(solve(Eq(sqrt(((21*x)/4)+(49/4))+sqrt(13*x+(13/2)), (57/4)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left(\\frac{6}{6}-19\\right)-\\left(\\frac{1}{19} ((10-5)+18)-19\\right)$.", + "Output Answer": [ + "$-\\frac{4}{19}$" + ], + "Output Program": [ + "try: \n print(((6/6)-19)-((1/19)*((10-5)+18)-19))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{69}{41}$, and $a_n=a_{n-1}+0$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$\\frac{1035}{41}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (69/41) # initial value\nd = 0 # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = (69/41) # initial value\nd = 0 # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x \\cdot y$ where $x=\\frac{5+17 i}{\\sqrt{\\pi }}$ and $y=\\frac{6+i}{\\sqrt{\\pi }}$", + "Output Answer": [ + "$\\frac{13+107 i}{\\pi }$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = ((5+17*i)/(math.sqrt(math.pi)))\ny = ((6+i)/(math.sqrt(math.pi)))\nprint(x*y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=-\\frac{29}{21}$, and $a_n=a_{n-1}+6$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=11$.", + "Output Answer": [ + "$\\frac{6611}{21}$" + ], + "Output Program": [ + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = -(29/21) # initial value\nd = 6 # second term\nn = 11 # steps\nprint(sum_arithmetic_series(a1, n, d))\n", + "a = -(29/21) # initial value\nd = 6 # second term\nn = 11 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=\\frac{8}{9} (34 t-87), x(t)=\\frac{16 t}{3}-15$", + "Output Answer": [ + "$y=\\frac{17 x}{3}+\\frac{23}{3}$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = (8/9)*(34*t-87)\nx_t = ((16*t)/3)-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{40}{17}$, and $a_n=a_{n-1}+-\\frac{1}{2}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=21$.", + "Output Answer": [ + "$-\\frac{945}{17}$" + ], + "Output Program": [ + "a = (40/17) # initial value\nd = -(1/2) # second term\nn = 21 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (40/17) # initial value\nd = -(1/2) # second term\nn = 21 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$-\\frac{157 x}{7}+\\frac{134 y}{7}+15 z-24=0$, $-21 x+\\frac{120 y}{7}-\\frac{166 z}{7}-\\frac{74}{7}=0$, $\\frac{13 x}{7}+\\frac{96 y}{7}-16 z-\\frac{135}{7}=0$", + "Output Answer": [ + "$x=\\frac{121405}{226639}$, $y=\\frac{1506077}{906556}$, $z=\\frac{127283}{453278}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((-((157*x)/7)+((134*y)/7)+15*z-24, -21*x+((120*y)/7)-((166*z)/7)-(74/7), ((13*x)/7)+((96*y)/7)-16*z-(135/7))), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 11 x^2+6 x+4$ and $q(x) = 8 x^2-7 x-8$", + "Output Answer": [ + "$88 x^4-29 x^3-98 x^2-76 x-32$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 11*x**2+6*x+4\nq = 8*x**2-7*x-8\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the quotient of $5 x^5+8 x^4-3 x^3-4 x^2-4 x-7$ when divided by $-8 x^2+2 x+2$.", + "Output Answer": [ + "$-\\frac{5 x^3}{8}-\\frac{37 x^2}{32}-\\frac{9 x}{128}+\\frac{99}{512}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = 5*x**5+8*x**4-3*x**3-4*x**2-4*x-7\nq = -8*x**2+2*x+2\nprint((p / q).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the roots of the following polynomial: $5 \\sqrt{3} x^2-\\sqrt{3} x$", + "Output Answer": [ + "$x=0\\lor x=\\frac{1}{5}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(5*sqrt(3)*x**2-sqrt(3)*x, x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 4 e x^2-e x+e$ and $q(x) = -4 e x^2+5 e x+e$", + "Output Answer": [ + "$-16 e^2 x^4+24 e^2 x^3-5 e^2 x^2+4 e^2 x+e^2$" + ], + "Output Program": [ + "import math\n\nfrom sympy import *\n\nx = symbols('x')\np = 4*math.e*x**2-math.e*x+math.e\nq = -4*math.e*x**2+5*math.e*x+math.e\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind the norm and argument (phase angle in radians) of $2 e \\left(\\cos \\left(\\frac{5 \\pi }{36}\\right)-i \\sin \\left(\\frac{5 \\pi }{36}\\right)\\right)$.", + "Output Answer": [ + "Norm: $2 e \\sqrt{\\sin ^2\\left(\\frac{5 \\pi }{36}\\right)+\\cos ^2\\left(\\frac{5 \\pi }{36}\\right)}$\nArgument: $-\\frac{5 \\pi }{36}$" + ], + "Output Program": [ + "import math\nfrom sympy import *\n\ni = 1j\nx = 2*math.e*(math.cos(((5*math.pi)/36))-i*math.sin(((5*math.pi)/36)))\nnorm = math.sqrt(pow(x.real, 2) + pow(x.imag, 2))\narg = math.atan(x.imag/x.real)\nprint('Norm:', norm)\nprint('Arg:', arg)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $(((15-15)+15)+7)+(((25-22)-22)-4)^2$.", + "Output Answer": [ + "$551$" + ], + "Output Program": [ + "try: \n print((((15-15)+15)+7)+(((25-22)-22)-4)**2)\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left((22+13)^2-5\\right) (24-2)$.", + "Output Answer": [ + "$26840$" + ], + "Output Program": [ + "try: \n print(((22+13)**2-5)*(24-2))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of three equations: \n$19 x+22 y+6 z-21=0$, $6 x-13 y-24 z+20=0$, $21 x-y-23 z-23=0$", + "Output Answer": [ + "$x=\\frac{583}{49}$, $y=-\\frac{2978}{245}$, $z=\\frac{2546}{245}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y, z\n\nprint(solve((19*x+22*y+6*z-21, 6*x-13*y-24*z+20, 21*x-y-23*z-23)), (x, y, z))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $((((7-24)-4)+16)+2)^2-((15+11)+20)$.", + "Output Answer": [ + "$-37$" + ], + "Output Program": [ + "try: \n print(((((7-24)-4)+16)+2)**2-((15+11)+20))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(-1+4 i) \\sqrt{2}$ and $y=0$", + "Output Answer": [ + "$(-1+4 i) \\sqrt{2}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-1+4*i)*math.sqrt(2)\ny = 0\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all real solutions to $\\frac{10 x^2+21 x+1}{6-20 x}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{1}{20} \\left(-21-\\sqrt{401}\\right)\\right\\},\\left\\{x\\to \\frac{1}{20} \\left(-21+\\sqrt{401}\\right)\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\nprint(solve(((10*x**2+21*x+1)/(6-20*x)), x))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve for $y=f(x)$ given the following parametric equations:\n$y(t)=9 t+13, x(t)=-9 t-15$", + "Output Answer": [ + "$y=-x-2$" + ], + "Output Program": [ + "from sympy import *\n\nx, y, t = symbols('x y t')\ny_t = 9*t+13\nx_t = -9*t-15\nt_x, *_ = solve(Eq(x, x_t), t)\nprint(y_t.subs(t, t_x).simplify())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(7 \\left(\\cos \\left(\\frac{7}{18}\\right)+i \\sin \\left(\\frac{7}{18}\\right)\\right)\\right)^2$", + "Output Answer": [ + "$49 \\left(\\cos \\left(\\frac{7}{9}\\right)+i \\sin \\left(\\frac{7}{9}\\right)\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((7*(math.cos((7/18))+1j*math.sin((7/18))))**2)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nGiven the equation $-4 x^2-5 x+6 y^2-10 y+4=0$, rewrite and classify the conic and state relevant properties.", + "Output Answer": [ + "Classification: Hyperbola\nEquation: $6 \\left(y-\\frac{5}{6}\\right)^2-4 \\left(x+\\frac{5}{8}\\right)^2=-\\frac{67}{48}$\nFoci: $\\left(\n\\begin{array}{cc}\n -\\frac{5}{8}-\\frac{\\sqrt{335}}{24} & \\frac{5}{6} \\\\\n \\frac{1}{24} \\left(\\sqrt{335}-15\\right) & \\frac{5}{6} \\\\\n\\end{array}\n\\right)$\nEccentricity: $\\sqrt{\\frac{5}{3}}$\nCenter: $\\left\\{\\frac{1}{2} \\left(-\\frac{5}{8}-\\frac{\\sqrt{335}}{24}+\\frac{1}{24} \\left(\\sqrt{335}-15\\right)\\right),\\frac{5}{6}\\right\\}$\nAsymptotes: $\\left\\{y=\\sqrt{\\frac{2}{3}} x+\\frac{5}{24} \\left(4+\\sqrt{6}\\right),y=-\\sqrt{\\frac{2}{3}} x-\\frac{5}{24} \\left(\\sqrt{6}-4\\right)\\right\\}$" + ], + "Output Program": [ + "import math\n\nimport math\nfrom sympy import *\nfrom sympy.abc import x, y\n\ncoeffs = Poly(-4*x**2-5*x+6*y**2-10*y+4, x, y).as_dict()\nprint(coeffs)\na = coeffs.get((2,0), 0)\nb = coeffs.get((1,0), 0)\nc = coeffs.get((0,2), 0)\nd = coeffs.get((0,1), 0)\ne = coeffs.get((0,0), 0)\n\nif a == 0 and c == 0:\n name = \"Line\"\n print(name)\nelif a == c: \n name = \"Circle\"\n print(name)\n # Rewriting in the form $(x-h)^2+(y-k)^2=r^2$\n h, k = -b/(2*a), -d/(2*a)\n print(\"Center:\", (h, k))\n r = sqrt((pow(b,2)+pow(d,2))/pow(2*a, 2)-e/a)\n print(\"Radius:\", r)\nelif c == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(x-h)^2=4p(y-k)$\n h = -b/(2*a)\n k = -e/d + pow(b,2)/(4*a*d)\n p = -d/(4*a)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h, k+p))\n print(\"Directrix:\", k-p)\nelif a == 0:\n name = \"Parabola\"\n print(name)\n # Rewriting in the form $(y-k)^2=4p(x-h)$\n k = -d/(2*c)\n h = -e/b + pow(d,2)/(4*c*b)\n p = -b/(4*c)\n print(\"Vertex:\", (h, k))\n print(\"Focus:\", (h+p, k))\n print(\"Directrix:\", h-p)\nelif a != c and a * c > 0:\n shape = \"Ellipse\"\n # Rewriting in the form $(x-h)^2/p^2+(y-k)^2/q^2=1$\n h = -b/(2*a)\n k = -d/(2*c)\n p = sqrt(pow(b,2)/(2*a*a)+pow(d,2)/(4*a*c)-e/a)\n q = sqrt(pow(b,2)/(2*a*c)+pow(d,2)/(4*c*c)-e/c)\n print(\"Name:\", shape)\n print(\"Center:\", (h, k))\nelif a * c < 0: \n # Rewriting in form $(x-h)^2/p - (y-k)^2/q=1$\n h = - b / 2 / a\n k = - d / 2 / c\n p = pow(b, 2) / (4 * pow(a, 2)) + pow(d, 2) / (4 * a * c) - e / a\n q = pow(d, 2) / (4 * pow(c, 2)) + pow(b, 2) / (4 * a * c) - e / c\n print(p, q, h, k)\n center = (h, k)\n shape = \"Hyperbola\"\n print(dict(Name=shape, Center=center))\n\n\n\n\n\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFactor the following quadratic: $10 x^2+110 x$", + "Output Answer": [ + "$10 x (x+11)$" + ], + "Output Program": [ + "from sympy import *\n\nx, a, b, c = symbols('x a b c')\n\n(a, b, c), *_ = solve(Eq(10*x**2+110*x, a*(x+b)*(x+c)), [a,b,c])\n\nprint(f'{a}(x+{b})(x+{c})')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following radical expression: $\\left(\\sqrt{27}+\\sqrt{60}\\right)+\\left(\\sqrt{12}-68\\right)$.", + "Output Answer": [ + "$-68+5 \\sqrt{3}+2 \\sqrt{15}$" + ], + "Output Program": [ + "from sympy import *\n\nprint((sqrt(27)+sqrt(60))+(sqrt(12)-68))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $x-y$ where $x=(2+3 i) \\pi$ and $y=(2-2 i) \\pi$", + "Output Answer": [ + "$5 i \\pi$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (2+3*i)*math.pi\ny = (2-2*i)*math.pi\nprint(x-y)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = 3 \\sqrt{5} x^2-6 \\sqrt{5} x+2 \\sqrt{5}$ and $q(x) = -\\sqrt{5} x^2-\\sqrt{5} x-\\sqrt{5}$", + "Output Answer": [ + "$-15 x^4+15 x^3+5 x^2+20 x-10$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = 3*sqrt(5)*x**2-6*sqrt(5)*x+2*sqrt(5)\nq = -sqrt(5)*x**2-sqrt(5)*x-sqrt(5)\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nMultiply and expand $p(x) = -10 x^2+12 x-12$ and $q(x) = -3 x^2-15 x-7$", + "Output Answer": [ + "$30 x^4+114 x^3-74 x^2+96 x+84$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\np = -10*x**2+12*x-12\nq = -3*x**2-15*x-7\nprint((p * q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nConsider the arithmetic sequence defined by $a_1=\\frac{98}{37}$, and $a_n=a_{n-1}+-\\frac{67}{7}$ for $n > 1$. Compute the nth partial sum, $S_n=\\sum_{k=1}^n a_k$, where $n=15$.", + "Output Answer": [ + "$-\\frac{35715}{37}$" + ], + "Output Program": [ + "a = (98/37) # initial value\nd = -(67/7) # second term\nn = 15 # steps\n\nanswer = 0 \nfor i in range(n):\n answer += a\n a += d\n\nprint(answer)\n", + "def sum_arithmetic_series(a1, n, d):\n # Use the formula for partial sum of arithmetic series\n return (2 * a1 + (n - 1) * d) * n / 2 \n\na1 = (98/37) # initial value\nd = -(67/7) # second term\nn = 15 # steps\nprint(sum_arithmetic_series(a1, n, d))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSolve the following system of two equations: \n$3 \\sqrt{2} x-17 \\sqrt{2} y+14 \\sqrt{2}=0$, $-\\frac{5 x}{\\sqrt{2}}-\\frac{25 y}{\\sqrt{2}}+15 \\sqrt{2}=0$", + "Output Answer": [ + "$x=1$, $y=1$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x, y\n\nprint(solve((3*sqrt(2)*x-17*sqrt(2)*y+14*sqrt(2), -((5*x)/(sqrt(2)))-((25*y)/(sqrt(2)))+15*sqrt(2)), (x, y)))\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify $\\left((((1+14)+23)-2)^2-9\\right)+((((17-5)-14)-16)+9)$.", + "Output Answer": [ + "$1278$" + ], + "Output Program": [ + "try: \n print(((((1+14)+23)-2)**2-9)+((((17-5)-14)-16)+9))\nexcept ZeroDivisionError:\n print('undefined')\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nExpand and find the sum $p(x) + q(x)$ of the following two polynomials: $p(x) = (5 x+6)^3, q(x) = (7-6 x)^4$", + "Output Answer": [ + "$1296 x^4-5923 x^3+11034 x^2-7692 x+2617$" + ], + "Output Program": [ + "from sympy import *\nfrom sympy.abc import x\n\np = (5*x+6)**3\nq = (7-6*x)**4\nprint((p + q).expand())\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind all roots of the following function: $\\sqrt[3]{\\sin ^{-1}\\left(\\frac{3}{2}-8 x\\right)}=0$", + "Output Answer": [ + "$\\left\\{\\left\\{x\\to \\frac{3}{16}\\right\\}\\right\\}$" + ], + "Output Program": [ + "from sympy import *\n\nx = symbols('x')\ntry:\n soln = solve(cbrt(asin((3/2)-8*x)), x)\n print(soln)\nexcept: ...\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nSimplify the following expression $\\left(-\\cos \\left(\\frac{7 \\pi }{30}\\right)+i \\sin \\left(\\frac{7 \\pi }{30}\\right)\\right)^3$", + "Output Answer": [ + "$\\sqrt{\\frac{5}{8}-\\frac{\\sqrt{5}}{8}}+\\frac{1}{4} i \\left(1+\\sqrt{5}\\right)$" + ], + "Output Program": [ + "import math\n\ni = 1j\nprint((-math.cos(((7*math.pi)/30))+1j*math.sin(((7*math.pi)/30)))**3)\n" + ], + "split": "test" + }, + { + "Input": "Problem:\nFind $\\frac{x}{y}$ where $x=(-5-2 i) \\sqrt{3}$ and $y=(5+5 i) \\sqrt{3}$", + "Output Answer": [ + "$-\\frac{7}{10}+\\frac{3 i}{10}$" + ], + "Output Program": [ + "import math\n\ni = 1j\nx = (-5-2*i)*math.sqrt(3)\ny = (5+5*i)*math.sqrt(3)\nprint((x/y))\n" + ], + "split": "test" + } + ] +} \ No newline at end of file