Using SymPy For Website #21225
Replies: 5 comments 6 replies
-
This seems like a more suitable question for the mailing list. |
Beta Was this translation helpful? Give feedback.
-
I don't know if this has been tried before. I would expect something like this would not be easy, but please report back if you have any success with it. |
Beta Was this translation helpful? Give feedback.
-
We can convert issues like this into discussions. |
Beta Was this translation helpful? Give feedback.
-
This is actually doable, however you'll want to use pyodide. Pyodide, while a bit on the heavy side, does support just about any Python package and ships with Sympy by default. from sympy import *
x = symbols('x')
factor(-2*x**2 + x + 21) Blatant self advertisement: There is a project that does just that, it's called QuantumSheet and works surprisingly well. So, the user types the left-hand side of Then it generates something along the lines of sympy.factor(
sympy.Add(sympy.Mul(sympy.Integer(-2),sympy.Pow(_x,sympy.Integer(2))),_x,sympy.Integer(21))
.subs({})
) And that gets sent to Pyodide, which is running in a web worker. As the final step, the Sympy result is returned, converted and displayed. |
Beta Was this translation helpful? Give feedback.
-
With Pyodide and Observable you can put sympy and show results easy for a educational/experimental level, I use this alternative a lot. Examples: https://observablehq.com/@fedesantana/sintesis-de-funciones-transferencia |
Beta Was this translation helpful? Give feedback.
-
I'm interested in using a CAS for a website. While there are JavaScript CAS, SymPy has generally been recommended to me. Would it be possible to use SymPy and pyjs in combination for a website? Is this often done, and are there any issues associated with it?
Beta Was this translation helpful? Give feedback.
All reactions