This project is read-only.
To use this library you will need the boost::mpl library -- see

There is no release here, since considers a release something like a binary.
To download the library click the source code tab and then click the "download" icon -- but not the Downloads tab -- below the "issue tracker" tab.

This library allows one to write mathematical expressions or mathematicall code,
and calculate not just only the value but also the first order or higher order derivatives.
Look into the main1.cpp to see an example on how to use this code.

The type of an expression changes depending on
  • which independent variables were involved
  • the operations involved
  • the maximum order of derivatives desired.
If you want to declare a variable and assign some expression to it, the type of the variable must contained at least the information contained inside the expression. If the variable type contains less than the expression, the compilation will fail.
Leave it up to the compiler to determine the type of variables -- by using the auto keyword.
In case of you want to declare a variable assigned in a if-statement or a question mark operator,
write code like this:

decltype(a + b) c;

if (something)
c = b;
c = a;

To declare a type for an independent variable use

typedef std::createCTaylor<boost::mpl::long_<0>, boost::mpl::long_<4> >::type C0;

Above typedef creates a type for an independent variable of enumeration 0 and maximum order 4.
To create an independent variable of this type write

C0(value, 0)

If you forget the integer argument (whose value is ignored) and write only


all derivatives will be zero!

All the used types for independent variables should use the same maximum order
-- the only difference should be the integer to identify the indepedent variable (0 in the example above).

Compile time is certainly a problem if you want optimization and higher order of derivatives!
For Visual C++ you may want to define forceinline as merely inline to avoid too long compilations.
For g++ you anyway need to define forceinline -- either as inline or as attribute always_inline.

Last edited May 3, 2013 at 4:42 AM by PeterFoelsche, version 3


PeterFoelsche Sep 24, 2014 at 6:28 PM 
The implementation of various atan functions is quite a hack. This can be done differently.

PeterFoelsche Sep 24, 2014 at 6:25 PM 
The following problems may occur:

__forceinline is not known:
#ifndef _MSC_VER
#ifdef __GNUC__
#define __forceinline inline __attribute__((always_inline))
#define __forceinline inline
#end if
#end if

This website appears to be too smart -- it insist on screwing up the #end if.

Some boost include files are not available. These are not needed -- they can be commented or replaced by "boost/mpl/map.hpp"