module Algebra::AlgebraicEquation
Public Class Methods
minimal_polynomial(e, *fs)
click to toggle source
# File lib/algebra/algebraic-equation.rb, line 28 def minimal_polynomial(e, *fs) raise 'too many polys' if fs.size > 'x'.ord - 'a'.ord # ("a"..."x").size require 'algebra/groebner-basis' (mpring = e.class).vars('x') x = mpring.var('x') gb = mpring.with_ord(:lex) do Algebra::Groebner.basis([x - e, * fs]) end gb.last end
symmetric_product(objs)
click to toggle source
# File lib/algebra/algebraic-equation.rb, line 16 def symmetric_product(objs) a = [1] objs.each do |x| ax = a.collect { |t| t * x } a.each_index do |i| a[i] = a[i] + ax[i - 1] if i > 0 && i < a.size end a.push ax.last end a end
Private Instance Methods
minimal_polynomial(e, *fs)
click to toggle source
# File lib/algebra/algebraic-equation.rb, line 28 def minimal_polynomial(e, *fs) raise 'too many polys' if fs.size > 'x'.ord - 'a'.ord # ("a"..."x").size require 'algebra/groebner-basis' (mpring = e.class).vars('x') x = mpring.var('x') gb = mpring.with_ord(:lex) do Algebra::Groebner.basis([x - e, * fs]) end gb.last end
symmetric_product(objs)
click to toggle source
# File lib/algebra/algebraic-equation.rb, line 16 def symmetric_product(objs) a = [1] objs.each do |x| ax = a.collect { |t| t * x } a.each_index do |i| a[i] = a[i] + ax[i - 1] if i > 0 && i < a.size end a.push ax.last end a end