Copyright | (c) Antony Courtney and Henrik Nilsson Yale University 2003 |
---|---|

License | BSD-style (see the LICENSE file in the distribution) |

Maintainer | ivan.perez@keera.co.uk |

Stability | provisional |

Portability | non-portable (GHC extensions) |

Safe Haskell | None |

Language | Haskell98 |

Integration and derivation of input signals.

In continuous time, these primitives define SFs that integrate/derive the input signal. Since this is subject to the sampling resolution, simple versions are implemented (like the rectangle rule for the integral).

In discrete time, all we do is count the number of events.

The combinator `iterFrom`

gives enough flexibility to program your own
leak-free integration and derivation SFs.

## Synopsis

- integral :: VectorSpace a s => SF a a
- imIntegral :: VectorSpace a s => a -> SF a a
- impulseIntegral :: VectorSpace a k => SF (a, Event a) a
- count :: Integral b => SF (Event a) (Event b)
- derivative :: VectorSpace a s => SF a a
- iterFrom :: (a -> a -> DTime -> b -> b) -> b -> SF a b

# Integration

integral :: VectorSpace a s => SF a a Source #

Integration using the rectangle rule.

imIntegral :: VectorSpace a s => a -> SF a a Source #

"Immediate" integration (using the function's value at the current time)

impulseIntegral :: VectorSpace a k => SF (a, Event a) a Source #

Integrate the first input signal and add the *discrete* accumulation (sum)
of the second, discrete, input signal.

count :: Integral b => SF (Event a) (Event b) Source #

Count the occurrences of input events.

`>>>`

[Event 1,NoEvent,Event 2]`embed count (deltaEncode 1 [Event 'a', NoEvent, Event 'b'])`

# Differentiation

derivative :: VectorSpace a s => SF a a Source #

A very crude version of a derivative. It simply divides the value difference by the time difference. Use at your own risk.