Message Boards Message Boards

Plot the first terms of Taylor series of the below function?

I have tried to plot the first term of Taylor expansion of the below function but I didn't come up to the plot . Any help, Where is the problem in my code ?
The Function is : $$I(x)=\int_{-\infty}^{x} \exp(-t^2 \operatorname {erfi}({(\sqrt{2\pi})t))}\operatorname {erf}({(\sqrt{2\pi})t)}) dt$$ The same Copy of that question is mentioned [here] , But the given code doesn't work at me in Wolfram cloud page, any help ? My Code :

Clear[\[Lambda], Ze, Z, ZTaylor];
        \[Lambda] = NIntegrate[Exp[-t^2* Erf[(Sqrt[2*Pi])*t]* Erfi[(Sqrt[2*Pi])*t]],{t,-Infinity,Infinity}];
        Ze[a_] := NIntegrate[Exp[-t^2* Erf[(Sqrt[2*Pi])*t]* Erfi[(Sqrt[2*Pi])*t]],{t,-Infinity,a}];
        Z[x_] := Integrate[Exp[-t^2* Erf[(Sqrt[2*Pi])*t]* Erfi[(Sqrt[2*Pi])*t]], {t, 0, x}];
        ZTaylor[n_][x_] := Series[Z[x], {x, 0, n}];
        TaylorSeries == ZTaylor[11][x] //TraditionalForm
        Plot[Evaluate[{Normal[ZTaylor[11][x]], Ze[x]}],
        With[{x = 1}, 
         Plot[Z[x] , {x, (x-(8x^5/5)), (
          -32/405 (-45+4Pi^2)x^9)}, {x, -1, 2}, 
          PlotRange -> {0, 1.5}, ImageSize -> 400, 


        ]]]
POSTED BY: Rafik zeraoulia
2 Replies

Hi Rafik, are you looking for something like this?

Clear[\[Lambda], Ze, Z, ZTaylor];
\[Lambda] = 
  NIntegrate[
   Exp[-t^2*Erf[(Sqrt[2*Pi])*t]*Erfi[(Sqrt[2*Pi])*t]], {t, -Infinity, 
    Infinity}];
Ze[a_] := 
  NIntegrate[
   Exp[-t^2*Erf[(Sqrt[2*Pi])*t]*Erfi[(Sqrt[2*Pi])*t]], {t, -Infinity, 
    a}];
Z[x_] := Integrate[
   Exp[-t^2*Erf[(Sqrt[2*Pi])*t]*Erfi[(Sqrt[2*Pi])*t]], {t, 0, x}];
ZTaylor[n_][x_] := Series[Z[x], {x, 0, n}];
TaylorSeries == ZTaylor[11][x] // TraditionalForm
Ze[1]
Plot[{Ze[1], 
  Z[x], {x, (x - (8 x^5/5)), (-32/405 (-45 + 4 Pi^2) x^9)}}, {x, -1, 
  2}, PlotRange -> {0, 1.5}, ImageSize -> 400]

im1

POSTED BY: Claudio Chaib

This gives an answer, which may or may not be what you have in mind:

i[x_] = Integrate[Exp[-t^2*Erf[(Sqrt[2*Pi])*t]*
    Erfi[(Sqrt[2*Pi])*t]],
  {t, -Infinity, x}]
Series[i[x], {x, 0, 1}] // Normal // N
Plot[%, {x, -1, 1}]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract