<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Surendra Singh Kamboj</title>
    <description>The latest articles on DEV Community by Surendra Singh Kamboj (@surendrasinghkamboj).</description>
    <link>https://dev.to/surendrasinghkamboj</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4243119%2F66f34919-f257-415e-be62-e13e87da64ad.jpg</url>
      <title>DEV Community: Surendra Singh Kamboj</title>
      <link>https://dev.to/surendrasinghkamboj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/surendrasinghkamboj"/>
    <language>en</language>
    <item>
      <title>Common ion effect in JavaScript: why AgCl is 745x less soluble with a pinch of salt</title>
      <dc:creator>Surendra Singh Kamboj</dc:creator>
      <pubDate>Fri, 04 Dec 2026 10:12:33 +0000</pubDate>
      <link>https://dev.to/surendrasinghkamboj/common-ion-effect-in-javascript-why-agcl-is-745x-less-soluble-with-a-pinch-of-salt-k95</link>
      <guid>https://dev.to/surendrasinghkamboj/common-ion-effect-in-javascript-why-agcl-is-745x-less-soluble-with-a-pinch-of-salt-k95</guid>
      <description>&lt;p&gt;Silver chloride dissolves in pure water, just barely. Add a little sodium chloride - a salt that has nothing to do with silver - and the AgCl's own solubility collapses. Nothing about AgCl changed; what changed is that the solution is no longer starting from zero chloride ion.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why adding a spectator salt suppresses solubility
&lt;/h2&gt;

&lt;p&gt;AgCl(s) &amp;lt;-&amp;gt; Ag+(aq) + Cl-(aq), Ksp = [Ag+][Cl-]&lt;/p&gt;

&lt;p&gt;In pure water, solubility s satisfies Ksp = s^2, so s = sqrt(Ksp). But if the solution already has chloride ions from another source, Le Chatelier's principle pushes the equilibrium left: dissolution has to stop sooner to keep [Ag+][Cl-] at the same fixed Ksp. With a large excess of common ion, [Cl-] is about the added concentration, so s is about Ksp / [Cl-]_added.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checked in JavaScript
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;Ksp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.8e-10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;                 &lt;span class="c1"&gt;// AgCl at 25°C&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;sPureWater&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Ksp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;Cl_added&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.01&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;               &lt;span class="c1"&gt;// 0.01 M NaCl&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;sWithCommonIon&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Ksp&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nc"&gt;Cl_added&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sPureWater&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toExponential&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;        &lt;span class="c1"&gt;// 1.3416e-5 M&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sWithCommonIon&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toExponential&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;     &lt;span class="c1"&gt;// 1.8000e-8 M&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sPureWater&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;sWithCommonIon&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// 745.4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Solvent&lt;/th&gt;
&lt;th&gt;Solubility of AgCl&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pure water&lt;/td&gt;
&lt;td&gt;1.34e-5 M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.01 M NaCl solution&lt;/td&gt;
&lt;td&gt;1.80e-8 M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ratio&lt;/td&gt;
&lt;td&gt;745x less soluble&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A 1% (0.01 M) solution of an entirely unrelated salt knocks AgCl's solubility down by nearly three orders of magnitude. This is the exact principle behind precipitating a metal ion to completion in gravimetric analysis, and behind why adding NaCl to a saturated NaCl solution precipitates more solid rather than dissolving it further.&lt;/p&gt;

&lt;p&gt;A buffer resisting pH change when you add a common ion (acetate suppressing acetic acid's own dissociation) and AgCl's solubility collapsing in NaCl are both Le Chatelier's principle applied to the same kind of equilibrium: adding a product ion from an outside source pushes the reaction back toward reactants, whether the equilibrium is a dissolution or a weak-acid dissociation.&lt;/p&gt;

&lt;p&gt;I build PractiSci (&lt;a href="https://www.practisci.in" rel="noopener noreferrer"&gt;https://www.practisci.in&lt;/a&gt;), a free virtual chemistry lab, and the equilibrium chapter has an interactive common-ion-effect solubility calculator: &lt;a href="https://www.practisci.in/labs/chem-common-ion-effect" rel="noopener noreferrer"&gt;common ion effect lab&lt;/a&gt;, or browse all &lt;a href="https://www.practisci.in/practicals/class-12-chemistry" rel="noopener noreferrer"&gt;Class 11 and 12 chemistry practicals&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>chemistry</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>education</category>
    </item>
    <item>
      <title>Zener diode regulator in JavaScript: output stays put even when input jumps 25%</title>
      <dc:creator>Surendra Singh Kamboj</dc:creator>
      <pubDate>Fri, 04 Dec 2026 10:11:45 +0000</pubDate>
      <link>https://dev.to/surendrasinghkamboj/zener-diode-regulator-in-javascript-output-stays-put-even-when-input-jumps-25-1137</link>
      <guid>https://dev.to/surendrasinghkamboj/zener-diode-regulator-in-javascript-output-stays-put-even-when-input-jumps-25-1137</guid>
      <description>&lt;p&gt;A Zener diode run backwards past its breakdown voltage holds a nearly fixed voltage across itself no matter how much current flows through it. Put one in series with a resistor and feed it a varying input, and the load sees a voltage locked to the Zener's breakdown value - the series resistor absorbs every volt of variation instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  The circuit rule
&lt;/h2&gt;

&lt;p&gt;Current from the source splits between the Zener and the load: I_total = I_zener + I_load, where I_total = (Vin - Vz)/Rseries and I_load = Vz/Rload. As long as I_zener stays positive, V_load stays pinned at Vz regardless of Vin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checked in JavaScript
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;zenerRegulator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Vin&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Vz&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Rseries&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Rload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;Itotal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Vin&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nc"&gt;Vz&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nc"&gt;Rseries&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;Iload&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Vz&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nc"&gt;Rload&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;Izener&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Itotal&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nc"&gt;Iload&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Itotal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Iload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Izener&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;zenerRegulator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// { Itotal: 0.06, Iload: 0.006, Izener: 0.054 }   -&amp;gt; Vout = 6 V&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;zenerRegulator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// { Itotal: 0.09, Iload: 0.006, Izener: 0.084 }   -&amp;gt; Vout = still 6 V&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;zenerRegulator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// { Itotal: 0.06, Iload: 0.012, Izener: 0.048 }   -&amp;gt; Vout = still 6 V&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Condition&lt;/th&gt;
&lt;th&gt;Vin&lt;/th&gt;
&lt;th&gt;Rload&lt;/th&gt;
&lt;th&gt;I through Zener&lt;/th&gt;
&lt;th&gt;Output&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Baseline&lt;/td&gt;
&lt;td&gt;12 V&lt;/td&gt;
&lt;td&gt;1 kOhm&lt;/td&gt;
&lt;td&gt;54 mA&lt;/td&gt;
&lt;td&gt;6 V&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Line surge (+3 V in)&lt;/td&gt;
&lt;td&gt;15 V&lt;/td&gt;
&lt;td&gt;1 kOhm&lt;/td&gt;
&lt;td&gt;84 mA&lt;/td&gt;
&lt;td&gt;still 6 V&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Load drops to 500 Ohm&lt;/td&gt;
&lt;td&gt;12 V&lt;/td&gt;
&lt;td&gt;500 Ohm&lt;/td&gt;
&lt;td&gt;48 mA&lt;/td&gt;
&lt;td&gt;still 6 V&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Whether the input jumps from 12 V to 15 V (a 25% line surge) or the load resistance is halved, the output stays locked at exactly 6 V. The series resistor and the Zener's own current simply reroute to absorb each change - that's line regulation and load regulation in the same two-component circuit.&lt;/p&gt;

&lt;p&gt;If the load would need more current than I_total can supply, I_zener goes to zero, the diode comes out of breakdown, and regulation fails: the output then just follows a plain resistor divider instead.&lt;/p&gt;

&lt;p&gt;I build PractiSci (&lt;a href="https://www.practisci.in" rel="noopener noreferrer"&gt;https://www.practisci.in&lt;/a&gt;), a free virtual physics lab, where the Semiconductor Electronics chapter has an interactive Zener regulator you can load-test yourself: &lt;a href="https://www.practisci.in/labs/12-14-zener-regulator" rel="noopener noreferrer"&gt;Zener diode regulator lab&lt;/a&gt;, or browse all &lt;a href="https://www.practisci.in/practicals/class-12-physics" rel="noopener noreferrer"&gt;Class 12 physics practicals&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>physics</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>education</category>
    </item>
    <item>
      <title>Gyroscope precession in JavaScript: why a faster spin makes a top turn slower</title>
      <dc:creator>Surendra Singh Kamboj</dc:creator>
      <pubDate>Fri, 04 Dec 2026 10:11:00 +0000</pubDate>
      <link>https://dev.to/surendrasinghkamboj/gyroscope-precession-in-javascript-why-a-faster-spin-makes-a-top-turn-slower-bmj</link>
      <guid>https://dev.to/surendrasinghkamboj/gyroscope-precession-in-javascript-why-a-faster-spin-makes-a-top-turn-slower-bmj</guid>
      <description>&lt;p&gt;Tip a stationary top and it falls straight over, following gravity's torque exactly where you'd expect. Spin the same top fast and tip it, and instead of falling it swings slowly sideways around the pivot. The torque never stopped pointing down - what changed is that there's now angular momentum for it to redirect.&lt;/p&gt;

&lt;h2&gt;
  
  
  The precession formula
&lt;/h2&gt;

&lt;p&gt;Gravity's torque is tau = mgr (weight times distance from pivot to centre of mass). Instead of tipping the spin axis over, that torque rotates the angular momentum vector L = I*omega sideways, at a rate:&lt;/p&gt;

&lt;p&gt;Omega = mgr / (I*omega)&lt;/p&gt;

&lt;p&gt;Faster spin means more angular momentum to redirect, so the same torque produces slower precession - the opposite of what intuition expects from "more torque, more effect."&lt;/p&gt;

&lt;h2&gt;
  
  
  Checked in JavaScript
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;R&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.05&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;9.8&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;      &lt;span class="c1"&gt;// 200 g disc flywheel, 5 cm radius&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;I&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="no"&gt;R&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="no"&gt;R&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;              &lt;span class="c1"&gt;// disc moment of inertia about spin axis&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;omega&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;                      &lt;span class="c1"&gt;// spin rate, rad/s&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;                          &lt;span class="c1"&gt;// pivot to centre-of-mass distance&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;Omega&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;I&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;omega&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;rpm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Omega&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;PI&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;I&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toExponential&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Omega&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rpm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// I = 2.50e-4 kg*m^2   Omega = 3.920 rad/s   precession rate = 37.43 rpm&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Quantity&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Flywheel moment of inertia, I&lt;/td&gt;
&lt;td&gt;2.5e-4 kg*m^2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Spin rate, omega&lt;/td&gt;
&lt;td&gt;200 rad/s (about 1910 rpm)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Precession rate, Omega&lt;/td&gt;
&lt;td&gt;3.92 rad/s (about 37.4 rpm)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The disc spins at nearly 2000 rpm, but the whole assembly sweeps around the pivot at only about 37 rpm - roughly 1/51st as fast. Double omega in the code above and Omega is cut exactly in half; that inverse relationship is the signature of gyroscopic precession and it's why bicycle wheels, tops and planets all precess slowly compared to how fast they actually spin.&lt;/p&gt;

&lt;p&gt;Torque only changes angular momentum in the direction the torque points - it doesn't have to change the magnitude or tilt of L if there's a perpendicular direction to act in instead. With fast spin, L is large and nearly horizontal for a tipped top, so the same downward torque rotates it sideways around the pivot rather than tipping it further down.&lt;/p&gt;

&lt;p&gt;I build PractiSci (&lt;a href="https://www.practisci.in" rel="noopener noreferrer"&gt;https://www.practisci.in&lt;/a&gt;), a free virtual physics lab, and the Rotational Motion chapter includes an interactive gyroscope: &lt;a href="https://www.practisci.in/labs/11-6-gyroscope-precession" rel="noopener noreferrer"&gt;gyroscope precession lab&lt;/a&gt;, or see the full &lt;a href="https://www.practisci.in/topics/rotational-motion" rel="noopener noreferrer"&gt;rotational motion topic guide&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>physics</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>education</category>
    </item>
    <item>
      <title>The binding energy curve in JavaScript: why fission splits uranium but never iron</title>
      <dc:creator>Surendra Singh Kamboj</dc:creator>
      <pubDate>Fri, 04 Dec 2026 10:10:13 +0000</pubDate>
      <link>https://dev.to/surendrasinghkamboj/the-binding-energy-curve-in-javascript-why-fission-splits-uranium-but-never-iron-jek</link>
      <guid>https://dev.to/surendrasinghkamboj/the-binding-energy-curve-in-javascript-why-fission-splits-uranium-but-never-iron-jek</guid>
      <description>&lt;p&gt;Every nucleus is lighter than the separate protons and neutrons that built it. Divide the missing mass's energy by nucleon count and plot it against mass number, and you get one of the most important curves in physics: it rises, peaks near iron, then slowly falls.&lt;/p&gt;

&lt;h2&gt;
  
  
  The formula
&lt;/h2&gt;

&lt;p&gt;BE = [Z*m_p + N*m_n - M_nucleus] * c^2, reported in MeV using 1 u = 931.494 MeV/c^2&lt;/p&gt;

&lt;h2&gt;
  
  
  Checked in JavaScript
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;mp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.007825&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.008665&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;u2MeV&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;931.494&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;bindingEnergy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;Z&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;N&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;atomicMassU&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;BE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;Z&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;mp&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;N&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;mn&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;atomicMassU&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;u2MeV&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;BE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;perNucleon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;BE&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;Z&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="no"&gt;N&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;fe56&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;bindingEnergy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;26&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;55.934942&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;u235&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;bindingEnergy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;92&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;143&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;235.043930&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fe56&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fe56&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;perNucleon&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// 492.3 MeV   8.7903 MeV/nucleon&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u235&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;u235&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;perNucleon&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// 1783.9 MeV   7.5909 MeV/nucleon&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Nucleus&lt;/th&gt;
&lt;th&gt;Binding energy per nucleon&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Iron-56&lt;/td&gt;
&lt;td&gt;8.79 MeV&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Uranium-235&lt;/td&gt;
&lt;td&gt;7.59 MeV&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Iron-56 sits almost exactly at the curve's peak. Uranium-235, on the downhill slope, has less binding energy per nucleon than the two medium-sized fragments it splits into during fission. That 1.2 MeV/nucleon gap, multiplied across 235 nucleons, is where a fission reactor's energy comes from: the fragments end up more tightly bound than the original nucleus, and the difference is released as energy.&lt;/p&gt;

&lt;p&gt;The same curve explains fusion from the other side: light nuclei like hydrogen and helium sit on the steep left slope, so fusing them climbs toward the peak just as steeply, which is why fusion fuel releases far more energy per kilogram than fissionable uranium.&lt;/p&gt;

&lt;p&gt;Beyond iron, every added proton adds Coulomb repulsion between all protons, but the strong force is short-ranged and only pulls on close neighbours. Past A of about 56 the repulsion wins out, which is why the curve turns over instead of climbing forever.&lt;/p&gt;

&lt;p&gt;I build PractiSci (&lt;a href="https://www.practisci.in" rel="noopener noreferrer"&gt;https://www.practisci.in&lt;/a&gt;), a free virtual physics lab, where the Nuclei chapter has an interactive fission/fusion energy calculator: &lt;a href="https://www.practisci.in/labs/12-13-binding-energy-curve" rel="noopener noreferrer"&gt;binding energy and fission/fusion lab&lt;/a&gt;, or browse all &lt;a href="https://www.practisci.in/practicals/class-12-physics" rel="noopener noreferrer"&gt;Class 12 physics practicals&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>physics</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>education</category>
    </item>
    <item>
      <title>Millikan's oil drop experiment in JavaScript: pinning down the electron's charge</title>
      <dc:creator>Surendra Singh Kamboj</dc:creator>
      <pubDate>Fri, 04 Dec 2026 10:08:53 +0000</pubDate>
      <link>https://dev.to/surendrasinghkamboj/millikans-oil-drop-experiment-in-javascript-pinning-down-the-electrons-charge-5g6b</link>
      <guid>https://dev.to/surendrasinghkamboj/millikans-oil-drop-experiment-in-javascript-pinning-down-the-electrons-charge-5g6b</guid>
      <description>&lt;p&gt;A charged oil droplet floating motionless between two plates is already a solved equation: the electric force up exactly cancels gravity down, so q = mg/E. Measure the field needed to balance one droplet and you've measured its charge — and in 1909, Robert Millikan found every droplet's charge was a whole-number multiple of the same tiny value.&lt;/p&gt;

&lt;h2&gt;
  
  
  The balance condition
&lt;/h2&gt;

&lt;p&gt;qE = mg, so q = mg / E&lt;/p&gt;

&lt;p&gt;The mass comes from a free-fall (no field) terminal-velocity measurement using Stokes' law, buoyancy-corrected: v0 = 2r^2(rho_oil - rho_air)g / (9*eta). Once you have the radius from v0, mass follows from m = (4/3)*pi*r^3*rho_oil.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checked in JavaScript
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;rho&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;920&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;eta&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.8e-5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;9.8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1e-6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.602e-19&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;v0&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;rho&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;eta&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;           &lt;span class="c1"&gt;// terminal velocity, no field&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;PI&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;rho&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;           &lt;span class="c1"&gt;// droplet mass&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;mg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;q&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;                                       &lt;span class="c1"&gt;// drop carries 3 excess electrons&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.01&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;                                         &lt;span class="c1"&gt;// 1 cm plate gap&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;E&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mg&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;q&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;V&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;E&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toExponential&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toExponential&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;E&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;V&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// 1.113e-4 m/s   3.854e-15 kg   78581 V/m   785.8 V&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A 1-micron oil droplet (density 920 kg/m3) falls at just over a tenth of a millimetre per second under gravity alone. Balancing it with exactly 3 extra electrons needs about 786 V across a 1 cm gap. Every droplet Millikan tried gave a charge that was a whole-number multiple of 1.602e-19 C, which is how the experiment proved charge is quantised in the first place.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Quantity&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Droplet radius&lt;/td&gt;
&lt;td&gt;1 micron&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Free-fall terminal velocity&lt;/td&gt;
&lt;td&gt;0.111 mm/s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Droplet mass&lt;/td&gt;
&lt;td&gt;3.85e-15 kg&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Balancing field (q = 3e)&lt;/td&gt;
&lt;td&gt;78,581 V/m&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Plate voltage (1 cm gap)&lt;/td&gt;
&lt;td&gt;785.8 V&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A micron-sized oil drop weighs about 4e-14 N, far below anything a balance can register directly. Stokes' law turns an easily measured fall time into that mass instead, which is the whole trick behind the experiment.&lt;/p&gt;

&lt;p&gt;I build PractiSci (&lt;a href="https://www.practisci.in" rel="noopener noreferrer"&gt;https://www.practisci.in&lt;/a&gt;), a free virtual physics lab. Try the interactive version here: &lt;a href="https://www.practisci.in/labs/12-11-millikan-oil-drop" rel="noopener noreferrer"&gt;Millikan-style charge balance lab&lt;/a&gt;, or browse all &lt;a href="https://www.practisci.in/practicals/class-12-physics" rel="noopener noreferrer"&gt;Class 12 physics practicals&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>physics</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>education</category>
    </item>
    <item>
      <title>Finding an unknown solute's molar mass from freezing-point depression, in JavaScript</title>
      <dc:creator>Surendra Singh Kamboj</dc:creator>
      <pubDate>Thu, 03 Dec 2026 04:48:32 +0000</pubDate>
      <link>https://dev.to/surendrasinghkamboj/finding-an-unknown-solutes-molar-mass-from-freezing-point-depression-in-javascript-2jc6</link>
      <guid>https://dev.to/surendrasinghkamboj/finding-an-unknown-solutes-molar-mass-from-freezing-point-depression-in-javascript-2jc6</guid>
      <description>&lt;p&gt;Dissolve anything non-volatile in water and the freezing point drops below 0°C — by an amount that depends only on how many particles went in, not what they are. That single colligative property is enough to back-calculate an unknown solute's molar mass.&lt;/p&gt;

&lt;h2&gt;
  
  
  The formula and the code
&lt;/h2&gt;

&lt;p&gt;ΔTf = Kf · m, with Kf = 1.86 °C·kg/mol for water. Writing molality in terms of masses (w2 g solute in w1 g solvent, molar mass M):&lt;/p&gt;

&lt;p&gt;M = Kf · w2 × 1000 / (ΔTf × w1)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;Kf&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.86&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;w2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.07&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// g solute&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;w1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;    &lt;span class="c1"&gt;// g water&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;dTf&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.40&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// degC depression observed&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;M&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Kf&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;w2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dTf&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;w1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Molar mass:'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;M&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'g/mol'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output: &lt;strong&gt;≈ 99.51 g/mol&lt;/strong&gt;. The method gives the molar mass, not the identity — a real unknown would still need a melting point or another check to pin down which compound it actually is.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why particle count, not particle identity
&lt;/h2&gt;

&lt;p&gt;This is why it's called a &lt;em&gt;colligative&lt;/em&gt; property: the effect is bound to how many particles are dissolved per kilogram of solvent, not whether the solute is sugar, urea, or an organic acid. For a non-ionising solute, one mole dissolved gives one mole of particles, so the plain formula applies directly.&lt;/p&gt;

&lt;p&gt;An ionic solute is a different story — NaCl dissociates into two particles per formula unit, so ΔTf = i·Kf·m with van't Hoff factor i ≈ 2. Using the plain formula on a salt would double-undercount the particles and give a molar mass roughly twice too large.&lt;/p&gt;

&lt;p&gt;Common mistake: double-converting w1 to kilograms — the ×1000 in the formula already handles grams-to-kilograms for the solvent, so adding a second conversion on top is the most common arithmetic slip here.&lt;/p&gt;

&lt;p&gt;Try it yourself: PractiSci's &lt;a href="https://www.practisci.in/labs/chem-molar-mass-freezing-point-a" rel="noopener noreferrer"&gt;molar mass by freezing-point depression lab&lt;/a&gt; lets you dissolve an unknown solid and read the freezing points of pure water and the solution side by side. More free labs: &lt;a href="https://www.practisci.in/practicals/class-12-chemistry" rel="noopener noreferrer"&gt;Class 12 chemistry practicals&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Full disclosure: I build PractiSci, a virtual physics and chemistry lab for Class 11-12.&lt;/p&gt;

</description>
      <category>chemistry</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>education</category>
    </item>
    <item>
      <title>Carbon dioxide turns lime water milky, then clear: the stoichiometry in JavaScript</title>
      <dc:creator>Surendra Singh Kamboj</dc:creator>
      <pubDate>Thu, 03 Dec 2026 04:47:39 +0000</pubDate>
      <link>https://dev.to/surendrasinghkamboj/carbon-dioxide-turns-lime-water-milky-then-clear-the-stoichiometry-in-javascript-c19</link>
      <guid>https://dev.to/surendrasinghkamboj/carbon-dioxide-turns-lime-water-milky-then-clear-the-stoichiometry-in-javascript-c19</guid>
      <description>&lt;p&gt;A classic qualitative test hides a quantitative story: pass CO2 into lime water and it turns milky, keep passing CO2 and it clears up again. Both volumes where this happens follow directly from the two reactions involved.&lt;/p&gt;

&lt;h2&gt;
  
  
  The two reactions
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Ca(OH)₂(aq) + CO₂(g) → CaCO₃(s)↓ + H₂O(l)  — the milky precipitate&lt;/li&gt;
&lt;li&gt;CaCO₃(s) + CO₂(g) + H₂O(l) → Ca(HCO₃)₂(aq)  — redissolves as soluble bicarbonate&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;Vm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;22400&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// mL gas per mole, STP&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;molesCaOH2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.01&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 0.01 M, 100 mL&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'moles Ca(OH)2:'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;molesCaOH2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;co2ToMilky&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;molesCaOH2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nc"&gt;Vm&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'CO2 to turn fully milky (mL):'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;co2ToMilky&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;massCaCO3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;molesCaOH2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;100.09&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'mass of CaCO3 formed (g):'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;massCaCO3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;co2ToClear&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;co2ToMilky&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// another equal mole of CO2 redissolves it&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'total CO2, milky then clear (mL):'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;co2ToClear&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For 100 mL of 0.01 M lime water: &lt;strong&gt;22.4 mL&lt;/strong&gt; of CO2 (STP) turns it fully milky (forming 0.1 g of CaCO3), and a further 22.4 mL — &lt;strong&gt;44.8 mL total&lt;/strong&gt; — clears it again as calcium bicarbonate dissolves back into solution.&lt;/p&gt;

&lt;h2&gt;
  
  
  The detail most answers skip
&lt;/h2&gt;

&lt;p&gt;SO2 also turns lime water milky — CaSO3 is insoluble too — so milkiness by itself does not prove the gas was CO2. What actually distinguishes CO2 is the &lt;em&gt;second&lt;/em&gt; reaction: only CO2's own precipitate redissolves cleanly in excess of the same gas. That reversal, not the first colour change, is the real confirming test.&lt;/p&gt;

&lt;p&gt;A lit splint going out at the mouth of the gas jar only shows the gas does not support combustion — true of CO2, N2 and others — so it narrows things down but does not confirm CO2 on its own either.&lt;/p&gt;

&lt;p&gt;Try it yourself: PractiSci's &lt;a href="https://www.practisci.in/labs/chem-test-carbon-dioxide" rel="noopener noreferrer"&gt;carbon dioxide and lime water lab&lt;/a&gt; lets you generate CO2 from marble chips and acid and watch both steps happen live. More free labs: &lt;a href="https://www.practisci.in/practicals/class-11-chemistry" rel="noopener noreferrer"&gt;Class 11 chemistry practicals&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Full disclosure: I build PractiSci, a virtual physics and chemistry lab for Class 11-12.&lt;/p&gt;

</description>
      <category>physics</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>education</category>
    </item>
    <item>
      <title>Finding a galvanometer's own resistance safely: the half-deflection method in JavaScript</title>
      <dc:creator>Surendra Singh Kamboj</dc:creator>
      <pubDate>Thu, 03 Dec 2026 04:46:38 +0000</pubDate>
      <link>https://dev.to/surendrasinghkamboj/finding-a-galvanometers-own-resistance-safely-the-half-deflection-method-in-javascript-3doj</link>
      <guid>https://dev.to/surendrasinghkamboj/finding-a-galvanometers-own-resistance-safely-the-half-deflection-method-in-javascript-3doj</guid>
      <description>&lt;p&gt;You cannot put a multimeter straight across a moving-coil galvanometer's terminals to find its resistance — a sensitive coil can bend or burn out from more current than it is rated for. The half-deflection method finds that resistance using only the galvanometer's own safe current.&lt;/p&gt;

&lt;h2&gt;
  
  
  The formula and the code
&lt;/h2&gt;

&lt;p&gt;With a series resistance R giving full deflection θ₁, then a shunt S (across the galvanometer) giving exactly half that deflection:&lt;/p&gt;

&lt;p&gt;G = S·R / (R − S)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;G&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;R&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;S&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;S&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="no"&gt;R&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;R&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="no"&gt;S&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'R=9710, S=10 -&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;G&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;9710&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'ohm'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'R=4990, S=5  -&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;G&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4990&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'ohm'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both cases land very close to G ≈ S (10.01 Ω and 5.005 Ω) — a common classroom shortcut, valid only when R &amp;gt;&amp;gt; S. The exact formula has a &lt;strong&gt;minus&lt;/strong&gt; sign in the denominator, not a plus — easy to mix up with the ordinary parallel-resistance formula, which it resembles but is not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why minus, not plus
&lt;/h2&gt;

&lt;p&gt;At full deflection only R limits the current. Closing the shunt key splits the current between S and the galvanometer; setting the galvanometer's share equal to exactly half of its full-deflection current, then solving for G, is what produces that minus sign — it falls out of current &lt;em&gt;division&lt;/em&gt;, not resistor combination.&lt;/p&gt;

&lt;p&gt;Why this method is safer than a direct reading: the galvanometer's own current never exceeds its full-scale value at any point in the procedure, since both readings (θ₁ and θ₁/2) are within its rated range by construction.&lt;/p&gt;

&lt;p&gt;Try it yourself: PractiSci's &lt;a href="https://www.practisci.in/labs/12-3-galvanometer-half-deflection" rel="noopener noreferrer"&gt;galvanometer half-deflection lab&lt;/a&gt; lets you dial in R and S and read both deflections on a simulated scale. More free labs: &lt;a href="https://www.practisci.in/practicals/class-12-physics" rel="noopener noreferrer"&gt;Class 12 physics practicals&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Full disclosure: I build PractiSci, a virtual physics and chemistry lab for Class 11-12.&lt;/p&gt;

</description>
      <category>physics</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>education</category>
    </item>
    <item>
      <title>Why a thermocouple's output bends over: the Seebeck effect's neutral temperature, in JavaScript</title>
      <dc:creator>Surendra Singh Kamboj</dc:creator>
      <pubDate>Thu, 03 Dec 2026 04:45:30 +0000</pubDate>
      <link>https://dev.to/surendrasinghkamboj/why-a-thermocouples-output-bends-over-the-seebeck-effects-neutral-temperature-in-javascript-324o</link>
      <guid>https://dev.to/surendrasinghkamboj/why-a-thermocouples-output-bends-over-the-seebeck-effects-neutral-temperature-in-javascript-324o</guid>
      <description>&lt;p&gt;A thermocouple's output voltage is not proportional to temperature difference the way Ohm's law is proportional to current. It is a parabola: it rises, flattens at a &lt;em&gt;neutral temperature&lt;/em&gt;, and would fall again past the &lt;em&gt;temperature of inversion&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.045&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// calibration constants, microvolt/degC&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;emf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;thermoPower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;150&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;250&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;355.6&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
  &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;emf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'microvolt'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'neutral temperature:'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'degC'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'thermoelectric power at 100C:'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;thermoPower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'microvolt/degC'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output climbs from 743.75 µV at 50°C to a maximum of 2844.44 µV at the neutral temperature of 355.6°C. The thermoelectric power (the slope dE/dt, which is what a real experiment actually plots) is +11.5 µV/°C at 100°C and exactly zero at the neutral temperature.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it matters for the experiment
&lt;/h2&gt;

&lt;p&gt;The thermoelectric power graph — not the raw emf — is usually what students are asked to find from readings at several temperatures, because it is linear (a + bt) even though the emf itself is curved. Fit a straight line through the dE/dt points, read off its intercept and slope, and you get a and b directly; from there the neutral temperature T_n = -a/b falls out immediately.&lt;/p&gt;

&lt;p&gt;With the cold junction at 0°C, the emf reverses sign at the temperature of inversion T_i = 2T_n: here, 711.2°C — well past where a school setup would ever push the hot junction, which is why the classroom graph only ever shows the rising half of the curve.&lt;/p&gt;

&lt;p&gt;Common mistake: assuming thermo-emf is linear in ΔT the way most other school formulas are. It isn't, and reading a bending graph as if it were straight is the easiest way to misjudge the neutral temperature.&lt;/p&gt;

&lt;p&gt;Try it yourself: PractiSci's &lt;a href="https://www.practisci.in/labs/12-3-thermocouple-seebeck" rel="noopener noreferrer"&gt;thermocouple Seebeck effect lab&lt;/a&gt; lets you pick the metal pair and watch the emf curve bend over live. More free labs: &lt;a href="https://www.practisci.in/practicals/class-12-physics" rel="noopener noreferrer"&gt;Class 12 physics practicals&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Full disclosure: I build PractiSci, a virtual physics and chemistry lab for Class 11-12.&lt;/p&gt;

</description>
      <category>physics</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>education</category>
    </item>
    <item>
      <title>Why an electron can't live inside a nucleus: the Heisenberg uncertainty principle in JavaScript</title>
      <dc:creator>Surendra Singh Kamboj</dc:creator>
      <pubDate>Thu, 03 Dec 2026 04:44:35 +0000</pubDate>
      <link>https://dev.to/surendrasinghkamboj/why-an-electron-cant-live-inside-a-nucleus-the-heisenberg-uncertainty-principle-in-javascript-419j</link>
      <guid>https://dev.to/surendrasinghkamboj/why-an-electron-cant-live-inside-a-nucleus-the-heisenberg-uncertainty-principle-in-javascript-419j</guid>
      <description>&lt;p&gt;Confine a particle to a smaller region and its momentum uncertainty goes up — not because of clumsy instruments, but because position and momentum simply cannot both be sharp at once. The rule is Δx·Δp ≥ ħ/2, and it rules out something you might expect to be possible: an electron permanently sitting inside a nucleus.&lt;/p&gt;

&lt;h2&gt;
  
  
  The code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;hbar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.054571817e-34&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// J.s&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;me&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;9.1093837015e-31&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// kg&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;minSpread&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;dp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hbar&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;dx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;dv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dp&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;me&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;dx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dv&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;minSpread&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1e-10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// electron confined to an atom&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;minSpread&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1e-14&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// electron confined to a nucleus&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Results:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Confined to an atom (Δx = 10⁻¹⁰ m): Δv_min ≈ &lt;strong&gt;5.79 × 10⁵ m/s&lt;/strong&gt; — fast, but far below light speed.&lt;/li&gt;
&lt;li&gt;Confined to a nucleus (Δx = 10⁻¹⁴ m): Δv_min ≈ &lt;strong&gt;5.79 × 10⁹ m/s&lt;/strong&gt; — about &lt;strong&gt;19 times the speed of light&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The second number is impossible, which is the point. An electron cannot be squeezed into a ~10 fm nucleus and still have a sensible velocity, so electrons are not permanent residents of the nucleus — in beta decay, the electron is created at the moment of emission, it does not escape from a pre-existing orbit inside.&lt;/p&gt;

&lt;h2&gt;
  
  
  The one-line takeaway
&lt;/h2&gt;

&lt;p&gt;Δp_min = ħ/(2Δx). Smaller box, bigger unavoidable momentum spread. It is not about measurement disturbing the particle — a particle simply does not have a sharply defined position and momentum together; that's built into the wave nature of matter.&lt;/p&gt;

&lt;p&gt;A cricket ball (150 g, Δx = 1 mm) has Δv_min around 10⁻³¹ m/s — the same law, just utterly unmeasurable at that mass. The principle only shows up where ħ competes with the numbers involved, which is atomic and nuclear scales.&lt;/p&gt;

&lt;p&gt;Try it yourself: PractiSci's &lt;a href="https://www.practisci.in/labs/12-11-uncertainty-principle" rel="noopener noreferrer"&gt;Heisenberg uncertainty principle lab&lt;/a&gt; fires single electrons through a slit and plots the diffraction pattern and the exact Δx·Δp/ħ ratio live. More free labs: &lt;a href="https://www.practisci.in/practicals/class-12-physics" rel="noopener noreferrer"&gt;Class 12 physics practicals&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Full disclosure: I build PractiSci, a virtual physics and chemistry lab for Class 11-12.&lt;/p&gt;

</description>
      <category>physics</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>education</category>
    </item>
    <item>
      <title>Two routes to the same NaOH + HCl reaction give the same -101.8 kJ/mol, checked in JavaScript (Hess's law)</title>
      <dc:creator>Surendra Singh Kamboj</dc:creator>
      <pubDate>Thu, 03 Dec 2026 03:36:02 +0000</pubDate>
      <link>https://dev.to/surendrasinghkamboj/two-routes-to-the-same-naoh-hcl-reaction-give-the-same-1018-kjmol-checked-in-javascript-4lol</link>
      <guid>https://dev.to/surendrasinghkamboj/two-routes-to-the-same-naoh-hcl-reaction-give-the-same-1018-kjmol-checked-in-javascript-4lol</guid>
      <description>&lt;p&gt;Dissolve solid NaOH in water, then neutralise the solution with HCl. Or just drop solid NaOH straight into dilute HCl. Different number of steps, identical total energy released — that is Hess's law in action, and here it is checked with real numbers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;dH1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;44.5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// NaOH(s) -&amp;gt; NaOH(aq), kJ/mol&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;dH2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;57.3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// NaOH(aq) + HCl(aq) -&amp;gt; NaCl(aq) + H2O(l), kJ/mol&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;dH_direct&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dH1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;dH2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"step 1, dissolving NaOH(s):"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dH1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"kJ/mol"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"step 2, neutralising with HCl:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dH2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"kJ/mol"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Hess's law total (direct NaOH(s) + HCl):"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dH_direct&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"kJ/mol"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;step 1, dissolving NaOH(s): -44.5 kJ/mol
step 2, neutralising with HCl: -57.3 kJ/mol
Hess's law total (direct NaOH(s) + HCl): -101.8 kJ/mol
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why the two routes agree
&lt;/h2&gt;

&lt;p&gt;Enthalpy only depends on the starting materials and the final products, never on the path taken between them — that is what makes it a state function. Solid NaOH plus dilute HCl ends up as the same aqueous NaCl solution whether you dissolve first and then neutralise, or just do it in one step, so the total heat released has to be the same: -101.8 kJ/mol, two different ways.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistake
&lt;/h2&gt;

&lt;p&gt;If a step in a Hess's-law cycle has to be run in reverse to fit the target equation, its ΔH sign must flip too before adding it in. Both steps here are already written in their natural forward direction, so this case is a straightforward sum — but it's the first thing to check whenever a cycle doesn't seem to add up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it in the lab
&lt;/h2&gt;

&lt;p&gt;I build PractiSci, a free interactive physics and chemistry lab for Class 11-12 (NCERT). The Hess's law with sodium hydroxide lab (&lt;a href="https://www.practisci.in/labs/chem-hess-law" rel="noopener noreferrer"&gt;https://www.practisci.in/labs/chem-hess-law&lt;/a&gt;) runs both reaction paths with a virtual calorimeter so you can watch them converge on the same number.&lt;/p&gt;

</description>
      <category>chemistry</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>education</category>
    </item>
    <item>
      <title>Decibels are logarithmic: a factory floor is 100,000,000x louder than a whisper, not 5x, in JavaScript</title>
      <dc:creator>Surendra Singh Kamboj</dc:creator>
      <pubDate>Thu, 03 Dec 2026 03:35:24 +0000</pubDate>
      <link>https://dev.to/surendrasinghkamboj/decibels-are-logarithmic-a-factory-floor-is-100000000x-louder-than-a-whisper-not-5x-in-1788</link>
      <guid>https://dev.to/surendrasinghkamboj/decibels-are-logarithmic-a-factory-floor-is-100000000x-louder-than-a-whisper-not-5x-in-1788</guid>
      <description>&lt;p&gt;20 dB (a whisper) and 100 dB (a factory floor) look only "80 apart" on a decibel meter. The actual sound intensity gap between them is a hundred million times. Decibels compress a huge range using a logarithm, and that is exactly why the numbers feel deceptively small.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;I0&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1e-12&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// threshold of hearing, W/m^2&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;toDecibels&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;I&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log10&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;I&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="no"&gt;I0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"1e-10 W/m^2 -&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;toDecibels&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1e-10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"dB"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"1e-6  W/m^2 -&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;toDecibels&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1e-6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"dB"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"1e-2  W/m^2 -&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;toDecibels&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1e-2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"dB"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1e-10 W/m^2 -&amp;gt; 20.0 dB
1e-6  W/m^2 -&amp;gt; 60.0 dB
1e-2  W/m^2 -&amp;gt; 100.0 dB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why it is deceptive
&lt;/h2&gt;

&lt;p&gt;Every extra 10 dB means the intensity has multiplied by 10, not added some fixed amount. Going from 20 dB to 100 dB is 8 jumps of ×10 — 10⁸, or 100,000,000. Distance matters too: under the inverse-square law, doubling your distance from a point source cuts the intensity to a quarter, which works out to roughly a 6 dB drop, no matter how loud the source started.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistake
&lt;/h2&gt;

&lt;p&gt;Two 80 dB machines running together do NOT make 160 dB — intensities add, levels do not. Two equal 80 dB sources together give about 83 dB, because you have to sum the actual intensities first and only then convert the total back to decibels.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it in the lab
&lt;/h2&gt;

&lt;p&gt;I build PractiSci, a free interactive physics and chemistry lab site for Class 11-12 students. The sound intensity, inverse-square law and decibels lab (&lt;a href="https://www.practisci.in/labs/11-14-sound-intensity-decibel" rel="noopener noreferrer"&gt;https://www.practisci.in/labs/11-14-sound-intensity-decibel&lt;/a&gt;) lets you move a source and watch intensity and decibel level update live at any distance.&lt;/p&gt;

</description>
      <category>physics</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>education</category>
    </item>
  </channel>
</rss>
