This mapping class is a usable example of a "sophisticated" symbolic
mapping class in C++. It allows you to do things like :
// X will be the "identity mapping"
Mapping X = Mapping::X;
// A undefined mapping
Mapping f;
// Now contains some complex stuff
f = sin(X * X - (X * 3.0) + 0.5);
// Display its square
cout << f*f << endl;
// fp will be its first derivative
Mapping fp = f.derivative();
// fs its second derivative
Mapping fs = fp.derivative();
// Compute the second derivative at 5
cout << fs(5.0) << endl;
The best is to check the file mappings.h for the list of available
functions and operators. It is pretty easy to add your own.
The memory management is done in such a way that unnecessary copies
are avoided and intermediate results are deallocated correctly. So far
I never traced a memory leak, but feel free to report it if you find
one.
Francois Fleuret
May 2001
Modified 2005, 2007, 2011