Last change
on this file since 4618 was
4565,
checked in by patrick, 19 years ago
|
orxonox/trunk: added the newmat library to the project. needs some translation in directory, temp under util/newmat. is needed by the collision detection engine to perform lin alg operations such as eigenvector decomposition. perhaps we will make our own library to do that later.
|
File size:
652 bytes
|
Line | |
---|
1 | // This is an example of the use of solution to find the cube root of |
---|
2 | // the integers -10 to 10 |
---|
3 | |
---|
4 | // you will need to compile and link solution.cpp and except.cpp |
---|
5 | |
---|
6 | #define WANT_STREAM |
---|
7 | #define WANT_MATH |
---|
8 | |
---|
9 | #include "include.h" |
---|
10 | #include "solution.h" |
---|
11 | |
---|
12 | #ifdef use_namespace |
---|
13 | using namespace RBD_LIBRARIES; |
---|
14 | #endif |
---|
15 | |
---|
16 | |
---|
17 | // the cube class |
---|
18 | |
---|
19 | class Cube : public R1_R1 |
---|
20 | { Real operator()() { return x*x*x; } }; |
---|
21 | |
---|
22 | int main() |
---|
23 | { |
---|
24 | // construct the Cube object |
---|
25 | Cube cube; |
---|
26 | // and then the solve object |
---|
27 | OneDimSolve cube_root(cube); |
---|
28 | // Now do the solves |
---|
29 | for (int i=-10; i<=10; i++) |
---|
30 | cout << i << " " << cube_root.Solve(i,0,1.5) << endl; |
---|
31 | return 0; |
---|
32 | } |
---|
33 | |
---|
Note: See
TracBrowser
for help on using the repository browser.