Harj. 12 LV

Tämä on nyt ehdottomasti viimeinen s. 2001

1.

> restart: with(inttrans): alias(u=Heaviside):

Warning, the name changecoords has been redefined

> f:=x->alpha*exp(-alpha*x);

f := proc (x) options operator, arrow; alpha*exp(-a...

> assume(alpha>0):int(f(x),x=0..infinity);

1

> plot(subs(alpha=2,u(x)*f(x)),x=-1..4,axes=box);

[Maple Plot]

> mu:=int(x*f(x),x=0..infinity);

mu := 1/alpha
mu := 1/alpha

> sigma^2=int((x-mu)^2*f(x),x=0..infinity);

sigma^2 = 1/(alpha^2)
sigma^2 = 1/(alpha^2)

Huom! Yllä olevat integraalit voidaan nähdä myös Laplace-muunnoksina:

> restart: with(inttrans): mu=alpha*laplace(t,t,alpha);

Warning, the name changecoords has been redefined

mu = 1/alpha

> sigma^2=alpha*laplace((t-mu)^2,t,alpha);subs(mu = 1/alpha,%);

sigma^2 = alpha*(2*1/(alpha^3)-2*mu/(alpha^2)+mu^2/...

sigma^2 = 1/(alpha^2)

2.

> restart: with(inttrans): alias(u=Heaviside):with(plots):with(plottools):

Warning, the name changecoords has been redefined

> f:=x->alpha*exp(-alpha*x);

f := proc (x) options operator, arrow; alpha*exp(-a...

> F:=unapply(int(f(t),t=0..x),x);

F := proc (x) options operator, arrow; -exp(-alpha*...

> alpha:=1/2000:

> 1-F(3000);evalf(%);

exp(-3/2)

.2231301601

> display(plot(f(t),t=0..3000),plot(f,3000..8000,filled=true,color=yellow));

[Maple Plot]

> x0:=3000:

> display(plot(F,0..8000),line([0,F(x0)],[x0,F(x0)]),line([x0,0],[x0,F(x0)]));

[Maple Plot]

>

3.

> restart; with(plots):

Warning, the name changecoords has been redefined

> F:=x->Phi((x-mu)/sigma);

F := proc (x) options operator, arrow; Phi((x-mu)/s...

> Phi:=x->1/2+1/2*erf(x/sqrt(2));

Phi := proc (x) options operator, arrow; 1/2+1/2*er...

> mu:=10: sigma:=0.02:

a)

> F(9.97);evalf(%);

1/2-1/2*erf(.7500000000*sqrt(2))

.668072012e-1

b)

> 1-F(10.05): evalf(%);

.62096654e-2

c)

> (1-F(10.03))+F(9.97): evalf(%);

.1336144025

>

>

4.

(d)

> g:=1-(F(mu+c)-F(mu-c))-0.05;

g := .9500000000-erf(25.00000000*c*sqrt(2))

> plot(g,c=sigma..3*sigma);

[Maple Plot]

> cc:=fsolve(g=0,c=0.04);

cc := .3919927969e-1

> vali:=mu-cc,mu+cc;

vali := 9.960800720, 10.03919928

e) Muutetaan odotusarvoa: Kaksi mahdollista tapaa ajatella: 1) Tarkastellaan koko ajan väliä

> ['mu' -c, 'mu'+c];

[mu-c, mu+c]

2) Pidetään kohdassa d) saatu väli [9.960800720, 10.03919928] kiinteänä ja muutetaan keskiarvoa mu (hiukan). Tämä liittyy paremmin "elävään elämään".

Tapauksess 1) kysymystä voidaan enemmän pitää "kompakysymyksenä": Tapauksessa 2) on kylläkin epärealistista muuttaa keskiarvoa noin paljon.

Järkevämpi muutos olisi mu=10.01. (Tällä arvolla laskin taululla.)

> mu:=10.1:g:=1-(F(mu+c)-F(mu-c))-0.05;

g := .9500000000-erf(25.00000000*c*sqrt(2))

> fsolve(g=0,c=0.04);

.3919927969e-1

Muutetaan oikein kunnolla.

> mu:=100:g:=1-(F(mu+c)-F(mu-c))-0.05;fsolve(g=0,c=0.04);

g := .9500000000-erf(25.00000000*c*sqrt(2))

.3919927969e-1

Tulos on riippumaton mu :stä tietenkin:

> restart: F:=x->Phi((x-mu)/sigma);

Warning, the name changecoords has been redefined

F := proc (x) options operator, arrow; Phi((x-mu)/s...

> F(mu-c),F(mu+c);

Phi(-c/sigma), Phi(c/sigma)

> P("hylätään")=1-(F(mu+c)-F(mu-c));

P(

Tulos ei tosiaankaan riipu mu :stä.

Sievenee vielä hiukan:

> P("hylätään")=1-2*Phi(c/sigma);

P(

Muistetaan: (Ylimääräinen harjoitustehtävä)

> Phi(-x)=1-Phi(x);

Phi(-x) = 1-Phi(x)

Tapaus e 2)

> vali;

9.960800720, 10.03919928

> mu:=10.01;

mu := 10.01

> P("hylätään")=1-(F(vali[2])-F(vali[1]));evalf(%);

P(

P(

Siis hylkäysprosentiksi tuli n. 8 % (d)-kohdan 5%:n sijasta.