#9130: Access to beta function
---------------------------------------------+------------------------------
   Reporter:  kcrisman                       |          Owner:  burcin          
               
       Type:  enhancement                    |         Status:  positive_review 
               
   Priority:  major                          |      Milestone:  sage-5.0        
               
  Component:  symbolics                      |       Keywords:  special 
function, pynac, sd35.5
Work_issues:                                 |       Upstream:  N/A             
               
   Reviewer:  Benjamin Jones, Burcin Erocal  |         Author:  Karen T. Kohl, 
Burcin Erocal   
     Merged:                                 |   Dependencies:                  
               
---------------------------------------------+------------------------------
Changes (by burcin):

  * status:  needs_work => positive_review


Old description:

> Although Maxima has the beta function, Sage doesn't:
> {{{
> sage: a, b, c = var('a b c')
> sage: assume(a > 0)
> sage: assume(b > 0)
> sage: x = var('x')
> sage: beta_dist = x**(a-1) * (1 - x)**(b-1)
> sage: c = integral(beta_dist, x, 0, 1)
> sage: c
> beta(a, b)
> sage: c(a=.5,b=.5)
> beta(0.500000000000000, 0.500000000000000)
> sage: c(a=.5,b=.5).n()
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call
> last)
>
> /Users/karl-dietercrisman/<ipython console> in <module>()
>
> /Users/karl-dietercrisman/Desktop/sage-4.4.2/local/lib/python2.6/site-
> packages/sage/symbolic/expression.so in
> sage.symbolic.expression.Expression.n
> (sage/symbolic/expression.cpp:17042)()
>
> TypeError: cannot evaluate symbolic expression numerically
> }}}
> This *is* is Ginac, though, and there is even room for defining it in
> symbolic/expression.pyx . It probably is also included in some of our
> other libraries, as a standard special function.
>
> ----
>
> Apply
>  * [attachment:trac_9130_combined.2.patch]

New description:

 Although Maxima has the beta function, Sage doesn't:
 {{{
 sage: a, b, c = var('a b c')
 sage: assume(a > 0)
 sage: assume(b > 0)
 sage: x = var('x')
 sage: beta_dist = x**(a-1) * (1 - x)**(b-1)
 sage: c = integral(beta_dist, x, 0, 1)
 sage: c
 beta(a, b)
 sage: c(a=.5,b=.5)
 beta(0.500000000000000, 0.500000000000000)
 sage: c(a=.5,b=.5).n()
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

 /Users/karl-dietercrisman/<ipython console> in <module>()

 /Users/karl-dietercrisman/Desktop/sage-4.4.2/local/lib/python2.6/site-
 packages/sage/symbolic/expression.so in
 sage.symbolic.expression.Expression.n
 (sage/symbolic/expression.cpp:17042)()

 TypeError: cannot evaluate symbolic expression numerically
 }}}
 This *is* is Ginac, though, and there is even room for defining it in
 symbolic/expression.pyx . It probably is also included in some of our
 other libraries, as a standard special function.

 ----

 Apply
  * [attachment:trac_9130-beta_function.patch]
  * [attachment:trac_9130-py_float_segfault.take2.patch]

--

Comment:

 I uploaded a new patch which combines Karen's previous patches. This is
 ready to go now.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9130#comment:24>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to