Вы находитесь на странице: 1из 43

. . .

..


WEB

,
,
, . 48
,
, WEB-
. .. :
http://physics.herzen.spb.ru.

-
2009


. ..

: .- , . . (
. . . );
.- , . . ( )

82

. .

WEB-: . .: .
. . . , 2009. 72.


JavaScript, -

VML. . , ,
JavaScript
.
.

. ...

7473

ISBN 978-5-8064-1419-0

. ., 2009
- . . . , 2009


..

1. .....
1.1. ...
1.2. ..
1.3.
1.4.

2.
..
2.1. ..
2.2.
2.3. ...
2.4.
2.5.
3. VML
3.1. .
3.2.
3.3
3.4. ..
4.

4.1.
4.2.
4.3. ...

11

18

28

. .

35

..

43



. ,
,
.

,
(, ) : MathCAD, Pascal, C++, Delphi .

.
JavaScript, VML. JavaScript
web-. ,
- JavaScript
. , .
. ,
,
.
. WEB- ( ), WEB .
JavaScript : ,
, , , , , .
.
JavaScript, , , WEB-, - . JavaScript
.
4


JavaScript, JavaScript , ,
.
.
JavaScript (,
, . .)
,
.
, ,
.
, ,

. HTML WEB-.
,
, , . WEB-
,
. WEB- .
, .
, , ,
.
JavaScript.

,
. , , , ,
.
5

1.
, .

, .
, ,
.
, , . Java Script.
,
,
. , :
1.
Java Script.
2. ( )
( ..)
.
3. ( , , ).
, ,
, . . : ,
, ,
, ..
.
.
6

, JavaScript, <SCRIPT > </SCRIPT>,


<HEAD> </HEAD>,
<BODY> </BODY>,
.
HTML .
Form - JavaScript, ( ). HTML
(input, textarea), , (button, submit, reset, radio) (select).
, .
, HTML
, , .

1.1.

(.1), (x y).

. 1. WEB- .
7

.
.

.

1.2.

. x
(<input type=radio>)
.
x
(. . 2).

. 2. .

1.3.
y=f(x),
JavaScript, .
JavaScript,
8

, . 3.
y. -
, y,
. , .

. 3. Internet Explorer .
x x=3 x=10.

1.4.
,
. ,
, , ,
.
. , . HTML , , HTML , .
.
window.document.write(),
9

HTML , - .
window . ,
, .
, , . , new_win.document.write(),
new_win , .
new_win ,
window.
document.write(),
, HTML
( ) , HTML
(. 4), : =Z(1/m2 1/n2)1, m , n=m+1, m+2,, Z 91.127.

. 4. WEB 1.4.

, .
10

2.

.
dx/dt=vx , dvx/dt=ax=Fx/m
y z. Fx , .

. ,

t+t t:
x(t+t) = x(t) + vx (t)t ,
vx(t+t) = vx(t) + ax (t)t.
N ,
(N t).
,
x=x+vx*dt
vx=vx+ax*dt

(=) , : x x vx*dt. dt ,
, .

,
. , , .
(. 3), - , 11

. () JavaScript .
,
. JavaScript : setTimeout
setInterval . . , . setTimeout

2.1.
WEB-,
,
, .

. 5. WEB-, .

2.2.

,
, , , .
Y , X , XY. .

12

ax (t) = vx(t) , ay (t) = g vy(t) , .

. 6. Internet Explorer .

. ,
,
.

2.3.
N

dri N ( . )
mi
Fi Fi , j
,
dt
j 1
j i

i=1N. ( ) .
, . . :

1. ,
. . .
13



)
2. ( Fi (,

F
(ri r j ) ),
j
.
3. ( ).
,

.

,
.
.
, () .
.
, (
). .
.

2.4.
, ,
(. .7). .

. 7. Internet Explorer 2.3.



.
14

2.5.

. , ,
,
. , : , , , ,
.

d. ,

v1 v2 .
(. 8). n ( n 1 ), , ;
L , . 8.

. 8. .


,
n
L ,


v1 v1|| v1 (n v1 )n ( L v1 ) L


v2 v2|| v2 (n v2 )n ( L v2 ) L
,

n .

15

, ,

n (.. vi )
, vi| | , . , ,
;

v '1|| v2|| v '2|| v1|| , . ,


v '1 v2|| v1 (n v2 )n ( L v1 ) L


v '2 v1|| v2 (n v1 )n ( L v2 ) L


n
, L .

.
(x1, y1) (x2, y2). n =(nx, ny)
nx = (x2 x1)/d , ny= (y2 y1)/d ,
, (x1 x2)2+(y1 y2)2 = d2.
, . .
d. nx=x2 x1, ny=y2 y1,
nx2 + ny2=1, (xi, yi)
.
.

L = (ny, nx); , L n ,

( L n ) 0 , | L | 1. ,

v1x= nx(v2)n + ny(v1)L ,
v1y= ny(v2)n nx(v1)L ;
v2x= nx(v1)n + ny(v2)L ,
v2y= ny(v1)n nx(v2)L ;


(vi)n= (vi n ) = nx vix + ny viy , (vi)L= (vi L) = ny vix nx viy.

nx=x2-x1; ny=y2-y1;
if (nx*nx+ny*ny<=1)//-- -{
x1=x1-vx1*dt; y1=y1-vy1*dt;
x2=x2-vx2*dt; y2=y2-vy2*dt;
if (ny>0) {ny=Math.sqrt(1-nx*nx)} else {ny=-Math.sqrt(1-nx*nx)};
nv1=nx*vx1+ny*vy1; lv1=ny*vx1-nx*vy1;
nv2=nx*vx2+ny*vy2; lv2=ny*vx2-nx*vy2;
vx1=nx*nv2+ny*lv1; vy1=ny*nv2-nx*lv1;
vx2=nx*nv1+ny*lv2; vy2=ny*nv1-nx*lv2;
16

.
: (x1, y1), (vx1,vy1), (x2, y2), (vx2,vy2) . nx, ny ,
, 1; nv1, lv1 nv2, lv2
1 2 .
-

x1=x1-vx1*dt; y1=y1-vy1*dt;
x2=x2-vx2*dt; y2=y2-vy2*dt;

(
). , ,
, ..
nx*nx+ny*ny<=1.

. 9. Internet Explorer 2.4.


.
.

17

3. VML

,
.

Vector Markup Language (VML). VML
XML-, Microsoft
, Microsoft Internet Explorer 5.0 . VML , .
, VML,
,
JavaScript
VB Script. , VML , , JavaScript,
HTML. , .
, VML .
1. <HTML xmlns:v = "urn:schemas-microsoft-com:vml">
2. <HEAD>
3. <STYLE>v\:* {BEHAVIOR: url(#default#VML)}</STYLE>
4. </HEAD>
5. <BODY>
6. <h1></h1>
7. <v:line strokecolor="green" strokeweight="2px"
8. from="10 10" to="100 100"
9. style="position:absolute;Top:100;Left:100; "/>
10.</BODY> </HTML>

VML HTML WEB . VML, HTML


XML- VML. VML <v: ,
. ,
, <v:

18

Microsoft Internet Explorer VML ( default behavior).


line 7 ,
. 8 .
9 ,
,
Top:100; Left:100. , 8
. , :
<v:oval style='position:relative; left:3em; top:0; height:50px;
width:100px' strokecolor="red" strokeweight="2px" fillcolor="blue"/>

:
<v:polyline style='position:relative; left:10; top:20' fillcolor="blue"
strokecolor="red" strokeweight="2" points="0 0 20 20 40 0 60 20" />

. points.
VML. VML
write() . ,
.
VML ,
shape.
,
path
;
<v:shape id=fig1 coordorigin="0 0" coordsize="200 200"
fillcolor="green" strokecolor="red" style='visibility: visible;
position:relative; left:3em; top:100; width:50; height:50'>
<v:path v="m 2,2 l 2,300 l 200,300 l 300,150 l 200,2 x e"/>
</v:shape>.
path m ,
l , x e . path -

. )
WEB (, 19

); )

.

3.1.
,
x(t)=asin(1t); y(t)=bsin(2t+). 2 3 , . 10.

. 10. Internet Explorer 3.1.


2 3.

3.2.
y(t), , .

a(0)
y (t )
a(n) cos(nt ) b(n) sin( nt )
2
n 1
= 2 /T, a(n), b(n) ( )
T 2
T 2
2
2
a ( n)
y (t ) cos(nt )dt ; b(n)
y (t ) sin( nt )dt
T T 2
T T 2
.
, (.
20

. 11). , . ,

, .

. 11. Internet Explorer 3.2.


100 .

U ( ), .
, 2. ,
U ( ).
, t=0 .
, .. y(t)=y(t).
, b(n)=0. ()
2
2U
a(n) U cos(nt )dt
sin( n ) .
T
n

,
. 11.
.
,
, .

a(n)
b(n)

nb(n)
na(n)

b(n)/n
a(n)/n
21

, .

3.3.
, .. , , .
. ,
Z.
(. . 12).


q[v B] , q , v , B
. ,
Z,
: Fx=Avy Fy= Avx, A qBz , . , Fx=Avy bvx Fy= Avx, bvy , b .

. 12. ,

22

3.4.
.
, ,
. , . , - ,
.
. -
,
,
.
- ,

x(t), y(t), z(t)
t. t
, .
v (t ) (v x , v y , v z ) .
dx
dy
dz
v x , v y , v z ,
dt
dt
dt
.

. ,
, ,
.
,
.
, , ,
1 /.
,
,
n(x,y,z) , 23

dv 1

n v (n v )
dt n

,
,
. ,
,
(. 2.1).
, ,
.
. , ,
. , ( , ), , , -,
n , , -, . , ,
y n = n0 gy,
n0 = 1.0004, g = 210-5 1 , . ,
10 18 ,
n < 1.

(-) . .
,
, ,
, . .
, .

24

, ( ).
, (.13). n1, n2 . ( XY):

. 13. .

. 13 v1 v2 .
XY
(x x0)2 + (y y0)2 = r2
(x0, y0) , r . ,
,
(x(t), y(t)) .
(x x0)2 + (y y0)2 >r2,
v1 . , ,
.
.

N =(Nx, Ny).
, . ,
(x, y) ,
( y y0 )
( x x0 )
,
Nx
; Ny
r1
r1
(r1)2 = (x x0)2 + (y y0)2, r1 r,
( -
).
25

, , , .
, sin().
( ) v1 .
: |Nxv1x+Nyv1y|=cos(),

sin( )2 N v1 1 N x v1x N y v1y 2


, .

: sin()=(n1 n2)sin(). n1 n2 (. . 13).

v2 =(v2x, v2y).

: v2 vN v vN N v , , 14

( N ).

. 14. .

=(Ny, Nx), ,

N =(Nx, Ny).
.14 : |vN| = cos(), |v|=sin().
v2 .
14 , . , vN ,

N , v1 , v , v1 .
, v2 :
v2x= NxvN + Nyv
26

v2y=NyvN Nxv


,
(x, y).
, ,
. 15 WEB-, ,
, . WEB- , , (
. f).
.
(. f). R2 , R1 ,
d . y .

. 15. IE

27

4.

4.1.
. , - ,
. ,
,
- ,
.

,
.. ( ) -.
JavaScript
x=Math.random(). x
0 1, , ,
, . , (x) ((x) 1 0 < x < 1 0
x). ,
,
<SCRIPT language=JavaScript>
function my_1()
{
var x = Math.random();
document.my_Form.my_input.value = x;
}
</SCRIPT >
<FORM name=my_Form>
<INPUT onclick=my_1() type=button value=" " >
<INPUT type=num value=*** name=my_input>
</FORM>

28

,
,
. .
, . , , . , .
? , -
. x= <x>+x, x . .

4.2.
, , . . , :
1)
;
2)
( );
3) .
, : , , , ,
. - . . , , ..
.
, , 29

, , , .
,

(.16). () . , .
.

. 16. .


-.
<(rN)2>,
N. t.

<(rN)2>=da2N= da2(t/t)
d , a . - <(rN)2> (rN)2 , . (d=2, a=1) . 17.
,
. 30

, .

. 17.
.

4.3.
(. percolation)
. ,

. ,
.
,
, n, , (1n). . n .
, , . ,
,
np, . , ,
. np
N. ,
N, ,
31

np. .

0,5927.
, .
: np = .
. ,
, . . n ( )
. np (
) ,
.
n = np ( n ) . n
, ,
.
; P , , . ,
n 1 ( ). ( )
(nnp) np n > np
n np
P (n) P0
n
p

n np
np

P0

, >0.

L():

L( ) L0 | | ,
() >0:

Z ( ) Z 0 t ,
>0, t>0.
32

, , , ;
. , , t
.
( )
,
, .
, =5/36, =4/3
=0.40, =0.88.
:
n,
,
.
(. . 18). ( ) .18 .
, ,
( ).

33

. 18.
(15 15), .

34



1.
1. WEB- . ( ) .
.
2. WEB- 3 3.
, .
3. WEB- . , .
4. . . ,
.
5. .
N, N!.
.
6. WEB-
. ,
.
7. WEB-
. ,
( ).
8. WEB- ( ).
.
9. WEB- -. , --.
35

10. WEB- . .
11. WEB-
.
Textarea .
12. WEB-
. .

2.
.
.
.
1. , . , .
. 4 .
2. . h d.
.
.
3. , ( ) . ,
.
. .
4. : .
. .
5. ,
.
, .
36

6.
, .
( ).
7. ,
, . .
8. ,
, .
9. , , (
, ).
. .
10. , , . , .
11. , , .
, . .
12. , .
,
.

. , .
. .

.
37

1. . , ,
.
2. , .
3.
. ,
4.
, .
5.
, ,
.
6.
, . , .
7.
, .
.
8. ( ).
, .
9. , ,
. , .
10. ,
.
.
11. . .
.
12. . ,
.
38

3. VML
1 - 12
.

. .
1.
,
( , ) .
.
.
2.
,
. ,
.
3.
, ,
. .
4.
, sin(x)+|sin(x)|
( ).
5.
, |sin(x)|
( ).
6.
, , ( ).
7.
, , ( ).
8.
. ,
.
9.
, 39


.
10.
, 0<x<T
x(Tx), T .
11.
,
2T, (T<x<T) x2,.
12.
,
2T, (T<x<0) x(x+T) (0<x<T)
x(Tx).
:
,
(, ..).
.
, .
13. ,
.
14. , .
.
15.
.
16. , n=1+d exp(az) z>0 n=1+abz z>0.
17.

.
40

. .
18. . , , .
19. .
20. . .
21.
.
22. .
23. .
.
24.
,
.

4.

1. , [0,1] N
.
2. .
-
.
3. - .
4.
.
5.

.
41

6.
:
,
. ( ) , .
7.
, , .
8. .
.
9. ,
10. ,
.
11. ,
, .
.
12. ,
. , , ,
.

, ,
WEB- . ..
: http://physics.herzen.spb.ru.

42


1. .. JavaScript. -. .: , 2004.
2. .. JavaScript. . .: . 2006.
3. ., . JavaScript. . .
. .: . , 2004.
4. .., .. . .: . , 2004.
5. .., .., ...
. . , .: Academia, 2005.

..

WEB

..
..
22.07.2009
6084 116

. . 4,5 .-. . 4,5 . . .
100 .
180
. . . , 191186, -,
. . , 48
. . .
191186, -, . . , 48

43

Оценить