Sha256: d6feff7a3271c743e3f2cdce4034b7abb8b78207b7824f17480f663543116bab

Contents?: true

Size: 1.33 KB

Versions: 15

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true

require_relative "binary_function"

module Plurimath
  module Math
    module Function
      class Root < BinaryFunction
        def to_mathml_without_math_tag
          first_value = parameter_one&.to_mathml_without_math_tag
          second_value = parameter_two&.to_mathml_without_math_tag
          Utility.update_nodes(
            Utility.ox_element("mroot"),
            [
              second_value,
              first_value,
            ],
          )
        end

        def to_latex
          first_value = parameter_one&.to_latex
          second_value = parameter_two&.to_latex
          "\\sqrt[#{first_value}]{#{second_value}}"
        end

        def to_omml_without_math_tag
          rad_element = Utility.ox_element("rad", namespace: "m")
          pr_element  = Utility.ox_element("radPr", namespace: "m")
          deg_element = Utility.ox_element("deg", namespace: "m")
          e_element   = Utility.ox_element("e", namespace: "m")
          Utility.update_nodes(
            rad_element,
            [
              pr_element  << Utility.pr_element("ctrl", true, namespace: "m"),
              deg_element << parameter_two.to_omml_without_math_tag,
              e_element   << parameter_one.to_omml_without_math_tag,
            ],
          )
          rad_element
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
plurimath-0.3.5 lib/plurimath/math/function/root.rb
plurimath-0.3.4 lib/plurimath/math/function/root.rb
plurimath-0.3.3 lib/plurimath/math/function/root.rb
plurimath-0.3.2 lib/plurimath/math/function/root.rb
plurimath-0.3.1.2 lib/plurimath/math/function/root.rb
plurimath-0.3.1 lib/plurimath/math/function/root.rb
plurimath-0.3.0 lib/plurimath/math/function/root.rb
plurimath-0.2.9 lib/plurimath/math/function/root.rb
plurimath-0.2.8 lib/plurimath/math/function/root.rb
plurimath-0.2.7 lib/plurimath/math/function/root.rb
plurimath-0.2.6 lib/plurimath/math/function/root.rb
plurimath-0.2.5 lib/plurimath/math/function/root.rb
plurimath-0.2.4 lib/plurimath/math/function/root.rb
plurimath-0.2.3 lib/plurimath/math/function/root.rb
plurimath-0.2.2 lib/plurimath/math/function/root.rb