// Numbas version: finer_feedback_settings {"name": "Calculate divergence of vector fields", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [], "variables": {"b1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)*sign(random(-1,1))", "description": "", "name": "b1"}, "c1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)*sign(random(-1,1))", "description": "", "name": "c1"}, "a3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)*sign(random(-1,1))", "description": "", "name": "a3"}, "c3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)*sign(random(-1,1))", "description": "", "name": "c3"}, "p1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..9)", "description": "", "name": "p1"}, "a1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)*sign(random(-1,1))", "description": "", "name": "a1"}, "a2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)*sign(random(1,1))", "description": "", "name": "a2"}, "b3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)*sign(random(-1,1))", "description": "", "name": "b3"}}, "ungrouped_variables": ["p1", "a1", "a3", "a2", "b1", "b3", "c3", "c1"], "name": "Calculate divergence of vector fields", "functions": {}, "preamble": {"css": "", "js": ""}, "parts": [{"customMarkingAlgorithm": "", "showCorrectAnswer": true, "prompt": "
$\\boldsymbol{u}=\\pmatrix{(\\simplify[std]{{a1}*x+{b1}*y+{c1}*z})(\\simplify[std]{{b1}*y-{c1}*z}),(\\simplify[std]{{a1}*y+{b1}*z+{c1}*x})(\\simplify[std]{{b1}*z-{c1}*x}),(\\simplify[std]{{a1}*z+{b1}*x+{c1}*y})(\\simplify[std]{{b1}*x-{c1}*y})}$.
\n$\\boldsymbol{\\nabla\\cdot u}=$ [[0]].
", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"answer": "{a1*b1-a1*c1}*x+{a1*b1-a1*c1}*y+{a1*b1-a1*c1}*z", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "failureRate": 1, "customMarkingAlgorithm": "", "checkingType": "absdiff", "vsetRangePoints": 5, "showPreview": true, "checkVariableNames": true, "unitTests": [], "vsetRange": [0, 1], "type": "jme", "showFeedbackIcon": true, "scripts": {}, "answerSimplification": "all", "expectedVariableNames": ["x", "y", "z"], "checkingAccuracy": 0.001, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "sortAnswers": false}, {"customMarkingAlgorithm": "", "showCorrectAnswer": true, "prompt": "$\\boldsymbol{u}=\\pmatrix{\\left(x^\\var{p1}+y^\\var{p1}\\right)\\left(\\simplify{{a2}*y^{p1-1}-{a2}*z^{p1-1}}\\right),\\left(y^\\var{p1}+z^\\var{p1}\\right)\\left(\\simplify{{a2}*z^{p1-1}-{a2}*x^{p1-1}}\\right),\\left(z^\\var{p1}+x^\\var{p1}\\right)\\left(\\simplify{{a2}*x^{p1-1}-{a2}*y^{p1-1}}\\right)}$.
\n$\\boldsymbol{\\nabla\\cdot u}=$ [[0]].
", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"answer": "0", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "failureRate": 1, "customMarkingAlgorithm": "", "checkingType": "absdiff", "vsetRangePoints": 5, "showPreview": true, "checkVariableNames": true, "unitTests": [], "vsetRange": [0, 1], "type": "jme", "showFeedbackIcon": true, "scripts": {}, "answerSimplification": "all", "expectedVariableNames": ["x", "y", "z"], "checkingAccuracy": 0.001, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "sortAnswers": false}, {"customMarkingAlgorithm": "", "showCorrectAnswer": true, "prompt": "$\\boldsymbol{u}=\\pmatrix{\\simplify{{a3}*x}+f_1(y,z),\\simplify{{b3}*y}+f_2(x,z),\\simplify{{c3}*z}+f_3(x,y)}$, for any general functions $f_1$, $f_2$, and $f_3$.
\n$\\boldsymbol{\\nabla\\cdot u}=$ [[0]].
", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"answer": "{a3+b3+c3}", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "failureRate": 1, "customMarkingAlgorithm": "", "checkingType": "absdiff", "vsetRangePoints": 5, "showPreview": true, "checkVariableNames": true, "unitTests": [], "vsetRange": [0, 1], "type": "jme", "showFeedbackIcon": true, "scripts": {}, "answerSimplification": "all", "expectedVariableNames": ["x", "y", "z"], "checkingAccuracy": 0.001, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "sortAnswers": false}], "statement": "For each of the following vector fields $\\boldsymbol{u}$, find the divergence $\\boldsymbol{\\nabla\\cdot u}$.
", "tags": ["checked2015"], "rulesets": {"std": ["all", "!noLeadingMinus", "!collectNumbers"]}, "extensions": [], "type": "question", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "Divergence of vector fields.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "The divergence of a vector field $\\boldsymbol{u}=\\pmatrix{u_1,u_2,u_3}$ is given by
\n\\[\\boldsymbol{\\nabla\\cdot u}=\\frac{\\partial u_1}{\\partial x}+\\frac{\\partial u_2}{\\partial y}+\\frac{\\partial u_3}{\\partial z}.\\]
\na)
\nThe variables $x$, $y$, and $z$ appear in a cyclical manner in each of the three components of $\\boldsymbol{u}$. Once you have calculated $\\frac{\\partial u_1}{\\partial x}$, you can use cyclic permutations to determine the other two derivatives. Hence
\n\\[\\begin{align}\\frac{\\partial u_1}{\\partial x}&=\\frac{\\partial}{\\partial x}\\left(\\simplify{({a1}*x+{b1}*y+{c1}*z)*({b1}*y-{c1}*z)}\\right)\\\\&=\\simplify{{a1}*({b1}*y-{c1}*z)},\\end{align}\\]
\nand so, cyclically permuting the variables,
\n\\[\\frac{\\partial u_2}{\\partial y}=\\simplify{{a1}*({b1}*z-{c1}*x)}\\]
\nand
\n\\[\\frac{\\partial u_3}{\\partial z}=\\simplify{{a1}*({b1}*x-{c1}*y)}.\\]
\nFinally, adding the components together gives the divergence
\n\\[\\boldsymbol{\\nabla\\cdot u}=\\simplify[std]{{a1}*({b1}*y-{c1}*z)+{a1}*({b1}*z-{c1}*x)+{a1}*({b1}*x-{c1}*y)}=\\simplify{{a1*b1-a1*c1}*x+{a1*b1-a1*c1}*y+{a1*b1-a1*c1}*z}.\\]
\n\n
b)
\nAs in part a) the variables $x$, $y$, and $z$ appear cyclically in each component of $\\boldsymbol{u}$, so we only need calculate one derivative explicitly, then use cyclic permutations to calculate the other two. Hence
\n\\[\\begin{align}\\frac{\\partial u_1}{\\partial x}&=\\frac{\\partial}{\\partial x}\\left\\{\\left(x^\\var{p1}+y^\\var{p1}\\right)\\left(\\simplify{{a2}*y^{p1-1}-{a2}*z^{p1-1}}\\right)\\right\\}\\\\&=\\simplify{{p1}*x^{p1-1}}\\left(\\simplify{{a2}*y^{p1-1}-{a2}*z^{p1-1}}\\right),\\end{align}\\]
\nand by symmetry
\n\\[\\frac{\\partial u_2}{\\partial y}=\\simplify{{p1}*y^{p1-1}}\\left(\\simplify{{a2}*z^{p1-1}-{a2}*x^{p1-1}}\\right),\\]
\nand
\n\\[\\frac{\\partial u_3}{\\partial z}=\\simplify{{p1}*z^{p1-1}}\\left(\\simplify{{a2}*x^{p1-1}-{a2}*y^{p1-1}}\\right).\\]
\nFinally, adding the derivatives together gives the divergence
\n\\[\\boldsymbol{\\nabla\\cdot u}=\\simplify{{p1}*x^{p1-1}}\\left(\\simplify{{a2}*y^{p1-1}-{a2}*z^{p1-1}}\\right)+\\simplify{{p1}*y^{p1-1}}\\left(\\simplify{{a2}*z^{p1-1}-{a2}*x^{p1-1}}\\right)+\\simplify{{p1}*z^{p1-1}}\\left(\\simplify{{a2}*x^{p1-1}-{a2}*y^{p1-1}}\\right)=0.\\]
\n\n
c)
\nFirst note that $f_1$ does not depend on $z$, $f_2$ does not depend on $y$, and $f_3$ does not depend on $z$. This makes the differentiation very straight forward, and hence
\n\\[\\begin{align}\\boldsymbol{\\nabla\\cdot u}&=\\frac{\\partial}{\\partial x}\\left(\\simplify{{a3}*x}+f_1(y,z)\\right)+\\frac{\\partial}{\\partial y}\\left(\\simplify{{b3}*y}+f_2(x,z)\\right)+\\frac{\\partial}{\\partial z}\\left(\\simplify{{c3}*z}+f_3(x,y)\\right)\\\\&=\\simplify[all,!collectNumbers]{{a3}+{b3}+{c3}}\\\\&=\\var{a3+b3+c3}.\\end{align}\\]
", "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}