File size: 9,717 Bytes
de52efb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Empirical Formulae &mdash; chemlib v1.0 documentation</title>
      <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
      <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <!--[if lt IE 9]>
    <script src="_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
        <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
        <script src="_static/jquery.js"></script>
        <script src="_static/underscore.js"></script>
        <script src="_static/doctools.js"></script>
    <script src="_static/js/theme.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="Chemical Reactions" href="reactions.html" />
    <link rel="prev" title="Chemical Compounds" href="compounds.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
            <a href="index.html" class="icon icon-home"> chemlib
          </a>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="core.html">Core Data</a></li>
<li class="toctree-l1"><a class="reference internal" href="compounds.html">Chemical Compounds</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Empirical Formulae</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#ef-by-percentage-composition">EF by Percentage Composition</a></li>
<li class="toctree-l2"><a class="reference internal" href="#combustion-analysis">Combustion Analysis</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="reactions.html">Chemical Reactions</a></li>
<li class="toctree-l1"><a class="reference internal" href="solution.html">Aqueous Solutions</a></li>
<li class="toctree-l1"><a class="reference internal" href="electrochemistry.html">Electrochemistry</a></li>
<li class="toctree-l1"><a class="reference internal" href="quantum.html">Quantum Mechanics</a></li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">chemlib</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
      <li>Empirical Formulae</li>
      <li class="wy-breadcrumbs-aside">
            <a href="_sources/formulae.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="empirical-formulae">
<h1>Empirical Formulae<a class="headerlink" href="#empirical-formulae" title="Permalink to this headline"></a></h1>
<section id="ef-by-percentage-composition">
<h2>EF by Percentage Composition<a class="headerlink" href="#ef-by-percentage-composition" title="Permalink to this headline"></a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="chemlib.chemistry.empirical_formula_by_percent_comp">
<span class="sig-prename descclassname"><span class="pre">chemlib.chemistry.</span></span><span class="sig-name descname"><span class="pre">empirical_formula_by_percent_comp</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#chemlib.chemistry.empirical_formula_by_percent_comp" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>Get the empirical formula given the percentage compositions of all elements in the compound.</p>
</div></blockquote>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>kwargs</strong> – The percentage compositions of elements in the compound <code class="docutils literal notranslate"><span class="pre">(&lt;Element</span> <span class="pre">symbol&gt;</span> <span class="pre">=</span> <span class="pre">&lt;Percentage</span> <span class="pre">Composition&gt;</span> <span class="pre">...)</span></code></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The empirical formula of the compound.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>str</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>ValueError</strong> – If the sums of the percentages is not equal to 100.</p>
</dd>
</dl>
</dd></dl>

<p>Get the empirical formula of a compound that is composed of 80.6% C, and 19.4% H by mass:</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">chemlib</span> <span class="kn">import</span> <span class="n">empirical_formula_by_percent_comp</span> <span class="k">as</span> <span class="n">efbpc</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">efbpc</span><span class="p">(</span><span class="n">C</span> <span class="o">=</span> <span class="mf">80.6</span><span class="p">,</span> <span class="n">H</span> <span class="o">=</span> <span class="mf">19.4</span><span class="p">)</span>
<span class="go">&#39;C1H3&#39;</span>
</pre></div>
</div>
</section>
<section id="combustion-analysis">
<h2>Combustion Analysis<a class="headerlink" href="#combustion-analysis" title="Permalink to this headline"></a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="chemlib.chemistry.combustion_analysis">
<span class="sig-prename descclassname"><span class="pre">chemlib.chemistry.</span></span><span class="sig-name descname"><span class="pre">combustion_analysis</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">CO2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">H2O</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#chemlib.chemistry.combustion_analysis" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>Get the empirical formula of a hydrocarbon given the grams of CO2 and grams of H2O formed from its combustion.</p>
</div></blockquote>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>CO2</strong> – The grams of carbon dioxide formed as a result of the combustion of the hydrocarbon.</p></li>
<li><p><strong>H2O</strong> – The grams of water formed as a result of the combustion of the hydrocarbon.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The empirical formula of the hydrocarbon.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>str</p>
</dd>
</dl>
</dd></dl>

<p>A hydrocarbon fuel is fully combusted with 18.214 g of oxygen to yield 23.118 g of carbon
dioxide and 4.729 g of water. Find the empirical formula for the hydrocarbon.</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">chemlib.chemistry</span> <span class="kn">import</span> <span class="n">combustion_analysis</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">combustion_analysis</span><span class="p">(</span><span class="mf">23.118</span><span class="p">,</span> <span class="mf">4.729</span><span class="p">)</span>
<span class="go">&#39;CH&#39;</span>
</pre></div>
</div>
</section>
</section>


           </div>
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="compounds.html" class="btn btn-neutral float-left" title="Chemical Compounds" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="reactions.html" class="btn btn-neutral float-right" title="Chemical Reactions" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2020, Hari Ambethkar.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>