Boost logo

Boost Users :

From: Hicham Mouline (hicham_at_[hidden])
Date: 2008-04-28 18:10:46


>Hicham Mouline wrote:
>>> Are there libraries with class templates for the following concepts:
>>>
>>> . notion of mathematical function f(x1,x2,.,xn), and perhaps
>>> derivation/integration
>>>
>>> . any-order multidim partial differential equations?
>>>
>>> . multidim stochastic differential equations?
>Not at present, sorry,
>Regards, John.

If I were to attempt to implement such things, I would need to familiarize
myself
with boost::function maybe, boost::mpl, boost::math for special functions?

I just finished reading the interesting "c++ template metaprogramming" which
highlights
such a large number of ideas that I will read once more.

Assuming the general case of a set of stochastic processes x1....xm (X is a
vector of xi):
dx1 = a1(t, X) dt + b11(t,X) dW1 + b12(t,X)dW2 + .... + b1n(t,X) dWn
...
dxm = am(t, X) dt + bm1(t,X) dW1 + bm2(t,X)dW2 + .... + bmn(t,X) dWn

where

ai: functionals of time and the state vector X
bij: functionals of time and the state vector X
Wj: non deterministic processes, governed by various statistical
distributions (e.g. Normal)
(perhaps ones listed in boost::math), with correlation matrix M

n and m would have to be runtime variables in my case as the end-user might
have
thousands of processes.

How would one model such a thing?

class StochasticProcessesSet {
  template<class A, class B, class W>
  explicit StochasticProcessesSet(const std::vector<const A*>,
                                  const std::vector<const B*>,
                                  const std::vector<const W*>)
  {
     // 1. for correctness, runtime assertion that the sizes of the 3
vectors
     // are consistent with the system of equations above
     // 2. how to enforce that A and B are functionals that take the
appropriate
     // number of arguments.
     // It seems impossible to mix a compile-time check on the template
arguments
     // with the runtime variables n and m
     // 3. How to enforce W is one of the stat distributions
  }
};

I would want to have special cases (perhaps for efficiency) for the above
such as:
1 stochastic process dependent on n Wi with functionals dependent just on
itself and time
class StochasticProcess {
....
};

What relationship should StochasticProcess have with StochasticProcessesSet?

A final special case would be 1 process driven only by source of randomness,
not n.

Clearly, these first thoughts are not applicable, given than n and m need to
be runtime.

Regards,


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net