![]() |
Prev | Next |
exp_eps(
x,
epsilon)
with x is equal to .5
and epsilon is equal to .2.
For this case,
the mathematical form for the operation sequence
corresponding to the exp_eps
is
\[
f( x , \varepsilon ) = 1 + x + x^2 / 2
\]
Note that, for these particular values of x and epsilon,
this is the same as the mathematical form for
exp_2
.
Index |
| Code |
| Operation |
| Zero Order |
1 |
|
abs_x = x;
|
v_1 = x
|
v_1^{(0)} = 0.5
| ||
2 |
|
temp = term * abs_x;
|
v_2 = 1 * v_1
|
v_2^{(0)} = 0.5
| ||
3 |
|
term = temp / Type(k);
|
v_3 = v_2 / 1
|
v_3^{(0)} = 0.5
| ||
4 |
|
sum = sum + term;
|
v_4 = 1 + v_3
|
v_4^{(0)} = 1.5
| ||
5 |
|
temp = term * abs_x;
|
v_5 = v_3 * v_1
|
v_5^{(0)} = 0.25
| ||
6 |
|
term = temp / Type(k);
|
v_6 = v_5 / 2
|
v_6^{(0)} = 0.125
| ||
7 |
|
sum = sum + term;
|
v_7 = v_4 + v_6
|
v_7^{(0)} = 1.625
|
\[
1.625 =
v_7^{(0)} =
f ( x^{(0)} , \varepsilon^{(0)} )
\]
if( Type(0) > x )
while(term > epsilon)
This in turn would result in a different operation sequence.
Thus the operation sequence above only corresponds to
exp_eps.hpp
for values of x and epsilon within a certain range.
Note that there is a neighborhood
of
x = 0.5
for which the comparisons would have the
same result and hence the operation sequence would be the same.
x^{(0)} = .1
,
what is the result of a zero order forward sweep for
the operation sequence above;
i.e., what are the corresponding values for
v_1^{(0)} , v_2^{(0)} , \ldots , v_7^{(0)}
.