JAVA programming: Design and construct a computer program in one of he ollowing
ID: 3745625 • Letter: J
Question
JAVA programming:
Design and construct a computer program in one of he ollowing anguages e g C C C# ava Pasca or Pv Be sure to follow the documentation and programming style policies of the Computer Science Department. on that will a trat ee ects round ng erors and truncation errors. The following is a plot of the function fx)- sinxx2 10 In order to illustrate the effects of the two major error sources, rounding and truncation, attempt to determine an approximation to the derivative of fx) at x-2.0 radians using the difference approximation given below. (The true answer is 4 +12 cos(S) or about 2.2539995942966376896). Use the formula: f(x) (f (x+h) -x) h with h-1, 0.5,0.25, 1.8189894035459e-12 i.e., keep halving h until it is less than 2.0e-12.) Print out the values of h, your approximation tofbx), and the error in the approximation for each value of h used. This error will include the effects of both truncation and rounding Write down (in your output file or in another file submitted with your program) any conclusions that you can make from these experimentsExplanation / Answer
Sample output
h Truncation error
0.5 0.4330201711177959
0.25 5.653340775253067
0.125 7.404618401727582
0.0625 4.32429066708621
0.03125 2.2225039611842097
0.015625 1.1147695457800997
0.0078125 0.556892153194362
0.00390625 0.27815741010889683
0.001953125 0.13898625934829356
0.0009765625 0.06946750999080864
0.00048828125 0.034727038236760155
0.000244140625 0.0173618010553942
0.0001220703125 0.008680466158275113
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.