Class: SyMath::Definition::CoDiff

Inherits:
Operator show all
Defined in:
lib/symath/definition/codiff.rb

Instance Attribute Summary

Attributes inherited from Operator

#args, #exp

Attributes inherited from SyMath::Definition

#name

Instance Method Summary collapse

Methods inherited from Operator

#<=>, #==, #arity, #call, #compose_with_simplify, #dump, init_builtin, #is_operator?, operators, #replace, #to_latex, #to_s, #validate_args

Methods inherited from SyMath::Definition

#<=>, #==, #arity, define, defined?, definitions, get, #hash, init_builtin, #inspect, #is_constant?, #is_function?, #is_operator?, #reduce_call, #replace, #to_latex, #to_s, undefine, #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, #type, #wedge

Methods included from Operation::Exterior

#flat, #hodge, #sharp

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

#iterate, #recurse

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

#initializeCoDiff

Returns a new instance of CoDiff.



6
7
8
9
10
11
12
# File 'lib/symath/definition/codiff.rb', line 6

def initialize()
  # The co-differential is defined as: (-1)**(n*k+ 1)*d*(F).
  # n : Dimension of the basis vector space
  # k : Grade of input function F
  # (the sign is calculated by the overridden evaluate method)
  super(:codiff, args: [:f], exp: 'hodge(xd(hodge(f)))')
end

Instance Method Details

#descriptionObject



14
15
16
# File 'lib/symath/definition/codiff.rb', line 14

def description()
  return 'codiff(f) - codifferential of function f'
end

#evaluate_call(c) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/symath/definition/codiff.rb', line 18

def evaluate_call(c)
  vars = SyMath.get_variable(:basis.to_m).row(0)
  n = vars.length
  k = c.args[0].type.degree
  sign = ((-1)**(n*k + 1)).to_m

  return sign*super(c)
end

#latex_formatObject



27
28
29
# File 'lib/symath/definition/codiff.rb', line 27

def latex_format()
  return '\delta %s'
end