{
  "format": "mathssim",
  "version": 1,
  "title": "03 - Vector Algebra and Coordinate Systems",
  "computeMode": "standard",
  "functions": [],
  "notation": {
    "A": "\\mathbf{A}",
    "Amag": "\\left|\\mathbf{A}\\right|",
    "Ahat": "\\hat{\\mathbf{A}}",
    "Ahat_check": "\\left|\\hat{\\mathbf{A}}\\right|",
    "Avec": "\\mathbf{A}",
    "Bvec": "\\mathbf{B}",
    "AdotB": "\\mathbf{A}\\cdot\\mathbf{B}",
    "angleAB": "\\theta_{AB}",
    "B_parallel_scalar": "B_{\\parallel}",
    "BprojA": "\\operatorname{proj}_{\\mathbf{A}}\\mathbf{B}",
    "Evec": "\\mathbf{E}",
    "Hvec": "\\mathbf{H}",
    "Svec": "\\mathbf{S}",
    "rho0": "\\rho",
    "r0": "r",
    "drho": "\\mathrm{d}\\rho",
    "dphi": "\\mathrm{d}\\phi",
    "dz": "\\mathrm{d}z",
    "dtheta": "\\mathrm{d}\\theta",
    "dV_cyl": "\\mathrm{d}V_{\\mathrm{cyl}}",
    "dV_sph": "\\mathrm{d}V_{\\mathrm{sph}}"
  },
  "regions": [
    {
      "id": "ch03-head-001",
      "type": "text",
      "x": 65,
      "y": 35,
      "w": 990,
      "content": "03 - Vector Algebra and Coordinate Systems",
      "heading": true
    },
    {
      "id": "ch03-note-002",
      "type": "text",
      "x": 65,
      "y": 140,
      "w": 990,
      "content": "Interactive M²S companion to EM Course Document 03.\nVector components, projections, dot/cross products and Cartesian/cylindrical/spherical geometry.\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": "ch03-head-003",
      "type": "text",
      "x": 65,
      "y": 291,
      "w": 990,
      "content": "1. Components, magnitude and unit direction",
      "heading": true
    },
    {
      "id": "ch03-math-004",
      "type": "math",
      "x": 65,
      "y": 396,
      "w": 990,
      "target": "A",
      "expr": "[2,-3,6]"
    },
    {
      "id": "ch03-math-005",
      "type": "math",
      "x": 65,
      "y": 561,
      "w": 990,
      "target": "Amag",
      "expr": "norm(A)"
    },
    {
      "id": "ch03-math-006",
      "type": "math",
      "x": 65,
      "y": 726,
      "w": 990,
      "target": "Ahat",
      "expr": "A/Amag"
    },
    {
      "id": "ch03-math-007",
      "type": "math",
      "x": 65,
      "y": 891,
      "w": 990,
      "target": "Ahat_check",
      "expr": "norm(Ahat)"
    },
    {
      "id": "ch03-table-008",
      "type": "table",
      "x": 65,
      "y": 1056,
      "w": 990,
      "h": 280,
      "title": "Vector decomposition",
      "headersText": "Value",
      "rowLabels": "Ax\nAy\nAz\n|A|\n|Ahat|",
      "expr": "cols([at(A,0),at(A,1),at(A,2),Amag,Ahat_check])",
      "precision": "12"
    },
    {
      "id": "ch03-head-009",
      "type": "text",
      "x": 65,
      "y": 1426,
      "w": 990,
      "content": "2. Dot product and projection",
      "heading": true
    },
    {
      "id": "ch03-math-010",
      "type": "math",
      "x": 65,
      "y": 1531,
      "w": 990,
      "target": "Avec",
      "expr": "[3,4,0]"
    },
    {
      "id": "ch03-math-011",
      "type": "math",
      "x": 65,
      "y": 1696,
      "w": 990,
      "target": "Bvec",
      "expr": "[5,2,0]"
    },
    {
      "id": "ch03-math-012",
      "type": "math",
      "x": 65,
      "y": 1861,
      "w": 990,
      "target": "AdotB",
      "expr": "dot(Avec,Bvec)"
    },
    {
      "id": "ch03-math-013",
      "type": "math",
      "x": 65,
      "y": 2026,
      "w": 990,
      "target": "angleAB",
      "expr": "acos(AdotB/(norm(Avec)*norm(Bvec)))"
    },
    {
      "id": "ch03-math-014",
      "type": "math",
      "x": 65,
      "y": 2191,
      "w": 990,
      "target": "B_parallel_scalar",
      "expr": "AdotB/norm(Avec)"
    },
    {
      "id": "ch03-math-015",
      "type": "math",
      "x": 65,
      "y": 2356,
      "w": 990,
      "target": "BprojA",
      "expr": "(AdotB/dot(Avec,Avec))*Avec"
    },
    {
      "id": "ch03-table-016",
      "type": "table",
      "x": 65,
      "y": 2521,
      "w": 990,
      "h": 280,
      "title": "Projection geometry",
      "headersText": "Value",
      "rowLabels": "A·B\nAngle (deg)\nScalar component of B along A\nProjection x\nProjection y",
      "expr": "cols([AdotB,angleAB*180/pi,B_parallel_scalar,at(BprojA,0),at(BprojA,1)])",
      "precision": "12"
    },
    {
      "id": "ch03-head-017",
      "type": "text",
      "x": 65,
      "y": 2891,
      "w": 990,
      "content": "3. Cross product and EM power direction",
      "heading": true
    },
    {
      "id": "ch03-math-018",
      "type": "math",
      "x": 65,
      "y": 2996,
      "w": 990,
      "target": "Evec",
      "expr": "[100,0,0]"
    },
    {
      "id": "ch03-math-019",
      "type": "math",
      "x": 65,
      "y": 3161,
      "w": 990,
      "target": "Hvec",
      "expr": "[0,0.265,0]"
    },
    {
      "id": "ch03-math-020",
      "type": "math",
      "x": 65,
      "y": 3326,
      "w": 990,
      "target": "Svec",
      "expr": "cross(Evec,Hvec)"
    },
    {
      "id": "ch03-table-021",
      "type": "table",
      "x": 65,
      "y": 3491,
      "w": 990,
      "h": 280,
      "title": "Poynting-vector direction",
      "headersText": "Value",
      "rowLabels": "Sx (W/m²)\nSy (W/m²)\nSz (W/m²)",
      "expr": "cols([at(Svec,0),at(Svec,1),at(Svec,2)])",
      "precision": "12"
    },
    {
      "id": "ch03-head-022",
      "type": "text",
      "x": 65,
      "y": 3861,
      "w": 990,
      "content": "4. Cartesian vector field",
      "heading": true
    },
    {
      "id": "ch03-plot-023",
      "type": "plot",
      "kind": "quiver3d",
      "title": "3D Cartesian vector samples: F=(x,y,z)",
      "xexpr": "linspace(-1,1,5)",
      "yexpr": "linspace(-1,1,5)",
      "zexpr": "linspace(-1,1,5)",
      "x": 65,
      "y": 3966,
      "w": 990,
      "h": 500,
      "xlabel": "x",
      "ylabel": "y",
      "y2label": "",
      "zlabel": "z",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false,
      "uexpr": "x",
      "vexpr": "y",
      "wexpr": "z",
      "vectorStyle": "arrows",
      "vectorAutoScale": true,
      "vectorScale": 0.8,
      "vectorNormalize": true,
      "vectorHeadSize": 0.58,
      "vectorWidth": 2.0,
      "vectorOpacity": 0.9,
      "vectorDensity": 1,
      "vectorAnchor": "tail",
      "vectorColorMode": "magnitude",
      "vectorColor": "#2175b5",
      "vectorPalette": "Viridis",
      "showColorbar": true,
      "animate": false,
      "animVar": "t",
      "animStart": "0",
      "animStop": "2*pi",
      "animFrames": 32,
      "animFps": 14,
      "animLoop": true
    },
    {
      "id": "ch03-head-024",
      "type": "text",
      "x": 65,
      "y": 4571,
      "w": 990,
      "content": "5. Cylindrical coordinates: azimuthal field around a wire",
      "heading": true
    },
    {
      "id": "ch03-note-025",
      "type": "text",
      "x": 65,
      "y": 4676,
      "w": 990,
      "content": "For cylindrical symmetry, the local azimuthal direction changes with position. The field below is proportional to φ-hat and illustrates why cylindrical unit vectors are not globally fixed.",
      "heading": false
    },
    {
      "id": "ch03-plot-026",
      "type": "plot",
      "kind": "quiver2d",
      "title": "Azimuthal direction field in the x-y plane",
      "xexpr": "linspace(-1,1,10)",
      "yexpr": "linspace(-1,1,10)",
      "zexpr": "",
      "x": 65,
      "y": 4791,
      "w": 990,
      "h": 470,
      "xlabel": "x",
      "ylabel": "y",
      "y2label": "",
      "zlabel": "",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false,
      "uexpr": "-y/(x^2+y^2)",
      "vexpr": "x/(x^2+y^2)",
      "wexpr": "",
      "vectorAutoScale": true,
      "vectorScale": 0.85,
      "vectorNormalize": true,
      "vectorHeadSize": 0.42,
      "vectorWidth": 2.0,
      "vectorOpacity": 0.92,
      "vectorDensity": 1,
      "vectorAnchor": "tail",
      "vectorColorMode": "single",
      "vectorColor": "#2175b5",
      "vectorPalette": "Viridis",
      "showColorbar": false,
      "animate": false,
      "animVar": "t",
      "animStart": "0",
      "animStop": "2*pi",
      "animFrames": 36,
      "animFps": 16,
      "animLoop": true
    },
    {
      "id": "ch03-head-027",
      "type": "text",
      "x": 65,
      "y": 5366,
      "w": 990,
      "content": "6. Spherical geometry and radial fields",
      "heading": true
    },
    {
      "id": "ch03-plot-028",
      "type": "plot",
      "kind": "quiver3d",
      "title": "Radial unit direction field",
      "xexpr": "linspace(-1,1,6)",
      "yexpr": "linspace(-1,1,6)",
      "zexpr": "linspace(-1,1,6)",
      "x": 65,
      "y": 5471,
      "w": 990,
      "h": 500,
      "xlabel": "x",
      "ylabel": "y",
      "y2label": "",
      "zlabel": "z",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false,
      "uexpr": "x/sqrt(x^2+y^2+z^2)",
      "vexpr": "y/sqrt(x^2+y^2+z^2)",
      "wexpr": "z/sqrt(x^2+y^2+z^2)",
      "vectorStyle": "arrows",
      "vectorAutoScale": true,
      "vectorScale": 0.8,
      "vectorNormalize": true,
      "vectorHeadSize": 0.58,
      "vectorWidth": 2.0,
      "vectorOpacity": 0.9,
      "vectorDensity": 1,
      "vectorAnchor": "tail",
      "vectorColorMode": "single",
      "vectorColor": "#2175b5",
      "vectorPalette": "Viridis",
      "showColorbar": false,
      "animate": false,
      "animVar": "t",
      "animStart": "0",
      "animStop": "2*pi",
      "animFrames": 32,
      "animFps": 14,
      "animLoop": true
    },
    {
      "id": "ch03-head-029",
      "type": "text",
      "x": 65,
      "y": 6076,
      "w": 990,
      "content": "7. Differential volume elements",
      "heading": true
    },
    {
      "id": "ch03-math-030",
      "type": "math",
      "x": 65,
      "y": 6181,
      "w": 475,
      "target": "rho0",
      "expr": "0.8"
    },
    {
      "id": "ch03-math-031",
      "type": "math",
      "x": 560,
      "y": 6181,
      "w": 475,
      "target": "r0",
      "expr": "1.2"
    },
    {
      "id": "ch03-math-032",
      "type": "math",
      "x": 65,
      "y": 6346,
      "w": 475,
      "target": "drho",
      "expr": "0.02"
    },
    {
      "id": "ch03-math-033",
      "type": "math",
      "x": 560,
      "y": 6346,
      "w": 475,
      "target": "dphi",
      "expr": "0.03"
    },
    {
      "id": "ch03-math-034",
      "type": "math",
      "x": 65,
      "y": 6511,
      "w": 475,
      "target": "dz",
      "expr": "0.04"
    },
    {
      "id": "ch03-math-035",
      "type": "math",
      "x": 560,
      "y": 6511,
      "w": 475,
      "target": "dtheta",
      "expr": "0.025"
    },
    {
      "id": "ch03-math-036",
      "type": "math",
      "x": 65,
      "y": 6676,
      "w": 990,
      "target": "dV_cyl",
      "expr": "rho0*drho*dphi*dz"
    },
    {
      "id": "ch03-math-037",
      "type": "math",
      "x": 65,
      "y": 6841,
      "w": 990,
      "target": "dV_sph",
      "expr": "r0^2*sin(pi/3)*drho*dtheta*dphi"
    },
    {
      "id": "ch03-table-038",
      "type": "table",
      "x": 65,
      "y": 7006,
      "w": 990,
      "h": 280,
      "title": "Coordinate Jacobian examples",
      "headersText": "Value",
      "rowLabels": "Cylindrical dV = ρ dρ dφ dz\nSpherical dV = r² sinθ dr dθ dφ",
      "expr": "cols([dV_cyl,dV_sph])",
      "precision": "12"
    },
    {
      "id": "ch03-head-039",
      "type": "text",
      "x": 65,
      "y": 7376,
      "w": 990,
      "content": "Checkpoint / exploration",
      "heading": true
    },
    {
      "id": "ch03-note-040",
      "type": "text",
      "x": 65,
      "y": 7481,
      "w": 990,
      "content": "Change the coordinate-grid limits and compare the radial and azimuthal 3D/2D arrows. The field is physical; the coordinate description is a choice made to fit the geometry.",
      "heading": false
    }
  ]
}
