Isuru -- thanks; those benchmarks are fantastic!  I'm really glad this
code exists (that you wrote).

Also, Richard Fateman wrote this about symbolic integration (but isn't
subscribed to sage-devel so I'm forwarding this from him):

"
If  dgamma (x,a,b) is the value at x of the density function of a
Gamma(a,b) random variable with a,b>0  then ...
In Maxima,  do  load(distrib)   to get you the  function pdf_gamma(x,a,b).
The answer to your integration is given as

(gamma_incomplete(a,0)*b^a-gamma_incomplete(a,1/b)*b^a)/(gamma(a)*b^a)

is this what you want?

I suppose it is pointless to mention, again, the relative inefficiencies
inherent in the
  idea that people should spend time on pynac or other "let's start from
scratch and re-do everything because python doesn't have so many
parentheses" projects.
   Maxima is open source, gpl, github, is able to accommodate new
contributors, has an Algol-ish command language that can be used for
many tasks.
The underlying implementation language, lisp is good for some things,
and frankly, if you can't learn lisp in 2 weeks, you're probably not
such a hot programmer in python, either.

And with a bit of research you can learn how to call out from Lisp to
functions that were written in other languages. C.  Python.

I'm no longer looking at Sage mail, so thanks for bringing this to my
attention.

I hope you are all staying safe and well.
Regards
Richard
"

On Fri, Aug 27, 2021 at 12:28 PM Isuru Fernando <isu...@gmail.com> wrote:
>
> Here's the correct benchmark script, 
> https://gist.github.com/isuruf/857e2236d2443ebd9085273b3e6ada3b
>
> Isuru
>
> On Fri, Aug 27, 2021 at 2:14 PM Isuru Fernando <isu...@gmail.com> wrote:
>>
>> Hi,
>>
>> On Fri, Aug 27, 2021 at 1:23 PM William Stein <wst...@gmail.com> wrote:
>>>
>>> Hello Isuru -- thanks for popping in to comment!
>>>
>>> On Fri, Aug 27, 2021 at 10:56 AM Isuru Fernando <isu...@gmail.com> wrote:
>>> >
>>> > Hi,
>>> >
>>> > A SymEngine maintainer here.
>>> >
>>> > > Pynac has a lot of I think nontrivial efficient hooks back into Sage
>>> > for working with various data types, and doing things like equality
>>> > testing, fast evaluation of expression (fast_float, etc.),
>>> >
>>> > With SymEngine, we do have fast evaluation of expressions with
>>> > several backends. One backend is LLVM, where we compile the function
>>> > using LLVM and generate a callable C function using that.
>>>
>>> Wow, that's very cool.  Do you know how it compares to Sage's
>>> fast_float and fast_callable "compilers" in terms of speed?   Sage's
>>> don't actually depend on having LLVM installed (they aren't compiling
>>> to machine code), so I assume might be significantly slower, except
>>> that the people (=Robert Bradshaw) who wrote them are very clever, so
>>> you never know.  It's probably also interesting to benchmark the
>>> compile time itself.
>>
>>
>> I've attached a small script that I put together just now. Note how we can
>> pass sage expressions in symbolic ring to symengine functions.
>>
>> Timings are below. First one is sage and the second is symengine.
>>
>> one element
>> 625 loops, best of 3: 68 μs per loop
>> 625 loops, best of 3: 12.9 μs per loop
>>
>> create an output numpy array of 1000 elements
>> 5 loops, best of 3: 175 ms per loop
>> 625 loops, best of 3: 18.1 μs per loop
>>
>> compile time
>> 625 loops, best of 3: 478 μs per loop
>> 125 loops, best of 3: 2.69 ms per loop
>>
>> SymEngine LLVM backend has optimization levels (0, 1, 2, 3). 3 is the 
>> default.
>> By setting to optimization level 0, compile time is half with a performance 
>> penalty
>> of around 10%.
>>
>> Isuru
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/CA%2B01voMGc5aayc%2BuAdjNa-orR%3D0cWjiZqqpFSwsDuk-NDKw%2Bxw%40mail.gmail.com.



-- 
William (http://wstein.org)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CACLE5GC_rX5jD2Z33b2Dr-em%2BLxRUUeM8NmUwWyV5%3Dj4zmbioQ%40mail.gmail.com.

Reply via email to