Class: SyMath::Wedge
- Defined in:
- lib/symath/wedge.rb
Instance Attribute Summary
Attributes inherited from Operator
Instance Method Summary collapse
-
#initialize(arg1, arg2) ⇒ Wedge
constructor
A new instance of Wedge.
- #to_latex ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
Methods inherited from Product
compose_with_simplify, #evaluate, #factor1, #factor1=, #factor2, #factor2=, #factors, #is_associative?, #is_commutative?, #is_prod_exp?, simplify_inf
Methods inherited from Operator
#<=>, #==, #args_assoc, #arity, compose_with_simplify, #dump, #evaluate, #hash, #is_associative?, #is_commutative?, #is_constant?, #name, #reduce, #replace, #variables
Methods inherited from Value
#*, #**, #+, #-, #-@, #/, #<, #<=, #<=>, #>, #>=, #^, #add, #base, compose_with_simplify, create, #deep_clone, #div, #dump, #evaluate, #exponent, #factors, #inspect, #inv, #is_divisor_factor?, #is_finite?, #is_nan?, #is_negative?, #is_negative_number?, #is_number?, #is_positive?, #is_prod_exp?, #is_sum_exp?, #is_unit_quaternion?, #is_zero?, #mul, #neg, #power, #reduce, #reduce_modulo_sign, #sign, #sub, #terms, #to_m, #wedge
Methods included from Operation::Exterior
Methods included from Operation::Integration
#anti_derivative, #get_linear_constants, initialize, #int_constant, #int_failure, #int_function, #int_inv, #int_pattern, #int_power, #int_product, #int_sum, #integral_bounds
Methods included from Operation::Differential
#_d_wedge, #d, #d_failure, #d_fraction, #d_function, #d_function_def, #d_power, #d_product, initialize
Methods included from Operation
Methods included from Operation::DistributiveLaw
#combfrac_add_term, #combfrac_sum, #combine_fractions, #expand, #expand_product, #expand_single_pass, #factorize, #factorize_integer_poly, #factorize_simple, #has_fractional_terms?
Methods included from Operation::Normalization
#combine_factors, #compare_factors_and_swap, #normalize, #normalize_matrix, #normalize_power, #normalize_product, #normalize_single_pass, #normalize_sum, #order_product, #product_on_fraction_form, #reduce_constant_factors, #replace_combined_factors, #swap_factors
Methods included from Operation::Match
#build_assoc_op, #match, #match_assoc, #match_replace
Constructor Details
#initialize(arg1, arg2) ⇒ Wedge
Returns a new instance of Wedge.
5 6 7 8 |
# File 'lib/symath/wedge.rb', line 5 def initialize(arg1, arg2) super(arg1, arg2) @name = '^' end |
Instance Method Details
#to_latex ⇒ Object
44 45 46 |
# File 'lib/symath/wedge.rb', line 44 def to_latex() return @args.map { |a| a.to_latex }.join('\wedge') end |
#to_s ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/symath/wedge.rb', line 30 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 |
#type ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/symath/wedge.rb', line 10 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 |