Math::StochasticProcess - Stochastic Process
Version 0.04
use Math::StochasticProcess; my $analysis = Math::StochasticProcess->new(seed_event=>It_all_started_here=>new, tolerance=>0.0001); $analysis->run(); print $analysis->event("Dont_worry_It_might_never_happen")->probability(); ...
One defines a stochastic process by inheriting from the Math::StochasticProcess::Event class and implementing the virtual functions. The process can be run until all events have become resolved (or else have probabilities that have dipped below a tolerance parameter).
As an added convenience one may use the Math::StochasticProcess::Event::Tuple class which derives from the Event class. This represents a tuple of random variables. This defines all undefined base functions, apart from "iterate" which actually defines what how an Event moves to the next iteration.
For theoretical background, see wikipedia articles: http://en.wikipedia.org/wiki/Stochastic_matrix and http://en.wikipedia.org/wiki/Stochastic_processes.
This is a standard constructor function. The arguments are as follows:
This mandatory argument must be an instance of the Math::StochasticProcess::Event class and its probability must be 1.
This defaults to 0.00001. It specifies the probability below which we just throw events away.
If specified this determines how far we allow the sum of all probabilities to diverge from 1, before warning.
If specified this determines how far we allow the sum of all probabilities to diverge from 1, before dieing.
If specified this should be a FileHandle object to which we write our debug statements.
This is the core function of the whole package. It iterates from the seed event until no unresolved events remain. Once it completes the object can be queried for the results.
This returns the result of the run. With no additional parameters it runs a list of signatures and events which can be put in a hash. Otherwise it takes as a single non-object parameter a signature and returns the corresponding event.
This is another function returning the result of the run. With no additional parameters it runs a list of random variable names and their expected terminal values. This list can be put into a hash. Otherwise it takes as a single non-object parameter a random variable name and returns the corresponding expected value.
Internal function. Used by expectedValue
.
The number of unresolved events.
Ideally should always be zero, but must at least be close.
Internal function. Essentially one round in the "run" function.
Internal function. Called inside "run" function when in case two events are essentially the same.
Nicholas Bamber, <theabbot at silasthemonk.org.uk>
Please report any bugs or feature requests to bug-math-stochasticprocess at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Math-StochasticProcess. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Math::StochasticProcess
You can also look for information at:
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Math-StochasticProcess
Copyright 2008 Nicholas Bamber, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.