01 May 2011 11:28:16 AM HERMITE_CUBIC_PRB C++ version Test the HERMITE_CUBIC library. TEST01: HERMITE_CUBIC_VALUE evaluates a Hermite cubic polynomial. Try out four sets of data: (F1,D1,F2,D2) = (1,0,0,0), (0,1,0,0), (0,0,1,0), (0,0,0,1) on [0,1] and [1.0,-2.0] (interval reversed) J X F D -3 -0.3 0.676 2.34 -2 -0.2 0.864 1.44 -1 -0.1 0.968 0.66 *Data 0 1 0 0 0 1 0 1 0.1 0.972 -0.54 2 0.2 0.896 -0.96 3 0.3 0.784 -1.26 4 0.4 0.648 -1.44 5 0.5 0.5 -1.5 6 0.6 0.352 -1.44 7 0.7 0.216 -1.26 8 0.8 0.104 -0.96 9 0.9 0.028 -0.54 10 1 0 0 *Data 1 0 0 11 1.1 0.032 0.66 12 1.2 0.136 1.44 J X F D -3 -0.3 -0.507 2.47 -2 -0.2 -0.288 1.92 -1 -0.1 -0.121 1.43 *Data 0 0 1 0 0 0 1 1 0.1 0.081 0.63 2 0.2 0.128 0.32 3 0.3 0.147 0.07 4 0.4 0.144 -0.12 5 0.5 0.125 -0.25 6 0.6 0.096 -0.32 7 0.7 0.063 -0.33 8 0.8 0.032 -0.28 9 0.9 0.009 -0.17 10 1 0 0 *Data 1 0 0 11 1.1 0.011 0.23 12 1.2 0.048 0.52 J X F D -3 -0.3 0.324 -2.34 -2 -0.2 0.136 -1.44 -1 -0.1 0.032 -0.66 *Data 0 0 0 0 0 0 0 1 0.1 0.028 0.54 2 0.2 0.104 0.96 3 0.3 0.216 1.26 4 0.4 0.352 1.44 5 0.5 0.5 1.5 6 0.6 0.648 1.44 7 0.7 0.784 1.26 8 0.8 0.896 0.96 9 0.9 0.972 0.54 10 1 1 0 *Data 1 1 0 11 1.1 0.968 -0.66 12 1.2 0.864 -1.44 J X F D -3 -0.3 -0.117 0.87 -2 -0.2 -0.048 0.52 -1 -0.1 -0.011 0.23 *Data 0 0 0 0 0 0 0 1 0.1 -0.009 -0.17 2 0.2 -0.032 -0.28 3 0.3 -0.063 -0.33 4 0.4 -0.096 -0.32 5 0.5 -0.125 -0.25 6 0.6 -0.144 -0.12 7 0.7 -0.147 0.07 8 0.8 -0.128 0.32 9 0.9 -0.081 0.63 10 1 0 1 *Data 1 0 1 11 1.1 0.121 1.43 12 1.2 0.288 1.92 J X F D -3 1.9 0.676 -0.78 -2 1.6 0.864 -0.48 -1 1.3 0.968 -0.22 *Data 1 1 0 0 1 1 0 1 0.7 0.972 0.18 2 0.4 0.896 0.32 3 0.1 0.784 0.42 4 -0.2 0.648 0.48 5 -0.5 0.5 0.5 6 -0.8 0.352 0.48 7 -1.1 0.216 0.42 8 -1.4 0.104 0.32 9 -1.7 0.028 0.18 10 -2 0 0 *Data -2 0 0 11 -2.3 0.032 -0.22 12 -2.6 0.136 -0.48 J X F D -3 1.9 1.521 2.47 -2 1.6 0.864 1.92 -1 1.3 0.363 1.43 *Data 1 0 1 0 1 0 1 1 0.7 -0.243 0.63 2 0.4 -0.384 0.32 3 0.1 -0.441 0.07 4 -0.2 -0.432 -0.12 5 -0.5 -0.375 -0.25 6 -0.8 -0.288 -0.32 7 -1.1 -0.189 -0.33 8 -1.4 -0.096 -0.28 9 -1.7 -0.027 -0.17 10 -2 0 2.22045e-16 *Data -2 0 0 11 -2.3 -0.033 0.23 12 -2.6 -0.144 0.52 J X F D -3 1.9 0.324 0.78 -2 1.6 0.136 0.48 -1 1.3 0.032 0.22 *Data 1 0 0 0 1 0 0 1 0.7 0.028 -0.18 2 0.4 0.104 -0.32 3 0.1 0.216 -0.42 4 -0.2 0.352 -0.48 5 -0.5 0.5 -0.5 6 -0.8 0.648 -0.48 7 -1.1 0.784 -0.42 8 -1.4 0.896 -0.32 9 -1.7 0.972 -0.18 10 -2 1 0 *Data -2 1 0 11 -2.3 0.968 0.22 12 -2.6 0.864 0.48 J X F D -3 1.9 0.351 0.87 -2 1.6 0.144 0.52 -1 1.3 0.033 0.23 *Data 1 0 0 0 1 0 0 1 0.7 0.027 -0.17 2 0.4 0.096 -0.28 3 0.1 0.189 -0.33 4 -0.2 0.288 -0.32 5 -0.5 0.375 -0.25 6 -0.8 0.432 -0.12 7 -1.1 0.441 0.07 8 -1.4 0.384 0.32 9 -1.7 0.243 0.63 10 -2 0 1 *Data -2 0 1 11 -2.3 -0.363 1.43 12 -2.6 -0.864 1.92 TEST02: HERMITE_CUBIC_VALUE evaluates a Hermite cubic polynomial. Try out data from a cubic function: on [0,10] and [-1.0,1.0] and [0.5,0.75] J X F D S T Exact -3 -120 79 -32 6 -3 -3 -120 79 -32 6 Exact -2 -56 50 -26 6 -2 -2 -56 50 -26 6 Exact -1 -18 27 -20 6 -1 -1 -18 27 -20 6 *Data 0 0 10 Exact 0 0 10 -14 6 0 0 0 10 -14 6 Exact 1 4 -1 -8 6 1 1 4 -1 -8 6 Exact 2 0 -6 -2 6 2 2 0 -6 -2 6 Exact 3 -6 -5 4 6 3 3 -6 -5 4 6 Exact 4 -8 2 10 6 4 4 -8 2 10 6 Exact 5 0 15 16 6 5 5 0 15 16 6 Exact 6 24 34 22 6 6 6 24 34 22 6 Exact 7 70 59 28 6 7 7 70 59 28 6 Exact 8 144 90 34 6 8 8 144 90 34 6 Exact 9 252 127 40 6 9 9 252 127 40 6 Exact 10 400 170 46 6 10 10 400 170 46 6 *Data 10 400 170 Exact 11 594 219 52 6 11 11 594 219 52 6 Exact 12 840 274 58 6 12 12 840 274 58 6 J X F D S T Exact -1.6 -38.016 40.08 -23.6 6 -3 -1.6 -38.016 40.08 -23.6 6 Exact -1.4 -30.464 35.48 -22.4 6 -2 -1.4 -30.464 35.48 -22.4 6 Exact -1.2 -23.808 31.12 -21.2 6 -1 -1.2 -23.808 31.12 -21.2 6 *Data -1 -18 27 Exact -1 -18 27 -20 6 0 -1 -18 27 -20 6 Exact -0.8 -12.992 23.12 -18.8 6 1 -0.8 -12.992 23.12 -18.8 6 Exact -0.6 -8.736 19.48 -17.6 6 2 -0.6 -8.736 19.48 -17.6 6 Exact -0.4 -5.184 16.08 -16.4 6 3 -0.4 -5.184 16.08 -16.4 6 Exact -0.2 -2.288 12.92 -15.2 6 4 -0.2 -2.288 12.92 -15.2 6 Exact 0 0 10 -14 6 5 0 0 10 -14 6 Exact 0.2 1.728 7.32 -12.8 6 6 0.2 1.728 7.32 -12.8 6 Exact 0.4 2.944 4.88 -11.6 6 7 0.4 2.944 4.88 -11.6 6 Exact 0.6 3.696 2.68 -10.4 6 8 0.6 3.696 2.68 -10.4 6 Exact 0.8 4.032 0.72 -9.2 6 9 0.8 4.032 0.72 -9.2 6 Exact 1 4 -1 -8 6 10 1 4 -1 -8 6 *Data 1 4 -1 Exact 1.2 3.648 -2.48 -6.8 6 11 1.2 3.648 -2.48 -6.8 6 Exact 1.4 3.024 -3.72 -5.6 6 12 1.4 3.024 -3.72 -5.6 6 J X F D S T Exact 0.425 3.06239 4.59187 -11.45 6 -3 0.425 3.06239 4.59187 -11.45 6 Exact 0.45 3.17363 4.3075 -11.3 6 -2 0.45 3.17362 4.3075 -11.3 6 Exact 0.475 3.2778 4.02688 -11.15 6 -1 0.475 3.2778 4.02688 -11.15 6 *Data 0.5 3.375 3.75 Exact 0.5 3.375 3.75 -11 6 0 0.5 3.375 3.75 -11 6 Exact 0.525 3.46533 3.47687 -10.85 6 1 0.525 3.46533 3.47687 -10.85 6 Exact 0.55 3.54888 3.2075 -10.7 6 2 0.55 3.54888 3.2075 -10.7 6 Exact 0.575 3.62573 2.94188 -10.55 6 3 0.575 3.62573 2.94188 -10.55 6 Exact 0.6 3.696 2.68 -10.4 6 4 0.6 3.696 2.68 -10.4 6 Exact 0.625 3.75977 2.42188 -10.25 6 5 0.625 3.75977 2.42188 -10.25 6 Exact 0.65 3.81713 2.1675 -10.1 6 6 0.65 3.81712 2.1675 -10.1 6 Exact 0.675 3.86817 1.91687 -9.95 6 7 0.675 3.86817 1.91687 -9.95 6 Exact 0.7 3.913 1.67 -9.8 6 8 0.7 3.913 1.67 -9.8 6 Exact 0.725 3.9517 1.42688 -9.65 6 9 0.725 3.9517 1.42688 -9.65 6 Exact 0.75 3.98438 1.1875 -9.5 6 10 0.75 3.98438 1.1875 -9.5 6 *Data 0.75 3.98438 1.1875 Exact 0.775 4.01111 0.951875 -9.35 6 11 0.775 4.01111 0.951875 -9.35 6 Exact 0.8 4.032 0.72 -9.2 6 12 0.8 4.032 0.72 -9.2 6 TEST03: HERMITE_CUBIC_INTEGRATE integrates a Hermite cubic polynomial from A to B. Exact Computed J A B Integral Integral -3 -1 -3 120.667 120.667 -2 -1 -2 35.0833 35.0833 -1 -1 -1 0 0 0 -1 0 -7.58333 -7.58333 1 -1 1 -4.66667 -4.66667 2 -1 2 -2.25 -2.25 3 -1 3 -5.33333 -5.33333 4 -1 4 -12.9167 -12.9167 5 -1 5 -18 -18 6 -1 6 -7.58333 -7.58333 7 -1 7 37.3333 37.3333 8 -1 8 141.75 141.75 9 -1 9 336.667 336.667 10 -1 10 659.083 659.083 11 -1 11 1152 1152 12 -1 12 1864.42 1864.42 Exact Computed J A B Integral Integral -3 -2 -1.6 -18.6709 -18.6709 -2 -2 -1.4 -25.5036 -25.5036 -1 -2 -1.2 -30.9163 -30.9163 0 -2 -1 -35.0833 -35.0833 1 -2 -0.8 -38.1696 -38.1696 2 -2 -0.6 -40.3303 -40.3303 3 -2 -0.4 -41.7109 -41.7109 4 -2 -0.2 -42.4476 -42.4476 5 -2 0 -42.6667 -42.6667 6 -2 0.2 -42.4849 -42.4849 7 -2 0.4 -42.0096 -42.0096 8 -2 0.6 -41.3383 -41.3383 9 -2 0.8 -40.5589 -40.5589 10 -2 1 -39.75 -39.75 11 -2 1.2 -38.9803 -38.9803 12 -2 1.4 -38.3089 -38.3089 Exact Computed J A B Integral Integral -3 -0.5 0.425 -0.82513 -0.82513 -2 -0.5 0.45 -0.747165 -0.747165 -1 -0.5 0.475 -0.666508 -0.666508 0 -0.5 0.5 -0.583333 -0.583333 1 -0.5 0.525 -0.497815 -0.497815 2 -0.5 0.55 -0.410123 -0.410123 3 -0.5 0.575 -0.320427 -0.320427 4 -0.5 0.6 -0.228892 -0.228892 5 -0.5 0.625 -0.135681 -0.135681 6 -0.5 0.65 -0.0409568 -0.0409568 7 -0.5 0.675 0.0551225 0.0551225 8 -0.5 0.7 0.1524 0.1524 9 -0.5 0.725 0.250721 0.250721 10 -0.5 0.75 0.349935 0.349935 11 -0.5 0.775 0.449891 0.449891 12 -0.5 0.8 0.550442 0.550442 TEST04: HERMITE_CUBIC_SPLINE_VALUE evaluates a Hermite cubic spline. I X F computed F exact Error 0 0 0 0 0 1 0.2 0.198223 0.198669 0.000446022 2 0.4 0.388329 0.389418 0.00108958 3 0.6 0.56347 0.564642 0.00117281 4 0.8 0.716799 0.717356 0.000556784 5 1 0.841471 0.841471 2.22045e-16 6 1.2 0.931 0.932039 0.00103876 7 1.4 0.9831 0.98545 0.00235021 8 1.6 0.997217 0.999574 0.00235692 9 1.8 0.9728 0.973848 0.00104769 10 2 0.909297 0.909297 0 11 2.2 0.80782 0.808496 0.000676464 12 2.4 0.674013 0.675463 0.00145007 13 2.6 0.514127 0.515501 0.00137409 14 2.8 0.334413 0.334988 0.00057535 15 3 0.14112 0.14112 1.38778e-16 16 3.2 -0.0580664 -0.0583741 0.000307767 17 3.4 -0.254758 -0.255541 0.000783257 18 3.6 -0.441648 -0.44252 0.000872071 19 3.8 -0.611432 -0.611858 0.00042596 20 4 -0.756802 -0.756802 1.11022e-16 21 4.2 -0.870567 -0.871576 0.00100904 22 4.4 -0.949306 -0.951602 0.00229646 23 4.6 -0.991375 -0.993691 0.00231645 24 4.8 -0.995129 -0.996165 0.00103564 25 5 -0.958924 -0.958924 0 26 5.2 -0.882672 -0.883455 0.000782604 27 5.4 -0.771066 -0.772764 0.00169831 28 5.6 -0.629636 -0.631267 0.0016311 29 5.8 -0.463909 -0.464602 0.000693162 30 6 -0.279415 -0.279415 0 31 6.2 -0.0832528 -0.0830894 0.000163353 32 6.4 0.116088 0.116549 0.00046126 33 6.6 0.310987 0.311541 0.00055388 34 6.8 0.493827 0.494113 0.00028661 35 7 0.656987 0.656987 0 36 7.2 0.792709 0.793668 0.000959124 37 7.4 0.896511 0.898708 0.00219675 38 7.6 0.96569 0.96792 0.00222962 39 7.8 0.99754 0.998543 0.00100287 40 8 0.989358 0.989358 0 41 8.2 0.939857 0.940731 0.000873081 42 8.4 0.852686 0.854599 0.00191256 43 8.6 0.732542 0.734397 0.00185546 44 8.8 0.58412 0.584917 0.0007971 45 9 0.412118 0.412118 1.66533e-16 46 9.2 0.222906 0.22289 1.56686e-05 47 9.4 0.0249055 0.0247754 0.000130031 48 9.6 -0.174102 -0.174327 0.000224603 49 9.8 -0.366338 -0.366479 0.000141524 50 10 -0.544021 -0.544021 1.11022e-16 I X D computed D exact Error 0 0 1 1 0 1 0.2 0.976527 0.980067 0.00353908 2 0.4 0.918821 0.921061 0.00223951 3 0.6 0.826882 0.825336 0.00154633 4 0.8 0.700709 0.696707 0.00400217 5 1 0.540302 0.540302 4.44089e-16 6 1.2 0.354531 0.362358 0.00782652 7 1.4 0.166001 0.169967 0.00396636 8 1.6 -0.025289 -0.0291995 0.00391048 9 1.8 -0.219338 -0.227202 0.00786385 10 2 -0.416147 -0.416147 5.55112e-17 11 2.2 -0.593419 -0.588501 0.00491829 12 2.4 -0.73944 -0.737394 0.00204655 13 2.6 -0.854209 -0.856889 0.00267936 14 2.8 -0.937727 -0.942222 0.00449553 15 3 -0.989992 -0.989992 2.22045e-16 16 3.2 -0.995783 -0.998295 0.00251179 17 3.4 -0.965043 -0.966798 0.00175485 18 3.6 -0.897774 -0.896758 0.00101516 19 3.8 -0.793974 -0.790968 0.00300595 20 4 -0.653644 -0.653644 2.22045e-16 21 4.2 -0.482628 -0.490261 0.00763254 22 4.4 -0.30339 -0.307333 0.00394284 23 4.6 -0.115929 -0.112153 0.00377634 24 4.8 0.0797552 0.087499 0.00774378 25 5 0.283662 0.283662 0 26 5.2 0.474253 0.468517 0.00573597 27 5.4 0.637199 0.634693 0.00250581 28 5.6 0.7725 0.775566 0.00306557 29 5.8 0.880158 0.88552 0.00536201 30 6 0.96017 0.96017 1.11022e-16 31 6.2 0.995108 0.996542 0.00143422 32 6.4 0.99195 0.993185 0.00123505 33 6.6 0.950696 0.950233 0.000463665 34 6.8 0.871347 0.869397 0.00194956 35 7 0.753902 0.753902 0 36 7.2 0.601066 0.608351 0.0072858 37 7.4 0.434707 0.438547 0.00384041 38 7.6 0.254826 0.25126 0.00356661 39 7.8 0.0614241 0.0539554 0.00746872 40 8 -0.1455 -0.1455 0 41 8.2 -0.345594 -0.339155 0.00643885 42 8.4 -0.522204 -0.519289 0.00291491 43 8.6 -0.67533 -0.67872 0.00339043 44 8.8 -0.804972 -0.811093 0.00612117 45 9 -0.91113 -0.91113 3.33067e-16 46 9.2 -0.974516 -0.974844 0.000327953 47 9.4 -0.999002 -0.999693 0.000690544 48 9.6 -0.984591 -0.984688 9.71047e-05 49 9.8 -0.93128 -0.930426 0.000854156 50 10 -0.839072 -0.839072 3.33067e-16 TEST05: HERMITE_CUBIC_TO_POWER_CUBIC converts the Hermite data to the coefficients of the power form of the polynomial POWER_CUBIC_TO_HERMITE_CUBIC converts the power form to Hermite form Hermite data: X1, F1, D1: -1 -18 27 X2, F2, D2: 1 4 -1 Power form: p(x) = 0 + 10 * x + -7 * x^2 + 1 * x^3 X F (Hermite) F (power) -1.6 -38.016 -38.016 -1.4 -30.464 -30.464 -1.2 -23.808 -23.808 -1 -18 -18 -0.8 -12.992 -12.992 -0.6 -8.736 -8.736 -0.4 -5.184 -5.184 -0.2 -2.288 -2.288 0 0 0 0.2 1.728 1.728 0.4 2.944 2.944 0.6 3.696 3.696 0.8 4.032 4.032 1 4 4 1.2 3.648 3.648 1.4 3.024 3.024 Use POWER_CUBIC_TO_HERMITE_CUBIC to recover the original Hermite data: Original Recovered F1: -18 -18 D1: 27 27 F2: 4 4 D2: -1 -1 TEST06: HERMITE_CUBIC_INTEGRATE integrates a Hermite cubic polynomial from A to B. Use A, B vectors for the calculation. Exact Computed J A B Integral Integral -3 -1 -3 120.667 120.667 -2 -1 -2 35.0833 35.0833 -1 -1 -1 0 0 0 -1 0 -7.58333 -7.58333 1 -1 1 -4.66667 -4.66667 2 -1 2 -2.25 -2.25 3 -1 3 -5.33333 -5.33333 4 -1 4 -12.9167 -12.9167 5 -1 5 -18 -18 6 -1 6 -7.58333 -7.58333 7 -1 7 37.3333 37.3333 8 -1 8 141.75 141.75 9 -1 9 336.667 336.667 10 -1 10 659.083 659.083 11 -1 11 1152 1152 12 -1 12 1864.42 1864.42 TEST07: HERMITE_CUBIC_INTEGRAL integrates a Hermite cubic polynomial over the definition interval [X1,X2]. Exact Computed X1 X2 Integral Integral 0 10 666.667 666.667 -1 1 -4.66667 -4.66667 0.5 0.75 0.933268 0.933268 TEST08: HERMITE_CUBIC_SPLINE_INTEGRAL integrates a Hermite cubic spline over the definition interval [X1,XNN]. Exact Computed X1 XNN Integral Integral 0 1 -0.166667 -0.166667 0 1 -0.166667 -0.166667 0 3.14159 2 1.99997 TEST09: HERMITE_CUBIC_SPLINE_INTEGRATE integrates a Hermite cubic spline from A to B. Exact Computed I A B Integral Integral 0 2.5 -1 3.02604 3.02604 1 2.5 -0.5 -3 -3 2 2.5 0 -4.55729 -4.55729 3 2.5 0.5 -3.58333 -3.58333 4 2.5 1 -1.64062 -1.64062 5 2.5 1.5 0.0833333 0.0833333 6 2.5 2 0.776042 0.776042 7 2.5 2.5 0 0 8 2.5 3 -2.30729 -2.30729 9 2.5 3.5 -5.83333 -5.83333 10 2.5 4 -9.89063 -9.89062 11 2.5 4.5 -13.4167 -13.4167 12 2.5 5 -14.974 -14.974 13 2.5 5.5 -12.75 -12.75 14 2.5 6 -4.55729 -4.55729 15 2.5 6.5 12.1667 12.1667 16 2.5 7 40.3594 40.3594 17 2.5 7.5 83.3333 83.3333 18 2.5 8 144.776 144.776 19 2.5 8.5 228.75 228.75 20 2.5 9 339.693 339.693 21 2.5 9.5 482.417 482.417 22 2.5 10 662.109 662.109 23 2.5 10.5 884.333 884.333 24 2.5 11 1155.03 1155.03 TEST10: HERMITE_CUBIC_SPLINE_INTEGRAL integrates a Hermite cubic spline over the definition interval [X1,XNN]. If the subintervals are equally spaced, the derivative information has no effect on the result, except for the first and last values, DN(1) and DN(NN). Exact Computed X1 XNN Integral Integral Comment 0 3.14159 2 1.99997 Equal spacing, correct DN 0 3.14159 2 1.99997 Equal spacing, DN(2:N-1) random 0 3.14159 2 7.08569 Equal spacing, DN(1:N) random 0 3.14159 2 1.99935 Variable spacing, correct DN 0 3.14159 2 1.2796 Variable spacing, a single internal DN randomized. TEST11: HERMITE_CUBIC_LAGRANGE_VALUE evaluates the four Lagrange basis functions associated with F1, D1, F2 and D2 such that P(X) = F1 * LF1(X) + D1 * LD1(X) + F2 * LF2(X) + D2 * LD2(X). The first, second and third derivatives of these four Lagrange basis functions are also computed. The Lagrange basis functions: I X LF1 LD1 LF2 LD2 0 0 -4 -4 5 -2 1 0.25 -1.53125 -2.29688 2.53125 -0.984375 2 0.5 0 -1.125 1 -0.375 3 0.75 0.78125 -0.390625 0.21875 -0.078125 4 1 1 0 0 -0 5 1.25 0.84375 0.140625 0.15625 -0.046875 6 1.5 0.5 0.125 0.5 -0.125 7 1.75 0.15625 0.046875 0.84375 -0.140625 8 2 0 0 1 0 9 2.25 0.21875 0.078125 0.78125 0.390625 10 2.5 1 0.375 0 1.125 The derivative of the Lagrange basis functions: I X LF1 LD1 LF2 LD2 0 0 12 8 -12 5 1 0.25 7.875 5.6875 -7.875 3.1875 2 0.5 4.5 3.75 -4.5 1.75 3 0.75 1.875 2.1875 -1.875 0.6875 4 1 -0 1 0 -0 5 1.25 -1.125 0.1875 1.125 -0.3125 6 1.5 -1.5 -0.25 1.5 -0.25 7 1.75 -1.125 -0.3125 1.125 0.1875 8 2 0 0 0 1 9 2.25 1.875 0.6875 -1.875 2.1875 10 2.5 4.5 1.75 -4.5 3.75 TEST12: HERMITE_CUBIC_LAGRANGE_INTEGRAL returns the integrals of the four Lagrange basis functions associated with F1, D1, F2 and D2 such that P(X) = F1 * LF1(X) + D1 * LD1(X) + F2 * LF2(X) + D2 * LD2(X). The Lagrange basis function integrals: X1 X2 LF1 LD1 LF2 LD2 -6 1 3.5 4.08333 3.5 -4.08333 -5 1 3 3 3 -3 -4 1 2.5 2.08333 2.5 -2.08333 -3 1 2 1.33333 2 -1.33333 -2 1 1.5 0.75 1.5 -0.75 -1 1 1 0.333333 1 -0.333333 0 1 0.5 0.0833333 0.5 -0.0833333 1 1 0 0 0 -0 2 1 -0.5 0.0833333 -0.5 -0.0833333 TEST13: HERMITE_CUBIC_LAGRANGE_INTEGRATE integrates a Hermite cubic Lagrange polynomial from A to B. Compute each result TWICE: First row computed using HERMITE_CUBIC_INTEGRATE. Second row computed using HERMITE_CUBIC_LAGRANGE_INTEGRATE. A B LF1 LD1 LF2 LD2 -1 -3 -1.7 5.93333 -0.3 1.06667 -1.7 5.93333 -0.3 1.06667 -1 -2 -0.9225 2.00417 -0.0775 0.270833 -0.9225 2.00417 -0.0775 0.270833 -1 -1 0 0 0 0 0 0 0 0 -1 0 0.9895 -0.569167 0.0105 -0.0358333 0.9895 -0.569167 0.0105 -0.0358333 -1 1 1.98 -0.133333 0.02 -0.0666667 1.98 -0.133333 0.02 -0.0666667 -1 2 2.9175 0.9375 0.0825 -0.2625 2.9175 0.9375 0.0825 -0.2625 -1 3 3.76 2.33333 0.24 -0.733333 3.76 2.33333 0.24 -0.733333 -1 4 4.4775 3.80417 0.5225 -1.52917 4.4775 3.80417 0.5225 -1.52917 -1 5 5.052 5.16 0.948 -2.64 5.052 5.16 0.948 -2.64 -1 6 5.4775 6.27083 1.5225 -3.99583 5.4775 6.27083 1.5225 -3.99583 -1 7 5.76 7.06667 2.24 -5.46667 5.76 7.06667 2.24 -5.46667 -1 8 5.9175 7.5375 3.0825 -6.8625 5.9175 7.5375 3.0825 -6.8625 -1 9 5.98 7.73333 4.02 -7.93333 5.98 7.73333 4.02 -7.93333 -1 10 5.9895 7.76417 5.0105 -8.36917 5.9895 7.76417 5.0105 -8.36917 -1 11 6 7.8 6 -7.8 6 7.8 6 -7.8 -1 12 6.0775 8.07083 6.9225 -5.79583 6.0775 8.07083 6.9225 -5.79583 TEST14: HERMITE_CUBIC_SPLINE_QUAD_RULE returns a quadrature rule for Hermite cubic splines. Case 1: Random spacing I J X W Q 0 0 0.218418 0.478159 0.478159 0 1 1.17474 0.892913 0.892913 0 2 2.00425 0.695602 0.695602 0 3 2.56594 0.488501 0.488501 0 4 2.98125 0.240713 0.240713 0 5 3.04737 0.161848 0.161848 0 6 3.30494 0.183767 0.183767 0 7 3.4149 0.0768929 0.0768929 0 8 3.45873 0.338897 0.338897 0 9 4.0927 0.347846 0.347846 0 10 4.15442 0.0308636 0.0308636 1 0 0.218418 0.0762119 0.0762119 1 1 1.17474 -0.0188715 -0.0188715 1 2 2.00425 -0.0310486 -0.0310486 1 3 2.56594 -0.0119185 -0.0119185 1 4 2.98125 -0.014009 -0.014009 1 5 3.04737 0.00516455 0.00516455 1 6 3.30494 -0.00452132 -0.00452132 1 7 3.4149 -0.00084746 -0.00084746 1 8 3.45873 0.0333326 0.0333326 1 9 4.0927 -0.0331752 -0.0331752 1 10 4.15442 -0.000317521 -0.000317521 Case 2: Uniform spacing F(2:N-1) have equal weight. D(2:N-1) have zero weight. I J X W Q 0 0 0.5 0.025 0.025 0 1 0.55 0.05 0.05 0 2 0.6 0.05 0.05 0 3 0.65 0.05 0.05 0 4 0.7 0.05 0.05 0 5 0.75 0.05 0.05 0 6 0.8 0.05 0.05 0 7 0.85 0.05 0.05 0 8 0.9 0.05 0.05 0 9 0.95 0.05 0.05 0 10 1 0.025 0.025 1 0 0.5 0.000208333 0.000208333 1 1 0.55 -8.94467e-19 -9.25186e-19 1 2 0.6 8.94467e-19 9.25186e-19 1 3 0.65 -8.94467e-19 -9.25186e-19 1 4 0.7 8.94467e-19 9.25186e-19 1 5 0.75 0 0 1 6 0.8 -8.94467e-19 -9.25186e-19 1 7 0.85 8.94467e-19 9.25186e-19 1 8 0.9 -8.94467e-19 -9.25186e-19 1 9 0.95 8.94467e-19 9.25186e-19 1 10 1 -0.000208333 -0.000208333 TEST15: HERMITE_CUBIC_SPLINE_QUAD_RULE returns a quadrature rule for Hermite cubic splines. Random spacing Number of points N = 11 Interval = [0.218418, 4.15442] Q = -6.75338 Q (exact) = -6.75338 HERMITE_CUBIC_PRB Normal end of execution. 01 May 2011 11:28:16 AM