I have some very simple questions about how to define a periodic function in Mathematica. I've never used Mathematica before so please forgive my ignorance.
What I need to do is graph and obtain the Fourier series for a 2*Pi-periodic function. My function is defined as follows:
- exp(x) when -pi < x < pi
- cosh(pi) when x = -pi or x = pi
I told this to Mathematica this way:
f[x_] := Piecewise[{{Exp[x], -Pi < x < Pi}, {Cosh[x],
x == -Pi || x == Pi}}]
I think it worked properly because when I evaluate the function I get the appropriate results.
Now the problem is I need to extend this definition to the whole real number line, taking into account that f(x+2pi) = f(x). I tried to do this several ways, but none of them worked and I couldn't figure out a solution.
Another issue is how to plot this showing the points (n*pi, cosh(n*pi)). When I plot the function it shows the line for exp(x) but nothing for cosh(x), and I need the dots to be seen. Any help would be appreciated.