Software:Rubychem

From HandWiki
Revision as of 06:49, 9 February 2024 by ScienceGen (talk | contribs) (url)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

RubyChem (pronounced /ˈruːˈbeːˈkːˈem/) is a freely available (MIT License) program, written in Ruby, supporting the calculation of moles, balancing chemical equations and valence orbital calculations.

Example

The Ruby official distribution also includes "irb" (Interactive Ruby Shell), an interactive command-line interpreter which can be used to test code quickly. The following code fragment represents a sample session using irb:

$ irb
irb(main):001:0> require 'rubychem'
irb(main):002:0> RubyChem::Equation.new("C12H26+O2=CO2+H2O").balance
=> 2C12H26 + 37O2 = 24C1O2 + 26H2O1"

In this example, the program finds the chemical equation for the burning of dodecane (or an isomer of it). The user knows that hydrocarbons burnt completely in oxygen produce carbon dioxide and water, so types that as their input. The program correctly "balances" this equation (meaning that the same number of each type of atom appears on each side, to result in the description below of dodecane burning in sufficient oxygen.

2 C
12
H
26
+ 37 O
2
→ 24 CO
2
+ 26 H
2
O

See also

External links