How can I call sympy by javascript with django / jquery or ajax

80 views
Skip to first unread message

Peter

unread,
Jun 6, 2014, 5:18:19 PM6/6/14
to sy...@googlegroups.com, peter...@fit4exam.de
Hallo everybody,

I'm sorry for this question, but I'm not realy familar with Python. Normally I'm working with PHP and JavaScript, but for my recent project I have to integrate some symbolic math to a webpage.
In an Internet search, I came across Sympy. And sympy looks quite good.
My problem looks like this:

The user should enter a formula in a field.
The value of the imput field has to be the formula that should be evaluated.
The value of the field should be posted to sympy. (Am I right, that this will work with django oder a simple jquery call? Can anybody give me an example, how to do so?)
Sympy has to evaluate the posted formula.
The return value should be posted back to JavaScript.

Can anyone please tell me how I can implement this.

Thanks a lot!
Peter

Björn Dahlgren

unread,
Jun 6, 2014, 5:56:01 PM6/6/14
to sy...@googlegroups.com, peter...@fit4exam.de

You should look into sympy gamma.
If you just want a small hack in your django codebase I would look at:
http://docs.sympy.org/dev/modules/parsing.html

and then maybe return the results as latex and use mathjax to render it nicely on the client side.

 

Peter

unread,
Jun 6, 2014, 8:16:19 PM6/6/14
to sy...@googlegroups.com, peter...@fit4exam.de

Hi Björn,
In the meantime, I tried to install SympyGamma and the Google app engine, as it is described in the manual. Unfortunately I don't know now how I can check if everything works fine, because some steps were discribed for a localhost and not on a remote server.

Until today, I've never done a django query, could you please give an example, that I'm able to orient me at that example.

Many thanks for your help!
Peter

Alan Bromborsky

unread,
Jun 6, 2014, 8:30:21 PM6/6/14
to sy...@googlegroups.com
You might want to look at http://krum.rz.uni-mannheim.de/jas/ (Java Algebra System (JAS) Project)
--
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 http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/38b6a055-ea01-4d44-88a5-aaad1c586711%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

SAHIL SHEKHAWAT

unread,
Jun 7, 2014, 12:16:31 AM6/7/14
to sy...@googlegroups.com

Peter!
I dont understand what is it exactly that you want to do but still I would like to help.

On 7 Jun 2014 06:00, "Alan Bromborsky" <abr...@verizon.net> wrote:
In the meantime, I tried to install SympyGamma and the Google app engine, as it is described in the manual. Unfortunately I don't know now how I can check if everything works fine, because some steps were discribed for a localhost and not on a remote server.
I guess you can ssh into your remote server and then just follow the steps to install and while running server just add "--host=0.0.0.0" to it to make it available to other systems also BUT that will be a bad practice if this project of your is big because that will still be running in dev mode. I think the better solution of it is to upload it on  the Google App Engine which also provides you many other options and is free for certain limit which is enough for a small project.

Until today, I've never done a django query, could you please give an example, that I'm able to orient me at that example.
Just look at the code of SymPyGamma. If i an getting you correctly this is all you need. In one sentence "SympyGamma is awesome." 

Björn Dahlgren

unread,
Jun 8, 2014, 9:55:05 AM6/8/14
to sy...@googlegroups.com, peter...@fit4exam.de


On Saturday, 7 June 2014 02:16:19 UTC+2, Peter wrote:

Hi Björn,
In the meantime, I tried to install SympyGamma and the Google app engine, as it is described in the manual. Unfortunately I don't know now how I can check if everything works fine, because some steps were discribed for a localhost and not on a remote server.

Until today, I've never done a django query, could you please give an example, that I'm able to orient me at that example.

I'm afraid I don't have any experience with app engine and my time is quite limited so I won't be able to make
a full example. But like Sahil suggested: see if there is ssh support.

Reply all
Reply to author
Forward
0 new messages