Re: [sympy] symjit

2025-04-12 Thread Peter Stahlecker
Thanks a lot! I will try to install it and if I run into trouble I'll take the liberty to contact you again. Best regards, Peter On Sat 12. Apr 2025 at 13:27, Shahriar Iravanian wrote: > That's right. This, or equivalently, `conda install -c conda-forge symjit` > should work on Windows, Linux

Re: [sympy] symjit

2025-04-12 Thread Isuru Fernando
Hey Oscar, SymEngine's lambdify can be used too. It uses numpy arrays to support broadcasting and other features of sympy. from symengine import * x = symbols('x') e = x**2 + x for _ in range(10): e = e**2 + e ed = e.diff(x) f = lambdify([x], [ed]) print(f(.0001)) To avoid a bit of overhead

Re: [sympy] symjit

2025-04-12 Thread Oscar Benjamin
On Sat, 12 Apr 2025 at 16:32, Isuru Fernando wrote: > > SymEngine is a bit slower than protosym due to using memoryviews, but > we can add an interface to avoid those. I'm sure it can be made faster. To be clear to anyone reading this both SymEngine and protosym are using LLVM for this. I could h

Re: [sympy] symjit

2025-04-12 Thread Oscar Benjamin
On Sat, 12 Apr 2025 at 18:01, Shahriar Iravanian wrote: > > Regarding the example, this is a tough test! It is and in some ways it is not realistic but actually in some ways it is. A common case will certainly be small expressions e.g. for simple ODEs as you show in the README. Another case thoug

Re: [sympy] symjit

2025-04-12 Thread Shahriar Iravanian
That's right. This, or equivalently, `conda install -c conda-forge symjit` should work on Windows, Linux, and MacOS. Even `python -m pip install symjit` may work, but the conda route is preferable. However, there are always corner cases. Please let me know if you have any problems. It has three ma

Re: [sympy] symjit

2025-04-12 Thread Oscar Benjamin
On Fri, 11 Apr 2025 at 20:49, Shahriar Iravanian wrote: > > The latest version of symjit (1.5.0) has just been published. By now, the > Rust backend is stabilized and generates code on Linus/Darwin/Windows and > x86-64 and arm64 machines. Wow this is amazing. I have been thinking for a long tim

Re: [sympy] symjit

2025-04-12 Thread Shahriar Iravanian
Hi Oscar, Thank you very much for your response. I appreciate it. There is a lot to think about. Regarding the example, this is a tough test! It shows that there is a bug in the x64-86 rust backend. Interestingly, the Python backend and the rust one on ARM64 (MacOS) give the correct answer: e =

Re: [sympy] symjit

2025-04-12 Thread Isuru Fernando
Hi Oscar, Yes, we can add symjit as another backend if it offers a C/C++ API. We also have a pure C/C++ backend, just replace `LLVMDouble` by `LambdaDouble`. Isuru On Sat, Apr 12, 2025 at 11:08 AM Oscar Benjamin wrote: > On Sat, 12 Apr 2025 at 16:32, Isuru Fernando wrote: > > > > SymEngine is