Taylor series
- To: mathgroup at smc.vnet.net
- Subject: [mg17479] Taylor series
- From: Enrique Aramendia <ea10598 at zurron.upna.es>
- Date: Mon, 10 May 1999 01:44:22 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Hello. I am a student from the public university of Navarra and I am
simulating optical systems. I need to get the Taylor series of
arctan(x), so I have tried:
Normal[Series[ArcTan[x],{x,0,5}]]
But this returns me the series only for some x values (-1<x<1). What is
the matter with the series if x<=-1 or 1<=x (I say, -Pi - 1/x +
1/(3*x^3) ... and Pi - 1/x + 1/(3*x^3) ...?
Anyway I thought I would avoid the problem by creating my own function:
arctan[x_,n_]:=
Which[x<=-1,-Pi/2 + Sum[(-1)^i * 1/((2*i-1)*x^(2*i-1)), {i,1,(n+1)/2}],
-1<x && x<1,Sum[(-1)^(i+1) * (x^(2*i-1))/(2*i-1),{i,1,(n+1)/2}],
1<=x,Pi/2 + Sum[(-1)^i * 1/((2*i-1)*x^(2*i-1)), {i,1,(n+1)/2}]]
Although Mathematica returs me some errors, I can plot the function with
Plot[arctan[x,5],{x,-5,5}]. However if I use it within another context,
my function arctan generates errors.
Can anybody help me? Thanks in advance for your help and excuse my
english.