Professional Documents
Culture Documents
Preview Mathematica και εφαρμογές για επιστημονες και μηχανικούς
Preview Mathematica και εφαρμογές για επιστημονες και μηχανικούς
KAI
EAPMOE
IA MAHMATIKOY, YIKOY KAI MHXANIKOY
E-BOOK
: T
2001
:
:
- :
T
:
:
E:
:
E K
2001
2004
(.E.K.)
, (.E.K.)
(.E.K.)
YXNO
B A
ISBN-10: 960-524-141-2
ISBN-13: 978-960-524-141-4
EPIEXOMENA
xiii
. MATHEMATICA
1.
A 3
: T Mathematica 03
0. : E
Mathematica. 04
1. : N 08
2. O, :
Integrate, Differentiate Sum 13
3. : Plot
ParametricPlot 17
4. A :
Solve DSolve 22
5. A : NSolve, NDSolve,
NIntegrate .. 26
6. P : FindRoot
FindMinimum 30
7. : = := 32
8. A : Simplify
FullSimplify 35
9. : Table
ListPlot. H 36
10. : O
TrigExpand, TrigReduce, Factor, Expand, Series .. 42
EPIEXOMENA
viii
2.
49
1. M Mathematica Mathematica :
49
2. M : T
54
3. X : 61
4. 65
3.
73
1. A .
Mathematica : Do 74
2. : Det[A], Inverse[A],
Eigensystem[A], MatrixPower[A,n], MatrixExp[A] 81
3. T : If Which 85
4. : ImplicitPlot,
ContourPlot, Plot3D ParametricPlot3D 88
5. :
PlotVectorField PlotGradientField 93
6. : 97
7.
Solve. M 107
8. .
Mathematica 118
B. MH PAMMIKA AINOMENA
MATHEMATICA
4. .
A 129
1. : E
130
A. 130
B. Mathematica 131
2. : K
138
EPIEXOMENA
ix
A. 138
B. Mathematica 140
5. . M
157
1. :
158
A. 158
B. Mathematica 160
2. : E
; 164
A. 164
B. Mathematica 173
3. : M
185
A. 185
B. Mathematica 188
6. `` . T
195
. : 195
. Mathematica 198
E : : T
207
. MAHMATIKE MEOOI
MATHEMATICA
7. Fourier.
219
. 219
. Mathematica 223
1. Fourier 224
EPIEXOMENA
2. Fourier 228
3. M FourierTrigSeries:
Fourier 231
4.
234
8. . H
243
. 243
.1. 243
.2. 246
: Mathematica 250
.1. 250
.2. 257
9. . M
271
. 271
. Mathematica 274
1. 274
2. 276
3. Legendre 280
4. Bessel 283
. H MATHEMATICA
A POPAMMATIMOY
10. .
291
291
: 295
1. : Function 295
2. :
Nest, NestList FixedPoint 297
3. Map Apply:
299
EPIEXOMENA
xi
4.
301
: 308
5. : Table Range 308
6. : Length .. 309
7. : Part s[[n]] 309
8. : Flatten 311
9. :
Union Count 312
10. : Sort 314
11. : Random 314
12. : Select 315
13.
Solve. 317
14. : Append 319
11. , , .
325
1. (;) :
CompoundExpression 326
2. : If, Which
Condition(/;) 327
3. 327
4. : , Do, While
For 329
5. :
Module 335
12. M .
339
1. _
339
2. :
Cases 340
3.
: x_Head
x_/;condition 343
xii
EPIEXOMENA
4.
: 347
5. :
350
359
Mathematica 361
Mathematica 365
368
369
POOO
, ,
Mathematica, Maple Matlab ( )
, .
.
.. Amazon.com Mathematica
, .
. , ,
, ,
.
. ,
,
. :
.
.
. ,
;
.
. ( -
xiv
POOO
) .
, , ( )
.
O , , .
. (
Mathematica)
, .
( Mathematica) , . , Mathematica,
Fourier, ,
Mathematica
.
Mathematica , .
Mathematica ,
: Mathematica
. :
C, Mathematica , , (Procedural programming).
, ,
: , .
( ) ,
POOO
xv
Mathematica. . Mathematica .
,
, Mathematica
.
.
, .
:
( )
. , ,
. , , Fourier, ,
. ,
Mathematica, ,
.
, E 1
Mathematica
M , ,
Mathematica (M ).
, , .
, M ( E 1)
xvi
POOO
E 4, Mathematica ,
, .
, .
,
Mathematica
C.
, ,
, .
(Windows, Macintosh Linux), Mathematica
. ,
, (Windows) ... Macintosh.
. (
) Mathematica,
: ,
.
. .
, .
, .
!
..., . , . . .
, 2001
M A
EIAH
TH MATHEMATICA
....
: Mathematica
, Mathematica
``''
.
.
: Mathematica
.
: Mathematica
'
' ,
. ,
, Mathematica
.
`` ''
,
Mathematica
,
.
Mathematica
.. FORTRAN C
1: - -
. 0
,
, .
0: ``'':
Mathematica.
Mathematica (
`` ''!) ``''
`` '' Mathematica.
Mathematica
( ),
( ) . ( `` '',
.)
Mathematica (
) ``'' ,
Untitled-1, ,
. Mathematica
, `` '' Start
Programs
, ( ) Mathematica
. ``''
Mathematica .
1527 243. '
Mathematica ,
1527 243
(1)
,
,
( )
Shift *
Shift .
0: ``''
( )
. ,
, Shift .
(1)
Shift + Enter Shift
Enter ( -) :
In[1]:= 1527 * 243
Out[1]= 371061
1: - -
( )
( ,
) Save
Dont'Save ( `` '' `` '' )
Cancel,
.
Don'tSave,
. Save, :
,
. ,
``My
Documents'' ,
Untitled-1 ' .
.
Beginner.nb ,
Untitled-1 .
0: ``''
My Documents
Mathematica ( My Documents,
),
, Save in Mathematica. Save
`` '' Beginner.nb.
, ,
Mathematica
. ,
: y
My Documents
. , ``'',
,
File / New / Folder
1: - -
File / Open
.
,
Open .
,
.
Mathematica
File Edit Cell Format Input Kernel Find Window Help
:
) File: ,
,
, Mathematica.
) Edit:
.
) Help: Mathematica
.
File
, Exit, Mathematica
'
. Start/ShutDown
( ) `` '' .
-
Mathematica.
1: : N
Mathematica
sin x x 0:4.
sin0:4 Shift + Enter.
.
Mathematica ' ,
. , , sin x, cos x, tan x,
exp x, ln x, Mathematica
1: .
Sin[x],
Cos[x],
Tan[x], Exp[x],
Log[x]
'
, ,
x.
,
,
Mathematica.
.
Mathematica , ..
(x+1)(x-3)Exp[-x]
f g
,
(list), Mathematica.
:
MATHEMATICA
xn
x^n
Exp[x], Log[x]
Abs[x]
x
( 1 x > 0, 1 x < 0)
Sign[x]
ArcSin[x], ArcTan[x]...
10
1: - -
``'' e, , 1 i
p
1
``''
MATHEMATICA
Pi
Infinity
,
Mathematica :
In[1]:= Sin[0.4]
Out[1]= 0:389418
In[2]:= Log[1.5]
Out[2]= 0:405465
In[3]:= Cos[2]
Out[3]= Cos2
``'' Out[3] , ,
Mathematica .
' 2 2.0,
In[4]:= Cos[2.0]
Out[4]=
0:416147
.
, , , , e .. ,
Mathematica .
,
.
, Mathematica ,
(, , )
, ,
.
1: .
11
.
.
N (
Numerical) :
In[5]:= N[Sin[3]]
Out[5]= 0:14112
16
,
In[6]:= InputForm[%]
Out[6]//InputForm = 0:1411200080598672
% Mathematica .
Out[n] %n, n
. ,
Out[2]
In[7]:= Exp[Out[2]]
Out[7]= 1:5
( Exp[%2])
Exp[%2]
, , . N
N[expr, k]
expr ( expression)
k ,
. ,
, 100 ,
Cos =5
p
2 50
.
12
1: - -
In[9]:= N[Cos[Pi/5],50]
Out[9]= 0:80901699437494742410229341718281905886015458
990288
In[10]:= N[2^(1/2),50]
Out[10]= 1:4142135623730950488016887242096980785696718
753769
, , ^n
, ^
n. ^ (
)
. , ,
^
. , ,
p
fx .. fx x2 1
sin x e x
fx fx
Mathematica.
.
nn
nn
1.
:
) sin 5=2
) arctan 2
) 2100
) 50!
) e50
) loge
) cosh 10
) log sinh 10!
p
) 3 100
p
p
) 1 2 .
;
, Mathematica
.
2.
:
)
)
)
)
)
p
3
3
log
e
tan 2
: 100
: " 30
"
: " 50
"
: " 100
"
: " 20
"
"
"
"
"
1: .
13
3.
1, Mathematica
, .. 2100 ,
.
;
4.
Mathematica ,
, ,
, , :
)
)
)
)
cos =6
sin =4
sin =12
tan =12
)
)
)
)
ei
ei=2
ei=3
ei=6
Re z Im z
, , z.
2: , :
Integrate, Differentiate
Sum
,
Mathematica
. ,
:
fx x
a b.
D[f[x], x]
fx x.
fn (
n) n nmin
nmax .
(Differentiate)
,
[...]
(, , ..).
14
1: - -
'
. Mathematica ,
.
.. ``'' :
.
Mathematica
R 2
. 0 x2 sin x dx
In[1]:= Integrate[(x^2)*Sin[x], {x, 0, 2Pi}]
Mathematica ``'',
, Shift+Enter
Out[1]=
42 :
In[2]:= Integrate[(x^3)*Exp[-a*x], {x, 0, Infinity}]
Out[2]= If Rea > 0;
R1
0
6
;
a4
x3 e
Z
ax
1
dx ``''
ax
x3 dx
``'' , ,
, , .
,
Rea a > 0 ,
( ),
.
,
Integrate [f[x], x]
, If (Out[2])
Mathematica .
. , ,
, , .
15
x (
) , fx
a; b; . . .
.
, ,
In[3]:= Integrate[x^3*Exp[-a*x], x]
Out[3]= e
ax
6
a4
6x
a3
3x2
a2
x3
a
Mathematica
.
.
D[f[x], x]
D[f[x], {x, k}]
( fx k )
, ,
fx x2 ln x
In[4]:= D[(x^2)*Log[x], {x, 3}]
Out[4] 2=x.
. :
In[5]:= Sum[1/n^2, {n, 1, Infinity}]
P
2
( ) 1
n1 1=n .
2
=6,
. . . .
Mathematica
In[6]:= Sum[1/n^3, {n, 1, Infinity}]
16
1: - -
. Zeta [3]
4 =90 .
Zeta,
( ), Zeta
[3] x 3.
``'' Zeta
[3.0] , ,
3
.
1.20206,
.
P
Mathematica
1
k
n1 1=n k
( ) .
1.
:
Z 1
Z 1
2
)
xe ax dx
)
x4 e ax dx
0
x2 cos kxdx
)
Z
)
2.
1
1
cos xe
x2
dx
dx
p
2
2
1 x a
dx
x2 a2 2
:
) xe
) sin ex
) x ln x
) tanh x.
``''
(Zeta) Riemann s > 1
s
, ,
1
X
1
s
n
n1
1
X
1
3 Zeta3.
3
n
n1
3.
17
:
)
)
1
X
1
n6
n1
N
X
N
X
n3
n1
n2
n1
N
X
n1
1
X
1
n!
n0
1
X
n0
n!2
3: : Plot
ParametricPlot
Plot ,
Mathematica.
Plot[f[x], {x, a, b}]
fx x a b.
In[1]:= Plot[(Sin[x])^2, {x, 0, 4Pi}]
sin x2 .
Out[1]=
Graphics
18
1: - -
Plot
..
(..
)
( ,
, ,
..).
PlotRange -> {ymin ; ymax }
y (Range)
.
:
In[2]:= Plot[Tan[x], {x, 0, 4Pi}, PlotRange -> {-4, 4}]
, , ``'' -> - ()
> ().
Out[2]=
Graphics
,
PlotRange, .
PlotRange -> All
Plot
, ,
Plot
.
3: PLOT PARAMETRICPLOT
19
fx e 10x
0 < x < 1 PlotRange.
In[3]:= Plot[Exp[-10x],{x,0,1}]
Out[3]=
Graphics
Out[4]=
Graphics
Out[3], Plot
e 10x ``''
. .
, PlotRange -> All Plot
,
.
.. fx, gx .. ,
20
1: - -
,
.
,
ParametricPlot[{ f[t], g[t]}, {t, a, b}]
`` '' x ft y gt. ,
Out[5]=
Graphics
, .
Parametric
. ,
ft gt t x.
:
Mathematica. ,
, .
, ,
, '
.
PlotStyle
.
,
3: PLOT PARAMETRICPLOT
21
Out[6]=
Graphics
1.
,
:
22
1: - -
) xe
) x2 e
)
2.
x > 0
) sin x e
x2
1
x2
) x2
2
x > 0
x
x > 0
1
3 < x < 3
) tan2 x:
( ) :
) cos x; x x > 0
) tan x; 4
) e x ; x2 x > 0
) sinh x;
) tanh x; 2x x > 0
3.
) 4
x x > 0
1
cosh x
1 < x < 1
x2 ; ex 1 < x < 1:
:
) x cos 2t; y 3 sin 2t
) x e
t=10
cos t; y e
) x cos t; y sin 4t
) x cos t; y sin9t=2
t=10
sin t
) x cos t; y cos 3t
) x cos t; y cos3t=2:
``''
, ``''. ' ; ``'';
,
;
4.
, In[5]
.
,
Mathematica AspectRatio.
, .
4:
: Solve DSolve
Solve DSolve ,
,
Mathematica.
23
4: SOLVE DSOLVE
1. x3
3x2
x 3 0.
2. y00
4y0 5y 0.
e2x C1Sinxgg
3. y00 y x
y0 1, y0 0 0.
In[3]:= DSolve[{y''[x] + y[x] == x, y[0] == 1,
y'[0] == 0}, y[x], x]
Out[3]= ffyx ! x Cosx
Sinxgg
.
: Mathematica `` ''
. == =. ' :
, Mathematica
( =) ( ==),
,
.
: DSolve
yx y. , y
x. , ,
yx x. (
,
Mathematica .)
: Mathematica
C1; C2; . . . ; Cn.
, , , .
: , DSolve
DSolve[{Ejsvsh; Arxikw Synukew}, y[x], x]
,
.
24
1: - -
, ..
( )
x_ F x; y;
y_ Gx; y;
x0 a;
y0 b
Mathematica
DSolve[{x'[t]==F[x[t],y[t]], y'[t]==G[x[t],y[t]],
x[0]==a, y[0]==b}, {x[t], y[t]}, t]
x_ y;
y_
x;
x0 1;
y0 0
Mathematica
In[4]:= DSolve[{x'[t] == y[t], y'[t] == -x[t], x[0]==1,
y[0] == 0}, {x[t], y[t]}, t]
Out[4]= ffxt ! Cost; yt !
Sintgg
, .
,
,
( In[4] ``'' )
``''
, ``'' ( ), .
:
( ) ( (cell)
) In[4], ,
. Edit (
)
Copy (``'') ``'' . ,
In[4]
``'' .
Edit Paste (``''),
In[4] .
x_ y, y_ x
x0 a, y0 b,
25
4: SOLVE DSOLVE
aSintgg
``'' , ,
. ,
, In[4] Out[4] , ( )
( ``'' In Out)
Edit Clear, In[4] Out[4]
,
.
,
Edit/Clear.
Clear Cut,
. Cut ``''
( ) , Clear,
Clipboard (``'')
Paste. Copy
Clipboard ( ),
Cut, ,
.
``'' , ``''
`` '' (scroll bar)
,
&
&
.
,
.
1.
, , :
) 2x3
) x
x2
2
2x 1 0
5x 8x
60
) x4
5
10
4
) x x x3 x2 x 1 0.
,
.
26
1: - -
2.
, Mathematica,
) y00 y x3
) y000
2y00
4y0 8y cosh x
1y 0
. Mathematica () ();
3.
x2 y0 xy e
xy
y1 0
,
. 1 < x < 20.
4.
y0 1 y2 , y0 1 .
y0 a.
5.
:
) x_ 3x
y_ 2x
2y;
t
y;
x0 1;
y0 1
) x_ x y e ;
y_ 4x y 3;
x0 0;
y0 1
) x_ y z 1;
y_ x z 1;
z_ x y 1;
x0 y0 z0 0.
5: : NSolve, NDSolve,
NIntegrate
..
Solve DSolve
.
( , ,
), NSolve
NDSolve , , N
Numerical, Numerically
. , NIntegrate NSum
Mathematica ``Numerically''
( ) . :
In[1]:= NSolve[x^3 + 3x^2 + x + 1 == 0, x]
Out[1]= ffx !
fx !
2:76929g; fx ! 0:115354
0:115354 0:589743Ig :
0:589743Ig;
27
, ,
,
I .
N, 1,
N. . .
.
NDSolve ,
,
In[4]:= NDSolve[{y'[x] == 1 - y[x]^2, y[0] == 0},
y, {x, 0, 2}]
Out[4]= ffy ! Interpolating Functionff0:; 2:gg; < >gg
:
: 3, y, yx
DSolve,
,
`` ''
.
,
y (pure function),
.
: , x
, ,
``'' x ,
(y yx). Mathematica
, #
x &
. (pure functions) DSolve, y yx.
7 3.
28
1: - -
, .
Out[4]
,
In[5]:= Plot[y[x] /. %, {x, 0, 2}]
' /.
, ' , % ,
, . y[x]/.%
, , y ``''
NDSolve
``'' x,
y[x].
/.
. Out,
Solve ..
x 3 , yx
.
x ! 3, yx ! ``'' y ! ``'',
/.
yx
.
Out[5]=
Graphics
,
, ``'' yx
,
%,
- . , ,
y1 =: % % 0.76159,
,
y tanh x, .
29
%,
Out[n], .. y[x]/.Out[n]
y[x]/.%n, (.. sol( solution))
NDSolve
sol=
= NDSolve[............]
, sol %
,
sol Out
. , ,
Plot [y[x]/.sol,{x, 0, 2}]
y[a]/.sol
a .
``'' Out [4] Mathematica,
InterpolatingFunction
x f0:; 2:g ,
<> y
. .
.
1.
:
Z 1
Z
x
ecos x dx
)
ee dx
)
0
Z
)
Z
)
2.
sinsin xdx
x4
dx
Z
)
1
X
1
3=2
n
n1
sin x e
x2
dx
cos x
dx:
cosh
x
1
1
X
ne
n1
:
) x5 2x2
4.
:
)
3.
50
) x7
3x6 4x3
7 0:
30
1: - -
5.
y3 ,
() ( )
. ; ``'' ,
y0 a .
Mathematica
x_ x4
3y;
y_ yx
1;
x0 2;
y0 3
5
0 5
t 5, xt
yt x y
x xt y yt.
6: :
FindRoot
FindMinimum
(' )
( ) fx FindRoot
FindRoot[f[x]==0, {x,x0 }]
x0
Newton: x0 ,
x ``'' fx.
fx
``'' x, x1 , '
.
( fx),
x0 ; x1 ; . . . xn ; . . . ' .
fx ,
, ,
x0 . Plot fx ,
`` '' ,
.
, xn
xn1 xn
fxn =f 0 xn , lim xn x,
n!1
,
xx
fx=f 0 x ) fx 0, x fx.
6: FINDROOT FINDMINIMUM
31
() cos x x
x cos x
In[1]:= FindRoot[Cos[x]==x,{x,1}]
Out[1]= fx ! 0:739085g
.
fx , , f 0 x ,
, FindRoot.
Mathematica
FindMinimum[f[x],{x,x0 }]
fx
x0 ( ,
FindRoot).
() , , ,
(FindMinimum) fx fx.
2
fx xe x x > 0,
Plot[x*Exp[-x^2],{x,0,3}]
x 0:7. x 1
FindMinimum :
In[2]:= FindMinimum[-x*Exp[-x^2], {x, 1}]
Out[2]= f 0:428882; fx ! 0:707107gg
. ,
( )
. : ,
Mathematica .
1.
,
:
32
1: - -
x
) x; e
) x2 ; e
) x; 3 cos x ()
x > 0
x
) x2 ; sin x x > 0
x > 0
) 2x; cos x ()
2.
) 2x; tan x
x > 0:
:
) xe
3
x2
;
x
) x =e
1<x<1
1;
x>0
x2
) x 1e
) x
1<x<1
2
1=x 1 ;
1 < x < 1 :
7: : = :=
Mathematica .. Integrate, Plot,
FindRoot .. ,
.
:
fx
fx :
:
`` '' .. , ,
, (
), .
. ,
, ``''
In[1]:= f[x_] = Sin[x]*Exp[-x^2]*(1 + x^2)^(1/2)
p
2
Out[1]= e x 1 x2 Sinx
, .., x
x 3. ,
.
7: : = :=
33
2 p
fx sin x e x 1 x2 , ,
fx.
, .
x x
, ,
.
, ``''
. '
,
..
,
Clear[f]
, , f : f . . . . Mathematica
.
?f ( : f;)
,
In[2]:= ?f
Global f
nnnn
f[x_]= e
x2
p
1 x2 Sinx
`` '' f
In[3]:= Clear[f]
f;
Mathematica Global f,
f f
Mathematica. ( `` ''
nnn
34
1: - -
'
Remove[f].)
. . .
.
1.
( = :=)
:
sin x
) fx p
1 x2
sin x
) fx D p ; fx; 5g
1 x2
) fx; N
N
X
k0
2.
1
sin 2k 1x .
2k 1
0 < a < 2.
3.
``''
, n 1; 2 3;
`` '' ;
.
4.
fx Mathematica
f[x_]=Sin[x]*Exp[-x]
, f0 x Shift+Enter;
f00 x, f000 x ..
;
7: : = :=
35
8: :
Simplify
FullSimplify
Simplify ,
,
Mathematica ..,
, ,
.
In[1]:= D[x^x, {x, 5}]
Out[1]
.
In[2]:= Simplify[%]
% , ,
Out[2]= x
4x
x 6x2 x3 Logx
.
FullSimplify
,
.
Simplify FullSimplify
,
:
In[3]:= Integrate[(x^3)*Sin[n*x], {x,0,Pi}]
Out[3]=
6 n2 2 Cosn 3 2 n2 2 Sinn
n3
n4
1n 6 n2 2
n3
36
1: - -
Element[n,Integers] ( n
) Simplify
, n 2 Integers, '
2
``''
``''
( 2.3).
(n 2 Integers) Simplify
x 2 Rationals, x 2 Primes, x > 0, x < 0, x 2 Reals, x y
..,
.
1.
) D[x^3*Sin[x^2], {x,5}]
) D[Exp[-x^2]*Cos[x], {x, 6}]
Simplify
.
2.
) Integrate[x^4*Sin[n*x], {x, 0, Pi}]
) Integrate[x^6*Cos[n*x], {x, 0, Pi}]
n .
9: : Table
ListPlot.
(.. ) n.
Table
Table[f[n],{n,1,N}]
ff1; f2; . . . ; fNg
9: TABLE LISTPLOT
37
() fn
n. ListPlot ( )
:
ListPlot[Table[f[n],{n,1,N}]]
fn n.
:
In[1]:= Table[n!, {n, 1, 10}]
Out[1]= f1; 2; 6; 24; 120; 720; 5040; 40320; 362880; 3628800g
, Out[2],
Out[2]=
Graphics
, ListPlot '
y1 ; . . . yn
x 1; 2; . . . ; n; . . ..
ListPlot[{y1 , y2 , . . .}]
}]
Table.
, Table
38
1: - -
fn nmin nmax
dn. dn
Table[f[n], {n,nmin ,nmax }]
.
:
In[3]:= Table[n^3, {n,1,10,3}]
Out[3]= f1; 64; 343; 1000g
In[4]:= Table[n^3, {n,4,8}]
Out[4]= f64; 125; 216; 343; 512g
n3
4 8 ListPlot[%] ,
, ListPlot[{64,125,216,343,512}] ,
, ListPlot
Out[4] ' ,
. , , n
.
n 1, n 2, n 3 ...
,
fn fnmin ; nmax g,
ListPlot
fn n .
fn; fng n
. , , Mathematica
ListPlot
Table .
ListPlot[{{x1 ,y1 }, {x2 , y2 }, ..., {xn , yn }}]
``'' xi ; yi , i 1; . . . ; n,
Table[{f[n],g[n]}, {n, nmin , nmax }]
ffn; gng n.
fn
fnmin ; nmax g
9: TABLE LISTPLOT
39
.
Table
fx; n
. ,
,
Plot[Table[f[x, n], {n, 1, N}], {x, a, b}]
f1 x fx; 1 . . . fN x fx; N.
: Table
Plot Table fxi ; n; fn; 1; Ng
xi a; b
. Table ,
ffx; 1; . . . fx; Ng
`` '' . '
Table Evaluate :
.
:
In[5]:= Plot[Evaluate[Table[Tanh[n*x],
Plot[Evaluate[Table[Tanh[n*x], {n, 1, 5}]],
{x, -2, 2}]
Out[5]=
Graphics
40
1: - -
In[5]
Plot[{Tanh[x], Tanh[2x], Tanh[3x], k:lp:},{x, -2, 2}]
Evaluate Table.
,
.
, , (List)
Mathematica.
``'' .. fa; b; c; . . .g
. , .., a; b; c; . . . , Sin fa; b; c; . . .g
a; b; c; . . . ( ),
x, Integrate [{a[x], b[x], c[x],
...}, {x, xmin , xmax }] D[{a[x],b[x],c[x],...}, {x,k}]
ax,
bx, cx .. Table
[f[x,n], {n,1,N}] ffx; 1; fx; 2; . . . ; fx; Ng
, ,
Integrate [Table[f[x,n], {n,1,100}], {x,xmin ,xmax }]
``''
fn x !
,
.. . , ,
A={{a,b},{c,d}}
a b
2 2 A
c d
``'' : n n A
.
, ,
x ! a, x ! b ..
Solve. Out[1]
4 (. 23)
{{ x ! -1}, { x ! 1}, { x ! 3}}
, .
-
9: TABLE LISTPLOT
41
( ) fx ,
, /.
:
In[6]:= f[x]/.{x -> a}
Out[6]= fa
In[7]:= f[x]/.x -> a
Out[7]= fa
In[8]:= f[x]/.{{x -> a}, {x -> b}}
Out[8]= ffa; fbg
'
.
, y[x]/.% y[x]/.sol
DSolve NDSolve
. % sol
Out
{y[x] -> f[x]}, f[x]
y[x]/.sol y[x]/.{y[x] -> f[x]}
y[x]
.
:
y[x]/.sol y[x]/.% sol %
Out,
, , . '
3.7.
1.
Mathematica
) .
) fx xe x
0 < x < 4 x 0:1.
Out
( 3.7),
.
42
1: - -
2.
fn n3 n 4 n 8.
3.
4.
5.
6.
) fn x exp nx;
n 1; . . . ; 5;
4<x<4
) fn x sin nx;
n 0; . . . ; 3;
1 < x < 1.
1().
R1
4
0 xn e x dx n 1
10.
Mathematica , ,
. ,
.
Mathematica ,
, A ffa; bg; fc; dgg 2 2
A ac db .
Mathematica
.
, s f2; 5; 9g
: ) Sin s, ) s2 , ) Log s.
fx fExp x; x Exp xg Integrate [f[x],{x,0,Infinity}];
10: :
, ,
, .
``'' .. Mathematica,
Integrate[f[x], x]
. ( ) Mathematica
.
``'' ..
Mathematica
.
10:
43
TrigExpand TrigReduce,
:
In[1]:= TrigExpand[Sin[x+y]]
Out[1]= CosySinx CosxSiny
In[2]:= TrigExpand[Cos[2x]]
Out[2]= Cosx2
Sinx2
In[3]:= TrigReduce[Cos[x]^2]
Out[3]=
1
1 Cos2x
2
In[4]:= TrigReduce[Sin[x]^3]
Out[4]=
1
3Sinx
4
Sin3x
In[5]:= TrigReduce[Cos[x]*Cos[y]]
Out[5]=
1
Cosx
2
y Cosx y
TrigExpand ( x y)
, TrigReduce :
.
:
In[6]:= TrigExpand[Tan[3x]]
Out[6]=
3Cosx2 Sinx
Cosx3
3CosxSinx2
Sinx3
Cosx3
In[7]:= TrigReduce[%]
Out[7]= Tan3x
In[8]:= TrigReduce[Cos[x]^5]
Out[8]=
1
10Cosx 5Cos3x Cos5x
16
In[9]:= TrigExpand[%]//Simplify
Out[9]= Cosx5
3CosxSinx2
44
1: - -
Simplify
(
In[7]) TrigReduce TrigExpand
.
( )
Expand Factor
:
In[10]:= Expand[(x+y)^5]
Out[10]= x5 5x4 y 10x3 y2 10x2 y3 5xy4 y5
In[11]:= Factor[%]
Out[11]= x y5
In[12]:= Factor[x^6-1]
Out[12]= 1 x1 x1
x x2 1 x x2
In[13]:= Expand[%]
Out[13]=
1 x6
Together
Apart
( ) Apart
: ,
.
:
In[14]:= Apart[(1+x^4)/(x+1)^3]
Out[14]=
3x
1 x3
1 x2
6
1x
In[15]:= Together[%]
Out[15]=
1 x4
1 x3
( 3.2),
[] //
(In[9])
TrigExpand[%]//Simplify Simplify[TrigExpand[%]].
45
10:
fx Taylor, x0 ,
x x0 n . , Mathematica
'
Series[f[x], { x,x0 ,n}]
:
In[16]:= Series[Sin[x], {x,0,10}]
Out[16]= x
x3
x5
6
120
x7
x9
0x11
5040 362880
In[17]:= Series[Sin[x],{x,Pi/2,6}]
1
2 1
4
1
x
x
x
Out[17]= 1
2
2
24
2
720
h
6
0 x
2
i7
2
In[18]:= Series[Exp[Sin[x]],{x,0,8}]
Out[18]= 1 x
x2
2
x4
8
x5
15
x6
x7 31x8
0x9
240 90 5760
,
Limit[f[x], x -> x0 ]
Mathematica
,
L'Hospital
. :
In[19]:= Limit[Sin[a*x]/x, x -> 0]
Out[19]= a
In[20]:= Limit[(x^4-16)/(x-2), x -> 2]
Out[20]= 32
Mathematica
``''
' ,
. ( 9)
(Bessel, Legendre,
..) Mathematica,
46
1: - -
'
.
,
, Mathematica
, . , ,
. Mathematica
, , .
``'' ,
,
.
1.
`` '' TrigExpand
TrigReduce ,
``'' :
)
)
)
)
2.
sinh 2x
cosh3 x
sinh x cosh x
sinh 3x
cosh 5x
cosh x y
tanh x y
tanh4 x.
x,
x:
) cos4 x
) sin4 x
) tan3 x
3.
)
)
)
)
) sin x cos x
) sin x cos3 x
) cos x tan3 x.
x
x:
) sin 6x
) cos 4x
) tan 5x
) tan 6x.
() () Out
`` '' . ;
4.
`` '' .
10:
5.
47
:
) x8
) x5 x4 x3 x2 x 1
) x3
3x2
x3
) x4
'
. ();
6.
Mathematica
:
) x3 =x3
) 1=x
) x6 1=x6
) x =x
'
.
7.
:
) x ln x;
x!0
sin x
; x!0
ex 1
) x ln x;
x!1
sin x
; x!
sin 2x
)
8.
cos x
; x!0
x2
) e x cosh x; x ! 1.
, , `` ''
Mathematica :
TrigToExp [expr]: .
ExpToTrig [expr]: .
) eix e
) sin x cos2 x
) sin3 x cos 2x
) e2ix 1
ix
22
) tan x
) cosx 1
.
9.
; , :
) ex 2e
) sinh2 xcosh x
) cosh3 x
) tanh2 x
48
1: - -
10. ``''
fz z x iy
fz ux; y ivx; y,
. Mathematica
ComplexExpand[f[x+iy]]
(1)
x y .
ComplexExpand[f[z],{z}]
(2)
z ,
f
Re z Im z. (1) (2)
:
In[1]:= ComplexExpand[Sin[x+I*y]]
Out[1]= Cosh[y]Sin[x]+iCos[x]Sinh[y]
In[2]:= ComplexExpand[Sin[z],{z}]
Out[2]= Cosh[Im[z]]Sin[Re[z]]+iCos[Re[z]]Sinh[Im[z]]
(1) (2)
(1)
z:
)
)
)
)
)
z2
z3
ez
cos z
sinh z
) tan z
) tanh z
) ln z
) z tanh z
) cosh z2 .
11. ``''
?Apart, ?Together, ?Expand, ?Factor
Shift+Enter
?.
??
Plot
. ? ??;
1 .
2d.
..........
-- - -- ... .... .
.
:
`` '',
``''
, ,
.
, ,
.
1: Mathematica Mathematica:
,
Mathematica.