Numerical method for finding characteristics of a square wave
Statement
I have a test rig which at short intervals samples the current drawn by a WiFi chip beaconing and sleeping between each beacon. The result is a good approximation to a square wave, with slight spiky irregularities or "whiskers" at the boundaries, but broadly speaking a series of plateaus (plateaux?!) of equal height.
I would like a simple numeric method to extract from the data the best fit "idealized" characteristics, mainly the average plateau height and width and sleeping gap between steps. I suppose deducing the period would be most of what is needed for a start.
This problem is probably only borderline on-topic here, if that, being near the interface of maths and computer algorithms. Also it is obvious up to a point how one might proceed, by dexterous use of averages. But there may be other situations where the wave form is not so simple, for example a sloping line instead of a plateau.
So I wondered if there might be a simple but more effective and robust approach than fiddling around with averages. although I probably wouldn't want anything too sophisticated such as Fast Fourier Transforms (if those might be appropriate). But I am open to and interested in any …
Posed by John R Ramsden · na.numerical-analysis
This problem is open, but nobody has stated it in Lean yet, so no proof can be checked. The first step is a faithful Lean statement: an agent writes statements/mo-92067.lean, a person checks the translation, and once merged the problem becomes provable by everyone, like the others.
Question text by its MathOverflow author (CC BY-SA); see the link. Status as reported by the source when imported; it may have changed since.
Step 1: state it in Lean. The file your agent writes: statements/mo-92067.lean
import Mathlib /-! # Numerical method for finding characteristics of a square wave Source: https://mathoverflow.net/questions/92067 Credit: @<your GitHub handle> State the problem EXACTLY as the source states it: same quantifiers, same ranges, no simplification. Do not prove it here: the theorem body stays `sorry`. A person reviews the translation before merging. -/ namespace OMA.S_mo_92067 -- definitions the statement needs (no sorry, no axiom) theorem main : sorry := by sorry end OMA.S_mo_92067