Let's Discuss the Matter Further
http://rhodesmill.org/brandon/category/python/feed/
Thoughts and ideas from Brandon Rhodeshttp://www.rssboard.org/rss-specificationpython-feedgenenSat, 16 Jun 2018 00:00:00 -0400Learning SymPy while eliminating trigonometry from rotations
http://rhodesmill.org/brandon/2018/sympy/
<p>I have played with Python’s
<a href="http://docs.sympy.org/latest/index.html">SymPy symbolic math library</a> before,
but for the first time last week I used it to solve a real problem!
In the process I had to confront three errors
in my understanding of how SymPy works:</p>
<ol>
<li>I had somehow imagined that SymPy was secretly storing
all the equations I was writing
and would use them automatically later.</li>
<li>I thought I could convince SymPy to eliminate intermediate symbols.</li>
<li>I thought each variable in my problem needed to be a SymPy symbol.</li>
</ol>
<p>While working through these misunderstandings to a solution,
I ran across two features that made SymPy’s results
easier to use in my Python code than I had expected!</p>
<ol>
<li>SymPy not only supports fancy formatting of math formulae,
but can print them as pure Python expressions
ready to be pasted into a Python program.</li>
<li>SymPy can perform subexpression elimination
to prevent your code
from computing any sub-result twice.</li>
</ol>
<p>The sections of this post tackle each of the items above in turn.<p><a href="http://rhodesmill.org/brandon/2018/sympy/">Read the full article...</a></p>http://rhodesmill.org/brandon/2018/sympy/Sat, 16 Jun 2018 00:00:00 -0400