https://github.com/cheind/py-cgraph
:tangerine: Intro to symbolic computation in Python including applications to function optimization, physics simulation and more. Includes notebooks on back-propagation, auto-diff and more.
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.2%) to scientific vocabulary
Keywords
Repository
:tangerine: Intro to symbolic computation in Python including applications to function optimization, physics simulation and more. Includes notebooks on back-propagation, auto-diff and more.
Basic Info
Statistics
- Stars: 16
- Watchers: 1
- Forks: 4
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
Readme.md
CGraph - symbolic computation in Python
This repository is the result of my efforts to understand symbolic computation of functions factored as expression trees. With the right concepts at hands, a few lines of code are able compute numeric and symbolic gradients of arbitrary functions. Even expression simplification is easily accomplished. While this library is not complete (and will never be) it offers the interested reader some insights on how to perform symbolic computation.
Notebooks on symbolic computation
The code is accompanied by a series of notebooks that explain fundamental concepts for developing your own library that performs symbolic computation:
Foundations - Computational Graphs - Introduction view - Computational Graphs - Symbolic Computation in Python view
Applications
- Function Optimization view
- Signed Distance Functions and Particle Physics view
This was recently referenced by Donald House co-author of Foundations of Physically Based Modeling & Animation as additional reader supplied material. Signed distance functions are not covered in his book, which makes this contribution a good fit. Most of the math in the notebook used is directly linked with content of the book.
All notebook sources can be found inside the docs folder. There are certainly typos, grammatical errors and all kind of improvements possible. In case you have one for me, I'd be happy to see your pull requests or comments!
CGraph as a library
The code for symbolic computation contained in cgraph.py can be used as follows.
```python import cgraph as cg
x = cg.Symbol('x') y = cg.Symbol('y') z = cg.Symbol('z')
f = (x * y + 3) / (z - 2)
Evaluate function
cg.value(f, {x:2, y:3, z:3}) # 9.0
Partial derivatives (numeric)
d = cg.numeric_gradient(f, {x:2, y:3, z:3}) d[x] # df/dx 3.0 d[z] # df/dz -9.0
Partial derivatives (symbolic)
d = cg.symbolic_gradient(f) cg.simplify(d[x]) # df/dx (y*(1/(z - 2))) cg.value(d[x], {x:2, y:3, z:3}) # df/dx 3.0
Higher order derivatives
ddx = cg.symbolic_gradient(d[x]) cg.simplify(ddx[y]) # ddf/dxdy (1/(z - 2)) ```
Installation
To install CGraph clone this repository and use pip to install
from local sources.
pip install -e <path/to/setup.py>
Python 3.5/3.6 and numpy is required.
Continuous Integration
Branch | Status
------- | ------
master |
develop |
License
If not otherwise stated all Material is licensed under BSD license.
Owner
- Name: Christoph Heindl
- Login: cheind
- Kind: user
- Location: Austrian area
- Website: https://cheind.github.io/
- Repositories: 88
- Profile: https://github.com/cheind
I am a computer scientist working at the interface of perception, robotics and deep learning.
GitHub Events
Total
Last Year
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0