# Error complex function ERFI(X): looking for alternative function representations?

I have some analytical results from a physics problem, where the Mathematica gives the results in terms of complex error function. I would like to explore another function representation using Mathematica. Here it is the code for the function.

    U=(1/4+I/4)  1/k Sqrt[\[Pi]] /Sqrt[ k R]  E^(-((I k (R^2+L^2))/(2 R)))
(-erfi((1/2+I/2) 1  /Sqrt[k  R]
(R-Sqrt[d^2+L^2]))-erfi((1/2+I/2) 1  /Sqrt[ k  R]     (Sqrt[d^2+L^2]+R))+erfi((1/2+I/2) 1  /Sqrt[k  R] (R-L))+erfi((1/2+I/2) 1  /Sqrt[ k  R] (R+L)))


For example for simplicity taking some values constants, let's say k = 1; R = 1; d = 1;. It is possible to approximate using series, finally the real part is needed to have physical meaning and interpretation.

• Could you please elaborate why you need (or want) "another" representation instead? What is the purpose or form of such a representation?
– Syed
Nov 24 '21 at 13:08

Mathematica functions start with a capital letter, function definitions need square brackets! Change erfi( ...) to Erfi[ ... ]

U = (1/4 + I/4) 1/k Sqrt[\[Pi]]/
Sqrt[k R] E^(-((I k (R^2 + L^2))/(2 R)))
(-Erfi[(1/2 + I/2) 1/Sqrt[k R] (R - Sqrt[d^2 + L^2])] -
Erfi[(1/2 + I/2) 1/Sqrt[k R] (Sqrt[d^2 + L^2] + R)] +
Erfi[(1/2 + I/2) 1/Sqrt[k R] (R - L)] +
Erfi[(1/2 + I/2) 1/Sqrt[k R] (R + L)])


real part of U

ComplexExpand[Re[U]]:

(*
(Sqrt[\[Pi]] (k^2 R^2)^(3/4)
Cos[(k (L^2 + R^2))/(2 R)] Cos[1/2 Arg[k R]])/(4 k^3 R^2) + (
Sqrt[\[Pi]] (k^2 R^2)^(3/4)
Cos[1/2 Arg[k R]] Sin[(k (L^2 + R^2))/(2 R)])/(4 k^3 R^2) + (
Sqrt[\[Pi]] (k^2 R^2)^(3/4)
Cos[(k (L^2 + R^2))/(2 R)] Sin[1/2 Arg[k R]])/(4 k^3 R^2) - (
Sqrt[\[Pi]] (k^2 R^2)^(3/4)
Sin[(k (L^2 + R^2))/(2 R)] Sin[1/2 Arg[k R]])/(4 k^3 R^2)


*)

• Or ComplexExpand[Re[U], TargetFunctions -> {Re, Im}] // FullSimplify Nov 24 '21 at 14:33
Clear["Global*"]

(altRep = Entity["MathematicalFunction", "Erfi"][
"AlternativeRepresentations"]) // Column


(altRep2 = (#[z] & /@ altRep // Activate) /.
True -> Nothing) // Column


To make one into a replacement rule:

(#[[1]] /. z -> z_) -> #[[-1]] &@altRep2[[-2]]

(* Erfi[z_] -> (Sqrt[-z^2] (-1 + GammaRegularized[1/2, -z^2]))/z *)
`