Skip to main content

equid

下の方に日本語の説明があります

Overview

  • Solving library for simultaneous equations and inequalities

Usage

import equid as eq

# Example of solving an equation
res = eq.solve(cond = (eq.x + 3 == 5))
print(res)	# -> {"x": 2.0}

# Inequalities and series are also possible. If there is more than one solution, one is randomly chosen.
cond = (
	(eq.x + 2 == eq.y) &
	(eq.x >= 10)
)
res = eq.solve(cond = cond)
print(res)	# -> e.g. {"x": 10.0, "y": 12.0}

# Assign
print((eq.x + 5).fix(x = 3))	# -> 8
print((5 + eq.x + eq.y).fix(x = 3))	# -> (+ 8 (var y))

# Mathematical programming (find the one with the smallest loss among those satisfying cond)
res = eq.solve(cond = (3 * eq.x - eq.y == 0),
	loss = (eq.y - 1) ** 2)
print(res)	# -> {"x": 0.333, "y": 1}

# convert to javascript code
print(eq.to_js((3 + eq.x) ** 2))	# -> Running "(OUTPUT_STR({x: 1}))" in javascript will output 16.

# Algorithmic differentiation (automatic differentiation)
print((eq.x ** 2).diff("x")) # -> (* 2 (var x))

# Interconversion between json format and equid object
formula = (3 + eq.x) ** 2
print(formula.to_json())	# -> ["**", ["+", 3, ["var", "x"]], 2]
print(eq.from_json('["**", ["+", 3, ["var", "x"]], 2]'))	# -> Formula object

Advanced Usage

# 執筆中 (under_construction)

概略

  • 連立方程式/不等式の求解ライブラリ

利用例

import equid as eq

# 方程式を解く例
res = eq.solve(cond = (eq.x + 3 == 5))
print(res)	# -> {"x": 2.0}

# 不等式・連立もできる。解が複数あるときはひとつ選ばれる
cond = (
	(eq.x + 2 == eq.y) &
	(eq.x >= 10)
)
res = eq.solve(cond = cond)
print(res)	# -> 例えば{"x": 10.0, "y": 12.0}

# 代入
print((eq.x + 5).fix(x = 3))	# -> 8
print((5 + eq.x + eq.y).fix(x = 3))	# -> (+ 8 (var y))

# 数理計画 (condを満たす中でlossが最小のものを見つける)
res = eq.solve(cond = (3 * eq.x - eq.y == 0),
	loss = (eq.y - 1) ** 2)
print(res)	# -> {"x": 0.333, "y": 1}

# javascriptコードに変換
print(eq.to_js((3 + eq.x) ** 2))	# -> 「(出てきた文字列)({x: 1})」をjavascriptで実行すると16を出力する

# アルゴリズム的微分 (自動微分)
print((eq.x ** 2).diff("x")) # -> (* 2 (var x))

# json形式とequidオブジェクトの相互変換
formula = (3 + eq.x) ** 2
print(formula.to_json())	# -> ["**", ["+", 3, ["var", "x"]], 2]
print(eq.from_json('["**", ["+", 3, ["var", "x"]], 2]'))	# -> Formula object

発展的な利用例

# 執筆中 (under_construction)

Metadata

Release files for equid 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for equid 0.1.2
File Size Uploaded Provenance Actions
equid-0.1.2.tar.gz 9.2 kB Without provenance Details for equid-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for equid 0.1.2
File Interpreter ABI Platform Actions
equid-0.1.2-py3-none-any.whl Python 3 none any Details for equid-0.1.2-py3-none-any.whl

Total release size: 18.1 kB

Release files / equid-0.1.2.tar.gz

Download URL equid-0.1.2.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2e6002099b0c7125ea7e9db5e2b336a07124dad6a7bd0c7d76da926f87bfe846
BLAKE2b-256 checksum
How to use checksums
1bb3f3bb0813e89bc907cacb34f1f03a320fb78ee533de96cae4f3c50e8ba235
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

Release files / equid-0.1.2-py3-none-any.whl

Download URL equid-0.1.2-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cac19dda6387242fa2b0955d5788d3c308d8cd9f963a1fba3fcbdd9bf7c54f53
BLAKE2b-256 checksum
How to use checksums
08b228a3bedbe8732b6b446cf0e2ce0bc65e2fb29f2322b58a64d91a9f07d93d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

Security for equid 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page