#13181: Managed to break _limit_latex argument passing.
------------------------------------------+---------------------------------
       Reporter:  JoalHeagney             |         Owner:  burcin  
           Type:  defect                  |        Status:  new     
       Priority:  minor                   |     Milestone:  sage-5.6
      Component:  calculus                |    Resolution:          
       Keywords:  limits latex integrals  |   Work issues:          
Report Upstream:  N/A                     |     Reviewers:          
        Authors:  Joal Heagney            |     Merged in:          
   Dependencies:                          |      Stopgaps:          
------------------------------------------+---------------------------------
Description changed by burcin:

Old description:

> Here's my code and it's results (in italics):
>
> {{{
> def fracintegral(func,xsub,n,a=0):
>     t = var('t')
>     assume(t > a)
>     assume(x > a)
>     return integrate((x-t)^(n-1)*func.subs({xsub:t}),t,a,x)/gamma(n)
> fracintegral(x,x,1/2)
>
> }}}
> ''4/3*x!^(3/2)/sqrt(pi)''
>
> {{{
> a = fracintegral(sin(x),x,1/2)
> a
>
> }}}
> ''-1/2*(sqrt(x)*sin(x)*expintegral_e(1/2, -I*x) +
> sqrt(x)*sin(x)*expintegral_e(1/2, I*x) +
> I*sqrt(x)*cos(x)*expintegral_e(1/2, -I*x) -
> I*sqrt(x)*cos(x)*expintegral_e(1/2, I*x) -
> 2*limit(-1/2*(I*expintegral_e(1/2, -I*t + I*x) - I*expintegral_e(1/2, I*t
> - I*x))*sqrt(-t + x)*cos(x) + 1/2*(expintegral_e(1/2, -I*t + I*x) +
> expintegral_e(1/2, I*t - I*x))*sqrt(-t + x)*sin(x), t, x,
> minus))/sqrt(pi)''
>
> This works if pretty printing (Typeset) is off, but the very last line
> (a) throws the following error if it is turned on.
>
> ''Traceback (most recent call last): ''
>
> ''            File "<stdin>", line 1, in <module> ''
>
> ''         File "_sage_input_25.py", line 10, in <module>     exec
> compile(u'open("!__    _code!__    _.py","w").write("# -*- coding: utf-8
> -*-\\n" +
> _support_.preparse_worksheet_cell(base64.b64decode("YQ=="),globals())+"\\n");
> execfile(os.path.abspath("!__    _code!__    _.py")) ''
>
> ''         File "", line 1, in <module> ''
>
> ''            File "/tmp/tmpdqa295/!__    _code!__    _.py", line 2, in
> <module>     exec compile(u'a   File "", line 1, in <module> ''
>
> ''         File "/home/joal/bin/sage-5.0.1/local/lib/python2.7/site-
> packages/sage/misc/latex.py", line 2280, in pretty_print     view(object)
> ''
>
> ''         File "/home/joal/bin/sage-5.0.1/local/lib/python2.7/site-
> packages/sage/misc/latex.py", line 2006, in view     s =
> _latex_file_(objects, title=title, sep=sep, tiny=tiny, debug=debug,
> !**latex_options) ''
>
> ''         File "/home/joal/bin/sage-5.0.1/local/lib/python2.7/site-
> packages/sage/misc/latex.py", line 1661, in _latex_file_     L = latex(x)
> ''
>
> ''         File "/home/joal/bin/sage-5.0.1/local/lib/python2.7/site-
> packages/sage/misc/latex.py", line 909, in !__    call!__         return
> !LatexExpr    (x._latex_()) ''   ''   ''
>
> ''         File "expression.pyx", line 667, in
> sage.symbolic.expression.Expression._latex_
> (sage/symbolic/!expression.cpp:4236    )''
>
> ''         File "ring.pyx", line 605, in sage.symbolic.ring.!SymbolicRing
> ._latex_element_ (sage/symbolic/!ring.cpp:6658    ) ''
>
> ''         ''   ''   File "pynac.pyx", line 433, in
> sage.symbolic.pynac.py_latex_function (sage/symbolic/!pynac.cpp:4817    )
> ''   ''   ''
>
> ''         File "pynac.pyx", line 407, in
> sage.symbolic.pynac.py_latex_function_pystring
> (sage/symbolic/!pynac.cpp:4443    ) ''
>
> ''            !TypeError: _limit_latex_() takes exactly 4 arguments (5
> given)''
>
> Interestingly, if I evaluate the fractional integral of sine directly
> (outside the function), it doesn't pop up any errors at all, AND
> simplifies to a simpler expression.
>
> {{{
> integrate(t^(-1/2)*sin(t),t,0,x)
> }}}
> ''1/4*((I - 1)*sqrt(2)*erf((1/2*I - 1/2)*sqrt(2)*sqrt(x)) + (I +
> 1)*sqrt(2)*erf((1/2*I + 1/2)*sqrt(2)*sqrt(x)))*sqrt(pi)''

New description:

 Here's my code and it's results (in italics):

 {{{
 sage: def fracintegral(func,xsub,n,a=0):
 ....:     t = var('t')
 ....:     assume(t > a)
 ....:     assume(x > a)
 ....:     return integrate((x-t)^(n-1)*func.subs({xsub:t}),t,a,x)/gamma(n)
 ....:
 sage: fracintegral(x,x,1/2)
 4/3*x^(3/2)/sqrt(pi)
 }}}

 {{{
 sage: a = fracintegral(sin(x),x,1/2)
 sage: a
 -1/2*(sqrt(x)*sin(x)*expintegral_e(1/2, -I*x) +
 sqrt(x)*sin(x)*expintegral_e(1/2, I*x) +
 I*sqrt(x)*cos(x)*expintegral_e(1/2, -I*x) -
 I*sqrt(x)*cos(x)*expintegral_e(1/2, I*x) -
 2*limit(-1/2*(I*expintegral_e(1/2, -I*t + I*x) - I*expintegral_e(1/2, I*t
 - I*x))*sqrt(-t + x)*cos(x) + 1/2*(expintegral_e(1/2, -I*t + I*x) +
 expintegral_e(1/2, I*t - I*x))*sqrt(-t + x)*sin(x), t, x, minus))/sqrt(pi)
 }}}

 This works if pretty printing (Typeset) is off, but the very last line (a)
 throws the following error if it is turned on.

 {{{
 Traceback (most recent call last):

             File "<stdin>", line 1, in <module>

          File "_sage_input_25.py", line 10, in <module>     exec
 compile(u'open("!__    _code!__    _.py","w").write("# -*- coding: utf-8
 -*-\\n" +
 _support_.preparse_worksheet_cell(base64.b64decode("YQ=="),globals())+"\\n");
 execfile(os.path.abspath("!__    _code!__    _.py"))

          File "", line 1, in <module>

             File "/tmp/tmpdqa295/!__    _code!__    _.py", line 2, in
 <module>     exec compile(u'a   File "", line 1, in <module>

          File "/home/joal/bin/sage-5.0.1/local/lib/python2.7/site-
 packages/sage/misc/latex.py", line 2280, in pretty_print     view(object)

          File "/home/joal/bin/sage-5.0.1/local/lib/python2.7/site-
 packages/sage/misc/latex.py", line 2006, in view     s =
 _latex_file_(objects, title=title, sep=sep, tiny=tiny, debug=debug,
 !**latex_options)

          File "/home/joal/bin/sage-5.0.1/local/lib/python2.7/site-
 packages/sage/misc/latex.py", line 1661, in _latex_file_     L = latex(x)

          File "/home/joal/bin/sage-5.0.1/local/lib/python2.7/site-
 packages/sage/misc/latex.py", line 909, in !__    call!__         return
 !LatexExpr    (x._latex_()) ''   ''

          File "expression.pyx", line 667, in
 sage.symbolic.expression.Expression._latex_
 (sage/symbolic/!expression.cpp:4236    )

          File "ring.pyx", line 605, in sage.symbolic.ring.!SymbolicRing
 ._latex_element_ (sage/symbolic/!ring.cpp:6658    )

          File "pynac.pyx", line 433, in
 sage.symbolic.pynac.py_latex_function (sage/symbolic/!pynac.cpp:4817    )

          File "pynac.pyx", line 407, in
 sage.symbolic.pynac.py_latex_function_pystring
 (sage/symbolic/!pynac.cpp:4443    )

             !TypeError: _limit_latex_() takes exactly 4 arguments (5
 given)
 }}}

 Interestingly, if I evaluate the fractional integral of sine directly
 (outside the function), it doesn't pop up any errors at all, AND
 simplifies to a simpler expression.

 {{{
 sage: integrate(t^(-1/2)*sin(t),t,0,x)
 1/4*((I - 1)*sqrt(2)*erf((1/2*I - 1/2)*sqrt(2)*sqrt(x)) + (I +
 1)*sqrt(2)*erf((1/2*I + 1/2)*sqrt(2)*sqrt(x)))*sqrt(pi)
 }}}

--

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