{
  "format": "mathssim",
  "version": 1,
  "title": "04 - Multivariable Calculus and Integration for EM",
  "computeMode": "standard",
  "functions": [],
  "notation": {
    "xP": "x_0",
    "yP": "y_0",
    "dVdx": "\\frac{\\partial V}{\\partial x}",
    "dVdy": "\\frac{\\partial V}{\\partial y}",
    "int1": "I",
    "sheet_charge": "Q_s",
    "line_int": "\\int_C \\mathbf{F}\\cdot\\mathrm{d}\\mathbf{l}",
    "tpath": "t",
    "xpath": "x(t)",
    "ypath": "y(t)",
    "Rcircle": "R",
    "circ_int": "\\oint_C \\mathbf{F}\\cdot\\mathrm{d}\\mathbf{l}",
    "th": "\\theta",
    "xc": "x(\\theta)",
    "yc": "y(\\theta)",
    "D0": "D_0",
    "Area": "A",
    "normal_angle": "\\theta_n",
    "fluxD": "\\Phi_D",
    "rho_v": "\\rho_v",
    "a_cyl": "a",
    "L_cyl": "L",
    "Q_cyl": "Q",
    "V_cyl_numeric": "V_{\\mathrm{num}}",
    "V_cyl_closed": "V_{\\mathrm{closed}}",
    "volume_residual": "\\Delta V"
  },
  "regions": [
    {
      "id": "ch04-head-001",
      "type": "text",
      "x": 65,
      "y": 35,
      "w": 990,
      "content": "04 - Multivariable Calculus and Integration for EM",
      "heading": true
    },
    {
      "id": "ch04-note-002",
      "type": "text",
      "x": 65,
      "y": 140,
      "w": 990,
      "content": "Interactive M²S companion to EM Course Document 04.\nPartial derivatives, path/circulation integrals, surface flux, volume integrals and coordinate Jacobians.\nEdit the input Math regions, then Calculate. M²S values are unitless, so SI units are stated explicitly in labels and notes.",
      "heading": false
    },
    {
      "id": "ch04-head-003",
      "type": "text",
      "x": 65,
      "y": 291,
      "w": 990,
      "content": "1. Partial derivatives of a scalar field",
      "heading": true
    },
    {
      "id": "ch04-math-004",
      "type": "math",
      "x": 65,
      "y": 396,
      "w": 475,
      "target": "xP",
      "expr": "1"
    },
    {
      "id": "ch04-math-005",
      "type": "math",
      "x": 560,
      "y": 396,
      "w": 475,
      "target": "yP",
      "expr": "2"
    },
    {
      "id": "ch04-math-006",
      "type": "math",
      "x": 65,
      "y": 561,
      "w": 990,
      "target": "dVdx",
      "expr": "partial(x^2+0.5*yP^2,x,xP)"
    },
    {
      "id": "ch04-math-007",
      "type": "math",
      "x": 65,
      "y": 726,
      "w": 990,
      "target": "dVdy",
      "expr": "partial(xP^2+0.5*y^2,y,yP)"
    },
    {
      "id": "ch04-table-008",
      "type": "table",
      "x": 65,
      "y": 891,
      "w": 990,
      "h": 280,
      "title": "Local derivative at (1,2)",
      "headersText": "Value",
      "rowLabels": "∂V/∂x\n∂V/∂y",
      "expr": "cols([dVdx,dVdy])",
      "precision": "12"
    },
    {
      "id": "ch04-plot-009",
      "type": "plot",
      "kind": "surface",
      "title": "V(x,y)=x²+0.5y²",
      "xexpr": "linspace(-2,2,45)",
      "yexpr": "linspace(-2,2,45)",
      "zexpr": "x^2+0.5*y^2",
      "x": 65,
      "y": 1261,
      "w": 990,
      "h": 450,
      "xlabel": "x",
      "ylabel": "y",
      "y2label": "",
      "zlabel": "V",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false
    },
    {
      "id": "ch04-plot-010",
      "type": "plot",
      "kind": "contour",
      "title": "Equipotential contours",
      "xexpr": "linspace(-2,2,65)",
      "yexpr": "linspace(-2,2,65)",
      "zexpr": "x^2+0.5*y^2",
      "x": 65,
      "y": 1816,
      "w": 990,
      "h": 430,
      "xlabel": "x",
      "ylabel": "y",
      "y2label": "",
      "zlabel": "V",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false
    },
    {
      "id": "ch04-head-011",
      "type": "text",
      "x": 65,
      "y": 2351,
      "w": 990,
      "content": "2. One-dimensional and area integration",
      "heading": true
    },
    {
      "id": "ch04-math-012",
      "type": "math",
      "x": 65,
      "y": 2456,
      "w": 990,
      "target": "int1",
      "expr": "integral(3*x^2,x,0,2)"
    },
    {
      "id": "ch04-math-013",
      "type": "math",
      "x": 65,
      "y": 2621,
      "w": 990,
      "target": "sheet_charge",
      "expr": "integral(integral(2e-6*(1+x),x,0,1),y,0,0.5)"
    },
    {
      "id": "ch04-table-014",
      "type": "table",
      "x": 65,
      "y": 2786,
      "w": 990,
      "h": 280,
      "title": "Integration examples",
      "headersText": "Value",
      "rowLabels": "∫0² 3x² dx\nSheet charge for ρs=2 µC/m²(1+x), 1×0.5 m",
      "expr": "cols([int1,sheet_charge])",
      "precision": "12"
    },
    {
      "id": "ch04-head-015",
      "type": "text",
      "x": 65,
      "y": 3156,
      "w": 990,
      "content": "3. Line integral along a parametrised path",
      "heading": true
    },
    {
      "id": "ch04-note-016",
      "type": "text",
      "x": 65,
      "y": 3261,
      "w": 990,
      "content": "Course worked path: E = 2x xhat + 3 yhat; r(t)=2t xhat+t yhat, 0≤t≤1. Then E·dl = (8t+3)dt.",
      "heading": false
    },
    {
      "id": "ch04-math-017",
      "type": "math",
      "x": 65,
      "y": 3376,
      "w": 990,
      "target": "line_int",
      "expr": "integral(8*t+3,t,0,1)"
    },
    {
      "id": "ch04-math-018",
      "type": "math",
      "x": 65,
      "y": 3541,
      "w": 990,
      "target": "tpath",
      "expr": "linspace(0,1,101)"
    },
    {
      "id": "ch04-math-019",
      "type": "math",
      "x": 65,
      "y": 3706,
      "w": 990,
      "target": "xpath",
      "expr": "2*tpath"
    },
    {
      "id": "ch04-math-020",
      "type": "math",
      "x": 65,
      "y": 3871,
      "w": 990,
      "target": "ypath",
      "expr": "tpath"
    },
    {
      "id": "ch04-plot-021",
      "type": "plot",
      "kind": "scatter",
      "title": "Straight integration path",
      "xexpr": "xpath",
      "yexpr": "y := ypath",
      "zexpr": "",
      "x": 65,
      "y": 4036,
      "w": 990,
      "h": 390,
      "xlabel": "x (m)",
      "ylabel": "y (m)",
      "y2label": "",
      "zlabel": "",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false
    },
    {
      "id": "ch04-head-022",
      "type": "text",
      "x": 65,
      "y": 4531,
      "w": 990,
      "content": "4. Closed-line circulation",
      "heading": true
    },
    {
      "id": "ch04-note-023",
      "type": "text",
      "x": 65,
      "y": 4636,
      "w": 990,
      "content": "For F=(-y,x), a circular path r=(R cosθ,R sinθ) has F·dl = R² dθ, so the circulation is 2πR². This anticipates Stokes’ theorem.",
      "heading": false
    },
    {
      "id": "ch04-math-024",
      "type": "math",
      "x": 65,
      "y": 4751,
      "w": 990,
      "target": "Rcircle",
      "expr": "1.5"
    },
    {
      "id": "ch04-math-025",
      "type": "math",
      "x": 65,
      "y": 4916,
      "w": 990,
      "target": "circ_int",
      "expr": "integral(Rcircle^2,theta,0,2*pi)"
    },
    {
      "id": "ch04-math-026",
      "type": "math",
      "x": 65,
      "y": 5081,
      "w": 990,
      "target": "th",
      "expr": "linspace(0,2*pi,241)"
    },
    {
      "id": "ch04-math-027",
      "type": "math",
      "x": 65,
      "y": 5246,
      "w": 990,
      "target": "xc",
      "expr": "Rcircle*cos(th)"
    },
    {
      "id": "ch04-math-028",
      "type": "math",
      "x": 65,
      "y": 5411,
      "w": 990,
      "target": "yc",
      "expr": "Rcircle*sin(th)"
    },
    {
      "id": "ch04-plot-029",
      "type": "plot",
      "kind": "scatter",
      "title": "Closed circular path",
      "xexpr": "xc",
      "yexpr": "y := yc",
      "zexpr": "",
      "x": 65,
      "y": 5576,
      "w": 990,
      "h": 390,
      "xlabel": "x",
      "ylabel": "y",
      "y2label": "",
      "zlabel": "",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false
    },
    {
      "id": "ch04-head-030",
      "type": "text",
      "x": 65,
      "y": 6071,
      "w": 990,
      "content": "5. Surface flux and volume integration",
      "heading": true
    },
    {
      "id": "ch04-math-031",
      "type": "math",
      "x": 65,
      "y": 6176,
      "w": 475,
      "target": "D0",
      "expr": "5e-6"
    },
    {
      "id": "ch04-math-032",
      "type": "math",
      "x": 560,
      "y": 6176,
      "w": 475,
      "target": "Area",
      "expr": "0.20"
    },
    {
      "id": "ch04-math-033",
      "type": "math",
      "x": 65,
      "y": 6341,
      "w": 990,
      "target": "normal_angle",
      "expr": "30*pi/180"
    },
    {
      "id": "ch04-math-034",
      "type": "math",
      "x": 65,
      "y": 6506,
      "w": 990,
      "target": "fluxD",
      "expr": "D0*Area*cos(normal_angle)"
    },
    {
      "id": "ch04-math-035",
      "type": "math",
      "x": 65,
      "y": 6671,
      "w": 475,
      "target": "rho_v",
      "expr": "4e-6"
    },
    {
      "id": "ch04-math-036",
      "type": "math",
      "x": 560,
      "y": 6671,
      "w": 475,
      "target": "a_cyl",
      "expr": "0.020"
    },
    {
      "id": "ch04-math-037",
      "type": "math",
      "x": 65,
      "y": 6836,
      "w": 990,
      "target": "L_cyl",
      "expr": "0.100"
    },
    {
      "id": "ch04-math-038",
      "type": "math",
      "x": 65,
      "y": 7001,
      "w": 990,
      "target": "Q_cyl",
      "expr": "rho_v*pi*a_cyl^2*L_cyl"
    },
    {
      "id": "ch04-table-039",
      "type": "table",
      "x": 65,
      "y": 7166,
      "w": 990,
      "h": 280,
      "title": "Flux and volume-charge checks",
      "headersText": "Value",
      "rowLabels": "D-flux through tilted surface (C)\nUniform cylinder charge (C)",
      "expr": "cols([fluxD,Q_cyl])",
      "precision": "12"
    },
    {
      "id": "ch04-head-040",
      "type": "text",
      "x": 65,
      "y": 7536,
      "w": 990,
      "content": "6. Coordinate integration",
      "heading": true
    },
    {
      "id": "ch04-math-041",
      "type": "math",
      "x": 65,
      "y": 7641,
      "w": 990,
      "target": "V_cyl_numeric",
      "expr": "integral(integral(integral(rho,rho,0,a_cyl),phi,0,2*pi),z,0,L_cyl)"
    },
    {
      "id": "ch04-math-042",
      "type": "math",
      "x": 65,
      "y": 7806,
      "w": 990,
      "target": "V_cyl_closed",
      "expr": "pi*a_cyl^2*L_cyl"
    },
    {
      "id": "ch04-math-043",
      "type": "math",
      "x": 65,
      "y": 7971,
      "w": 990,
      "target": "volume_residual",
      "expr": "V_cyl_numeric-V_cyl_closed"
    },
    {
      "id": "ch04-table-044",
      "type": "table",
      "x": 65,
      "y": 8136,
      "w": 990,
      "h": 280,
      "title": "Cylindrical Jacobian check",
      "headersText": "Value",
      "rowLabels": "Numerical ∭ρ dρdφdz\nπa²L\nResidual",
      "expr": "cols([V_cyl_numeric,V_cyl_closed,volume_residual])",
      "precision": "12"
    },
    {
      "id": "ch04-head-045",
      "type": "text",
      "x": 65,
      "y": 8506,
      "w": 990,
      "content": "Checkpoint / exploration",
      "heading": true
    },
    {
      "id": "ch04-note-046",
      "type": "text",
      "x": 65,
      "y": 8611,
      "w": 990,
      "content": "For every integral, identify the domain before evaluating it: path, open/closed surface, or volume. Then check the differential element and orientation.",
      "heading": false
    }
  ]
}
