Question: Calculate the functions f(x) = (1 - x) 8 g(x) = 1 - 8x + 28x 2 - 56x 3 + 70x 4 - 56x

Calculate the functions

f(x) = (1 - x)8 g(x) = 1 - 8x + 28x2 - 56x3+ 70x4 - 56x5 + 28x6 - 8x7 + x8

for -0.01 x 0.01 in steps of 0.001. Calculate all powers using a loop:

t = x // t will be x^n

for i = 2 to n do t = t * x

Print out a table of values, with 4 columns: x, f(x), g(x), and f(x) - g(x). Do this twice, once with floats and once with doubles. Note that f(x) and g(x) are mathematically equivalent, but may differ numerically, due to round-off error.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!