plurimath 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +33 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +2 -0
- data/AsciiMath-Supported-Data.adoc +280 -0
- data/Gemfile +1 -0
- data/Latex-Supported-Data.adoc +1872 -0
- data/MathML-Supported-Data.adoc +270 -0
- data/README.adoc +94 -0
- data/lib/plurimath/asciimath/constants.rb +301 -0
- data/lib/plurimath/asciimath/parse.rb +121 -0
- data/lib/plurimath/asciimath/parser.rb +25 -0
- data/lib/plurimath/asciimath/transform.rb +395 -0
- data/lib/plurimath/asciimath.rb +16 -0
- data/lib/plurimath/html/constants.rb +50 -0
- data/lib/plurimath/html/parse.rb +149 -0
- data/lib/plurimath/html/parser.rb +26 -0
- data/lib/plurimath/html/transform.rb +363 -0
- data/lib/plurimath/html.rb +15 -0
- data/lib/plurimath/latex/constants.rb +1990 -0
- data/lib/plurimath/latex/parse.rb +198 -0
- data/lib/plurimath/latex/parser.rb +25 -0
- data/lib/plurimath/latex/transform.rb +458 -0
- data/lib/plurimath/latex.rb +15 -0
- data/lib/plurimath/math/formula.rb +51 -0
- data/lib/plurimath/math/function/abs.rb +12 -0
- data/lib/plurimath/math/function/arccos.rb +12 -0
- data/lib/plurimath/math/function/arcsin.rb +12 -0
- data/lib/plurimath/math/function/arctan.rb +12 -0
- data/lib/plurimath/math/function/bar.rb +16 -0
- data/lib/plurimath/math/function/base.rb +36 -0
- data/lib/plurimath/math/function/binary_function.rb +58 -0
- data/lib/plurimath/math/function/cancel.rb +12 -0
- data/lib/plurimath/math/function/ceil.rb +12 -0
- data/lib/plurimath/math/function/color.rb +23 -0
- data/lib/plurimath/math/function/cos.rb +12 -0
- data/lib/plurimath/math/function/cosh.rb +12 -0
- data/lib/plurimath/math/function/cot.rb +12 -0
- data/lib/plurimath/math/function/coth.rb +12 -0
- data/lib/plurimath/math/function/csc.rb +12 -0
- data/lib/plurimath/math/function/csch.rb +12 -0
- data/lib/plurimath/math/function/ddot.rb +12 -0
- data/lib/plurimath/math/function/deg.rb +12 -0
- data/lib/plurimath/math/function/det.rb +12 -0
- data/lib/plurimath/math/function/dim.rb +12 -0
- data/lib/plurimath/math/function/dot.rb +12 -0
- data/lib/plurimath/math/function/exp.rb +12 -0
- data/lib/plurimath/math/function/f.rb +12 -0
- data/lib/plurimath/math/function/fenced.rb +27 -0
- data/lib/plurimath/math/function/floor.rb +12 -0
- data/lib/plurimath/math/function/font_style/bold.rb +18 -0
- data/lib/plurimath/math/function/font_style/double_struck.rb +18 -0
- data/lib/plurimath/math/function/font_style/fraktur.rb +18 -0
- data/lib/plurimath/math/function/font_style/monospace.rb +18 -0
- data/lib/plurimath/math/function/font_style/sans-serif.rb +18 -0
- data/lib/plurimath/math/function/font_style/script.rb +18 -0
- data/lib/plurimath/math/function/font_style.rb +25 -0
- data/lib/plurimath/math/function/frac.rb +23 -0
- data/lib/plurimath/math/function/g.rb +12 -0
- data/lib/plurimath/math/function/gcd.rb +12 -0
- data/lib/plurimath/math/function/glb.rb +12 -0
- data/lib/plurimath/math/function/hat.rb +12 -0
- data/lib/plurimath/math/function/hom.rb +12 -0
- data/lib/plurimath/math/function/inf.rb +17 -0
- data/lib/plurimath/math/function/int.rb +17 -0
- data/lib/plurimath/math/function/ker.rb +12 -0
- data/lib/plurimath/math/function/lcm.rb +12 -0
- data/lib/plurimath/math/function/left.rb +20 -0
- data/lib/plurimath/math/function/lg.rb +12 -0
- data/lib/plurimath/math/function/lim.rb +23 -0
- data/lib/plurimath/math/function/liminf.rb +12 -0
- data/lib/plurimath/math/function/limits.rb +18 -0
- data/lib/plurimath/math/function/limsup.rb +12 -0
- data/lib/plurimath/math/function/ln.rb +12 -0
- data/lib/plurimath/math/function/log.rb +29 -0
- data/lib/plurimath/math/function/lub.rb +12 -0
- data/lib/plurimath/math/function/max.rb +12 -0
- data/lib/plurimath/math/function/min.rb +12 -0
- data/lib/plurimath/math/function/mod.rb +29 -0
- data/lib/plurimath/math/function/multiscript.rb +11 -0
- data/lib/plurimath/math/function/norm.rb +16 -0
- data/lib/plurimath/math/function/obrace.rb +12 -0
- data/lib/plurimath/math/function/oint.rb +17 -0
- data/lib/plurimath/math/function/over.rb +29 -0
- data/lib/plurimath/math/function/overset.rb +23 -0
- data/lib/plurimath/math/function/power.rb +36 -0
- data/lib/plurimath/math/function/power_base.rb +33 -0
- data/lib/plurimath/math/function/prod.rb +29 -0
- data/lib/plurimath/math/function/right.rb +24 -0
- data/lib/plurimath/math/function/root.rb +23 -0
- data/lib/plurimath/math/function/sec.rb +12 -0
- data/lib/plurimath/math/function/sech.rb +12 -0
- data/lib/plurimath/math/function/sin.rb +12 -0
- data/lib/plurimath/math/function/sinh.rb +12 -0
- data/lib/plurimath/math/function/sqrt.rb +16 -0
- data/lib/plurimath/math/function/stackrel.rb +12 -0
- data/lib/plurimath/math/function/substack.rb +17 -0
- data/lib/plurimath/math/function/sum.rb +29 -0
- data/lib/plurimath/math/function/sup.rb +12 -0
- data/lib/plurimath/math/function/table/align.rb +24 -0
- data/lib/plurimath/math/function/table/array.rb +25 -0
- data/lib/plurimath/math/function/table/bmatrix.rb +26 -0
- data/lib/plurimath/math/function/table/matrix.rb +24 -0
- data/lib/plurimath/math/function/table/multline.rb +24 -0
- data/lib/plurimath/math/function/table/pmatrix.rb +24 -0
- data/lib/plurimath/math/function/table/split.rb +24 -0
- data/lib/plurimath/math/function/table/vmatrix.rb +25 -0
- data/lib/plurimath/math/function/table.rb +54 -0
- data/lib/plurimath/math/function/tan.rb +12 -0
- data/lib/plurimath/math/function/tanh.rb +12 -0
- data/lib/plurimath/math/function/td.rb +32 -0
- data/lib/plurimath/math/function/ternary_function.rb +52 -0
- data/lib/plurimath/math/function/text.rb +44 -0
- data/lib/plurimath/math/function/tilde.rb +12 -0
- data/lib/plurimath/math/function/tr.rb +30 -0
- data/lib/plurimath/math/function/ubrace.rb +12 -0
- data/lib/plurimath/math/function/ul.rb +12 -0
- data/lib/plurimath/math/function/unary_function.rb +46 -0
- data/lib/plurimath/math/function/underover.rb +12 -0
- data/lib/plurimath/math/function/underset.rb +12 -0
- data/lib/plurimath/math/function/vec.rb +16 -0
- data/lib/plurimath/math/function.rb +14 -0
- data/lib/plurimath/math/number.rb +37 -0
- data/lib/plurimath/math/symbol.rb +43 -0
- data/lib/plurimath/math.rb +56 -0
- data/lib/plurimath/mathml/constants.rb +295 -0
- data/lib/plurimath/mathml/parse.rb +68 -0
- data/lib/plurimath/mathml/parser.rb +26 -0
- data/lib/plurimath/mathml/transform.rb +200 -0
- data/lib/plurimath/mathml.rb +16 -0
- data/lib/plurimath/omml/constants.rb +154 -0
- data/lib/plurimath/omml/parser.rb +22 -0
- data/lib/plurimath/omml/transform.rb +216 -0
- data/lib/plurimath/omml.rb +15 -0
- data/lib/plurimath/unicode.rb +15 -0
- data/lib/plurimath/unitsml.rb +15 -0
- data/lib/plurimath/utility.rb +73 -0
- data/lib/plurimath/version.rb +3 -1
- data/lib/plurimath.rb +3 -5
- data/plurimath.gemspec +4 -3
- metadata +169 -9
- data/README.md +0 -40
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "binary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Inf < BinaryFunction
|
9
|
+
def to_latex
|
10
|
+
first_value = "_{#{parameter_one.to_latex}}" if parameter_one
|
11
|
+
second_value = "^{#{parameter_two.to_latex}}" if parameter_two
|
12
|
+
"\\#{class_name}#{first_value}#{second_value}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "binary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Int < BinaryFunction
|
9
|
+
def to_asciimath
|
10
|
+
first_value = "_(#{parameter_one.to_asciimath})" if parameter_one
|
11
|
+
second_value = "^(#{parameter_two.to_asciimath})" if parameter_two
|
12
|
+
"int#{first_value}#{second_value}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "unary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Left < UnaryFunction
|
9
|
+
def to_asciimath
|
10
|
+
"left#{parameter_one}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_latex
|
14
|
+
prefix = "\\" if parameter_one == "{"
|
15
|
+
"\\left#{prefix}#{parameter_one}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "binary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Lim < BinaryFunction
|
9
|
+
def to_asciimath
|
10
|
+
first_value = "_(#{parameter_one.to_asciimath})" if parameter_one
|
11
|
+
second_value = "^(#{parameter_two.to_asciimath})" if parameter_two
|
12
|
+
"lim#{first_value}#{second_value}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_latex
|
16
|
+
first_value = "_{#{parameter_one.to_latex}}" if parameter_one
|
17
|
+
second_value = "^{#{parameter_two.to_latex}}" if parameter_two
|
18
|
+
"\\#{class_name}#{first_value}#{second_value}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "ternary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Limits < TernaryFunction
|
9
|
+
def to_latex
|
10
|
+
first_value = parameter_one&.to_latex
|
11
|
+
second_value = "{#{parameter_two.to_latex}}" if parameter_two
|
12
|
+
third_value = "{#{parameter_three.to_latex}}" if parameter_three
|
13
|
+
"#{first_value}\\#{class_name}_#{second_value}^#{third_value}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "binary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Log < BinaryFunction
|
9
|
+
def to_asciimath
|
10
|
+
first_value = "_(#{parameter_one.to_asciimath})" if parameter_one
|
11
|
+
second_value = "^(#{parameter_two.to_asciimath})" if parameter_two
|
12
|
+
"log#{first_value}#{second_value}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_latex
|
16
|
+
first_value = "_{#{parameter_one.to_latex}}" if parameter_one
|
17
|
+
second_value = "^{#{parameter_two.to_latex}}" if parameter_two
|
18
|
+
"\\log#{first_value}#{second_value}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_html
|
22
|
+
first_value = "<sub>#{parameter_one.to_html}</sub>" if parameter_one
|
23
|
+
second_value = "<sup>#{parameter_two.to_html}</sup>" if parameter_two
|
24
|
+
"<i>log</i>#{first_value}#{second_value}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "binary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Mod < BinaryFunction
|
9
|
+
def to_asciimath
|
10
|
+
first_value = "(#{parameter_one.to_asciimath})" if parameter_one
|
11
|
+
second_value = "(#{parameter_two.to_asciimath})" if parameter_two
|
12
|
+
"#{first_value}mod#{second_value}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_latex
|
16
|
+
first_value = "{#{parameter_one.to_latex}}" if parameter_one
|
17
|
+
second_value = "{#{parameter_two.to_latex}}" if parameter_two
|
18
|
+
"#{first_value}\\pmod#{second_value}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_html
|
22
|
+
first_value = "<i>#{parameter_one.to_html}</i>" if parameter_one
|
23
|
+
second_value = "<i>#{parameter_two.to_html}</i>" if parameter_two
|
24
|
+
"#{first_value}<i>mod</i>#{second_value}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "unary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Norm < UnaryFunction
|
9
|
+
def to_mathml_without_math_tag
|
10
|
+
first_value = parameter_one&.to_mathml_without_math_tag
|
11
|
+
"<mo>∥</mo>#{first_value}<mo>∥</mo>"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "binary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Oint < BinaryFunction
|
9
|
+
def to_asciimath
|
10
|
+
first_value = "_(#{parameter_one.to_asciimath})" if parameter_one
|
11
|
+
second_value = "^(#{parameter_two.to_asciimath})" if parameter_two
|
12
|
+
"oint#{first_value}#{second_value}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "binary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Over < BinaryFunction
|
9
|
+
def to_asciimath
|
10
|
+
first_value = "(#{parameter_one.to_asciimath})" if parameter_one
|
11
|
+
second_value = "(#{parameter_two.to_asciimath})" if parameter_two
|
12
|
+
"overset#{first_value}#{second_value}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_mathml_without_math_tag
|
16
|
+
first_value = parameter_one&.to_mathml_without_math_tag
|
17
|
+
two_value = parameter_two&.to_mathml_without_math_tag
|
18
|
+
"<mover>#{first_value}#{two_value}</mover>"
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_latex
|
22
|
+
first_value = parameter_one&.to_latex
|
23
|
+
two_value = parameter_two&.to_latex
|
24
|
+
"{#{first_value} \\over #{two_value}}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "binary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Overset < BinaryFunction
|
9
|
+
def to_mathml_without_math_tag
|
10
|
+
first_value = parameter_one&.to_mathml_without_math_tag
|
11
|
+
second_value = parameter_two&.to_mathml_without_math_tag
|
12
|
+
"<mover>#{second_value}#{first_value}</mover>"
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_latex
|
16
|
+
first_value = "{#{parameter_one.to_latex}" if parameter_one
|
17
|
+
second_value = "#{parameter_two.to_latex}}" if parameter_two
|
18
|
+
"#{first_value}\\over#{second_value}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "binary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Power < BinaryFunction
|
9
|
+
def to_asciimath
|
10
|
+
first_value = parameter_one.to_asciimath if parameter_one
|
11
|
+
second_value = "^#{parameter_two.to_asciimath}" if parameter_two
|
12
|
+
"#{first_value}#{second_value}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_mathml_without_math_tag
|
16
|
+
first_value = parameter_one.to_mathml_without_math_tag
|
17
|
+
second_value = parameter_two.to_mathml_without_math_tag
|
18
|
+
"<msup>#{first_value}#{second_value}</msup>"
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_latex
|
22
|
+
first_value = parameter_one.to_latex if parameter_one
|
23
|
+
first_value = "{#{first_value}}" if parameter_one.is_a?(Formula)
|
24
|
+
second_value = parameter_two.to_latex
|
25
|
+
"#{first_value}^{#{second_value}}"
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_html
|
29
|
+
first_value = "<i>#{parameter_one.to_html}</i>" if parameter_one
|
30
|
+
second_value = "<sup>#{parameter_two.to_html}</sup>" if parameter_two
|
31
|
+
"#{first_value}#{second_value}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "ternary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class PowerBase < TernaryFunction
|
9
|
+
def to_mathml_without_math_tag
|
10
|
+
first_value = parameter_one&.to_mathml_without_math_tag
|
11
|
+
second_value = parameter_two&.to_mathml_without_math_tag
|
12
|
+
third_value = parameter_three&.to_mathml_without_math_tag
|
13
|
+
"<msubsup>#{first_value}#{second_value}#{third_value}</msubsup>"
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_latex
|
17
|
+
first_value = parameter_one&.to_latex
|
18
|
+
second_value = parameter_two&.to_latex
|
19
|
+
third_value = parameter_three&.to_latex
|
20
|
+
first_value = "{#{first_value}}" if parameter_one.is_a?(Formula)
|
21
|
+
"#{first_value}_{#{second_value}}^{#{third_value}}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_html
|
25
|
+
first_value = "<i>#{parameter_one.to_html}</i>"
|
26
|
+
second_value = "<sub>#{parameter_two.to_html}</sub>"
|
27
|
+
third_value = "<sup>#{parameter_three.to_html}</sup>"
|
28
|
+
"#{first_value}#{second_value}#{third_value}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "binary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Prod < BinaryFunction
|
9
|
+
def to_asciimath
|
10
|
+
first_value = "_(#{parameter_one.to_asciimath})" if parameter_one
|
11
|
+
second_value = "^(#{parameter_two.to_asciimath})" if parameter_two
|
12
|
+
"prod#{first_value}#{second_value}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_latex
|
16
|
+
first_value = "_{#{parameter_one.to_latex}}" if parameter_one
|
17
|
+
second_value = "^{#{parameter_two.to_latex}}" if parameter_two
|
18
|
+
"\\prod#{first_value}#{second_value}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_html
|
22
|
+
first_value = "<sub>#{parameter_one.to_latex}</sub>" if parameter_one
|
23
|
+
second_value = "<sup>#{parameter_two.to_latex}</sup>" if parameter_two
|
24
|
+
"<i>∏</i>#{first_value}#{second_value}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "unary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Right < UnaryFunction
|
9
|
+
def to_asciimath
|
10
|
+
"right#{parameter_one}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_mathml_without_math_tag
|
14
|
+
"<mi>#{parameter_one}</mi>"
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_latex
|
18
|
+
prefix = "\\" if parameter_one == "}"
|
19
|
+
"\\right#{prefix}#{parameter_one}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "binary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Root < BinaryFunction
|
9
|
+
def to_mathml_without_math_tag
|
10
|
+
first_value = parameter_one&.to_mathml_without_math_tag
|
11
|
+
second_value = parameter_two&.to_mathml_without_math_tag
|
12
|
+
"<mroot>#{first_value}#{second_value}</mroot>"
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_latex
|
16
|
+
first_value = parameter_one&.to_latex
|
17
|
+
second_value = parameter_two&.to_latex
|
18
|
+
"\\sqrt[#{first_value}]{#{second_value}}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "unary_function"
|
4
|
+
|
5
|
+
module Plurimath
|
6
|
+
module Math
|
7
|
+
module Function
|
8
|
+
class Sqrt < UnaryFunction
|
9
|
+
def to_mathml_without_math_tag
|
10
|
+
first_value = parameter_one&.to_mathml_without_math_tag
|
11
|
+
"<msqrt>#{first_value}</msqrt>"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|