I had this problem on my exam yesterday and would like to see how others would approach this problem. It just seemed like a lot of calculation for how much time I had, which makes me wonder if there is a different, simpler approach.
Integrate $f(z)=\cos(z)+i$, where $z(\theta)=\frac{\pi}{4}e^{\theta i}$ on $0\le \theta \le \pi$.
My approach was to use the Cauchy integral formula. $$ \begin{align*} \int_C f(z) \, dz& =\int_{0}^\pi f[(\theta)]z'(\theta)\, d\theta \\ f[z(\theta)] &=\cos \left(\frac{\pi}{4}e^{\theta i} \right)+i \ \ \text{and} \ \ z'(\theta)=\frac{\pi}{4} i e^{\theta i} \\ \Rightarrow \int_C f(z)\, dz &= \int_{0}^\pi \left(\cos \left(\frac{\pi}{4}e^{\theta i} \right)+i \right)\left( \frac{\pi}{4} i e^{\theta i} \right)\, d\theta \\ &= \frac{\pi}{4} i \int_{0}^\pi e^{i \theta}\cos \left(\frac{\pi}{4} e^{\theta i} \right) \, d\theta-\frac{\pi}{4} \int_0^\pi e^{i\theta}\, d\theta \end{align*}$$
From here, I just evaluated the two integrals, performing integration by parts twice on the first integral. Is this the correct approach to this problem, does it work? Is there a simpler way to go about it?
Thank you!
================================================
Εdit: I just wanted to finish out the problem using the CIF.
From where I left off, $$ \int_C f(z)dz= \frac{\pi}{4} i \int_{0}^\pi e^{i \theta}\cos \left(\frac{\pi}{4} e^{\theta i} \right) \, d\theta-\frac{\pi}{4} \int_0^\pi e^{i\theta}\, d\theta $$
Splitting the integral up, we have
$$ \frac{\pi}{4} \int_0^\pi e^{i\theta}\, d\theta = \frac{\pi}{4} \bigg[-ie^{i\theta}\bigg]_0^\pi = -\frac{\pi}{4}i(e^{i\pi}-e^0)=-\frac{\pi}{4} i((-1)-1)=\frac{\pi}{2} i $$ and $$\frac{\pi}{4} i \int_{0}^\pi e^{i \theta}\cos \left(\frac{\pi}{4} e^{\theta i} \right) \, d\theta, \\ \text{Let} \ \ u=e^{i\theta} \Rightarrow du=ie^{i\theta}; \ \text{when} \ \theta=\pi, \ u=-1 \ \text{and when} \ \theta=0, \ u=1 \\ \therefore \frac{\pi}{4} i \int_{1}^{-1}u\cos\left(\frac{\pi}{4}u\right)du=\frac{\pi}{4}\left[ -\frac{4}{\pi} \sin\left(\frac{\pi}{4}u\right)u\bigg|_1^{-1}+\frac{4}{\pi} \int_1^{-1}\sin\left(\frac{\pi}{4}u\right)du\right] \\ =-2\sin\left(\frac{\pi}{4}\right)+\left( \cos\left( -\frac{\pi}{4} \right)-\cos\left( \frac{\pi}{4} \right)\right)=-\frac{2\sqrt2}{2}=-\sqrt2$$ So, $$ \int_C f(z)dz= \frac{\pi}{4} i \int_{0}^\pi e^{i \theta}\cos \left(\frac{\pi}{4} e^{\theta i} \right) \, d\theta-\frac{\pi}{4} \int_0^\pi e^{i\theta}\, d\theta =-\sqrt2-\frac{\pi}{2}i $$
The mapping
$$z \mapsto f(z) := \cos(z) + i$$
is holomorphic and therefore
$$\int_{\gamma} f(z) \, dz = 0$$
for any closed curve $\gamma$. In particular,
$$\int_C f(z) \, dz + \int_{-\pi/4}^{\pi/4} f(t) \, dt = 0,$$
i.e.
$$\int_C f(z) \, dz = - \int_{-\pi/4}^{\pi/4} f(t) \, dt = - \bigg[ -\sin(t)+it \bigg]_{t=-\pi/4}^{\pi/4} = -\sqrt{2}-i \frac{\pi}{2}.$$