Skip to content
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

Make differential operators in partialderivative(pdv) customizable #36

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions physica-manual.typ
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ Function: `partialderivative(`_f_, \*_args_, \*\*_kwargs_`)`, abbreviated as `pd
- _f_: the function, which can be `#none` or omitted,
- positional _args_: the variable names, *optionally* followed by an order number e.g. `2`, or an order array e.g. `[2,3]`, `[k]`, `[m n, lambda+1]`.
- named _kwargs_:
- `d`: the differential symbol [default: `diff`].
- `s`: the "slash" separating the numerator and denominator [default: `none`], by default it produces the normal fraction form $pdv(f,x)$. The most common non-default is `slash` or simply `\/`, so as to create a flat form $pdv(f,x,s:\/)$ that fits inline.
- `total`: the user-specified total order.
- If it is absent, then (1) if the orders assigned to all variables are numeric, the total order number will be *automatically computed*; (2) if non-number symbols are present, computation will be attempted with minimum effort, and a user override with argument `total` may be necessary.
Expand Down Expand Up @@ -802,17 +803,25 @@ Function: `partialderivative(`_f_, \*_args_, \*\*_kwargs_`)`, abbreviated as `pd
*(8)* #hl(`pdv(phi,x,y,z,tau, [2,2,2,1])`) \
$ pdv(phi,x,y,z,tau, [2,2,2,1]) $
],
[
[
*(9)* #hl(`pdv(,x,y,z,t,[1,xi,2,eta+2])`) \
$ pdv(,x,y,z,t,[1,xi,2,eta+2]) $
],
[
*(10)* #hl(`pdv(,x,y,z,[xi n,n-1],total:(xi+1)n)`) \
$ pdv(,x,y,z,[xi n,n-1],total:(xi+1)n) $
],
[
*(11)* #hl(`pdv(S, phi.alt, phi.alt, d:delta)`) \
$ pdv(S, phi.alt, phi.alt, d:delta) $
],
[
*(12)* #hl(`pdv(W[J], J^mu (x) J^nu (y), d:delta)`) \
$ pdv(W[J], J^mu (x) J^nu (y), d:delta) $
]
)

*(11)* #hl(`integral_V dd(V) (pdv(cal(L), phi) - diff_mu (pdv(cal(L), (diff_mu phi)))) = 0`) \
*(13)* #hl(`integral_V dd(V) (pdv(cal(L), phi) - diff_mu (pdv(cal(L), (diff_mu phi)))) = 0`) \
$ integral_V dd(V) (pdv(cal(L), phi) - diff_mu (pdv(cal(L), (diff_mu phi)))) = 0 $

== Special show rules
Expand Down
10 changes: 6 additions & 4 deletions physica.typ
Original file line number Diff line number Diff line change
Expand Up @@ -693,22 +693,24 @@
__bare_minimum_effort_symbolic_add(orders)
}

let d = kwargs.at("d", default: $diff$)

let lowers = ()
for i in range(var_num) {
let var = args.at(1 + i) // 1st element is the function name, skip
let order = orders.at(i)
if order == [1] {
lowers.push($diff#var$)
lowers.push($#d#var$)
} else {
let varorder = __combine_var_order(var, order)
lowers.push($diff#varorder$)
lowers.push($#d#varorder$)
}
}

let upper = if total_order != 1 and total_order != [1] { // number or Content
if f == none { $diff^#total_order$ } else { $diff^#total_order#f$ }
if f == none { $#d^#total_order$ } else { $#d^#total_order#f$ }
} else {
if f == none { $diff$ } else { $diff #f$ }
if f == none { $#d$ } else { $#d #f$ }
}

let display(num, denom, slash) = {
Expand Down
Loading