479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
|
# File 'lib/symcalc.rb', line 479
def __simplify__
@lside = @lside.__simplify__
@rside = @rside.__simplify__
if (@lside == EquationValue.new(0)) || (@rside == EquationValue.new(0))
return EquationValue.new 0
elsif @lside == EquationValue.new(1)
return @rside
elsif @rside == EquationValue.new(1)
return @lside
elsif @rside.is_a? EquationValue and @lside.is_a? EquationValue
calculated = @rside.value * @lside.value
if calculated.to_s.size <= 6
return to_equation(calculated)
else
return self
end
else
return self
end
end
|