def periodicReflected(f, period):
	"""
	Return a new function F(t) such that it has the following properties.

	Define P as the given period, and f as the initial function. Then

			/ f(t), 0 <= t < P/2
	F(t) = | 
			\ f(P - t), P/2 <= t < P

	F(t) also satisfies F(t + n*P) = F(t) for all integers n.
	"""
	half_period = period/2
	def _f(t):
		t %= period
		if t > half_period:
			return f(period - t)
		return f(t)
	return _f