November 11th, 2011, 5:26 am
QuoteOriginally posted by: outrunQuoteOriginally posted by: CuchulainnQuoteOriginally posted by: outrunIndeed! I see two separate (orthogonal) concepts / libraries* generic numerical derivatives* mesh / grid coordinates mappings / transforms. This will be some mapping between S,t "space" and mesh/grids space i,j (and in doing that also allow for shadow points, 0 or 1 based addressing)The last one has two sub elements: grid, and coordinate transform. For FDM you'll probably have cube-shaped grids, for trees (binomial, trinonimal) you'll have different (triangular) shapes. Both can have the same coordinate transforms. So we have 3 sub libraries:1. numerical derivatives ala dfdx(x1,x2,x3,f1,f2,f3)2. grids, meshes, trees. Basically integer coordinate regions in N dimensions e.g. things like 0<=i<N 3. coordinate tranforms x,y,z <-> f(i,j,k) what do you think?Bang on. All we need now is someone to do itHAHAHAHAHA!!Well, OOglesby sugested 1. We could start a new thread on that, and particullary focus on a good interface. I'm hoping we can provide in general two interfaces: a 'zero-learning-curve' simple one, and a more flexible / generic one. The simple one is basically a synonym for a pre-configured generic out (default policy?)so: *one* pre-cooked interface could be:dfdx(f1,f2,x1,x2) // 2 point, 1st derivativedfdx1(f1,f2,f3,x1,x2,x3) // 3 point, 1st derivative at x1dfdx2(f1,f2,f3,x1,x2,x3) // 3 point, 1st derivative at x2dfdx3(f1,f2,f3,x1,x2,x3) // 3 point, 1st derivative at x3ordfdx3(f1,f2,f3,x1,x2,x3,xi) // 3 point, 1st derivative at xi..don't know.. on a more conceptual level: what are the preconditions? e.g. do we assume x1<x2<x3? Things like that!2. I think we should call these coordinates? Or bound coordinates? 3. I think we should call these coordinate transforms? this one is also a bit tough: I don't think we need bijection? I do think it would be very convenient if we allow for nesting, e.g. use log S (or s/(s+a)) but first apply a cash or stock dividend in S-space. I would also prefer to have the coordinates generic, just specify a good common denominator for an coordinate interface, and then just pick one like double x[3] or std::vector, or boost:tuple but *not* get married to that one (or make divorce possible via traits )I am currently looking at the numerical derivatives task. So far I see several flavors: outrun's pre-cooked interface for 1st and 2nd derivatives an algorithm for N-point, kth derivatives with user specified grid points for x pre-cooked 1st derivative via complex step methods that FinancialAlex has mentioned generalized complex step for N-point, kth derivatives with user specified grid points for xRight now, I am only focusing on flavors 1 and 2.