{"html":{"scrollTop":0},"body":{"scrollTop":0},"#panel":{"tabIndex":-1},"#eq-compound_interest":{"open":true},"#eq-loan_payment":{"open":true},"#eq-net_present_value":{"open":true},"#eq-return_on_investment":{"open":true},"#eq-ohms_law":{"open":true},"#eq-projectile_motion":{"open":true},"#eq-hookes_law":{"open":true},"#eq-gravitational_force":{"open":true},"#eq-simple_pendulum":{"open":true},"#eq-quadratic_formula":{"open":true},"#eq-pythagorean_theorem":{"open":true},"#eq-distance_formula":{"open":true},"#eq-standard_deviation":{"open":true},"#eq-law_of_cosines":{"open":true},"#eq-shannon_entropy":{"open":true},"#eq-shannon_hartley":{"open":true},"#eq-bayes_theorem":{"open":true},"#eq-signal_noise_ratio":{"open":true},"#eq-ideal_gas_law":{"open":true},"#eq-rc_charging":{"open":true},"#eq-kinetic_energy":{"open":true},"#eq-doppler_effect":{"open":true},"#eq-thermal_expansion":{"open":true},"#eq-count":{"textContent":"24"},"#eq-vars":{"textContent":"66"},"#eq-outs":{"textContent":"57"},"meta":{"title":"Equation Reference","description":"Interactive calculators for finance, physics, math, information theory, and engineering."},"section":{"innerHTML":"<h1>Equation Reference</h1>\n\n<p>Auto-generated from <code>lib/equations.json</code> \u2014 <span id=\"eq-count\">0</span> equations, <span id=\"eq-vars\">0</span> variables, <span id=\"eq-outs\">0</span> outputs.</p>\n\n<div class=\"eq-reference\">\n<div class=\"eq-category\">\n  <details id=\"eq-compound_interest\" data-auto-open>\n    <summary><strong>Compound Interest (Finance)</strong></summary>\n    <p><strong>Formula:</strong> <code>A = P(1 + r/n)^(nt)</code></p>\n    <p><em>Growth of an investment with compound interest</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Principal</td><td><code>P</code></td><td>100 \u2013 100,000 $</td><td>10,000 $</td><td>Initial investment amount</td></tr>\n      <tr><td>Interest Rate</td><td><code>r</code></td><td>0.1000 \u2013 20 %</td><td>5 %</td><td>Annual interest rate</td></tr>\n      <tr><td>Compounds Per Year</td><td><code>n</code></td><td>1 \u2013 365 times</td><td>12 times</td><td>How often interest is compounded</td></tr>\n      <tr><td>Years</td><td><code>t</code></td><td>1 \u2013 50 years</td><td>10 years</td><td>Investment period</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Final Amount</strong><br><code>principal * Math.pow(1 + rate / (100 * compounds), compounds * years)</code></td><td>$</td><td>Total value after compounding</td></tr>\n      <tr><td><strong>Interest Earned</strong><br><code>principal * Math.pow(1 + rate / (100 * compounds), compounds * years) - principal</code></td><td>$</td><td>Total interest earned</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-loan_payment\" data-auto-open>\n    <summary><strong>Loan Amortization (Finance)</strong></summary>\n    <p><strong>Formula:</strong> <code>M = P \u00b7 [r(1+r)^n] / [(1+r)^n - 1]</code></p>\n    <p><em>Monthly payment for a fixed-rate amortizing loan</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Loan Amount</td><td><code>P</code></td><td>1,000 \u2013 500,000 $</td><td>200,000 $</td><td>Principal loan amount</td></tr>\n      <tr><td>Annual Interest Rate</td><td><code>r</code></td><td>0.5000 \u2013 15 %</td><td>6 %</td><td>Annual interest rate</td></tr>\n      <tr><td>Loan Term</td><td><code>n</code></td><td>1 \u2013 30 years</td><td>30 years</td><td>Loan term in years</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Monthly Payment</strong><br><code>loanAmount * (annualRate / 1200 * Math.pow(1 + annualRate / 1200, loanYears * 12)) / (Math.pow(1 + annualRate / 1200, loanYears * 12) - 1)</code></td><td>$</td><td>Fixed monthly payment (principal + interest)</td></tr>\n      <tr><td><strong>Total Paid</strong><br><code>(loanAmount * (annualRate / 1200 * Math.pow(1 + annualRate / 1200, loanYears * 12)) / (Math.pow(1 + annualRate / 1200, loanYears * 12) - 1)) * loanYears * 12</code></td><td>$</td><td>Total amount paid over full loan term</td></tr>\n      <tr><td><strong>Total Interest</strong><br><code>(loanAmount * (annualRate / 1200 * Math.pow(1 + annualRate / 1200, loanYears * 12)) / (Math.pow(1 + annualRate / 1200, loanYears * 12) - 1)) * loanYears * 12 - loanAmount</code></td><td>$</td><td>Total interest paid over loan term</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-net_present_value\" data-auto-open>\n    <summary><strong>Net Present Value (Finance)</strong></summary>\n    <p><strong>Formula:</strong> <code>NPV = CF / (1+r)^t - I</code></p>\n    <p><em>Present value of a future cash flow minus initial investment</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Initial Investment</td><td><code>I</code></td><td>-100,000 \u2013 100,000 $</td><td>10,000 $</td><td>Upfront cost or investment</td></tr>\n      <tr><td>Future Cash Flow</td><td><code>CF</code></td><td>0 \u2013 200,000 $</td><td>15,000 $</td><td>Expected future return</td></tr>\n      <tr><td>Discount Rate</td><td><code>r</code></td><td>0 \u2013 30 %</td><td>8 %</td><td>Required rate of return</td></tr>\n      <tr><td>Time Periods</td><td><code>t</code></td><td>1 \u2013 30 years</td><td>5 years</td><td>Number of years until cash flow</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Net Present Value</strong><br><code>cashFlow / Math.pow(1 + discountRate / 100, periods) - initialInvestment</code></td><td>$</td><td>NPV &gt; 0: investment adds value</td></tr>\n      <tr><td><strong>Present Value of CF</strong><br><code>cashFlow / Math.pow(1 + discountRate / 100, periods)</code></td><td>$</td><td>Future cash flow discounted to today</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-return_on_investment\" data-auto-open>\n    <summary><strong>Return on Investment (Finance)</strong></summary>\n    <p><strong>Formula:</strong> <code>ROI = (Gain - Cost) / Cost \u00d7 100</code></p>\n    <p><em>Profit relative to cost, expressed as percentage</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Cost of Investment</td><td><code>C</code></td><td>100 \u2013 100,000 $</td><td>5,000 $</td><td>Total amount invested</td></tr>\n      <tr><td>Final Value</td><td><code>G</code></td><td>0 \u2013 200,000 $</td><td>7,500 $</td><td>Total value received</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>ROI</strong><br><code>(finalValue - investmentCost) / investmentCost * 100</code></td><td>%</td><td>Return on Investment (positive = profit)</td></tr>\n      <tr><td><strong>Profit / Loss</strong><br><code>finalValue - investmentCost</code></td><td>$</td><td>Absolute gain or loss in dollars</td></tr>\n    </table>\n  </details>\n</div>\n<div class=\"eq-category\">\n  <details id=\"eq-ohms_law\" data-auto-open>\n    <summary><strong>Ohm&#039;s Law (Physics)</strong></summary>\n    <p><strong>Formula:</strong> <code>V = I \u00d7 R</code></p>\n    <p><em>Relationship between voltage, current, and resistance</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Current</td><td><code>I</code></td><td>0 \u2013 10 A</td><td>2 A</td><td>Electric current in Amperes</td></tr>\n      <tr><td>Resistance</td><td><code>R</code></td><td>1 \u2013 1,000 \u03a9</td><td>100 \u03a9</td><td>Electrical resistance in Ohms</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Voltage</strong><br><code>current * resistance</code></td><td>V</td><td>Electrical voltage in Volts</td></tr>\n      <tr><td><strong>Power Dissipated</strong><br><code>current * current * resistance</code></td><td>W</td><td>Power dissipated as heat (P = I\u00b2R)</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-projectile_motion\" data-auto-open>\n    <summary><strong>Projectile Motion (Physics)</strong></summary>\n    <p><strong>Formula:</strong> <code>R = (v\u2080\u00b2 \u00d7 sin(2\u03b8)) / g</code></p>\n    <p><em>Range of a projectile launched at an angle with initial velocity</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Initial Velocity</td><td><code>v\u2080</code></td><td>1 \u2013 100 m/s</td><td>20 m/s</td><td>Launch velocity</td></tr>\n      <tr><td>Launch Angle</td><td><code>\u03b8</code></td><td>0 \u2013 90 \u00b0</td><td>45 \u00b0</td><td>Angle from horizontal</td></tr>\n      <tr><td>Gravitational Acceleration</td><td><code>g</code></td><td>1 \u2013 50 m/s\u00b2</td><td>9.8100 m/s\u00b2</td><td>Gravity constant (Earth = 9.81)</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Range (Distance)</strong><br><code>velocity * velocity * Math.sin(2 * angle * Math.PI / 180) / gravity</code></td><td>m</td><td>Horizontal distance traveled</td></tr>\n      <tr><td><strong>Max Height</strong><br><code>velocity * velocity * Math.sin(angle * Math.PI / 180) * Math.sin(angle * Math.PI / 180) / (2 * gravity)</code></td><td>m</td><td>Maximum height reached</td></tr>\n      <tr><td><strong>Flight Time</strong><br><code>2 * velocity * Math.sin(angle * Math.PI / 180) / gravity</code></td><td>s</td><td>Total time in the air</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-hookes_law\" data-auto-open>\n    <summary><strong>Hooke&#039;s Law (Physics)</strong></summary>\n    <p><strong>Formula:</strong> <code>F = -k \u00b7 x</code></p>\n    <p><em>Force exerted by an ideal spring: F = -kx</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Spring Constant</td><td><code>k</code></td><td>1 \u2013 500 N/m</td><td>100 N/m</td><td>Stiffness of the spring</td></tr>\n      <tr><td>Displacement</td><td><code>x</code></td><td>-2 \u2013 2 m</td><td>0.5000 m</td><td>Distance stretched or compressed from equilibrium</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Restoring Force</strong><br><code>-(springConstant * displacement)</code></td><td>N</td><td>Force exerted by the spring (negative = opposite to displacement)</td></tr>\n      <tr><td><strong>Force Magnitude</strong><br><code>Math.abs(springConstant * displacement)</code></td><td>N</td><td>Absolute magnitude of the spring force</td></tr>\n      <tr><td><strong>Elastic Potential Energy</strong><br><code>0.5 * springConstant * displacement * displacement</code></td><td>J</td><td>Energy stored in the spring (PE = \u00bdkx\u00b2)</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-gravitational_force\" data-auto-open>\n    <summary><strong>Newton&#039;s Gravitation (Physics)</strong></summary>\n    <p><strong>Formula:</strong> <code>F = G \u00b7 m\u2081 \u00b7 m\u2082 / r\u00b2</code></p>\n    <p><em>Gravitational force between two masses: F = G\u00b7m\u2081\u00b7m\u2082/r\u00b2</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Mass 1</td><td><code>m\u2081</code></td><td>10 \u2013 1,000,000,000,000 kg</td><td>1,000 kg</td><td>Mass of first object</td></tr>\n      <tr><td>Mass 2</td><td><code>m\u2082</code></td><td>10 \u2013 1,000,000,000,000 kg</td><td>1,000 kg</td><td>Mass of second object</td></tr>\n      <tr><td>Distance</td><td><code>r</code></td><td>1 \u2013 1,000 m</td><td>10 m</td><td>Distance between centers of mass</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Gravitational Force</strong><br><code>6.674e-11 * mass1 * mass2 / (distance * distance)</code></td><td>N</td><td>Force of gravitational attraction</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-simple_pendulum\" data-auto-open>\n    <summary><strong>Simple Pendulum (Physics)</strong></summary>\n    <p><strong>Formula:</strong> <code>T = 2\u03c0\u221a(L/g)</code></p>\n    <p><em>Period of a simple pendulum for small-angle oscillations</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Length</td><td><code>L</code></td><td>0.1000 \u2013 10 m</td><td>1 m</td><td>Length of the pendulum</td></tr>\n      <tr><td>Gravitational Acceleration</td><td><code>g</code></td><td>0.5000 \u2013 25 m/s\u00b2</td><td>9.8100 m/s\u00b2</td><td>Local gravity (Earth = 9.81)</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Period T</strong><br><code>2 * Math.PI * Math.sqrt(pendulumLength / pendulumGravity)</code></td><td>s</td><td>Time for one complete swing</td></tr>\n      <tr><td><strong>Frequency f</strong><br><code>1 / (2 * Math.PI * Math.sqrt(pendulumLength / pendulumGravity))</code></td><td>Hz</td><td>Oscillations per second</td></tr>\n    </table>\n  </details>\n</div>\n<div class=\"eq-category\">\n  <details id=\"eq-quadratic_formula\" data-auto-open>\n    <summary><strong>Quadratic Formula (Math)</strong></summary>\n    <p><strong>Formula:</strong> <code>x = (-b \u00b1 \u221a(b\u00b2 - 4ac)) / 2a</code></p>\n    <p><em>Solutions to ax\u00b2 + bx + c = 0</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Coefficient a</td><td><code>a</code></td><td>-10 \u2013 10</td><td>1</td><td>Coefficient of x\u00b2</td></tr>\n      <tr><td>Coefficient b</td><td><code>b</code></td><td>-20 \u2013 20</td><td>-5</td><td>Coefficient of x</td></tr>\n      <tr><td>Constant term</td><td><code>c</code></td><td>-20 \u2013 20</td><td>6</td><td>Constant term</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Discriminant</strong><br><code>b*b - 4*a*c</code></td><td></td><td>b\u00b2 - 4ac (negative = complex roots)</td></tr>\n      <tr><td><strong>Root 1</strong><br><code>(-b + Math.sqrt(Math.abs(b*b - 4*a*c))) / (2*a)</code></td><td></td><td>First solution (real part)</td></tr>\n      <tr><td><strong>Root 2</strong><br><code>(-b - Math.sqrt(Math.abs(b*b - 4*a*c))) / (2*a)</code></td><td></td><td>Second solution (real part)</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-pythagorean_theorem\" data-auto-open>\n    <summary><strong>Pythagorean Theorem (Math)</strong></summary>\n    <p><strong>Formula:</strong> <code>c = \u221a(a\u00b2 + b\u00b2)</code></p>\n    <p><em>Relationship between sides of a right triangle: a\u00b2 + b\u00b2 = c\u00b2</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Side a</td><td><code>a</code></td><td>0.1000 \u2013 20</td><td>3</td><td>Length of first leg</td></tr>\n      <tr><td>Side b</td><td><code>b</code></td><td>0.1000 \u2013 20</td><td>4</td><td>Length of second leg</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Hypotenuse c</strong><br><code>Math.sqrt(sideA * sideA + sideB * sideB)</code></td><td></td><td>Length of the hypotenuse</td></tr>\n      <tr><td><strong>Area</strong><br><code>0.5 * sideA * sideB</code></td><td>u\u00b2</td><td>Area of the right triangle</td></tr>\n      <tr><td><strong>Perimeter</strong><br><code>sideA + sideB + Math.sqrt(sideA * sideA + sideB * sideB)</code></td><td></td><td>Perimeter of the triangle</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-distance_formula\" data-auto-open>\n    <summary><strong>2D Distance Formula (Math)</strong></summary>\n    <p><strong>Formula:</strong> <code>d = \u221a((x\u2082-x\u2081)\u00b2 + (y\u2082-y\u2081)\u00b2)</code></p>\n    <p><em>Distance between two points in the Cartesian plane</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Point 1 \u2014 x</td><td><code>x\u2081</code></td><td>-10 \u2013 10</td><td>0</td><td>x-coordinate of first point</td></tr>\n      <tr><td>Point 1 \u2014 y</td><td><code>y\u2081</code></td><td>-10 \u2013 10</td><td>0</td><td>y-coordinate of first point</td></tr>\n      <tr><td>Point 2 \u2014 x</td><td><code>x\u2082</code></td><td>-10 \u2013 10</td><td>3</td><td>x-coordinate of second point</td></tr>\n      <tr><td>Point 2 \u2014 y</td><td><code>y\u2082</code></td><td>-10 \u2013 10</td><td>4</td><td>y-coordinate of second point</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Distance</strong><br><code>Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))</code></td><td></td><td>Euclidean distance between points</td></tr>\n      <tr><td><strong>Midpoint \u2014 x</strong><br><code>(x1 + x2) / 2</code></td><td></td><td>x-coordinate of the midpoint</td></tr>\n      <tr><td><strong>Midpoint \u2014 y</strong><br><code>(y1 + y2) / 2</code></td><td></td><td>y-coordinate of the midpoint</td></tr>\n      <tr><td><strong>Slope</strong><br><code>(y2 - y1) / (x2 - x1)</code></td><td></td><td>Slope of the line (undefined if vertical)</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-standard_deviation\" data-auto-open>\n    <summary><strong>Standard Deviation (Math)</strong></summary>\n    <p><strong>Formula:</strong> <code>\u03c3 = \u221a(\u03a3(x-\u03bc)\u00b2 / n)</code></p>\n    <p><em>Measure of spread in a small dataset (3 values)</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Value 1</td><td><code>x\u2081</code></td><td>-50 \u2013 50</td><td>10</td><td>First data point</td></tr>\n      <tr><td>Value 2</td><td><code>x\u2082</code></td><td>-50 \u2013 50</td><td>20</td><td>Second data point</td></tr>\n      <tr><td>Value 3</td><td><code>x\u2083</code></td><td>-50 \u2013 50</td><td>30</td><td>Third data point</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Mean (\u03bc)</strong><br><code>(d1 + d2 + d3) / 3</code></td><td></td><td>Arithmetic mean of the dataset</td></tr>\n      <tr><td><strong>Std Dev (\u03c3)</strong><br><code>Math.sqrt(((d1 - (d1 + d2 + d3) / 3) * (d1 - (d1 + d2 + d3) / 3) + (d2 - (d1 + d2 + d3) / 3) * (d2 - (d1 + d2 + d3) / 3) + (d3 - (d1 + d2 + d3) / 3) * (d3 - (d1 + d2 + d3) / 3)) / 3)</code></td><td></td><td>Population standard deviation</td></tr>\n      <tr><td><strong>Variance (\u03c3\u00b2)</strong><br><code>((d1 - (d1 + d2 + d3) / 3) * (d1 - (d1 + d2 + d3) / 3) + (d2 - (d1 + d2 + d3) / 3) * (d2 - (d1 + d2 + d3) / 3) + (d3 - (d1 + d2 + d3) / 3) * (d3 - (d1 + d2 + d3) / 3)) / 3</code></td><td></td><td>Population variance</td></tr>\n      <tr><td><strong>Range</strong><br><code>Math.max(d1, d2, d3) - Math.min(d1, d2, d3)</code></td><td></td><td>Max - Min</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-law_of_cosines\" data-auto-open>\n    <summary><strong>Law of Cosines (Math)</strong></summary>\n    <p><strong>Formula:</strong> <code>c\u00b2 = a\u00b2 + b\u00b2 - 2ab\u00b7cos(C)</code></p>\n    <p><em>Find the third side of a triangle given two sides and the included angle</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Side a</td><td><code>a</code></td><td>0.1000 \u2013 20</td><td>5</td><td>Length of side a</td></tr>\n      <tr><td>Side b</td><td><code>b</code></td><td>0.1000 \u2013 20</td><td>7</td><td>Length of side b</td></tr>\n      <tr><td>Angle C</td><td><code>C</code></td><td>0 \u2013 180 \u00b0</td><td>60 \u00b0</td><td>Included angle between sides a and b</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Side c</strong><br><code>Math.sqrt(sideA * sideA + sideB * sideB - 2 * sideA * sideB * Math.cos(angleC * Math.PI / 180))</code></td><td></td><td>Length of side opposite angle C</td></tr>\n      <tr><td><strong>Triangle Area</strong><br><code>0.5 * sideA * sideB * Math.sin(angleC * Math.PI / 180)</code></td><td>u\u00b2</td><td>Area using formula A = \u00bdab\u00b7sin(C)</td></tr>\n    </table>\n  </details>\n</div>\n<div class=\"eq-category\">\n  <details id=\"eq-shannon_entropy\" data-auto-open>\n    <summary><strong>Shannon Entropy (Info Theory)</strong></summary>\n    <p><strong>Formula:</strong> <code>H = -p \u00b7 log\u2082(p) - (1-p) \u00b7 log\u2082(1-p)</code></p>\n    <p><em>Information content of a binary source \u2014 maximum at p = 0.5</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Probability of 1</td><td><code>p</code></td><td>0.0100 \u2013 0.9900</td><td>0.5000</td><td>Probability of the outcome being 1 (vs 0)</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Entropy H</strong><br><code>-(p * Math.log2(p) + (1 - p) * Math.log2(1 - p))</code></td><td>bits</td><td>Average information content per symbol</td></tr>\n      <tr><td><strong>Redundancy</strong><br><code>1 - (-(p * Math.log2(p) + (1 - p) * Math.log2(1 - p)))</code></td><td></td><td>Redundancy relative to maximum entropy (1 bit)</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-shannon_hartley\" data-auto-open>\n    <summary><strong>Shannon-Hartley Theorem (Info Theory)</strong></summary>\n    <p><strong>Formula:</strong> <code>C = B \u00b7 log\u2082(1 + S/N)</code></p>\n    <p><em>Maximum data rate over a noisy channel</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Bandwidth</td><td><code>B</code></td><td>100 \u2013 20,000 Hz</td><td>3,000 Hz</td><td>Channel bandwidth in Hertz</td></tr>\n      <tr><td>Signal-to-Noise Ratio</td><td><code>S/N</code></td><td>1 \u2013 1,000</td><td>31.6000</td><td>Linear signal-to-noise ratio (not dB)</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Channel Capacity</strong><br><code>bandwidth * Math.log2(1 + snrLinear)</code></td><td>bit/s</td><td>Maximum theoretical data rate</td></tr>\n      <tr><td><strong>SNR (dB)</strong><br><code>10 * Math.log10(snrLinear)</code></td><td>dB</td><td>Equivalent SNR in decibels</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-bayes_theorem\" data-auto-open>\n    <summary><strong>Bayes&#039; Theorem (Info Theory)</strong></summary>\n    <p><strong>Formula:</strong> <code>P(A|B) = P(B|A)\u00b7P(A) / (P(B|A)\u00b7P(A) + P(B|\u00acA)\u00b7(1-P(A)))</code></p>\n    <p><em>Posterior probability given prior, likelihood, and false positive rate</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Prior Probability P(A)</td><td><code>P(A)</code></td><td>0.0010 \u2013 0.5000</td><td>0.0100</td><td>Base rate of the condition</td></tr>\n      <tr><td>Likelihood P(B|A)</td><td><code>P(B|A)</code></td><td>0.5000 \u2013 1</td><td>0.9500</td><td>Probability of positive test given condition</td></tr>\n      <tr><td>False Positive Rate P(B|\u00acA)</td><td><code>P(B|\u00acA)</code></td><td>0.0010 \u2013 0.5000</td><td>0.0500</td><td>Probability of positive test given no condition</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Posterior P(A|B)</strong><br><code>(likelihood * prior) / (likelihood * prior + falsePositive * (1 - prior))</code></td><td></td><td>Probability of condition given positive test</td></tr>\n      <tr><td><strong>Positive Predictive Value</strong><br><code>((likelihood * prior) / (likelihood * prior + falsePositive * (1 - prior))) * 100</code></td><td>%</td><td>PPV \u2014 same as posterior, expressed as percentage</td></tr>\n    </table>\n  </details>\n</div>\n<div class=\"eq-category\">\n  <details id=\"eq-signal_noise_ratio\" data-auto-open>\n    <summary><strong>Signal-to-Noise Ratio (Engineering)</strong></summary>\n    <p><strong>Formula:</strong> <code>SNR_dB = 10 \u00b7 log\u2081\u2080(S / N)</code></p>\n    <p><em>Ratio of signal power to noise power in decibels</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Signal Power</td><td><code>S</code></td><td>0.1000 \u2013 100 W</td><td>10 W</td><td>Power of the signal</td></tr>\n      <tr><td>Noise Power</td><td><code>N</code></td><td>0.0100 \u2013 10 W</td><td>0.1000 W</td><td>Power of the noise floor</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>SNR (dB)</strong><br><code>10 * Math.log10(signalPower / noisePower)</code></td><td>dB</td><td>Signal-to-noise ratio in decibels</td></tr>\n      <tr><td><strong>SNR (Linear)</strong><br><code>signalPower / noisePower</code></td><td></td><td>Signal-to-noise ratio as a linear ratio</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-ideal_gas_law\" data-auto-open>\n    <summary><strong>Ideal Gas Law (Engineering)</strong></summary>\n    <p><strong>Formula:</strong> <code>P = nRT / V</code></p>\n    <p><em>Pressure of an ideal gas: PV = nRT \u2014 R = 8.314 J/(mol\u00b7K)</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Amount of Substance</td><td><code>n</code></td><td>0.1000 \u2013 10 mol</td><td>1 mol</td><td>Number of moles of gas</td></tr>\n      <tr><td>Temperature</td><td><code>T</code></td><td>100 \u2013 1,000 K</td><td>300 K</td><td>Absolute temperature in Kelvin</td></tr>\n      <tr><td>Volume</td><td><code>V</code></td><td>0.0010 \u2013 1 m\u00b3</td><td>0.0250 m\u00b3</td><td>Volume of the container</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Pressure</strong><br><code>moles * 8.314 * temperature / volume</code></td><td>Pa</td><td>Pressure in Pascals</td></tr>\n      <tr><td><strong>Pressure (atm)</strong><br><code>moles * 8.314 * temperature / volume / 101325</code></td><td>atm</td><td>Pressure in atmospheres</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-rc_charging\" data-auto-open>\n    <summary><strong>RC Circuit Charging (Engineering)</strong></summary>\n    <p><strong>Formula:</strong> <code>V(t) = V\u2080 \u00b7 (1 - e^(-t / RC))</code></p>\n    <p><em>Voltage across a capacitor as it charges through a resistor</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Source Voltage</td><td><code>V\u2080</code></td><td>1 \u2013 100 V</td><td>12 V</td><td>Applied voltage</td></tr>\n      <tr><td>Resistance</td><td><code>R</code></td><td>100 \u2013 100,000 \u03a9</td><td>10,000 \u03a9</td><td>Series resistance</td></tr>\n      <tr><td>Capacitance</td><td><code>C</code></td><td>0.0000 \u2013 0.0010 F</td><td>0.0001 F</td><td>Capacitor value</td></tr>\n      <tr><td>Time Elapsed</td><td><code>t</code></td><td>0 \u2013 5 s</td><td>0.5000 s</td><td>Time since charging began</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Capacitor Voltage</strong><br><code>sourceVoltage * (1 - Math.exp(-time / (resistance * capacitance)))</code></td><td>V</td><td>Voltage across the capacitor</td></tr>\n      <tr><td><strong>Time Constant \u03c4</strong><br><code>resistance * capacitance</code></td><td>s</td><td>RC time constant (time to reach 63.2%)</td></tr>\n      <tr><td><strong>Percent Charged</strong><br><code>(1 - Math.exp(-time / (resistance * capacitance))) * 100</code></td><td>%</td><td>Percentage of final voltage reached</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-kinetic_energy\" data-auto-open>\n    <summary><strong>Kinetic Energy (Engineering)</strong></summary>\n    <p><strong>Formula:</strong> <code>KE = \u00bd \u00b7 m \u00b7 v\u00b2</code></p>\n    <p><em>Energy of a moving object: KE = \u00bdmv\u00b2</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Mass</td><td><code>m</code></td><td>0.1000 \u2013 1,000 kg</td><td>10 kg</td><td>Mass of the object</td></tr>\n      <tr><td>Velocity</td><td><code>v</code></td><td>0 \u2013 100 m/s</td><td>20 m/s</td><td>Speed of the object</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Kinetic Energy</strong><br><code>0.5 * mass * velocity * velocity</code></td><td>J</td><td>Kinetic energy in Joules</td></tr>\n      <tr><td><strong>Momentum</strong><br><code>mass * velocity</code></td><td>kg\u00b7m/s</td><td>Linear momentum</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-doppler_effect\" data-auto-open>\n    <summary><strong>Doppler Effect (Engineering)</strong></summary>\n    <p><strong>Formula:</strong> <code>f&#039; = f \u00b7 (v_sound + v_observer) / v_sound</code></p>\n    <p><em>Observed frequency when observer moves toward a stationary source</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Source Frequency</td><td><code>f</code></td><td>100 \u2013 2,000 Hz</td><td>440 Hz</td><td>Frequency emitted by the source</td></tr>\n      <tr><td>Speed of Sound</td><td><code>v</code></td><td>100 \u2013 500 m/s</td><td>343 m/s</td><td>Speed of sound in the medium</td></tr>\n      <tr><td>Observer Speed</td><td><code>v\u2080</code></td><td>0 \u2013 100 m/s</td><td>15 m/s</td><td>Speed of observer moving toward source</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Observed Frequency</strong><br><code>sourceFreq * (soundSpeed + observerSpeed) / soundSpeed</code></td><td>Hz</td><td>Perceived frequency (higher than source when approaching)</td></tr>\n      <tr><td><strong>Frequency Shift</strong><br><code>sourceFreq * (soundSpeed + observerSpeed) / soundSpeed - sourceFreq</code></td><td>Hz</td><td>Change in frequency (\u0394f)</td></tr>\n    </table>\n  </details>\n  <details id=\"eq-thermal_expansion\" data-auto-open>\n    <summary><strong>Thermal Linear Expansion (Engineering)</strong></summary>\n    <p><strong>Formula:</strong> <code>\u0394L = \u03b1 \u00b7 L\u2080 \u00b7 \u0394T</code></p>\n    <p><em>Change in length of a material due to temperature change</em></p>\n    <h4>Inputs</h4>\n    <table>\n      <tr><th>Variable</th><th>Symbol</th><th>Range</th><th>Default</th><th>Description</th></tr>\n      <tr><td>Expansion Coefficient</td><td><code>\u03b1</code></td><td>1 \u2013 50 \u00d710\u207b\u2076/K</td><td>12 \u00d710\u207b\u2076/K</td><td>Linear thermal expansion coefficient (\u00d710\u207b\u2076)</td></tr>\n      <tr><td>Initial Length</td><td><code>L\u2080</code></td><td>1 \u2013 100 m</td><td>10 m</td><td>Original length of the material</td></tr>\n      <tr><td>Temperature Change</td><td><code>\u0394T</code></td><td>-100 \u2013 500 K</td><td>50 K</td><td>Change in temperature</td></tr>\n    </table>\n    <h4>Outputs</h4>\n    <table>\n      <tr><th>Output</th><th>Unit</th><th>Description</th></tr>\n      <tr><td><strong>Length Change</strong><br><code>coefficient * 0.000001 * initialLength * tempChange</code></td><td>m</td><td>Change in length (\u0394L)</td></tr>\n      <tr><td><strong>Length Change</strong><br><code>coefficient * 0.000001 * initialLength * tempChange * 1000</code></td><td>mm</td><td>Change in length in millimeters</td></tr>\n      <tr><td><strong>Final Length</strong><br><code>initialLength + coefficient * 0.000001 * initialLength * tempChange</code></td><td>m</td><td>Length after thermal change</td></tr>\n    </table>\n  </details>\n</div>\n</div>\n\n<p>Interactive calculators for finance, physics, math, information theory, and engineering.</p>\n<p>The <strong>Equation Visualizer</strong> in the sidebar lets you interact with all <span id=\"eq-count\">0</span> equations using sliders. This page is a static reference generated from the same data.</p>\n<p><em>See also: <a href=\"/projects\">Interactive demo on the projects page \u2192</a></em></p>"}}