#11888: Sage is missing the lambert_w function
----------------------------------------------------------------+-----------
       Reporter:  benjaminfjones                                |         
Owner:  burcin                                                            
           Type:  defect                                        |        
Status:  needs_review                                                      
       Priority:  minor                                         |     
Milestone:  sage-5.0                                                          
      Component:  symbolics                                     |    
Resolution:                                                                    
       Keywords:  lambert_w symbolics conversion maxima sd35.5  |   Work 
issues:                                                                    
Report Upstream:  N/A                                           |     
Reviewers:  Keshav Kini, Karl-Dieter Crisman, Fredrik Johansson, Burcin Erocal
        Authors:  Benjamin Jones                                |     Merged 
in:                                                                    
   Dependencies:  #12507                                        |      
Stopgaps:                                                                    
----------------------------------------------------------------+-----------
Description changed by benjaminfjones:

Old description:

> Maxima returns solutions to some exponential equations in terms of the
> `lambert_w` function. Sage is missing a conversion for this function:
>
> {{{
>
> sage: solve(e^(5*x)+x==0, x, to_poly_solve=True)
> [x == -1/5*lambert_w(5)]
> sage: S = solve(e^(5*x)+x==0, x, to_poly_solve=True)
> sage: z = S[0].rhs()
> sage: z
> -1/5*lambert_w(5)
> sage: N(z)
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call
> last)
>
> /Users/jonesbe/sage/sage-4.7.2.alpha2/devel/sage-test/sage/<ipython
> console> in <module>()
>
> /Users/jonesbe/sage/latest/local/lib/python2.6/site-
> packages/sage/misc/functional.pyc in numerical_approx(x, prec, digits)
>    1264             prec = int((digits+1) * 3.32192) + 1
>    1265     try:
> -> 1266         return x._numerical_approx(prec)
>    1267     except AttributeError:
>    1268         from sage.rings.complex_double import
> is_ComplexDoubleElement
>
> /Users/jonesbe/sage/latest/local/lib/python2.6/site-
> packages/sage/symbolic/expression.so in
> sage.symbolic.expression.Expression._numerical_approx
> (sage/symbolic/expression.cpp:17950)()
>
> TypeError: cannot evaluate symbolic expression numerically
> sage: lambert_w(5)
> ---------------------------------------------------------------------------
> NameError                                 Traceback (most recent call
> last)
>
> /Users/jonesbe/sage/sage-4.7.2.alpha2/devel/sage-test/sage/<ipython
> console> in <module>()
>
> NameError: name 'lambert_w' is not defined
> sage:
> }}}
>
> `mpmath` can evaluate the `lambert_w` function, so it should be easy to
> add a new symbolic function to Sage that will fix this issue.
>
> ----
>
> Apply:
>
>  * Patch at #12507
>  * [attachment:trac_11888_v5.patch] to `$SAGE_ROOT/devel/sage`

New description:

 Maxima returns solutions to some exponential equations in terms of the
 `lambert_w` function. Sage is missing a conversion for this function:

 {{{

 sage: solve(e^(5*x)+x==0, x, to_poly_solve=True)
 [x == -1/5*lambert_w(5)]
 sage: S = solve(e^(5*x)+x==0, x, to_poly_solve=True)
 sage: z = S[0].rhs()
 sage: z
 -1/5*lambert_w(5)
 sage: N(z)
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

 /Users/jonesbe/sage/sage-4.7.2.alpha2/devel/sage-test/sage/<ipython
 console> in <module>()

 /Users/jonesbe/sage/latest/local/lib/python2.6/site-
 packages/sage/misc/functional.pyc in numerical_approx(x, prec, digits)
    1264             prec = int((digits+1) * 3.32192) + 1
    1265     try:
 -> 1266         return x._numerical_approx(prec)
    1267     except AttributeError:
    1268         from sage.rings.complex_double import
 is_ComplexDoubleElement

 /Users/jonesbe/sage/latest/local/lib/python2.6/site-
 packages/sage/symbolic/expression.so in
 sage.symbolic.expression.Expression._numerical_approx
 (sage/symbolic/expression.cpp:17950)()

 TypeError: cannot evaluate symbolic expression numerically
 sage: lambert_w(5)
 ---------------------------------------------------------------------------
 NameError                                 Traceback (most recent call
 last)

 /Users/jonesbe/sage/sage-4.7.2.alpha2/devel/sage-test/sage/<ipython
 console> in <module>()

 NameError: name 'lambert_w' is not defined
 sage:
 }}}

 `mpmath` can evaluate the `lambert_w` function, so it should be easy to
 add a new symbolic function to Sage that will fix this issue.

 ----

 Apply:

  * [attachment:trac_11888_v7.patch] to `$SAGE_ROOT/devel/sage`

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11888#comment:39>
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