// Numbas version: finer_feedback_settings {"name": "1.2.3. Polynomial Expressions", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "1.2.3. Polynomial Expressions", "tags": [], "metadata": {"description": "

Part of HELM Book 1.2

", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "

Polynomial Expressions

\n

An important group of mathematical expressions which use indices are known as polynomials. Examples of polynomials are:

\n

\\(4x^3 +2x^2 +3x−7,\\quad x^2 +x,\\quad 17 −2t+7t^4, \\quad z −z^3 \\)

\n

Notice that they are all constructed using non-negative whole number powers of the variable. Recall that $x^0 = 1$ and so the number $−7$ appearing in the first expression can be thought of as $−7x^0$. Similarly the $17$ appearing in the third expression can be read as $17t^0$.

\n
\n

Key Point 8

\n

Polynomials

\n

A polynomial expression takes the form

\n

\\( a_0 + a_1x + a_2x^2 + a_3x^3 + : : : + a_nx^n \\)

\n

where $a_0$, $a_1$, $a_2$, $a_3$, $\\dots$ $a_n$ are all constants called the coeffcients of the polynomial. The number $a_0$ is also called the constant term. The highest power in a polynomial is called the degree of the polynomial.

\n

Polynomials with low degrees have special names and subscript notation is often not needed:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
PolynomialDegreeName
$ax^3+bx^2+cx+d$3cubic
$ax^2+bx+c$2quadratic
$ax+b$1linear
$a$0constant
\n
", "advice": "", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"q1_expr": {"name": "q1_expr", "group": "question 1", "definition": "latex(q1_expr_array[q1_idx])", "description": "", "templateType": "anything", "can_override": false}, "q1_expr_array": {"name": "q1_expr_array", "group": "question 1", "definition": "[\n string(random(-9,-8,-7,-6,-5,-4,-3-2,2,3,4,5,6,7,8,9)) + letter + \"^2 + \\\\frac\\{\" + string(random(1..9)) + \"\\}\\{\"+ letter +\"\\} +2\",\n \"\\\\frac\\{\"+ string(random(-9,-8,-7,-6,-5,-4,-3-2,2,3,4,5,6,7,8,9)) + \"\\}\\{\" + letter + \"+\" + string(random(1..9)) + \"\\}\",\n \"\\\\sqrt\\{\"+string(random(1..9))+letter+\"\\}\",\n string(random(-9,-8,-7,-6,-5,-4,-3-2,2,3,4,5,6,7,8,9)) + letter + \"+\" + string(random(1..9)),\n string(random(-9,-8,-7,-6,-5,-4,-3-2,2,3,4,5,6,7,8,9)) + letter + \"^2+\"+ string(random(1..9)) + letter +\"+\"+string(random(1..9))\n ]", "description": "", "templateType": "anything", "can_override": false}, "q1_idx": {"name": "q1_idx", "group": "question 1", "definition": "random(0..4)", "description": "", "templateType": "anything", "can_override": false}, "alphabet": {"name": "alphabet", "group": "Ungrouped variables", "definition": "['a','b','c','d','m','n','p','q','r','s','t','w','x','y','z']", "description": "", "templateType": "anything", "can_override": false}, "letter": {"name": "letter", "group": "Ungrouped variables", "definition": "alphabet[random(0..14)]", "description": "", "templateType": "anything", "can_override": false}, "q1_ans_array": {"name": "q1_ans_array", "group": "question 1", "definition": "[false, false, false, true, true]", "description": "", "templateType": "anything", "can_override": false}, "q1_ans": {"name": "q1_ans", "group": "question 1", "definition": "q1_ans_array[q1_idx]", "description": "", "templateType": "anything", "can_override": false}, "weighted_random_list": {"name": "weighted_random_list", "group": "question 2", "definition": "[[0,10],[1,1],[2,1],[3,1],[4,1],[5,1],[6,1],[7,1],[8,1],[9,1]]", "description": "", "templateType": "anything", "can_override": false}, "q2_quadratic": {"name": "q2_quadratic", "group": "question 2", "definition": "weighted_random(weighted_random_list)", "description": "", "templateType": "anything", "can_override": false}, "q2_linear": {"name": "q2_linear", "group": "question 2", "definition": "weighted_random(weighted_random_list)", "description": "", "templateType": "anything", "can_override": false}, "q2_constant": {"name": "q2_constant", "group": "question 2", "definition": "random(0..9 except q2_quadratic)", "description": "", "templateType": "anything", "can_override": false}, "q2_expr": {"name": "q2_expr", "group": "question 2", "definition": "simplify(expression(q2_expr_parts[0] + q2_sgn1 + q2_expr_parts[1] + q2_sgn2 + q2_expr_parts[2]),[\"basic\",\"unitFactor\",\"unitPower\",\"zeroFactor\",\"zeroTerm\"])", "description": "", "templateType": "anything", "can_override": false}, "q2_sgn1": {"name": "q2_sgn1", "group": "question 2", "definition": "random(\"+\",\"-\")", "description": "", "templateType": "anything", "can_override": false}, "q2_sgn2": {"name": "q2_sgn2", "group": "question 2", "definition": "random(\"+\",\"-\")", "description": "", "templateType": "anything", "can_override": false}, "q2_expr_parts": {"name": "q2_expr_parts", "group": "question 2", "definition": "shuffle([q2_quadratic + letter + \"^2\",\n q2_linear + letter,\n q2_constant\n ])", "description": "", "templateType": "anything", "can_override": false}, "q3_expr": {"name": "q3_expr", "group": "question 3", "definition": "simplify(expression(string(simplify(\nexpression( \n q3_expr_bits[0] + \"+\" + q3_expr_bits[1] + \"+\" + q3_expr_bits[2] + \"+\" +\n q3_expr_bits[3] + \"+\" + q3_expr_bits[4] + \"+\" + q3_expr_bits[5] + \"+\" +\n q3_expr_bits[6] + \"+\" + q3_expr_bits[7] + \"+\" + q3_expr_bits[8] + \"+\" +\n q3_expr_bits[9] ),\n[\"all\"]))),[\"all\"])", "description": "

The reason for the convoluted double simplification is because without this, you occasionally got an expression with a +- in front of the second term. Why? I have no idea. Multiple iterations of \"simplify\" did not change it. But simplifying the expression, converting to a string and then repeating seems to fix it!!!

", "templateType": "anything", "can_override": false}, "q3_deg": {"name": "q3_deg", "group": "question 3", "definition": "if(q3_coeffs[0]<>0,9,\n if(q3_coeffs[1]<>0,8,\n if(q3_coeffs[2]<>0,7,\n if(q3_coeffs[3]<>0,6,\n if(q3_coeffs[4]<>0,5,\n if(q3_coeffs[5]<>0,4,\n if(q3_coeffs[6]<>0,3,\n if(q3_coeffs[7]<>0,2,\n if(q3_coeffs[8]<>0,1,0\n )))))))))", "description": "", "templateType": "anything", "can_override": false}, "q3_coeffs": {"name": "q3_coeffs", "group": "question 3", "definition": "[weighted_random([[0,4],[1,1]]) * random(-9..9),\n weighted_random([[0,4],[1,1]]) * random(-9..9),\n weighted_random([[0,4],[1,1]]) * random(-9..9),\n weighted_random([[0,3],[1,1]]) * random(-9..9),\n weighted_random([[0,3],[1,1]]) * random(-9..9),\n weighted_random([[0,3],[1,1]]) * random(-9..9),\n weighted_random([[0,2],[1,1]]) * random(-9..9),\n weighted_random([[0,2],[1,1]]) * random(-9..9),\n weighted_random([[0,2],[1,1]]) * random(-9..9),\n random(-9..9)\n ]", "description": "", "templateType": "anything", "can_override": false}, "q3_expr_bits": {"name": "q3_expr_bits", "group": "question 3", "definition": "shuffle([q3_coeffs[0] + letter + \"^9\",\n q3_coeffs[1] + letter + \"^8\" , \n q3_coeffs[2] + letter + \"^7\" , \n q3_coeffs[3] + letter + \"^6\" , \n q3_coeffs[4] + letter + \"^5\" , \n q3_coeffs[5] + letter + \"^4\" , \n q3_coeffs[6] + letter + \"^3\" , \n q3_coeffs[7] + letter + \"^2\" , \n q3_coeffs[8] + letter , \n q3_coeffs[9] \n ])", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["alphabet", "letter"], "variable_groups": [{"name": "question 1", "variables": ["q1_expr_array", "q1_expr", "q1_idx", "q1_ans_array", "q1_ans"]}, {"name": "question 2", "variables": ["weighted_random_list", "q2_quadratic", "q2_linear", "q2_constant", "q2_expr", "q2_sgn1", "q2_sgn2", "q2_expr_parts"]}, {"name": "question 3", "variables": ["q3_expr", "q3_deg", "q3_coeffs", "q3_expr_bits"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question", "contributors": [{"name": "Merryn Horrocks", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4052/"}]}]}], "contributors": [{"name": "Merryn Horrocks", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4052/"}]}