Another thing to think about: how do we simplify expressions to make them
optimal for code?  This is not necessarily the same as making them "look"
simple, which is what we currently tend to aim for in simplification
functions  There's also the question of putting expressions in a form that
is suitable to reduce floating point error.

Based on what was said on the other thread I think parsing should be its
own GSoC project, independent of SymPy Gamma.  I guess such a project
should also consider cases of parsing very large expressions (like a C
function).

Aaron Meurer

Sent from my iPhone.

On Mar 20, 2012, at 11:55 AM, Matthew Rocklin <mrock...@gmail.com> wrote:

Ah, I see. So we would need to parse C code, do some optimization in sympy,
and then spit C code back out and presumably give it to a compiler.

SymPy does have the ability to reason about code in a way that is quite
different from a traditional compiler. (I.e. we know that sin(x)**2 +
cos(x)**2 is 1, a compiler won't). It would be interesting to hook in some
SymPy system into some standard compiler tool-chain and see what we could
do.

As a first pass we could skip over any control stuff (this might be hard)
and just look at simpler expressions. We could run over some large body of
code and tweak expressions at a local level. We might also want to consider
simplifying based on numerical issues. There was a scicomp.stackexchange
question about this
http://scicomp.stackexchange.com/questions/527/is-there-software-that-can-autogenerate-numerically-accurate-floating-point-c-ro

Really, all of these questions would be accessible once we had a code
parser. Perhaps the GSoC idea is to build a code parser for SymPy? Anyone
out there familiar with building parsers?

On Tue, Mar 20, 2012 at 10:35 AM, Andy Ray Terrel <andy.ter...@gmail.com>wrote:

> Well I was thinking more of taking a piece of c code, but it could be
> take a python function, grab the code object and manipulate that.
>
> What I really want is to play around with symbolic code optimizations
> and since we have quite a few tools to go from symbolics to code, it
> seems easy to do simple things in the other directions.  I realize
> this isn't super well formed but after seeing a number of these
> symbolic executor papers, I think it is probably a good way to go.
>
> -- Andy
>
> On Tue, Mar 20, 2012 at 11:28 AM, Aaron Meurer <asmeu...@gmail.com> wrote:
> > Isn't this just a matter of turning some variables into Symbols and
> > wrapping your literals in sympify() calls, so that everything comes
> > out symbolically?
> >
> > Aaron Meurer
> >
> > On Tue, Mar 20, 2012 at 9:44 AM, Matthew Rocklin <mrock...@gmail.com>
> wrote:
> >> I'm confused.
> >>
> >> Are you talking about turning a python function into a sympy expression,
> >> optimizing the sympy expression and then going back?
> >>
> >> What's an example use case?
> >>
> >> -Matt
> >>
> >>
> >> On Tue, Mar 20, 2012 at 7:52 AM, Andy Ray Terrel <andy.ter...@gmail.com
> >
> >> wrote:
> >>>
> >>> We have code printer's it would be nice to take a function and turn it
> >>> into a symbolic expression.  This would allow for symbolically
> >>> exploring optimizations.  Lots of publishing on this, I can find a
> >>> reference or two (John Gunnels thesis is certainly a good read).
> >>> AFAIK this is how John optimizes codes for IBM and has won him 5
> >>> Gordon Bell prizes.
> >>>
> >>> -- Andy
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google
> Groups
> >>> "sympy" group.
> >>> To post to this group, send email to sympy@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> sympy+unsubscr...@googlegroups.com.
> >>> For more options, visit this group at
> >>> http://groups.google.com/group/sympy?hl=en.
> >>>
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "sympy" group.
> >> To post to this group, send email to sympy@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> sympy+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/sympy?hl=en.
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "sympy" group.
> > To post to this group, send email to sympy@googlegroups.com.
> > To unsubscribe from this group, send email to
> sympy+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to sympy@googlegroups.com.
> To unsubscribe from this group, send email to
> sympy+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>
>
 --
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to