#11143: define symbolic functions for exponential integrals
------------------------------------------------------+---------------------
Reporter: kcrisman | Owner:
benjaminfjones
Type: defect | Status:
needs_review
Priority: major | Milestone:
sage-5.0
Component: symbolics | Resolution:
Keywords: ei Ei special function maxima sd32 | Work issues: rebase
to 5.0.beta10
Report Upstream: N/A | Reviewers: Burcin
Erocal, Karl-Dieter Crisman
Authors: Benjamin Jones | Merged in:
Dependencies: #11513, #11885 | Stopgaps:
------------------------------------------------------+---------------------
Comment (by JoalHeagney):
Hi guys. I don't know if this even applies, because I discovered this
behaviour on version 4.8, with the patch applied (And it seems to apply to
limit rather than anything else.)
However, if I enter the following code:
{{{
def fracintegral(func,n, xsub=x,a=0):
t = var('t')
assume(t > a)
assume(x > a)
return integrate(((x-t)^(n-1))*func(t),t,a,x)/gamma(n)
a = fracintegral(sin(x),1/2);a
}}}
I get the following returned:
{{{
-1/2*(sqrt(x)*sin(x)*exp_integral_e(1/2, -I*x) +
sqrt(x)*sin(x)*exp_integral_e(1/2, I*x) +
I*sqrt(x)*cos(x)*exp_integral_e(1/2, -I*x) -
I*sqrt(x)*cos(x)*exp_integral_e(1/2, I*x) -
2*limit(1/2*sqrt(-t)*sin(x)*exp_integral_e(1/2, -I*t) +
1/2*sqrt(-t)*sin(x)*exp_integral_e(1/2, I*t) -
1/2*I*sqrt(-t)*cos(x)*exp_integral_e(1/2, -I*t) +
1/2*I*sqrt(-t)*cos(x)*exp_integral_e(1/2, I*t), t, 0, minus))/sqrt(pi)
}}}
If I copy/paste this into a new sage notebook cell, I get the following
error:
{{{
Traceback (most recent call last):
1/2*I*sqrt(-t)*cos(x)*exp_integral_e(1/2, -I*t) +
File "", line 1, in <module>
File "/tmp/tmpbIxhPU/___code___.py", line 10, in <module>
_sage_const_1 /_sage_const_2
*I*sqrt(-t)*cos(x)*exp_integral_e(_sage_const_1 /_sage_const_2 , I*t), t,
_sage_const_0 , minus))/sqrt(pi)
NameError: name 'minus' is not defined
}}}
If I fix up the minus by doing this,
{{{
-1/2*(sqrt(x)*sin(x)*exp_integral_e(1/2, -I*x) +
sqrt(x)*sin(x)*exp_integral_e(1/2, I*x) +
I*sqrt(x)*cos(x)*exp_integral_e(1/2, -I*x) -
I*sqrt(x)*cos(x)*exp_integral_e(1/2, I*x) -
2*limit(1/2*sqrt(-t)*sin(x)*exp_integral_e(1/2, -I*t) +
1/2*sqrt(-t)*sin(x)*exp_integral_e(1/2, I*t) -
1/2*I*sqrt(-t)*cos(x)*exp_integral_e(1/2, -I*t) +
1/2*I*sqrt(-t)*cos(x)*exp_integral_e(1/2, I*t), t, 0, 'minus'))/sqrt(pi)
}}}
I get this error:
{{{
Traceback (most recent call last):
1/2*I*sqrt(-t)*cos(x)*exp_integral_e(1/2, -I*t) +
File "", line 1, in <module>
File "/tmp/tmpI2jAGB/___code___.py", line 10, in <module>
_sage_const_1 /_sage_const_2
*I*sqrt(-t)*cos(x)*exp_integral_e(_sage_const_1 /_sage_const_2 , I*t), t,
_sage_const_0 , 'minus'))/sqrt(pi)
File "/home/joal/bin/sage-4.8-linux-64bit-
ubuntu_10.04.3_lts-x86_64-Linux/local/lib/python2.6/site-
packages/sage/calculus/calculus.py", line 1131, in limit
raise ValueError, "call the limit function like this, e.g. limit(expr,
x=2)."
ValueError: call the limit function like this, e.g. limit(expr, x=2).
}}}
Then if I write it up in correct limit syntax like so:
{{{
b = 2*limit(1/2*sqrt(-t)*sin(x)*exp_integral_e(1/2, -I*t) +
1/2*sqrt(-t)*sin(x)*exp_integral_e(1/2, I*t) -
1/2*I*sqrt(-t)*cos(x)*exp_integral_e(1/2, -I*t) +
1/2*I*sqrt(-t)*cos(x)*exp_integral_e(1/2, I*t), t=0, dir='minus'); b
}}}
I get literally nothing from the notebook cell. If I then enter b and
evaluate in the next cell I get this:
{{{
2*limit(1/2*I*sqrt(t)*sin(x)*exp_integral_e(1/2, -I*t) +
1/2*I*sqrt(t)*sin(x)*exp_integral_e(1/2, I*t) +
1/2*sqrt(t)*cos(x)*exp_integral_e(1/2, -I*t) -
1/2*sqrt(t)*cos(x)*exp_integral_e(1/2, I*t), t, 0, minus)
}}}
This is all with Pretty Printing turned off. If I turn on Pretty Printing,
then the reply from the fracintegral call (on trig functions and
exponents) is this:
{{{
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_35.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8
-*-\\n" +
_support_.preparse_worksheet_cell(base64.b64decode("YSA9IGZyYWNpbnRlZ3JhbChzaW4oeCksMS8yKTth"),globals())+"\\n");
execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/tmp/tmpOvxXQw/___code___.py", line 3, in <module>
exec compile(u'a = fracintegral(sin(x),_sage_const_1 /_sage_const_2
);a
File "", line 1, in <module>
File "/home/joal/bin/sage-4.8-linux-64bit-
ubuntu_10.04.3_lts-x86_64-Linux/local/lib/python2.6/site-
packages/sage/misc/latex.py", line 2243, in pretty_print
view(object)
File "/home/joal/bin/sage-4.8-linux-64bit-
ubuntu_10.04.3_lts-x86_64-Linux/local/lib/python2.6/site-
packages/sage/misc/latex.py", line 1969, in view
s = _latex_file_(objects, title=title, sep=sep, tiny=tiny,
debug=debug, **latex_options)
File "/home/joal/bin/sage-4.8-linux-64bit-
ubuntu_10.04.3_lts-x86_64-Linux/local/lib/python2.6/site-
packages/sage/misc/latex.py", line 1624, in _latex_file_
L = latex(x)
File "/home/joal/bin/sage-4.8-linux-64bit-
ubuntu_10.04.3_lts-x86_64-Linux/local/lib/python2.6/site-
packages/sage/misc/latex.py", line 875, in __call__
return LatexExpr(x._latex_())
File "expression.pyx", line 667, in
sage.symbolic.expression.Expression._latex_
(sage/symbolic/expression.cpp:4121)
File "ring.pyx", line 596, in
sage.symbolic.ring.SymbolicRing._latex_element_
(sage/symbolic/ring.cpp:6461)
File "pynac.pyx", line 433, in sage.symbolic.pynac.py_latex_function
(sage/symbolic/pynac.cpp:4702)
File "pynac.pyx", line 407, in
sage.symbolic.pynac.py_latex_function_pystring
(sage/symbolic/pynac.cpp:4328)
TypeError: _limit_latex_() takes exactly 4 arguments (5 given)
}}}
Let me know if I should put this into another ticket for limit, but
kcrisman asked me to put this up here first.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11143#comment:45>
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.