Atnaujinkite slapukų nuostatas

El. knyga: Financial Instrument Pricing Using C++

(Datasim Education BV)
  • Formatas: EPUB+DRM
  • Serija: Wiley Finance
  • Išleidimo metai: 05-Sep-2018
  • Leidėjas: John Wiley & Sons Inc
  • Kalba: eng
  • ISBN-13: 9781119170488
  • Formatas: EPUB+DRM
  • Serija: Wiley Finance
  • Išleidimo metai: 05-Sep-2018
  • Leidėjas: John Wiley & Sons Inc
  • Kalba: eng
  • ISBN-13: 9781119170488

DRM apribojimai

  • Kopijuoti:

    neleidžiama

  • Spausdinti:

    neleidžiama

  • El. knygos naudojimas:

    Skaitmeninių teisių valdymas (DRM)
    Leidykla pateikė šią knygą šifruota forma, o tai reiškia, kad norint ją atrakinti ir perskaityti reikia įdiegti nemokamą programinę įrangą. Norint skaityti šią el. knygą, turite susikurti Adobe ID . Daugiau informacijos  čia. El. knygą galima atsisiųsti į 6 įrenginius (vienas vartotojas su tuo pačiu Adobe ID).

    Reikalinga programinė įranga
    Norint skaityti šią el. knygą mobiliajame įrenginyje (telefone ar planšetiniame kompiuteryje), turite įdiegti šią nemokamą programėlę: PocketBook Reader (iOS / Android)

    Norint skaityti šią el. knygą asmeniniame arba „Mac“ kompiuteryje, Jums reikalinga  Adobe Digital Editions “ (tai nemokama programa, specialiai sukurta el. knygoms. Tai nėra tas pats, kas „Adobe Reader“, kurią tikriausiai jau turite savo kompiuteryje.)

    Negalite skaityti šios el. knygos naudodami „Amazon Kindle“.

An integrated guide to C++ and computational finance This complete guide to C++ and computational finance is a follow-up and major extension to Daniel J. Duffy's 2004 edition of Financial Instrument Pricing Using C++. Both C++ and computational finance have evolved and changed dramatically in the last ten years and this book documents these improvements. Duffy focuses on these developments and the advantages for the quant developer by:





Delving into a detailed account of the new C++11 standard and its applicability to computational finance. Using de-facto standard libraries, such as Boost and Eigen to improve developer productivity. Developing multiparadigm software using the object-oriented, generic, and functional programming styles. Designing flexible numerical algorithms: modern numerical methods and multiparadigm design patterns. Providing a detailed explanation of the Finite Difference Methods through six chapters, including new developments such as ADE, Method of Lines (MOL), and Uncertain Volatility Models. Developing applications, from financial model to algorithmic design and code, through a coherent approach. Generating interoperability with Excel add-ins, C#, and C++/CLI. Using random number generation in C++11 and Monte Carlo simulation.

Duffy adopted a spiral model approach while writing each chapter of Financial Instrument Pricing Using C++ 2e: analyse a little, design a little, and code a little. Each cycle ends with a working prototype in C++ and shows how a given algorithm or numerical method works. Additionally, each chapter contains non-trivial exercises and projects that discuss improvements and extensions to the material.

This book is for designers and application developers in computational finance, and assumes the reader has some fundamental experience of C++ and derivatives pricing.





HOW TO RECEIVE THE SOURCE CODE

Once you have purchased a copy of the book please send an email to the author dduffyATdatasim.nl requesting your personal and non-transferable copy of the source code. Proof of purchase is needed. The subject of the mail should be C++ Book Source Code Request.  You will receive a reply with a zip file attachment.
Chapter 1 A Tour of C++ and Environs 1(20)
1.1 Introduction and Objectives
1(1)
1.2 What is C++?
1(1)
1.3 C++ as a Multiparadigm Programming Language
2(2)
1.4 The Structure and Contents of this Book: Overview
4(2)
1.5 A Tour of C++11: Black-Scholes and Environs
6(1)
1.5.1 System Architecture
6(1)
1.5.2 Detailed Design
7(1)
1.5.3 Libraries and Algorithms
8(2)
1.5.4 Configuration and Execution
10(2)
1.6 Parallel Programming in C++ and Parallel C++ Libraries
12(2)
1.7 Writing C++ Applications; Where and How to Start?
14(2)
1.8 For Whom is this Book Intended?
16(1)
1.9 Next-Generation Design and Design Patterns in C++
16(1)
1.10 Some Useful Guidelines and Developer Folklore
17(1)
1.11 About the Author
18(1)
1.12 The Source Code and Getting the Source Code
19(2)
Chapter 2 New and Improved C++ Fundamentals 21(38)
2.1 Introduction and Objectives
21(1)
2.2 The C++ Smart Pointers
21(2)
2.2.1 An Introduction to Memory Management
22(1)
2.3 Using Smart Pointers in Code
23(7)
2.3.1 Class std: :shared_ptr
23(3)
2.3.2 Class std: :unique_ptr
26(2)
2.3.3 std: :weak_ptr
28(1)
2.3.4 Should We Use Smart Pointers and When?
29(1)
2.4 Extended Examples of Smart Pointers Usage
30(4)
2.4.1 Classes with Embedded Pointers
30(1)
2.4.2 Re-engineering Object-Oriented Design Patterns
31(3)
2.5 Move Semantics and Rvalue References
34(5)
2.5.1 A Quick Overview of Value Categories
34(1)
2.5.2 Why Some Classes Need Move Semantics
35(2)
2.5.3 Move Semantics and Performance
37(1)
2.5.4 Move Semantics and Shared Pointers
38(1)
2.6 Other Bits and Pieces: Usability Enhancements
39(13)
2.6.1 Type Alias and Alias Templates
39(2)
2.6.2 Automatic Type Deduction and the auto Specifier
41(1)
2.6.3 Range-Based for Loops
42(1)
2.6.4 nullptr
43(1)
2.6.5 New Fundamental Data Types
44(1)
2.6.6 Scoped and Strongly Typed Enumerations
44(1)
2.6.7 The Attribute [ [ deprecated] ]
45(2)
2.6.8 Digit Separators
47(1)
2.6.9 Unrestricted Unions
47(2)
2.6.10 std: :variant (C++17) and boost: :variant
49(3)
2.7 Summary and Conclusions
52(1)
2.8 Exercises and Projects
52(7)
Chapter 3 Modelling Functions in C++ 59(30)
3.1 Introduction and Objectives
59(1)
3.2 Analysing and Classifying Functions
60(4)
3.2.1 An Introduction to Functional Programming
60(1)
3.2.2 Function Closure
61(1)
3.2.3 Currying
62(1)
3.2.4 Partial Function Application
62(1)
3.2.5 Lambda (Anonymous) Functions
62(1)
3.2.6 Eager and Lazy Evaluation
63(1)
3.2.7 Fold
63(1)
3.2.8 Continuation
63(1)
3.3 New Functionality in C++: std: : function<>
64(1)
3.4 New Functionality in C++: Lambda Functions and Lambda Expressions
65(4)
3.4.1 Basic Syntax
65(1)
3.4.2 Initial Examples
66(2)
3.4.3 Lambda Functions and Classes: Capturing Member Data
68(1)
3.4.4 Storing Lambda Functions
69(1)
3.5 Callable Objects
69(1)
3.6 Function Adapters and Binders
70(5)
3.6.1 Binding and Function Objects
72(1)
3.6.2 Binding and Free Functions
73(1)
3.6.3 Binding and Subtype Polymorphism
74(1)
3.7 Application Areas
75(1)
3.8 An Example: Strategy Pattern New Style
75(3)
3.9 Migrating from Traditional Object-Oriented Solutions: Numerical Quadrature
78(3)
3.10 Summary and Conclusions
81(1)
3.11 Exercises and Projects
82(7)
Chapter 4 Advanced C++ Template Programming 89(34)
4.1 Introduction and Objectives
89(2)
4.2 Preliminaries
91(3)
4.2.1 Arithmetic Operators and Implicit Conversions
91(2)
4.2.2 A Primer on Variadic Functions
93(1)
4.2.3 Value Categories
94(1)
4.3 decltype Specifier
94(7)
4.3.1 Initial Examples
94(2)
4.3.2 Extended Examples
96(2)
4.3.3 The Auxiliary Trait std: :declval
98(1)
4.3.4 Expressions, lvalues, rvalues and xvalues
99(2)
4.4 Life Before and After decltype
101(5)
4.4.1 Extending the STL to Support Heterogeneous Data Types
103(3)
4.5 std: :result_of and SFINAE
106(2)
4.6 std: :enable_if
108(4)
4.7 Boost enable_if
112(2)
4.8 std: :decay () Trait
114(1)
4.9 A Small Application: Quantities and Units
115(3)
4.10 Conclusions and Summary
118(1)
4.11 Exercises and Projects
118(5)
Chapter 5 Tuples in C++ and their Applications 123(24)
5.1 Introduction and Objectives
123(1)
5.2 An std: :pair Refresher and New Extensions
123(5)
5.3 Mathematical and Computer Science Background
128(2)
5.4 Tuple Fundamentals and Simple Examples
130(1)
5.5 Advanced Tuples
130(3)
5.5.1 Tuple Nesting
130(2)
5.5.2 Variadic Tuples
132(1)
5.6 Using Tuples in Code
133(5)
5.6.1 Function Return Types
133(3)
5.6.2 Function Input Arguments
136(2)
5.7 Other Related Libraries
138(2)
5.7.1 Boost Tuple
138(1)
5.7.2 Boost Fusion
139(1)
5.8 Tuples and Run-Time Efficiency
140(2)
5.9 Advantages and Applications of Tuples
142(1)
5.10 Summary and Conclusions
143(1)
5.11 Exercises and Projects
143(4)
Chapter 6 Type Traits, Advanced lambdas and Multiparadigm Design in C++ 147(38)
6.1 Introduction and Objectives
147(2)
6.2 Some Building Blocks
149(1)
6.3 C++ Type Traits
150(8)
6.3.1 Primary Type Categories
151(2)
6.3.2 Composite Type Categories
153(2)
6.3.3 Type Properties
155(1)
6.3.4 Type Relationships
156(1)
6.3.5 'Internal Properties' of Types
157(1)
6.3.6 Other Type Traits
158(1)
6.4 Initial Examples of Type Traits
158(3)
6.4.1 Simple Bridge Pattern
159(2)
6.5 Generic Lambdas
161(3)
6.6 How Useful will Generic Lambda Functions be in the Future?
164(7)
6.6.1 Duck Typing and Avoiding Class Hierarchies
164(3)
6.6.2 Something Completely Different: Homotopy Theory
167(4)
6.7 Generalised Lambda Capture
171(3)
6.7.1 Living Without Generalised Lambda Capture
173(1)
6.8 Application to Stochastic Differential Equations
174(4)
6.8.1 SDE Factories
176(2)
6.9 Emerging Multiparadigm Design Patterns: Summary
178(1)
6.10 Summary and Conclusions
179(1)
6.11 Exercises and Projects
179(6)
Chapter 7 Multiparadigm Design in C++ 185(30)
7.1 Introduction and Objectives
185(1)
7.2 Modelling and Design
185(5)
7.2.1 Liskov Substitution Principle
186(1)
7.2.2 Single Responsibility Principle
187(1)
7.2.3 An Example: Separation of Concerns for Monte Carlo Simulation
188(2)
7.3 Low-Level C++ Design of Classes
190(9)
7.3.1 Explicit Specifier
190(1)
7.3.2 Deleted and Defaulted Member Functions
191(2)
7.3.3 The constexpr Keyword
193(2)
7.3.4 The override and final Keywords
195(2)
7.3.5 Uniform Initialisation
197(1)
7.3.6 Initialiser Lists
198(1)
7.3.7 Keyword noexcept
199(1)
7.4 Shades of Polymorphism
199(7)
7.5 Is there More to Life than Inheritance?
206(1)
7.6 An Introduction to Object-Oriented Software Metrics
207(3)
7.6.1 Class Size
207(1)
7.6.2 Class Internals
207(1)
7.6.3 Class Coupling
208(1)
7.6.4 Class and Member Function Inheritance
209(1)
7.7 Summary and Conclusions
210(1)
7.8 Exercises and Projects
210(5)
Chapter 8 C++ Numerics, IEEE 754 and Boost C++ Multiprecision 215(30)
8.1 Introduction and Objectives
215(4)
8.1.1 Formats
216(1)
8.1.2 Rounding Rules
217(1)
8.1.3 Exception Handling
218(1)
8.1.4 Extended and Extendible Precision Formats
219(1)
8.2 Floating-Point Decomposition Functions in C++
219(2)
8.3 A Tour of std: :numeric_limits<T>
221(2)
8.4 An Introduction to Error Analysis
223(1)
8.4.1 Loss of Significance
224(1)
8.5 Example: Numerical Quadrature
224(4)
8.6 Other Useful Mathematical Functions in C++
228(3)
8.7 Creating C++ Libraries
231(8)
8.7.1 Creating Static C++ Libraries
231(6)
8.7.2 Dynamic Link Libraries
237(2)
8.7.3 Boost C++ DLLs
239(1)
8.8 Summary and Conclusions
239(1)
8.9 Exercises and Projects
239(6)
Chapter 9 An Introduction to Unified Software Design 245(43)
9.1 Introduction and Objectives
245(2)
9.1.1 Future Predictions and Expectations
246(1)
9.2 Background
247(4)
9.2.1 Jackson Problem Frames
248(1)
9.2.2 The Hatley-Pirbhai Method
248(1)
9.2.3 Domain Architectures
249(1)
9.2.4 Garlan-Shaw Architecture
250(1)
9.2.5 System and Design Patterns
250(1)
9.3 System Scoping and Initial Decomposition
251(8)
9.3.1 System Context Diagram
251(4)
9.3.2 System Responsibilities and Services
255(1)
9.3.3 Optimisation: System Context and Domain Architectures
255(4)
9.4 Checklist and Looking Back
259(1)
9.4.1 A Special Case: Defining the System's Operating Environment
259(1)
9.5 Variants of the Software Process: Policy-Based Design
260(8)
9.5.1 Advantages and Limitations of PBD
266(2)
9.5.2 A Defined Process for PBD
268(1)
9.6 Using Policy-Based Design for the DVM Problem
268(5)
9.6.1 Introducing Events and Delegates
272(1)
9.7 Advantages of Uniform Design Approach
273(1)
9.8 Summary and Conclusions
274(1)
9.9 Exercises and Projects
275(13)
Chapter 10 New Data Types, Containers and Algorithms In C++ and Boost C++ Libraries 288(45)
10.1 Introduction and Objectives
283(1)
10.2 Overview of New Features
283(1)
10.3 C++ std : :bitset<N> and Boost Dynamic Bitset Library
284(4)
10.3.1 Boolean Operations
286(1)
10.3.2 Type Conversions
286(1)
10.3.3 Boost dynamic_bitset
287(1)
10.3.4 Applications of Dynamic Bitsets
287(1)
10.4 Chrono Library
288(13)
10.4.1 Compile-Time Fractional Arithmetic with std: :ratio<>
288(3)
10.4.2 Duration
291(1)
10.4.3 Timepoint and Clocks
292(1)
10.4.4 A Simple Stopwatch
293(2)
10.4.5 Examples and Applications
295(5)
10.4.6 Boost Chrono Library
300(1)
10.5 Boost Date and Time
301(5)
10.5.1 Overview of Concepts and Functionality
301(1)
10.5.2 Gregorian Time
302(1)
10.5.3 Date
302(4)
10.6 Forwards Lists and Compile-Time Arrays
306(5)
10.6.1 std: :forward_list<>
306(3)
10.6.2 boost: :array<> and std: :array<>
309(2)
10.7 Applications of Boost.Array
311(2)
10.8 Boost uBLAS (Matrix Library)
313(3)
10.8.1 Introduction and Objectives
313(1)
10.8.2 BLAS (Basic Linear Algebra Subprograms)
313(1)
10.8.3 BLAS Level 1
314(1)
10.8.4 BLAS Level 2
314(1)
10.8.5 BLAS Level 3
315(1)
10.9 Vectors
316(2)
10.9.1 Dense Vectors
316(1)
10.9.2 Creating and Accessing Dense Vectors
317(1)
10.9.3 Special Dense Vectors
318(1)
10.10 Matrices
318(4)
10.10.1 Dense Matrices
319(1)
10.10.2 Creating and Accessing Dense Matrices
320(1)
10.10.3 Special Dense Matrices
321(1)
10.11 Applying uBLAS: Solving Linear Systems of Equations
322(8)
10.11.1 Conjugate Gradient Method
323(2)
10.11.2 LU Decomposition
325(2)
10.11.3 Cholesky Decomposition
327(3)
10.12 Summary and Conclusions
330(1)
10.13 Exercises and Projects
331(2)
Chapter 11 Lattice Models Fundamental Data Structures and Algorithms 333(54)
11.1 Introduction and Objectives
333(1)
11.2 Background and Current Approaches to Lattice Modelling
334(1)
11.3 New Requirements and Use Cases
335(1)
11.4 A New Design Approach: A Layered Approach
335(12)
11.4.1 Layers System Pattern
338(1)
11.4.2 Layer 1: Basic Lattice Data Structures
339(3)
11.4.3 Layer 2: Operations on Lattices
342(4)
11.4.4 Layer 3: Application Configuration
346(1)
11.5 Initial '101' Examples of Option Pricing
347(2)
11.6 Advantages of Software Layering
349(3)
11.6.1 Maintainability
350(1)
11.6.2 Functionality
350(1)
11.6.3 Efficiency
351(1)
11.7 Improving Efficiency and Reliability
352(3)
11.8 Merging Lattices
355(2)
11.9 Summary and Conclusions
357(1)
11.10 Exercises and Projects
357(30)
Chapter 12 Lattice Models Applications to Computational Finance 387
12.1 Introduction and Objectives
367(1)
12.2 Stress Testing the Lattice Data Structures
368(4)
12.2.1 Creating Pascal's Triangle
368(1)
12.2.2 Binomial Coefficients
369(1)
12.2.3 Computing the Powers of Two
370(1)
12.2.4 The Fibonacci Sequence
370(1)
12.2.5 Triangular Numbers
371(1)
12.2.6 Summary: Errors, Defects and Faults in Software
372(1)
12.3 Option Pricing Using Bernoulli Paths
372(2)
12.4 Binomial Model for Assets with Dividends
374(3)
12.4.1 Continuous Dividend Yield
374(1)
12.4.2 Binomial Method with a Known Discrete Proportional Dividend
375(1)
12.4.3 Perpetual American Options
376(1)
12.5 Computing Option Sensitivities
377(2)
12.6 (Quick) Numerical Analysis of the Binomial Method
379(3)
12.6.1 Non-monotonic (Sawtooth) Convergence
380(1)
12.6.2 'Negative' Probabilities and Convection Dominance
381(1)
12.6.3 Which Norm to Use when Measuring Error
381(1)
12.7 Richardson Extrapolation with Binomial Lattices
382(1)
12.8 Two-Dimensional Binomial Method
382(2)
12.9 Trinomial Model of the Asset Price
384(1)
12.10 Stability and Convergence of the Trinomial Method
385(1)
12.11 Explicit Finite Difference Method
386(3)
12.12 Summary and Conclusions
389(1)
12.13 Exercises and Projects
389
Chapter 13 Numerical Linear Algebra: Tridiagonal Systems and Applications 385(48)
13.1 Introduction and Objectives
395(1)
13.2 Solving Tridiagonal Matrix Systems
395(11)
13.2.1 Double Sweep Method
396(3)
13.2.2 The Thomas Algorithm
399(4)
13.2.3 Examples
403(1)
13.2.4 Performance Issues
404(1)
13.2.5 Applications of Tridiagonal Matrices
405(1)
13.2.6 Some Remarks on Matrices
405(1)
13.3 The Crank-Nicolson and Theta Methods
406(5)
13.3.1 C++ Implementation of the Theta Method for the Heat Equation
409(2)
13.4 The ADE Method for the Impatient
411(4)
13.4.1 C++ Implementation of ADE (Barakat and Clark) for the Heat Equation
413(2)
13.5 Cubic Spline Interpolation
415(12)
13.5.1 Examples
424(2)
13.5.2 Caveat: Cubic Splines with Sparse Input Data
426(1)
13.6 Some Handy Utilities
427(1)
13.7 Summary and Conclusions
428(1)
13.8 Exercises and Projects
429(4)
Chapter 14 Data Visualisation in Excel 433(42)
14.1 Introduction and Objectives
433(1)
14.2 The Structure of Excel-Related Objects
433(2)
14.3 Sanity Check: Is the Excel Infrastructure Up and Running?
435(2)
14.4 ExcelDriver and Matrices
437(7)
14.4.1 Displaying a Matrix
440(1)
14.4.2 Displaying a Matrix with Labels
441(1)
14.4.3 Lookup Tables, Continuous and Discrete Functions
442(2)
14.5 ExcelDriver and Vectors
444(4)
14.5.1 Single and Multiple Curves
445(3)
14.6 Path Generation for Stochastic Differential Equations
448(11)
14.6.1 The Main Classes
450(7)
14.6.2 Testing the Design and Presentation in Excel
457(2)
14.7 Summary and Conclusions
459(1)
14.8 Exercises and Projects
459(4)
14.9 Appendix: COM Architecture Overview
463(5)
14.9.1 COM Interfaces and COM Objects
465(1)
14.9.2 HRESULT and Other Data Types
466(2)
14.9.3 Interface Definition Language
468(1)
14.9.4 Class Identifiers
468(1)
14.10 An Example
468(3)
14.11 Virtual Function Tables
471(2)
14.12 Differences Between COM and Object-Oriented Paradigm
473(1)
14.13 Initialising the COM Library
474(1)
Chapter 15 Univariate Statistical Distributions 475(40)
15.1 Introduction, Goals and Objectives
475(1)
15.2 The Error Function and Its Universality
475(3)
15.2.1 Approximating the Error Function
476(1)
15.2.2 Applications of the Error Function
477(1)
15.3 One-Factor Plain Options
478(10)
15.3.1 Other Scenarios
485(3)
15.4 Option Sensitivities and Surfaces
488(3)
15.5 Automating Data Generation
491(8)
15.5.1 Data Generation Using Random Number Generators: Basics
492(1)
15.5.2 A Generic Class to Generate Random Numbers
492(3)
15.5.3 A Special Case: Sampling Distributions in C++
495(2)
15.5.4 Generating Numbers Using a Producer-Consumer Metaphor
497(1)
15.5.5 Generating Numbers and Data with STL Algorithms
498(1)
15.6 Introduction to Statistical Distributions and Functions
499(5)
15.6.1 Some Examples
502(2)
15.7 Advanced Distributions
504(7)
15.7.1 Displaying Boost Distributions in Excel
507(4)
15.8 Summary and Conclusions
511(1)
15.9 Exercises and Projects
511(4)
Chapter 16 Bivariate Statistical Distributions and Two-Asset Option Pricing 515(36)
16.1 Introduction and Objectives
515(1)
16.2 Computing Integrals Using PDEs
516(5)
16.2.1 The Finite Difference Method for the Goursat PDE
517(1)
16.2.2 Software Design
518(1)
16.2.3 Richardson Extrapolation
519(1)
16.2.4 Test Cases
520(1)
16.3 The Drezner Algorithm
521(1)
16.4 The Genz Algorithm and the West/Quantlib Implementations
521(4)
16.5 Abramowitz and Stegun Approximation
525(3)
16.6 Performance Testing
528(1)
16.7 Gauss-Legendre Integration
529(2)
16.8 Applications to Two-Asset Pricing
531(5)
16.9 Trivariate Normal Distribution
536(7)
16.9.1 Four-Dimensional Distributions
542(1)
16.10 Chooser Options
543(2)
16.11 Conclusions and Summary
545(1)
16.12 Exercises and Projects
546(5)
Chapter 17 STL Algorithms h Detail 551(37)
17.1 Introduction and Objectives
551(3)
17.2 Binders and std : : bind
554(3)
17.2.1 The Essentials of std : :bind
554(1)
17.2.2 Further Examples and Applications
555(1)
17.2.3 Deprecated Function Adapters
556(1)
17.2.4 Conclusions
557(1)
17.3 Non-modifying Algorithms
557(10)
17.3.1 Counting the Number of Elements Satisfying a Certain Condition
558(1)
17.3.2 Minimum and Maximum Values in a Container
559(1)
17.3.3 Searching for Elements and Groups of Elements
560(1)
17.3.4 Searching for Subranges
561(2)
17.3.5 Advanced Find Algorithms
563(2)
17.3.6 Predicates for Ranges
565(2)
17.4 Modifying Algorithms
567(8)
17.4.1 Copying and Moving Elements
567(2)
17.4.2 Transforming and Combining Elements
569(2)
17.4.3 Filling and Generating Ranges
571(1)
17.4.4 Replacing Elements
572(1)
17.4.5 Removing Elements
573(2)
17.5 Compile-Time Arrays
575(1)
17.6 Summary and Conclusions
576(1)
17.7 Exercises and Projects
576(7)
17.8 Appendix: Review of STL Containers and Complexity Analysis
583(5)
17.8.1 Sequence Containers
583(1)
17.8.2 Associative Containers
583(1)
17.8.3 Unordered (Associative) Containers
583(1)
17.8.4 Special Containers
584(1)
17.8.5 Other Data Containers
584(1)
17.8.6 Complexity Analysis
585(1)
17.8.7 Asymptotic Behaviour of Functions and Asymptotic Order
585(2)
17.8.8 Some Examples
587(1)
Chapter 18 STL Algorithms Port II 588(229)
18.1 Introduction and Objectives
589(1)
18.2 Mutating Algorithms
589(8)
18.2.1 Reversing the Order of Elements
590(1)
18.2.2 Rotating Elements
590(2)
18.2.3 Permuting Elements
592(2)
18.2.4 Shuffling Elements
594(1)
18.2.5 Creating Partitions
595(2)
18.3 Numeric Algorithms
597(4)
18.3.1 Accumulating the Values in a Container Based on Some Criterion
597(1)
18.3.2 Inner Products
598(1)
18.3.3 Partial Sums
599(1)
18.3.4 Adjacent Difference
600(1)
18.4 Sorting Algorithms
601(3)
18.4.1 Full Sort
601(1)
18.4.2 Partial Sort
602(1)
18.4.3 Heap Sort
603(1)
18.5 Sorted-Range Algorithms
604(5)
18.5.1 Binary Search
604(1)
18.5.2 Inclusion
605(1)
18.5.3 First and Last Positions
606(1)
18.5.4 First and Last Possible Positions as a Pair
607(1)
18.5.5 Merging
608(1)
18.6 Auxiliary Iterator Functions
609(3)
18.6.1 advance ()
609(1)
18.6.2 next () and prev ()
610(1)
18.6.3 distance ()
611(1)
18.6.4 iter_swap ()
611(1)
18.7 Needle in a Haystack: Finding the Right STL Algorithm
612(1)
18.8 Applications to Computational Finance
613(1)
18.9 Advantages of STL Algorithms
613(1)
18.10 Summary and Conclusions
614(1)
18.11 Exercises and Projects
614(203)
Chapter 18 An Introduction to Optimisation and the Solution of Nonlinear Equations 817(24)
19.1 Introduction and Objectives
617(1)
19.2 Mathematical and Numerical Background
618(1)
19.3 Sequential Search Methods
619(1)
19.4 Solutions of Nonlinear Equations
620(2)
19.5 Fixed-Point Iteration
622(1)
19.6 Aitken's Acceleration Process
623(1)
19.7 Software Framework
623(9)
19.7.1 Using the Mediator to Reduce Coupling
628(1)
19.7.2 Examples of Use
629(3)
19.8 Implied Volatility
632(1)
19.9 Solvers in the Boost C++ Libraries
632(1)
19.10 Summary and Conclusions
633(1)
19.11 Exercises and Projects
633(3)
19.12 Appendix: The Banach Fixed-Point Theorem
636(205)
Chapter 20 The Finite Difference Method for PDEs: Mathematical Background 841
20.1 Introduction and Objectives
641(1)
20.2 General Convection-Diffusion-Reaction Equations and Black-Scholes PDE
641(4)
20.3 PDE Preprocessing
645(4)
20.3.1 Log Transformation
645(1)
20.3.2 Reduction of PDE to Conservative Form
646(1)
20.3.3 Domain Truncation
647(1)
20.3.4 Domain Transformation
647(2)
20.4 Maximum Principles for Parabolic PDEs
649(1)
20.5 The Fichera Theory
650(4)
20.5.1 Example: Boundary Conditions for the One-Factor Black-Scholes PDE
653(1)
20.6 Finite Difference Schemes: Properties and Requirements
654(1)
20.7 Example: A Linear Two-Point Boundary Value Problem
655(4)
20.7.1 The Example
656(3)
20.8 Exponentially Fitted Schemes for Time-Dependent PDEs
659(4)
20.8.1 What Happens When the Volatility Goes to Zero?
662(1)
20.9 Richardson Extrapolation
663(2)
20.10 Summary and Conclusions
665(1)
20.11 Exercises and Projects
666
Chapter 21 Software Framework tor One-Factor Option Models 600(101)
21.1 Introduction and Objectives
669(1)
21.2 A Software Framework: Architecture and Context
669(1)
21.3 Modelling PDEs and Finite Difference Schemes: What is Supported?
670(1)
21.4 Several Versions of Alternating Direction Explicit
671(2)
21.4.1 Spatial Amplification and ADE
672(1)
21.5 A Software Framework: Detailed Design and Implementation
673(1)
21.6 C++ Code for PDE Classes
674(5)
21.7 C++ Code for FDM Classes
679(11)
21.7.1 Classes Based on Subtype Polymorphism
683(2)
21.7.2 Classes Based on CRTP
685(3)
21.7.3 Assembling FD Schemes from Simpler Schemes
688(2)
21.8 Examples and Test Cases
690(3)
21.9 Summary and Conclusions
693(1)
21.10 Exercises and Projects
694(7)
Chapter 22 Extending the Software Framework 701(26)
22.1 Introduction and Objectives
701(1)
22.2 Spline Interpolation of Option Values
701(3)
22.3 Numerical Differentiation Foundations
704(6)
22.3.1 Mathematical Foundations
704(2)
22.3.2 Using Cubic Splines
706(1)
22.3.3 Initial Examples
706(2)
22.3.4 Divided Differences
708(2)
22.3.5 What is the Optimum Step Size?
710(1)
22.4 Numerical Greeks
710(5)
22.4.1 An Example: Crank-Nicolson Scheme
712(3)
22.5 Constant Elasticity of Variance Model
715(1)
22.6 Using Software Design (GOF) Patterns
715(5)
22.6.1 Underlying Assumptions and Consequences
717(1)
22.6.2 Pattern Classification
718(2)
22.6.3 Patterns: Incremental Improvements
720(1)
22.7 Multiparadigm Design Patterns
720(1)
22.8 Summary and Conclusions
721(1)
22.9 Exercises and Projects
721(6)
Chapter 23 A POE Software Framework in C++11 for a Class of Path-Dependent Options 727(28)
23.1 Introduction and Objectives
727(1)
23.2 Modelling PDEs and Initial Boundary Value Problems in the Functional Programming Style
728(2)
23.2.1 A Special Case: Asian-Style PDEs
730(1)
23.3 PDE Preprocessing
731(1)
23.4 The Anchoring PDE
732(7)
23.5 ADE for Anchoring PDE
739(7)
23.5.1 The Saul'yev Method and Factory Method Pattern
744(2)
23.6 Useful Utilities
746(2)
23.7 Accuracy and Performance
748(2)
23.8 Summary and Conclusions
750(1)
23.9 Exercises and Projects
751(4)
Chapter 24 Ordinary Differential Equations and their Numerical Approximation 755(26)
24.1 Introduction and Objectives
755(1)
24.2 What is an ODE?
755(1)
24.3 Classifying ODEs
756(1)
24.4 A Palette of Model ODEs
757(3)
24.4.1 The Logistic Function
757(1)
24.4.2 Bernoulli Differential Equation
758(1)
24.4.3 Riccati Differential Equation
758(1)
24.4.4 Population Growth and Decay
759(1)
24.5 Existence and Uniqueness Results
760(3)
24.5.1 A Test Case
762(1)
24.6 Overview of Numerical Methods for ODEs: The Big Picture
763(7)
24.6.1 Mapping Mathematical Functions to C++
763(2)
24.6.2 Runge-Kutta Methods
765(1)
24.6.3 Richardson Extrapolation Methods
766(1)
24.6.4 Embedded Runge-Kutta Methods
767(1)
24.6.5 Implicit Runge-Kutta Methods
767(1)
24.6.6 Stiff ODEs: An Overview
768(2)
24.7 Creating ODE Solvers in C++
770(6)
24.7.1 Explicit Euler Method
771(1)
24.7.2 Runge-Kutta Method
772(3)
24.7.3 Stiff Systems
775(1)
24.8 Summary and Conclusions
776(1)
24.9 Exercises and Projects
776(2)
24.10 Appendix
778(3)
Chapter 25 Advanced Ordinary Differential Equations and Method of Lines 781(37)
25.1 Introduction and Objectives
781(1)
25.2 An Introduction to the Boost Odeint Library
782(9)
25.2.1 Steppers
782(2)
25.2.2 Examples of Steppers
784(2)
25.2.3 Integrate Functions and Observers
786(1)
25.2.4 Modelling ODEs and their Observers
787(4)
25.3 Systems of Stiff and Non-stiff Equations
791(5)
25.3.1 Scalar ODEs
791(1)
25.3.2 Systems of ODEs
792(4)
25.4 Matrix Differential Equations
796(3)
25.5 The Method of Lines: What is it and what are its Advantages?
799(2)
25.6 Initial Foray in Computational Finance: MOL for One-Factor Black-Scholes PDE
801(5)
25.7 Barrier Options
806(2)
25.8 Using Exponential Fitting of Barrier Options
808(1)
25.9 Summary and Conclusions
808(1)
25.10 Exercises and Projects
809(9)
Chapter 26 Random Number Generation and Distributions 818(35)
26.1 Introduction and Objectives
819(1)
26.2 What is a Random Number Generator?
820(1)
26.2.1 Uniform Random Number Generation
820(1)
26.2.2 Polar Marsaglia Method
820(1)
26.2.3 Box-Muller Method
821(1)
26.3 What is a Distribution?
821(4)
26.3.1 Analytical Solutions for Random Variate Computations
822(1)
26.3.2 Other Methods for Computing Random Variates
823(2)
26.4 Some Initial Examples
825(2)
26.4.1 Calculating the Area of a Circle
826(1)
26.5 Engines in Detail
827(3)
26.5.1 Seeding an Engine
828(1)
26.5.2 Seeding a Collection of Random Number Engines
829(1)
26.6 Distributions in C++: The List
830(1)
26.7 Back to the Future: C-Style Pseudo-Random Number Generation
831(2)
26.8 Cryptographic Generators
833(1)
26.9 Matrix Decomposition Methods
833(12)
26.9.1 Cholesky (Square-Root) Decomposition
835(5)
26.9.2 LU Decomposition
840(2)
26.9.3 QR Decomposition
842(3)
26.10 Generating Random Numbers
845(3)
26.10.1 Appendix: Overview of the Eigen Matrix Library
846(2)
26.11 Summary and Conclusions
848(1)
26.12 Exercises and Projects
849(4)
Chapter 27 Microsoft .Net, C# and C++11 Interoperability 853(46)
27.1 Introduction and Objectives
853(1)
27.2 The Big Picture
854(4)
27.3 Types
858(1)
27.4 Memory Management
859(2)
27.5 An Introduction to Native Classes
861(1)
27.6 Interfaces and Abstract Classes
861(1)
27.7 Use Case: C++/CLI as 'Main Language'
862(2)
27.8 Use Case: Creating Proxies, Adapters and Wrappers for Legacy C++ Applications
864(8)
27.8.1 Alternative: SWIG (Simplified Wrapper and Interface Generator)
871(1)
27.9 'Back to the Future' Use Case: Calling C# Code from C++11
872(4)
27.10 Modelling Event-Driven Applications with Delegates
876(10)
27.10.1 Next-Generation Strategy (Plug-in) Patterns
877(4)
27.10.2 Events and Multicast Delegates
881(5)
27.11 Use Case: Interfacing with Legacy Code
886(3)
27.11.1 Legacy DLLs
886(1)
27.11.2 Runtime Callable Wrapper (RCW)
887(1)
27.11.3 COM Callable Wrapper (CCW)
888(1)
27.12 Assemblies and Namespaces for C++/CLI
889(6)
27.12.1 Assembly Types
889(1)
27.12.2 Specifying Assembly Attributes in AssemblyInfo.cs
890(1)
27.12.3 An Example: Dynamically Loading Algorithms from an Assembly
891(4)
27.13 Summary and Conclusions
895(1)
27.14 Exercises and Projects
896(3)
Chapter 28 C++ Concurrency, Part I Threads 899
28.1 Introduction and Objectives
899(1)
28.2 Thread Fundamentals
900(3)
28.2.1 A Small Digression into the World of OpenMP
902(1)
28.3 Six Ways to Create a Thread
903(6)
28.3.1 Detaching a Thread
908(1)
28.3.2 Cooperative Tasking with Threads
908(1)
28.4 Intermezzo: Parallelising the Binomial Method
909(7)
28.5 Atomics
916(8)
28.5.1 The C++ Memory Model
918(2)
28.5.2 Atomic Flags
920(2)
28.5.3 Simple Producer-Consumer Example
922(2)
28.6 Smart Pointers and the Thread-Safe Pointer Interface
924(2)
28.7 Thread Synchronisation
926(3)
28.8 When Should we use Threads?
929(1)
28.9 Summary and Conclusions
929(1)
28.10 Exercises and Projects
930
Chapter 29 C++ Concurrency, Part II Tasks 885(96)
29.1 Introduction and Objectives
935(1)
29.2 Finding Concurrency: Motivation
936(1)
29.2.1 Data and Task Parallelism
936(1)
29.3 Tasks and Task Decomposition
937(4)
29.3.1 Data Dependency Graph: First Example
937(2)
29.3.2 Data Dependency Graph: Generalisations
939(1)
29.3.3 Steps to Parallelisation
940(1)
29.4 Futures and Promises
941(4)
29.4.1 Examples of Futures and Promises in C++
942(2)
29.4.2 Mapping Dependency Graphs to C++
944(1)
29.5 Shared Futures
945(3)
29.6 Waiting on Tasks to Complete
948(2)
29.7 Continuations and Futures in Boost
950(2)
29.8 Pure Functions
952(1)
29.9 Tasks versus Threads
953(1)
29.10 Parallel Design Patterns
953(2)
29.11 Summary and Conclusions
955(1)
29.12 Quizzes, Exercises and Projects
955(26)
Chapter 30 Parallel Patterns Language (PPL) 981
30.1 Introduction and Objectives
961(1)
30.2 Parallel Algorithms
962(5)
30.2.1 Parallel For
963(1)
30.2.2 Parallel for each
964(1)
30.2.3 Parallel Invoke and Task Groups
964(3)
30.2.4 Parallel Transform and Parallel Reduction
967(1)
30.3 Partitioning Work
967(4)
30.3.1 Parallel Sort
970(1)
30.4 The Aggregation/Reduction Pattern in PPL
971(6)
30.4.1 An Extended Example: Computing Prime Numbers
973(2)
30.4.2 An Extended Example: Merging and Filtering Sets
975(2)
30.5 Concurrent Containers
977(1)
30.6 An Introduction to the Asynchronous Agents Library and Event-Based Systems
978(8)
30.6.1 Agents Library Overview
979(1)
30.6.2 Initial Examples and Essential Syntax
980(3)
30.6.3 Simulating Stock Quotes Work Flow
983(2)
30.6.4 Monte Carlo Option Pricing Using Agents
985(1)
30.6.5 Conclusions and Epilogue
985(1)
30.7 A Design Plan to Implement a Framework Using Message Passing and Other Approaches
986(3)
30.8 Summary and Conclusions
989(1)
30.9 Exercises and Projects
990
Chapter 31 Monte Carlo Simulation, Part I 883(140)
31.1 Introduction and Objectives
993(2)
31.1.1 Software Product and Process Management
994(1)
31.1.2 Who can Benefit from this
Chapter?
995(1)
31.2 The Boost Parameters Library for the Impatient
995(5)
31.2.1 Other Ways to Initialise Data
997(2)
31.2.2 Boost Parameter and Option Data
999(1)
31.3 Monte Carlo Version 1: The Monolith Program ('Ball of Mud')
1000(3)
31.4 Policy-Based Design: Dynamic Polymorphism
1003(8)
31.5 Policy-Based Design Approach: CRTP and Static Polymorphism
1011(2)
31.6 Builders and their Subcontractors (Factory Method Pattern)
1013(1)
31.7 Practical Issue: Structuring the Project Directory and File Contents
1014(2)
31.8 Summary and Conclusions
1016(1)
31.9 Exercises and Projects
1017(6)
Chapter 32 Monte Carlo Simulation, Part II 1023(30)
32.1 Introduction and Objectives
1023(1)
32.2 Parallel Processing and Monte Carlo Simulation
1023(10)
32.2.1 Some Random Number Generators
1025(1)
32.2.2 A Test Case
1026(3)
32.2.3 C++ Threads
1029(2)
32.2.4 C++ Futures
1031(1)
32.2.5 PPL Parallel Tasks
1031(1)
32.2.6 OpenMP Parallel Loops
1032(1)
32.2.7 Boost Thread Group
1032(1)
32.3 A Family of Predictor-Corrector Schemes
1033(5)
32.4 An Example (CEV Model)
1038(3)
32.5 Implementing the Monte Carlo Method Using the Asynchronous Agents Library
1041(6)
32.6 Summary and Conclusions
1047(3)
32.6.1 Appendix: C++ for Closed-Form Solution of CEV Option Prices
1047(3)
32.7 Exercises and Projects
1050(3)
Appendix 1: Multiple-Precision Arithmetic 1053(22)
Appendix 2: Computing Implied Volatility 1075(34)
References 1109(8)
Index 1117
DANIEL J. DUFFY started the company Datasim in 1987 to promote C++ as a new object-oriented language for developing applications in the roles of developer, architect and requirements analyst to help clients design and analyse software systems for Computer Aided Design (CAD), process control and hardware- software systems, logistics, holography (optical technology) and computational finance. He used a combination of top-down functional decomposition and bottom-up object-oriented programming techniques to create stable and extendible applications. Prior to Datasim, he worked on engineering and financial applications in oil and gas and semiconductor industries using a range of numerical methods (for example, the finite element method [ FEM]) on mainframe and mini-computers.

Duffy has BA (Mod), MSc and PhD degrees in pure, numerical and applied mathematics and has been active in promoting partial differential equation (PDE) and finite difference methods (FDM) to applications in computational finance. He was responsible for the introduction of the Fractional Step ("Soviet Splitting") method and the Alternating Direction Explicit (ADE) method in computational finance.

He is the originator of two very popular and leading C++ online courses (both C++98 and C++11/14/17) on www.quantnet.com in cooperation with Quantnet LLC and Baruch College (CUNY), NYC. He also trains quants, developers and designers around the world. Duffy can be contacted at dduffy@datasim.nl. In his spare time, he tries to keep in shape by workouts in the dojo.