New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lambdify improvement via Direct mappings from Sympy Operations to Numpy/Scipy/ect. #13652
Comments
This is an outstanding issue: #7229 There have been a number of attempts to add this functionality but seem to be stale pull requests. You may want to look into some of their implementations. Maybe you can improve it. |
That issue chain has not been touched since '15. What I am suggesting is more than just scipy integration. For instance, I work with myHDL to generate verilog/VHDL code from python. And at one point it could take input from So what I am trying to get at is that So I am going to keep tolling at this, but like I noted in the notebook I have no idea how to do some crazy OOP magic to make a method be auto-executed when the class instances are passed into a function like |
This summer we finally implemented a proper Python code printer. A good next step would be to change out the backend of lambdify to use this printer. Lambdify is currently built in way that makes it hard to understand due to it being too clever with namspace injection. If it were backed by our normal printers, then adding dunder methods for a variety of common NumPy, SciPy, etc operations would become much easier and clearer. |
Could it be because we recently made the default lambdify module numpy instead of mpmath? It was a subtle backwards incompatible change. |
on the myHDL lambda thing and mpmath most likely. I have put my myHDL work on hold for the time do work on Fourier Optics that give's rise to the dreaded Fresnel integrals and then visualizing the output to yt. Which is why I need @moorepants do you have any R&D files/notebooks(most preferable) of the python printer utility or |
Tried using pycode and its scipy code with just the binomial coefficient and it did not work. And
lambdify
is just not verbose enough. So here is my prototype of a way to verbosely define the mappings between sympy mathematical operations and their respective main numerical python implementation by means of defining the mapping as a dunder method in the sympy operations class definition. I am more of front-end user then developer so this is the best I know how to do at the momenthttps://github.com/GProtoZeroW/PythonToolForge/blob/master/SympyNumericalBinding.ipynb
The text was updated successfully, but these errors were encountered: