Professional Documents
Culture Documents
1
2
3
4
5
6
7
Mathematica
Mathematica
Mathematica
Mathematica
Mathematica
Mathematica
Mathematica
1 Mathematica
1.
Mathematica
2.
3.
Mathematica
1.1.1 Mathematica
MathematicaWolfram
WindowsMathematica4.0
Windows
Mathematica4.0
Notebook
Untitled-1
1+1Shift+Enter
In[1]Out[1]In[1]
Shift+Enter
In[2]Out[2]
MathematicaNotebook
Mathematica
built-in function,
(1)
Abs[x]Sin[x]Cos[x]e
Log[x]a
Log[a,x]
(2)
Plot[f[x],{x,xmin,xmax}]
Solve[eqn,x]D[f[x],x]
Mathematica
FindMinimum[f[x],{x,x0]
Mathematica
[ ]
[-1010]
plot[Sin[x],{x,-10,10}]
plot
Plot
Plot
Plot[Sin[x],{x,-10,10}
1.1.2
Mathematica
Mathematic
x/(2+3x)+y*(x-w)
FILEPalettes->Basic
Input
MathemMatica
FILE
Complete
Characters,
1.2 Mathematica
Mathematica
1Notebook,
??
, ,
PlotPlot
PlotPlot (
??)? Plot*
Plot
2 HelpF1
Help Browser, ,
Built-in Function
Add-ons
Standard Packages
MathLink Library
Mathematica
The Mathematica
Book
Getting Started/
Demos
Other Information
Master Index
Mathematica
Mahematica
Mathematica
The Mathematica Book
Contents
Goto
PlotPlot
Plot
Mathematica
Built-in Functions
PlotPlot
1-5Plot
Mathematica
Built-in Functions
2 Mathematica
1. mathematica
2.
3.
4.
5.
6.
2.1
1
Mathematic
Mathemateic
210031
ln[1]:=2^100
Out[1]=1267650600228228229401496703205376
Mathematica
In[2]:=12345/5555
Out[2]=2469/1111
Mathematica
ln[3]:=0.239998
Out[3]=0.23998
ln[4]:=0.12*10^11
Out[4]=0.12*10^11
MathematicaI
In[6]:=3+0.7I
Out[6]:=3+0.7I
2.
Mathematica
Out[n]ln[n]
Mathematica
N[x]
N[x,n]
x
n
Rationalize[x]
Rationalize[x,dx]
x,
dx
[]
ln[1]=N[5/3,20]
Out[1]=1.66666666666666666667
ln[2]:=N[%,10]
Out[2]=1.66666667
10
In[3]=Rationalize[%]
Out[3]=5/3
3.
Mathematica
Pi
=
3.1415926535897932
Degree
e=
2.7182818284590452
Pi/180
I= -1
Infinity
Infinity
GoldenRatio
=
1.6180339887498948
,
In[1]:=Pi^2
2
Out[1]=
ln[2]:=Pi^2//N
Out[2]=9.86961
4.
NumberForm[expr,n]
n
expr
ScientificForm[expr]
expr
EngineeringForm[expr]
expr
ln[1]:=N[Pi^30,30]
14
8.21289330402749581586503585434
10
Out[1]=
ln[2]:=NumberForm[%,10]
14
Out[2]//NumberForm= 8.212893304 10
3
In[3]=EngineeringForm[%%]
Out[3]//EngineeringForm=
821.289330402749581586503585434 1012
2.2
1
Mathematica
a12,ast,aST12a
z*aMathematica
Mathematica
2
Mathmatica
In[1]:=x=3
Out[1]=3
In[2]:=x^2+2x
Out[2]=15
In[3]:=x=%+1
Out[3]=16
,
In[4]:={u,v,w}={1,2,3}
Out[4]={1,2,3}
In[5]:=2u+3v+w
Out[5]=11
Clear[x]
ln[6]:=u=.
ln[7]:=2u+v
Out[7]=2+2u
3.
expr/.
In[1]:=f=x/2+1
x
Out[1]= 1 2
In[2]:=f/.x->1
3
Out[2]= 2
In[3]:=f/.x->2
Out[3]=3
expr/.{x->xval,y->val}
In[4]:=(x+y)(x-y)^2/.{x->3,y->1-a}
Out[4]= (4 - a) (2 + a)^2
2.3
1
Mathmatic
Floor[x]
Ceiling[x]
x
x
Sign[x]
Round[x]
Abs[x]
Max[x1,x2,x3..]
x1,x2,x3.
Min[x1,x2,x3..]
x1,x2,x3.
Random[]
0~1
Random[Real,xmax] 0~xmax
Random[Real,{xmin, xmin~xmax
xmax}]
Exp[x]
Log[x]
lnx
Log[b,x]
Sin[x],Cos[x],Tan[x],
Csc[x],Sec[x],Cot[x]
Sinh[x],Cosh[x],Tanhx[x],
Csch[x],Sech[x],Coth[x]
ArcSech[x],ArcCoth[x]
Mod[m,n]
Quotient[m,n]
mn
n
m/n
GCD[n1,n2,n3]
GCD[s]
LCM[n1,n2]
LCM[s]
n!
n1,n2,
s
n1,n2.
s
n
n!!
Mathematica
Mathematica
Mathematica
2
1
f[x_]=expr
f,xexpr
expr xfx(x_)
f[x_]=x*Sinx+x^2
Clear[f]
Remove[f]
2
f[x_,y_,z_,]=expr
x,y,z.,expr
f(x,y)=xy+ycosx
==f[x_]
=expr
4If
If
IfIf[12]
12If
If
2.4
Mathematica
Lista,b,c
{{a,b},{c,d}}
1,2,3.
In[1]:={1,2,3}
Out[1]={1,2,3}
In[2]:=1+%x+x^%
Out[2]={1+2x,1+2x+x2,1+3x+x2}
x
In[3]:=D[%,x]
Out[3]={2,2+2x,3+3x2}
In[4]:=%/.x->1
Out[4]={2,4,6}
Table[f,{I,min,max,step stepf
}]
iminmax
Table[f,{min,max}]
fImin
max 1
Table[f,max]
maxf
Table[f,{I,imin,imax},{j,
jmin,jmax},.]
TableForm[list]
Range[n]
Range[n1,n2,d]
1,2,..
n1, n1+d,
n1+d , ., n2
xii[2,6]:
In[1]:=Table[x*i,{i,2,6}]
Out[1]={2x,3x,4x,5x,6x}
In[2]:=Table[x^2,{4}]
Out[2]={x2,x2,x2,x2}
Range
In[3]:=Range[10]
Out[3]={1,2,3,4,5,6,7,8,9,10}
2820
In[4]:=Range[8,20,2]
Out[4]={8,10,12,14,16,18,20}
In[5]:=Table[2i+j,{i,1,3},{j,3,5}]
Out[5]={{5,6,7},{7,8,9},{9,10,11}}
TableForm
In[6]:=%//TableForm
Out[6]//TableForm=5 6 7
7 8 9
9 10 11
2
tt[[i]] Part[t,i] t
it={1,2,a,b}, t[[3]]
a
ln[1]:=t=Table[I+2,j{I,1,3},{j,3,5}]
Out[1]={{7,9,11},{8,10,12},{9,11,13}}
ln[2]:=t[[2]]
Out[2]={8,10,12}
1
{e1,e2,...}
Table[expr,{imax}]
imax
Table[expr,{i,imax}}
imaxexpr
Table(expr,{iimin,imax}
{j,jmin,jmax},..]
Range[imax]
f12+imax)
Range[iminimaxdi]
di
Array[f,n]
fI(i1n)
Array[f,{n1,n2..}]
i1 (1ni)
IdentityMatrix[n]
DiagonalMatrix[list]
2
Part[expr,i]expr[[i]] i
expr[[-i]]
expr[{i,j,..}]
expr[{i1,i2,..}]
i(n)
FirstCexpr]
Last[expr]
Head[expr]
expr[[0]]
Extract[expr,list]
listexpr
Take[list,n]
listn
Take[list{m,n}]
listmn
Drop[list,n]
listn
Rest[expr]
list
Select [UStcrit]
critlistTrue
Length[expr]
expr
Dimensions[expr]
(n1,n2..},exprnl*n2
TensorRank[expr)
Depth[expr]
expr
Level[expr,n]
exprn
Count[UStpaUem] list
MembefQ[1ist
form]
listform
FreeQ[expr,form]
MemberQ
FreeQ[expr,form]
pattern
Cases[{e1,e2}
pattem}
pattemei
3
Append[exp[elem]
exprelem
Prepend[expr,elem)
exprelem
Insert[1istelemn] nelem
lnsert[expr,elem,{i,j,.
expr[[{i,j,..}]]elem
..}]
Delete[expr,{i,j,..}]
expr[[{i,j,..}]]
DeleteCases[expr,pa
pattern
ttem]
ReplacePart[expr,ne
exprnnew
w,n]
Sort[list]
list
Reverse[expr]
expr
RotateLeft[expr,n]
exprn
RotateRight[expr,n] exprn
Partition[list,n]
listn
Flatten[1istl
Flatten[1ist,n]
Split[1ist]
2.5
1.
Mathematica
Mathematica
Mathematica
f[x,y]
Expand[expr]
Factor[expr]
Simplify[expr]
(x+y)^4 (x+y^2)
x>0, y=0
Mathematica
x==y
x!=y
x>y
x>=y
x<y
x<=y
x==y==z
x!=y!=z
x>y>z,etc
x,y
In[1]:=x=2;y=9
Out[1]=9;
In[2]:=x>y
Out[2]=False
In[3]:=3^2>y+1
Out[3]=True
&&||
XorIf
In[4]:=3x^2<Y+1&&3^2==y
Out[4]=False
In[5]:=3x^2+1||3^2==y
Out[5]=True
3 Mathematica
1.
2.
3.
3.1
Mathematica
Expand[ploy]
ploy
ExpandAll[ploy]
ploy
Factor[ploy]
poly
FactorTerms[ploy
{x,y,}]
Simplify[poly]
FullSimplify[ploy]
x,y,
Collect[ploy,x]
polyx
Collect[poly,{x,y}]
polyx,y.
3.2
Mathematica
x2-2x+1=0
Mathematica=
==
x^2-2x+1==0
Rootsx^2-3x+2
x12
Solve[]
Solve[lhs==rhs,vars]
NSolve[lhs==rhs,vars]
Roots[lhs==rhs,vars]
FindRoot[lhs==rhs,{x,x0}
x=x0
Solve
Solve
Mathematica
x3+5x+3=0
N.
Mathematica
FindRoot[]
3Cosx=logx
x=1
x=10
x=5
2.
SolveNSolveFindRoot
Solve
3.
ax2+bx+c=0Solve
a,b,c
Reduce
a,b,c
4.
x4+bx2+c=0x2=y
Mahematica
Solve[ ]
ScSin2x+Cos2x=1
3.3
Mathematica
Sum
Product
Sum[f,{i,imin,imax}]
Sum[f,{i,imin,imax,di}] dii
Sum[f,{i,imin,imax},{j,jmin,jmax}]
Product[f,{i,imain,imax}]
Product [f,{i,imin,imax,di}] dii
Product[f,{I,imin,imax},{j,jmin,jmax}]
Nsum[f,{i,imin,Infinity}]
NProduct[f,{i,imin,Infinity}]
4
1.
2.
3.
4.
5.
4.1
Mathematica
Plot[f{xxminxmax}option>value]
.
Plot[{f1,f2,f3,}, {x,xmin,xmax},option>value]
Mathematica
->
Plot
AspectRatio
1/0.618
AxesLabel
PlotLabel
PlotRange
PlotStyle
PlotPoint
25
1.
(1)
(2)Ticks
(3)x Time,y
Height
(4)(30)
(5)xy
(6)y
(7)
Show
2.
Mathematica
:
x12
ListPlot[{y1,y2,..}]
y1,y2,
ListPlot[{{x1,y1},{x2
xi,yi
,y2},..}]
ListPlot[List,PlotJoi
ned->True]
(1)
3.
Plot
ParametrecPlot
ParametricPlot
ParametricPlot[{fx,fy},{t,tmin,tmax}]
ParametricPlot[{fx,fy},{gx,gy},.{t,t
min,tmax}]
ParametricPlot[{fx,fy},{t,tmin,tmax},
AspectRatio->Automatic]
(1).
(2)
4.3
Graykvel[]
0()l()
RGBColor[r,g,b]
01
Hue[A]
01
Hue[h,s,b]
01
PointSize[d]
d
Plot
AbsolutePointSize[d]
Thickness[w]
d(
)
wPlot
AbsoluteThickness[w]
w(
)
Dashing[wl,w2,.]
wlw2,
Absolutedashing[{w1,w2
,..}]
PlotStyle->style
Plot
PlotStyle>{{Style1},{Style2} Plot
.}
MeshStyle->Style
1.
Mathematicaa
2.
3.
4.4
Mathematica
Show[plot]
Show[plot,option->value]
Show[plot1,plot2,plot3]
Show[GraphcisArray[{{plot1,
plot2,}}]]
InputForm[plot]
1.Show
Sin[x^2]
2.Show
Show
Mathematica
-xsin(2x+Pi)
xcos(2x)
GraphicsArray
4.5
f(xy)
Plot3DPlot3DPlot
ListPlot3D
ListPlot
Plot3D[f ,(x,xmin,xmax)(y,ymin,ymax)]
xyf
ListPlot3D[{Z11,Z12,}{Z21,Z22,},..]]
Zvx
True
AxesLabel
None
zlabelz
{xlabel,ylabel,zlabel}
Boxed
True
Axes
ColorFunction
TextStyle
OrmatType
Automati Hue
c
STextSty
le
Standard
Form
Sdlisplay
Indentity
DisplayFunction
Functi
on
FaceGrids
None
All
HiddenSurface True
Lighdng
True
Mesh
True
xy
PlotRange
Automati
All{zmin,zmax}
c
{xminn,xmax}
{ymin,ymax},{zmin,zmax}
Shading
True
ViewPoint
{13
24,2}
1.
(1)Sin(x+y)Cos(x+y)
PlotRange
(3)
(4)
2.
3.
ParametricPlot3D[{fx,fv,fz},{t,tmin,tmax}]
ParametricPlot
Mathematica
t
ParametricPlot3D[{fx,fv,fz},{t,t
min,tmax}]
ParametricPlot3D[{fx,fv,fz},{t,t
min,tmax},{u,umin,umax}]
ParametricPlot3D[{fx,fv,fz,s}
..]
ParametricPlot3D[{fx,fv,fz},{g
x,gy,gz}..]]
ParametricPlot3D[{fx,fv,fz},{t,tmin,tmax}
{u,umin,umax}]
5
1.
2.
3.
4.
5.1
MathematicaLimit
Limit[expr,x->x0]
xx0expr
Limit[expr,x->x0,Direction- xx0expr
>1]
Limit[expr,x->x0,Direction- xx0expr
>-1]
+-
1
5.2
1.
Mathematica
D[f,x],xf
D[f,x]
D[f,x1,x2,]
D[f,{x,n}]
D[f,x, NonConstants>{v1,v2,----}]
v1,v2x
1.Sinx
2.exSinx2
3.aSinax
4.f(x,y)=x^2*y+y^2
x,y
Mathematica
2.
MathematicaD[f,x]f
fxf
D[f,x]fxDt[f,x]
ff
x.Dt
Dt[f]
df
Dt[f,x]
Dt[f,x1,x2,]
Dt[f,x,Constants->{c1,c2,.}]
c1,c2..
x^2+y^2
yx
yx
x^2+xy^3+yz z
yxy
5.3
1.
Mathematica
Integerate[f,x]
Mathematica
MatheMatica
2.
Integrate
Integrate[f,{x,min,max}]
3.
Integrate
Nintegrate[f,{x,a,b}]
[a,b]f
NIntegrate[expr,{x,xmi
n,xmax},{y,ymin,yma
x},...]
Nintegrate[f,{x,a,x1,x2, x1,x2.[a,b]
,b}]
Sinsinx[0,Pi]
Integrate
[-11]
x=0
0
5.4
( I ) D[f,x1,x2,...,xn]
:
6
1.
2.
6.1
MathematicaDsolove[ ]
C[1],C[2]
Mathematica
y[x]y[x],y[x]
()
Dsolve[eqn,y[x],x]
y[x]
Dsolve[eqn,y,x]
Dsolve[{eqn1,eqn2,},{y1
,y2,.},x]
1Dsolvey[x]
y[x]y[x]
y[x]y[0]y[x]
y[x],y[0]
.
2
Dsolve
y,
yy
6.2
MathematicaDSolve[]
NDSolve
(x,xmin,xmax)
NDSolve
yix
NDSolve[{eqn1,eqn2,},y,{x,xmin,xmax}]
yx[xmin,xmax]
NDSolve[{eqnl,eqn2,}
{y1,y2,}{x,xmin,xmax}]yi
Mathematica
Evaluate
InterpolatingFunction
7 Mathematica
1.
2.
3.
7.1
Module[{x,y,...},bod
x,y
y]
Module[{x=x0,y=y0,
},body]
lhs:=Module[vars,r
hs/:cond]
rhscond
Block[{x=x0,y=y0,
},bddy]
x,y,..
t, Mathematica
:
ln[1]:=t=10
Out[1]=10
t,
t
ln[2]:=Module[{t}, t=8; Print[t]]
t10:
ln[3]=t=10
Out[3]=10
t10:
ln[6]:=t=10
Out[6]=10
Mathematica
,,
Block[ ]x,
x:
Module[vars,body]
bodyMathematica
vatsvars
Block[vats,body]body
Body
vars
ln[12]:=m=i^2
Out[12]:=i2
In[13]:=Block[{i=a}i+m]
Out[13]=a+a2
In[14]:=Module[{i=a}i+m]
Out[14]=a+i2
7.2
If[test,then,else]
test, then
else
testl
which[test1,value1test2...]
Switch[expr,forml,value1,for
m2,...]
exprformi
Switch[expr,form1,
value1,form2,_def]
def
1. If
ln[1]:=If [1>0, 1+2, 2+3]
Out[1]=3
2Which
,If
,
WhitchSwitch
Which,
:
Switch:
Mathemahca,
, If
:
ln[1]:=If[x==y,a,b]
Out[1]=If[x==y,a,b]
If,
ln[2]:=If[x==y,a,b,c]
Out[2]=c
ln[5]:=TrueQ[x==x]
Out[5]=True
ln[6]:=TrueQ[x==y]
Out[6]=false
===:
In[7]:x===y
Out[7]:=False
4.
expri,
expr1&&expr2&&expr3
exprl||expr2||expr3
expri,
:
In[l0]:=t[x_]:=(x!=0&&1/x<3)
,
,,
10,
ln[12]:=t[0]
Out[12]=False
7.3
Mathematica
Mathematica ,
; ,
,
,
1. Do
Do:
Do[expr,{i,imax}]
expr,1,i1
imax
Do[expr,{i,imin,im expr,di,i
ax,di}]
iminimax
Do[expr,{n}]
expr n
Print[i+i^2], i13:
Do
2. WhileFor
While[test,bo test
dy]
body
start
For[start,test,
bodyincrtest
incr,body]
While,
While
test
For
For
MathematicaWhileFor
WhileFor
3.
i++
i-++i
--i
i+=di
i-=di
x*=C
x=c
{x,y}={y,x}
i1
i1
i1
i1
idi
idi
xC
xc
xy
4.
Nest[f, x, n]
exprfn
FixedPoint[f expr
x]
NestWhile[f,ex exprf
pr,test]
5.
Break[]
Continue[]
Return[expr]
expr
Goto[name]
Label[name]
Throw[value]
expr
Continue[]
Return
Throw