Skip to main content

Symbolic computation language for Python — pattern matching, algebraic simplification, and computational intelligence

Project description

MikoshiLang

MikoshiLang

Tests PyPI License Python

A symbolic computation language for Python — Wolfram-style syntax, pattern matching, algebraic simplification, and domain-specific packages for physics, chemistry, and signal processing.

Built by Mikoshi Ltd.

Why MikoshiLang?

Feature MikoshiLang SymPy Wolfram
Wolfram-style syntax (Sin[x], {1,2,3})
Pattern matching (x_, __, conditions) Limited
Rule-based rewriting engine Limited
Interactive REPL with In/Out history
Jupyter kernel with LaTeX rendering
Chemistry — 118 elements, equation balancing
Physics units with arithmetic & conversion
Signal processing (FFT, filters, spectrograms) Limited
Free & open source ❌ ($395/yr)
Python-native, pip installable

Key Selling Points

  • 🧪 Chemistry built-in — All 118 elements with atomic mass, electron configuration, electronegativity. Balance equations: BalanceEquation["H2 + O2 -> H2O"]"2H2 + O2 -> 2H2O". Calculate molecular mass: MolecularMass["C6H12O6"]180.156
  • ⚡ Wolfram syntax, Python ecosystem — Write Solve[x^2 - 4 == 0, x] not sympy.solve(sympy.Symbol('x')**2 - 4, sympy.Symbol('x')). Same power, 70% less typing
  • 🎯 Pattern matching — Real Wolfram-style patterns: f[x_] := x^2, blanks, sequences, conditions. Not regex — structural matching on expression trees
  • 📡 Signal processing — DFT, filters (low/high/band-pass), convolution, window functions, spectrograms — all from one import
  • 🔬 Physics units — 50+ units, quantity arithmetic that checks dimensions, automatic conversion: UnitConvert[Quantity[100, "cm"], "m"]
  • 📓 Jupyter kernel — LaTeX-rendered expressions, inline plots, proper notebook experience

Installation

pip install mikoshilang

# With Jupyter support
pip install mikoshilang[jupyter]

# With signal processing
pip install mikoshilang[signal]

# Everything
pip install mikoshilang[all]

Language Syntax

MikoshiLang uses Wolfram-style syntax. Launch the REPL:

mikoshilang

Arithmetic

In[1]:= 2 + 3 * x
Out[1]= 2 + 3*x

In[2]:= x^2 - 4
Out[2]= x^2 - 4

In[3]:= (x + 1)(x - 1)    (* implicit multiplication *)
Out[3]= (x + 1)*(x - 1)

Function Calls (Square Brackets)

In[1]:= Sin[Pi/2]
In[2]:= Diff[x^2, x]
In[3]:= Integrate[x^2, x]
In[4]:= Solve[x^2 - 4 == 0, x]
In[5]:= Simplify[(x^2 - 1)/(x - 1)]
In[6]:= Factor[x^2 - 4]
In[7]:= Expand[(x + 1)^3]
In[8]:= Limit[Sin[x]/x, x -> 0]
In[9]:= Series[Exp[x], {x, 0, 5}]

Lists and Data

In[1]:= {1, 2, 3, 4, 5}
In[2]:= Range[10]
In[3]:= Table[i^2, {i, 1, 10}]
In[4]:= Map[Sin, {1, 2, 3}]
In[5]:= Select[{1, -2, 3, -4}, Positive]

Matrices

In[1]:= Det[{{1, 2}, {3, 4}}]
Out[1]= -2

In[2]:= Inverse[{{1, 2}, {3, 4}}]

Pattern Matching and Rules

In[1]:= x /. x -> 3
In[2]:= f[x_] := x^2
In[3]:= MatchQ[Sin[x], Sin[_]]
In[4]:= ReplaceAll[x + y, {x -> 1, y -> 2}]

Constants

Pi, E, I, Infinity, True, False

Comments

(* This is a comment *)

Jupyter Integration

Install the kernel:

pip install mikoshilang[jupyter]
python -m mikoshilang.jupyter.install

Then open Jupyter Notebook and select the "MikoshiLang" kernel. Features:

  • LaTeX rendering of expressions
  • Inline matplotlib plots with Plot[Sin[x], {x, -Pi, Pi}]
  • Rich display of matrices and lists

Plotting

Plot[Sin[x], {x, -Pi, Pi}]
Plot[{Sin[x], Cos[x]}, {x, -Pi, Pi}]
ListPlot[{1, 4, 9, 16, 25}]
ListLinePlot[{1, 4, 9, 16, 25}]

Physics Units

In[1]:= q = Quantity[9.8, "m/s^2"]
In[2]:= t = Quantity[3, "s"]
In[3]:= q * t
Out[3]= Quantity[29.4, "m/s"]

In[4]:= UnitConvert[Quantity[100, "cm"], "m"]
Out[4]= Quantity[1, "m"]

In[5]:= UnitConvert[Quantity[72, "kg"], "lb"]
Out[5]= Quantity[158.73, "lb"]

Supported Units

Category Units
Length m, cm, mm, km, in, ft, yd, mi
Mass kg, g, mg, lb, oz
Time s, ms, min, h, day
Speed m/s, km/h, mph
Force N, lbf
Energy J, kJ, cal, kcal, eV, kWh
Power W, kW, hp
Pressure Pa, kPa, atm, bar, psi
Temperature K, C, F
Electric A, V, ohm, Farad, H, Coulomb, Hz

Physical Constants

SpeedOfLight, GravitationalConstant, PlanckConstant, BoltzmannConstant, AvogadroNumber, ElementaryCharge

Chemistry

In[1]:= Element["H"]
Out[1]= {name: "Hydrogen", number: 1, mass: 1.008, symbol: "H"}

In[2]:= AtomicMass["O"]
Out[2]= 15.999

In[3]:= ElectronConfiguration["Fe"]
Out[3]= [Ar] 3d6 4s2

In[4]:= MolecularMass["H2O"]
Out[4]= 18.015

In[5]:= MolecularMass["C6H12O6"]
Out[5]= 180.156

In[6]:= BalanceEquation["H2 + O2 -> H2O"]
Out[6]= 2H2 + O2 -> 2H2O

All 118 elements included with atomic number, symbol, name, mass, electron configuration, electronegativity, and category.

Signal Processing

Requires pip install mikoshilang[signal] for filters and spectrogram.

In[1]:= DFT[{1, 2, 3, 4}]
In[2]:= IDFT[{10, -2, -2, -2}]

In[3]:= Convolve[{1, 2, 3}, {0, 1, 0.5}]

In[4]:= HammingWindow[256]
In[5]:= HanningWindow[256]
In[6]:= BlackmanWindow[256]

(* Symbolic Fourier transforms via SymPy *)
In[7]:= FourierTransform[Exp[-t^2], t, w]

(* Filters (require scipy) *)
In[8]:= LowPassFilter[data, cutoff]
In[9]:= HighPassFilter[data, cutoff]
In[10]:= BandPassFilter[data, low, high]

In[11]:= Spectrogram[data, sample_rate]

Python API

from mikoshilang import *

# Parse and evaluate Wolfram-style syntax
result = parse_and_eval("Simplify[(x^2 - 1)/(x - 1)]")

# Or use Python constructors directly
x = Symbol("x")
expr = x**2 + 2*x + 1
print(simplify(expr))
print(to_latex(expr))

# Units
q = Quantity(100, "cm")
print(UnitConvert(q, "m"))

# Chemistry
print(MolecularMass("C6H12O6"))
print(BalanceEquation("H2 + O2 -> H2O"))

Feature Comparison with Wolfram

Feature Wolfram MikoshiLang
Symbolic algebra ✅ (via SymPy)
Pattern matching
Calculus
Linear algebra ✅ (via NumPy)
Number theory
Wolfram-style syntax
Jupyter notebooks
LaTeX output
Plotting ✅ (via Matplotlib)
Physics units
Chemistry ✅ (118 elements)
Signal processing ✅ (via SciPy)
Free & open source

License

Apache 2.0 — Mikoshi Ltd.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mikoshilang-0.3.0.tar.gz (62.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mikoshilang-0.3.0-py3-none-any.whl (50.8 kB view details)

Uploaded Python 3

File details

Details for the file mikoshilang-0.3.0.tar.gz.

File metadata

  • Download URL: mikoshilang-0.3.0.tar.gz
  • Upload date:
  • Size: 62.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.3

File hashes

Hashes for mikoshilang-0.3.0.tar.gz
Algorithm Hash digest
SHA256 902bec95690aba9823ebbe2e10ce2836ae058ec8d092c57e14d2503b41a75de1
MD5 265ae224fa30e451b93e9aea92fa261c
BLAKE2b-256 1dda70042893e01bda58d9b0c7f82170c35e97561e3111fbdf51267704f17f94

See more details on using hashes here.

File details

Details for the file mikoshilang-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: mikoshilang-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 50.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.3

File hashes

Hashes for mikoshilang-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39949318cb670bdf0c7e62d74621e25a9c48cd9bcfc9e74746b4d589f8c3aa81
MD5 793f6fa43cc17289ebfe63d64e05b311
BLAKE2b-256 a56a944a7173680c49ea215615afe67421f86759e741464b8580deaf2ae52522

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page