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

-

..
..

.. , ..


MATHCAD


MATHCAD

2002
2002

004.4
32.973-018


762
..
MathCAD: .
: .. , .. . :
, 2002. 136 .

ISBN-5-7795-0169-6
MathCAD2001i (
) (, )
. MathCAD.

.
, .


, , , .

..
-
54.. 02.953..127.10.01 01.10.2001 .
10.12.2002. 6084 1/16 ..
. . .


MATHCAD

.. , ..-.., ,

;
.. , ...,
()

ISBN-5-7795-0169-6

, 2002
..,
.., 2002

8,0 .-..; 8,75 .. 400 .



630008, , . , 113


.............................................................................................. 5
1.
MathCAD .............................................................................. 7
1. .................... 7
1.1. MathCAD ....................................... 7
1.2. .......................................................... 9
1.3. ................................................... 13
2.
- ......................... 15
2.1. Word ... 15
2.2. Excel .. 19
2. MathCAD ........... 27
3.
MATHCAD ........................................................................ 28
3.1. ...................... 28
3.2. ........ 29
3.3. ................. 35
4. -:
........................................................................... 39
4.1. -
..................................................... 39
4.2. - MathCAD ........... 42
5.
- MathCAD .................... 44
5.1.
-.................................................... 44
5.2.
- ................................................. 45
5.3.
- ................................................. 51
6.
- MathCAD .......... 62
6.1. ........ 62
6.2.
............................................ 66
3

6.3. ...................... 74
7. MathCAD ..... 80
7.1. ............. 80
7.2.
MathCAD ......................................................... 81
7.3.
MathCAD................................ 84
7.4. MathCAD Internet ....................................... 85
3. -
MathCAD ....................................................... 94
8.
MathCAD ........................................................... 94
8.1. ...................................... 94
8.2. ............................................. 105
9.
MathCAD .......................................................................... 112
9.1. ..... 112
9.2. .... 114
10.
MathCAD ..................................................... 118
10.1.
........................................................................... 118
10.2. .................... 125
.................................................................................... 135
................................................ 135


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

. :
(
);
( - );
.
( Visual) ( ), (
). , 90- , [1] , ,
. MathCAD [2, 3],
MatLab [4, 5], Mathematica [6], Maple [7].
, MathCAD,
MathCAD2000 Professional, MathCAD2001i Professional. , ,
(
) Internet.
MathCAD [2, 8, 9]. ,

,
5

- MathCAD. ,
,
,
MathCAD, . , MathCAD.
.
MathCAD.
2 MathCAD (
MathCAD2001i), : , .
- MathCAD. . ,
, MathCAD.
,
MathCAD ( , , , , ). , .

,
,
, , . , , , MathCAD

.

1.
MathCAD
MathCAD, MathCAD
-,
Word
Excel.
1.
MathCAD, ,
ASCII-, 0 255.
MathCAD , (, , Pascal ..).
MathCAD, , MathCAD.
1.1. MathCAD
, , .

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

, , ;
( [Enter])
( );
(
Excel);
,
.. ;
, ASCII-, ;
,
- .

:
, , , ;

.

, :
,
( );
, , .
1.1.1.
READ :
) : =READ(E :\COPY\data1.dat)
) file_1 : =E :\COPY\data1.dat

A : = READ(file_1)

1.2.

:
WRITE ( ) : =
APPEND ( ) : =
:
WRITE ,
. ,
;
APPEND
. ,
, ;
APPEND
, ( );
:
;
;
;
, (. 1.2.1).
1.2.1. :
nsamp = 10 ;
n samp [0, 99];

n samp 0 n samp 1 .

,
, . 1.2.1. rnd(a)
, [0, a],
floor(x) ,
x.
.

nsamp := 10

i := 0 .. nsamp 1

x i := floor ( rnd( 100 ) )


WRITE ( file_1 ) := nsamp
APPEND( file_1 ) := x i
APPEND( file_1 ) := i

. 1.2.1.
1.2.1.
MathCAD ( MathCAD2000 ). MathCAD2001i (. . 1.2.2),
.

. 1.2.2. WRITE

:
WRITEPRN ( ) := <>
APPENDPRN ( ) := <>
:
WRITEPRN , ;
APPENDRN
. ,

10

. ;
,
;
:
;
;
.
,
,
.
:
PRNCOLWIDTH ,
( 8);
PRNPRECISION
( 4).
,
, , .
1.2.2. , k-
0 = 10 0 = 2
( 02 = 4 ).
, , . 1.2.3. ( n = 5,
m = 4).

0 := 10
n := 5

0 := 2
m := 4

k := 0 .. m 1
B k

:= rnorm n , 0 , 0

WRITEPRN ( file_2 ) := B

. 1.2.3.
1.2.1. MathCAD, , :
xi , i = 0, n :

xi = a +

ba
;
n

( xi ),

i = 0, n ,

( x) = e x cos (5 x) .

1.2.2. MathCAD, , , 1.2.2,


8 m , k- 0 = 10 k2 = 0.01 + k ,

k = 0, m 1 .

1.2.2. MathCAD ,
ASCII-.
, Windows ( ), PASCAL, .
1.2.3. , 1.2.2.

11

12

1.3.
:
<> := READ(< >),
<> ,
(.. ).
,
READ . ,

(. 1.3.1).
1.3.1. z m data _1. dat , 1.2.1.
m data _1. dat .
. 1.3.1.
file_1 := "F:\COPY\data_1.dat"
m := READ ( file_1 )

rab i := READ ( file_1 )

i := 0 .. 2 m
j := 0 .. m 1
0

z =

m = 10
n := last ( rab )

z j := rab n m + j+ 1

1
1

2
2

3
3

4
4

5
5

1.3.2. ,
1.2.2.
. 1.3.2.
mean , var
. .
.
B := READPRN ( file_2 )
n := rows ( B)

m := cols ( B)

j := 0 .. n 1

k := 0 .. m 1

x j+ k n := B j , k

n=5

mean ( x ) = 10.174

m=4
var ( x ) = 3.215

. 1.3.2.
6
6

7
7

8
8

9
9

. 1.3.1.
1.3.1.
MathCAD ( MathCAD2000 ). MathCAD2001i
.

:
<> := READPRN(< >),

13

<> , .
:
;
, ASCII-, .

1.3.1. ,
V, k- k-
, 1.2.2
file_2.dat.
,
MathCAD
.

14

2.
-
MathCAD, MathCAD () Word ( ) Excel.
2.1. Word
, ,
, , MathCAD. .
1. MathCAD
Word.
2. Word
MathCAD.
, - Word
. .
:
1. MathCAD
,
Word.
:
) MathCAD,
,

Copy ();
) Word
, ;
) MathCAD,
Paste () .
15

, , .. Word.
Word , .
: )
,
(
), ,
).
,
. ,
, . .
. 2.1.1 Word,
MathCAD - . MathCAD Word.
- ( ).
ba
:
Simpson ( f , a , b , N ) := h
N
f S ( f ( a) ) + f ( b)
;
for i 0 .. N 1
a, b h
;

S S + 4 fa + i h +
2
N
for i 1 .. N 1

S S + 2 f ( a + i h)
h
6

. 2.1.1. MathCAD
2. Word MathCAD,
16

. MathCAD,
:
) , ;
) (. 2.1.2) MathCAD document
;
. 2.1.3. MathCAD Word

2
x cos ( 4 x) d x = 0.247
0

. 2.1.4. MathCAD
Word
MathCAD .
, ) (. . 2.1.2) . , , MathCAD, Word , . 2.1.5.
. 2.1.2.
) ( ) (, , . 2.1.3);
) MathCAD MathCAD. Word
MathCAD (. .
2.1.4);
) MathCAD
MathCAD .
17

Mathcad Document

. 2.1.5. MathCAD
Word MathCAD
, ( ) MathCAD.
18


MathCAD
MathCAD , Word.
Word , MathCAD.
MathCAD , ) ) 1.
2, MathCAD Word. :
Word (. . 2.1.6,
,
Word);
Word (
2).
2.1.1. MathCAD - ( , ).
(. . OLE).
2.2. Excel
, MathCAD Excel , ( . 2.1
Word).
, MathCAD ( MathCAD2000),
AddIn for Excel,
MathCAD Excel. MathCAD. ,
, , MathCAD.

19

. 2.1.5. MathCAD
Word
1. Excel ,
MathCAD.
, Excel , , MathCAD svds ( . 2.2.1).

20

. 2.2.1. , Excel

. 2.2.2. Excel

:
) MathCAD,
, ;
) (. . 2.2.2)
Excel ;
) (. . 2.2.3) :
Create an empty Excel worksheet Excel;
Create from file .
, Browse, , ,
( , );
. 2.2.3.

21

22

) (. 2.2.4)
Inputs = 0, Outputs = 1, Range ,
( B3:D7),
;

. 2.2.7 MathCAD, , .

. 2.2.5. MathCAD

. 2.2.4.
) MathCAD , : =, ( ).
. . 2.2.5
MathCAD .
, Excel
. , . 2.2.1, :
B3:D7;
3:7.
Out )
puts = 2, Range ( B3:D7,
3:7) . (. . 2.2.6) ,
23

. 2.2.6.
,
MathCAD ( submatrix), MathCAD Excel
MathCAD Excel.
.
,
. MathCAD .

24

, MathCAD.

. 2.2.7. MathCAD
2. MathCAD ,
Excel (,
).
, MathCAD

: x = 2, 4, 6, 8 y = 8, 6, 4, 2 .
2:5, 3:D6.
:
) ) 1;
) Create an empty Excel
(. . 2.2.3);
) Outputs = 0, Inputs = 2
Starting Cell : 2, 3 (. . 2.2.8) ;
) MathCAD , (. . 2.2.9), x, y ;
) MathCAD
. ,
Excel (, ..) . 2.2.10 25

. 2.2.8.

. 2.2.9.

26

. 2.2.10. , Excel
MathCAD
,
MathCAD Excel
MathCAD .
2. MathCAD
MathCAD,
: ,
( ).
:
MathCAD
;
.
( ) MathCAD, .
27

( )
(,
) , -
( -).

MathCAD, .
,
(7080 XX )
, .
MathCAD :
;
- -
-
;
MathCAD.
3.
MathCAD
, , MathCAD.
3.1.


. , , MathCAD
, .. .
3.1.1.

: ax2 + bx + c = 0 :
28

b b 2 4ac
.
(3.1.1)
2a
(3.1.1) ( ),
MathCAD ,
. 3.1.1.
x1,2 =

a := 2 b := 5
x 1 :=

c := 8

b + d
2a

x 1 = 1.25 + 1.561i

x.
. 3.2.1 - , .

d := b 2 4 a c
x 2 :=

b d

(1)

2a

x 2 = 1.25 1.561i

(0)

x0

y( x) = x2

y( x) =


a x 1 2 + b x 1 + c = 0.00000

a x 2 2 + b x 2 + c = 0.00000

. 3.1.1.
x1, x2 , 1, 2 (
) [.] .
3.1.1. a, b, c,
. .
, MathCAD .
3.2.
. ( )
.
3.2.1. y x :
x 2 , x 0;
y=
(3.2.1)
x, .
29

. 3.2.1. - (3.2.1)
: ? (3.2.1) :
,
( , (3.2.1));
, .
MathCAD : , .
( )
:
<.1> < > <.2>,
<.1>, <.2> ,
< > :

< > =

( -

).
.

30

( . 3.2.2) , . 3.2.1.

3.2.2

(NOT)

(OR)
(AND)

(XOR)
. 3.2.2.
! = . =
.

3.2.1

[<]
[Ctrl] + [9]
[>]
[Ctrl] + [0]
[Ctrl] + [=]
[Ctrl] + [3]


<

>

: 1
, 0 . 1 , 0
.
3.2.1. x =3. :
a) x 4 ;
) + 1 4 ;
) 4 > 1.

, . 3.2.2.

. . 3.2.3.

0 = 1
1 = 0

NOT

00 = 0
0 1 = 0
1 0 = 0
11 = 1
AND

00 = 0
0 1 = 1
1 0 = 1
1 1 = 1
OR

00 = 0
1 0 = 1
0 1 = 1
00 = 0
XOR

,
, .
: 1
0;
. , : AND, OR XOR .
3.2.2. MathCAD, . 3.2.3.
x := 0.2

y := 4

( x > 3) ( y > 0) =
( x > 3) ( y < 0) =
31

3.2.3

32

. 3.2.3.
, if,
:
if (< >, <. 1>, <. 2>),
if . 1, .1, . 2. - .
3.2.4.

x := 3

y := if x 0 , x 2 , x

y = 1.732

z ( x ) := if x 1 , 30 , if 1 x 1 , x , x 2 30

))

x := 10 , 9.95 .. 10

z(x)

. .

.1

.2

x
. 3.2.5.

. 3.2.4. - if

. 1 . 2
if (. 3.2.1).
3.2.1. if, .
x 2 ,
x 0;
. y ( x ) =

x ,

x > 0.

30, x 1;

z ( x ) = x , 1 < x 1;
x 2 30, x > 1.

33

, ,
. 3.2.5. z
(x), .
MathCAD , , , . :
ceil (x) , x;
trunc (x) x;
floor (x) , x;
round (x, n) x n ;
(x) 0 x < 0 1 ;
sign (x) ( 0 x = 0; -1, x <0
1, x >0);

34

signum (x) 1, x = 0

x
x

3.3.
( ) , ,
, ,
.
. :
) ;
) .

,
, , .
3.3.1. z n , :
1 ,
i = 1, , n; n = 10.
zi =
(i + 4)
i , ( zi ) n = 10 , .. -

.
, ..
, - .
3.3.2.
:

xn +1 = 0.5 ( xn +

a
), n = 0, 1, ... ; x0 = a.
xn


:
x2 a ,
n+1

35

. a , (, = 9, = 0.01 ), .
. ( ), ,
,
MathCAD , .
,
3.3.1 . 3.3.1.
n := 10
z i :=
T

z =
1

i := 1 .. 10
1

i+4
3

0.2 0.167 0.143 0.125 0.111

10

0.1 0.091 0.083 0.077 0.071

. 3.3.1. z 3.3.1
. 3.3.2 ,
( ) :

i , j =

1
; i = 1, ..., n; j = 1, ..., m .
i + j +1

(3.3.3)

, : i ,
; j ,
. ,
.

(3.3.1)

xn +1 ,
(3.3.2)
36

n := 3

m := 6

i := 1 .. n
Bi , j :=

j := 1 .. m
1

i+ j+1

ORIGIN := 0
a := 9

0.333 0.25 0.2 0.167 0.143 0.125


B = 0.25
0.2 0.167 0.143 0.125 0.111
0.2 0.167 0.143 0.125 0.111 0.1

. 3.3.2. (3.3.3)
, . 3.3.1 3.3.2
ORIGIN=1.
. until, :

until (<. 1>,<. 2>).


. 2 , . 1
0. . 1
, until 0, .
until .
. 3.3.3 , 3.3.2.
3.3.1. MathCAD2001i

- while.

37

:= 10 6

x 0 := a

i := 0 .. 10
a

xi +

xi

x i+ 1 := until ( x i) 2 a ,
2

x = ( 9.0000 5.0000 3.4000 3.0235 3.0001 3.0000 0.0000 )

. 3.3.3.
until
, 7- x ( 6)
- , ( xi )2 a , until 0. , :
nsolve := last ( x ) 1

nsolve = 5

x n solve = 3.0000000

, - xn. : xn () x n+1
().
,

.
, ,
, FORTRAN Pascal:
, , .. MathCAD,
.

38

4. -:

.
4.1. -

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

- , .
- , , ..
. , . .
4.1.1. - , , -.
- : ,
, - .
- MathCAD.
-
:
- , (. 4.1.1);
: : =;
Add line (. . 4.1.1).
, - (. . 4.1.2);

f ( x)

. 4.1.2. -
. 4.1.1.
- MathCAD ,
. (
) -.

1 (
[Tab]) -.
- ,

39

40

Add line (.
. 4.1.3).
.
-
[Delete];
f(x)

x
z

x
x

2
1
3

2
2

< >

< > .

! - ( : =) .
4.2. - MathCAD
- ( ), ..:

. 4.1.3. -

< - > (< >) .

( 2), , - (.
. 4.1.4).

, .
.
, , . :
,
, , ;
,
;

,
.

f ( x)

x
z

x
x

2
1
3

. 4.1.4. -

x, - (. ) z,

-.
4.1.2. - , -
-.
. - , :
41

4.2.1. -
,
.
4.2.1. f(x), .
4.1.4, :

42

x := 2

f ( x) = 1.587

z := f ( x + 2.5)

f ( 3.23) = 0.536 + 0.928i

z = 1.866

, z z, -.
4.2.2. - ,
- (. . 4.2.1).
x := 2
f :=

5.1.
-
, ,
(. . 3.1). ,
, - , .
5.1.1. - ax2 + bx +c = 0
x1,2 =

x x + 2
1

z x

f = 1.587

z
x = 2

. 4.2.1. -
-,
- .
4.2.3.
- , .
5.
- MathCAD
,
- MathCAD.

43

b m (b2 4ac)1/ 2 .
2a

- root_poly2
. 5.5.1. - .
. , x1, x2 , .
[.] . - .
root_poly2 ( a , b , c) :=

d b2 4 a c
x1
x2

b + d
2a
b d
2a

x1
x2

0.292 + 0.865i
0.292 0.865i

z=

z := root_poly2 ( 12 , 7 , 10 )

44

. 5.1.1.

if

2
5.2.
-
,
.
( )
.
- MathCAD
if. , .
if . 3.2, if.
.
- if . , . 5.2.1.
1

if

otherwise

. 5.2.2.
2 otherwise :
, if;

otherwise

;
otherwise 2.
5.2.1. -,
y(x), 3.2.1. -
. 5.2.3.
y( x ) :=

x 2 if x 0
x otherwise

y( 2 ) = 1.414

. 5.2.1. if
2 (
). 1
1 ( , ), ,
1. = 0, 1 . , .

otherwise,

, 2, , 0 (. . 5.2.2). otherwise
if.

y( 4 ) = 16

. 5.2.3. 3.2.1
, , otherwise
,
.
otherwise.
5.2.2. - z(t)

t 3 , t < 3;

z(t) = ln( t ), t > 4;


2
t , 3 t 4.
- . 5.2.4.

45

46

z ( t ) :=

t 3 if t 3

if

t 2 if 3 t 4


= 1

ln( t ) otherwise
z ( 8 ) = 512

z ( 2) = 4

z ( 7 ) = 1.946

. 5.2.4. 5.2.2
, z(t) ln(t)
, , -.
! 3 ln(t), .
5.2.1. -, :
1 , x 1;
2 x

1
. y = 3 x , 0 x 1;
3
1 4 x , x < 0.
4

, x y < ;
2 x +1
. ( x, ) =
1 3 x + y , x y ,
3

y= x .

otherwise

. 5.2.5. 1
2. MathCAD.
otherwise,
Add line
(. 5.2.6).

if

otherwise

, ,
= 0

. 5.2.6. 2

if . .
1.
MathCAD.
1 (. . 5.2.2), Add line
(. 5.2.5).
47

5.2.3. -,
x(t), y(t) . n. n < 0 n > 1,
0. - . 5.2.7. , a, b, , .

48

poly ( n , a , b , t ) :=

if n

x a0
y b0
if n

x a0 + a1 t
y b0 + b1 t
otherwise
x0
y0

y
. 5.2.7. 5.2.3
5.2.4. x, y. -,
x
, y . . 5.2.8.
v,
x, y.
- . 5.2.9.
arrangement ( x , y) :=

if x > y
v0 x
v1 y
otherwise
v0 y
v1 x
v

. 5.2.8. 5.2.4

49

x := 2

y := 8

x
:= arrangement ( x , y) x = 8

y=2

. 5.2.9. - arrangement
5.2.2. a, b, c. -, . a b c , , a > b > c , ,
.
5.2.3.
x, y. -,
, .
5.2.4. a,
b, c. -, n
: n = 3, ; n = 2,
; n = 1, .
5.3.
-
, () , . , .
:
;
.
. 3.3.
.
for ( ).
:

for

. , . 5.3.1;

50

for

xk, x0 , d .
, (2(2))/0.5+1=9. , y
9 . , : x, f(x);
i,
. ,
, , x,
.
- . 5.3.3. ,
.
y, 1 .

x k x0
d + 1,

. 5.3.1. for
1 , ;
2 ,
;
3 , .
, ( ) Add line
,
, .

5.3.1. -,
3.3.1.
- . 5.3.2. ,
ORIGIN ( ) 1.
form_vec1 ( n) :=

form_vec1 ( 5 ) =

for i 1 .. n
zi

1
2

i +1

0.5

0.2

i1
for x x 0 , x 0 + d .. x k
yi e x cos ( 2 x )
ii+1

z := form_vec2 ( 0 , 0.8 , 0.1 )

y
T

z = ( 1 0.887 0.754 0.611 0.467 0.328 0.199 0.084 0.013 )

. 5.3.3. 5.3.2

0.1
0.059
0.038

form_vec2 x 0 , x k , d :=

5.3.3. -, .
. 5.3.4 -.

. 5.3.2. -
5.3.2. x -2 2 0.5 f(x) = e-x. Cos (2x)
y, .. y1 = f(-2), y2 = f(-1.5) ..

51

52

sum_vec_3 :=

S 0

2
for i 5
7

-
sum_vec_3 =

S S +i
S

. 5.3.4. - 5.3.3
5.3.1. - y
5.3.2, i.
. while.
:

while

. , . 5.3.5;

, . 0, .
5.3.4. -,
, 3.3.2. - . 5.3.6.
, -
x0, x1, x2,... ( until . . 3.3.3). () ( xc)
() xn.
,
while , ..
. , - < 0,
.
sqroot ( a , ) :=

xn a
while

xn2 a >

xc xn

while

xc +

xn

a
xc

1 ;
2 .
, , .
while : while, MathCAD
. 1 (.. ),
53

sqroot ( 9 , 0.1 ) = 3.00009


sqroot ( 9 , 0.0001 ) = 3.00000

xn

. 5.3.5. while

. 5.3.6. 5.3.4
MathCAD break,
break .
break break
(
). break if, ,
54

sqroot_new ( a , ) :=


. if, . break.
5.3.5. -,
.
- . 5.3.7.
10000.
, ierr 1, . xn, ierr . ierr = 1, xn
not solve -. ,
- ierr , , ,
.

55

xn a
ierr 1
for i 1 .. 10000
if

xn2 a <
ierr 0

break
sqroot_new ( 9 , 0.0001 ) =

xc xn

xc +
sqroot_new ( 9 , 0.0001 ) =

"not solve"

xn

a
xc

xn "not solve" if ierr

xn

ierr
. 5.3.7.
5.3.6. -,
. ,
.
- . 5.3.8. ,
, .

, -.

56

sum_conv ( , a ) :=

(
. 5.3.9).

sum 0
ierr 1
for i 1 .. 10000
if

1
i

d ( i) :=

a ( i) <

for

for

while

while

for

ierr 0



b ( i ) :=

for

. 5.3.9.

break

sum sum + a ( i )

sum "not convergence"

if ierr

sum

ierr
-
sum_conv ( 0.00001 , b ) =
sum_conv ( 0.00001 , d ) =

1.64177

"not convergence"

. 5.3.8. 5.3.6
. , ( ) : , , . , A2,4
,
.
,
, , .
: . ,
,

57

5.3.7. -
:
Bi , j =

1
, i = 1,..., n;
i + j +1

j = 1,..., m .

- . 5.3.9. - i, j.
ORIGIN := 1

form_mat1 ( n , m) :=

for i 1 .. n
for j 1 .. m

form_mat1 ( 4 , 2 ) =

0.333

0.25

0.25

0.2

0.2

Bi , j

0.167

0.167 0.143

1
i+ j+1

. 5.3.10. 5.3.7
5.3.8. A n m .
-, , c.
- 5.3.10. ,
ORIGIN = 1.

58

min_dist ( n , m , A , c) :=

0.105 0.002
A := 0.001
2

6.123 0.12

min 10 10
for i 1 .. n
for j 1 .. m
if

A i , j c < min
min Ai , j c
Amin A i , j

2
min_dist ( 3 , 2 , A , 1.99 ) = 2
2

imin i
jmin j

Amin
imin
jmin

0.105
1
1

min_dist ( 3 , 2 , A , 0.11 ) =

x :=

4
3

2
2

11

z := form_vec2 ( x )

continue. .
.
5.3.9. -,
.
. 5.3.12. - last(v),
v. vi , ( ,
w), i.
x -
z
.

59

i0
j0
while i < last ( v)
ii+1
continue if vi 0

2
z = 3
2

j j+1
w j vi
w

. 5.3.12. 5.3.9
return. -
, 1 (. . 5.3.13).

. 5.3.11. 5.3.8
, . ,
.

form_vec2 ( v) :=

return

. 5.3.13. return
.
5.3.10. -,
. ( . 5.3.14). B
.

B
pol_1 ( v) :=

i1
while vi 0

pol_2 ( v) := for i 1 .. last ( v)


return vi if vi > 0

ii+1
vi

. 5.3.14. 5.3.10

60

on error. :
< 1 > on error < 2 >.
.
< 2> , < 1>.
, < 2>.

proj ( v , w) :=

error ( "You cannot onto the 0 vector" ) if


w
w

2
x := 4
6

w < 10 10

( v w) otherwise

3
w := 2
1

16.036
proj ( x , w) = 10.69
5.345

. 5.3.16. - error
5.3.11. on error angl(x,y). . 5.3.15.
angl ( x , y) :=

x
y

angl ( 2 , 0 ) =

angl ( x , y) := 10 10 on error
angl ( 2 , 0 ) = 1 10 10

x
y
angl ( 2 , 2 ) = 1

, -,
(. . 5.3.17).
2
x := 4
6

0
w := 0
0

. 5.3.15. on error 5.3.11


. 5.3.17. error 5.3.12
error.
:
error ("< >").
.
if, .
5.3.12. v w.
- . 5.3.16.
61

6.
- MathCAD

, .
6.1.
,
MathCAD.
62

6.1.1. -,
n . -
. 6.1.1. -
:
length(v) v;
submatrix(A,i1,i2,j1,j2) , A, i1 i2 j1
j2.
ORIGIN = 0.
form_vec3 ( n , v) :=

f ( x , a , b , A , B) := B + A ( ( x a ) ( x b ) ) ,

a = 2, b = 4, A = 6, B = 2 . 6.1.3.
( x) , < 0 1
.

f ( x) := 1 if mod( ceil( x) , 2)
1 if mod( ceil( x) , 2)

1.5

0
f ( x)

x := 0 , 0.05 .. 6

N length ( v)

v if n N
1

submatrix ( v , 0 , n 1 , 0 , 0 ) if n 1 otherwise

x :=

9
2
7

form_vec3 ( 10 , x ) =

2
form_vec3 ( 3 , x ) = 5
7

1.5

9
2

4
x

. 6.1.2. 6.1.2

. 6.1.1. 6.1.1
3

6.1.2. -,
2 +1 1 ( . 6.1.2). - . 6.1.2.
:
mod(y,modul) x modul;
ceil(y) , y.
6.1.3. -, A [ a, b ] . .
- :
63

f ( x , 2 , 4 , 6 , 2)

. 6.1.3. 6.1.3
64

6
6

6.1.4. MathCAD
z = xmax + y pol , xmax
x2 + 5.45x 8.12 = 0; y pol y2 + 25.3y 9.5 = 0. . 6.1.4. -
,
. 5.1.1 (. 5.1.1).

6.668

0.37
Y=
25.67

Y := root_poly2 ( 1 , 25.3 , 9.5 )


x max := if ( X 0 > X 1 , X 0 , X 1)

ypol := if ( Y 0 > 0 , Y 0 , Y 1)
z := x max + ypol

x max = 6.668

ypol = 0.37
z = 6.298

. 6.1.4. 6.1.4
6.1.1. -,
, . 6.1.2, : ) 1; ) 8. (. 6.1.2).
6.1.2. -, , . 6.1.4, . -.

ab, n = 1;

S = r 2 , n = 2;
a+b
h
, n = 3.

a = 3 2Sin2 x + 3Cos( x2 + 2)
b=

esin2 x ecos3x
ln x2 + d 2

1.218

X =

X := root_poly2 ( 1 , 5.45 , 8.12 )

y=max (a,b),

. 6.1.4.

6.2.


, .
MathCAD
ORIGIN=1.
1 ( ,
)
6.2.1. -, A
:
ai , j

sin(i + j ), i = j;

= sin i + cos j, i > j;


sin j + cos i, i < j.

- . 6.2.1.
form_mat_1 ( n , m) :=

for i 1 .. n
for j 1 .. m
a i , j sin( i + j) if i

a i , j sin( i) + cos ( j) if i > j

6.1.3. -,
S n=1, 2, 3. 6.1.4, , h, a, b, r, n .

65

a i , j sin( j ) + cos ( i) if i < j


a

. 6.2.1. 6.2.1
66

6.2.1. x y, n .
-, B n n
:
Bi , j

calc_num ( n , y , a , b ) :=

k2 0
for i 1 .. n

xi2 + 2 yi , xi > yi ;
=
xi + yi , xi > yi .

6.2.2. x y, n . -, q n, i-
1, ( xi , yi ) r .
6.2.3. A n n . , ,
1, 0.
6.2.4. x, y, n .
: xi yi xi,
yi.
2 (
, )
6.2.2. y, n . -, :
, a yi b ;
.
- . 6.2.2.
6.2.3. n n .
-, ,
a Ci , j b . , , i > j .
, : ) ; ) , ,
. -, . 6.2.3
.
67

k1 0

k1 k1 + 1 if a yi b
k2 k2 + 1 if yi > 0

k1

k2

. 6.2.2. 6.2.2
calc_num2 ( n , C , a , b ) :=

k0
for i 2 .. n
for j 1 .. i 1
k k + 1 if a C i , j b
k

. 6.2.3. 6.2.3
6.2.4.
ai = cos (

i
+ i ) i=1,2,...,n; n=10.
10

-, , [0.5, 1].
: ) -
, -; )
-

. -
. 6.2.4.

68

calc_posl_1 ( n , a , a1 , a2 ) :=

i- D,
Di , j , .

k1 0
k2 0

a ( l ) := cos
+l
10

for i 1 .. n
c a( i)
k1 k1 + 1 if c < 0

calc_posl_1 ( 10 , a , 0.5 , 1 ) =

k2 k2 + 1 if a1 c a2

k1

k2

. 6.2.4. 6.2.4
6.2.5. D n m . , , i-
i- D. -
. 6.2.5. ( )
( )
.
.
calk_mat_1 ( n , m , D) :=

for i 1 .. n
k0

1 2
A := 1 3
1 9

for j 1 .. m
k k + 1 if Di , j > 0

3 (
, )
6.2.6. y, n . -, :
;
, [ a, b ] .
- . 6.2.6. ,
sum, pr
, .
calc_sum1 ( n , y , a , b ) :=

sum 0
pr 1
for i 1 .. n
sum sum + yi if a yi b
pr pr yi if yi > 0

sum

pr

. 6.2.6. 6.2.6

Di , m k

1 1
2
1 0

calk_mat_1 ( 3 , 2 , A) = 1

. 6.2.5. 6.2.5
6.2.4. A, B n m . -, Ai, j Bi , j
6.2.5. D n m . , i- 69

6.2.7. A n m . , i-
. -
. 6.2.7.
6.2.6. x, n . -,
.
6.2.7. x, n . -, , : 70

, , .

sum_mat_2 ( n , m , A) :=

min_max_vec ( n , y) :=

min y1
max y1

for i 1 .. n

imin 1

sum 0

imax 1

for j 1 .. m

for i 1 .. n

1 2
A := 1 3
1 9

if yi > max

sum sum + Ai , j

max yi

Ai , 1 sum

1 2
sum_mat_2 ( 3 , 2 , A ) = 4
3
10 9

x :=

imax i

if yi < min
min yi

. 6.2.7. 6.2.7
6.2.8. A n m . -,
, i- i- .
6.2.9. A n m . -,
,
Ai , j , .
6.2.10. n = 20 m = 5 .
n m .
-, ,
.
6.2.11. n = 20 m = 5 .
n m .
-, .
4 (
)
6.2.8. y, n . -, . - . 6.2.8.
71

3
2

10

min_max_vec ( 5 , x ) =

imin i
yimin max
yimax min
y

10
2

. 6.2.8. 6.2.8
6.2.9. f(x) x, n
. -, : ) ; )
, .
- . 6.2.9. , -
.
f(x), ( x) , -.
6.2.10. A n m .
-, , i- i- . - . 6.2.10.

72

max_fun ( n , x , f ) :=

xmax x 1
imax 1

( x ) := e

( x 3.5 )
3

fmax f ( xmax )

for i 1 .. n
if f ( x i) > fmax
fmax f ( x i)
imax i

4
5
6

xmax x i

0.92

max_fun ( 6 , x , ) =

x :=

fmax
xmax
imax

. 6.2.9. 6.2.9
min_mat_1 ( n , m , A ) :=

for i 1 .. n
jmin 1

1 2
A := 1 3
1 9

min Ai , 1
for j 1 .. m
if Ai , j < min
jmin j

2
min_mat_1 ( 3 , 2 , A) = 1
2

min Ai , j
x i jmin
x

. 6.2.10. 6.2.10
6.2.12. A, B n m . max = max A + max B , max A, max B A, B . -.
6.2.13. A n m .
-,
.
73

6.2.14. A n m .
-, ,
.
6.2.15. n = 20 m = 5 .
n m .
-, (.. ), .
6.2.16. n = 15 m = 4 .
n m .
-, (.. ),
.
6.3.
6.3.1. -, n 0
n! = 1 2 3 n .
- . 6.3.1.
F1 ( n) :=

0 if n 0
F1 ( 5 ) = 120

=1

i otherwise

F1 ( 0 ) = 0

F1 ( 3 ) = 0

. 6.3.1. n
- break . 6.3.2. while, while 1, , n = 1,
break .

74

F2 ( n) :=

f 0 if n 0
otherwise
f n
while 1
f f (n 1)
nn1
break if n

F2 ( 5 ) = 120

. 6.3.2. n
3.6.2. v, n . -, ,
v j x , x, .
- . 6.3.3.
for, , - search (, < 0 ).
- . 6.3.4.
search ( v , x , ) :=

j1
while v j x >
j := 1 .. 500

j j+1

w j := ceil ( 1000 cos ( j) )

vj

397

search w , 400 , 10 3 =

400

. 6.3.3. 6.3.2

search_1 ( v , x , ) :=

for j 1 .. last ( v)
break if

vj

vj x

search_1 w , 400 , 10 3 =

397

400

while (
) .
,
. ,
.
.
6.3.3
.
6.3.3.
x2 ex = 0 .
(6.3.1)
= 105 , [ 4, 0 ] , ( ).
, , .
f ( x) = 0
x = ( x) .
(6.3.2)
x0 [ a, b ] ,
f ( x) = 0 ( [ 4, 0 ] ).
(6.3.2),
x1 = ( x0 ) . x1
(6.3.2) x2 = ( x1 ) .
,
xn = ( xn 1 )
(6.3.3)
( ). .
1. x0 , x1 , x2 ,..., xn ,... x , .. , , .. f ( x ) = 0 .

. 6.3.4. 6.3.2
75

76

2. x0 , x1 , x2 ,..., xn ,... , ..
, .
,
.
[ a, b ] x = ( x) ,
' ( x) q < 1 .
(6.3.4)

a ( x) b ,
(6.3.5)
(6.3.3) , x0 [ a, b ] .
, q (6.3.4), x0 , x1 , x2 ,..., xn ,... x .
xn ,
(1 q )
(6.3.6)
= ,
xn xn 1
q

,
xn x ,
(6.3.7)
x .

(6.3.2). x = e 2 ( - x
e2

. ), .. ( x) =
(6.3.4) , MathCAD (.
. 6.3.5).

77

( x ) := e 2

d ( x ) :=

d
dx

( x )

x := 4 , 3.95 .. 0

0.6

d ( x)
0.5

0.4

0.2
0

0
0

. 6.3.5. (6.3.4)
, q (6.3.4)
0.5, (6.3.4).
(6.3.5) ( x)
[ 4, 0 ] (. . 6.3.6). , (6.3.5)
[ 4, 0 ] ( x) 4 < ( x) < 0 .
:
x0 [ 4, 0 ]
(6.3.1).
(6.3.6):
:=

10

( 1 0.5)
0.5

= 1 10

-, . 6.3.7. . ( x) .
(6.3.3) for
( . 5.3.4). , x0 , xn ,
-, ,
78

(
[ ] ).
0

( x)

0.5

7. MathCAD

. 6.3.6. (6.3.5)

posl_prib x 0 , , :=

- , [ 0,1 ] , . while (.
5.3.3).
6.3.2.
f ( x ) = x 3 + 3 x 2 24 x + 1 = 0 .
- ,
[7, 1] [2, 12], 0.001. while (. 5.3.3).

MathCAD.

ierr 1
for n 1 .. 10000

( )

xn x0

xn x0

if

ierr 0
break
x0 xn
x n "not solve" if ierr

xn
x
2

f ( x) := x e

( x) := e

x0 := 2

:= 10

)
7
f ( xapp) = 3.01 10

xapp := posl_prib x0 , ,
xapp = 0.70347

7.1.

XX ,
. (, [10]). :

;
.
,
, .
? :

. 6.3.7.

6.3.1.
f ( x ) = 5 x3 20 x + 3 = 0 .
79

80


,
;
, , ..

;
. , (, , );
, .
MathCAD?
- (. 4).
- :
- . ;
- MathCAD .
7.2.
MathCAD
, :

, -;
, -
.
-
-.

f ( x)dx ,

, [a, b].
- Simpson (f,a,b,N) ( .
7.2.1)
N, -
Adapt-Simpson (f, a, b, ) ,

, . . :
I 2 I1 < ,
(7.2.2.)
I2 , ( I1) (
).
. 7.2.2 - f(x). ,
(
). , = 10 8 .
7.2.1. -
(7.2.1.)
.
[a, b] N :
f ( x0 ) + f ( x N )
b a N 1
(7.2.3)
Int =
f ( xi ) +
,
2
N i =1

xi = a + i b a , i = 0, ..., N .
N

7.2.1. - :
81

(7.2.1)

82


:
-
;
- MathCAD ;
- , . Web- Internet (. . 7.4).
, .

ORIGIN := 0
Simpson ( f , a , b , N ) :=

ba
N

S ( f (a) ) + f ( b)
for i 0 .. N 1

S S + 4 fa + i h +

h
2

for i 1 .. N 1
S S + 2 f ( a + i h)
h
6

Adapt_Simpson ( f , a , b , ) :=

7.3.
MathCAD

Int1 Simpson ( f , a , b , 5 )
Int2 Simpson ( f , a , b , 10 )
Int2 if

Int2 Int1 <

otherwise

Int Adapt_Simpson f , a ,

a+b

Int Int + Adapt_Simpson f ,

a+b
2

,b,

Int

. 7.2.1. -
2

f 2 ( x ) := e x cos ( 2 x )
1

f 2( x) d x = 0.4290978
0

Simpson f 2 , 0 , 1 , 10 = 0.4290976

Adapt_Simpson

( f 2 , 0 , 1 , 10 ) = 0.4290978
8

, - MathCAD, ( ).
:
- , -?
:
1) , -, ;
2) (
-),
;
3)
;
4)
( ),
-. ;
5) ,
. 7.3.1.

. 7.2.2.
83

84

Reference:F:\COPY\__.mcd
Reference:F:\COPY\__.mcd

. 7.3.1. -
7.3.1. 7.2.1.
- (
. 7.2.1) __
F:\Copy.
, . 7.3.1, -, (.
. 7.3.2).

MathCAD . -,
.
Internet.
Web Library
MathCAD ,
. :
Resource Center ( ) (.
. 7.4.1);

Reference:F:\COPY\__.mcd

Reference:F:\COPY\__.mcd
f2 ( x ) := e

cos ( 2 x )

Adapt_Simpson

f , 0 , 1 , 10 8 = 0.4290978
2

. 7.3.2. -
, :
- ,
- MathCAD, ;
-.
MathCAD, -, - .
7.4. MathCAD Internet
MathCAD - , ,
Internet Web-,
85

. 7.4.1. Resource Center


Web Library ;
- (. . 7.4.2);
(. . 7.4.3) .
86

. 7.4.2. Web Library

. 7.4.3. Web Library

MathSoft ( MathCAD) MathCAD


(URL-
http://www.mathcad.com/library/Mathcad_Files.asp). . 7.4.4.
. ,
Civil and Mechanical Engineering 94 ( 2002 ).
87

88

. 7.4.4.
MathCAD

, ,
(. . 7.4.5, Civil and
Mechanical Engineering). MathCAD
( ).

89

. 7.4.5.
Civil and Mechanical Engineering

MathCAD Exponenta
(URL- www.exponenta.ru/soft/Mathcad). . 7.4.6
MathCAD.

90

. 7.4.6. ,
Exponenta
Web-, MathCAD,
- . . 7.4.7 Web. :
collab.mathsoft.com/~mathcad2000

MathCAD
(

twt.mpei.ac.ru/ochkov/Collab/Collab.htm);
www.mathsoft.com/mathcad/library/3Dplots/ MathCAD (
twt.mpei.ac.ru/ochkov/Lace/Lace.htm);
www.mathsoft.com/appsindex.html
MathCAD;
www.mathsoft.com/mathcad/library/world.html MathCAD (MathCAD Files Around the World);
www.mathsoft.com/books.html MathCAD;
http://twt.mpei.ac.ru/ochkov/MC_ODE/Stiff_ODE/Stiff_DE.htm
(
MathCAD);
http://petrsu.karelia.ru/psu/Deps/IMO/Complex/

MathCAD
MathCAD;
http://www.keldysh.ru/comma - ( .. ). , MathCAD;
http://www.mpei.ac.ru/homepages/mm/
.

. 7.4.7.

http://www2.latech.edu/~dmg/#Civil Engineering

, MathSoft,
MathCAD.
,
( )
MathCAD . , , .
.
MathCAD.
:
Resource Center (. . 7.4.1)
Collaboratory;
Collaboratory (. . 7.4.7).
.
- . (,

MathCAD).
( MathCAD)
.
MathCAD
File Send. -

91

92

Outlook Express. MathCAD


.mcd.

.

3. -
MathCAD
, . :

;
, ;
.
MathCAD, (-). , ,
MathCAD.
8.
MathCAD


, ,
. ,
-.
8.1.
, .

8.1.1.
. 7.4.7.

93


:
f ( x) = 0 .
(8.1.1)
x ,
(8.1.1) , , x . , x 2 = 2 x :
94

x1 = 2, x2 = 1 .

,
.
f ( x) x , . . 8.1.1 f ( x) = x 2 2 + x ,
x 2 = 2 x ,
f ( x) = 0 (

).

. 8.1.1.

( ), , :
an x n + an 1 x n 1 + + a1 x + a0 = 0 .
(8.1.2)
an , an 1 , ..., a1 , a0 ,
, ( ). , .
95

, (8.1.2) n - n

f ( x) = ( x x1 ) ( x x2 ) ( x xn ) = 0 ,
(8.1.3)
x1 , x2 , ..., xn (8.1.2). (8.1.2)
( x x j ) ,
an x n + an 1 x n 1 + + a1 x + a0
x xj

(8.1.4)

, x j .
, (8.1.3).
.
,
(, ,
), . sin( x) = 0 , x = n ( n = 0, m 1, m 2,...) .
, :
( ),
(
. 8.1.1), (
).
.
:
;
.
.
8.1.2.
f ( x) = 0
[ a, b ] , f ( x) = 0
. [ a, b ]
. , , ,
, 96

.
: .
: f ( x)
[ a, b ] ,
[ a, b ]
f ( x) = 0 .

f ( x) [ a, b ]
f ( x) x .
MathCAD,
.
.
8.1.1.
x3 + 3x 2 3 = 0 .
(8.1.5)
.
. 8.1.2 f ( x) = x3 + 3 x 2 3 , MathCAD. , : [ 3, 2 ] , [ 2, 1 ] , [ 0, 2 ] .
, , .

.
. 8.1.3 f ( x ) = x 3 6 x 2 + 21x + 52 ,
MathCAD. ,
[ 2, 0 ] . (8.1.6)
. ,
.

. 8.1.3. (8.1.7)
8.1.3.

, (
a , b ). ,
(8.1.7)
b a ,
.
[11] ,
, , ( ) .

. 8.1.2. (8.1.5)
8.1.2.
x3 6 x 2 + 21x + 52 = 0 .
97

(8.1.6)

8.1.3. , (8.1.5). -.


a , b
98

, f ( x) , .. f (a ) f (b ) < 0 .
- root_2 . 8.1.4. .
.
root_2 ( a , b , f , ) :=

8.1.4. root ( f ( x), x) ,


(8.1.6), (.
8.1.2). MathCAD,
. 8.1.5.

a+b
2

for k 1 .. 1000
ba <

break if
otherwise

a 3 := 1 a 2 := 3
3

a 1 := 0

a otherwise

f ( x ) := a 3 x + a 2 x + a 1 x + a 0

b if f ( a ) f ( ) < 0

a 0 := 3

a+b

( )
x 2 := root_2 ( 2 , 1 , f , 10 )
x 2 = 1.347
f ( x 2 ) = 1.485 10 8
x 3 = 0.879
f x 3 ) = 9.084 10 9
x 3 := root_2 ( 0 , 2 , f , 10 8 )
. 8.1.4.
(

x 1 := root_2 3 , 2 , f , 10 8

x 1 = 2.532

f x 1 = 1.219 10 8

, -
for, .
root. MathCAD ( )
root, , ..
root ( f ( x ), x ) root ( f ( x ), x, a , b) , f ( x ) ,
, x , , a , b .

,
, . 8.1.1.
root ( ) x .

99

100

. 8.1.5. 8.1.2

root:
root [11], ;
, root , TOL.
TOL , root , . TOL ,
root , . TOL
MathCAD, TOL := 0.01 . TOL ,
TOL ( 0.001);
,
TOL, ;
f(x) , root(f(x), x) r,
.
TOL. f(x) = 0 g(x) = 0,
g ( x) =

f ( x)
.
d
f ( x)
dx

8.1.5. root,
e x ax 2 = 0 1 10 1.
. 8.1.6.

solve_root ( a , x ) := root e x a x 2 , x
a := 1 .. 10

x 0 := 0

x a := solve_root

( a , x a 1)

xa =
0.704
0.54
0.459

0.6

0.408
0.371
0.344

xa
0.4

0.322
0.304
0.289

0.2

10

0.276

. 8.1.6.
polyroots. (8.1.2) n ( 5) polyroots. polyroots(v), v , n +1 , , .. v0 = a0 , v1 = a1 , ..., vn = an .
.
8.1.6. polyroots,
(8.1.6), (.
8.1.2). MathCAD,
. 8.1.7.
8.1.1. root,
:
3sin( x) + 0.35 x 3.8 = 0, x [ 2,3 ] ;

3x 14 + e x e x = 0,
101

x [ 1,3 ] .

102

MathCAD,
. .

a0

1.578
a1

v :=

polyroots ( v) = 3.789 4.313i


a2
3.789 + 4.313i
a

. 8.1.7.
polyroots

Given. Given, :

Given

(8.1.8)

Find Minerr

. 8.1.8. Find

, , . ,
.
Find ,
Find(x), x , . ,
Minerr(x), .
Find(x), Minerr(x) (
),
MathCAD.
Find(x) (. . 8.1.8)
. , -


Minerr(x).
8.1.1. Find(x), Minerr(x) Given
,
.
8.1.7. Given, 8.1.2 [ 5, 1 ] . . 8.1.9.
8.1.2. Given,
:
1 x tg ( x) = 0, x [ 0,1 ] ;

1 x + sin x ln(1 + x) = 0, x [ 0, 2 ] ;
3x 4 ln( x) 5 = 0, x [ 2, 4 ] .

103

104

a 3 := 1

a 2 := 6

a 1 := 21

().
.

a 0 := 52

f ( x ) := a 3 x 3 + a 2 x 2 + a 1 x + a 0

8.2.2.
() :

x := 2
Given
f ( x)

a1,1 x1 + a1,2 x2 + ... + a1,m xm = b1;

a2,1 x1 + a2,2 x2 + ... + a2,m xm = b2 ;

. . .

4 x 1

Find ( x ) = 1.578

an ,1 x1 + an ,2 x2 + ... + an ,m xm = bn ,

. 8.1.9. Given
8.2.
,
MathCAD .

8.2.1.
.
, .
,
2
x + y = 5

x + y 2 = 3

(8.2.1)

x = 2, y = 1 ,
( ).
, , :
;
.
105

(8.2.2)

n m .
Ax = b ,
(8.2.3)
A n m , b m .
, : ) A , .. n = m ; ) A , .. .
b n .

lsolve, : lsolve(,b),
, b .
8.2.1.
2 x1 + 12 x2 4 = 40;
x2 + 7 x3 = 4;
10 x1 + 5 x2 = 20.

(8.2.4)

lsolve, .
MathCAD
. 8.2.1. .

106

2 12 4
A := 0 1 7
10 5 0

x := lsolve ( A , b )

4
x= 4
0

40
b := 4
20

A = 810

0.000000
A x b = 0.000000
0.000000

A x b = 0.000000000

. 8.2.1.

. MathCAD, . 8.2.2, ,
(8.2.7),
.
2
x := 3 , 2.95 .. 6
y1 ( x) := x
y2 ( x) := 8 + 3 x
40

y1 ( x )
y2 ( x )

20

8.2.1. lsolve,
:
100 x1 + 6 2 2 3 = 200;

(8.2.5)
6 x1 + 200 2 10 3 = 600;
x 2 100 = 500.
1
2
3
10
x
+

=
12,

1
2
3

(8.2.6)
2 x1 + 10 2 + 3 = 13,
2 x + 2 + 10 = 14.
1
2
3
8.2.3.
MathCAD , MathCAD2001i 200.
.
, .
,
8.2.2.
8.2.2. :
y = x2 ;
(8.2.7)
y = 8 + 3x.

, :
(-2, 2),
(5, 20).
(.. ). Given, (8.1.8). , ,
. , .
Find , Find(x), x
, . < >.
.
:
;

107

108

20

10

. 8.2.2.

, ;

, Given
Find ( Minerr).
, , Find, . ,
f(a, b, c, ):= Find(x, y, z, ).

a, b, c,,
.

( ) ,
:
;
, ,
;
.
;
, . TOL.
TOL ( 0.001).

, Minner . Find .
8.2.3. Given,
(8.2.7) 8.2.2. . . 8.2.3.

109

x := 2 y := 2
Given
y

8 + 3x

sA := Find ( x , y)

1.702
2.895

sA =

x := 5
Given

y := 20

8+ 3x

x> 0

sB := Find ( x , y)

4.702
22.105

sB =

. 8.2.3. 8.2.2
8.2.1. Given,
:

sin x + 2 y = 2,
sin y + x = 0,4,


cos ( y 1 ) + x = 0.7. 2 y cos(x + 1) = 0.
sin( x + 1) + y = 0,8,
sin( x) 2 y = 1,
sin( y 1) + x = 1,3.

sin( y 1) + x = 1,3.

.
8.2.4. Minerr ,

110

x + y = 0.95;
( x 2 + 1) 2 + ( y 2 + 1) 2 = 5.5.
MathCAD . 8.2.4.
x := 0 y := 1
Given

( x 2 + 1 ) 2 + ( y2 + 1 ) 2
x+ y

5.5

0.95

z := Minerr ( x , y)

0.106
1.056

z=

z0 + z1 = 0.95
2

( z0 ) 2 + 1 + ( z1 ) 2 + 1 = 5.5

. 8.2.4. 8.2.4
9.
MathCAD

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

9.1.
MathCAD:
Maximize(f,< >) ;
Minimize(f,< >) , f ,
; < > ( ) , .
! Maximize, Minimize
( ) .
9.1.1. :

g ( x, y , z ) = 10 x 2 2 x + 36 + y 2 + 4 y + 3z 2 18 z .

(9.1.1)

x, y, z, g(x, y, z) .
MathCAD, ,
. 9.1.1.
2

g ( x , y , z ) := 10 x 2 x + 36 + y + 4 y + 3 z 18 z
x := 1 y := 1

z := 1

""

x
y := Minimize ( g , x , y , z )
z

x 1
y = 2
z

g ( x , y , z ) = 20

. 9.1.1. (9.1.1)

9.1.2. :

f ( u, v ) =

1
41 32u 16u 2 4v 2 + 20v
.
e
4
32
112

(9.1.2)

u, v, f(u,v) .
MathCAD, . 9.1.2.

.
2

4132 u16 u 4 v + 20 v

d ( u , v ) :=
u := 0

4
v := 0

b := 1

a + 2 b 5

b 1

a 0

a
a 0
=
F ( a , b) = 625
:= Maximize ( F , a , b)
b
b 2.5

u
u 1
:= Maximize ( d , u , v )
=
d ( u , v ) = 0.0795775

v
v 2.5

a + 2 b = 5

d ( u + 0.01 u , v + 0.01 v ) = 0.0795673

b = 2.5

d ( u 0.001 u , v 0.001 v ) = 0.0795774

. 9.2.1. (9.2.1)

. 9.1.2. (9.1.2)
9.1.1. :

(9.1.3)

.
9.2.
Maximize, Minimize,
Given (. (8.1.8))
, .
9.2.1. :

a
(9.2.1)
F(a , b) = 100(a b) 50
b

(9.2.2)
a + 2b 5; b 1; a 0.
a, b,
(9.2.1) (9.2.2).
113

Given

""

F ( a , b) := 100 ( a b) 50
a := 1

32

( x , y, z) = (cos ( x y) + cos ( y z)) sin ( x y z) .

MathCAD, , . 9.2.1.
, (9.2.2).

9.2.1.
. (
), Given, , .
Find, Minerr (
. 8.2.2).
9.2.2.
:

f ( x , y) = 100 ( y x 2 ) + (1 x ) 2 .

(9.2.3)

,
.
:
(9.2.4)
x 0; y 0; y 9 x .
MathCAD . 9.2.2.
114

f ( x , y ) := 100 y x
x := 2

y := 3

Given
d
f ( x , y)
dx
x 0

d
f ( x , y)
dy

y 0

y 9 x

x
:= Minerr ( x , y )

y
f ( x , y ) = 3.538 10

f x 1 , x 2 , x 3 := 4 x 1 + 3 x 2 + 2 x 3
x 1 := 1 x 2 := 1 x 3 := 1
Given

) 2 + ( 1 x) 2

x 1 20

x 3 20

4 x 1 + 3.4 x 2 + 2 x 3 340
4.75 x 1 + 11 x 2 + 2 x 3 700

x1 + x2 + x3
x1

x 1
=

y 1

. 9.2.2.
9.2.3 ( ). 100
( x1 , x2 , x3 ) 20 .
4, 3.4 2 ,
340 , 4.75, 11 2 ,
400 . , 4, 3 2 .
.
MathCad, . 9.2.3.

x 2 20

100

x 2 := Maximize

x3

f , x1 , x2 , x3

4 x 1 + 3.4 x 2 + 2 x 3 = 340
4.75 x 1 + 11 x 2 + 2 x 3 = 534
x 1 + x 2 + x 3 = 100

x1

56
x 2 = 20

x3

24

. 9.2.3.
9.2.4 ( ).
v :
2

N ( v ) = v + 2v1 v2 + 2v3 .

:
3

v
i =1

= 1, vi 0.2, i = 1,3.

MathCAD, , . 9.2.4.

115

116

2
N ( v ) := ( v ) + v 1
2

10.
MathCAD

v 2 := 1
Given

v>

1
5

v := Minimize ( N , v )
N ( v ) = 0.64

v = 1

0
v = 0
1

0.2
v = 0.6
0.2

MathCAD :
,
, .

10.1.

( -) (, ) ,
.

. 9.2.4.
9.2.1 ( ).
:
F ( x ) = 2 x0 + 9 x1 + 15 x2 .
:

x0 0; x1 0; x2 0;
7 x0 + 3x1 + x2 47;
0.5 x0 3x1 + 8 x2 25;
9 x0 + 2 x1 10 x2 29.

.
: (0, 13, 8).
9.2.2 ( ).
:

Q (u, v, ) = u(15 u ) + 5v ( 20 v ) + 2 (12 ).

u 0; v 0; 0;
3u + 2v + 4 100;
u + 7v + 90.

: (7.5, 10, 6).


117

MathCAD . . 10.1.1 (
d),
( x , ).
10.1.1

MathCAD

dnorm ( x, , )

( x )2
exp
, > 0

2 2
2

qnorm ( , , )

vnorm ( m, , )

x
x!

dpois ( x, )

qpois ( , )

( x ,
>0)

1
, x [a, b]
ba

rpois ( m, )
dunif ( x, a , b )
qunif ( , a, b )

0, x [a, b]

runif ( m, a, b )
dbinom ( x, n, p )


Cnx p x (1 p )n x , 0 x n

qbinom ( , n, p )
rbinom ( m, n, p )

118

. 10.1.1

MathCAD

2
0, x 0 ;
1
2

n/2

( 2)

x n / 2 1 ,
2

x>0

( 2 ) 1 + x 2
n
n (n )
2

qchisq ( , n )
rchisq ( m, n )

( n > 0 )

n +1

dchisq ( x, n )

n +1
2

dt ( x, n )
qt ( , n )

( n > 0 )

rt ( m, n )

MathCAD . x

p ( x ) , :
x

p ( x ) dx = .

. 10.1.1
MathCAD ( q )
.

rnd ( x ) ,
[0, 1].
10.1.1. . 10.1.1
MathCAD, : N
( 20, 100); 2 ( 10). 100.
MathCAD .
: ( ), , .. m .
.
N := rnorm ( 100 , 20 , 10)

i := 1 .. 100

:= rchisq ( 100 , 10)


40

( )
( )

mean N = 21.505
var N = 95.484

( )
var ( ) = 25.356
corr ( N , ) = 0.014

mean = 10.312

20

20
40

MathCAD .
, , , .
. 10.1.1
( r ),
.
m .

. 10.1.2 , .

119

120

cvar N , = 0.704

60

50

100

. 10.1.1.

X ,Y m ,
X Y .
10.1.2

MathCAD

mean ( X )

X

X

var ( X )

X
X

X , Y

side ( X )
median ( X )
mode ( X )
cvar ( X , Y )

10.1.2. . 10.1.1
MathCAD,
, 10.1.1.
MathCAD
( ). .
, {i }, i = 1, N

( N ). L+1 z1 < z2 < L < z L < z L +1 ,


:
z1 min {xi }; z L +1 max {xi } .
(10.1.1)

xi ,

[ zk ,

zk +1 ] ,

k = 1,K, L, nk .
,
L

=N.

wk =

nk
N

k =1

(10.1.2)

(10.1.3)
121

,
L

w
k =1

=1 .

(10.1.4)

, .. , k- zk +1 zk , p*k
wk
pk* =
, k = 1,K, L
(10.1.5)
zk +1 zk

pk* p( x * ),
(10.1.6)

x * [ zk , zk +1 ] .

[ zk , zk +1 ] p( x ) .

: [ zk , zk +1 ] ? L
L = [1 + 3.222 lg( N)] + 1, [Q ] Q . h = zk +1 zk , zk :
zk = min {xi } + h ( k 1), k = 1,K, L + 1,
(10.1.7)

max {xi } min {xi }


i
.
h= i
L
wk, pk* nk . -

nk {xi } MathCAD :
hist(int,X), histogram(int,X).
hist(int,X):
int (L+1),
zk , k = 1, K, L + 1. int ,
122

L, {zk } (10.1.7), (10.1.8);

{x i } .

X N,


{ nk }, k = 1,K, L.
histogram(int,X):
int (L+1),
zk , k = 1 ,K, L + 1. int , L, { zk } (10.1.7), (10.1.8);

N,
x
.
{ i}
L 2 , d k (

[ zk , zk +1 ] ,

k = 1, K, L, nk .
, histogram, d k nk , wk , pk .
10.1.3.
N , ,

10.1.1. N = 1000.
. 10.1.2
N , . 10.1.3 histogram L = 11. d k
,
solidbar ( ,
). , x = d k .

N := 1000 N := rnorm ( N , 20 , 10)

ORIGIN := 1

L := round ( 1 + 3.222 log ( N ) )

HN := histogram L , N
h := dN dN
2

L = 11

dN := HN

h = 5.909

pN :=

nN := HN

1
n
N h N

k := 1 .. L

0.04
pN
k
dnorm dN , 20 , 10 0.02

60

40

20
dN

20

. 10.1.2.
:= 1

ORIGIN

:= rchisq ( N , 10 )

N := 1000

L := round ( 1 + 3.222 log ( N ) )


H := histogram
h := d

(L , )

L = 11


d := H 1

h = 3.545

p :=


n := H 2
1
N h

k := 1 .. L

0.1
p

dchisq d

, 10 0.05

10

20
d

30

40

. 10.1.3. 2
123

124

10.2.
. . , x y
y = f ( x ) . f ( x ) , x, y

{xi , y% i }, i = 1, ..., n ,

y% i = f ( xi ) + i ,

i , .
S(x), f(x).
.
1. , S(x).
, S(x)
S(x)=0+1, 0, 1 . ,
.
(
{ xi , y% i } , i = 1,..., n )
. , , .
2. S(x)
.
F(a).
, :

S(x).
. 10.2.1, ,
{xi}, i=1, , n, Y ,
{ y% i }, i = 1, ..., n.
10.2.1

slope(X, Y)
intercept(X, Y)

S ( x ) = a0 + a1 x

S ( x ) = a0 + a1 x

a0 , a1 ,..., am


regress(X,Y,m)

line(X, Y)

S ( x ) = a0 + a1 x + L + am x m
m ( m 5 ).
,
(. 10.2.2)
0, 1

S ( x ) = a0 + a1 x

a1 , a2 , .., am linfit (X, Y,)

a11 ( x ) + a2 2 ( x ) + L + am m ( x )

1 ( x ),..., n ( x )

- (x),
linfit
a1 , a2 , ..., am
S(x). F(x,a)
- (m+1),
S(x)

(10.2.1)

S ( x )
, j = 1,..., m, m, a j

S(, x) S(x)
{aj}, j=1, 2,, M.


a j , j = 1,..., m (. 10.2.3)

F ( a ) = ( y% i S ( a , xi ))2 ,
i =1

MathCAD . MathCAD 125

genfit(X,Y,,F)

10.2.1. x a j ,

{ }

126

regress, interp(v, X, Y, x), v , regress (. 10.2.2). (. 10.2.1, 10.2.3).


10.2.2. linfit genfit , 1,, m linfit
, genfit , ( ) .
10.2.1.

f ( x ) = 2 + 0.5 x n + 1 { xi }

.
. 10.2.1.
ORIGIN := 0 n := 20 a0 := 2 a1 := 0.5
i := 0 .. n
:= 0.1
xi := 2 + 0.2i

yi := a0 + a1 xi

:= rnorm( n + 1 , 0 , max( y))

A := line x , y

2.0757
0.4218

y := y +

S ( x) := A0 + A1 x

= 0.139

2
3
x :=
4
5

0.8

3.5
8
y :=

15
19

15

ORIGIN := 0

i := 0 .. 5

8.15

v2 := regress( x , y , 2)

coef2 := submatrix( v2 , 3 , 5 , 0 , 0) coef2 = 7.995

0.634

S2 ( x1) := interp( v2 , x , y , x1)

v3 := regress( x , y , 3)

S3 ( x1) := interp( v3 , x , y , x1)


coef3 := submatrix( v3 , 3 , 6 , 0 , 0)
20

7.133

11.231
coef3 =
5.734

0.606

yi
S2 ( xi)
S3 ( xi)

10

10

A=

xi

yi
y

, . 10.2.2. , m = 3
, .. { y% i } .

. 10.2.2.

S( xi)

10.2.3. , . 10.2.3 ( X Y ),
2

xi

. 10.2.1.
10.2.2. ,
. 10.2.2,
Sm ( x ) = a0 + a1 x + L + am x m m = 2 m = 3.
127

S ( x ) = exp( a0 + a1 x + a2 x 2 ) .
MathCAD,
. 10.2.3, genfit.
- ( x, a ) , ,
128

a0 , a1 , a2 . y% i .

0.4
11.2
1
5

X := 1.4 Y := 3
2
6

4
2
1
a0 := 0
1

2.82
A = 1.194
0.178

expfit(X,Y,ao)

a0+a1 x+a2 x2
e

a0+a1 x+a2 x2
e

( x , a) :=

2
ea0+a1 x+a2 x x

a0+a1 x+a2 x2 2
x
e

A := genfit( X , Y , a0 , )
i := 0 .. 4

1, 2, 3 -

S(z)

lgsfit(X,Y,ao)

lnfit(X,Y)

S ( x) := ( x , A) 0

z := 0.2 , 0.25.. 4.25

logfit(X,Y, ao)

3) , ..
1, 2, 3

S ( x) =

1
. ( 3) 1 + a2 e a 3 x

1, 2, 3
1, 2

S ( x ) = a1 ln( x ) + a2

1, 2, 3
S ( x ) = a1 ln( x + a2 ) + a3 . (

pwrfit(X,Y,ao)

S ( x ) = a1 2 + 3 . ( 3)

sinfit(X,Y,ao)

1, 2, 3

S ( x ) = a1 Sin( x + a2 ) + a3 . (
3) 1, 2, 3

Xi , z

. 10.2.3.

10.2.4. , . 10.2.4,
S ( x ) = a1e a2 x + a3 .
MathCAD, . 10.2.4.

, . 10.2.1,
,
. . 10.2.2 .
10.2.2

+ a3 . (-

3) 1, 2, 3

10

a2 x

1, 2, 3

15

Yi

S ( x ) = a1e


129

130

6.3

1.8
11.6

29.1
Y :=
27.3

40.5
50.4

96.7


X := 3

3.756
A = 0.453
3.019

Yi
S ( z)

4
a0 := 1
1

interp(v,X,Y,z),
z.

ORIGIN := 0

10.2.5. . 10.2.5 MathCAD,


loess(X,Y,d)
d = 0.8 d = 3 . , d = 3 .

A := expfit ( X , Y , a0 )
S ( x) := A 0 e
i := 0 .. 7

A1 x

+ A2

z := 0 , 0.05 .. 7.5

ORIGIN := 0 n := 20

150

a0 := 2 a1 := 0.5
i := 0 .. n

100

xi := 2 + 0.2 i


:= 0.1
2
y i := a0 + a1 xi + a2 xi

( )

:= rnorm ( n + 1 , 0 , max ( y ) )

50
0

a2 := 0.3

Xi ,z

= 0.152
y
v2 := loess x , y , d2
d1 := 0.4
d2 := 3.2 v1 := loess x , y , d1
S1 ( x1) := interp v1 , x , y , x1
S2 ( x1) := interp v2 , x , y , x1

131

. 10.2.4.
. 10.2.1 10.2.2 , ,
. , ,
. .

MathCAD loess(X,Y,d),
. X, Y
, d > 0
(
0.75 0.85). d, . d
loess(X,Y,d) regress(X,Y,2). loess(X,Y,d) v,

y := y +

yi
y

2
i

S1 ( xi)
S2 ( xi)

xi

. 10.2.5.
.
,
.
. MathCAD 132

, smooth (). :
medsmooth(Y,m) Y, n m (m m < n ). , n Y;
supsmooth(X,Y) Y, n , xi , X. k xi k
. X
;
ksmooth(X,Y,b) Y, n , xi , X.

""
i := 0 .. n

""

xi x j
) y% j
b
j =1

1
t2
yi = n
,
h(t ) =
.

exp

2
xi x j

2
(0.37)

2
0.37

)
h(

b
j =1

h(

, yi y% j

:= rnorm ( n + 1 , 0 , max ( y ) )

:= 0.2

(
)
Y2 := ksmooth ( x , y , 9 0.1 )

Y1 := ksmooth x , y , 3 0.1

Y1 y
y

Y2 y

0.8
yi
y

0.6
i

0.4

Y1i

0.2
0
-0.2

xi

. 10.2.6. ksmooth

,
b , y% j .
10.2.6. . 10.2.6 MathCAD,
( 38%)
ksmooth b ( b =0.3
0.161 b =0.9

0.141).
133

y := y +

ksmooth

Y2i
n

y i := f ( xi )

xi := i 0.1

134

MathCAD
. ,
. , .
[ 2, 3, 9,10 ].
( ),
MathCAD -
.

1.
2.
3.

4.
5.
6.
7.
8.

9.

.. . /
.. . .: - , 2001. 296 .
.. MathCAD2000: / .. .
: , 2000. 596 .
.. MathCAD 8 Professional ,
Internet / .. , .. . .: ,
1999. 512 .
.. Matlab: / .. . :
, 2001. 560 .
.. Matlab
5.x.: 2- . . , 1999. 672 .
.. Mathematica 4: / .. .
: , 2000 482 .
.. Maple V R3/R4/R5 /
.. . .: , 1998. 381 .
.. MathCAD. / .. ,
.. . : - , 1999. 32
.
.. MathCAD2001 / .. .

.: -, 2002. 459 .
10. .. MathCAD / .. . .:
- , 2001. 196 .
11. .. /
.. , .. . .: , 1970. 486 .

135

136