(*

This code modifies the definition of the function IntegrateIF (from the
package BSplineBasis) to work under Version 3 or greater. This allows one
to use the option FunctionalForm -> DLogDelta for DiscountFunction in the
package YieldCurve.

Note however that the functions InfoIF and PlotIFPolynomials are obsolete
under Version 3 or greater.

There are two ways to use apply this patch.

First way: After loading BSplineBasis or YieldCurve (which loads
BSplineBasis), read this file into your Mathematica session. This must be
done each time you load either BSplineBasis or YieldCurve. For example,

<<FRB`BSplineBasis`
<<BSplineBasisFix.m

Second way: Copy the If statement below and paste it into the file
"BSplineBasis.m" anywhere after the existing definition of IntegrateIF.
(For example, you can paste it at the end of the file, after the Examples.)
This need be done only once.

*)

(***** code starts here *****)

If[$VersionNumber >= 3.0,
(* clear definitions that do not work in Version 3 *)
	Clear[IntegrateIF, InfoIF, PlotIFPolynomials];

(* new usage statements for obsolete functions *)
	InfoIF::usage = ToString @ 
		StringForm["Not defined in Version ``", $VersionNumber];
	PlotIFPolynomials::usage = ToString @ 
		StringForm["Not defined in Version ``", $VersionNumber];

(* new definitions for IntegrateIF *)
	If[$VersionNumber >= 4.0,
	(* then *)
		Derivative[n_Integer /; Negative[n]][if:InterpolatingFunction[__]] :=
			Derivative[n+1][Head @ Integrate[if[#], #]];
		IntegrateIF[if:InterpolatingFunction[__]] := 
			Head @ Integrate[if[#], #],
	(* else *)
	(* this fix for Version 3 supplied by Rob Knapp *)
		IntegrateIF[if_InterpolatingFunction] := 
			Module[{iif, mat, len},
			iif = Head @ Integrate[if[#], #];
			mat = iif[[4]];
			len = Last @ Dimensions[mat];
			iif[[4]] = #/Prepend[Range[len-1],1]& /@ mat; (* the fix *)
			iif]
		]	(* end inner if *)
	]	(* end outer if *)

(***** code ends here *****)
