Equations that can be algebraicly manipulated.
Project description
Algebraic Equations with SymPy
Introduction | Output Formatting | Installation | Try Live | Issues or Comments | Change Log | License | GIT Repository | PyPi Link
Website/Documentation (including API)
Introduction
This tool defines relations that all high school and college students would recognize as mathematical equations. They consist of a left hand side (lhs) and a right hand side (rhs) connected by the relation operator "=".
This tool applies operations to both sides of the equation simultaneously, just
as students are taught to do when
attempting to isolate (solve for) a variable. Thus the statement Equation/b
yields a new equation Equation.lhs/b = Equation.rhs/b
The intent is to allow using the mathematical tools in SymPy to rearrange equations and perform algebra in a stepwise fashion using as close to standard mathematical notation as possible. In this way more people can successfully perform algebraic rearrangements without stumbling over missed details such as a negative sign.
A simple example as it would appear in a Jupyter notebook is shown immediately below:
Once the algebra is complete it is possible to substitute numbers with units into the solved equation to calculate a numerical solution with proper units.
Many math packages such as SageMath and Maxima have similar capabilities, but require more knowledge of command syntax, plus they cannot easily be installed in a generic python environment.
Controlling the Format of Interactive Outputs
-
In graphical environments (Jupyter) you will get rendered Latex such as $\frac{a}{b} = \frac{c}{d}$. To also see the code representation (what can be copy and pasted for additional computation) set
algwsym_config.output.show_code = True
. This will print the code version (e.g.Equation(a,b/c)
) of the equation as well. This code version can be accessed directly by callingrepr()
on the equation. -
In interactive text environments (ipython and command line) the representation (code version) is returned by default. Calling
print()
orstr()
on an equation will return the human readable version with an equals sign. To have the human readable version returned by default setalgwsym_config.output.human_text = True
. If combined withalgwsym_config.output.show_code = True
, both code and human readable versions will be shown. -
The equation label can be turned off by setting
algwsym_config.output.label = False
.
Setup/Installation
- Use pip to install in your python environment:
pip install -U Algebra-with-SymPy
- To use in a running python session issue
the following command :
from algebra_with_sympy import *
. This will also import the SymPy tools. - If you want to isolate this tool from the global namespace you are
working with change the import statement
to
import algebra_with_sympy as spa
, wherespa
stands for "SymPy Algebra". Then all calls would be made tospa.funcname()
.
Try in binder
Issues or Comments
- Issues and bug reports should be filed on github.
- Comments, questions, show and tell, etc. should go in the project discussions.
Change Log
- 0.9.1
- Equations labeled with their python name, if they have one.
- Added flags to adjust human readable output and equation labeling.
- Accept equation as function argument in any position.
- First pass at
solve()
accepting equations. - Added override of
root()
to avoid warning messages. - More unit tests.
- First pass at documentation.
- 0.9.0 functionality equivalent to extension of SymPy in PR#21333.
This software is distributed under the GNU V3 license
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Copyright - Jonathan Gutow 2021, 2022
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for Algebra_with_SymPy-0.9.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | aaf33125190183795cf4e8051c4f9aa9a6fd7fed157452b7ace49e2820a0acf8 |
|
MD5 | 7541955e1237509fff395df31f1e965c |
|
BLAKE2b-256 | 3aa544cdc2fb3d4b565043f5f92251c36b146b05111085963b7677a0bb8b6978 |
Hashes for Algebra_with_SymPy-0.9.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd1e2eee8483aec6db4fcb6a27a5efb364663cb58d55afa79ecd58ba7ae8027e |
|
MD5 | 267590b2dfe3e628657466731fda4855 |
|
BLAKE2b-256 | 9331ee2e9410ad421ee8af1b9ffb76c2bd5227a4bb0b7720d9a6f8c40014ba3e |