plurimath 0.11.11 → 0.11.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/dependent-tests.yml +7 -0
- data/.github/workflows/shared-testsuite.yml +24 -0
- data/.gitmodules +3 -0
- data/.rspec-opal +3 -0
- data/Gemfile +18 -0
- data/README.adoc +297 -3
- data/docs/catalog.adoc +73 -0
- data/docs/uncertainty-asciimath-tree.md +92 -0
- data/docs/uncertainty.adoc +522 -0
- data/lib/plurimath/asciimath/parse.rb +43 -226
- data/lib/plurimath/asciimath/parser.rb +58 -1
- data/lib/plurimath/asciimath/slice_adapter.rb +138 -0
- data/lib/plurimath/asciimath/transform.rb +218 -0
- data/lib/plurimath/asciimath.rb +1 -0
- data/lib/plurimath/catalog/entry.rb +109 -0
- data/lib/plurimath/catalog/validation.rb +109 -0
- data/lib/plurimath/catalog.rb +96 -0
- data/lib/plurimath/cli/convert.rb +40 -0
- data/lib/plurimath/cli/helpers.rb +49 -0
- data/lib/plurimath/cli/render.rb +64 -0
- data/lib/plurimath/cli.rb +55 -57
- data/lib/plurimath/documentation.rb +99 -0
- data/lib/plurimath/errors/ambiguous_decimal_error.rb +19 -0
- data/lib/plurimath/errors/invalid_uncertainty.rb +18 -0
- data/lib/plurimath/errors/missing_dependency_error.rb +23 -0
- data/lib/plurimath/errors/rendering_failed.rb +17 -0
- data/lib/plurimath/errors/rendering_unavailable.rb +25 -0
- data/lib/plurimath/errors/unsupported_render_format.rb +18 -0
- data/lib/plurimath/errors/unsupported_semantic_tree_error.rb +12 -0
- data/lib/plurimath/errors.rb +5 -0
- data/lib/plurimath/math/evaluation/evaluator.rb +48 -0
- data/lib/plurimath/math/evaluation/expression_parser.rb +29 -20
- data/lib/plurimath/math/formula/class_tree.rb +92 -0
- data/lib/plurimath/math/formula.rb +43 -2
- data/lib/plurimath/math/function/abs.rb +6 -0
- data/lib/plurimath/math/function/arccos.rb +6 -0
- data/lib/plurimath/math/function/arcsin.rb +6 -0
- data/lib/plurimath/math/function/arctan.rb +6 -0
- data/lib/plurimath/math/function/arg.rb +20 -0
- data/lib/plurimath/math/function/bar.rb +6 -0
- data/lib/plurimath/math/function/base.rb +6 -0
- data/lib/plurimath/math/function/binary_function.rb +4 -0
- data/lib/plurimath/math/function/cancel.rb +6 -0
- data/lib/plurimath/math/function/ceil.rb +6 -0
- data/lib/plurimath/math/function/color.rb +12 -0
- data/lib/plurimath/math/function/cos.rb +6 -0
- data/lib/plurimath/math/function/cosh.rb +6 -0
- data/lib/plurimath/math/function/cot.rb +6 -0
- data/lib/plurimath/math/function/coth.rb +6 -0
- data/lib/plurimath/math/function/csc.rb +6 -0
- data/lib/plurimath/math/function/csch.rb +6 -0
- data/lib/plurimath/math/function/ddot.rb +6 -0
- data/lib/plurimath/math/function/deg.rb +6 -0
- data/lib/plurimath/math/function/det.rb +6 -0
- data/lib/plurimath/math/function/dim.rb +6 -0
- data/lib/plurimath/math/function/dot.rb +6 -0
- data/lib/plurimath/math/function/exp.rb +6 -0
- data/lib/plurimath/math/function/fenced.rb +6 -0
- data/lib/plurimath/math/function/floor.rb +6 -0
- data/lib/plurimath/math/function/font_style/bold-fraktur.rb +6 -0
- data/lib/plurimath/math/function/font_style/bold-italic.rb +6 -0
- data/lib/plurimath/math/function/font_style/bold-sans-serif.rb +6 -0
- data/lib/plurimath/math/function/font_style/bold-script.rb +6 -0
- data/lib/plurimath/math/function/font_style/bold.rb +6 -0
- data/lib/plurimath/math/function/font_style/double_struck.rb +6 -0
- data/lib/plurimath/math/function/font_style/fraktur.rb +6 -0
- data/lib/plurimath/math/function/font_style/italic.rb +6 -0
- data/lib/plurimath/math/function/font_style/monospace.rb +6 -0
- data/lib/plurimath/math/function/font_style/normal.rb +6 -0
- data/lib/plurimath/math/function/font_style/sans-serif-bold-italic.rb +6 -0
- data/lib/plurimath/math/function/font_style/sans-serif-italic.rb +6 -0
- data/lib/plurimath/math/function/font_style/sans-serif.rb +6 -0
- data/lib/plurimath/math/function/font_style/script.rb +6 -0
- data/lib/plurimath/math/function/font_style.rb +4 -0
- data/lib/plurimath/math/function/frac.rb +6 -0
- data/lib/plurimath/math/function/gcd.rb +6 -0
- data/lib/plurimath/math/function/glb.rb +12 -0
- data/lib/plurimath/math/function/hat.rb +6 -0
- data/lib/plurimath/math/function/hom.rb +6 -0
- data/lib/plurimath/math/function/inf.rb +6 -0
- data/lib/plurimath/math/function/int.rb +7 -1
- data/lib/plurimath/math/function/intent.rb +35 -0
- data/lib/plurimath/math/function/ker.rb +6 -0
- data/lib/plurimath/math/function/lcm.rb +12 -0
- data/lib/plurimath/math/function/lg.rb +6 -0
- data/lib/plurimath/math/function/lim.rb +6 -0
- data/lib/plurimath/math/function/liminf.rb +6 -0
- data/lib/plurimath/math/function/limits.rb +6 -0
- data/lib/plurimath/math/function/limsup.rb +6 -0
- data/lib/plurimath/math/function/ln.rb +6 -0
- data/lib/plurimath/math/function/log.rb +6 -0
- data/lib/plurimath/math/function/longdiv.rb +6 -0
- data/lib/plurimath/math/function/lub.rb +6 -0
- data/lib/plurimath/math/function/max.rb +6 -0
- data/lib/plurimath/math/function/mbox.rb +6 -0
- data/lib/plurimath/math/function/menclose.rb +19 -0
- data/lib/plurimath/math/function/merror.rb +22 -0
- data/lib/plurimath/math/function/min.rb +6 -0
- data/lib/plurimath/math/function/mlabeledtr.rb +23 -0
- data/lib/plurimath/math/function/mod.rb +6 -0
- data/lib/plurimath/math/function/msgroup.rb +20 -0
- data/lib/plurimath/math/function/multiscript.rb +6 -0
- data/lib/plurimath/math/function/nary.rb +11 -0
- data/lib/plurimath/math/function/norm.rb +6 -0
- data/lib/plurimath/math/function/obrace.rb +6 -0
- data/lib/plurimath/math/function/oint.rb +7 -1
- data/lib/plurimath/math/function/over.rb +6 -0
- data/lib/plurimath/math/function/overleftrightarrow.rb +6 -0
- data/lib/plurimath/math/function/overset.rb +6 -0
- data/lib/plurimath/math/function/phantom.rb +6 -0
- data/lib/plurimath/math/function/power.rb +6 -0
- data/lib/plurimath/math/function/power_base.rb +6 -0
- data/lib/plurimath/math/function/prod.rb +7 -1
- data/lib/plurimath/math/function/right.rb +1 -1
- data/lib/plurimath/math/function/root.rb +6 -0
- data/lib/plurimath/math/function/rule.rb +20 -0
- data/lib/plurimath/math/function/scarries.rb +20 -0
- data/lib/plurimath/math/function/sec.rb +6 -0
- data/lib/plurimath/math/function/sech.rb +6 -0
- data/lib/plurimath/math/function/semantics.rb +20 -0
- data/lib/plurimath/math/function/sin.rb +6 -0
- data/lib/plurimath/math/function/sinh.rb +6 -0
- data/lib/plurimath/math/function/sqrt.rb +6 -0
- data/lib/plurimath/math/function/stackrel.rb +6 -0
- data/lib/plurimath/math/function/substack.rb +6 -0
- data/lib/plurimath/math/function/sum.rb +7 -1
- data/lib/plurimath/math/function/sup.rb +6 -0
- data/lib/plurimath/math/function/table/align.rb +6 -0
- data/lib/plurimath/math/function/table/array.rb +6 -0
- data/lib/plurimath/math/function/table/bmatrix.rb +6 -0
- data/lib/plurimath/math/function/table/cases.rb +6 -0
- data/lib/plurimath/math/function/table/eqarray.rb +6 -0
- data/lib/plurimath/math/function/table/matrix.rb +6 -0
- data/lib/plurimath/math/function/table/multline.rb +6 -0
- data/lib/plurimath/math/function/table/pmatrix.rb +6 -0
- data/lib/plurimath/math/function/table/split.rb +6 -0
- data/lib/plurimath/math/function/table/vmatrix.rb +6 -0
- data/lib/plurimath/math/function/table.rb +10 -0
- data/lib/plurimath/math/function/tan.rb +6 -0
- data/lib/plurimath/math/function/tanh.rb +6 -0
- data/lib/plurimath/math/function/ternary_function.rb +4 -0
- data/lib/plurimath/math/function/text.rb +6 -0
- data/lib/plurimath/math/function/tilde.rb +6 -0
- data/lib/plurimath/math/function/ubrace.rb +6 -0
- data/lib/plurimath/math/function/ul.rb +6 -0
- data/lib/plurimath/math/function/unary_function.rb +4 -0
- data/lib/plurimath/math/function/uncertainty.rb +655 -0
- data/lib/plurimath/math/function/underover.rb +6 -0
- data/lib/plurimath/math/function/underset.rb +6 -0
- data/lib/plurimath/math/function/vec.rb +6 -0
- data/lib/plurimath/math/function.rb +1 -0
- data/lib/plurimath/math/renderer.rb +95 -0
- data/lib/plurimath/math/semantic_tree.rb +331 -0
- data/lib/plurimath/math/symbols/symbol.rb +12 -5
- data/lib/plurimath/math.rb +26 -0
- data/lib/plurimath/mathml/translator.rb +32 -0
- data/lib/plurimath/mathml/uncertainty_marker.rb +118 -0
- data/lib/plurimath/omml/translator.rb +68 -0
- data/lib/plurimath/omml/utility.rb +9 -1
- data/lib/plurimath/symbol_documentation.rb +57 -0
- data/lib/plurimath/unicode_math/parsing_rules/common_rules.rb +2 -1
- data/lib/plurimath/unicode_math/parsing_rules/masked.rb +3 -0
- data/lib/plurimath/unicode_math/transform.rb +64 -3
- data/lib/plurimath/unicode_math/utility.rb +38 -0
- data/lib/plurimath/version.rb +1 -1
- data/lib/plurimath.rb +3 -0
- data/plurimath.gemspec +3 -1
- data/scripts/replay_asciimath_corpus.rb +611 -0
- metadata +30 -4
|
@@ -4,7 +4,11 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Oint < TernaryFunction
|
|
7
|
-
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "The contour integral of a function along a closed path."
|
|
9
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Contour_integration"
|
|
10
|
+
EXAMPLE = -> { new(sym("x"), sym("y"), sym("z")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
8
12
|
|
|
9
13
|
FUNCTION = {
|
|
10
14
|
name: "contour integral",
|
|
@@ -12,6 +16,8 @@ module Plurimath
|
|
|
12
16
|
second_value: "supscript",
|
|
13
17
|
}.freeze
|
|
14
18
|
|
|
19
|
+
attr_accessor :options
|
|
20
|
+
|
|
15
21
|
def initialize(parameter_one = nil,
|
|
16
22
|
parameter_two = nil,
|
|
17
23
|
parameter_three = nil,
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Over < BinaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "A fraction formed with the LaTeX \\over primitive."
|
|
9
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Fraction"
|
|
10
|
+
EXAMPLE = -> { new(sym("x"), sym("y")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
FUNCTION = {
|
|
8
14
|
name: "over",
|
|
9
15
|
first_value: "numerator",
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Overleftrightarrow < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "A left-right arrow accent over an expression."
|
|
9
|
+
REFERENCE = "https://developer.mozilla.org/en-US/docs/Web/MathML/Reference/Element/mover"
|
|
10
|
+
EXAMPLE = -> { new(sym("x")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
attr_accessor :attributes
|
|
8
14
|
|
|
9
15
|
def initialize(parameter_one = nil, attributes = {})
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Overset < BinaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "An expression set as an overscript above a base."
|
|
9
|
+
REFERENCE = "https://developer.mozilla.org/en-US/docs/Web/MathML/Reference/Element/mover"
|
|
10
|
+
EXAMPLE = -> { new(sym("x"), sym("y")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
attr_accessor :options
|
|
8
14
|
|
|
9
15
|
FUNCTION = {
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Phantom < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "Reserves the space of its argument without rendering it."
|
|
9
|
+
REFERENCE = "https://developer.mozilla.org/en-US/docs/Web/MathML/Reference/Element/mphantom"
|
|
10
|
+
EXAMPLE = -> { new(sym("x")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
def to_asciimath(options:)
|
|
8
14
|
Array.new(asciimath_value(options: options)&.length, '\ ').join.to_s
|
|
9
15
|
end
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Power < BinaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "A base raised to an exponent."
|
|
9
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Exponentiation"
|
|
10
|
+
EXAMPLE = -> { new(sym("x"), sym("y")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
FUNCTION = {
|
|
8
14
|
name: "superscript",
|
|
9
15
|
first_value: "base",
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class PowerBase < TernaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "A base bearing both a subscript and a superscript."
|
|
9
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Subscript_and_superscript"
|
|
10
|
+
EXAMPLE = -> { new(sym("x"), sym("y"), sym("z")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
FUNCTION = {
|
|
8
14
|
name: "subsup",
|
|
9
15
|
first_value: "base",
|
|
@@ -4,7 +4,11 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Prod < TernaryFunction
|
|
7
|
-
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "The product of a sequence of terms over an index range."
|
|
9
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Product_(mathematics)"
|
|
10
|
+
EXAMPLE = -> { new(sym("x"), sym("y"), sym("z")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
8
12
|
|
|
9
13
|
FUNCTION = {
|
|
10
14
|
name: "prod",
|
|
@@ -12,6 +16,8 @@ module Plurimath
|
|
|
12
16
|
second_value: "supscript",
|
|
13
17
|
}.freeze
|
|
14
18
|
|
|
19
|
+
attr_accessor :options
|
|
20
|
+
|
|
15
21
|
def evaluate(evaluator)
|
|
16
22
|
if parameter_one.nil? || parameter_two.nil? || parameter_three.nil?
|
|
17
23
|
evaluator.unsupported(self)
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Root < BinaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "A root of a radicand with an explicit index (degree)."
|
|
9
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Nth_root"
|
|
10
|
+
EXAMPLE = -> { new(sym("x"), sym("y")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
FUNCTION = {
|
|
8
14
|
name: "root",
|
|
9
15
|
first_value: "radicand",
|
|
@@ -4,6 +4,26 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Rule < TernaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "A typographic rule — a filled rectangle used for spacing or lines, as in LaTeX's rule."
|
|
9
|
+
REFERENCE = "https://latexref.xyz/_005crule.html"
|
|
10
|
+
EXAMPLE = -> { new(sym("5pt"), sym("5pt"), sym("5pt")) }
|
|
11
|
+
CATALOG_FORMAT_LIMITATIONS = {
|
|
12
|
+
asciimath: {
|
|
13
|
+
status: :unavailable,
|
|
14
|
+
notes: ["No AsciiMath representation is emitted."],
|
|
15
|
+
},
|
|
16
|
+
mathml: {
|
|
17
|
+
status: :unavailable,
|
|
18
|
+
notes: ["Only an empty MathML placeholder is emitted; the rule geometry is omitted."],
|
|
19
|
+
},
|
|
20
|
+
omml: {
|
|
21
|
+
status: :unavailable,
|
|
22
|
+
notes: ["Only an empty OMML placeholder is emitted; the rule geometry is omitted."],
|
|
23
|
+
},
|
|
24
|
+
}.freeze
|
|
25
|
+
# --- end catalog documentation ---
|
|
26
|
+
|
|
7
27
|
FUNCTION = {
|
|
8
28
|
name: "rule",
|
|
9
29
|
first_value: "first argument",
|
|
@@ -4,6 +4,26 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Scarries < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "Marks carries or borrows over a row in elementary arithmetic layout."
|
|
9
|
+
REFERENCE = "https://www.w3.org/TR/mathml4/#presm_mscarries"
|
|
10
|
+
EXAMPLE = -> { new(sym("x")) }
|
|
11
|
+
CATALOG_FORMAT_LIMITATIONS = {
|
|
12
|
+
asciimath: {
|
|
13
|
+
status: :limited,
|
|
14
|
+
notes: ["Carry positioning is omitted; only the carried expression is emitted."],
|
|
15
|
+
},
|
|
16
|
+
latexmath: {
|
|
17
|
+
status: :limited,
|
|
18
|
+
notes: ["Carry positioning is omitted; only the carried expression is emitted."],
|
|
19
|
+
},
|
|
20
|
+
omml: {
|
|
21
|
+
status: :limited,
|
|
22
|
+
notes: ["Carry positioning is omitted; only the carried expression is emitted."],
|
|
23
|
+
},
|
|
24
|
+
}.freeze
|
|
25
|
+
# --- end catalog documentation ---
|
|
26
|
+
|
|
7
27
|
def to_asciimath(options:)
|
|
8
28
|
asciimath_value(options: options)
|
|
9
29
|
end
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Sec < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "The secant function."
|
|
9
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Trigonometric_functions"
|
|
10
|
+
EXAMPLE = -> { new(sym("x")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
def validate_function_formula
|
|
8
14
|
false
|
|
9
15
|
end
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Sech < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "The hyperbolic secant function."
|
|
9
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Hyperbolic_functions"
|
|
10
|
+
EXAMPLE = -> { new(sym("x")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
def validate_function_formula
|
|
8
14
|
false
|
|
9
15
|
end
|
|
@@ -4,6 +4,26 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Semantics < BinaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "A presentation expression paired with its semantic annotations."
|
|
9
|
+
REFERENCE = "https://developer.mozilla.org/en-US/docs/Web/MathML/Reference/Element/semantics"
|
|
10
|
+
EXAMPLE = -> { new(sym("x"), [{ "annotation-xml": [sym("x")] }]) }
|
|
11
|
+
CATALOG_FORMAT_LIMITATIONS = {
|
|
12
|
+
asciimath: {
|
|
13
|
+
status: :limited,
|
|
14
|
+
notes: ["Semantic annotations are omitted; only the presentation expression is emitted."],
|
|
15
|
+
},
|
|
16
|
+
latexmath: {
|
|
17
|
+
status: :limited,
|
|
18
|
+
notes: ["Semantic annotations are omitted; only the presentation expression is emitted."],
|
|
19
|
+
},
|
|
20
|
+
omml: {
|
|
21
|
+
status: :limited,
|
|
22
|
+
notes: ["Semantic annotations are omitted; only the presentation expression is emitted."],
|
|
23
|
+
},
|
|
24
|
+
}.freeze
|
|
25
|
+
# --- end catalog documentation ---
|
|
26
|
+
|
|
7
27
|
FUNCTION = {
|
|
8
28
|
name: "semantics",
|
|
9
29
|
first_value: "first argument",
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Sin < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "The sine function."
|
|
9
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Sine_and_cosine"
|
|
10
|
+
EXAMPLE = -> { new(sym("x")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
def validate_function_formula
|
|
8
14
|
false
|
|
9
15
|
end
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Sinh < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "The hyperbolic sine function."
|
|
9
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Hyperbolic_functions"
|
|
10
|
+
EXAMPLE = -> { new(sym("x")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
def validate_function_formula
|
|
8
14
|
false
|
|
9
15
|
end
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Sqrt < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "The square root of a radicand."
|
|
9
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Square_root"
|
|
10
|
+
EXAMPLE = -> { new(sym("x")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
attr_accessor :options
|
|
8
14
|
|
|
9
15
|
def to_mathml_without_math_tag(intent, options:)
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Stackrel < BinaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "An expression stacked above another, typically over a relation."
|
|
9
|
+
REFERENCE = "https://developer.mozilla.org/en-US/docs/Web/MathML/Reference/Element/mover"
|
|
10
|
+
EXAMPLE = -> { new(sym("x"), sym("y")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
FUNCTION = {
|
|
8
14
|
name: "stackrel",
|
|
9
15
|
first_value: "above",
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Substack < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "Stacks multiple lines within a subscript or superscript, as under a summation."
|
|
9
|
+
REFERENCE = "https://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics"
|
|
10
|
+
EXAMPLE = -> { new([Tr.new([Td.new([sym("x")])])]) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
FUNCTION = {
|
|
8
14
|
name: "substack",
|
|
9
15
|
first_value: "above",
|
|
@@ -4,7 +4,11 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Sum < TernaryFunction
|
|
7
|
-
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "The summation of a sequence of terms over an index range."
|
|
9
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Summation"
|
|
10
|
+
EXAMPLE = -> { new(sym("x"), sym("y"), sym("z")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
8
12
|
|
|
9
13
|
FUNCTION = {
|
|
10
14
|
name: "summation",
|
|
@@ -13,6 +17,8 @@ module Plurimath
|
|
|
13
17
|
third_value: "term",
|
|
14
18
|
}.freeze
|
|
15
19
|
|
|
20
|
+
attr_accessor :options
|
|
21
|
+
|
|
16
22
|
def evaluate(evaluator)
|
|
17
23
|
if parameter_one.nil? || parameter_two.nil? || parameter_three.nil?
|
|
18
24
|
evaluator.unsupported(self)
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Sup < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "The supremum (least upper bound) of a set."
|
|
9
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Infimum_and_supremum"
|
|
10
|
+
EXAMPLE = -> { new(sym("x")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
def to_mathml_without_math_tag(intent, options:)
|
|
8
14
|
mo_tag = ox_element("mo") << "sup"
|
|
9
15
|
first_value = mathml_value(intent, options: options)
|
|
@@ -5,6 +5,12 @@ module Plurimath
|
|
|
5
5
|
module Function
|
|
6
6
|
class Table
|
|
7
7
|
class Align < Table
|
|
8
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
9
|
+
DESCRIPTION = "Aligns a sequence of equations at designated alignment points, one equation per row."
|
|
10
|
+
REFERENCE = "https://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics"
|
|
11
|
+
EXAMPLE = -> { new([Tr.new([Td.new([sym("x")])])], nil, nil) }
|
|
12
|
+
# --- end catalog documentation ---
|
|
13
|
+
|
|
8
14
|
def initialize(value,
|
|
9
15
|
open_paren = "[",
|
|
10
16
|
close_paren = "]",
|
|
@@ -5,6 +5,12 @@ module Plurimath
|
|
|
5
5
|
module Function
|
|
6
6
|
class Table
|
|
7
7
|
class Array < Table
|
|
8
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
9
|
+
DESCRIPTION = "Lays out entries in a matrix-like grid with per-column alignment."
|
|
10
|
+
REFERENCE = "https://en.wikibooks.org/wiki/LaTeX/Mathematics"
|
|
11
|
+
EXAMPLE = -> { new([Tr.new([Td.new([sym("x")], { columnalign: "center" })])], nil, nil) }
|
|
12
|
+
# --- end catalog documentation ---
|
|
13
|
+
|
|
8
14
|
def initialize(value = [],
|
|
9
15
|
open_paren = "[",
|
|
10
16
|
close_paren = "]",
|
|
@@ -5,6 +5,12 @@ module Plurimath
|
|
|
5
5
|
module Function
|
|
6
6
|
class Table
|
|
7
7
|
class Bmatrix < Table
|
|
8
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
9
|
+
DESCRIPTION = "A matrix enclosed in square brackets (curly braces in its capitalized Bmatrix form)."
|
|
10
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Matrix_(mathematics)"
|
|
11
|
+
EXAMPLE = -> { new([Tr.new([Td.new([sym("x")])])]) }
|
|
12
|
+
# --- end catalog documentation ---
|
|
13
|
+
|
|
8
14
|
def initialize(value,
|
|
9
15
|
open_paren = "[",
|
|
10
16
|
close_paren = "]",
|
|
@@ -5,6 +5,12 @@ module Plurimath
|
|
|
5
5
|
module Function
|
|
6
6
|
class Table
|
|
7
7
|
class Cases < Table
|
|
8
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
9
|
+
DESCRIPTION = "Selects among alternative expressions by condition, as in a piecewise definition."
|
|
10
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Piecewise_function"
|
|
11
|
+
EXAMPLE = -> { new([Tr.new([Td.new([sym("x")])])]) }
|
|
12
|
+
# --- end catalog documentation ---
|
|
13
|
+
|
|
8
14
|
def initialize(value = [],
|
|
9
15
|
open_paren = "{",
|
|
10
16
|
close_paren = ":}",
|
|
@@ -5,6 +5,12 @@ module Plurimath
|
|
|
5
5
|
module Function
|
|
6
6
|
class Table
|
|
7
7
|
class Eqarray < Table
|
|
8
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
9
|
+
DESCRIPTION = "Aligns an array of equations across multiple columns."
|
|
10
|
+
REFERENCE = "https://www.unicode.org/notes/tn28/UTN28-PlainTextMath-v3.2.pdf"
|
|
11
|
+
EXAMPLE = -> { new([Tr.new([Td.new([sym("x")])])], nil, nil) }
|
|
12
|
+
# --- end catalog documentation ---
|
|
13
|
+
|
|
8
14
|
def initialize(value = [],
|
|
9
15
|
open_paren = "",
|
|
10
16
|
close_paren = "",
|
|
@@ -5,6 +5,12 @@ module Plurimath
|
|
|
5
5
|
module Function
|
|
6
6
|
class Table
|
|
7
7
|
class Matrix < Table
|
|
8
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
9
|
+
DESCRIPTION = "A matrix of rows and columns without enclosing delimiters."
|
|
10
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Matrix_(mathematics)"
|
|
11
|
+
EXAMPLE = -> { new([Tr.new([Td.new([sym("x")])])], nil, nil) }
|
|
12
|
+
# --- end catalog documentation ---
|
|
13
|
+
|
|
8
14
|
def initialize(value = [],
|
|
9
15
|
open_paren = "(",
|
|
10
16
|
close_paren = ")",
|
|
@@ -5,6 +5,12 @@ module Plurimath
|
|
|
5
5
|
module Function
|
|
6
6
|
class Table
|
|
7
7
|
class Multline < Table
|
|
8
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
9
|
+
DESCRIPTION = "Splits a single long equation across several lines."
|
|
10
|
+
REFERENCE = "https://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics"
|
|
11
|
+
EXAMPLE = -> { new([Tr.new([Td.new([sym("x")])])], nil, nil) }
|
|
12
|
+
# --- end catalog documentation ---
|
|
13
|
+
|
|
8
14
|
def initialize(value,
|
|
9
15
|
open_paren = "[",
|
|
10
16
|
close_paren = "]",
|
|
@@ -5,6 +5,12 @@ module Plurimath
|
|
|
5
5
|
module Function
|
|
6
6
|
class Table
|
|
7
7
|
class Pmatrix < Table
|
|
8
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
9
|
+
DESCRIPTION = "A matrix enclosed in parentheses."
|
|
10
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Matrix_(mathematics)"
|
|
11
|
+
EXAMPLE = -> { new([Tr.new([Td.new([sym("x")])])]) }
|
|
12
|
+
# --- end catalog documentation ---
|
|
13
|
+
|
|
8
14
|
def initialize(value,
|
|
9
15
|
open_paren = "(",
|
|
10
16
|
close_paren = ")",
|
|
@@ -5,6 +5,12 @@ module Plurimath
|
|
|
5
5
|
module Function
|
|
6
6
|
class Table
|
|
7
7
|
class Split < Table
|
|
8
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
9
|
+
DESCRIPTION = "Splits a single equation across aligned lines within another display."
|
|
10
|
+
REFERENCE = "https://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics"
|
|
11
|
+
EXAMPLE = -> { new([Tr.new([Td.new([sym("x")])])], nil, nil) }
|
|
12
|
+
# --- end catalog documentation ---
|
|
13
|
+
|
|
8
14
|
def initialize(value,
|
|
9
15
|
open_paren = "[",
|
|
10
16
|
close_paren = "]",
|
|
@@ -5,6 +5,12 @@ module Plurimath
|
|
|
5
5
|
module Function
|
|
6
6
|
class Table
|
|
7
7
|
class Vmatrix < Table
|
|
8
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
9
|
+
DESCRIPTION = "A matrix enclosed in single vertical bars, denoting a determinant; its capitalized Vmatrix form uses double bars for a norm."
|
|
10
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Determinant"
|
|
11
|
+
EXAMPLE = -> { new([Tr.new([Td.new([sym("x")])])]) }
|
|
12
|
+
# --- end catalog documentation ---
|
|
13
|
+
|
|
8
14
|
def initialize(value,
|
|
9
15
|
open_paren = "|",
|
|
10
16
|
close_paren = "|",
|
|
@@ -4,6 +4,8 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Table < Core
|
|
7
|
+
extend Documentation
|
|
8
|
+
|
|
7
9
|
autoload :Align, "#{__dir__}/table/align"
|
|
8
10
|
autoload :Array, "#{__dir__}/table/array"
|
|
9
11
|
autoload :Bmatrix, "#{__dir__}/table/bmatrix"
|
|
@@ -15,6 +17,14 @@ module Plurimath
|
|
|
15
17
|
autoload :Split, "#{__dir__}/table/split"
|
|
16
18
|
autoload :Vmatrix, "#{__dir__}/table/vmatrix"
|
|
17
19
|
|
|
20
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
21
|
+
# Declared once on the base and inherited by every matrix subclass.
|
|
22
|
+
CATALOG_TYPE = :unary
|
|
23
|
+
DESCRIPTION = "Arranges rows and cells into a two-dimensional table or matrix."
|
|
24
|
+
REFERENCE = "https://developer.mozilla.org/en-US/docs/Web/MathML/Reference/Element/mtable"
|
|
25
|
+
EXAMPLE = -> { new([Tr.new([Td.new([sym("x")])])]) }
|
|
26
|
+
# --- end catalog documentation ---
|
|
27
|
+
|
|
18
28
|
attr_accessor :value, :open_paren, :close_paren, :options
|
|
19
29
|
|
|
20
30
|
SIMPLE_TABLES = %w[array align split].freeze
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Tan < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "The tangent function."
|
|
9
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Trigonometric_functions"
|
|
10
|
+
EXAMPLE = -> { new(sym("x")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
def validate_function_formula
|
|
8
14
|
false
|
|
9
15
|
end
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Tanh < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "The hyperbolic tangent function."
|
|
9
|
+
REFERENCE = "https://en.wikipedia.org/wiki/Hyperbolic_functions"
|
|
10
|
+
EXAMPLE = -> { new(sym("x")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
def validate_function_formula
|
|
8
14
|
false
|
|
9
15
|
end
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Text < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "Typesets its argument as literal text."
|
|
9
|
+
REFERENCE = "https://developer.mozilla.org/en-US/docs/Web/MathML/Reference/Element/mtext"
|
|
10
|
+
EXAMPLE = -> { new("x") }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
PARSER_REGEX = %r{unicode\[:(?<unicode>\w{1,})\]}
|
|
8
14
|
|
|
9
15
|
def initialize(parameter_one = "", lang: nil)
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Tilde < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "A tilde accent over an expression."
|
|
9
|
+
REFERENCE = "https://developer.mozilla.org/en-US/docs/Web/MathML/Reference/Element/mover"
|
|
10
|
+
EXAMPLE = -> { new(sym("x")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
attr_accessor :attributes
|
|
8
14
|
|
|
9
15
|
def initialize(parameter_one = nil, attributes = {})
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Ubrace < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "An underbrace spanning an expression."
|
|
9
|
+
REFERENCE = "https://developer.mozilla.org/en-US/docs/Web/MathML/Reference/Element/munder"
|
|
10
|
+
EXAMPLE = -> { new(sym("x")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
attr_accessor :attributes
|
|
8
14
|
|
|
9
15
|
def initialize(parameter_one = nil, attributes = {})
|
|
@@ -4,6 +4,12 @@ module Plurimath
|
|
|
4
4
|
module Math
|
|
5
5
|
module Function
|
|
6
6
|
class Ul < UnaryFunction
|
|
7
|
+
# --- Catalog documentation (see Plurimath::Documentation) ---
|
|
8
|
+
DESCRIPTION = "An underline beneath an expression."
|
|
9
|
+
REFERENCE = "https://developer.mozilla.org/en-US/docs/Web/MathML/Reference/Element/munder"
|
|
10
|
+
EXAMPLE = -> { new(sym("x")) }
|
|
11
|
+
# --- end catalog documentation ---
|
|
12
|
+
|
|
7
13
|
attr_accessor :attributes
|
|
8
14
|
|
|
9
15
|
def initialize(parameter_one = nil, attributes = {})
|