Treść książki

Przejdź do opcji czytnikaPrzejdź do nawigacjiPrzejdź do informacjiPrzejdź do stopki
TheequivalenceofbothformulaemaybealsoconfirmedbymeansofthefollowingMATLABscript:
%PROPAGATIONOFRELATIVEERRORS
%EQUIVALENCEOFTWOFORMULAE
symsxyf(x)
y=f(x);fprintf('y=%s\n',y)
T1=x/y*diff(y,x);%firstformula
fprintf('x/y*dy/dx=%s\n',T1);
T2=diff(log(y),x)/diff(log(x),x);%secondformula
fprintf('d(ln(y)/d(ln(x))=%s\n',T2);
y=f(x)
x/y*dy/dx=(x*diff(f(x),x))/f(x)
d(ln(y)/d(ln(x))=(x*diff(f(x),x))/f(x)
Problem1.2:Assesstherelativeerrorofcomputing:
y
±
sin
2
()
x
for
x
E
f
L
π
4
,
π
4
1
J
causedbyarelativeerrorcorruptingxtheerrorwhosemagnitudedoesnotexceed0.1%.
Solution:Thecoefficientoferrorpropagationis:
Tx
()
±
dyx
dxy
|
±
2sin
()
x
cos
()
x
sin
2
x
()
x
±
2cos
()
x
sin
x
()
x
Since
sup
{
Txx
()
E
f
L
π
4
,
π
4
1
J
}
±
2,
themagnitudeoftheerrorpropagatedfromxtoydoesnotexceed0.2%:
δ
[]
y
~
±
Tx
()
δ
[]
x
~
Ś|
20.1%
±
0.2%
ThisresulthasbeenconfirmedbymeansofthefollowingMATLABscript:
%PROPAGATIONOFRELATIVEERRORS
%THROUGHOUTTHEFUNCTIONy=sin(x)^2
%BYMEANSOFSTATISTICALSIMULATION
f=@(x)sin(x).^2;%analysedfunction
N=100;%numberofdiscretevaluesofx
R=500;%numberofrandomtrials(foreachvalueofx)
x=linspace(-pi/4,pi/4,N);
%error-freevaluesofx
x_err=x.*(1+rand(R,N)*0.002-0.001);
%error-corruptedvaluesofx
y=f(x);
%error-freevaluesofy
y_err=f(x_err);
%error-corruptedvaluesofy
dy=abs((y_err-y)./y);%magnitudeofrelativeerrorsiny
figure(1);plot(x,dy,'.')
xlabel('x');ylabel('magnitudeofrelativeerrorsiny')
axis([-0.8,0.8,0,2.5e-3]);
10-3
2.5
2
1.5
1
0.5
0
-0.8
-0.6
-0.4
-0.2
0
x
0.2
0.4
0.6
0.8
Problem1.3:Determinethefunctions
Tx
()
=
δ
[][]
y
~
δ
x
~
,
characterisingthepropagationoftherelative
errorsinthedata,forthefollowingformulae:
(a)
y
±
sinx
x
()
for
x
E
[
0,4
π
]
,
(b)
y
±
1
1
++
+
xx
xx
2
2
+
x
x
3
3
for
xE
[
0,3.
]
FindanumericalestimateofT(x):
Tx
ˆ
()
-
±
1000
yy
~
y
-
-
where
y
-
±
yx
()
-and
y
~
±
yx
()
~with
xx
~
=
-
(
1
+
8
)
.
Solution(a):Thecoefficient
Txinthiscaseis:
()
Tx
()
±
yx
()
x
dyx
dx
()
±
sin
x
()
2
x
|
cos
()
xx
|
x
2
sin
()
x
±
cos
()
xx
sin
|
()
x
sin
()
x
±
tan
x
()
x
1
14