Daniel J. Duffy9780470015384, 0470015381
Table of contents :
Introduction to C++ for Financial Engineers……Page 4
Contents……Page 8
0.2 Why has this Book been Written?……Page 18
0.6 What this Book does not Cover……Page 19
0.7 More Information and Support……Page 20
Part I C++ Essential Skills……Page 22
1.2 A Short History of C++……Page 24
1.3.1 Object-Oriented Paradigm……Page 25
1.3.2 Generic Programming……Page 27
1.5 What is Software Quality?……Page 28
1.6 Summary and Conclusions……Page 30
1.7 Exercises……Page 31
2.2 The Compilation Process……Page 32
2.3 Header Files and Source Files……Page 33
2.4 Creating Classes and Using their Objects……Page 36
2.5 Template Classes and Template Functions……Page 39
2.6.1 Compiler Errors……Page 42
2.6.3 Run-Time Errors……Page 43
2.8 Useful Data Conversion Routines……Page 44
2.10 Exercises and Projects……Page 46
3.1 Introduction and Objectives……Page 48
3.2 Class == member data + member functions……Page 49
3.3 The Header File (Function Prototypes)……Page 50
3.4 The Class Body (Code File)……Page 52
3.5 Using the Class……Page 55
3.6.2 Using Standard Libraries……Page 57
3.7 Other Paradigms……Page 58
3.9 Questions, Exercises and Projects……Page 62
4.2 Call by Reference and Call by Value……Page 66
4.3.1 Read-Only (Const) Member Functions……Page 69
4.4 Constructors in Detail……Page 71
4.5 Static Member Data and Static Member Functions……Page 72
4.6 Function Overloading……Page 74
4.8.1 The ‘Inline’ Keyword……Page 75
4.8.2 Anonymous Objects in Function Code……Page 76
4.10 Questions, Exercises and Projects……Page 77
5.2 What is Operator Overloading and what are the Possibilities?……Page 80
5.3 Why Use Operator Overloading? The Advantages……Page 82
5.4 Operator Overloading: The Steps……Page 85
5.4.1 A Special Case: The Assignment Operator……Page 87
5.5 Using Operator Overloading for Simple I/O……Page 88
5.6 Friend Functions in General……Page 89
5.6.1 Friend Classes……Page 90
5.8 Exercise……Page 91
Appendix: Useful Data Structures in C++……Page 92
6.2 Single Objects and Arrays of Objects on the Stack……Page 96
6.3.1 Single Objects……Page 99
6.3.2 Arrays of Objects……Page 100
6.4 Small Application: Working with Complex Numbers……Page 101
6.5.1 Memory Allocation and Deallocation……Page 103
6.5.2 Accessing Functions……Page 104
6.5.4 The Full Header File……Page 105
6.7 Exercises……Page 106
6.8 Review Questions and Comments……Page 108
7.2 Functions and Function Pointers……Page 110
7.2.2 Function Categories……Page 111
7.2.3 Modelling Functions in C++……Page 112
7.3 An Introduction to Namespaces in C++……Page 113
7.3.1 Some Extra Functionality……Page 114
7.4.1 Basic Inheritance Structure……Page 116
7.4.2 Adding New Functionality……Page 118
7.4.3 Overriding Functionality: Polymorphic and Non-Polymorphic Behaviour……Page 119
7.6 Solution of Nonlinear Equations……Page 121
7.7 Nonlinear Solvers in C++: Design and Implementation……Page 123
7.8 Applying Nonlinear Solvers: Calculating Volatility……Page 125
7.10 Exercises and Projects……Page 126
8.2 The Virtual Specifier and Memory Deallocation……Page 130
8.3 Abstract and Concrete Classes……Page 132
8.3.1 Using Payoff Classes……Page 135
8.4 Lightweight Payoff Classes……Page 136
8.5 Super Lightweight Payoff Functions……Page 138
8.6 The Dangers of Inheritance: A Counterexample……Page 140
8.8 Two-Factor Payoff Functions and Classes……Page 144
8.10 Exercises and Projects……Page 147
9.2 An Introduction to Reflection and Self-Aware Objects……Page 150
9.3 Run-Time Type Information (RTTI)……Page 151
9.4 Casting between Types……Page 154
9.4.1 More Esoteric Casting……Page 156
9.5 Client-Server Programming and Exception Handling……Page 157
9.7 C++ Implementation……Page 158
9.8 Pragmatic Exception Mechanisms……Page 162
9.8.1 An Example of Use……Page 165
9.10 Exercises and Research……Page 166
10.1 Introduction and Objectives……Page 170
10.2 My First Template Class……Page 171
10.2.1 Using Template Classes……Page 173
10.2.2 (Massive) Reusability of the Range Template Class……Page 174
10.3 Template Functions……Page 175
10.4 Consolidation: Understanding Templates……Page 176
10.4.1 A Test Program……Page 179
10.5 Summary and Conclusions……Page 180
10.6 Exercises and Projects……Page 181
Part II
Data Structures, Templates and Patterns Data Structures, Templates and Patterns……Page 184
11.1 Introduction and Objectives……Page 186
11.2 Complexity Analysis……Page 187
11.2.1 Examples of Complexities……Page 188
11.3.1 Lists……Page 189
11.3.2 Stacks and Queues……Page 190
11.3.3 Sets and Multisets……Page 191
11.4 Algorithms……Page 193
11.5 Navigation in Data Structures: Iterators in STL……Page 194
11.6 STL by Example: My First Example……Page 195
11.6.3 Algorithms……Page 196
11.8 Exercises and Projects……Page 200
12.2 Maps and Dictionaries……Page 204
12.2.1 Iterating in Maps……Page 205
12.2.2 Erasing Records in a Map……Page 206
12.3 Applications of Maps……Page 207
12.4 User-Friendly Sets……Page 208
12.4.1 STL Sets……Page 209
12.4.2 User-Defined and Wrapper Classes for STL Sets……Page 211
12.5 Associative Arrays and Associative Matrices……Page 213
12.6 Applications of Associative Data Structures……Page 216
12.8 Exercises and Projects……Page 217
13.2 The Property Pattern……Page 220
13.3 Property Sets……Page 222
13.3.1 Basic Functionality……Page 223
13.3.2 Addition and Removal of Properties……Page 224
13.3.3 Navigating in a Property Set: Creating your own Iterators……Page 225
13.3.4 Property Sets with Heterogeneous Data Types……Page 226
13.4.2 Collection-Members Relationship……Page 230
13.5 Lattice Structures……Page 232
13.5.1 Some Simple Examples……Page 234
13.5.2 A Simple Binomial Method Solver……Page 236
13.7 Exercises and Projects……Page 238
14.2 The Software LifeCycle……Page 240
14.3.1 Generalisation and Specialisation……Page 242
14.3.2 Aggregation and Composition……Page 244
14.3.3 Associations……Page 246
14.3.4 Other Diagrams……Page 249
14.4.1 Creational Patterns……Page 250
14.4.3 Behavioural Patterns……Page 253
14.5 Are we Using the Wrong Design? Choosing the Appropriate Pattern……Page 254
14.6 CADObject, a C++ Library for Computer Graphics……Page 255
14.9 Exercises and Projects……Page 258
Part III QF Applications……Page 260
15.1 Introduction and Objectives……Page 262
15.3 A Short Overview of the Binomial Method……Page 263
15.4 Software Requirements for a Binomial Solver……Page 266
15.5.1 UML Class Structure……Page 267
15.5.2 Information Flow……Page 268
15.6 Applying Design Patterns……Page 269
15.7 The Builder and Director Classes……Page 272
15.8 The Process and the Steps……Page 275
15.9 Test Cases and Examples……Page 276
15.11 Exercises and Questions……Page 277
16.2 Scope and Assumptions……Page 282
16.4 Modelling the Black Scholes PDE……Page 284
16.5 Finite Difference Schemes……Page 287
16.5.1 Explicit Schemes……Page 289
16.5.2 Implicit Schemes……Page 290
16.5.4 Other Schemes……Page 292
16.6.1 Creating the user Interface Dialogue……Page 293
16.6.3 Presentation……Page 295
16.8 Exercises and Projects……Page 296
17.2 Motivation and Background……Page 300
17.3 Scoping the Problem: PDEs for Basket Options……Page 302
17.4.1 Data Classes for Instruments……Page 303
17.4.2 Modelling the PDE with C++ Classes……Page 309
17.5 The Finite Difference Method for Two-Factor Problems……Page 314
17.6 Discrete Boundary and Initial Conditions……Page 315
17.7 Assembling the System of Equations……Page 316
17.8 Post Processing and Output……Page 318
17.10 Exercises and Projects……Page 319
18.2 Solving Tridiagonal Systems……Page 322
18.2.1 A Tridiagonal Solver in C++……Page 323
18.3.1 Polynomial Interpolation……Page 327
18.3.2 Rational Function Interpolation……Page 328
18.3.3 Cubic Spline Interpolation……Page 329
18.4 Summary and Conclusions……Page 330
19.2 The Trinomial Method for Assets……Page 332
19.4 Trinomial Tree for the Short Rate……Page 335
19.5 The Multidimensional Binomial Method……Page 338
19.6.1 Candlestick Charts……Page 339
19.6.2 (Highly) Generic Lattice Structures……Page 341
19.9 Exercises……Page 343
20.3 Examples of the Application of the Monte Carlo Method……Page 344
20.3.1 Calculation of Definite Integrals……Page 345
20.3.2 Device Reliability……Page 347
20.4.1 An Overview of Stochastic Differential Equations (SDE)……Page 350
20.4.2 Other Background Information……Page 353
20.5 Software Architecture for the Monte Carlo Method……Page 354
20.6.2 Barrier Options……Page 355
20.6.3 Asian Options……Page 356
20.7 Summary and Conclusions……Page 357
20.8 Appendix: Comparing Monte Carlo with Other Numerical Methods……Page 358
20.9 Exercises and Projects……Page 359
21.3 Part I: C++ Essential Skills……Page 362
21.4 Part II: Data Structures, Templates and Patterns……Page 363
21.6 Part IV: Background Information……Page 364
21.7.2 Layer 2: Mechanisms……Page 365
21.8 Summary and Conclusions……Page 366
Part IV Background Information……Page 368
22.2 Basic Data Types……Page 370
22.3 The C Preprocessor……Page 371
22.4 Pointers and References……Page 372
22.6 What to Avoid in C……Page 374
22.7 Test Case: Numerical Integration in One Dimension……Page 375
22.9 Exercises……Page 376
23.1 Introduction and Objectives……Page 380
23.3 Multi-Dimensional Arrays……Page 381
23.4 Introduction to Structures……Page 382
23.6 Useful C Libraries……Page 383
23.7 Test Case: Linear Regression……Page 384
23.9 Exercises……Page 387
24.3 Basic Driver Functionality……Page 390
24.4 Excel Mechanisms……Page 393
24.5 Option Values and Sensitivities in Excel……Page 397
24.6 Finite Difference Method……Page 401
24.8 Exercises and Projects……Page 404
25.3 An Introduction to Multiple Inheritance (MI)……Page 408
25.4 Interfaces and Multiple Inheritance……Page 413
25.6 Summary……Page 416
26.3 The IUnknown Interface……Page 418
26.4 Using IUnknown……Page 419
26.4.1 Testing the Interface……Page 422
26.6 Summary……Page 423
References……Page 424
Index……Page 426
Reviews
There are no reviews yet.