-
Notifications
You must be signed in to change notification settings - Fork 78
Prove energy dissipation rate for damped harmonic oscillator #967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JayYarlott
wants to merge
11
commits into
leanprover-community:master
Choose a base branch
from
Complex-Quantum-Systems-Research-Group:dho_dissipation_proofs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+38
−7
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
17e4a82
theorems for enery dissipation rates and lack of conservation of energy
JayYarlott 76a1d89
linting fixes
JayYarlott 0f72746
Clean up todos
JayYarlott 84fae75
Clean up unused namespaces
JayYarlott bf4e588
replace `theorem` with `lemma`
JayYarlott 956245f
Clearer unfolding of energy defs
JayYarlott f343468
Fold fderiv_add continuity hypotheses into rewrite
JayYarlott 31158d4
Combine simpler rewrites
JayYarlott eeaaaaf
Condense energy_not_conserved
JayYarlott cadc96c
remove fderiv rewrites
JayYarlott c2ce03d
move statements around
JayYarlott File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,13 +61,8 @@ References for the damped harmonic oscillator include: | |
|
|
||
| namespace ClassicalMechanics | ||
| open Real | ||
| open Space | ||
| open InnerProductSpace | ||
|
|
||
| TODO "DHO01" "Define the DampedHarmonicOscillator structure with mass m, spring constant k, | ||
| and damping coefficient γ." | ||
|
|
||
| TODO "DHO04" "Prove that energy is not conserved and derive the energy dissipation rate." | ||
| open ContDiff | ||
| open Time | ||
|
|
||
| TODO "DHO05" "Derive solutions for the underdamped case (oscillatory with exponential decay)." | ||
|
|
||
|
|
@@ -205,6 +200,42 @@ so the energy is non-increasing and not conserved when `S.γ > 0`. -/ | |
| noncomputable def energyDissipationRate (x : Time → ℝ) : Time → ℝ := | ||
| fun t => - S.γ * (Time.deriv x t)^2 | ||
|
|
||
| /-- Derives the energy dissipation rate from the equation of motion -/ | ||
| lemma energy_dissipation_rate (x: Time → ℝ) (h1 : S.EquationOfMotion x) | ||
| (hx : ContDiff ℝ ∞ x) : | ||
| Time.deriv (energy S x) t = - S.γ * (Time.deriv x t)^2 := by | ||
|
|
||
| -- Rearrange Equation of Motion | ||
| have heom' : S.m * Time.deriv (Time.deriv x) t + S.k * x t = | ||
| - S.γ * Time.deriv x t := by linarith [h1 t] | ||
|
|
||
| -- Break equation apart | ||
| rw [energy] | ||
| unfold kineticEnergy potentialEnergy | ||
|
|
||
| rw [Time.deriv_eq] | ||
|
|
||
| have hdx : Differentiable ℝ x := hx.differentiable (by norm_num) | ||
| have hddx : Differentiable ℝ (∂ₜ x) := deriv_differentiable_of_contDiff x hx | ||
| have hKE := ((hddx t).hasFDerivAt.pow 2).const_mul (1/2 * S.m) | ||
| have hPE := ((hdx t).hasFDerivAt.pow 2).const_mul (1/2 * S.k) | ||
|
|
||
| rw [(hKE.add hPE).fderiv] | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we remove these extra new lines in the proof? |
||
| norm_num | ||
| rw [← Time.deriv, ← Time.deriv] | ||
| linear_combination (Time.deriv x t) * heom' | ||
|
|
||
| lemma energy_not_conserved (x: Time → ℝ) (h1 : S.EquationOfMotion x) | ||
| (hx : ContDiff ℝ ∞ x) | ||
| (hdx : Time.deriv x t ≠ 0) | ||
| (hγ : S.γ > 0) : | ||
| Time.deriv (energy S x) t < 0 := by | ||
|
|
||
| rw [energy_dissipation_rate S x h1 hx] | ||
| rw [neg_mul S.γ (∂ₜ x t ^ 2)] | ||
| refine neg_neg_of_pos (mul_pos hγ (sq_pos_iff.mpr hdx)) | ||
|
|
||
| /-! | ||
|
|
||
| ## E. Damping regimes (placeholder) | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rw [energy, kineticEnergy, potentialEnergy]?If this doesn't work then we should likely have theorems
kineticEnergy_eqandpotentialEnergy_eqwhich experts the definitional equality ofkineticEnergyandpotentialEnergy. Usingunfoldis generally not the best idea, although I acknowledge that it is used throughout this project.