I'm getting {{{id=2| def math_bessel_K(nu,x): return mathematica(nu).BesselK(x).N(20).sage() math_bessel_K(2,I) /// Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/tclemans/.sage/sage_notebook/worksheets/admin/5/code/ 9.py", line 6, in <module> exec compile(ur'math_bessel_K(Integer(2),I)' + '\n', '', 'single') File "/home/was/s/data/extcode/sage/", line 1, in <module>
File "/home/tclemans/.sage/sage_notebook/worksheets/admin/5/code/ 9.py", line 5, in math_bessel_K return mathematica(nu).BesselK(x).N(Integer(20)).sage() File "/home/was/s/local/lib/python2.5/site-packages/sage/interfaces/ expect.py", line 1086, in sage return self._sage_() File "/home/was/s/local/lib/python2.5/site-packages/sage/interfaces/ expect.py", line 1079, in _sage_ return sage.misc.sage_eval.sage_eval(repr(self)) File "/home/was/s/local/lib/python2.5/site-packages/sage/misc/ sage_eval.py", line 112, in sage_eval raise SyntaxError, "%s\nError using SAGE to evaluate '%s'"%(msg, p) SyntaxError: invalid syntax (<string>, line 1) Error using SAGE to evaluate '- RealNumber('2.592886175491196978167651322538251462935637034451900356688') + RealNumber('0.180489972066962026629620880838378650496225604668529521981')*I' }}} On Dec 13, 11:21 am, "William Stein" <[EMAIL PROTECTED]> wrote: > On Dec 13, 2007 11:08 AM, pgdoyle <[EMAIL PROTECTED]> wrote: > > > > > Let me simplify the question. > > > Is there a better way to get Mathematica to go off and compute a > > Bessel function for me than this: > > > def math_bessel_K(nu,x): > > m=mathematica('N[BesselK['+str(mathematica(nu)) > > +','+str(mathematica(x))+'],20]') > > return m.sage() > > Yes there is, and you might even find this impressive: > > def math_bessel_K(nu,x): > return mathematica(nu).BesselK(x).N(20).sage() > > Use it: > > sage: math_bessel_K(2,I) > 0.180489972066962*I - 2.592886175491197 --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---