Sha256: 042780a9d61aa21c679a7bf1a4af9ef6915ed5681ef2d2b119775be9f9cc2c5a

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 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")
          Utility.update_nodes(
            rad_element,
            [
              (pr_element << Utility.pr_element("ctrl", true, namespace: "m")),
              omml_parameter(parameter_two, tag_name: "deg"),
              omml_parameter(parameter_one, tag_name: "e"),
            ],
          )
          [rad_element]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plurimath-0.3.9 lib/plurimath/math/function/root.rb
plurimath-0.3.8 lib/plurimath/math/function/root.rb