Skip to content

Commit

Permalink
Update documents
Browse files Browse the repository at this point in the history
  • Loading branch information
ohno committed Nov 28, 2023
1 parent 63548b1 commit 3df57ba
Show file tree
Hide file tree
Showing 13 changed files with 143 additions and 171 deletions.
78 changes: 39 additions & 39 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
name: Documentation
on:
push:
branches:
- main
tags: ['*']
pull_request:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
docs:
name: Documentation
runs-on: ubuntu-latest
permissions:
contents: write
statuses: write
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- name: Configure doc environment
run: |
julia --project=docs/ -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()'
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
julia --project=docs -e '
using Documenter: DocMeta, doctest
using Antiq
DocMeta.setdocmeta!(Antiq, :DocTestSetup, :(using Antiq); recursive=true)
name: Documentation
on:
push:
branches:
- main
tags: ['*']
pull_request:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
docs:
name: Documentation
runs-on: ubuntu-latest
permissions:
contents: write
statuses: write
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- name: Configure doc environment
run: |
julia --project=docs/ -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()'
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
julia --project=docs -e '
using Documenter: DocMeta, doctest
using Antiq
DocMeta.setdocmeta!(Antiq, :DocTestSetup, :(using Antiq); recursive=true)
doctest(Antiq)'
19 changes: 1 addition & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,4 @@
[![Build Status](https://github.com/ohno/Antiq.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ohno/Antiq.jl/actions/workflows/CI.yml?query=branch%3Amain)
[![Coverage](https://codecov.io/gh/ohno/Antiq.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/ohno/Antiq.jl)

Self-contained, Well-Tested, Well-Documented Functions for Quantum Mechanical Models

## Supported Models

- Infinite Potential Well (Particle in a box)
- Harmonic Oscillator
- Morse Potential
- Hydrogen Atom $^\infty\mathrm{H}$ ($m_\mathrm{p}\rightarrow\infty$)

## Future Works

[List of quantum-mechanical systems with analytical solutions](https://en.wikipedia.org/wiki/List_of_quantum-mechanical_systems_with_analytical_solutions)

## Acknowledgment

This package was named by [@KB-satou](https://github.com/KB-satou) and [@ultimatile](https://github.com/ultimatile):

**An**aly**ti**cal soulutions of Schrödinger e**q**uations.
Please see [here](https://ohno.github.io/Antiq.jl/dev/HydrogenAtom/).
73 changes: 23 additions & 50 deletions developer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -250,41 +250,28 @@
"┌ Info: Weaving chunk 6 from line 107\n",
"│ progress = 0.8333333333333334\n",
"└ @ Weave C:\\Users\\user\\.julia\\packages\\Weave\\f7Ly3\\src\\run.jl:66\n",
"WARNING: replacing module InfinitePotentialWell8472295553246349096.\n",
"┌ Info: Weaved all chunks\n",
"│ progress = 1\n",
"└ @ Weave C:\\Users\\user\\.julia\\packages\\Weave\\f7Ly3\\src\\run.jl:90\n"
"WARNING: replacing module InfinitePotentialWell8472295553246349096.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"m.match = \"\\n```julia\\ninclude(\\\"../../../test/InfinitePotentialWell.jl\\\")\\n```\\n\\n```\"\n",
"m.offset = 2877\n",
"m.match = \".jl\\\")\\n```\\n\\n```\"\n",
"m.offset = 3032\n",
"m.match = \"```\\n```\\n\\n\\n\"\n",
"m.offset = 25190"
"m.offset = 25354\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"┌ Info: Weaved all chunks\n",
"│ progress = 1\n",
"└ @ Weave C:\\Users\\user\\.julia\\packages\\Weave\\f7Ly3\\src\\run.jl:90\n",
"┌ Info: Weaved to C:\\Users\\user\\Desktop\\GitHub\\Antiq.jl\\docs\\src\\InfinitePotentialWell.md\n",
"└ @ Weave C:\\Users\\user\\.julia\\packages\\Weave\\f7Ly3\\src\\Weave.jl:228\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"└ @ Weave C:\\Users\\user\\.julia\\packages\\Weave\\f7Ly3\\src\\Weave.jl:228\n",
"┌ Info: Weaving chunk 1 from line 93\n",
"│ progress = 0.0\n",
"└ @ Weave C:\\Users\\user\\.julia\\packages\\Weave\\f7Ly3\\src\\run.jl:66\n",
Expand All @@ -311,31 +298,17 @@
"│ progress = 1\n",
"└ @ Weave C:\\Users\\user\\.julia\\packages\\Weave\\f7Ly3\\src\\run.jl:90\n",
"┌ Info: Weaved to C:\\Users\\user\\Desktop\\GitHub\\Antiq.jl\\docs\\src\\HarmonicOscillator.md\n",
"└ @ We"
"└ @ Weave C:\\Users\\user\\.julia\\packages\\Weave\\f7Ly3\\src\\Weave.jl:228\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"m.match = \"\\n```julia\\ninclude(\\\"../../../test/HarmonicOscillator.jl\\\")\\n```\\n\\n```\"\n",
"m.offset = 6141\n",
"m.match = \".jl\\\")\\n```\\n\\n```\"\n",
"m.offset = 6290\n",
"m.match = \"```\\n```\\n\\n\\n\"\n",
"m.offset = 31497"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"ave C:\\Users\\user\\.julia\\packages\\Weave\\f7Ly3\\src\\Weave.jl:228\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n"
"m.offset = 31655\n"
]
},
{
Expand Down Expand Up @@ -371,10 +344,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"m.match = \"\\n```julia\\ninclude(\\\"../../../test/MorsePotential.jl\\\")\\n```\\n\\n```\"\n",
"m.offset = 5749\n",
"m.match = \".jl\\\")\\n```\\n\\n```\"\n",
"m.offset = 5890\n",
"m.match = \"```\\n```\\n\\n\\n\"\n",
"m.offset = 52690\n"
"m.offset = 52840\n"
]
},
{
Expand Down Expand Up @@ -422,10 +395,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"m.match = \"\\n```julia\\ninclude(\\\"../../../test/HydrogenAtom.jl\\\")\\n```\\n\\n```\"\n",
"m.offset = 13553\n",
"m.match = \".jl\\\")\\n```\\n\\n```\"\n",
"m.offset = 13690\n",
"m.match = \"```\\n```\\n\\n\\n\"\n",
"m.offset = 102637\n"
"m.offset = 102783\n"
]
},
{
Expand Down Expand Up @@ -455,16 +428,16 @@
" weave(\"./docs/src/jmd/$file.jmd\", doctype=\"github\", out_path=\"./docs/src/\", fig_path=\"./assets/fig/\")\n",
" text = Antiq.load(\"./docs/src/$file.md\")\n",
" # remove ``` after include(...s)\n",
" for m in eachmatch(r\"\\n```julia\\n.*?jl\\\"\\)\\n```[.\\n]*?```\", text)\n",
" for m in eachmatch(r\"\\.jl\\\"\\)\\n```[.\\n]*?```\", text)\n",
" @show m.match\n",
" @show m.offset\n",
" text = replace(text, m.match => \"\")\n",
" text = replace(text, m.match => \".jl\\\")\\n```\")\n",
" end\n",
" # remove ``` at the end of file\n",
" for m in eachmatch(r\"```\\n```[\\s\\n]*?\\z\", text)\n",
" @show m.match\n",
" @show m.offset\n",
" text = replace(text, m.match => \"```\\n\")\n",
" text = replace(text, m.match => \"\\n```\\n\")\n",
" end\n",
" Antiq.save(\"./docs/src/$file.md\", text)\n",
"end"
Expand Down Expand Up @@ -542,13 +515,13 @@
"output_type": "stream",
"text": [
"\u001b[0m\u001b[1mTest Summary: | \u001b[22m\u001b[32m\u001b[1mPass \u001b[22m\u001b[39m\u001b[36m\u001b[1mTotal \u001b[22m\u001b[39m\u001b[0m\u001b[1m Time\u001b[22m\n",
"Antiq.jl | \u001b[32m2052 \u001b[39m\u001b[36m 2052 \u001b[39m\u001b[0m34.9s\n"
"Antiq.jl | \u001b[32m2052 \u001b[39m\u001b[36m 2052 \u001b[39m\u001b[0m44.4s\n"
]
},
{
"data": {
"text/plain": [
"Test.DefaultTestSet(\"Antiq.jl\", Any[Test.DefaultTestSet(\"<ψᵢ|ψⱼ> = ∫ψₙ*ψₙdx = δᵢⱼ\", Any[], 100, false, false, true, 1.700519612948e9, 1.700519613486e9), Test.DefaultTestSet(\"<ψₙ|H|ψₙ> = ∫ψₙ*Tψₙdx = Eₙ\", Any[], 80, false, false, true, 1.700519613499e9, 1.700519613983e9), Test.DefaultTestSet(\"<ψₙ|x|ψₙ> = L/2\", Any[], 4, false, false, true, 1.700519613993e9, 1.700519614266e9), Test.DefaultTestSet(\"<ψₙ|x²|ψₙ> = 2L²/π³(π³/6-π/4)\", Any[], 4, false, false, true, 1.700519614272e9, 1.700519614608e9), Test.DefaultTestSet(\"<ψₙ|p|ψₙ> = ∫ψₙ*(-iℏd/dx)ψₙdx = 0\", Any[], 4, false, false, true, 1.700519614626e9, 1.700519615014e9), Test.DefaultTestSet(\"<ψₙ|p²|ψₙ> = ∫ψₙ*(-ℏ²d²/dx²)ψₙdx = π²ℏ²/L²\", Any[], 4, false, false, true, 1.700519615029e9, 1.700519615335e9), Test.DefaultTestSet(\"Hₙ(x) = (-1)ⁿ exp(x²) dⁿ/dxⁿ exp(-x²) = ...\", Any[], 10, false, false, true, 1.700519615365e9, 1.700519615515e9), Test.DefaultTestSet(\"∫Hⱼ(x)Hᵢ(x)exp(-x²)dx = √π2ʲj!δᵢⱼ\", Any[], 100, false, false, true, 1.70051961552e9, 1.700519616055e9), Test.DefaultTestSet(\"<ψᵢ|ψⱼ> = δᵢⱼ\", Any[], 100, false, false, true, 1.700519616058e9, 1.70051961659e9), Test.DefaultTestSet(\"2 × <ψₙ|V|ψₙ> = Eₙ\", Any[], 40, false, false, true, 1.7005196166e9, 1.700519617e9) … Test.DefaultTestSet(\"Pₙᵐ(x) = √(1-x²)ᵐ dᵐ/dxᵐ Pₙ(x); Pₙ(x) = 1/(2ⁿn!) dⁿ/dxⁿ (x²-1)ⁿ\", Any[], 15, false, false, true, 1.700519621457e9, 1.700519621572e9), Test.DefaultTestSet(\"∫Pᵢᵐ(x)Pⱼᵐ(x)dx = 2(j+m)!/(2j+1)(j-m)! δᵢⱼ\", Any[], 355, false, false, true, 1.700519621581e9, 1.700519622141e9), Test.DefaultTestSet(\"∫Yₗ₁ₘ₁(θ,φ)Yₗ₂ₘ₂(θ,φ)sinθdθdφ = δₗ₁ₗ₂δₘ₁ₘ₂\", Any[], 81, false, false, true, 1.700519622149e9, 1.700519623777e9), Test.DefaultTestSet(\"Lₙᵏ(x) = dᵏ/dxᵏ Lₙ(x); Lₙ(x) = 1/(n!) eˣ dⁿ/dxⁿ e⁻ˣ xⁿ\", Any[], 15, false, false, true, 1.700519623782e9, 1.70051962396e9), Test.DefaultTestSet(\"∫exp(-x)xᵏLᵢᵏ(x)Lⱼᵏ(x)dx = (2i+k)!/(i+k)! δᵢⱼ\", Any[], 204, false, false, true, 1.700519623967e9, 1.700519624538e9), Test.DefaultTestSet(\"∫|Rₙₗ(r)|²r²dr = δₙ₁ₙ₂δₗ₁ₗ₂\", Any[], 45, false, false, true, 1.700519624543e9, 1.700519624924e9), Test.DefaultTestSet(\"∫r|Rₙₗ(r)|²r²dr = (a₀×mₑ/μ)/2Z × [3n²-l(l+1)]; 1/μ = 1/mₑ + 1/mₚ\", Any[], 45, false, false, true, 1.70051962493e9, 1.700519625253e9), Test.DefaultTestSet(\"∫r²|Rₙₗ(r)|²r²dr = (a₀×mₑ/μ)²/2Z² × n²[5n²+1-3l(l+1)]; 1/μ = 1/mₑ + 1/mₚ\", Any[], 45, false, false, true, 1.700519625261e9, 1.700519625582e9), Test.DefaultTestSet(\"<ψₙ|V|ψₙ> / 2 = Eₙ\", Any[], 10, false, false, true, 1.700519625587e9, 1.700519626056e9), Test.DefaultTestSet(\"<ψₙ₁ₗ₁ₘ₁|ψₙ₂ₗ₂ₘ₂> = δₙ₁ₙ₂δₗ₁ₗ₂δₘ₁ₘ₂\", Any[], 196, false, false, true, 1.700519626064e9, 1.700519647791e9)], 0, false, false, true, 1.700519612868e9, 1.700519647792e9)"
"Test.DefaultTestSet(\"Antiq.jl\", Any[Test.DefaultTestSet(\"<ψᵢ|ψⱼ> = ∫ψₙ*ψₙdx = δᵢⱼ\", Any[], 100, false, false, true, 1.701193274726e9, 1.701193275384e9), Test.DefaultTestSet(\"<ψₙ|H|ψₙ> = ∫ψₙ*Tψₙdx = Eₙ\", Any[], 80, false, false, true, 1.701193275393e9, 1.701193276053e9), Test.DefaultTestSet(\"<ψₙ|x|ψₙ> = L/2\", Any[], 4, false, false, true, 1.701193276059e9, 1.701193276423e9), Test.DefaultTestSet(\"<ψₙ|x²|ψₙ> = 2L²/π³(π³/6-π/4)\", Any[], 4, false, false, true, 1.701193276433e9, 1.701193276847e9), Test.DefaultTestSet(\"<ψₙ|p|ψₙ> = ∫ψₙ*(-iℏd/dx)ψₙdx = 0\", Any[], 4, false, false, true, 1.701193276857e9, 1.701193277383e9), Test.DefaultTestSet(\"<ψₙ|p²|ψₙ> = ∫ψₙ*(-ℏ²d²/dx²)ψₙdx = π²ℏ²/L²\", Any[], 4, false, false, true, 1.701193277403e9, 1.701193277881e9), Test.DefaultTestSet(\"Hₙ(x) = (-1)ⁿ exp(x²) dⁿ/dxⁿ exp(-x²) = ...\", Any[], 10, false, false, true, 1.701193277918e9, 1.701193278115e9), Test.DefaultTestSet(\"∫Hⱼ(x)Hᵢ(x)exp(-x²)dx = √π2ʲj!δᵢⱼ\", Any[], 100, false, false, true, 1.701193278124e9, 1.7011932788e9), Test.DefaultTestSet(\"<ψᵢ|ψⱼ> = δᵢⱼ\", Any[], 100, false, false, true, 1.70119327881e9, 1.701193279526e9), Test.DefaultTestSet(\"2 × <ψₙ|V|ψₙ> = Eₙ\", Any[], 40, false, false, true, 1.701193279531e9, 1.701193280049e9) … Test.DefaultTestSet(\"Pₙᵐ(x) = √(1-x²)ᵐ dᵐ/dxᵐ Pₙ(x); Pₙ(x) = 1/(2ⁿn!) dⁿ/dxⁿ (x²-1)ⁿ\", Any[], 15, false, false, true, 1.701193286143e9, 1.701193286309e9), Test.DefaultTestSet(\"∫Pᵢᵐ(x)Pⱼᵐ(x)dx = 2(j+m)!/(2j+1)(j-m)! δᵢⱼ\", Any[], 355, false, false, true, 1.701193286321e9, 1.701193287009e9), Test.DefaultTestSet(\"∫Yₗ₁ₘ₁(θ,φ)Yₗ₂ₘ₂(θ,φ)sinθdθdφ = δₗ₁ₗ₂δₘ₁ₘ₂\", Any[], 81, false, false, true, 1.70119328702e9, 1.701193288943e9), Test.DefaultTestSet(\"Lₙᵏ(x) = dᵏ/dxᵏ Lₙ(x); Lₙ(x) = 1/(n!) eˣ dⁿ/dxⁿ e⁻ˣ xⁿ\", Any[], 15, false, false, true, 1.70119328895e9, 1.701193289218e9), Test.DefaultTestSet(\"∫exp(-x)xᵏLᵢᵏ(x)Lⱼᵏ(x)dx = (2i+k)!/(i+k)! δᵢⱼ\", Any[], 204, false, false, true, 1.701193289228e9, 1.701193289921e9), Test.DefaultTestSet(\"∫|Rₙₗ(r)|²r²dr = δₙ₁ₙ₂δₗ₁ₗ₂\", Any[], 45, false, false, true, 1.70119328993e9, 1.701193290451e9), Test.DefaultTestSet(\"∫r|Rₙₗ(r)|²r²dr = (a₀×mₑ/μ)/2Z × [3n²-l(l+1)]; 1/μ = 1/mₑ + 1/mₚ\", Any[], 45, false, false, true, 1.701193290456e9, 1.70119329088e9), Test.DefaultTestSet(\"∫r²|Rₙₗ(r)|²r²dr = (a₀×mₑ/μ)²/2Z² × n²[5n²+1-3l(l+1)]; 1/μ = 1/mₑ + 1/mₚ\", Any[], 45, false, false, true, 1.701193290887e9, 1.701193291336e9), Test.DefaultTestSet(\"<ψₙ|V|ψₙ> / 2 = Eₙ\", Any[], 10, false, false, true, 1.70119329134e9, 1.701193291834e9), Test.DefaultTestSet(\"<ψₙ₁ₗ₁ₘ₁|ψₙ₂ₗ₂ₘ₂> = δₙ₁ₙ₂δₗ₁ₗ₂δₘ₁ₘ₂\", Any[], 196, false, false, true, 1.701193291842e9, 1.701193318941e9)], 0, false, false, true, 1.701193274569e9, 1.701193318941e9)"
]
},
"execution_count": 5,
Expand Down
16 changes: 10 additions & 6 deletions docs/src/HarmonicOscillator.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,11 @@ plot!(x -> HO.V(x), lc=:black, lw=2, label="")

## Testing

Unit testing and Integration testing were done using computer algebra system ([Symbolics.jl](https://symbolics.juliasymbolics.org/stable/)) and numerical integration ([QuadGK.jl](https://juliamath.github.io/QuadGK.jl/stable/)).
Unit testing and Integration testing were done using computer algebra system ([Symbolics.jl](https://symbolics.juliasymbolics.org/stable/)) and numerical integration ([QuadGK.jl](https://juliamath.github.io/QuadGK.jl/stable/)). The test script is [here](https://github.com/ohno/Antiq.jl/blob/main/test/HarmonicOscillator.jl).

```julia
include("../../../test/HarmonicOscillator.jl")
```
#### Hermite Polynomials $H_n(x)$

```math
Expand Down Expand Up @@ -288,7 +291,7 @@ Unit testing and Integration testing were done using computer algebra system ([S

```
Test Summary: | Pass Total Time
Hₙ(x) = (-1)ⁿ exp(x²) dⁿ/dxⁿ exp(-x²) = ... | 10 10 28.0s
Hₙ(x) = (-1)ⁿ exp(x²) dⁿ/dxⁿ exp(-x²) = ... | 10 10 34.9s
```

#### Normalization & Orthogonality of $H_n(x)$
Expand Down Expand Up @@ -400,7 +403,7 @@ Hₙ(x) = (-1)ⁿ exp(x²) dⁿ/dxⁿ exp(-x²) = ... | 10 10 28.0s
9 8 0.0000000016298145 0.0000000000000000 0.0000000000000000% ✔
9 9 329312283.3492956757545471 329312283.3492959141731262 0.0000000000000724% ✔
Test Summary: | Pass Total Time
∫Hⱼ(x)Hᵢ(x)exp(-x²)dx = √π2ʲj!δᵢⱼ | 100 100 0.8s
∫Hⱼ(x)Hᵢ(x)exp(-x²)dx = √π2ʲj!δᵢⱼ | 100 100 1.0s
```

#### Normalization & Orthogonality of $\psi_n(x)$
Expand Down Expand Up @@ -512,7 +515,7 @@ Test Summary: | Pass Total Time
9 8 -0.0000000000000000 0.0000000000000000 0.0000000000000000% ✔
9 9 0.9999999999999998 1.0000000000000000 0.0000000000000222% ✔
Test Summary: | Pass Total Time
<ψᵢ|ψⱼ> = δᵢⱼ | 100 100 0.6s
<ψᵢ|ψⱼ> = δᵢⱼ | 100 100 0.7s
```

#### Virial Theorem
Expand Down Expand Up @@ -566,7 +569,7 @@ The virial theorem $\langle T \rangle = \langle V \rangle$ and the definition of
5.0 8 8.4999999999999929 8.5000000000000000 0.0000000000000836% ✔
5.0 9 9.5000000000000000 9.5000000000000000 0.0000000000000000% ✔
Test Summary: | Pass Total Time
2 × <ψₙ|V|ψₙ> = Eₙ | 40 40 0.5s
2 × <ψₙ|V|ψₙ> = Eₙ | 40 40 0.6s
```

#### Eigen Values
Expand Down Expand Up @@ -674,5 +677,6 @@ are given by the sum of 2 Taylor series:
5.0 8 19.0065551524155296 19.0065778087482116 0.0001192025882298% ✔
5.0 9 21.2426175047498660 21.2426457862480049 0.0001331354786194% ✔
Test Summary: | Pass Total Time
∫ψₙ*Hψₙdx = <ψₙ|H|ψₙ> = Eₙ | 40 40 0.5s
∫ψₙ*Hψₙdx = <ψₙ|H|ψₙ> = Eₙ | 40 40 0.6s
```
Loading

0 comments on commit 3df57ba

Please sign in to comment.