Sha256: bf664ed68c057e2d95977e538aeb5b2ac234f3e63474d65fa2474255e72f70fe
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
require 'symath/product' module SyMath class Wedge < Product def initialize(arg1, arg2) super(arg1, arg2) @name = '^' end def type() if factor1.type.is_subtype?('tensor') and factor2.type.is_subtype?('tensor') # Wedge product of two tensor-like object. Determine index signature # and subtype. indexes = factor1.type.indexes + factor2.type.indexes if (indexes - ['u']).empty? type = 'nvector' elsif (indexes - ['l']).empty? type = 'nform' else type = 'tensor' end return type.to_t(indexes: indexes) else return factor1.type.sum(factor2.type) end end def to_s() if SyMath.setting(:expl_parentheses) return '('.to_s + factor1.to_s + '^' + factor2.to_s + ')'.to_s else return @args.map do |a| if a.is_sum_exp? '(' + a.to_s + ')' else a.to_s end end.join('^') end end def to_latex() return @args.map { |a| a.to_latex }.join('\wedge') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
symath-0.1.1 | lib/symath/wedge.rb |
symath-0.1.0 | lib/symath/wedge.rb |