diff --git a/notebooks/oscillator.jl b/notebooks/oscillator.jl index 725145d746c179d95ec34d2f085eab1c7772feb5..59e9acb07a657e6a98b0b23d0f826386d33b06a3 100644 --- a/notebooks/oscillator.jl +++ b/notebooks/oscillator.jl @@ -165,9 +165,6 @@ function step_euler(y_n, A, Δt, α) return lhs\rhs end -# ╔═╡ ce696808-9964-4741-ac4d-57f39ecb1f63 -system_matrix(δ) = [0. 1.; -1. -2. *δ] - # ╔═╡ 3086ab6c-fc5f-40e9-9700-130588f3f862 begin fwd_euler(y_n, A, Δt) = step_euler(y_n, A, Δt, 0.) @@ -175,6 +172,9 @@ begin crank_nichols(y_n, A, Δt) = step_euler(y_n, A, Δt, 0.5) end; +# ╔═╡ ce696808-9964-4741-ac4d-57f39ecb1f63 +system_matrix(δ) = [0. 1.; -1. -2. *δ] + # ╔═╡ b1c1ae20-11a7-4451-bd3b-d20ce9d4965e @bind δ0_exp Slider(collect(-4:0.05:1)[2:end], default=0.0, show_value=true) @@ -271,9 +271,9 @@ version = "0.7.2" [[deps.ColorSchemes]] deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "PrecompileTools", "Random"] -git-tree-sha1 = "dd3000d954d483c1aad05fe1eb9e6a715c97013e" +git-tree-sha1 = "be6ab11021cd29f0344d5c4357b163af05a48cba" uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4" -version = "3.22.0" +version = "3.21.0" [[deps.ColorTypes]] deps = ["FixedPointNumbers", "Random"] @@ -282,16 +282,10 @@ uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" version = "0.11.4" [[deps.ColorVectorSpace]] -deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "Requires", "Statistics", "TensorCore"] -git-tree-sha1 = "a1f44953f2382ebb937d60dafbe2deea4bd23249" +deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "SpecialFunctions", "Statistics", "TensorCore"] +git-tree-sha1 = "600cc5508d66b78aae350f7accdb58763ac18589" uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4" -version = "0.10.0" - - [deps.ColorVectorSpace.extensions] - SpecialFunctionsExt = "SpecialFunctions" - - [deps.ColorVectorSpace.weakdeps] - SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" +version = "0.9.10" [[deps.Colors]] deps = ["ColorTypes", "FixedPointNumbers", "Reexport"] @@ -742,6 +736,12 @@ git-tree-sha1 = "1aa4b74f80b01c6bc2b89992b861b5f210e665b5" uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" version = "1.1.21+0" +[[deps.OpenSpecFun_jll]] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "13652491f6856acfd2db29360e1bbcd4565d04f1" +uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e" +version = "0.5.5+0" + [[deps.Opus_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] git-tree-sha1 = "51a08fb14ec28da2ec7a927c4337e4332c2a4720" @@ -749,9 +749,9 @@ uuid = "91d4177d-7536-5919-b921-800302f37372" version = "1.3.2+0" [[deps.OrderedCollections]] -git-tree-sha1 = "2e73fe17cac3c62ad1aebe70d44c963c3cfdc3e3" +git-tree-sha1 = "d321bf2de576bf25ec4d3e4360faca399afca282" uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" -version = "1.6.2" +version = "1.6.0" [[deps.PCRE2_jll]] deps = ["Artifacts", "Libdl"] @@ -914,6 +914,18 @@ version = "1.1.1" deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" +[[deps.SpecialFunctions]] +deps = ["IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] +git-tree-sha1 = "7beb031cf8145577fbccacd94b8a8f4ce78428d3" +uuid = "276daf66-3868-5448-9aa4-cd146d93841b" +version = "2.3.0" + + [deps.SpecialFunctions.extensions] + SpecialFunctionsChainRulesCoreExt = "ChainRulesCore" + + [deps.SpecialFunctions.weakdeps] + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + [[deps.Statistics]] deps = ["LinearAlgebra", "SparseArrays"] uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" diff --git a/notebooks/thermo_exercises.jl b/notebooks/thermo_exercises.jl index fe88cbf7551abb65246f0621e693cb153cdf1ed3..ea22c06736f1104b7eeec2607b42dd467dbfb2d3 100644 --- a/notebooks/thermo_exercises.jl +++ b/notebooks/thermo_exercises.jl @@ -80,9 +80,41 @@ Derive expressions for entropy, internal energy, pressure, chemical potential, b # ╔═╡ cf62429e-2d29-4ebe-a950-4f8a6c8ecc96 md""" -From ``H = A = U - TS``, +From Boltzmann's study of ideal gas, if N is large enough, we know that the internal energy of a monoatomic gas is purely kinetic energy. Hence, with each degree of freedom of motion for the gas particles contributing ``\frac{1}{2}\kboltz T`` to the internal energy, we have +```math + U = \frac{3}{2}N\kboltz T +``` +""" + +# ╔═╡ 86776c0e-67c9-4a78-a939-52cbfccbf59d +function internal_energy(N, T) + return 1.5*N*BoltzmannConstant*T +end + +# ╔═╡ 5492cb3d-002d-4bad-8ad6-072751eb1bf5 +md""" +From the definition of ``F = U - TS``, we can derive +```math +\begin{align} +S &= \frac{U-F}{T}\\ +S &= \frac{1}{T}\left(\frac{3}{2}N\kboltz T-N\kboltz T\left(\frac{\ln N \Lambda^3}{V}-1\right) \right)\\ +2S &= 3N\kboltz - 2N\kboltz\frac{\ln N \lambda^3}{V} + 2N\kboltz\\ +S &= \frac{1}{2}N\kboltz\left(5 - 2\frac{\ln N \Lambda^3}{V}\right) +\end{align} +``` """ +# ╔═╡ b7d31193-8472-4764-ad7c-921e2d77e3ad +function entropy(T, V, N, m) + Λ = debroglie_wavelength(T, m) + q1 = 0.5*N*BoltzmannConstant + q2 = 5-2*log(N)*Λ^3/V + return q1*q2 +end + +# ╔═╡ badc5384-2099-421e-aecf-8786f76cd422 +entropy(273.15u"K", 1u"L", 1*_mol, Ar.atomic_mass) + # ╔═╡ 00000000-0000-0000-0000-000000000001 PLUTO_PROJECT_TOML_CONTENTS = """ [deps] @@ -108,7 +140,7 @@ Unitful = "~1.15.0" PLUTO_MANIFEST_TOML_CONTENTS = """ # This file is machine-generated - editing it directly is not advised -julia_version = "1.9.0" +julia_version = "1.9.2" manifest_format = "2.0" project_hash = "b586531e304952de66218a8af77aea24d18bbe87" @@ -211,7 +243,7 @@ weakdeps = ["Dates", "LinearAlgebra"] [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.0.2+0" +version = "1.0.5+0" [[deps.ConcurrentUtilities]] deps = ["Serialization", "Sockets"] @@ -713,7 +745,7 @@ version = "0.42.2+0" [[deps.Pkg]] deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -version = "1.9.0" +version = "1.9.2" [[deps.PlotThemes]] deps = ["PlotUtils", "Statistics"] @@ -1166,7 +1198,7 @@ version = "0.15.1+0" [[deps.libblastrampoline_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.7.0+0" +version = "5.8.0+0" [[deps.libfdk_aac_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -1228,6 +1260,10 @@ version = "1.4.1+0" # ╠═9a8ac776-b1d3-4fb8-a360-5b341f86a2a7 # ╠═213dfc26-bfa2-406f-9fa3-1d168068e670 # ╟─5f7a9c35-97c3-4d4f-8bc4-494d43b65b94 -# ╠═cf62429e-2d29-4ebe-a950-4f8a6c8ecc96 +# ╟─cf62429e-2d29-4ebe-a950-4f8a6c8ecc96 +# ╠═86776c0e-67c9-4a78-a939-52cbfccbf59d +# ╟─5492cb3d-002d-4bad-8ad6-072751eb1bf5 +# ╠═b7d31193-8472-4764-ad7c-921e2d77e3ad +# ╠═badc5384-2099-421e-aecf-8786f76cd422 # ╟─00000000-0000-0000-0000-000000000001 # ╟─00000000-0000-0000-0000-000000000002