Ngax 0 and Ny
So FXCNminS.TXz0 then
20 SO all the Subnormals work
and f YE Nmax S T 420 so so all finite numbers
Copyright By PowCoder代写 加微信 powcoder
So, all non-negative values of a work. The only values that don’t work are when a=00 Because
And when a is nan the result will also be nan. So all values that are non-negative besides nan aEndgan
that are positive will However 840 Nan
yield go O
T RRs CR tra
if Rio and R2 to
tO FÉFife’sO
Nan F g to 0
Wha R R2 O
When Rio and Rato it will deliver the corretresu and when Rito and Raso it will deliver the corret Peso
However when Rereo nan to so it is NOT correct
Yes, based on the graph, I see that the discretization error for larger values of h now decrees for O(h!). Looking at the right side of the graph, we see values for when h is larger(which is where discretization could occur). We also see that the error for O(h!) is decreasing by a factor of 100 each time h decreases by a factor of 10 until h=10″#. With the original graph in red, we see that each time h changes by a factor of 10, when h is greater than 10″$, the error changes by a factor of 10. As stated above O(h!) changes by factor 100 for this discretization error.
The original best value for h was around 10″$, with an error about 10″% and now the best value for h using the center difference quotient is 10″# &'(h )* error about 10″&& . Certainly, h=10″# is greater than h = 10″$.
3(5 + h) = 3(5) + 3′(5) ∗ h + (3”(8) ∗ (h!)/2) then (for some z between x and x+h) ;((*+,)”((*)< − 3'(5) = ;,< 3′′(8) so, the error is O(h) Let this be referred to as 1
For the center difference quotient,
((*+,)"((*",) − 3'(5) = .,!/ (3'''(8) + 3'''(?)) for some z and y between [x-h, x+h]
Then the error will be Let this be referred to as 2
Now, when h decreases, we expect the error of 1 to decrease by a factor of h (in this case 10) and we expect the error of 2 to decrease by a factor of (h!) (in this case 100). When h is small the rounding error will dominate, and the error will not be decreasing. However, we see 1’s error decreasing faster than 2’s error. Since the error of 2 is being squared, the smaller numbers of h will be affected even more so by the rounding error when the value is squared. However, we see that as h gets larger and close to h=1, the error for 2 starts to decrease more than 1 and this is because 2 is not affected as much by the discretization error. In addition, since the error for 2 is being squared, the larger numbers of h will be squared making it smaller, giving a more optimal result. Now, when h = 10"$ 0(h)= 10"$. This is optimal for 1 because it is not being dominated by rounding or discretization error. When h = 10"# we see ((10"#)^2/12) which is about 10"&&.
IFCK I fax f'd
so no matter the X the condition number will always be 1 Thus it will never be in conditioned
IF KAI KI Ifex
X is close to to 1a lol will be small So Ha will be large and 00 when 9 10
X is close to to it will be ill conditioned
F'CHI sinct
SO whenever x is an odd multiple of of the problem will be ill
kpa tsineal IN Osca
OSCE 11 1 00
conditioned
for example
EE 33 53 3
If'cx Nt If CADI
Kray Into log x
I 110Tholog ex Ogex
SO if x is very close to 1 then log ex will be very small so I will be very large Chd oo when ya
ill conditioned
intologex I
ICA Krakatoa E I
84 1 foil I
FCI It II I
When X getX 1 x I
lets take Xi 1.00000005
2 FCx go fax
961.0000005
1000000051 1
1 00000005 1
I 2.0000000488 I 2 00000005
this was computed in double
so we see that when X is close to 1 gas It becomes
Unstable This due to the fact that gex has unnecessary subtract resulting in cancelation
If'mHI9AlICHCA xx Iggy A1 XD
kgext 11 1 1 pH 19411
if Al Igel
gas is well conditioned everywhere besides I
since get YI is unstable we end up losing digits
we expect to lose no digits when x 1
or wth x is close to 1
I log C's E
X=-5 X=-7 X=-9 X=-20
0.0067379 9.1188197e-04
1.2340980e-04 2.0611537e-09
0.00673842 9.0884266e-04
1.4435990e-04 -2.7566755
Algo 2(new one )
0.00674438 8.5449219e-04
7.3242188e-04 -16
The new method is certainly worse!
For the first version of this algorithm, we are getting cancelation as the loop continues because the numbers are getting closer together. While we are getting cancelation, it is not effecting the answer as much as the second method. With the second method we are summing all the numbers up separately first, with no cancelation during the loop. However, when we sum all of the numbers together we are ignoring the smaller numbers for each positive and negative case because of the rounding. As a result, we have lost information that is need for the problem since the answer will be a small decimal. Finally, when we (subtract/add) these two numbers we are getting cancelation as well because these numbers are very similar, but these numbers that we are subtracting are already off from the true value because of the all the rounding that has occurred during the loop. As seen by the graph above for x=-20 we rounded so much that the result was -16 when the actual answer 2.0611537e-09.
{THIS IS THE LINE THAT WAS CUT OFF}
fprintf('n = %d,postive= %g, negative= %g, diff=%g, term = %g, newsum = %g\n', n,positive_terms,negative_terms,positive_terms+negative_terms,term,newsum);
Kfc b I e'd 10 b e'o
I fall IN Ifa
le on Lex 11
if there is no the answer
rounding aprox is 2.17 10 7 which
very close to 0
SO we expect to lose o digits by rule of thumb So
ruleof thumb 16 logCi 16
we should have to accurate digits for double and accurate digits for single
1 0000005 00000 167 10 6 x teeny t 4,1 tix4
Fox1 Io 10 b
10 t510 t1.51019
I 10b t 0 00 00054106 00 00 0 0 0000000 189106
I 1 000 0005 00000 16F X10 SO if we found our taylor series to
1 000 0005 00000 16 7 X10
we see that we have 18accurate digits
Xt E tf t Ey
10 0 t 10 18
1 0000004994 62184 10
1.00000 1000000 500 I6
in order to figure out how many digits are correct lets look at log creterr
109 1 0000004994 62184 10 t 1 000000500000167 10 1 000000500000167 10 0
This means we have about to correct digits
The reason why this happens is because of cancellation
1 00000 1000 000 500 1 0.00000 1000 000 500
when we normalize we are losing about 6 digits because we have to shift f times once we get cancellation we also
have problems with rounding and converting decimal to binary
Thus we have to correct dig its snowing that it is not complete
stable since we are missing 6 digits of accuracyhere
Yes it does.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com