Method: Variable#initialize
- Defined in:
- lib/symcalc.rb
#initialize(name, fixed_value = nil) ⇒ Variable
Create a new symbolic variable with a custom display name, and an optional fixed value Accepts the display name and an optional fixed_value Fixed_value works in the cases of evaluating the function
Example: x = Variable.new “x”, 5 fx = x ** 2 fx.eval # => 25
304 305 306 307 |
# File 'lib/symcalc.rb', line 304 def initialize name, fixed_value = nil @name = name @fixed_value = fixed_value end |