bn9

bn9

  • NA
  • 24
  • 0

Integration Program

Mar 17 2004 12:12 AM
Hello fellas... ok, i am officially stuck and getting nowhere fast. i am new to c# and programming in general and i have this program to write. Integrating a given function, and then using rectangluar and trapezodial integration to estimate the value (with the formulas below). CAN someone, anyone PLEASE help me?? it would be much oblidged. Rectangular Integration with Backward Differences: If the width of a single sample is T, then the area of a rectangle at point n is T times xn. If writen Yn = Yn-1 + T*Xn then we can approximate y as a succession of rectangular areas like this For trapezoidal integration divide the function into trapezoids spaced at the sample intervals. The area of a single trapezoid can be found by taking the average of the two ordinates and multiplying it by the width, T. The relevant equation is: Yn = Yn-1 + T (( Xn + Xn-1) / (2)) integrate the following polynomial over the interval 0 to 10: f(x) = x^4 - 2x^3 -12x^2 + 3x + 40 Use a sample width of 0.01. use both rectangular and trapezoidal integration and compare it to the true value for the integral over the same period. the program should print the following: This program integrates f(x) = x^4 - 2x^3 -12x^2 + 3x + 40 over the interval 0 to 5 using rectangular and trapezoidal integration. The true value of the integral is xx.xxxxxx Using rectangular integration the integral value is yy.yyyyyy Using trapezoidal integration the integral value is zz.zzzzzzz