Repository: sympy/sympy (Python)

Issue:
fresnels: write as integral missing pi
@arnabnandikgp I noticed something about the fresnels rewrite:
```
In [12]: S = fresnels(x)

In [13]: S.diff(x)
Out[13]: 
   ⎛   2⎞
   ⎜π⋅x ⎟
sin⎜────⎟
   ⎝ 2  ⎠

In [14]: S.rewrite(Integral)
Out[14]: 
x           
⌠           
⎮    ⎛ 2⎞   
⎮ sin⎝t ⎠ dt
⌡           
0           

In [15]: _.diff(x)
Out[15]: 
   ⎛ 2⎞
sin⎝x ⎠
```



Discussion:
FresnelC as well.

Maybe we can add new tests, something like the above, where differentiating the rewritten result is tested to match differentiating fresnel itself.
Ohk, it seems that fresnel integrals are defined by either `t**2` or `pi*t**2/2` as arguments and different literature prefer different forms, going through the code it turns out that sympy uses the latter definition and thus the error, as while adding rewrite I considered the former definition. Thanks for pointing out! will fix this.



Patch:
diff --git a/sympy/functions/special/error_functions.py b/sympy/functions/special/error_functions.py
index 808866dea314..eeaa3ddb5efe 100644
--- a/sympy/functions/special/error_functions.py
+++ b/sympy/functions/special/error_functions.py
@@ -2476,7 +2476,7 @@ def _eval_rewrite_as_meijerg(self, z, **kwargs):
     def _eval_rewrite_as_Integral(self, z, **kwargs):
         from sympy.integrals.integrals import Integral
         t = Dummy(uniquely_named_symbol('t', [z]).name)
-        return Integral(sin(t**2), (t, 0, z))
+        return Integral(sin(pi*t**2/2), (t, 0, z))
 
     def _eval_as_leading_term(self, x, logx=None, cdir=0):
         from sympy.series.order import Order
@@ -2637,7 +2637,7 @@ def _eval_rewrite_as_meijerg(self, z, **kwargs):
     def _eval_rewrite_as_Integral(self, z, **kwargs):
         from sympy.integrals.integrals import Integral
         t = Dummy(uniquely_named_symbol('t', [z]).name)
-        return Integral(cos(t**2), (t, 0, z))
+        return Integral(cos(pi*t**2/2), (t, 0, z))
 
     def _eval_as_leading_term(self, x, logx=None, cdir=0):
         from sympy.series.order import Order


Test patch:
diff --git a/sympy/functions/special/tests/test_error_functions.py b/sympy/functions/special/tests/test_error_functions.py
index 2ad877cc9a42..774ee183cb06 100644
--- a/sympy/functions/special/tests/test_error_functions.py
+++ b/sympy/functions/special/tests/test_error_functions.py
@@ -828,10 +828,12 @@ def test_fresnel_series():
     assert ((3*fresnelc(2*z)).series(z, oo) - 3*fc.subs(z, 2*z)).expand().is_Order
 
 
-def test_integral_rewrites(): #issues 26134, 26144
+def test_integral_rewrites(): #issues 26134, 26144, 26306
     assert expint(n, x).rewrite(Integral).dummy_eq(Integral(t**-n * exp(-t*x), (t, 1, oo)))
     assert Si(x).rewrite(Integral).dummy_eq(Integral(sinc(t), (t, 0, x)))
     assert Ci(x).rewrite(Integral).dummy_eq(log(x) - Integral((1 - cos(t))/t, (t, 0, x)) + EulerGamma)
-    assert fresnels(x).rewrite(Integral).dummy_eq(Integral(sin(t**2), (t, 0, x)))
-    assert fresnelc(x).rewrite(Integral).dummy_eq(Integral(cos(t**2), (t, 0, x)))
+    assert fresnels(x).rewrite(Integral).dummy_eq(Integral(sin(pi*t**2/2), (t, 0, x)))
+    assert fresnelc(x).rewrite(Integral).dummy_eq(Integral(cos(pi*t**2/2), (t, 0, x)))
     assert Ei(x).rewrite(Integral).dummy_eq(Integral(exp(t)/t, (t, -oo, x)))
+    assert fresnels(x).diff(x) == fresnels(x).rewrite(Integral).diff(x)
+    assert fresnelc(x).diff(x) == fresnelc(x).rewrite(Integral).diff(x)