kalc_lib/
functions.rs

1use std::collections::HashSet;
2pub fn functions() -> HashSet<&'static str> {
3    [
4        "sum",
5        "product",
6        "prod",
7        "summation",
8        "cofactor",
9        "cofactors",
10        "cof",
11        "minor",
12        "minors",
13        "adjugate",
14        "adj",
15        "inv",
16        "inverse",
17        "transpose",
18        "trans",
19        "len",
20        "length",
21        "wid",
22        "width",
23        "tr",
24        "trace",
25        "det",
26        "determinant",
27        "part",
28        "norm",
29        "norm_combine",
30        "abs",
31        "normalize",
32        "car",
33        "cartesian",
34        "polar",
35        "pol",
36        "angle",
37        "cross",
38        "proj",
39        "oproj",
40        "project",
41        "oproject",
42        "dot",
43        "rotate",
44        "sin",
45        "csc",
46        "cos",
47        "sec",
48        "tan",
49        "cot",
50        "asin",
51        "arcsin",
52        "acsc",
53        "arccsc",
54        "acos",
55        "arccos",
56        "asec",
57        "arcsec",
58        "atan",
59        "arctan",
60        "atan2",
61        "hypot",
62        "acot",
63        "arccot",
64        "sinh",
65        "csch",
66        "cosh",
67        "sech",
68        "tanh",
69        "coth",
70        "asinh",
71        "arcsinh",
72        "acsch",
73        "arccsch",
74        "acosh",
75        "arccosh",
76        "asech",
77        "arcsech",
78        "atanh",
79        "arctanh",
80        "acoth",
81        "arccoth",
82        "cis",
83        "ln",
84        "ceil",
85        "floor",
86        "round",
87        "recip",
88        "exp",
89        "log",
90        "root",
91        "bi",
92        "binomial",
93        "gamma",
94        "max",
95        "min",
96        "sqrt",
97        "re",
98        "real",
99        "im",
100        "imag",
101        "sgn",
102        "sign",
103        "arg",
104        "cbrt",
105        "frac",
106        "fract",
107        "int",
108        "trunc",
109        "square",
110        "cube",
111        "fact",
112        "subfact",
113        "sinc",
114        "conj",
115        "conjugate",
116        "erf",
117        "erfc",
118        "ai",
119        "digamma",
120        "zeta",
121        "sort",
122        "Γ",
123        "ζ",
124        "Σ",
125        "Π",
126        "factor",
127        "factors",
128        "vec",
129        "all",
130        "any",
131        "eigenvalues",
132        "eigenvectors",
133        "rref",
134        "ker",
135        "ran",
136        "rank",
137        "null",
138        "generalized_eigenvectors",
139        "rcf",
140        "jcf",
141        "change_basis",
142        "coordinate",
143        "mat",
144        "prime",
145        "reverse",
146        "flatten",
147        "I",
148        "P",
149        "C",
150        "split",
151        "slog",
152        "doublefact",
153        "mean",
154        "median",
155        "mode",
156        "quad",
157        "quadratic",
158        "cubic",
159        "standarddeviation",
160        "variance",
161        "to_list",
162        "to_freq",
163        "σ",
164        "var",
165        "quartiles",
166        "percentile",
167        "percentilerank",
168        "normD",
169        "normP",
170        "piecewise",
171        "pw",
172        "is_prime",
173        "isprime",
174        "dice",
175        "μ",
176        "W",
177        "productlog",
178        "lambertw",
179        "ssrt",
180        "gcd",
181        "gcf",
182        "lcm",
183        "multinomial",
184        "Β",
185        "B",
186        "beta",
187        "betaP",
188        "betaC",
189        "slope",
190        "taylor",
191        "lim",
192        "limit",
193        "D",
194        "area",
195        "∫",
196        "integrate",
197        "arclength",
198        "roll",
199        "erfi",
200        "polygamma",
201        "trigamma",
202        "pochhammer",
203        "ph",
204        "ψ",
205        "next",
206        "factorial",
207        "doublefactorial",
208        "subfactorial",
209        "units",
210        "An",
211        "Ap",
212        "eta",
213        "η",
214        "iden",
215        "identity",
216        "quartic",
217        "solve",
218        "inter",
219        "interpolate",
220        "unity",
221        "iter",
222        "rand_weighted",
223        "lobf",
224        "lineofbestfit",
225        "onlyreal",
226        "onlyre",
227        "ore",
228        "onlyimag",
229        "onlyim",
230        "oim",
231        "mod",
232        "cossin",
233        "sincos",
234        "surfacearea",
235        "sarea",
236        "cov",
237        "covariance",
238        "extrema",
239        "plane",
240        "is_nan",
241        "is_inf",
242        "is_fin",
243        "is_finite",
244        "nth_prime",
245        "rand_norm",
246        "rand_uniform",
247        "rand_int",
248        "geo_mean",
249        "γ",
250        "lower_gamma",
251        "gamma_pdf",
252        "gamma_cdf",
253        "beta_cdf",
254        "beta_pdf",
255        "norm_cdf",
256        "norm_pdf",
257        "rand_gamma",
258        "rand_beta",
259        "skewness",
260        "weighted_mean",
261        "lognorm_cdf",
262        "binomial_cdf",
263        "geometric_cdf",
264        "lognorm_pdf",
265        "binomial_pmf",
266        "geometric_pmf",
267        "poly",
268        "polynomial",
269        "rand_lognorm",
270        "rand_binomial",
271        "rand_geometric",
272        "rand_bernoulli",
273        "sd",
274        "skew",
275        "isolate",
276        "kurtosis",
277        "rand_poisson",
278        "poisson_pmf",
279        "poisson_cdf",
280        "rand_neg_binomial",
281        "neg_binomial_cdf",
282        "neg_binomial_pmf",
283        "hypergeometric_pmf",
284        "hypergeometric_cdf",
285        "rand_hypergeometric",
286        "neg_hypergeometric_pmf",
287        "neg_hypergeometric_cdf",
288        "rand_neg_hypergeometric",
289        "cyl",
290        "cylinder",
291        "prime_factors",
292        "hsv_to_rgb",
293        "domain_coloring_rgb",
294        "set",
295        "uniq",
296        "union",
297        "intersection",
298        "set_difference",
299        "symmetric_difference",
300        "cartesian_product",
301        "power_set",
302        "set_fix",
303        "subset",
304        "element",
305        "remove",
306        "extend",
307        "link",
308        "rationalize",
309    ]
310    .iter()
311    .cloned()
312    .collect::<HashSet<&str>>()
313}
314pub fn functions_with_args() -> HashSet<&'static str> {
315    [
316        "sum(a,f(a),start,end)",
317        "sum(vec)",
318        "prod(a,f(a),start,end)",
319        "prod(vec)",
320        "Σ(a,f(a),start,end)",
321        "Π(a,f(a),start,end)",
322        "cofactor(mat)",
323        "minor(mat)",
324        "adjugate(mat)",
325        "inverse(mat)",
326        "transpose(mat)",
327        "length(vec/mat)",
328        "width(vec/mat)",
329        "trace(mat)",
330        "isolate(a,f(a))",
331        "determinant(mat)",
332        "part(mat,x(,y))",
333        "part(vec,x)",
334        "norm(num/vec/mat)",
335        "norm_combine(mat)",
336        "abs(num/vec/mat)",
337        "normalize(vec)",
338        "cartesian({r,θ(,φ)})",
339        "polar({x,y(,z)})",
340        "angle(vec(,vec))",
341        "cross(vec,vec)",
342        "project(vec,vec)",
343        "oproject(vec,vec)",
344        "dot(vec,vec)",
345        "rotate(θ)",
346        "rotate(yaw,pitch,roll)",
347        "sin(x)",
348        "csc(x)",
349        "cos(x)",
350        "sec(x)",
351        "tan(x)",
352        "cot(x)",
353        "asin(x)",
354        "acsc(x)",
355        "acos(x)",
356        "asec(x)",
357        "atan(x(,y))",
358        "atan2(y,x)",
359        "hypot(y,x)",
360        "acot(x)",
361        "sinh(x)",
362        "csch(x)",
363        "cosh(x)",
364        "sech(x)",
365        "tanh(x)",
366        "coth(x)",
367        "asinh(x)",
368        "acsch(x)",
369        "acosh(x)",
370        "asech(x)",
371        "atanh(x)",
372        "acoth(x)",
373        "cis(x)",
374        "ln(x)",
375        "ceil(x(,d))",
376        "floor(x(,d))",
377        "round(x(,d))",
378        "recip(x)",
379        "exp(x(,y))",
380        "log((b,)p)",
381        "root(b(,p))",
382        "bi(n,r)",
383        "gamma(s(,x))",
384        "max(vec/mat)",
385        "min(vec/mat)",
386        "sqrt(x)",
387        "re(x)",
388        "im(x)",
389        "sgn(x)",
390        "arg(x)",
391        "cbrt(x)",
392        "fract(x(,d))",
393        "int(x(,d))",
394        "trunc(x(,d))",
395        "fact(x)",
396        "subfact(x)",
397        "sinc(x)",
398        "conj(x)",
399        "erf(x)",
400        "erfc(x)",
401        "ai(x)",
402        "digamma((m,)x)",
403        "zeta(x)",
404        "sort(vec/mat)",
405        "Γ(x)",
406        "ζ(x)",
407        "factors(x)",
408        "vec(a,f(a),start,end)",
409        "all(vec)",
410        "any(vec)",
411        "eigenvalues(mat)",
412        "eigenvectors(mat)",
413        "rref(mat)",
414        "ker(mat)",
415        "generalized_eigenvectors(mat)",
416        "rcf(mat)",
417        "jcf(mat)",
418        "change_basis(mat(,beta),gamma)",
419        "coordinate(beta, v)",
420        "ran(mat)",
421        "rank(mat)",
422        "null(mat)",
423        "mat(a,f(a),start,end)",
424        "reverse(vec)",
425        "flatten(mat)",
426        "I(x,α,β(,z))",
427        "P(n,r)",
428        "C(n,r)",
429        "split(x)",
430        "slog(b,p)",
431        "doublefact(x)",
432        "mean(vec)",
433        "weighted_mean(mat)",
434        "median(vec)",
435        "mode(vec)",
436        "quadratic(a,b,c(,real))",
437        "cubic(a,b,c,d(,real))",
438        "standarddeviation(vec)",
439        "variance(vec)",
440        "to_list(mat)",
441        "to_freq(vec)",
442        "σ(vec)",
443        "quartiles(vec)",
444        "percentile(vec,nth)",
445        "percentilerank(vec,x)",
446        "norm_cdf(x,μ,σ)",
447        "norm_pdf(x,μ,σ)",
448        "piecewise({f(x),bool},{g(x),bool}...)",
449        "is_prime(x)",
450        "dice(vec/mat)",
451        "μ(vec)",
452        "W((k,),x)",
453        "productlog((k,),x)",
454        "lambertw((k,),x)",
455        "ssrt((k,),x)",
456        "gcd(x,y)",
457        "lcm(x,y)",
458        "multinomial(a,b,c...)",
459        "Β((z,)a,b)",
460        "B((z,)a,b)",
461        "beta((z,)a,b)",
462        "beta_pdf(x,α,β)",
463        "beta_cdf(x,α,β)",
464        "slope(a,f(a),x(,nth)(,combine))",
465        "taylor(a,f(a),p,n(,x))",
466        "lim(a,f(a),x(,side))",
467        "area(a,f(a),start,end(,nth)(,combine)",
468        "arclength(a,f(a),start,end)",
469        "roll(vec/mat)",
470        "erfi(x)",
471        "pochhammer(x,n)",
472        "next(x(,to))",
473        "units(x)",
474        "An(n,k)",
475        "Ap(n,t)",
476        "eta(x)",
477        "η(x)",
478        "identity(n)",
479        "quartic(a,b,c,d,e(,real))",
480        "solve(a,f(a)(,start))",
481        "interpolate(mat,x)",
482        "unity(b,p)",
483        "iter(a,f(a),x,n(,steps))",
484        "rand_weighted(mat)",
485        "lineofbestfit(mat(,x))",
486        "onlyreal(x)",
487        "onlyimag(x)",
488        "mod(a,b)",
489        "cossin(x)",
490        "sincos(x)",
491        "surfacearea(a,b,z(a,b),start_b,end_b,start_a,end_a)",
492        "covariance(vec)",
493        "extrema(a,f(a)(,start))",
494        "plane(mat(,x,y))",
495        "is_nan(x)",
496        "is_inf(x)",
497        "is_finite(x)",
498        "nth_prime(n)",
499        "rand_norm(μ,σ)",
500        "rand_int(a,b)",
501        "rand_uniform(a,b)",
502        "geo_mean(vec)",
503        "γ(s(,x))",
504        "lower_gamma(s,x)",
505        "gamma_pdf(k,θ)",
506        "gamma_cdf(k,θ)",
507        "rand_gamma(k,θ)",
508        "rand_beta(k,θ)",
509        "skewness(vec)",
510        "lognorm_cdf(x,μ,σ)",
511        "binomial_cdf(k,n,p)",
512        "geometric_cdf(k,p)",
513        "lognorm_pdf(x,μ,σ)",
514        "binomial_pmf(k,n,p)",
515        "geometric_pmf(k,p)",
516        "polynomial(vec/mat,x)",
517        "rand_lognorm(μ,σ)",
518        "rand_binomial(n,p)",
519        "rand_geometric(k,p)",
520        "rand_bernoulli(p)",
521        "rand_poisson(λ)",
522        "poisson_pmf(x,λ)",
523        "poisson_cdf(x,λ)",
524        "kurtosis(vec)",
525        "rand_neg_binomial(r,p)",
526        "neg_binomial_cdf(k,r,p)",
527        "neg_binomial_pmf(k,r,p)",
528        "hypergeometric_pmf(k,N,K,n)",
529        "hypergeometric_cdf(k,N,K,n)",
530        "rand_hypergeometric(N,K,n)",
531        "neg_hypergeometric_pmf(k,N,K,r)",
532        "neg_hypergeometric_cdf(k,N,K,r)",
533        "rand_neg_hypergeometric(N,K,r)",
534        "cylinder({x,y,z})",
535        "prime_factors(n)",
536        "hsv_to_rgb({h,s,v})",
537        "domain_coloring_rgb(x)",
538        "set(a,f(a),val)",
539        "uniq({vec})",
540        "union(A,B)",
541        "intersection(A,B)",
542        "set_difference(A,B)",
543        "symmetric_difference(A,B)",
544        "cartesian_product(A,B)",
545        "power_set(A)",
546        "set_fix(A)",
547        "subset(A,B)",
548        "element(A,b)",
549        "remove(vec,num/vec)",
550        "extend(vec,num/vec)",
551        "rand",
552        "epoch",
553        "inf",
554        "true",
555        "false",
556        "nan",
557        "and",
558        "or",
559        "not",
560        "xor",
561        "nand",
562        "implies",
563        "nor",
564        "converse",
565        "rationalize(x)",
566    ]
567    .iter()
568    .cloned()
569    .collect::<HashSet<&str>>()
570}
571pub fn units_list() -> HashSet<&'static str> {
572    [
573        "eV",
574        "eC",
575        "eM",
576        "pM",
577        "nM",
578        "ke",
579        "Na",
580        "R",
581        "boltzmann",
582        "gravity",
583        "G",
584        "planck",
585        "reduced_planck",
586        "c",
587        "meter",
588        "second",
589        "ampere",
590        "kelvin",
591        "mole",
592        "candela",
593        "gram",
594        "joule",
595        "mph",
596        "mile",
597        "yard",
598        "foot",
599        "inch",
600        "pound",
601        "litre",
602        "hertz",
603        "voltage",
604        "celsius",
605        "fahrenheit",
606        "Wh",
607        "Ah",
608        "year",
609        "month",
610        "ly",
611        "kph",
612        "tesla",
613        "henry",
614        "weber",
615        "siemens",
616        "farad",
617        "watt",
618        "pascal",
619        "ohm",
620        "minute",
621        "hour",
622        "day",
623        "week",
624        "newton",
625        "coulomb",
626        "degrees",
627        "arcsec",
628        "arcmin",
629        "radians",
630        "gradians",
631        "lumen",
632        "lux",
633        "nit",
634        "byte",
635        "gray",
636        "sievert",
637        "katal",
638        "bit",
639        "steradian",
640        "atm",
641        "psi",
642        "bar",
643        "tonne",
644        "hectare",
645        "acre",
646        "ton",
647        "oz",
648        "gallon",
649        "lbf",
650        "parsec",
651        "au",
652        "floz",
653        "AUD",
654        "CAD",
655        "CNY",
656        "EUR",
657        "GBP",
658        "HKD",
659        "IDR",
660        "INR",
661        "JPY",
662        "KRW",
663        "MYR",
664        "NZD",
665        "PHP",
666        "SGD",
667        "THB",
668        "TWD",
669        "VND",
670        "BGN",
671        "BRL",
672        "CHF",
673        "CLP",
674        "CZK",
675        "DKK",
676        "HUF",
677        "ILS",
678        "ISK",
679        "MXN",
680        "NOK",
681        "PLN",
682        "RON",
683        "SEK",
684        "TRY",
685        "UAH",
686        "ZAR",
687        "EGP",
688        "JOD",
689        "LBP",
690        "AED",
691        "MDL",
692        "RSD",
693        "RUB",
694        "AMD",
695        "AZN",
696        "BDT",
697        "DOP",
698        "DZD",
699        "GEL",
700        "IQD",
701        "IRR",
702        "KGS",
703        "KZT",
704        "LYD",
705        "MAD",
706        "PKR",
707        "SAR",
708        "TJS",
709        "TMT",
710        "TND",
711        "UZS",
712        "XAF",
713        "XOF",
714        "BYN",
715        "PEN",
716        "VES",
717        "ARS",
718        "BOB",
719        "COP",
720        "CRC",
721        "HTG",
722        "PAB",
723        "PYG",
724        "UYU",
725        "NGN",
726        "AFN",
727        "ALL",
728        "ANG",
729        "AOA",
730        "AWG",
731        "BAM",
732        "BBD",
733        "BHD",
734        "BIF",
735        "BND",
736        "BSD",
737        "BWP",
738        "BZD",
739        "CDF",
740        "CUP",
741        "CVE",
742        "DJF",
743        "ERN",
744        "ETB",
745        "FJD",
746        "GHS",
747        "GIP",
748        "GMD",
749        "GNF",
750        "GTQ",
751        "GYD",
752        "HNL",
753        "JMD",
754        "KES",
755        "KHR",
756        "KMF",
757        "KWD",
758        "LAK",
759        "LKR",
760        "LRD",
761        "LSL",
762        "MGA",
763        "MKD",
764        "MMK",
765        "MNT",
766        "MOP",
767        "MRU",
768        "MUR",
769        "MVR",
770        "MWK",
771        "MZN",
772        "NAD",
773        "NIO",
774        "NPR",
775        "OMR",
776        "PGK",
777        "QAR",
778        "RWF",
779        "SBD",
780        "SCR",
781        "SDG",
782        "SOS",
783        "SRD",
784        "SSP",
785        "STN",
786        "SVC",
787        "SYP",
788        "SZL",
789        "TOP",
790        "TTD",
791        "TZS",
792        "UGX",
793        "VUV",
794        "WST",
795        "XCD",
796        "XPF",
797        "YER",
798        "ZMW",
799    ]
800    .iter()
801    .cloned()
802    .collect::<HashSet<&str>>()
803}
804pub fn options_list() -> HashSet<&'static str> {
805    [
806        "graphcli=",
807        "slowcheck=",
808        "interactive=",
809        "prompt=",
810        "progress=",
811        "surface=",
812        "rt=",
813        "siunits=",
814        "keepzeros=",
815        "polar=",
816        "frac=",
817        "fractions=",
818        "fractionsv=",
819        "fractionsm=",
820        "multi=",
821        "tabbed=",
822        "comma=",
823        "units=",
824        "scalegraph=",
825        "debug=",
826        "vars=",
827        "onaxis=",
828        "base=",
829        "ticks=",
830        "decimal=",
831        "deci=",
832        "decimals=",
833        "graphprec=",
834        "graphprecision=",
835        "prec=",
836        "windowsize=",
837        "precision=",
838        "range=",
839        "xr=",
840        "yr=",
841        "zr=",
842        "vrange=",
843        "vxr=",
844        "vyr=",
845        "vzr=",
846        "color=",
847        "lines=",
848        "angle=",
849        "notation=",
850        "graph=",
851        "saveto=",
852        "recol=",
853        "imcol=",
854        "textc=",
855        "promptc=",
856        "imagc=",
857        "scic=",
858        "unitsc=",
859        "bracketc=",
860        "label=",
861        "point=",
862        "default_units=",
863    ]
864    .iter()
865    .cloned()
866    .collect::<HashSet<&str>>()
867}