#3401: Make Li symbolic and work with complex input
---------------------------------+------------------------------------------
Reporter: was | Owner: gfurnish
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-5.3
Component: calculus | Resolution:
Keywords: beginner | Work issues:
Report Upstream: N/A | Reviewers: Mike Hansen, Karl-Dieter
Crisman, Burcin Erocal, Benjamin Jones
Authors: Michael Yurko | Merged in:
Dependencies: #11143 | Stopgaps:
---------------------------------+------------------------------------------
Comment (by martinx):
Replying to [comment:26 benjaminfjones]:
> Don't worry about the coding conventions, some of them are unwritten and
some of them are subtle.
and I am a slow learner anyway :)
>I found a few doctest errors after running `make ptestlong` with the
patches applied. These should be simple to fix:
>
> Change 9 to 10:
Agreed.
>
> simple change, `Li` is now fully symbolic:
> {{{
> File
"/home/jonesbe/sage/sage-5.2/devel/sage-11143/sage/functions/transcendental.py",
lin
> e 195:
> sage: Li(100)
> Expected:
> 29.080977804
> Got:
> -log_integral(2) + log_integral(100)
> }}}
The function can be removed since it was just a convenience one to support
the original li and Li.
>
> This one is more mysterious:
> {{{
> File
"/home/jonesbe/sage/sage-5.2/devel/sage-11143/sage/symbolic/random_tests.py",
line 2
> 36:
> sage: print "ignore this"; random_expr(50, nvars=3,
coeff_generator=CDF.random_eleme
> nt) # random
> Exception raised:
> Traceback (most recent call last): File
"/home/jonesbe/sage/sage-5.2/local/bin/ncadoctest.py", line 1231, in
run_one_test
> self.run_one_example(test, example, filename, compileflags)
> File "/home/jonesbe/sage/sage-5.2/local/bin/sagedoctest.py", line
38, in run_one_ex
> ample
> OrigDocTestRunner.run_one_example(self, test, example, filename,
compileflags)
> File "/home/jonesbe/sage/sage-5.2/local/bin/ncadoctest.py", line
1172, in run_one_e
> xample
> compileflags, 1) in test.globs
> File "<doctest __main__.example_5[4]>", line 1, in <module>
> print "ignore this"; random_expr(Integer(50), nvars=Integer(3),
coeff_generator=CDF.random_element) # random###line 236:
> sage: print "ignore this"; random_expr(50, nvars=3,
coeff_generator=CDF.random_element) # random
>
> sage: print "ignore this"; random_expr(50, nvars=3,
coeff_generator=CDF.random_element) # random
> File "/home/jonesbe/sage/sage-5.2/local/lib/python/site-
packages/sage/symbolic/random_tests.py", line 258, in random_expr
> return random_expr_helper(size, internal, leaves, verbose)
> File "/home/jonesbe/sage/sage-5.2/local/lib/python/site-
packages/sage/symbolic/random_tests.py", line 206, in random_expr_helper
> children = [random_expr_helper(n+1, internal, leaves, verbose)
for n in nodes_per_child]
> File "/home/jonesbe/sage/sage-5.2/local/lib/python/site-
packages/sage/symbolic/random_tests.py", line 209, in random_expr_helper
> return r[1](*children)
> File "function.pyx", line 432, in
sage.symbolic.function.Function.__call__ (sage/symbolic/function.cpp:4941)
> res = g_function_evalv(self._serial, vec, hold)
> File "/home/jonesbe/sage/sage-5.2/local/lib/python/site-
packages/sage/symbolic/integration/integral.py", line 173, in _eval_
> return integrator(*args)
> File "/home/jonesbe/sage/sage-5.2/local/lib/python/site-
packages/sage/symbolic/integration/external.py", line 21, in
maxima_integrator
> result = maxima.sr_integral(expression, v, a, b)
> File "/home/jonesbe/sage/sage-5.2/local/lib/python/site-
packages/sage/interfaces/maxima_lib.py", line 746, in sr_integral
> raise error
> RuntimeError: ECL says: Error executing code in Maxima: defint:
upper limit of integration must be real; found
> elliptic_eu(.18648175298340663*I-.7457199773032457,
> coth(v3)*(v3*(.12348638361486497*I+.29875723285490263)
> +v1*(.12348638361486497*I+.29875723285490263)
>
-sinh(v3^(.5481180571998028*I-.5534231539946481))))
> }}}
The function randomly selects from a list of all Pynac functions, to which
is now added Li, and so now the functions chosen have changed. The docs
state that it will often raise an error because it tries to create an
erroneous expression. In this case it is trying to pass a complex
expression to Maxima. Trial and error and got a return result setting the
seed to 1.
When I have worked out how to merge patches I'll post a revised patch for
review that addresses all comments made so far.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/3401#comment:32>
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.