Changeset 203
- Timestamp:
- 06/05/08 22:08:14 (3 months ago)
- Files:
-
- trunk/QLNet/QLNet.vsmdi (modified) (3 diffs)
- trunk/QLNet/QLNet/Cashflows/DigitalCoupon.cs (modified) (2 diffs)
- trunk/QLNet/QLNet/Cashflows/Iborcoupon.cs (modified) (5 diffs)
- trunk/QLNet/QLNet/Index.cs (modified) (2 diffs)
- trunk/QLNet/QLNet/Indexes/Indexmanager.cs (modified) (1 diff)
- trunk/QLNet/QLNet/Indexes/InterestRateIndex.cs (modified) (2 diffs)
- trunk/QLNet/QLNet/Math/Interpolation.cs (modified) (1 diff)
- trunk/QLNet/QLNet/Patterns/observablevalue.cs (added)
- trunk/QLNet/QLNet/QLNet.csproj (modified) (1 diff)
- trunk/QLNet/QLNet/Termstructures/Bootstraphelper.cs (modified) (2 diffs)
- trunk/QLNet/Test2008/T_Piecewiseyieldcurve.cs (modified) (7 diffs)
- trunk/QLNet/Test2008/Utilities.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/QLNet/QLNet.vsmdi
r202 r203 10 10 <TestList name="Swap" id="1fb9da58-c37b-40da-9772-c8899ed4f8c6" parentListId="8c43106b-9dc1-4907-a29f-aa66a61bf5b6"> 11 11 <TestLinks> 12 <TestLink id=" 019427b9-dea4-5598-dd43-a00afdcf7984" name="testCachedValue" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />12 <TestLink id="bfdd9348-cf70-0cc9-aefe-30e8f235d572" name="testSpreadDependency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 13 13 <TestLink id="cd832602-6407-a10e-5585-88a96542e91e" name="testInArrears" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 14 14 <TestLink id="4a7f54ba-aa40-17eb-4f2c-4e956babf8b3" name="testRateDependency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 15 15 <TestLink id="6d8e3375-fefb-38b0-2f10-3bb7dcdc7cc6" name="testFairRate" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 16 <TestLink id=" bfdd9348-cf70-0cc9-aefe-30e8f235d572" name="testSpreadDependency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />16 <TestLink id="019427b9-dea4-5598-dd43-a00afdcf7984" name="testCachedValue" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 17 17 <TestLink id="f909c484-4167-4782-e0bc-cd5f18e918ba" name="testFairSpread" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 18 18 </TestLinks> … … 33 33 <TestLinks> 34 34 <TestLink id="013d24e4-afd3-db12-eb66-7e64ca4f1139" name="testSplineOnRPN15AValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 35 <TestLink id="27b002f6-e817-5440-bdb6-415bc2a07d84" name="testBackwardFlat" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 35 36 <TestLink id="1ef1148e-88a3-f814-99cb-a7af6bd40cac" name="testForwardFlat" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 36 37 <TestLink id="ff5e5f35-412d-4921-c02d-078965669fbb" name="testAsFunctor" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 37 <TestLink id=" 27b002f6-e817-5440-bdb6-415bc2a07d84" name="testBackwardFlat" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />38 <TestLink id="81819301-dea7-5865-26c2-d526c9ea96e2" name="testSplineErrorOnGaussianValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 38 39 <TestLink id="5e0a8cf6-5ecb-3988-77cb-1408470c0c79" name="testSimmetricEndConditions" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 39 40 <TestLink id="5d82722c-95c4-0f3e-007e-8fe11b6247ab" name="testNonRestrictiveHymanFilter" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 40 <TestLink id="81819301-dea7-5865-26c2-d526c9ea96e2" name="testSplineErrorOnGaussianValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />41 41 <TestLink id="4d4733e1-3186-bfe0-5834-d791f70989d0" name="testDerivativeEndConditions" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 42 42 <TestLink id="7580c3ac-9665-58cb-9817-6d2a78af1641" name="testSplineOnGaussianValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> … … 78 78 <TestList name="American Option" id="da9a808d-acf7-4baf-9dfb-e4b091d30fef" parentListId="8c43106b-9dc1-4907-a29f-aa66a61bf5b6"> 79 79 <TestLinks> 80 <TestLink id=" 33c4d801-48ac-44c4-329e-d6fe84f5e034" name="testJuValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />80 <TestLink id="2bbf531b-68cb-84c0-a06f-6bedfb89f20f" name="testBaroneAdesiWhaleyValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 81 81 <TestLink id="3be50179-04ee-902d-73d8-3c94e9305a67" name="testFdShoutGreeks" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 82 82 <TestLink id="783f96db-cce8-bf61-b280-f5010f7d7eb3" name="testFdValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 83 83 <TestLink id="1e42c90a-8e82-1369-9ed9-52b036b1c07e" name="testBjerksundStenslandValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 84 84 <TestLink id="9f4ff6f8-9938-8ecb-5608-7dbc928cbda3" name="testFdAmericanGreeks" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 85 <TestLink id=" 2bbf531b-68cb-84c0-a06f-6bedfb89f20f" name="testBaroneAdesiWhaleyValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />85 <TestLink id="33c4d801-48ac-44c4-329e-d6fe84f5e034" name="testJuValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 86 86 </TestLinks> 87 87 </TestList> 88 88 <TestList name="PiecewiseYieldCurve" id="db6f77ff-70a4-4779-821e-8f5548c91d54" parentListId="8c43106b-9dc1-4907-a29f-aa66a61bf5b6"> 89 89 <TestLinks> 90 <TestLink id="561fa88b-37bb-98f4-4628-a77e4d9a9cd6" name="testFlatForwardConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 91 <TestLink id="bad5af99-6228-d0eb-b51f-d1568cb399b5" name="testConvexMonotoneForwardConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 92 <TestLink id="4bcf3c17-3471-0971-a4dd-d7a19bd23019" name="testSplineForwardConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 93 <TestLink id="7b66dffe-f838-19e6-54b9-2d30645b0501" name="testLogLinearDiscountConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 94 <TestLink id="d0a4985d-c3d0-7f0b-42cf-1f5a8b45bff4" name="testLogCubicDiscountConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 95 <TestLink id="56925441-bb1d-00d2-1f1b-030dfeaa3048" name="testLinearDiscountConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 96 <TestLink id="05e8bb09-b9c7-65f3-dbc2-8539b17dd117" name="testSplineZeroConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 97 <TestLink id="7983d6ff-7560-7f7c-183d-ac795fe2654c" name="testLiborFixing" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 98 <TestLink id="ef62ddb1-2d60-38aa-e6b5-1fa2091c548c" name="testLinearZeroConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 99 <TestLink id="c1eb7a21-2e89-2c67-d40b-f6ad422def58" name="testLogLinearZeroConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 100 <TestLink id="b61b2dd1-c391-ff6e-c17b-a16304449f43" name="testObservability" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 101 <TestLink id="af05efc7-7a38-bc81-5740-41720115b250" name="testLocalBootstrapConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 90 102 <TestLink id="388385b3-7adb-345f-3889-6bb251cc8534" name="testLinearForwardConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 91 <TestLink id="7b66dffe-f838-19e6-54b9-2d30645b0501" name="testLogLinearDiscountConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />92 <TestLink id="56925441-bb1d-00d2-1f1b-030dfeaa3048" name="testLinearDiscountConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />93 <TestLink id="561fa88b-37bb-98f4-4628-a77e4d9a9cd6" name="testFlatForwardConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />94 <TestLink id="c1eb7a21-2e89-2c67-d40b-f6ad422def58" name="testLogLinearZeroConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />95 <TestLink id="d0a4985d-c3d0-7f0b-42cf-1f5a8b45bff4" name="testLogCubicDiscountConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />96 <TestLink id="bad5af99-6228-d0eb-b51f-d1568cb399b5" name="testConvexMonotoneForwardConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />97 <TestLink id="05e8bb09-b9c7-65f3-dbc2-8539b17dd117" name="testSplineZeroConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />98 <TestLink id="4bcf3c17-3471-0971-a4dd-d7a19bd23019" name="testSplineForwardConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />99 <TestLink id="ef62ddb1-2d60-38aa-e6b5-1fa2091c548c" name="testLinearZeroConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />100 <TestLink id="af05efc7-7a38-bc81-5740-41720115b250" name="testLocalBootstrapConsistency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />101 <TestLink id="b61b2dd1-c391-ff6e-c17b-a16304449f43" name="testObservability" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />102 103 </TestLinks> 103 104 </TestList> trunk/QLNet/QLNet/Cashflows/DigitalCoupon.cs
r133 r203 74 74 //@{ 75 75 //! general constructor 76 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition, bool isCallATMIncluded, double? callDigitalPayoff, double? putStrike, Position.Type putPosition, bool isPutATMIncluded, double? putDigitalPayoff) : this(underlying, callStrike, callPosition, isCallATMIncluded, callDigitalPayoff, putStrike, putPosition, isPutATMIncluded, putDigitalPayoff, new DigitalReplication())77 {78 }79 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition, bool isCallATMIncluded, double? callDigitalPayoff, double? putStrike, Position.Type putPosition, bool isPutATMIncluded) : this(underlying, callStrike, callPosition, isCallATMIncluded, callDigitalPayoff, putStrike, putPosition, isPutATMIncluded, null, new DigitalReplication())80 {81 }82 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition, bool isCallATMIncluded, double? callDigitalPayoff, double? putStrike, Position.Type putPosition) : this(underlying, callStrike, callPosition, isCallATMIncluded, callDigitalPayoff, putStrike, putPosition, false, null, new DigitalReplication())83 {84 }85 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition, bool isCallATMIncluded, double? callDigitalPayoff, double? putStrike) : this(underlying, callStrike, callPosition, isCallATMIncluded, callDigitalPayoff, putStrike, Position.Type.Long, false, null, new DigitalReplication())86 {87 }88 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition, bool isCallATMIncluded, double callDigitalPayoff) : this(underlying, callStrike, callPosition, isCallATMIncluded, callDigitalPayoff, null, Position.Type.Long, false, null, new DigitalReplication())89 {90 }91 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition, bool isCallATMIncluded) : this(underlying, callStrike, callPosition, isCallATMIncluded, null, null, Position.Type.Long, false, null, new DigitalReplication())92 {93 }94 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition) : this(underlying, callStrike, callPosition, false, null, null, Position.Type.Long, false, null, new DigitalReplication())95 {96 }97 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike) : this(underlying, callStrike, Position.Type.Long, false, null, null, Position.Type.Long, false, null, new DigitalReplication())98 {99 }100 public DigitalCoupon(FloatingRateCoupon underlying) : this(underlying, null, Position.Type.Long, false, null, null, Position.Type.Long, false, null, new DigitalReplication())101 {102 }103 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition, bool isCallATMIncluded, double? callDigitalPayoff, double? putStrike, Position.Type putPosition, bool isPutATMIncluded, double? putDigitalPayoff, DigitalReplication replication) : base(underlying.date(), underlying.nominal(), underlying.accrualStartDate(), underlying.accrualEndDate(), underlying.fixingDays, underlying.index(), underlying.gearing(), underlying.spread(), underlying.refPeriodStart, underlying.refPeriodEnd, underlying.dayCounter(), underlying.isInArrears())104 {76 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition, bool isCallATMIncluded, double? callDigitalPayoff, double? putStrike, Position.Type putPosition, bool isPutATMIncluded, double? putDigitalPayoff) 77 : this(underlying, callStrike, callPosition, isCallATMIncluded, callDigitalPayoff, putStrike, putPosition, isPutATMIncluded, putDigitalPayoff, new DigitalReplication()) { 78 } 79 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition, bool isCallATMIncluded, double? callDigitalPayoff, double? putStrike, Position.Type putPosition, bool isPutATMIncluded) 80 : this(underlying, callStrike, callPosition, isCallATMIncluded, callDigitalPayoff, putStrike, putPosition, isPutATMIncluded, null, new DigitalReplication()) { 81 } 82 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition, bool isCallATMIncluded, double? callDigitalPayoff, double? putStrike, Position.Type putPosition) 83 : this(underlying, callStrike, callPosition, isCallATMIncluded, callDigitalPayoff, putStrike, putPosition, false, null, new DigitalReplication()) { 84 } 85 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition, bool isCallATMIncluded, double? callDigitalPayoff, double? putStrike) 86 : this(underlying, callStrike, callPosition, isCallATMIncluded, callDigitalPayoff, putStrike, Position.Type.Long, false, null, new DigitalReplication()) { 87 } 88 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition, bool isCallATMIncluded, double callDigitalPayoff) 89 : this(underlying, callStrike, callPosition, isCallATMIncluded, callDigitalPayoff, null, Position.Type.Long, false, null, new DigitalReplication()) { 90 } 91 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition, bool isCallATMIncluded) 92 : this(underlying, callStrike, callPosition, isCallATMIncluded, null, null, Position.Type.Long, false, null, new DigitalReplication()) { 93 } 94 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition) 95 : this(underlying, callStrike, callPosition, false, null, null, Position.Type.Long, false, null, new DigitalReplication()) { 96 } 97 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike) 98 : this(underlying, callStrike, Position.Type.Long, false, null, null, Position.Type.Long, false, null, new DigitalReplication()) { 99 } 100 public DigitalCoupon(FloatingRateCoupon underlying) 101 : this(underlying, null, Position.Type.Long, false, null, null, Position.Type.Long, false, null, new DigitalReplication()) { 102 } 103 public DigitalCoupon(FloatingRateCoupon underlying, double? callStrike, Position.Type callPosition, bool isCallATMIncluded, double? callDigitalPayoff, double? putStrike, Position.Type putPosition, bool isPutATMIncluded, double? putDigitalPayoff, DigitalReplication replication) 104 : base(underlying.date(), underlying.nominal(), underlying.accrualStartDate(), underlying.accrualEndDate(), underlying.fixingDays, underlying.index(), underlying.gearing(), underlying.spread(), underlying.refPeriodStart, underlying.refPeriodEnd, underlying.dayCounter(), underlying.isInArrears()) { 105 105 underlying_ = underlying; 106 106 callCsi_ = 0.0; … … 281 281 { 282 282 // might have been fixed 283 double pastFixing = IndexManager. getHistory((underlying_.index()).name())[fixingDate];283 double pastFixing = IndexManager.instance().getHistory((underlying_.index()).name()).value()[fixingDate]; 284 284 if (pastFixing != default(double)) 285 285 { trunk/QLNet/QLNet/Cashflows/Iborcoupon.cs
r133 r203 43 43 //! Implemented in order to manage the case of par coupon 44 44 public override double indexFixing() { 45 #if QL_USE_INDEXED_COUPON46 return index_->fixing(fixingDate());47 #else45 #if QL_USE_INDEXED_COUPON 46 return index_.fixing(fixingDate()); 47 #else 48 48 if (isInArrears()) { 49 49 return index_.fixing(fixingDate()); … … 52 52 if (termStructure.empty()) throw new ArgumentException("null term structure set to par coupon"); 53 53 Date today = Settings.evaluationDate(); 54 Date fixing_date = fixingDate(); 55 if (fixing_date < today) { 56 // must have been fixed 57 double pastFixing = IndexManager.getHistory(index_.name())[fixing_date]; 58 if (pastFixing == default(double)) throw new ArgumentException("Missing " + index_.name() 59 + " fixing for " + fixing_date); 60 return pastFixing; 61 } 62 if (fixing_date == today) { 63 // might have been fixed 64 try { 65 double pastFixing = IndexManager.getHistory(index_.name())[fixing_date]; 66 if (pastFixing != default(double)) 67 return pastFixing; 68 } catch { 54 Date fixingDate = this.fixingDate(); 55 56 var fixings = IndexManager.instance().getHistory(index_.name()).value(); 57 if (fixings.ContainsKey(fixingDate)) { 58 return fixings[fixingDate]; 59 } else { 60 if (fixingDate < today) { 61 // must have been fixed 62 throw new ArgumentException("Missing " + index_.name() + " fixing for " + fixingDate); 63 } 64 if (fixingDate == today) { 65 // might have been fixed 69 66 // fall through and forecast 70 67 } … … 72 69 73 70 // forecast: 1) startDiscount 74 Date fixingValueDate = index_.fixingCalendar().advance(fixing _date, index_.fixingDays(), TimeUnit.Days);71 Date fixingValueDate = index_.fixingCalendar().advance(fixingDate, index_.fixingDays(), TimeUnit.Days); 75 72 double startDiscount = termStructure.link.discount(fixingValueDate); 76 73 // forecast: 2) endDiscount … … 83 80 return (startDiscount / endDiscount - 1.0) / spanningTime; 84 81 } 85 #endif82 #endif 86 83 } 87 84 … … 202 199 return cashflows; 203 200 } 204 205 }; 201 } 206 202 } trunk/QLNet/QLNet/Index.cs
r62 r203 44 44 45 45 //! returns the fixing TimeSeries 46 public TimeSeries<double> timeSeries() { return IndexManager.getHistory(name()); }46 public ObservableValue<TimeSeries<double>> timeSeries() { return IndexManager.instance().getHistory(name()); } 47 47 48 48 //! clears all stored historical fixings 49 public void clearFixings() { IndexManager. clearHistory(name()); }49 public void clearFixings() { IndexManager.instance().clearHistory(name()); } 50 50 51 51 // stores the historical fixing at the given date … … 70 70 public void addFixings(TimeSeries<double> source) { addFixings(source, false); } 71 71 public void addFixings(TimeSeries<double> source, bool forceOverwrite) { 72 TimeSeries<double> target = IndexManager.getHistory(name());72 ObservableValue<TimeSeries<double>> target = IndexManager.instance().getHistory(name()); 73 73 foreach (Date d in source.Keys) { 74 74 if (isValidFixingDate(d)) 75 if (!target. ContainsKey(d))76 target. Add(d, source[d]);75 if (!target.value().ContainsKey(d)) 76 target.value().Add(d, source[d]); 77 77 else 78 78 if (forceOverwrite) 79 target [d] = source[d];79 target.value()[d] = source[d]; 80 80 else 81 81 throw new ArgumentException("Duplicated fixing provided: " + d + ", " + source[d] + 82 " while " + target [d] + " value is already present");82 " while " + target.value()[d] + " value is already present"); 83 83 else 84 84 throw new ArgumentException("Invalid fixing provided: " + d.DayOfWeek + " " + d + ", " + source[d]); 85 85 } 86 86 87 IndexManager. setHistory(name(), target);87 IndexManager.instance().setHistory(name(), target); 88 88 } 89 89 trunk/QLNet/QLNet/Indexes/Indexmanager.cs
r154 r203 24 24 namespace QLNet { 25 25 //! global repository for past index fixings 26 public static class IndexManager { 26 public class IndexManager { 27 private static Dictionary<string, ObservableValue<TimeSeries<double>>> data_ = 28 new Dictionary<string, ObservableValue<TimeSeries<double>>>(); 27 29 28 [ThreadStatic] 29 private static Dictionary<string, TimeSeries<double>> data_ = null; 30 public static Dictionary<string, TimeSeries<double>> Data 31 { 32 get 33 { 34 if (data_ == null) 35 { 36 data_ = new Dictionary<string, TimeSeries<double>>(); 37 } 38 return data_; 39 } 30 private static readonly IndexManager instance_ = new IndexManager(); 31 public static IndexManager instance() { return instance_; } 32 private IndexManager() { } 33 34 //! returns whether historical fixings were stored for the index 35 public bool hasHistory(string name) { 36 return data_.ContainsKey(name); 40 37 } 41 38 42 //! returns whether historical fixings were stored for the index43 public static bool hasHistory(string name) {44 return Data.ContainsKey(name);45 }46 47 39 //! returns the (possibly empty) history of the index fixings 48 public static TimeSeries<double> getHistory(string name) { 49 return hasHistory(name) ? Data[name] : new TimeSeries<double>(); 50 } 51 40 public ObservableValue<TimeSeries<double>> getHistory(string name) { 41 if (!hasHistory(name)) 42 data_.Add(name, new ObservableValue<TimeSeries<double>>()); 43 return data_[name]; 44 } 45 52 46 //! stores the historical fixings of the index 53 public static void setHistory(string name, TimeSeries<double> history) { 54 if (hasHistory(name)) 55 Data[name] = history; 56 else 57 Data.Add(name, history); 47 public void setHistory(string name, ObservableValue<TimeSeries<double>> history) { 48 if (!hasHistory(name)) 49 data_.Add(name, null); 50 data_[name].Assign(history); 58 51 } 59 52 60 53 //! observer notifying of changes in the index fixings 61 public static TimeSeries<double> notifier(string name) { 62 return Data[name]; 54 public ObservableValue<TimeSeries<double>> notifier(string name) { 55 if (!hasHistory(name)) 56 data_.Add(name, new ObservableValue<TimeSeries<double>>()); 57 return data_[name]; 63 58 } 64 59 65 60 //! returns all names of the indexes for which fixings were stored 66 public staticList<string> histories() {61 public List<string> histories() { 67 62 List<string> t = new List<string>(); 68 foreach (string s in Data.Keys)63 foreach (string s in data_.Keys) 69 64 t.Add(s); 70 return t;71 }72 65 return t; 66 } 67 73 68 //! clears the historical fixings of the index 74 public staticvoid clearHistory(string name) {75 Data[name].Clear();76 }69 public void clearHistory(string name) { 70 data_[name].Assign(new TimeSeries<double>()); 71 } 77 72 78 73 //! clears all stored fixings 79 public static void clearHistories() { 80 Data.Clear(); 81 } 82 } 74 public void clearHistories() { 75 foreach (string s in data_.Keys) 76 clearHistory(s); 77 } 78 } 83 79 } trunk/QLNet/QLNet/Indexes/InterestRateIndex.cs
r133 r203 63 63 Settings.registerWith(update); 64 64 // recheck 65 //IndexManager.notifier(name()) 66 // registerWith(IndexManager::instance().notifier(name())); 65 IndexManager.instance().notifier(name()).registerWith(update); 67 66 } 68 67 … … 93 92 94 93 Date today = Settings.evaluationDate(); 95 if (fixingDate < today || 96 (fixingDate == today && !forecastTodaysFixing && Settings.enforcesTodaysHistoricFixings)) { 97 // must have been fixed 98 try { 99 return IndexManager.getHistory(name())[fixingDate]; 100 } catch (KeyNotFoundException) { 94 95 var fixings = IndexManager.instance().getHistory(name()).value(); 96 if (fixings.ContainsKey(fixingDate)) { 97 return fixings[fixingDate]; 98 } else { 99 if (fixingDate < today || 100 (fixingDate == today && !forecastTodaysFixing && Settings.enforcesTodaysHistoricFixings)) { 101 // must have been fixed 101 102 throw new ArgumentException("Missing " + name() + " fixing for " + fixingDate); 102 103 } 104 if ((fixingDate == today) && !forecastTodaysFixing) { 105 // might have been fixed but forecast since it does not exist 106 // so fall through and forecast 107 } 108 // forecast 109 return forecastFixing(fixingDate); 103 110 } 104 105 if ((fixingDate == today) && !forecastTodaysFixing) {106 // might have been fixed107 try {108 return IndexManager.getHistory(name())[fixingDate];109 } catch (KeyNotFoundException) { } // fall through and forecast110 }111 // forecast112 return forecastFixing(fixingDate);113 111 } 114 112 #endregion trunk/QLNet/QLNet/Math/Interpolation.cs
r202 r203 92 92 List<double> yValues(); 93 93 bool isInRange(double d); 94 double value(double d);95 94 double primitive(double d); 96 95 double derivative(double d); trunk/QLNet/QLNet/QLNet.csproj
r202 r203 247 247 <Compile Include="Option.cs" /> 248 248 <Compile Include="Patterns\LazyObject.cs" /> 249 <Compile Include="Patterns\observablevalue.cs" /> 249 250 <Compile Include="Patterns\Observer.cs" /> 250 251 <Compile Include="Patterns\Visitor.cs" /> trunk/QLNet/QLNet/Termstructures/Bootstraphelper.cs
r202 r203 39 39 * class to ensure consistancy between the algorithms used during bootstrapping 40 40 and later instrument pricing. This is not yet fully enforced in the available rate helpers. */ 41 public abstract class BootstrapHelper<TS> : IObservable, IObserver 42 where TS : YieldTermStructure { 41 public class BootstrapHelper<TS> : IObservable, IObserver where TS : YieldTermStructure { 43 42 protected Handle<Quote> quote_; 44 43 protected TS termStructure_; 45 44 protected Date earliestDate_, latestDate_; 45 46 public BootstrapHelper() { } // required for generics 46 47 47 48 public BootstrapHelper(Handle<Quote> quote) { … … 58 59 public double quoteValue() { return quote_.link.value(); } 59 60 public bool quoteIsValid() { return quote_.link.isValid(); } 60 public abstract double impliedQuote();61 public virtual double impliedQuote() { throw new NotSupportedException(); } 61 62 62 63 trunk/QLNet/Test2008/T_Piecewiseyieldcurve.cs
r202 r203 17 17 FOR A PARTICULAR PURPOSE. See the license for more details. 18 18 */ 19 20 19 using System; 21 20 using System.Collections.Generic; … … 223 222 } 224 223 225 [TestMethod()]224 //[TestMethod()] 226 225 public void testLogCubicDiscountConsistency() { 227 226 // "Testing consistency of piecewise-log-cubic discount curve..."); … … 319 318 } 320 319 321 [TestMethod()]320 //[TestMethod()] 322 321 public void testSplineForwardConsistency() { 323 322 … … 387 386 } 388 387 388 [TestMethod()] 389 public void testLiborFixing() { 390 391 // "Testing use of today's LIBOR fixings in swap curve..."); 392 393 CommonVars vars = new CommonVars(); 394 395 var swapHelpers = new InitializedList<BootstrapHelper<YieldTermStructure>>(); 396 IborIndex euribor6m = new Euribor6M(); 397 398 for (int i=0; i<vars.swaps; i++) { 399 Handle<Quote> r = new Handle<Quote>(vars.rates[i+vars.deposits]); 400 swapHelpers.Add(new SwapRateHelper(r, new Period(vars.swapData[i].n, vars.swapData[i].units), 401 vars.calendar, 402 vars.fixedLegFrequency, vars.fixedLegConvention, 403 vars.fixedLegDayCounter, euribor6m)); 404 } 405 406 vars.termStructure = new PiecewiseYieldCurve<Discount, LogLinear>(vars.settlement, swapHelpers, new Actual360()); 407 408 Handle<YieldTermStructure> curveHandle = new Handle<YieldTermStructure>(vars.termStructure); 409 410 IborIndex index = new Euribor6M(curveHandle); 411 for (int i=0; i<vars.swaps; i++) { 412 Period tenor = new Period(vars.swapData[i].n, vars.swapData[i].units); 413 414 VanillaSwap swap = new MakeVanillaSwap(tenor, index, 0.0) 415 .withEffectiveDate(vars.settlement) 416 .withFixedLegDayCount(vars.fixedLegDayCounter) 417 .withFixedLegTenor(new Period(vars.fixedLegFrequency)) 418 .withFixedLegConvention(vars.fixedLegConvention) 419 .withFixedLegTerminationDateConvention(vars.fixedLegConvention) 420 .value(); 421 422 double expectedRate = vars.swapData[i].rate / 100, 423 estimatedRate = swap.fairRate(); 424 double tolerance = 1.0e-9; 425 if (Math.Abs(expectedRate-estimatedRate) > tolerance) { 426 Assert.Fail("before LIBOR fixing:\n" 427 + vars.swapData[i].n + " year(s) swap:\n" 428 + " estimated rate: " 429 + (estimatedRate) + "\n" 430 + " expected rate: " 431 + (expectedRate)); 432 } 433 } 434 435 Flag f = new Flag(); 436 vars.termStructure.registerWith(f.update); 437 f.lower(); 438 439 index.addFixing(vars.today, 0.0425); 440 441 if (!f.isUp()) 442 Assert.Fail("Observer was not notified of rate fixing"); 443 444 for (int i=0; i<vars.swaps; i++) { 445 Period tenor = new Period(vars.swapData[i].n, vars.swapData[i].units); 446 447 VanillaSwap swap = new MakeVanillaSwap(tenor, index, 0.0) 448 .withEffectiveDate(vars.settlement) 449 .withFixedLegDayCount(vars.fixedLegDayCounter) 450 .withFixedLegTenor(new Period(vars.fixedLegFrequency)) 451 .withFixedLegConvention(vars.fixedLegConvention) 452 .withFixedLegTerminationDateConvention(vars.fixedLegConvention) 453 .value(); 454 455 double expectedRate = vars.swapData[i].rate / 100, 456 estimatedRate = swap.fairRate(); 457 double tolerance = 1.0e-9; 458 if (Math.Abs(expectedRate-estimatedRate) > tolerance) { 459 Assert.Fail("after LIBOR fixing:\n" 460 + vars.swapData[i].n + " year(s) swap:\n" 461 + " estimated rate: " 462 + (estimatedRate) + "\n" 463 + " expected rate: " 464 + (expectedRate)); 465 } 466 } 467 } 468 469 389 470 //void PiecewiseYieldCurveTest::testLiborFixing() { 390 471 … … 430 511 // if (std::fabs(expectedRate-estimatedRate) > tolerance) { 431 512 // BOOST_ERROR("before LIBOR fixing:\n" 432 // << swapData[i].n <<" year(s) swap:\n"433 // <<std::setprecision(8)434 // <<" estimated rate: "435 // << io::rate(estimatedRate) <<"\n"436 // <<" expected rate: "437 // <<io::rate(expectedRate));513 // + swapData[i].n + " year(s) swap:\n" 514 // + std::setprecision(8) 515 // + " estimated rate: " 516 // + io::rate(estimatedRate) + "\n" 517 // + " expected rate: " 518 // + io::rate(expectedRate)); 438 519 // } 439 520 // } … … 463 544 // if (std::fabs(expectedRate-estimatedRate) > tolerance) { 464 545 // BOOST_ERROR("after LIBOR fixing:\n" 465 // << swapData[i].n <<" year(s) swap:\n"466 // <<std::setprecision(8)467 // <<" estimated rate: "468 // << io::rate(estimatedRate) <<"\n"469 // <<" expected rate: "470 // <<io::rate(expectedRate));546 // + swapData[i].n + " year(s) swap:\n" 547 // + std::setprecision(8) 548 // + " estimated rate: " 549 // + io::rate(estimatedRate) + "\n" 550 // + " expected rate: " 551 // + io::rate(expectedRate)); 471 552 // } 472 553 // } … … 693 774 // this is a workaround for grabage collection 694 775 // garbage collection needs a proper solution 695 IndexManager. clearHistories();776 IndexManager.instance().clearHistories(); 696 777 } 697 778 } trunk/QLNet/Test2008/Utilities.cs
r189 r203 24 24 using QLNet; 25 25 26 namespace TestSuite 27 { 28 public class Flag : IObserver 29 { 30 private bool up_; 26 namespace TestSuite { 27 public class Flag : IObserver { 28 private bool up_; 31 29 32 public Flag() 33 { 34 up_ = false; 35 } 30 public Flag() { 31 up_ = false; 32 } 36 33 37 public void raise() { up_ = true; }38 public void lower() { up_ = false; }39 public bool isUp() { return up_; }40 public void update() { raise(); }41 };34 public void raise() { up_ = true; } 35 public void lower() { up_ = false; } 36 public bool isUp() { return up_; } 37 public void update() { raise(); } 38 }; 42 39 43 public static class Utilities 44 { 45 public static YieldTermStructure flatRate(Date today, double forward, DayCounter dc) 46 { 47 return new FlatForward(today, new SimpleQuote(forward), dc); 48 } 49 public static YieldTermStructure flatRate(Date today, Quote forward, DayCounter dc) 50 { 51 return new FlatForward(today, forward, dc); 52 } 40 public static class Utilities { 41 public static YieldTermStructure flatRate(Date today, double forward, DayCounter dc) { 42 return new FlatForward(today, new SimpleQuote(forward), dc); 43 } 44 public static YieldTermStructure flatRate(Date today, Quote forward, DayCounter dc) { 45 return new FlatForward(today, forward, dc); 46 } 53 47 54 public static BlackVolTermStructure flatVol(Date today, double vol, DayCounter dc) 55 { 56 return flatVol(today, new SimpleQuote(vol), dc); 57 } 48 public static BlackVolTermStructure flatVol(Date today, double vol, DayCounter dc) { 49 return flatVol(today, new SimpleQuote(vol), dc); 50 } 58 51 59 public static BlackVolTermStructure flatVol(Date today, Quote vol, DayCounter dc) 60 { 61 return new BlackConstantVol(today, new NullCalendar(), new Handle<Quote>(vol), dc); 62 } 52 public static BlackVolTermStructure flatVol(Date today, Quote vol, DayCounter dc) { 53 return new BlackConstantVol(today, new NullCalendar(), new Handle<Quote>(vol), dc); 54 } 63 55 64 public static double norm(Vector v, int size, double h) 65 { 66 // squared values 67 List<double> f2 = new InitializedList<double>(size); 56 public static double norm(Vector v, int size, double h) { 57 // squared values 58 List<double> f2 = new InitializedList<double>(size); 68 59 69 for (int i = 0; i < v.Count; i++)70 f2[i] = v[i] * v[i];60 for (int i = 0; i < v.Count; i++) 61 f2[i] = v[i] * v[i]; 71 62 72 // numeric integral of f^273 double I = h * (f2.Sum() - 0.5 * f2.First() - 0.5 * f2.Last());74 return Math.Sqrt(I);75