// Numbas version: finer_feedback_settings {"name": "Harry's copy of 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": [{"extensions": [], "tags": [], "parts": [{"variableReplacements": [], "scripts": {}, "showCorrectAnswer": true, "marks": 0, "type": "gapfill", "showFeedbackIcon": true, "gaps": [{"checkvariablenames": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "marks": 1, "type": "jme", "checkingtype": "absdiff", "vsetrange": [0, 1], "answersimplification": "all", "expectedvariablenames": ["x", "y", "z"], "answer": "{a1*b1}x^{{b1}-1}*y^{a1}{c1}z+{a5}z^{a7}+{a1}", "vsetrangepoints": 5, "scripts": {}, "showCorrectAnswer": true, "showpreview": true, "showFeedbackIcon": true, "checkingaccuracy": 0.001}], "variableReplacementStrategy": "originalfirst", "prompt": "
$\\boldsymbol{u}=(\\simplify[std]{x^{b1}*y^{a1}{c1}*z})i + (\\simplify[std]{{a5}*y*z^{a7}+{c1}x^{a3}})j + (\\simplify[std]{{a1}*z+{b1}x+{c1}y})k$
\n$\\boldsymbol{\\nabla\\cdot u}=$ [[0]]
"}, {"variableReplacements": [], "scripts": {}, "showCorrectAnswer": true, "marks": 0, "type": "gapfill", "showFeedbackIcon": true, "gaps": [{"checkvariablenames": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "marks": 1, "type": "jme", "checkingtype": "absdiff", "vsetrange": [0, 1], "answersimplification": "all", "expectedvariablenames": ["x", "y", "z"], "answer": "0", "vsetrangepoints": 5, "scripts": {}, "showCorrectAnswer": true, "showpreview": true, "showFeedbackIcon": true, "checkingaccuracy": 0.001}], "variableReplacementStrategy": "originalfirst", "prompt": "$\\boldsymbol{u}=(\\simplify[std]{x^{a5}y*z^2})i + (\\simplify[std]{x^{a6}*y*z^{a5}+{c1}y*z^{a8}})j+ (\\simplify[std]{{a5}y^2*z^{a2}+{a3}x+{a7}y^2})k $
\n$\\boldsymbol{\\nabla\\cdot u}=$ [[0]]
"}], "preamble": {"js": "", "css": ""}, "name": "Harry's copy of Calculate divergence of vector fields", "functions": {}, "variable_groups": [], "rulesets": {"std": ["all", "!noLeadingMinus", "!collectNumbers"]}, "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "For each of the following vector fields $\\boldsymbol{u}$, find the divergence $\\boldsymbol{\\nabla\\cdot u}$.
", "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_1(x,z)\\right)+\\frac{\\partial}{\\partial z}\\left(\\simplify{{c3}*z}+f_1(x,y)\\right)\\\\&=\\simplify[all,!collectNumbers]{{a3}+{b3}+{c3}}\\\\&=\\var{a3+b3+c3}.\\end{align}\\]
", "ungrouped_variables": ["p1", "a1", "a3", "a2", "b1", "b3", "c3", "c1", "a5", "a6", "a7", "a8"], "variables": {"a1": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..9)*sign(random(-1,1,1))", "name": "a1"}, "a6": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..9)", "name": "a6"}, "a5": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..9)", "name": "a5"}, "a2": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..9)*sign(random(-1,1,1))", "name": "a2"}, "p1": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(2..9)", "name": "p1"}, "b3": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..9)*sign(random(-1,1,1))", "name": "b3"}, "a8": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(2..5)", "name": "a8"}, "a3": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..9)*sign(random(-1,1,1))", "name": "a3"}, "a7": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..9)", "name": "a7"}, "b1": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..5)*sign(random(-1,1,1))", "name": "b1"}, "c3": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..9)*sign(random(-1,1,1))", "name": "c3"}, "c1": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(1..9)*sign(random(-1,1,1))", "name": "c1"}}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "Divergence of vector fields.
"}, "type": "question", "contributors": [{"name": "Harry Flynn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/976/"}]}]}], "contributors": [{"name": "Harry Flynn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/976/"}]}