{
  "format": "mathssim",
  "version": 1,
  "title": "02 - Complex Numbers, Exponentials and Phasors",
  "computeMode": "standard",
  "functions": [],
  "notation": {
    "zr": "z_r",
    "zi": "z_i",
    "zmag": "\\left|z\\right|",
    "zphase": "\\arg z",
    "zconj": "z^{*}",
    "mag_sq_check": "\\left|z\\right|^2",
    "theta": "\\theta",
    "unitCircle": "e^{j\\theta}",
    "V0": "V_0",
    "phi_deg": "\\phi_{\\mathrm{deg}}",
    "phi": "\\phi",
    "Vphasor": "\\tilde{V}",
    "tphase": "\\omega t",
    "vtime": "v(t)",
    "V1": "\\tilde{V}_1",
    "V2": "\\tilde{V}_2",
    "Vsum": "\\tilde{V}",
    "Vsum_mag": "\\left|\\tilde{V}\\right|",
    "Vsum_phase_deg": "\\angle\\tilde{V}",
    "Rohm": "R",
    "Lhenry": "L",
    "freq": "f",
    "omega": "\\omega",
    "Zseries": "Z",
    "Zseries_mag": "\\left|Z\\right|",
    "Zseries_deg": "\\angle Z",
    "Vrms": "V_{\\mathrm{rms}}",
    "Irms": "I_{\\mathrm{rms}}",
    "Scomplex": "\\tilde{S}",
    "Pwatts": "P",
    "Qvars": "Q",
    "alpha": "\\alpha",
    "beta": "\\beta",
    "zaxis": "z",
    "Ephasor_z": "\\tilde{E}(z)",
    "Emag_z": "\\left|\\tilde{E}(z)\\right|",
    "Ereal_z": "E(z)"
  },
  "regions": [
    {
      "id": "ch02-head-001",
      "type": "text",
      "x": 65,
      "y": 35,
      "w": 990,
      "content": "02 - Complex Numbers, Exponentials and Phasors",
      "heading": true
    },
    {
      "id": "ch02-note-002",
      "type": "text",
      "x": 65,
      "y": 140,
      "w": 990,
      "content": "Interactive M²S companion to EM Course Document 02.\nComplex plane, Euler identity, phasors, impedance, complex power and propagation exponentials.\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": "ch02-head-003",
      "type": "text",
      "x": 65,
      "y": 291,
      "w": 990,
      "content": "1. Rectangular and polar complex forms",
      "heading": true
    },
    {
      "id": "ch02-math-004",
      "type": "math",
      "x": 65,
      "y": 396,
      "w": 475,
      "target": "zr",
      "expr": "3"
    },
    {
      "id": "ch02-math-005",
      "type": "math",
      "x": 560,
      "y": 396,
      "w": 475,
      "target": "zi",
      "expr": "4"
    },
    {
      "id": "ch02-math-006",
      "type": "math",
      "x": 65,
      "y": 561,
      "w": 990,
      "target": "z",
      "expr": "complex(zr,zi)"
    },
    {
      "id": "ch02-math-007",
      "type": "math",
      "x": 65,
      "y": 726,
      "w": 990,
      "target": "zmag",
      "expr": "abs(z)"
    },
    {
      "id": "ch02-math-008",
      "type": "math",
      "x": 65,
      "y": 891,
      "w": 990,
      "target": "zphase",
      "expr": "arg(z)"
    },
    {
      "id": "ch02-math-009",
      "type": "math",
      "x": 65,
      "y": 1056,
      "w": 990,
      "target": "zconj",
      "expr": "conj(z)"
    },
    {
      "id": "ch02-math-010",
      "type": "math",
      "x": 65,
      "y": 1221,
      "w": 990,
      "target": "mag_sq_check",
      "expr": "real(z*zconj)"
    },
    {
      "id": "ch02-table-011",
      "type": "table",
      "x": 65,
      "y": 1386,
      "w": 990,
      "h": 280,
      "title": "Complex-number check",
      "headersText": "Value",
      "rowLabels": "Real part\nImag part\nMagnitude\nPhase (deg)\nz·conj(z)",
      "expr": "cols([real(z),imag(z),zmag,zphase*180/pi,mag_sq_check])",
      "precision": "12"
    },
    {
      "id": "ch02-head-012",
      "type": "text",
      "x": 65,
      "y": 1756,
      "w": 990,
      "content": "2. Euler rotation and sinusoidal reconstruction",
      "heading": true
    },
    {
      "id": "ch02-math-013",
      "type": "math",
      "x": 65,
      "y": 1861,
      "w": 990,
      "target": "theta",
      "expr": "linspace(0,2*pi,361)"
    },
    {
      "id": "ch02-math-014",
      "type": "math",
      "x": 65,
      "y": 2026,
      "w": 990,
      "target": "unitCircle",
      "expr": "exp(i*theta)"
    },
    {
      "id": "ch02-plot-015",
      "type": "plot",
      "kind": "scatter",
      "title": "Euler identity on the complex plane",
      "xexpr": "real(unitCircle)",
      "yexpr": "Imaginary := imag(unitCircle)",
      "zexpr": "",
      "x": 65,
      "y": 2191,
      "w": 990,
      "h": 430,
      "xlabel": "Real",
      "ylabel": "Imaginary",
      "y2label": "",
      "zlabel": "",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false
    },
    {
      "id": "ch02-math-016",
      "type": "math",
      "x": 65,
      "y": 2726,
      "w": 475,
      "target": "V0",
      "expr": "10"
    },
    {
      "id": "ch02-math-017",
      "type": "math",
      "x": 560,
      "y": 2726,
      "w": 475,
      "target": "phi_deg",
      "expr": "-30"
    },
    {
      "id": "ch02-math-018",
      "type": "math",
      "x": 65,
      "y": 2891,
      "w": 990,
      "target": "phi",
      "expr": "phi_deg*pi/180"
    },
    {
      "id": "ch02-math-019",
      "type": "math",
      "x": 65,
      "y": 3056,
      "w": 990,
      "target": "Vphasor",
      "expr": "polar(V0,phi)"
    },
    {
      "id": "ch02-math-020",
      "type": "math",
      "x": 65,
      "y": 3221,
      "w": 990,
      "target": "tphase",
      "expr": "linspace(0,2*pi,361)"
    },
    {
      "id": "ch02-math-021",
      "type": "math",
      "x": 65,
      "y": 3386,
      "w": 990,
      "target": "vtime",
      "expr": "real(Vphasor*exp(i*tphase))"
    },
    {
      "id": "ch02-plot-022",
      "type": "plot",
      "kind": "line",
      "title": "Real sinusoid reconstructed from a phasor",
      "xexpr": "tphase",
      "yexpr": "vtime",
      "zexpr": "",
      "x": 65,
      "y": 3551,
      "w": 990,
      "h": 420,
      "xlabel": "ωt (rad)",
      "ylabel": "v(t) (V)",
      "y2label": "",
      "zlabel": "",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false
    },
    {
      "id": "ch02-head-023",
      "type": "text",
      "x": 65,
      "y": 4076,
      "w": 990,
      "content": "3. Phasor addition",
      "heading": true
    },
    {
      "id": "ch02-math-024",
      "type": "math",
      "x": 65,
      "y": 4181,
      "w": 990,
      "target": "V1",
      "expr": "polar(10,0)"
    },
    {
      "id": "ch02-math-025",
      "type": "math",
      "x": 65,
      "y": 4346,
      "w": 990,
      "target": "V2",
      "expr": "polar(10,pi/2)"
    },
    {
      "id": "ch02-math-026",
      "type": "math",
      "x": 65,
      "y": 4511,
      "w": 990,
      "target": "Vsum",
      "expr": "V1+V2"
    },
    {
      "id": "ch02-math-027",
      "type": "math",
      "x": 65,
      "y": 4676,
      "w": 990,
      "target": "Vsum_mag",
      "expr": "abs(Vsum)"
    },
    {
      "id": "ch02-math-028",
      "type": "math",
      "x": 65,
      "y": 4841,
      "w": 990,
      "target": "Vsum_phase_deg",
      "expr": "arg(Vsum)*180/pi"
    },
    {
      "id": "ch02-table-029",
      "type": "table",
      "x": 65,
      "y": 5006,
      "w": 990,
      "h": 280,
      "title": "10∠0° + 10∠90°",
      "headersText": "Value",
      "rowLabels": "Result magnitude (V)\nResult phase (deg)",
      "expr": "cols([Vsum_mag,Vsum_phase_deg])",
      "precision": "12"
    },
    {
      "id": "ch02-head-030",
      "type": "text",
      "x": 65,
      "y": 5376,
      "w": 990,
      "content": "4. Impedance: the course 50 Ω + 10 nH example",
      "heading": true
    },
    {
      "id": "ch02-math-031",
      "type": "math",
      "x": 65,
      "y": 5481,
      "w": 475,
      "target": "Rohm",
      "expr": "50"
    },
    {
      "id": "ch02-math-032",
      "type": "math",
      "x": 560,
      "y": 5481,
      "w": 475,
      "target": "Lhenry",
      "expr": "10e-9"
    },
    {
      "id": "ch02-math-033",
      "type": "math",
      "x": 65,
      "y": 5646,
      "w": 990,
      "target": "freq",
      "expr": "1e9"
    },
    {
      "id": "ch02-math-034",
      "type": "math",
      "x": 65,
      "y": 5811,
      "w": 990,
      "target": "omega",
      "expr": "2*pi*freq"
    },
    {
      "id": "ch02-math-035",
      "type": "math",
      "x": 65,
      "y": 5976,
      "w": 990,
      "target": "Zseries",
      "expr": "Rohm+i*omega*Lhenry"
    },
    {
      "id": "ch02-math-036",
      "type": "math",
      "x": 65,
      "y": 6141,
      "w": 990,
      "target": "Zseries_mag",
      "expr": "abs(Zseries)"
    },
    {
      "id": "ch02-math-037",
      "type": "math",
      "x": 65,
      "y": 6306,
      "w": 990,
      "target": "Zseries_deg",
      "expr": "arg(Zseries)*180/pi"
    },
    {
      "id": "ch02-table-038",
      "type": "table",
      "x": 65,
      "y": 6471,
      "w": 990,
      "h": 280,
      "title": "Series R-L impedance at 1 GHz",
      "headersText": "Value",
      "rowLabels": "Resistance (ohm)\nInductive reactance (ohm)\n|Z| (ohm)\n∠Z (deg)",
      "expr": "cols([Rohm,omega*Lhenry,Zseries_mag,Zseries_deg])",
      "precision": "12"
    },
    {
      "id": "ch02-head-039",
      "type": "text",
      "x": 65,
      "y": 6841,
      "w": 990,
      "content": "5. Complex power and conjugation",
      "heading": true
    },
    {
      "id": "ch02-math-040",
      "type": "math",
      "x": 65,
      "y": 6946,
      "w": 990,
      "target": "Vrms",
      "expr": "polar(10,0)"
    },
    {
      "id": "ch02-math-041",
      "type": "math",
      "x": 65,
      "y": 7111,
      "w": 990,
      "target": "Irms",
      "expr": "polar(0.1,-60*pi/180)"
    },
    {
      "id": "ch02-math-042",
      "type": "math",
      "x": 65,
      "y": 7276,
      "w": 990,
      "target": "Scomplex",
      "expr": "Vrms*conj(Irms)"
    },
    {
      "id": "ch02-math-043",
      "type": "math",
      "x": 65,
      "y": 7441,
      "w": 990,
      "target": "Pwatts",
      "expr": "real(Scomplex)"
    },
    {
      "id": "ch02-math-044",
      "type": "math",
      "x": 65,
      "y": 7606,
      "w": 990,
      "target": "Qvars",
      "expr": "imag(Scomplex)"
    },
    {
      "id": "ch02-table-045",
      "type": "table",
      "x": 65,
      "y": 7771,
      "w": 990,
      "h": 280,
      "title": "RMS complex-power worked example",
      "headersText": "Value",
      "rowLabels": "P (W)\nQ (var)\n|S| (VA)",
      "expr": "cols([Pwatts,Qvars,abs(Scomplex)])",
      "precision": "12"
    },
    {
      "id": "ch02-head-046",
      "type": "text",
      "x": 65,
      "y": 8141,
      "w": 990,
      "content": "6. Propagation exponential: attenuation and phase",
      "heading": true
    },
    {
      "id": "ch02-math-047",
      "type": "math",
      "x": 65,
      "y": 8246,
      "w": 475,
      "target": "alpha",
      "expr": "0.35"
    },
    {
      "id": "ch02-math-048",
      "type": "math",
      "x": 560,
      "y": 8246,
      "w": 475,
      "target": "beta",
      "expr": "12"
    },
    {
      "id": "ch02-math-049",
      "type": "math",
      "x": 65,
      "y": 8411,
      "w": 990,
      "target": "zaxis",
      "expr": "linspace(0,1,401)"
    },
    {
      "id": "ch02-math-050",
      "type": "math",
      "x": 65,
      "y": 8576,
      "w": 990,
      "target": "Ephasor_z",
      "expr": "exp(-(alpha+i*beta)*zaxis)"
    },
    {
      "id": "ch02-math-051",
      "type": "math",
      "x": 65,
      "y": 8741,
      "w": 990,
      "target": "Emag_z",
      "expr": "abs(Ephasor_z)"
    },
    {
      "id": "ch02-math-052",
      "type": "math",
      "x": 65,
      "y": 8906,
      "w": 990,
      "target": "Ereal_z",
      "expr": "real(Ephasor_z)"
    },
    {
      "id": "ch02-plot-053",
      "type": "plot",
      "kind": "line",
      "title": "Propagation factor exp(-(α+jβ)z)",
      "xexpr": "zaxis",
      "yexpr": "Real part := Ereal_z\nMagnitude [y2] := Emag_z",
      "zexpr": "",
      "x": 65,
      "y": 9071,
      "w": 990,
      "h": 450,
      "xlabel": "z (m)",
      "ylabel": "Re{E}",
      "y2label": "Magnitude",
      "zlabel": "",
      "vlines": "",
      "bins": 20,
      "palette": "blue",
      "xlog": false,
      "ylog": false,
      "y2log": false
    },
    {
      "id": "ch02-out-054",
      "type": "output",
      "kind": "csv",
      "title": "Propagation samples",
      "filename": "ch02-propagation.csv",
      "sources": "z_m := zaxis\nphasor := Ephasor_z\nmagnitude := Emag_z\nreal_part := Ereal_z",
      "x": 65,
      "y": 9626,
      "w": 990,
      "csvLayout": "columns",
      "delimiter": "comma",
      "headers": true,
      "quote": "auto",
      "txtLayout": "readable",
      "txtSeparator": "tab",
      "precision": "12",
      "complexFormat": "abi"
    },
    {
      "id": "ch02-head-055",
      "type": "text",
      "x": 65,
      "y": 9831,
      "w": 990,
      "content": "Checkpoint / exploration",
      "heading": true
    },
    {
      "id": "ch02-note-056",
      "type": "text",
      "x": 65,
      "y": 9936,
      "w": 990,
      "content": "Keep the course convention explicit: these examples use exp(+jωt). Change alpha and beta separately to see attenuation and spatial phase play different roles.",
      "heading": false
    }
  ]
}
