Egor Kraev's Homepage
  Frequently Asked Questions
Book Home
Code
VC++ 2003
Typos
FAQ
  Code compiles but does not link
Does the code in the book work only in Visual Studio?
Should one control Excel from C++ or combine C++ dll add-ins with VBA?
What's the big deal with exponentially fitted schemes?

Code compiles but does not link

If you get link errors looking like

Array.obj : error LNK2005: "long __stdcall ATL::AtlAxWindowProc(struct HWND__ *,unsigned int,unsigned int,long)" (?AtlAxWindowProc@ATL@@YGJPAUHWND__@@IIJ@Z) already defined in Vector.obj
ExecutiveOption.obj : error LNK2005: "long __cdecl ATL::CreateNormalizedObject(unsigned short const *,struct _GUID const &,void * *,bool &,unsigned short *)" (?CreateNormalizedObject@ATL@@$$FYAJPBGABU_GUID@@PAPAXAA_NPAG@Z) already defined in Vector.obj

you probably defined your VS project as an ATL project - don't do that.

You should make an Empty Windows Console Application, i.e. no WinMain stuff.

back to top

Does the code in the book work only in Visual Studio?

It depends, most of the code is Vendor independent EXCEPT the Excel stuff. In fact, a lot of the stuff was done in Linux.

back to top

Should one control Excel from C++ or combine C++ dll add-ins with VBA?

We work mainly in C++ and C# so we do not do much in VBA, what I think does not scale up. I think that large models will be done in C++.

back to top

What's the big deal with exponentially fitted schemes?

We discuss exponentially fitted schemes in the book. What's the big deal?

The Crank Nicholson gives spurious oscillation for the option price and delta, gamma in some cases. The basic problem is the kink in the payoff function at the strike price and at boundaries for barrier options.

1: Try CN with r = 0.15, sigma = 0.01, K = 14 at t = 1 (t ranges from 0 to 10). S ranges from 10 to 20 with 1000X1000 mesh points. Lots of wiggles (but not giggles :))
2: barrier options: see the example in Tavella/Randall book, p 191. We get a spike at the barrier.

Exponentially fitted schemes do not have this problem because we use implicit Euler in time and Duffy fitting in S (thus solving the nasty boundary layer problems in point 2).

back to top