Say I have an expression that I know is quadratic in u1, u2, u3:
expr = k00*u1**2 + k01*u1*u2 + k02*u1*u3 + k10*u1*u2 + k11*u2**2 +
k12*u2*u3 + k20*u1*u3 + k21*u2*u3 + k22*u3**2
Is there a simple way to transform this into:
expr = u^T * K * u
Where u = [u1, u2, u3]^T and K is a 3 x 3 matrix?
I
On Wednesday, April 6, 2016, Nathan Hayden wrote:
> Excellent! This is exactly what I was looking for.
>
> Does S() return the tree in memory?
>
S() is just an alias for sympify. It returns an Expression object, in this
case.
>
>
> On Wednesday, April 6, 2016 at 4:32:32 PM UTC-5, Nathan Goldb
S() converts the string into a SymPy expression (short for sympify()).
SymPy expressions are always stored as trees in memory (that's how
they are represented, see
http://docs.sympy.org/latest/tutorial/manipulation.html).
Aaron Meurer
On Wed, Apr 6, 2016 at 6:02 PM, Nathan Hayden wrote:
> Excell
The dot printer does this. See
http://docs.sympy.org/latest/modules/printing.html#sympy.printing.dot.dotprint,
and http://docs.sympy.org/latest/tutorial/manipulation.html for an
example.
Aaron Meurer
On Wed, Apr 6, 2016 at 5:42 PM, Christophe Bal wrote:
> Hello.
>
> It should be fairly easy to t
Excellent! This is exactly what I was looking for.
Does S() return the tree in memory?
On Wednesday, April 6, 2016 at 4:32:32 PM UTC-5, Nathan Goldbaum wrote:
>
>
>
> On Wed, Apr 6, 2016 at 4:09 PM, Nathan Hayden > wrote:
>
>> Hi, I'm new to SymPy, but I'm using it to do some simple things alre
Hello.
It should be fairly easy to transform the sympy output into a Graphviz file.
*Christophe BAL*
*Enseignant de mathématiques en Lycée **et développeur Python amateur*
*---*
*French teacher of **math** in a high school **and **amateur **Python *
*developer*
2016-04-06 23:32 GMT+02:00 Nathan
On Wed, Apr 6, 2016 at 4:09 PM, Nathan Hayden
wrote:
> Hi, I'm new to SymPy, but I'm using it to do some simple things already.
>
> I'm wondering, can I feed SymPy an expression and get a tree
> representation back showing me the order of operations used to evaluate the
> expression? I know this
Hi, I'm new to SymPy, but I'm using it to do some simple things already.
I'm wondering, can I feed SymPy an expression and get a tree representation
back showing me the order of operations used to evaluate the expression? I
know this is all handled under the hood, but I don't know if it's expos