= Solution
The derivative relations and initial values give $S'=C$, $S(0)=0$, $C'=-S$ and $C(0)=1$. Integrating from zero yields $S=\int_0^x C$ and $C=1-\int_0^x S$. Thus use mutually recursive <lazy lists>:
``
sinx, cosx :: Fractional a => [a]
sinx = integral cosx
cosx = minus one (integral sinx)
``
Both heads are available immediately, and later coefficients depend on earlier coefficients of the other stream. The resulting <formal power series> are \b[$S=x-x^3/3!+x^5/5!-\cdots$] and \b[$C=1-x^2/2!+x^4/4!-\cdots$]. Their zero coefficients and alternating signs follow directly from the coupled <recurrence relations>, providing a coefficientwise proof without assumptions about analytic <convergence>.
Back to article page