#set document(title: "3.2 Square-Wave Forcing", author: "XYZ Homework") #set page(width: 8.5in, height: auto, margin: 1in) #import "@preview/cetz:0.5.2" #set text(font: ("STIX Two Text", "Libertinus Serif", "New Computer Modern"), size: 10.5pt, lang: "en") #show math.equation: set text(font: ("STIX Two Math", "New Computer Modern Math")) #set par(justify: true, leading: 0.62em, spacing: 0.9em) #set enum(spacing: 1.1em) // room between list items so tall inline fractions don't collide #set list(spacing: 1.1em) #set table(stroke: 0.5pt + rgb("#c7ccd3")) #let BLUE = rgb("#183B6F") // brand navy — section bars + example/solution labels (white on navy 11.09:1) #let ORANGE = rgb("#A94509") // brand primary-700 — AA-safe deep orange for TEXT (5.93:1 on white; raw brand #F37021 is 2.94:1 and must never carry text) #let RED = rgb("#DC2626") // brand error-600 #let GREEN = rgb("#059669") // brand success-600 (decoration only; small green text uses green-text #007942) #show heading.where(level: 1): it => block(width: 100%, above: 0pt, below: 16pt, fill: gradient.linear(BLUE, rgb("#2C5AA0")), inset: (x: 14pt, y: 12pt), radius: 3pt, text(fill: white, weight: "bold", size: 19pt, it.body)) #show heading.where(level: 2): it => block(width: 100%, above: 18pt, below: 10pt, fill: BLUE, inset: (x: 10pt, y: 6pt), radius: 2pt, text(fill: white, weight: "bold", size: 12pt, it.body)) #show heading.where(level: 3): it => text(fill: ORANGE, weight: "bold", size: 12.5pt, it.body) #show heading.where(level: 4): it => text(fill: BLUE, weight: "bold", size: 10.5pt, it.body) #let examplebox(label, title, body) = block(width: 100%, breakable: true, fill: rgb("#EFF1F5"), stroke: 0.5pt + rgb("#CFDDF0"), radius: 4pt, inset: 10pt, above: 12pt, below: 12pt)[ #block(below: 6pt)[#box(fill: BLUE, inset: (x: 6pt, y: 2pt), radius: 2pt, text(fill: white, weight: "bold", size: 8.5pt, label)) #h(0.4em) #strong[#title]] #body] // rail = decorative left rule (raw brand token); labelcolor = AA-safe label text shade #let notebox(label, rail, labelcolor, tint, body) = block(width: 100%, breakable: true, fill: tint, stroke: (left: 3pt + rail), inset: (left: 10pt, rest: 8pt), radius: (right: 4pt), above: 11pt, below: 11pt)[ #text(fill: labelcolor, weight: "bold", size: 7.5pt, tracking: 0.5pt)[#upper(label)] #linebreak() #body] #let solutionbox(body) = block(above: 4pt, below: 8pt)[ #text(fill: BLUE, weight: "bold", size: 8.5pt)[Solution] #linebreak() #body] #let figph(msg) = block(width: 100%, height: 60pt, fill: rgb("#f6f7f9"), stroke: (paint: rgb("#c7ccd3"), dash: "dashed"), radius: 4pt, inset: 10pt)[ #align(center + horizon, text(fill: rgb("#889"), style: "italic", size: 9pt, msg))] // Standardize inlined figure sizes: measure the natural CeTZ canvas, then scale to a // consistent envelope (aspect-aware; see build_typst.py FIG_* constants). Unlike the // print preamble, dimensions are FLOORED: in an editor a user can trim a figure to a // degenerate 1-D shape (a bare line), and w/h or tw/w would then divide by zero. #let _STD_W = 3.5 #let _WIDE_W = 5.6 #let _MAX_H = 3.4 #let _ASPECT_WIDE = 2.2 #let _UPSCALE_MAX = 1.15 #let stdfig(body) = context { let m = measure(body) let w = calc.max(m.width / 1in, 0.01) let h = calc.max(m.height / 1in, 0.01) let tw = if w / h > _ASPECT_WIDE { _WIDE_W } else { _STD_W } let s = calc.min(tw / w, _MAX_H / h, _UPSCALE_MAX) align(center, box(scale(x: s * 100%, y: s * 100%, reflow: true, body))) } #show figure: set block(breakable: false) #set figure(gap: 8pt) #show figure.caption: set text(size: 8.5pt, fill: rgb("#555")) == 3.2#h(0.6em)Square-Wave Forcing #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Objectives] - Write a periodic square wave both as an infinite train of Heaviside switches and as an infinite sum of sinusoids. - Watch the Fourier partial sums #math.equation(block: false, alt: "S sub 1 , S sub 2 , S sub 3")[$S_(1) , S_(2) , S_(3)$] flatten toward the square wave, ripple by ripple. - Predict resonance under square-wave forcing by matching the natural frequency against the odd harmonics. ] Throw the switch on and off forever and you get the simplest periodic forcing there is: the #emph[square wave]. With period #math.equation(block: false, alt: "2 π")[$2 π$], let #math.equation(block: false, alt: "s q open parenthesis t close parenthesis")[$upright(s) upright(q) ( t )$] equal #math.equation(block: false, alt: "π / 4")[$π / 4$] on the first half-period and #math.equation(block: false, alt: "minus π / 4")[$− π / 4$] on the second. (The odd-looking amplitude #math.equation(block: false, alt: "π / 4")[$π / 4$] is chosen to make every coefficient below a clean unit fraction.) In the language of the last section it is an infinite train of switches, #math.equation(block: true, alt: "s q open parenthesis t close parenthesis equals the fraction π over 4 open parenthesis 1 minus 2 u sub π open parenthesis t close parenthesis plus 2 u sub 2 π open parenthesis t close parenthesis minus 2 u sub 3 π open parenthesis t close parenthesis plus ⋯ close parenthesis ,")[$upright(s) upright(q) ( t ) = frac(π, 4) ( 1 − 2 u_(π) ( t ) + 2 u_(2 π) ( t ) − 2 u_(3 π) ( t ) + ⋯ ) ,$] and its transform costs one geometric series: each delayed switch contributes its exponential tag, and #math.equation(block: true, alt: "ℒ { s q } open parenthesis s close parenthesis equals the fraction π over 4 s open parenthesis 1 minus 2 e to the power minus π s plus 2 e to the power minus 2 π s minus ⋯ close parenthesis equals the fraction π over 4 s times the fraction 1 minus e to the power minus π s over 1 plus e to the power minus π s ,")[$ℒ \{ upright(s) upright(q) \} ( s ) = frac(π, 4 s) ( 1 − 2 e^(− π s) + 2 e^(− 2 π s) − ⋯ ) = frac(π, 4 s) · frac(1 − e^(− π s), 1 + e^(− π s)) ,$] a closed form paying for infinitely many switches at once. That is the #emph[time] ledger: the wave described by when it flips. There is a second ledger — not #emph[when] the wave switches but #emph[which frequencies it contains]: #math.equation(block: true, alt: "s q open parenthesis t close parenthesis equals sin t plus the fraction sin 3 t over 3 plus the fraction sin 5 t over 5 plus the fraction sin 7 t over 7 plus ⋯ ,")[$upright(s) upright(q) ( t ) = sin t + frac(sin 3 t, 3) + frac(sin 5 t, 5) + frac(sin 7 t, 7) + ⋯ ,$] its #emph[Fourier series]. Only odd multiples of the fundamental frequency #math.equation(block: false, alt: "1")[$1$] appear, and the #math.equation(block: false, alt: "n")[$n$]th harmonic arrives with amplitude #math.equation(block: false, alt: "1 / n")[$1 / n$]. The claim looks implausible — smooth waves summing to a jump? — and deserves to be watched happening. The figure plots the first three #emph[partial sums]: #math.equation(block: false, alt: "S sub 1 equals sin t")[$S_(1) = sin t$], then #math.equation(block: false, alt: "S sub 2")[$S_(2)$] adds #math.equation(block: false, alt: "the fraction 1 over 3 sin 3 t")[$frac(1, 3) sin 3 t$], then #math.equation(block: false, alt: "S sub 3")[$S_(3)$] adds #math.equation(block: false, alt: "the fraction 1 over 5 sin 5 t")[$frac(1, 5) sin 5 t$]. {"camera":{"fov":50,"position":\[6,0,9\],"projection":"perspective","target":\[6,0,0\]},"grid":{"axisColors":{"x":"\#ef4444","y":"\#22c55e","z":"\#3b82f6"},"divisions":12,"gridColor":"\#e5e7eb","showAxes":true,"showLabels":true,"size":12,"visible":true},"id":"57d9804a-b881-4cbd-a8b7-e94712b1bef0","metadata":{"alt\_text":"Three blue waves of increasing darkness drawn over the same two periods: a dashed pale sine wave, a dashed medium curve whose crests have begun to flatten, and a solid dark curve with flatter tops, steeper crossings, and a small ripple. Toggling the curves' visibility shows each added odd harmonic pushing the shape closer to a square wave of height about 0.785.","created\_at":"2026-08-01T00:00:00.000Z","description":"The first three Fourier partial sums S1 = sin t, S2 = S1 + sin(3t)/3, S3 = S2 + sin(5t)/5 of the square wave of amplitude pi/4, plotted together on t in \[0, 12\] with visibility toggles standing in for a term-count control.","tags":\["diffeq","laplace","fourier","square-wave","periodic-forcing"\],"updated\_at":"2026-08-01T00:00:00.000Z"},"objects":\[{"id":"8b2cee3a-acb5-41a2-b919-5118a86ac143","kind":"parametric-curve","label":{"text":"S1 = sin t","visible":true},"samples":1200,"style":{"color":"\#93c5fd","dash":\[5,5\],"lineWidth":2},"tDomain":\[0,12\],"visible":true,"xExpr":"t","yExpr":"sin(t)","zExpr":"0"},{"id":"05af6379-11d9-4abe-8131-97d0a06146f1","kind":"parametric-curve","label":{"text":"S2 = sin t + (1/3) sin 3t","visible":true},"samples":1200,"style":{"color":"\#60a5fa","dash":\[2,3\],"lineWidth":2.5},"tDomain":\[0,12\],"visible":true,"xExpr":"t","yExpr":"sin(t) + sin(3\*t)/3","zExpr":"0"},{"id":"b50a5afe-33f7-44e4-8749-0c658dd21fdd","kind":"parametric-curve","label":{"text":"S3 = sin t + (1/3) sin 3t + (1/5) sin 5t","visible":true},"samples":1200,"style":{"color":"\#1d4ed8","dash":\[\],"lineWidth":4},"tDomain":\[0,12\],"visible":true,"xExpr":"t","yExpr":"sin(t) + sin(3\*t)/3 + sin(5\*t)/5","zExpr":"0"}\],"title":"Building a square wave: Fourier partial sums","version":1} The first three Fourier partial sums of the square wave of height #math.equation(block: false, alt: "π / 4 approximately equals 0.785")[$π / 4 ≈ 0.785$], drawn over nearly two periods: the pale dashed #math.equation(block: false, alt: "S sub 1 equals sin t")[$S_(1) = sin t$], the medium dashed #math.equation(block: false, alt: "S sub 2 equals S sub 1 plus the fraction 1 over 3 sin 3 t")[$S_(2) = S_(1) + frac(1, 3) sin 3 t$], and the solid dark #math.equation(block: false, alt: "S sub 3 equals S sub 2 plus the fraction 1 over 5 sin 5 t")[$S_(3) = S_(2) + frac(1, 5) sin 5 t$], its tops flatter and its crossings steeper. Toggle each curve's visibility to replay the convergence one harmonic at a time. === Explore + #strong[Observe.] Hide #math.equation(block: false, alt: "S sub 2")[$S_(2)$] and #math.equation(block: false, alt: "S sub 3")[$S_(3)$]. Alone, #math.equation(block: false, alt: "S sub 1")[$S_(1)$] is a plain sine of height #math.equation(block: false, alt: "1")[$1$] — the right period and the right sign pattern already, but round-topped and, at its crest, taller than the plateau #math.equation(block: false, alt: "π / 4 approximately equals 0.785")[$π / 4 ≈ 0.785$] it is aiming for. + #strong[Predict.] At the center of the plateau, #math.equation(block: false, alt: "t equals π / 2")[$t = π / 2$], the next term contributes #math.equation(block: false, alt: "the fraction 1 over 3 sin open parenthesis 3 π / 2 close parenthesis equals minus the fraction 1 over 3")[$frac(1, 3) sin ( 3 π / 2 ) = − frac(1, 3)$]. Will revealing #math.equation(block: false, alt: "S sub 2")[$S_(2)$] raise or lower the middle of the crest? Decide, then toggle it on. + #strong[Verify.] Read the three center heights at #math.equation(block: false, alt: "t equals π / 2")[$t = π / 2$]: they are #math.equation(block: false, alt: "1")[$1$], then #math.equation(block: false, alt: "1 minus the fraction 1 over 3 approximately equals 0.67")[$1 − frac(1, 3) ≈ 0.67$], then #math.equation(block: false, alt: "1 minus the fraction 1 over 3 plus the fraction 1 over 5 approximately equals 0.87")[$1 − frac(1, 3) + frac(1, 5) ≈ 0.87$] — the partial sums of the alternating series #math.equation(block: false, alt: "1 minus the fraction 1 over 3 plus the fraction 1 over 5 minus ⋯")[$1 − frac(1, 3) + frac(1, 5) − ⋯$], whose limit is exactly #math.equation(block: false, alt: "π / 4")[$π / 4$]. The plateau height #emph[is] that famous series, straddled from above and below. + #strong[Observe.] Count the ripples riding the solid curve's plateau: three crests, at #math.equation(block: false, alt: "t equals π / 6")[$t = π / 6$], #math.equation(block: false, alt: "π / 2")[$π / 2$], and #math.equation(block: false, alt: "5 π / 6")[$5 π / 6$]. Each harmonic added contributes one more ripple and shrinks them all. + #strong[Predict, then verify.] The solid curve's tallest crests are the ones nearest the jumps — at #math.equation(block: false, alt: "t equals π / 6")[$t = π / 6$] and #math.equation(block: false, alt: "5 π / 6")[$5 π / 6$], height #math.equation(block: false, alt: "the fraction 1 over 2 plus the fraction 1 over 3 plus the fraction 1 over 10 equals the fraction 14 over 15 approximately equals 0.93")[$frac(1, 2) + frac(1, 3) + frac(1, 10) = frac(14, 15) ≈ 0.93$] — not the one at the center. Predict where the tallest crest of #math.equation(block: false, alt: "S sub 4")[$S_(4)$] would sit, then check your reasoning against the pattern from #math.equation(block: false, alt: "S sub 1")[$S_(1)$] to #math.equation(block: false, alt: "S sub 3")[$S_(3)$]. (That stubborn spike beside each jump is the #emph[Gibbs phenomenon]: it narrows as terms are added but never shrinks below about #math.equation(block: false, alt: "9")[$9$] of the jump.) === Connect Why take the wave apart at all? Because for a linear equation, superposition turns the series into a term-by-term to-do list. Drive an undamped oscillator with the square wave, #math.equation(block: true, alt: "x double prime plus ω 0 2 x equals s q open parenthesis t close parenthesis ,")[$x^(″) + ω_(0)^(2) x = upright(s) upright(q) ( t ) ,$] and each harmonic #math.equation(block: false, alt: "the fraction 1 over n sin n t")[$frac(1, n) sin n t$] produces its own steady response #math.equation(block: false, alt: "the fraction 1 over n open parenthesis ω 0 2 minus n squared close parenthesis sin n t")[$frac(1, n ( ω_(0)^(2) − n^(2) )) sin n t$], exactly as in the beats section — provided #math.equation(block: false, alt: "ω sub 0 not equal to n")[$ω_(0) ≠ n$]. The denominators tell the story: the response is dominated by whichever harmonic sits closest to the natural frequency. And if #math.equation(block: false, alt: "ω sub 0")[$ω_(0)$] #emph[equals] an odd integer, that single term resonates and grows without bound while every other term stays politely small. This is the treacherous fact about periodic switching. A pure sinusoid resonates at exactly one frequency; a square wave carries the frequencies #math.equation(block: false, alt: "1 , 3 , 5 , 7 , …")[$1 , 3 , 5 , 7 , …$] all at once and can resonate a system tuned to any of them. Matching the forcing period to the natural period is the resonance you expect. A square wave that switches three or five times slower than the system's natural oscillation excites a resonance you may not expect — the energy arrives through an overtone. Switched machinery must be designed against the whole ladder of frequencies, not a single rung. #examplebox("Example 1")[A hidden resonance][ The system #math.equation(block: false, alt: "x double prime plus 9 x equals s q open parenthesis t close parenthesis")[$x^(″) + 9 x = upright(s) upright(q) ( t )$] has natural frequency #math.equation(block: false, alt: "3")[$3$], so its natural period #math.equation(block: false, alt: "2 π / 3")[$2 π / 3$] is one third of the forcing period — no match. Show that it resonates anyway. Feed the Fourier series through the equation term by term. The fundamental #math.equation(block: false, alt: "sin t")[$sin t$] yields the bounded response #math.equation(block: false, alt: "the fraction 1 over 9 minus 1 sin t equals the fraction 1 over 8 sin t")[$frac(1, 9 − 1) sin t = frac(1, 8) sin t$]. The fifth harmonic #math.equation(block: false, alt: "the fraction 1 over 5 sin 5 t")[$frac(1, 5) sin 5 t$] yields #math.equation(block: false, alt: "the fraction 1 / 5 over 9 minus 25 sin 5 t equals minus the fraction 1 over 80 sin 5 t")[$frac(1 / 5, 9 − 25) sin 5 t = − frac(1, 80) sin 5 t$], tiny. But the third harmonic #math.equation(block: false, alt: "the fraction 1 over 3 sin 3 t")[$frac(1, 3) sin 3 t$] drives the oscillator exactly at its natural frequency, and the resonant repair from Chapter 2 — multiply by #math.equation(block: false, alt: "t")[$t$] — gives the response #math.equation(block: false, alt: "minus the fraction 1 over 18 t cos 3 t")[$− frac(1, 18) t cos 3 t$], growing without bound. (Check: for #math.equation(block: false, alt: "x double prime plus 9 x equals F sin 3 t")[$x^(″) + 9 x = F sin 3 t$] the resonant solution is #math.equation(block: false, alt: "minus the fraction F over 6 t cos 3 t")[$− frac(F, 6) t cos 3 t$]; here #math.equation(block: false, alt: "F equals the fraction 1 over 3")[$F = frac(1, 3)$].) The square wave never looks like a frequency-#math.equation(block: false, alt: "3")[$3$] signal, but one of its harmonics is one, and that is all resonance requires. ] #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ A square wave is one signal with two honest descriptions — a train of switches in time, a ladder of odd harmonics in frequency. The first makes its transform a geometric series; the second settles resonance at a glance: the forcing contains the frequencies #math.equation(block: false, alt: "1 , 3 , 5 , …")[$1 , 3 , 5 , …$], and any natural frequency on that ladder rings. ]