Skip to content

Commit

Permalink
Init preparation for v0.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Leedehai committed Dec 25, 2023
1 parent 66834e5 commit d2ef1e5
Show file tree
Hide file tree
Showing 5 changed files with 249 additions and 85 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
:green_book: The [manual](https://github.com/Leedehai/typst-physics/blob/master/physica-manual.pdf).
:green_book: The [manual](https://github.com/Leedehai/typst-physics/blob/v0.9.1/physica-manual.pdf).
<p align="center">
<img width="545" alt="logo" src="https://github.com/Leedehai/typst-physics/assets/18319900/ed86198a-8ddb-4473-aed3-8111d5ecde60">
</p>

# The physica package for Typst
# The physica package for Typst (v0.9.1)

[![CI](https://github.com/Leedehai/typst-physics/actions/workflows/ci.yml/badge.svg)](https://github.com/Leedehai/typst-physics/actions/workflows/ci.yml)
[![Latest release](https://img.shields.io/github/v/release/Leedehai/typst-physics.svg?color=gold)][latest-release]
Expand All @@ -27,7 +27,7 @@ natural sciences, including:

## A quick look

See the [manual](https://github.com/Leedehai/typst-physics/blob/master/physica-manual.pdf) for more details and examples.
See the [manual](https://github.com/Leedehai/typst-physics/blob/v0.9.1/physica-manual.pdf)for more details and examples.

![demo-quick](https://github.com/Leedehai/typst-physics/assets/18319900/4a9f40df-f753-4324-8114-c682d270e9c7)

Expand Down Expand Up @@ -89,7 +89,7 @@ typst 0.10.0 (70ca0d25)

## Manual

See the manual [physica-manual.pdf](https://github.com/Leedehai/typst-physics/blob/master/physica-manual.pdf) for a more comprehensive coverage, a PDF file
See the [manual](https://github.com/Leedehai/typst-physics/blob/v0.9.1/physica-manual.pdf) for a more comprehensive coverage, a PDF file
generated directly with the [Typst](https://typst.app) binary.

To regenerate the manual, use command
Expand All @@ -107,8 +107,9 @@ request. If it is large, the best first step is creating an issue and let us
explore the design together. Some features might warrant a package on its own.

* Testing: currently testing is done by closely inspecting the generated
[physica-manual.pdf](https://github.com/Leedehai/typst-physics/blob/master/physica-manual.pdf). This does not scale well. I plan to add programmatic
testing by comparing rendered pictures with golden images.
[manual](https://github.com/Leedehai/typst-physics/blob/v0.9.1/physica-manual.pdf).
This does not scale well. I plan to add programmatic testing by comparing
rendered pictures with golden images.

## License

Expand Down
62 changes: 62 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Changelog

## 0.9.2 (pending)

* Let `braket()` take an optional third argument to render `braket(u,A,v)` as
`⟨u|A|v⟩`. The one argument case `braket(a)` is still rendered as `⟨a|a⟩` and
the two argument case `braket(u,v)` is still rendered as `⟨u|v⟩`.
* Let `expval()` take an optional second argument to render `expval(A,a)` as
`⟨a|A|a⟩`. The one argument case `expval(A)` is still rendered as `⟨A⟩`.
* **(breaking)** Differentiated big-O `Order(...)` and little-o `order(...)`.
* Let Taylor series term `taylorterm(...)` automatically add parenthesis, so
that e.g. `tarlorterm(f,x,1+a,n-1)`'s `1+a` and `n-1` can be put inside
parenthesis when needed.
* Fixed a rendering issue of `Set(...)` when it contains tall contents.
* Removed the `box(..)` layer from `tensor(...)`'s phantom index.
* Added 2D and 3D rotation matrix `rot2mat(...)` and `rot3mat(...)`.
* Added Gram matrix `grammat(...)`.

## 0.9.1

* Added show rules `super-T-as-transpose` and `super-plus-as-dagger`, so that
`..^T` and `..^+` can be rendered as a transpose operator and a dagger
(i.e. conjugate transpose) operator, respectively, just like handwriting.
* Adjusted spacing for `dd()`, following advice in TeXBook Chapter 18. The
intra spacing can be disabled by a new optional argument `compact:#true`.
* Fixed a spacing issue of `vecrow(..)`.
* **(breaking)** Let `iprod(..)` be rendered in the more familiar inner
product `⟨a,b⟩`, instead of `⟨a|b⟩`--that can be done with `braket(a,b)`.
* Added optional argument `big:#true` to Jacobian matrix and Hessian matrix, so
that the fractions can be rendered in an "uncramped" form. The default is the
"cramped" form just like LaTeX.
* Added `taylorterm(...)` to display terms in the Taylor series.

## 0.9.0

Changed the minimum Typst version to 0.10.0.

* Fixed the appearance of `braket`, `ketra`, and `mel`.
* Fixed Hessian matrix `hmax(...)`.

## 0.8.1

## 0.8.0

* Added CI.
* **(breaking)** Let `va(...)` (vector arrow) be not bold, according to the ISO
standard.

## 0.7.5

* First appeared in the official package collection
[typst/packages](https://github.com/typst/packages).

## 0.7.4

* Renamed from `physics` to `physica`, meaning _natural sciences_.

## 0.7.1

## 0.6

## 0.5
Binary file modified physica-manual.pdf
Binary file not shown.
139 changes: 86 additions & 53 deletions physica-manual.typ
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,15 @@ All symbols need to be used in *math mode* `$...$`.
[`norm(phi(x))` #sym.arrow $norm(phi(x))$],
[norm],

[`Order(`_content_`)`],
[],
[`Order(x^2)` #sym.arrow $Order(x^2)$],
[big O],

[`order(`_content_`)`],
[],
[`order(x^2)` #sym.arrow $order(x^2)$],
[order of magnitude],
[`order(1)` #sym.arrow $order(1)$],
[small O],

[`Set(`_content_`)`],
[],
Expand All @@ -134,9 +139,9 @@ All symbols need to be used in *math mode* `$...$`.
[`expval`],
[
`expval(u)` #sym.arrow $expval(u)$ \
`expval(f/N)` #sym.arrow $expval(f/N)$ \
`expval(p,psi)` #sym.arrow $expval(p,psi)$ \
],
[expectation value],
[expectation value, also see bra-ket @dirac-braket below],
)

== Vector notations
Expand Down Expand Up @@ -225,6 +230,8 @@ All symbols need to be used in *math mode* `$...$`.

#v(1em)

=== Determinant, (anti-)diagonal, identity, zero matrix

#table(
columns: (auto, auto, auto, auto),
align: left,
Expand Down Expand Up @@ -279,24 +286,11 @@ All symbols need to be used in *math mode* `$...$`.
#hl(`zmat(3,delim:"[")`) #sym.arrow \ $zmat(3,delim:"[")$
],
[zero matrix],

[`jacobianmatrix(`...`)`],
[`jmat`],
[See below],
[Jacobian matrix],

[`hessianmatrix(`...`)`],
[`hmat`],
[See below],
[Hessian matrix],

[`xmatrix(`...`)`],
[`xmat`],
[See below],
[Matrix built with an element building function],
)

Jacobian matrix: `jacobianmatrix(`...`)`, i.e. `jmat(`...`)`.
=== Jacobian matrix

`jacobianmatrix(`...`)`, i.e. `jmat(`...`)`.

#table(
columns: (25%, auto, auto),
Expand Down Expand Up @@ -328,7 +322,9 @@ Jacobian matrix: `jacobianmatrix(`...`)`, i.e. `jmat(`...`)`.
],
)

Hessian matrix: `hessianmatrix(`...`)`, i.e. `hmat(`...`)`.
=== Hessian matrix

`hessianmatrix(`...`)`, i.e. `hmat(`...`)`.

#table(
columns: (25%, auto, auto),
Expand Down Expand Up @@ -360,7 +356,10 @@ Hessian matrix: `hessianmatrix(`...`)`, i.e. `hmat(`...`)`.
],
)

Matrix built with an element building function: `xmatrix(`_m, n, func_`)`, i.e. `xmat(`...`)`. The element building function _func_ takes two integers which are the row and column numbers starting from 1.
=== Matrix with an element builder

`xmatrix(`_m, n, func_`)`, i.e. `xmat(`...`)`. The element building function
_func_ takes two integers which are the row and column numbers starting from 1.

#table(
columns: (auto, auto),
Expand All @@ -385,7 +384,42 @@ xmat(2, 2, #g)`)
],
)

== Dirac braket notations
=== Rotation matrices, 2D and 3D

#table(
columns: (auto, auto, auto),
align: center,
stroke: none,
column-gutter: 1em,

[
#hl(`rot2mat(theta)`)
$ rot2mat(theta) $
],
[
#hl(`rot2mat(-a/2,delim:"[")`)
$ rot2mat(-a/2, delim:"[") $
],
[
#hl(`rot2mat(display(a/2),delim:"[")`)
$ rot2mat(display(a/2),delim:"[") $
],

[
#hl(`rot3xmat(theta)`)
$ rot3xmat(theta) $
],
[
#hl(`rot3ymat(45^degree)`)
$ rot3ymat(45^degree) $
],
[
#hl(`rot3zmat(theta,delim:"[")`)
$ rot3zmat(theta,delim:"[") $
],
)

== Dirac braket notations <dirac-braket>

#v(1em)

Expand All @@ -411,37 +445,36 @@ xmat(2, 2, #g)`)
],
[ket],

[`expval(`_content_`)`],
[`braket(`..`)`],
[],
[
`expval(u)` #sym.arrow $expval(u)$ \
`expval(vec(1,2))` #sym.arrow $expval(vec(1,2))$
`braket(a), braket(u, v)` \ #sym.arrow $braket(a), braket(u, v)$ \
`braket(psi,A/N,phi)` #sym.arrow $braket(psi,A/N,phi)$
],
[expectation],
[braket, with 1, 2, or 3 arguments],

[`braket(`_a_, _b_`)`],
[`ketbra(`..`)`],
[],
[
`braket(a), braket(u, v)` \ #sym.arrow $braket(a), braket(u, v)$ \
`braket(vec(1,2), b)` #sym.arrow $braket(vec(1,2), b)$
`ketbra(a), ketbra(u, v)` \ #sym.arrow $ketbra(a), ketbra(u, v)$ \
`ketbra(a/N, b)` #sym.arrow $ketbra(a/N, b)$
],
[braket],
[ketbra, with 1 or 2 arguments],

[`ketbra(`_a_, _b_`)`],
[`expval(`_content_`)`],
[],
[
`ketbra(a), ketbra(u, v)` \ #sym.arrow $ketbra(a), ketbra(u, v)$ \
`ketbra(vec(1,2), b)` #sym.arrow $ketbra(vec(1,2), b)$
`expval(u)` #sym.arrow $expval(u)$ \
`expval(A,psi)` #sym.arrow $expval(A,psi)$
],
[ketbra],
[expectation],

[`matrixelement(`_n_, _M_, _m_`)`],
[`matrixelement(`..`)`],
[`mel`],
[
`mel(n, diff_nu H, m)` \ #sym.arrow $mel(n, diff_nu H, m)$ \
`mel(vec(U,V),A,m)` #sym.arrow $mel(vec(U,V),A,m)$
`mel(n, diff_nu H, m)` \ #sym.arrow $mel(n, diff_nu H, m)$
],
[matrix element],
[matrix element, same as `braket(n,M,n)`],
)

== Math functions
Expand Down Expand Up @@ -962,8 +995,8 @@ Function: `tensor(`_symbol_, \*_args_`)`.
$ tensor(AA,+a,+b,-c,-d,+e,-f,+g,-h) $
],
[
*(7)* #hl(`tensor(R, -a, -b, -c, +d)`) \
$ tensor(R, -a, -b, -c, +d) $
*(7)* #hl(`tensor(R, -a, -b, +d)`) \
$ tensor(R, -a, -b, +d) $
],
[
*(8)* #hl(`tensor(T,+1,-I(1,-1),+a_bot,-+,+-)`) \
Expand Down Expand Up @@ -1001,11 +1034,11 @@ Function: `isotope(`_element_, _a_: ..., _z_: ...`)`.
],
)

*(3)* #hl(`isotope("Bi",a:211,z:83) --> isotope("Tl",a:207,z:81) + isotope("He",a:4,z:2)`)
$ isotope("Bi",a:211,z:83) --> isotope("Tl",a:207,z:81) + isotope("He",a:4,z:2) $
*(3)* #hl(`isotope("Bi",a:211,z:83) -> isotope("Tl",a:207,z:81) + isotope("He",a:4,z:2)`)
$ isotope("Bi",a:211,z:83) -> isotope("Tl",a:207,z:81) + isotope("He",a:4,z:2) $

*(4)* #hl(`isotope("Tl",a:207,z:81) --> isotope("Pb",a:207,z:82) + isotope(e,a:0,z:-1)`)
$ isotope("Tl",a:207,z:81) --> isotope("Pb",a:207,z:82) + isotope(e,a:0,z:-1) $
*(4)* #hl(`isotope("Tl",a:207,z:81) -> isotope("Pb",a:207,z:82) + isotope(e,a:0,z:-1)`)
$ isotope("Tl",a:207,z:81) -> isotope("Pb",a:207,z:82) + isotope(e,a:0,z:-1) $

=== The n-th term in Taylor series

Expand All @@ -1016,8 +1049,8 @@ Function: `taylorterm(`_func_, _x_, _x0_, _idx_`)`.
- _x_: the variable name e.g. `x`,
- _x0_: the variable value at the expansion point e.g. `x_0`, `(1+a)`,
- _idx_: the index of the term, e.g. `0`, `1`, `2`, `n`, `(n+1)`.
If _x0_ or _idx_ is in a parenthesis e.g. `(1+k)`, then the function
automatically removes the outer parenthesis where appropriate.
If _x0_ or _idx_ is an add/sub sequence e.g. `-a`, `a+b`, then the function
automatically adds a parenthesis where appropriate.

#align(center, [*Examples*])

Expand All @@ -1034,20 +1067,20 @@ automatically removes the outer parenthesis where appropriate.
$ taylorterm(f,x,x_0,1) $
],
[
*(3)* #hl(`taylorterm(f,x,(1+a),2)`) \
$ taylorterm(f,x,(1+a),2) $
*(3)* #hl(`taylorterm(F,x^nu,x^nu_0,n)`) \
$ taylorterm(F,x^nu,x^nu_0,n) $
],
[
*(4)* #hl(`taylorterm(f,x,x_0,n)`) \
$ taylorterm(f,x,x_0,n) $
],
[
*(5)* #hl(`taylorterm(F,x^nu,x^nu_0,n)`) \
$ taylorterm(F,x^nu,x^nu_0,n) $
*(5)* #hl(`taylorterm(f,x,1+a,2)`) \
$ taylorterm(f,x,1+a,2) $
],
[
*(6)* #hl(`taylorterm(f_p,x,x_0,(n+1))`) \
$ taylorterm(f_p,x,x_0,(n+1)) $
*(6)* #hl(`taylorterm(f_p,x,x_0,n-1)`) \
$ taylorterm(f_p,x,x_0,n-1) $
],
)

Expand Down
Loading

0 comments on commit d2ef1e5

Please sign in to comment.