Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit e52fb2e

Browse files
committedNov 19, 2017
initial implementation of sine Fresnel
1 parent 92f95ce commit e52fb2e

File tree

2 files changed

+73
-4
lines changed

2 files changed

+73
-4
lines changed
 

‎src/sage/functions/all.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
abs_symbolic, sqrt, log_gamma,
2626
gamma_inc, incomplete_gamma, gamma_inc_lower,
2727
arg, real_part, real, frac,
28-
imag_part, imag, imaginary, conjugate, cases)
28+
imag_part, imag, imaginary, conjugate, cases, fresnel_sin)
2929

3030
from .log import (exp, exp_polar, log, ln, polylog, dilog, lambert_w, harmonic_number)
3131

@@ -84,4 +84,3 @@
8484
exponential_integral_1, Ei, exp_integral_ei)
8585

8686
from .hypergeometric import hypergeometric, hypergeometric_M, hypergeometric_U
87-

‎src/sage/functions/other.py

+72-2
Original file line numberDiff line numberDiff line change
@@ -1817,7 +1817,7 @@ def __init__(self):
18171817
The result is symbolic if exact input is given::
18181818
18191819
sage: ex = beta(2,1+5*I); ex
1820-
beta(...
1820+
beta...
18211821
sage: set(ex.operands()) == set([1+5*I, 2])
18221822
True
18231823
sage: beta(2, 2.)
@@ -2644,7 +2644,7 @@ def __call__(self, l, **kwargs):
26442644
Traceback (most recent call last):
26452645
...
26462646
TypeError: __call__() takes exactly 2 arguments (1 given)
2647-
2647+
26482648
sage: cases(x)
26492649
Traceback (most recent call last):
26502650
...
@@ -2696,3 +2696,73 @@ def _sympy_(self, l):
26962696

26972697
cases = Function_cases()
26982698

2699+
############################
2700+
# Fresnel integrals #
2701+
############################
2702+
class Function_Fresnel_sin(BuiltinFunction):
2703+
def __init__(self):
2704+
r"""
2705+
The sine Fresnel integral.
2706+
2707+
It is defined by the integral
2708+
2709+
.. MATH ::
2710+
2711+
\operatorname(S)(x) = \int_0^x \sin\left(\frac{\pi t^2}{2}\right)\, dt
2712+
2713+
for real `x`. Using power series expansions, it can be extended to the
2714+
domain of complex numbers. See the :wikipedia:`Fresnel_integral`.
2715+
2716+
INPUT:
2717+
2718+
- ``x`` -- the argument of the function
2719+
2720+
EXAMPLES::
2721+
2722+
sage: from sage.functions.other import fresnel_sin
2723+
sage: fresnel_sin(0)
2724+
0
2725+
sage: fresnel_sin(x).subs(x==0)
2726+
0
2727+
sage: x = var('x')
2728+
sage: fresnel_sin(1).n(100)
2729+
0.43825914739035476607675669662
2730+
sage: fresnel_sin(x)._sympy_()
2731+
fresnels(x)
2732+
"""
2733+
BuiltinFunction.__init__(self, "fresnel_sin", nargs=1,
2734+
latex_name=r"\operatorname{S}",
2735+
conversions=dict(maxima='fresnel_s',
2736+
sympy='fresnels',
2737+
mathematica='FresnelS',
2738+
maple='FresnelS'))
2739+
2740+
def _eval_(self, x):
2741+
r"""
2742+
EXAMPLES::
2743+
2744+
sage: from sage.functions.other import fresnel_sin
2745+
sage: fresnel_sin(pi)
2746+
fresnel_sin(pi)
2747+
sage: fresnel_sin(pi).n(100)
2748+
0.59824907809026766482843860921
2749+
"""
2750+
return None
2751+
2752+
def _evalf_(self, x, parent=None, algorithm=None):
2753+
r"""
2754+
EXAMPLES::
2755+
2756+
sage: from sage.functions.other import fresnel_sin
2757+
sage: fresnel_sin(pi)
2758+
fresnel_sin(pi)
2759+
sage: fresnel_sin(pi).n(100)
2760+
0.59824907809026766482843860921
2761+
sage: fresnel_sin(1.0+2*I)
2762+
36.7254648839914 + 15.5877511044046*I
2763+
"""
2764+
import mpmath
2765+
from sage.libs.mpmath import utils as mpmath_utils
2766+
return mpmath_utils.call(mpmath.fresnels, x, parent=parent)
2767+
2768+
fresnel_sin = Function_Fresnel_sin()

0 commit comments

Comments
 (0)
This repository has been archived.