<?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: Yash Matrani</title>
    <description>The latest articles on DEV Community by Yash Matrani (@yashdevelopers).</description>
    <link>https://dev.to/yashdevelopers</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%2F4179339%2Ff4516e6d-0681-43a0-bc35-0454643dd616.png</url>
      <title>DEV Community: Yash Matrani</title>
      <link>https://dev.to/yashdevelopers</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yashdevelopers"/>
    <language>en</language>
    <item>
      <title>How I built a symbolic log inequality solver as a 16-year-old</title>
      <dc:creator>Yash Matrani</dc:creator>
      <pubDate>Mon, 12 Oct 2026 12:38:37 +0000</pubDate>
      <link>https://dev.to/yashdevelopers/how-i-built-a-symbolic-log-inequality-solver-as-a-16-year-old-1ml7</link>
      <guid>https://dev.to/yashdevelopers/how-i-built-a-symbolic-log-inequality-solver-as-a-16-year-old-1ml7</guid>
      <description>&lt;p&gt;Logarithmic inequalities are annoying.&lt;/p&gt;

&lt;p&gt;Not because they're hard — but because most solvers skip the domain constraints. They give you the answer, you trust it, and then you realize the base was invalid the whole time.&lt;/p&gt;

&lt;p&gt;So I built my own. In Python. Using SymPy.&lt;/p&gt;

&lt;p&gt;I'm 16, and this is my first serious symbolic math project.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Variable-base log inequalities like:&lt;br&gt;
log(x-1)(x+1) &amp;lt; 2&lt;/p&gt;

&lt;p&gt;Here the base itself is &lt;code&gt;(x-1)&lt;/code&gt;, which means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Base must be &amp;gt; 0&lt;/li&gt;
&lt;li&gt;Base must ≠ 1&lt;/li&gt;
&lt;li&gt;Argument must be &amp;gt; 0&lt;/li&gt;
&lt;li&gt;Then solve the inequality&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Most online solvers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Skip domain constraints&lt;/li&gt;
&lt;li&gt;Assume base &amp;gt; 1 only&lt;/li&gt;
&lt;li&gt;Miss the 0 &amp;lt; base &amp;lt; 1 case&lt;/li&gt;
&lt;li&gt;Return wrong or incomplete answers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I got tired of checking manually. So I wrote a script that does it properly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Approach
&lt;/h2&gt;

&lt;p&gt;Using SymPy's &lt;code&gt;solve_univariate_inequality&lt;/code&gt;, the script:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Extracts free symbols from the base&lt;/li&gt;
&lt;li&gt;Splits into cases: base &amp;gt; 1 and 0 &amp;lt; base &amp;lt; 1&lt;/li&gt;
&lt;li&gt;Applies domain constraints (base &amp;gt; 0, base ≠ 1)&lt;/li&gt;
&lt;li&gt;Solves each case symbolically&lt;/li&gt;
&lt;li&gt;Returns the union of solution sets&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here's the core logic:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
python
import sympy as sy

x = sy.Symbol('x')

def base_A(base):
    if x in base.free_symbols:
        return sy.solve_univariate_inequality(
            sy.And(base &amp;gt; 0, base != 1),
            x,
            relational=False
        )
    else:
        return base
The rest handles case splitting, domain checks, and union of intervals.

What I Learned
1. Symbolic math is different from numerical.
math.sqrt(2) gives 1.414.... SymPy gives sqrt(2) — exact.

2. Domain constraints matter more than the equation.
Most people solve the inequality, forget the domain, and get it wrong.

3. Edge cases break everything.
Base = 1? Base = 0? Base negative? Each one is a different failure mode.

4. SymPy is underrated.
Python devs use it for scripts. It's built for math.

What's Next
Add support for nested logarithms

Build a CLI interface with argument parsing

Maybe a web version with Streamlit

Links
Source code: Gumroad

GitHub: github.com/yashmatrani-cpu/My-Projects

X: @Developervxku

I'm still learning. Feedback welcome — especially from anyone who's worked with SymPy or symbolic solvers.

Thanks for reading.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>python</category>
      <category>math</category>
      <category>showdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
