sympy gamma improvements

89 views
Skip to first unread message

Nicolas Jimenez

unread,
Mar 22, 2016, 8:44:31 PM3/22/16
to sympy
Hi all, 

Ondrej and I have been discussing changes for sympy gamma that would make the project more useable for the Mathpix project (http://mathpix.com/).  Our main issues with the software are the following:

1.  Evaluation of Sympy expressions is string based and uses 'eval'.  This is problematic for us as we are using a Latex parser which directly generates a Sympy object: https://github.com/augustt198/latex2sympy/tree/master.  

2.  Plotting is done server side and is not robust.  Computing the points should be done client side in javascript for greater responsiveness.  

3.  Too much display logic in templates and server side code.  For example, all the code in https://github.com/sympy/sympy_gamma/blob/master/templates/card.html could be distilled into a single ReactJS component.  Moving as much of the code as possible into Javascript would go a long way into making the code easier to embed in people's web app.  There is too much dependence on Django and the Google App Engine.  Porting the app to using Flask should be straightforward, but this is far from being the case.  If SympyGamma was a thin API to Sympy it would be much easier to use / maintain.  

Best,
Nico
Message has been deleted

mvnnn

unread,
Mar 23, 2016, 2:32:54 AM3/23/16
to sympy
Hi all,

I discuss about Sympy gamma project in maillist Sympy gamma discussion and @Aaron Meurer said me this project is just on NLP so that i concentrate only on NLP.  I have shared my draft with SymPy. the proposal's title is "GSoC SymPy Live and SymPy Gamma (on Google App Engine)". 
Please review this and push me in right direction.
Thanks

mvnnn

Ondřej Čertík

unread,
Mar 23, 2016, 11:50:24 AM3/23/16
to sympy
Hi Nico,

On Tue, Mar 22, 2016 at 6:44 PM, Nicolas Jimenez <nicodj...@gmail.com> wrote:
> Hi all,
>
> Ondrej and I have been discussing changes for sympy gamma that would make
> the project more useable for the Mathpix project (http://mathpix.com/). Our
> main issues with the software are the following:

Thanks a lot for posting the feedback here.

>
> 1. Evaluation of Sympy expressions is string based and uses 'eval'. This
> is problematic for us as we are using a Latex parser which directly
> generates a Sympy object:
> https://github.com/augustt198/latex2sympy/tree/master.

I think it should be possible to make sympy gamma to take a latex input as well.

>
> 2. Plotting is done server side and is not robust. Computing the points
> should be done client side in javascript for greater responsiveness.

This could be implemented by extending sympy's code generation to also
generate JavaScript (we already do C and Fortran). Then we would need
to use some JavaScript library that implements the mathematical
functions. It might not be easy to do for some special functions that
do not (yet) have a JavaScript implementation, but for most elementary
functions this should work great, and it should allow the plot to be a
lot more responsive. I think that's a good idea.

>
> 3. Too much display logic in templates and server side code. For example,
> all the code in
> https://github.com/sympy/sympy_gamma/blob/master/templates/card.html could
> be distilled into a single ReactJS component. Moving as much of the code as
> possible into Javascript would go a long way into making the code easier to
> embed in people's web app. There is too much dependence on Django and the
> Google App Engine. Porting the app to using Flask should be
> straightforward, but this is far from being the case. If SympyGamma was a
> thin API to Sympy it would be much easier to use / maintain.

Yes, we should probably move to Flask or some other lightweight
framework. I also heard good things about ReactJS (which was not
available when I started sympy gamma).


Mvnnn, if you are interested, I think the above would be very useful
improvements to sympy gamma.

Ondrej

>
> Best,
> Nico
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/08ea23d0-1fb5-4bdb-a23f-de3f0337651c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Aaron Meurer

unread,
Mar 23, 2016, 12:16:10 PM3/23/16
to sy...@googlegroups.com
On Wed, Mar 23, 2016 at 11:50 AM, Ondřej Čertík <ondrej...@gmail.com> wrote:
> Hi Nico,
>
> On Tue, Mar 22, 2016 at 6:44 PM, Nicolas Jimenez <nicodj...@gmail.com> wrote:
>> Hi all,
>>
>> Ondrej and I have been discussing changes for sympy gamma that would make
>> the project more useable for the Mathpix project (http://mathpix.com/). Our
>> main issues with the software are the following:
>
> Thanks a lot for posting the feedback here.
>
>>
>> 1. Evaluation of Sympy expressions is string based and uses 'eval'. This
>> is problematic for us as we are using a Latex parser which directly
>> generates a Sympy object:
>> https://github.com/augustt198/latex2sympy/tree/master.
>
> I think it should be possible to make sympy gamma to take a latex input as well.
>
>>
>> 2. Plotting is done server side and is not robust. Computing the points
>> should be done client side in javascript for greater responsiveness.
>
> This could be implemented by extending sympy's code generation to also
> generate JavaScript (we already do C and Fortran). Then we would need
> to use some JavaScript library that implements the mathematical
> functions. It might not be easy to do for some special functions that
> do not (yet) have a JavaScript implementation, but for most elementary
> functions this should work great, and it should allow the plot to be a
> lot more responsive. I think that's a good idea.

There is jscode(). It may need to be improved, but the work is already
started there.

>
>>
>> 3. Too much display logic in templates and server side code. For example,
>> all the code in
>> https://github.com/sympy/sympy_gamma/blob/master/templates/card.html could
>> be distilled into a single ReactJS component. Moving as much of the code as
>> possible into Javascript would go a long way into making the code easier to
>> embed in people's web app. There is too much dependence on Django and the
>> Google App Engine. Porting the app to using Flask should be
>> straightforward, but this is far from being the case. If SympyGamma was a
>> thin API to Sympy it would be much easier to use / maintain.
>
> Yes, we should probably move to Flask or some other lightweight
> framework. I also heard good things about ReactJS (which was not
> available when I started sympy gamma).
>
>
> Mvnnn, if you are interested, I think the above would be very useful
> improvements to sympy gamma.
>
> Ondrej

IMHO we should also consider moving away from the app engine. There
are better alternatives these days. Consider for instance tmpnb.org,
which runs a full Python instance (no timers) and you can install any
module you want. The whole thing runs in a Docker container (which
didn't even exist when we started Gamma).

We would need someone with relative expertise in this area to do this,
which I don't know if any core SymPy developers have. But perhaps one
of the GSoC students has it.

Aaron Meurer

>
>>
>> Best,
>> Nico
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to sympy+un...@googlegroups.com.
>> To post to this group, send email to sy...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/sympy.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sympy/08ea23d0-1fb5-4bdb-a23f-de3f0337651c%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CADDwiVAxrxLR%2BjeMJTTUqZxMcHePaXRTKVqRBm4dpNTRgBET5A%40mail.gmail.com.

mvnnn

unread,
Mar 23, 2016, 12:34:14 PM3/23/16
to sympy
> 3.  Too much display logic in templates and server side code.  For example,
> all the code in
> https://github.com/sympy/sympy_gamma/blob/master/templates/card.html could
> be distilled into a single ReactJS component.  Moving as much of the code as
> possible into Javascript would go a long way into making the code easier to
> embed in people's web app.  There is too much dependence on Django and the
> Google App Engine.  Porting the app to using Flask should be
> straightforward, but this is far from being the case.  If SympyGamma was a
> thin API to Sympy it would be much easier to use / maintain.

Yes, we should probably move to Flask or some other lightweight
framework. I also heard good things about ReactJS (which was not
available when I started sympy gamma).


Hi Ondrej,

Currently, i am working on ReactJS in startup. ReactJS + MaterialUI make very good design and we not need to use any javascript library. I would like to work on ReactJS.

Ondřej Čertík

unread,
Mar 23, 2016, 6:14:19 PM3/23/16
to sympy
Definitely. E.g. if we move to Flask, then there is an adapter to the
AppEngine, but it can also be used elsewhere. There are other
frameworks now as well.

Ondrej
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6JW7qiQgbfFohRQZxd5Hyi4A7QyCA00a3Stcu_pMPzxfw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages