title: Fourier series of Piecewise PYTHON
body: <p>I tried to find the Fourier Series of </p>
  
  <p><a href="https://i.stack.imgur.com/Wa8pj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wa8pj.png" alt="piecewise"></a></p>
  
  <p>With simpy like :</p>
  
  <pre><code>p = Piecewise((sin(t), 0 &lt; t),(sin(t), t &lt; pi), (0 , pi &lt; t), (0, t &lt; 2*pi))
  fs = fourier_series(p, (t, 0, 2*pi)).truncate(8)
  </code></pre>
  
  <p>But it doesn't seem to work. It is stuck in * (looping?). Is there any way to solve that? Perhaps an alternative? Many thanks</p>