Skip to content

Commit a068681

Browse files
committed
Synchronise with tmprint to add typesetting support for atan2(y,x), m_Gamma(a,z), Lambert_W(x); BernoulliP(n,x), EulerP(n,x), FibonacciP(n,x); Bernoulli(n), Euler(n), Fibonacci(n), Stirling1(n, m), Stirling2(n, m), Motzkin(n).
1 parent 70df98b commit a068681

File tree

2 files changed

+73
-22
lines changed

2 files changed

+73
-22
lines changed

resources/rrprint.red

Lines changed: 65 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,16 +1808,24 @@ put('log, 'fancy!-functionsymbol, "\log");
18081808
put('logb, 'fancy!-prifn, 'fancy!-logb);
18091809
put('log10, 'fancy!-prifn, 'fancy!-log10);
18101810
1811-
symbolic procedure fancy!-logb(u);
1811+
inline procedure fancy!-logb(u);
18121812
% u = (logb(x, b) -> \log_{b}(x)
1813-
fancy!-indexed!-fn {'log, caddr u, cadr u};
1813+
fancy!-indexed!-fn {"\log", caddr u, cadr u};
18141814
1815-
symbolic procedure fancy!-log10(u);
1815+
inline procedure fancy!-log10(u);
18161816
% u = (log10 x) -> \log_{10}(x)
1817-
fancy!-indexed!-fn {'log, 10, cadr u};
1817+
fancy!-indexed!-fn {"\log", 10, cadr u};
18181818
1819-
symbolic inline procedure fancy!-indexed!-fn u;
1820-
fancy!-bessel u;
1819+
put('atan2, 'fancy!-functionsymbol, "\arctan_2");
1820+
1821+
symbolic procedure fancy!-indexed!-fn u;
1822+
fancy!-level
1823+
begin scalar w;
1824+
fancy!-prefix!-operator car u;
1825+
w := fancy!-print!-one!-index cadr u;
1826+
if testing!-width!* and w eq 'failed then return w;
1827+
return fancy!-print!-function!-arguments cddr u;
1828+
end;
18211829
18221830
put('ln, 'fancy!-functionsymbol, "\ln");
18231831
put('max, 'fancy!-functionsymbol, "\max");
@@ -1868,6 +1876,7 @@ symbolic procedure fancy!-polygamma(u);
18681876
end;
18691877

18701878
put('iGamma, 'fancy!-functionsymbol, '!P); % P(a,z)
1879+
put('m_Gamma, 'fancy!-functionsymbol, "\gamma"); % gamma(a,z)
18711880

18721881
put('iBeta, 'fancy!-prifn, 'fancy!-iBeta);
18731882
put('iBeta, 'fancy!-functionsymbol, '!I);
@@ -1900,6 +1909,7 @@ put('Ci, 'fancy!-functionsymbol, "\mathrm{Ci}");
19001909
put('Shi, 'fancy!-functionsymbol, "\mathrm{Shi}");
19011910
put('Chi, 'fancy!-functionsymbol, "\mathrm{Chi}");
19021911
put('erf, 'fancy!-functionsymbol, "\mathrm{erf}");
1912+
% erfc(x) -> 1 - erf(x) for all x.
19031913
put('Fresnel_S, 'fancy!-functionsymbol, "\mathrm{S}");
19041914
put('Fresnel_C, 'fancy!-functionsymbol, "\mathrm{C}");
19051915

@@ -1917,24 +1927,15 @@ put('Airy_BiPrime, 'fancy!-functionsymbol, "\mathrm{Bi}'");
19171927
put('Airy_AiPrime, 'fancy!-symbol!-length, 5);
19181928
put('Airy_BiPrime, 'fancy!-symbol!-length, 5);
19191929

1920-
put('BesselI, 'fancy!-prifn, 'fancy!-bessel);
1921-
put('BesselJ, 'fancy!-prifn, 'fancy!-bessel);
1922-
put('BesselY, 'fancy!-prifn, 'fancy!-bessel);
1923-
put('BesselK, 'fancy!-prifn, 'fancy!-bessel);
1930+
put('BesselI, 'fancy!-prifn, 'fancy!-indexed!-fn);
1931+
put('BesselJ, 'fancy!-prifn, 'fancy!-indexed!-fn);
1932+
put('BesselY, 'fancy!-prifn, 'fancy!-indexed!-fn);
1933+
put('BesselK, 'fancy!-prifn, 'fancy!-indexed!-fn);
19241934
put('BesselI, 'fancy!-functionsymbol, '!I);
19251935
put('BesselJ, 'fancy!-functionsymbol, '!J);
19261936
put('BesselY, 'fancy!-functionsymbol, '!Y);
19271937
put('BesselK, 'fancy!-functionsymbol, '!K);
19281938

1929-
symbolic procedure fancy!-bessel(u);
1930-
fancy!-level
1931-
begin scalar w;
1932-
fancy!-prefix!-operator car u;
1933-
w:=fancy!-print!-one!-index cadr u;
1934-
if testing!-width!* and w eq 'failed then return w;
1935-
return fancy!-print!-function!-arguments cddr u;
1936-
end;
1937-
19381939
put('Hankel1, 'fancy!-prifn, 'fancy!-Hankel); % H_{nu}^{(1)}(z)
19391940
put('Hankel2, 'fancy!-prifn, 'fancy!-Hankel); % H_{nu}^{(2)}(z)
19401941

@@ -1974,6 +1975,10 @@ symbolic procedure fancy!-Lommel(u);
19741975

19751976
put('KummerM, 'fancy!-functionsymbol, '!M); % M(a, b, z)
19761977
put('KummerU, 'fancy!-functionsymbol, '!U); % U(a, b, z)
1978+
% Note the Whittaker M & W functions are simplified to expressions
1979+
% involving the Kummer M & U functions respectively.
1980+
1981+
put('Lambert_W, 'fancy!-functionsymbol, "\omega");
19771982

19781983
% Classical Orthogonal Polynomials
19791984

@@ -2031,6 +2036,47 @@ put('LaguerreP, 'fancy!-functionsymbol, '!L);
20312036
put('HermiteP, 'fancy!-prifn, 'fancy!-indexed!-fn); % H_n(x)
20322037
put('HermiteP, 'fancy!-functionsymbol, '!H);
20332038

2039+
% Other Polynomials and Numbers
2040+
2041+
put('BernoulliP, 'fancy!-prifn, 'fancy!-indexed!-fn); % B_n(x)
2042+
put('BernoulliP, 'fancy!-functionsymbol, '!B);
2043+
put('EulerP, 'fancy!-prifn, 'fancy!-indexed!-fn); % E_n(x)
2044+
put('EulerP, 'fancy!-functionsymbol, '!E);
2045+
put('FibonacciP, 'fancy!-prifn, 'fancy!-indexed!-fn); % F_n(x)
2046+
put('FibonacciP, 'fancy!-functionsymbol, '!F);
2047+
2048+
put('Bernoulli, 'fancy!-prifn, 'fancy!-indexed!-symbol); % B_n
2049+
put('Bernoulli, 'fancy!-special!-symbol, '!B);
2050+
put('Euler, 'fancy!-prifn, 'fancy!-indexed!-symbol); % E_n
2051+
put('Euler, 'fancy!-special!-symbol, '!E);
2052+
put('Fibonacci, 'fancy!-prifn, 'fancy!-indexed!-symbol); % F_n
2053+
put('Fibonacci, 'fancy!-special!-symbol, '!F);
2054+
put('Motzkin, 'fancy!-prifn, 'fancy!-indexed!-symbol); % M_n
2055+
put('Motzkin, 'fancy!-special!-symbol, '!M);
2056+
2057+
symbolic procedure fancy!-indexed!-symbol(u);
2058+
% e.g. u = (Motzkin n)
2059+
fancy!-level
2060+
<<
2061+
fancy!-prefix!-operator car u;
2062+
fancy!-print!-one!-index cadr u
2063+
>>;
2064+
2065+
put('Stirling1, 'fancy!-prifn, 'fancy!-Stirling); % s_n^m
2066+
put('Stirling2, 'fancy!-prifn, 'fancy!-Stirling); % S_n^m
2067+
2068+
symbolic procedure fancy!-Stirling(u);
2069+
% u = (Stirling1/2 mu nu)
2070+
fancy!-level
2071+
begin scalar w;
2072+
fancy!-prefix!-operator(if car u eq 'Stirling1 then "\mathrm{s}"
2073+
else "\mathrm{S}");
2074+
w := fancy!-print!-indexlist1({cadr u}, '!_, '!*comma!*);
2075+
if testing!-width!* and w eq 'failed then return w;
2076+
w := fancy!-print!-indexlist1({caddr u}, '!^, '!*comma!*);
2077+
return w;
2078+
end;
2079+
20342080
% Other Special Functions
20352081

20362082
put('polylog, 'fancy!-prifn, 'fancy!-indexed!-fn);

test/symbols_and_functions.tst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
{exp(x), log(x), log10(x), logb(x, b), sqrt(x), factorial(x)};
1212
{sin(x), cos(x), tan(x), csc(x), sec(x), cot(x)};
1313
{sinh(x), cosh(x), tanh(x), csch(x), sech(x), coth(x)};
14-
{asin(x), acos(x), atan(x), acsc(x), asec(x), acot(x)};
14+
{asin(x), acos(x), atan(x), atan2(y, x), acsc(x), asec(x), acot(x)};
1515
{asinh(x), acosh(x), atanh(x), acsch(x), asech(x), acoth(x)};
1616

1717
% Complex value functions:
1818
{repart z, impart z, conj z, conj(a+i*b)};
1919
let conj z => z_bar; {conj z, conj z_bar, z*z_bar = abs(z)^2};
2020

2121
% Gamma, Beta and related functions:
22-
{Gamma(z), Beta(a, b), psi(z), polygamma(n, z), iGamma(a, z), iBeta(a, b, x), dilog(z),
23-
Pochhammer(a, n), binomial(m, n), zeta(s)};
22+
{Gamma(z), Beta(a, b), psi(z), polygamma(n, z), iGamma(a, z), m_Gamma(a, z), iBeta(a, b, x),
23+
dilog(z), Pochhammer(a, n), binomial(m, n), zeta(s), Lambert_W(x)};
2424

2525
load_package specfn;
2626

@@ -40,4 +40,9 @@ load_package specfn;
4040
{JacobiP(n, alpha, beta, x), GegenbauerP(n, lambda, x), ChebyshevT(n, x), ChebyshevU(n, x),
4141
LegendreP(n, x), LegendreP(n, m, x), LaguerreP(n, x), LaguerreP(n, alpha, x), HermiteP(n, x)};
4242

43+
% Other Polynomials and Numbers:
44+
{BernoulliP(n, x), EulerP(n, x), FibonacciP(n, x)};
45+
46+
{Bernoulli(n), Euler(n), Fibonacci(n), Stirling1(n, m), Stirling2(n, m), Motzkin(n)};
47+
4348
;end;

0 commit comments

Comments
 (0)