Approximating Complicated Functions in Physics Engines
Question one.
- Obtain Taylor polynomial
Of the function f(x)= 0.5
Now formulating the values of various degrees of differentiation of the function you have the table below. . (Kreyszig, 2011)
function |
derivative |
Derivative at a=0 |
f(x) |
0.5 |
0.5 |
1 |
||
2 |
2 |
|
4 |
4 |
|
8 |
8 |
|
16 |
16 |
|
32 |
32 |
Now expressing the tailor’s formula as
f(a) + + + +
This translates into
+2/3
2/15 x^5
This is the Taylor’s polynomial
- Now using it to estimate the value f(0.2)
We replace x with the value 0.2 in the polynomial above
To obtain the equation
+2/3
2/15 *0.2^5 and computing by use of a calculator we obtain the value 0.74590930 as the estimated value to find the upper bound here, we make use of the remainder theorem. Error is because of remaining part the polynomial that was cut off to remain with degree 5 polynomials. Lagrange formula for the remainder if given by
Getting the error upper bound we use the Taylor’s absolute value of the remainder as given by the formula
Taking the maximum value of the function I an increasing function is
In this case, minimum value of the function is 0. Thus, the true value of
(d) The actual value is 0.74591235
While the estimated value is 0.74590930
The actual error is therefore 0.00000305
Therefore, the magnitude of the upper error is greater than the magnitude of the actual error.
Question two
- From the spreadsheets 8515625
- From the spreadsheets, maximum error is 0.015625
- As per the spreadsheets, the number of iteration needed are 13.
The equation’s zero is 1.852669557 when fixed point iteration scheme is applied, while the zero of the given equation is 1.854678248 when we apply the use of the Newton Raphson method. . (Kreyszig, 2011)
- The table below indicate the different between the approximated values and the actual values obtained
Newton-Raphson method has the smallest difference between the exact value and the approximated value, after 5 iterations. That is -2E-09. Which is followed by fixed point scheme and the last one being the bisection method with the largest difference. Thus Newton-Raphson method has fastest convergence rate while bisection method has the slowest convergence rate.
Question 3 (Strang, 2006)
- Refer to the attached Excel
- To develop a homogeneous matrix, we add another coordinate (third one) to the existing coordinate. The third coordinate should not interfere with the points i.e., the new point become; where z is the added coordinate
leaves with no evidence pf interference by z.
- Homogeneous coordinated translation is generally given by the matrix
2D translation matrix that will slide the sailing boat 10 units to the left and 8 units up will be given by
when vectors are rotated clockwise the image will also rotate. With the form matrix of anticlockwise rotation given by (Strang, 2006): now that we have homogeneous form of the coordinates, 9anti-clockwise rotation will be achieved by
- we can combine the transformations at once by getting the product of matrices off various transformations but with keenness in observing the order of multiplication (Strang, 2006).
For instance, to get the final image in the above examples Let K be the single transformation matrix to transform the image through the two transformations while W be the homogeneous matrix. We have
With the final image, I am being obtained by
Question 4
- applying Simpson rule the area covered under the curve is given by
- When 12 subintervals are used, the distance covered by Mario in 1.2 second is 5.270833
- To find the exact integral of the function, we integrate f(x) with respect to x then evaluate using the given limits.
Comparing the values found in part a) and part b) with that calculated in part c). We note that the many the subinterval’s number the more the accurate the approximate value will be, with part b giving an answer that is almost equivalent to the answer calculated in part c). Hence the more the subintervals lead to faster convergence.
Question five. (Kreyszig, 2011)
- Using Lagrange’s interpolation polynomial of degree 2 to estimate f(0.9) at points
X |
0.7 |
1.0 |
1.5 |
F(x) |
-0.3567 |
0.0000 |
0.4055 |
Now we first calculate the Lagrange’s polynomial given by
Using the formula plus the values given in the table we can now calculate the various values of Lagrange’s polynomial and we find
This gives
Next we find
This gives
Now we find
Which gives
Now using the formula
Now we have the overall equation as
+ 0( + 0.4055(
=
Now estimating f(0.9)
We let the value of x in the Lagrange equation obtained above to be 0.9
Hence our value of
f(0.9)= =
Which gives the value 2.08025
xi |
fi |
f [xi, xj] |
f [xi, xj, xk ] |
f [xi, xj, xk, xl] |
|||||||||
x1 |
f1 |
||||||||||||
x2 |
f2 |
||||||||||||
|
|||||||||||||
x3 |
f3 |
|
|||||||||||
|
|||||||||||||
x4 |
f4 |
Now using the formulas given by the table and the data below
X |
0.5 |
0.7 |
1.0 |
1.5 |
fx |
-0.6931 |
-0.3567 |
0.0000 |
0.4055 |
xi |
fi |
f [xi, xj] |
f [xi, xj, xk ] |
f [xi, xj, xk, xl] |
0.5 |
-0.6931 |
|||
2.08025 |
||||
0.7 |
-0.3567 |
-1.7825 |
||
1.189 |
1.31 |
|||
1 |
0 |
-0.4725 |
||
0.811 |
||||
1.5 |
0.4044 |
Now to obtain newton divided difference interpolating polynomial of degree 3 we use the formula
F(x) = -0.6931+2.08025x-1.04125-1.7825+1.24775x+0.89125x-o.623875+1.31-2.882+2.0305x-0.4585
When the above equation is simplified we get
F(x)=1.31
Now estimating f(0.9) by use of the polynomial we replace the x in the equation by the value 0.9 . (Kreyszig, 2011)
And calculating by use of a calculator we get
0.090905
- given the function f(x) as ln(x)
Therefore to caculate the actual error
We find actual value= -0.10536
And the predicted value is 2.08025 as obtained in part a above
The actual error obtained by the use of lagranges equation is -0.10536-2.08025
This gives us the error as -2.18561 with a magnitude of 2.18561
In the 2nd polynomial obtained by use of the table, the estimated value 0.090905
Now the actual error becomes -0.10536-0.090905. Which gives -0.196265 with a magnitude of 0.196265
The increase in the degrees of polynomials has caused a reduction in the actual error obtained in the calculations. . (Kreyszig, 2011)
References
Kreyszig, E. (2011). Advanced Engineering Mathematics. New York: Wiley
Strang, G., (2006). Linear Algebra and Its Application. 4th edn. London: Brooks Cole