Harj. 11 av

194.02 HA

1.

> geodeesi:=proc(leveys1,pituus1,leveys2,pituus2)
local phi1,phi2,Theta1,Theta2,R,cosalpha;
R:=6370;
phi1:=90-leveys1; phi2:=90-leveys2;
phi1:=phi1/180*Pi;phi2:=phi2/180*Pi;
Theta1:=pituus1/180*Pi;Theta2:=pituus2/180*Pi;
cosalpha:=sin(phi1)*sin(phi2)*cos(Theta1)*cos(Theta2)+sin(phi1)*sin(phi2)*sin(Theta1)*sin(Theta2)+cos(phi1)*cos(phi2);
R*arccos(evalf(cosalpha));
end:

> evalf(geodeesi(60,25,35,140));

7906.603231

cosalpha:n lauseketta voidaan hiukan sieventää. (Helppo nähdä ja tehdä käsin, Maplenkin saa tekemään, kunhan tietää, mihin pyrkii.

> cosalpha:=sin(phi1)*sin(phi2)*cos(Theta1)*cos(Theta2)+sin(phi1)*sin(phi2)*sin(Theta1)*sin(Theta2)+cos(phi1)*cos(phi2);

cosalpha := sin(phi1)*sin(phi2)*cos(Theta1)*cos(The...

> cosalpha:=factor(sin(phi1)*sin(phi2)*cos(Theta1)*cos(Theta2)+sin(phi1)*sin(phi2)*sin(Theta1)*sin(Theta2))+cos(phi1)*cos(phi2);

cosalpha := sin(phi1)*sin(phi2)*(cos(Theta1)*cos(Th...

> osa:=combine((cos(Theta1)*cos(Theta2)+sin(Theta1)*sin(Theta2)));

osa := cos(Theta1-Theta2)

> cosalpha:=sin(phi1)*sin(phi2)*osa+cos(phi1)*cos(phi2);

cosalpha := sin(phi1)*sin(phi2)*cos(Theta1-Theta2)+...

Onhan tämä sievempi, tehdään:

> sievageodeesi:=proc(leveys1,pituus1,leveys2,pituus2)
local phi1,phi2,Theta1,Theta2,R,cosalpha;
R:=6370;
phi1:=90-leveys1; phi2:=90-leveys2;
phi1:=phi1/180*Pi;phi2:=phi2/180*Pi;
Theta1:=pituus1/180*Pi;Theta2:=pituus2/180*Pi;
cosalpha:=sin(phi1)*sin(phi2)*cos(Theta1-Theta2)+cos(phi1)*cos(phi2);
R*arccos(evalf(cosalpha));
end:

> evalf(sievageodeesi(60,25,35,140));

7906.603231

Ei siinä yksikääm numero muuttunut.

2.

> restart:with(linalg):

Warning, the name changecoords has been redefined

Warning, the protected names norm and trace have been redefined and unprotected

> r:=[R*sin(phi)*cos(Theta),R*sin(phi)*sin(Theta),R*cos(phi)];

r := [R*sin(phi)*cos(Theta), R*sin(phi)*sin(Theta),...

> rt:=map(diff,r,Theta);

rt := [-R*sin(phi)*sin(Theta), R*sin(phi)*cos(Theta...

> rphi:=map(diff,r,phi);

rphi := [R*cos(phi)*cos(Theta), R*cos(phi)*sin(Thet...

> rtxrphi:=crossprod(rt,rphi);

rtxrphi := vector([-R^2*sin(phi)^2*cos(Theta), -R^2...

> norm(rtxrphi,2)^2; simplify(%,symbolic);

abs(R^2*sin(phi)^2*cos(Theta))^2+abs(R^2*sin(phi)^2...

-R^4*(-1+cos(phi)^2)

> dS:=R^2*sin(phi)*da;

dS := R^2*sin(phi)*da

> suhde:=Int(sin(phi),phi=0..Pi/6)/Int(sin(phi),phi=0..Pi);value(suhde);evalf(%);

suhde := Int(sin(phi),phi = 0 .. 1/6*Pi)/Int(sin(ph...

-1/4*sqrt(3)+1/2

.669872980e-1

> noin,6.7,"%";

noin, 6.7,

3.

Käsin laskun tulos:

> sqrt(2)*Int(2*cos(Theta)^2+1,Theta=0..2*Pi): %=value(%);

sqrt(2)*Int(2*cos(Theta)^2+1,Theta = 0 .. 2*Pi) = 4...

Lasketaan Maplella:

> restart: with(plots): with(linalg):setoptions3d(axes=boxed,orientation=[-30,50]):F:=[x^2,y^2,z^2];

Warning, the name changecoords has been redefined

Warning, the protected names norm and trace have been redefined and unprotected

F := [x^2, y^2, z^2]

> R:=[sqrt(2)*cos(Theta),sqrt(2)*sin(Theta),z];

R := [sqrt(2)*cos(Theta), sqrt(2)*sin(Theta), z]

> plot3d(R,z=0..1,Theta=0..2*Pi); # Johan lieriö osataan, vaikka unissa.

[Maple Plot]

> rT:=map(diff,R,Theta);
rz:=map(diff,R,z);

rT := [-sqrt(2)*sin(Theta), sqrt(2)*cos(Theta), 0]

rz := [0, 0, 1]

> N:=crossprod(rT,rz);

N := vector([sqrt(2)*cos(Theta), sqrt(2)*sin(Theta)...

> norm(N,2)^2;simplify(%,symbolic);normi:=sqrt(2);

2*abs(cos(Theta))^2+2*abs(sin(Theta))^2

2*cos(Theta)^2+2*sin(Theta)^2

normi := sqrt(2)

> f:=x^2+1;

f := x^2+1

> [sqrt(2)*cos(Theta),sqrt(2)*sin(Theta),z];

[sqrt(2)*cos(Theta), sqrt(2)*sin(Theta), z]

> intf:=normi*subs(x=sqrt(2)*cos(Theta),y=sqrt(2)*sin(Theta),f);

intf := sqrt(2)*(2*cos(Theta)^2+1)

> Int(Int(intf,z=0..1),Theta=0..2*Pi);
tulos:=value(%);

Int(Int(sqrt(2)*(2*cos(Theta)^2+1),z = 0 .. 1),Thet...

tulos := 4*Pi*sqrt(2)

>

4 (kts. harj11lv teht. 2)

5. Kts. harj11lv teht. 5 AV