Top Level Namespace

Defined Under Namespace

Modules: SyMath Classes: Array, Integer, String, Symbol

Instance Method Summary collapse

Instance Method Details

#define_fn(name, args, exp = nil) ⇒ Object



172
173
174
175
176
177
178
# File 'lib/symath/definition/function.rb', line 172

def define_fn(name, args, exp = nil)
  if exp
    return SyMath::Definition::Function.new(name, args: args, exp: exp)
  else
    return SyMath::Definition::Function.new(name, args: args)
  end
end

#define_op(name, args, exp = nil) ⇒ Object



209
210
211
212
213
214
215
# File 'lib/symath/definition/operator.rb', line 209

def define_op(name, args, exp = nil)
  if exp
    return SyMath::Definition::Operator.new(name, args: args, exp: exp)
  else
    return SyMath::Definition::Operator.new(name, args: args)
  end
end

#definition(name) ⇒ Object



193
194
195
# File 'lib/symath/definition.rb', line 193

def definition(name)
  return SyMath::Definition.get(name)
end

#definitionsObject



197
198
199
# File 'lib/symath/definition.rb', line 197

def definitions()
  return SyMath::Definition.definitions
end

#eq(a, b) ⇒ Object

Convenience method



65
66
67
# File 'lib/symath/equation.rb', line 65

def eq(a, b)
  return SyMath::Equation.new(a, b)
end

#fn(f, *args) ⇒ Object



168
169
170
# File 'lib/symath/definition/function.rb', line 168

def fn(f, *args)
  return SyMath::Operator.create(f, args.map { |a| a.nil? ? a : a.to_m })
end

#lmd(exp, *args) ⇒ Object



94
95
96
97
# File 'lib/symath/definition/lmd.rb', line 94

def lmd(exp, *args)
  # Create a lamda (nameless) function.
  return SyMath::Definition::Lmd.new(exp, *args)
end

#op(o, *args) ⇒ Object



205
206
207
# File 'lib/symath/definition/operator.rb', line 205

def op(o, *args)
  return SyMath::Operator.create(o, args.map { |a| a.nil? ? a : a.to_m })
end