<?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: Alan Matthew</title>
    <description>The latest articles on DEV Community by Alan Matthew (@alan-matthew).</description>
    <link>https://dev.to/alan-matthew</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%2F4118963%2F9a4577c7-a028-42b0-b258-00ef08cb3d1b.png</url>
      <title>DEV Community: Alan Matthew</title>
      <link>https://dev.to/alan-matthew</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alan-matthew"/>
    <language>en</language>
    <item>
      <title>Punnett Square Simulator: Modeling Mendelian Inheritance and Hardy-Weinberg Equilibrium in JavaScript</title>
      <dc:creator>Alan Matthew</dc:creator>
      <pubDate>Thu, 10 Sep 2026 10:04:07 +0000</pubDate>
      <link>https://dev.to/alan-matthew/punnett-square-simulator-modeling-mendelian-inheritance-and-hardy-weinberg-equilibrium-in-23m9</link>
      <guid>https://dev.to/alan-matthew/punnett-square-simulator-modeling-mendelian-inheritance-and-hardy-weinberg-equilibrium-in-23m9</guid>
      <description>&lt;p&gt;Visualizing genetic allele distributions beyond simple single-gene traits can quickly become tedious when computing multi-gene combinatorial trees and phenotype ratios.&lt;/p&gt;

&lt;p&gt;To make genetics intuitive and interactive, I built a pure JavaScript inheritance simulator that models both cross variations and population dynamics.&lt;/p&gt;

&lt;h3&gt;
  
  
  How It Works
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cartesian Combinatorics:&lt;/strong&gt; The engine takes parental genotypes, determines all possible gamete configurations, and builds the full Cartesian product matrix (monohybrid $2 \times 2$, dihybrid $4 \times 4$).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dominance Mapping:&lt;/strong&gt; Evaluates complete, incomplete, and codominance allele interactions to output precise genotype and phenotype probability breakdowns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hardy-Weinberg Verification:&lt;/strong&gt; Runs chi-square goodness-of-fit testing against population genetics distributions ($p^2 + 2pq + q^2 = 1$) to verify theoretical equilibrium states.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Test out the simulator: &lt;a href="https://paysomeonetotakeonlineclass.us/tools/genetics-punnett-square-hardy-weinberg-simulator" rel="noopener noreferrer"&gt;Punnett Square Simulator&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What algorithmic models have you used to visualize biological simulations on the web? Discuss below!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Financial Amortization &amp; NPV Calculator</title>
      <dc:creator>Alan Matthew</dc:creator>
      <pubDate>Thu, 10 Sep 2026 09:54:53 +0000</pubDate>
      <link>https://dev.to/alan-matthew/financial-amortization-npv-calculator-43da</link>
      <guid>https://dev.to/alan-matthew/financial-amortization-npv-calculator-43da</guid>
      <description>&lt;p&gt;Calculating financial metrics like Net Present Value (NPV) and dynamic loan amortization schedules is straightforward. Calculating the Internal Rate of Return (IRR) across irregular cash flow intervals, however, requires numerical approximation.&lt;/p&gt;

&lt;p&gt;Here is how I implemented a fast, dependency-free financial modeling engine directly in the browser.&lt;/p&gt;

&lt;h3&gt;
  
  
  The IRR Convergence Algorithm
&lt;/h3&gt;

&lt;p&gt;Because IRR represents the discount rate where $NPV = 0$, solving for it cannot be done via simple algebraic rearrangement. The engine implements the &lt;strong&gt;Newton-Raphson method&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;$$r_{n+1} = r_n - \frac{f(r_n)}{f'(r_n)}$$&lt;/p&gt;

&lt;p&gt;Where $f(r)$ represents the NPV function and $f'(r)$ is its first derivative with respect to the discount rate $r$. The loop iterates until the difference drops below an error tolerance ($\epsilon &amp;lt; 10^{-7}$), converging reliably in milliseconds without blocking UI threads.&lt;/p&gt;

&lt;h3&gt;
  
  
  Built-in Capabilities
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Full month-by-month and year-by-year loan amortization schedules.&lt;/li&gt;
&lt;li&gt;Principal vs. interest repayment curves.&lt;/li&gt;
&lt;li&gt;Dynamic NPV and cash flow internal rate of return computations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Run your financial models live: &lt;a href="https://paysomeonetotakeonlineclass.us/tools/financial-amortization-npv-calculator" rel="noopener noreferrer"&gt;Financial Amortization &amp;amp; NPV Calculator&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What numerical methods do you rely on for browser-based financial calculations? Drop your thoughts below!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>fintech</category>
      <category>webdev</category>
      <category>math</category>
    </item>
    <item>
      <title>Building an AST-Driven Propositional Truth Table Generator in JavaScript</title>
      <dc:creator>Alan Matthew</dc:creator>
      <pubDate>Thu, 10 Sep 2026 09:50:14 +0000</pubDate>
      <link>https://dev.to/alan-matthew/building-an-ast-driven-propositional-truth-table-generator-in-javascript-2hgf</link>
      <guid>https://dev.to/alan-matthew/building-an-ast-driven-propositional-truth-table-generator-in-javascript-2hgf</guid>
      <description>&lt;p&gt;Writing a simple boolean parser using JavaScript's built-in &lt;code&gt;eval()&lt;/code&gt; is risky, error-prone, and doesn't support structured mathematical logic operators like material implication or biconditionals.&lt;/p&gt;

&lt;p&gt;I built a lightweight, client-side discrete logic generator that constructs an Abstract Syntax Tree (AST) to evaluate expressions step by step.&lt;/p&gt;

&lt;p&gt;How the Parser Works&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lexical Analysis:&lt;/strong&gt; The scanner tokenizes raw input strings, recognizing variables ($p, q, r$), parentheses, and logical operators (&lt;code&gt;AND&lt;/code&gt;, &lt;code&gt;OR&lt;/code&gt;, &lt;code&gt;NOT&lt;/code&gt;, &lt;code&gt;XOR&lt;/code&gt;, &lt;code&gt;IMPLIES&lt;/code&gt;, &lt;code&gt;EQUIV&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Operator Precedence:&lt;/strong&gt; Using the Shunting-Yard algorithm, infix notation is converted to an evaluation-ready syntax tree that preserves mathematical order of operations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exhaustive Evaluation:&lt;/strong&gt; The engine iterates across all $2^n$ binary permutations, evaluating truth values across intermediate subexpression branches.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Features&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Step-by-step intermediate truth table columns for verification.&lt;/li&gt;
&lt;li&gt;Automated detection of tautologies, contradictions, and contingencies.&lt;/li&gt;
&lt;li&gt;Fully client-side computation with zero latency.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Try the logic generator here: &lt;a href="https://paysomeonetotakeonlineclass.us/tools/truth-table-generator" rel="noopener noreferrer"&gt;Truth Table Generator&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What's your preferred approach for parsing nested logical grammar in JavaScript? Let me know in the comments!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Balancing Chemical Equations with Linear Algebra in Pure JavaScript</title>
      <dc:creator>Alan Matthew</dc:creator>
      <pubDate>Thu, 10 Sep 2026 09:46:01 +0000</pubDate>
      <link>https://dev.to/alan-matthew/balancing-chemical-equations-with-linear-algebra-in-pure-javascript-l9a</link>
      <guid>https://dev.to/alan-matthew/balancing-chemical-equations-with-linear-algebra-in-pure-javascript-l9a</guid>
      <description>&lt;p&gt;Balancing complex multi-phase chemical equations by inspection works for simple reactions, but it falls apart quickly when dealing with redox reactions and polyatomic complexes. &lt;/p&gt;

&lt;p&gt;To solve this deterministically in the browser without server calls, I built a client-side linear algebra solver tailored for chemistry.&lt;/p&gt;

&lt;p&gt;The Algorithm: Null-Space Vector Reduction&lt;br&gt;
Instead of using trial-and-error recursive search trees, the engine represents chemical conservation as an augmented system of linear equations:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Atomic Matrix Construction:&lt;/strong&gt; Every chemical formula is parsed into an element-frequency vector. Reactants carry negative values, while products carry positive values.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Matrix Normalization:&lt;/strong&gt; Using IUPAC 2021 standard atomic weights, molecular masses are compiled dynamically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Null-Space Kernel:&lt;/strong&gt; The balanced coefficients represent the non-trivial integer null space (kernel) of the composition matrix, solved via Gaussian elimination over rational numbers to prevent floating-point rounding issues.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What the Engine Handles&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Instant balancing for arbitrary chemical formulas.&lt;/li&gt;
&lt;li&gt;Limiting reactant determination based on input gram weights.&lt;/li&gt;
&lt;li&gt;Precise theoretical yield and excess reagent percentages.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Test the balancer live: &lt;a href="https://paysomeonetotakeonlineclass.us/tools/stoichiometry-equation-balancer" rel="noopener noreferrer"&gt;Stoichiometry &amp;amp; Equation Balancer&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have you tackled chemical formula tokenization in JavaScript before? Share your approach below!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
