Skip to main content

SymPy-to-Torch conversion and numerical integration

Project description

symtorch (distribution: libsymtorch)

SymPy-to-Torch conversion and numerical integration helpers.

Note: this module was first developed for libphysics (and remains compatible): https://github.com/ferhatpy/libphysics — then it was split out into a standalone library.

Install (dev)

pip install -e .

Install (PyPI)

pip install libsymtorch

Quick usage

import symtorch
import sympy as sp

x = sp.Symbol("x", real=True)
expr = sp.Integral(sp.exp(-x**2), (x, -sp.oo, sp.oo))

lt = symtorch.SymTorch()
texpr = lt.torchify(expr)
re, im = texpr.torchquad_integrate(N=121)
print(re, im)

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

libsymtorch-0.1.1.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

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

libsymtorch-0.1.1-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file libsymtorch-0.1.1.tar.gz.

File metadata

  • Download URL: libsymtorch-0.1.1.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for libsymtorch-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9f7b0ae39c5d85141c15ef2d95532391efe799ea0d45a0d9cbf88bc0bc28ded4
MD5 fef9e03b55d50b5dd6f9d2c1624719c3
BLAKE2b-256 bdb89b59cb98e024137cfb1e103f2fd1975d65618d85ef5d98b851d547ffc4aa

See more details on using hashes here.

File details

Details for the file libsymtorch-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: libsymtorch-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for libsymtorch-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2fcc3bea31513b2a87eead82c23a55872bb764f21edcfbbc1d9e261f8bf85a0c
MD5 bf4905e10d07723f9dbcdbb858869903
BLAKE2b-256 5defa893fe48db9d59d1f3d70232d62c544d513d79b9695ba71db34a20fb7f23

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