Ask Your Question

# Revision history [back]

### does sagemath support fresnels function?

I am trying to run integration on file that contains problems using fresnels functions. I am not even able to load the file, since sagemath complains that it does not know fresnels.

This function is there in sympy http://docs.sympy.org/latest/modules/functions/special.html?highlight=fresnel#sympy.functions.special.error_functions.fresnels

>python
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56)
>>> from sympy import *
>>> fresnels(x)
fresnels(x)


But in Sagemath

sage: var('x')
x
sage: fresnels(x)
NameError                                 Traceback (most recent call last)
<ipython-input-10-08120c00ce46> in <module>()
----> 1 fresnels(x)

NameError: name 'fresnels' is not defined


It is no problem for this to fail, as I can capture the exception. But the problem is that I can't even load the file itself to begin with. The sage script I have starts by reading a plain text file, which contains a list of the problems. Like this

 var('a b c d e m n x ')
lst=[[x^7*fresnels(b*x),x,6,],
[x^6*fresnels(b*x),x,6,],
[x^5*fresnels(b*x),x,5,],
[x^4*fresnels(b*x),x,5,]]


The sage script does this

        load(currentTestFile)


Where the currentTestFile is as shown above.

And once loaded, it iterates over each integral in the list and run it. But it seems sage parses the file during loading:

>./build_giac.sage
Test starting.....
load(currentTestName) #read the problems. This also contains the var('') statement.
File "sage/misc/persist.pyx", line 136, in sage.misc.persist.load (build/cythonized/sage/misc/persist.c:2440)
File "/usr/lib/python2.7/site-packages/sage/repl/load.py", line 263, in load
exec(preparse_file(f.read()) + "\n", globals)
File "<string>", line 3, in <module>
NameError: name 'fresnels' is not defined


So I am not able to even load the file. If I can even load the file, then if the integral fails afterwords, it is OK, since I can trap the exception, mark it as failed, and go to the next integral.

First question is: Does Sagemath have no support for fresnels? And in this case, how could one bypass this error during reading of the input file to give me a change to run the integrals?

Using SageMath version 8.3.rc2, Release Date: 2018-07-22

Thank you

--Nasser