スライド 1

Mathematica (2)
3次元曲線・曲面のパラメータ表示
ParametricPlot3D[{Sin[t],Cos[t],t/3},{t,0,4Pi}];
ParametricPlot3D[{v Sin[u],v Cos[u],u/3},
{u,0,4Pi},{v,-1,1}];
ParametricPlot3D[{Cos[u]Cos[v], Cos[u]Sin[v],
Sin[u]}, {u,-Pi/2,Pi},{v,0,2Pi}];
ParametricPlot3D[{Sin[v](3+Cos[u]),
Cos[v](3+Cos[u]),Sin[u]},{u,0,2Pi},{v,0,2Pi}];
式の展開・因数分解・簡単化
In:[1]=
Out[1]=
In:[2]=
Out[2]=
In:[3]=
Out[3]=
In:[4]=
Expand[(b+a x)^2]
b2 + 2abx + a2x2
Factor[%]
(b + ax)2
Factor[x^6 - 1]
(-1+x)(1+x)(1-x+x2)(1+x+x2)
y = 1/(1+x) + 1/(1-x)
1
1

Out[4]=
1 x 1 x
In:[5]= Simplify[y]
Out[5]= -2/(-1+x2)
展開
因数分解
簡単化
方程式を解く: Solve[], NSolve[]
In:[1]=
Out[1]=
In:[2]=
Out[2]=
In:[3]=
Out[3]=
Solve[x^2 - 2x - 4 ==0, x]
{{x 1  5},{x 1  5}}
N[%]
{{x  1.23607}, {x  3.23607}}
NSolve[x^2 - 2x - 4 ==0, x]
{{x  1.23607}, {x  3.23607}}
4次方程式までは必ず解ける。
5次以上は(普通は)Solve[]では解けないが、
NSolve[] で数値的に解くことは可能。
連立方程式
In:[1]= Solve[{2x+3y==0,x-2y+3==0},{x,y}]
Out[1]= {{x  9 / 7, y  6 / 7}}
In:[2]= Solve[{2x+3y==0,x^2+y^2==1},{x,y}]
3
2
3
2
,y
}, {x 
,y
}}
Out[2]= {{x  
13
13
13
13
In:[3]= Solve[{a x+b y==0,x^2+y^2==r^2},{x,y}]
Out[3]= {{x  
br
,y
ar
},
a2  b2
a2  b2
br
ar
{x 
,y
}}
a 2  b2
a 2  b2
数値解を探す:FindRoot[]
In:[1]=
In:[2]=
Out[2]=
In:[3]=
Out[4]=
Plot[{Exp[-x],Sin[x]},{x,0,8}];
FindRoot[Exp[-x]==Sin[x],{x,0}]
{{x → 0.588533}}
FindRoot[Exp[-x]==Sin[x],{x,3}]
{{x → 3.09636}}
最小値を探す: FindMinimum[]
In:[1]= Plot[Sin[x]/x,{x,0,Pi}];
In:[2]= FindMinimum[Sin[x]/x,{x,5}]
Out[2]= {-0.217234,{x → 4.49341}}
微分: D[f,x]
In:[1]=
Out[1]=
In:[2]=
Out[2]=
In:[3]=
Out[3]=
In:[4]=
Out[4]=
In:[5]=
Out[5]=
D[x^2 - x - 6, x]
-1 + 2x
D[x^n,x]
nx-1+n
D[Cos[a x], x]
-a Sin[a x]
D[Cos[a x], {x,2}]
-a2 Cos[a x]
D[Cos[x^2 y], x,y]
-2x3y Cos[x2y]-2x Sin[x2y]
積分: Integrate[]
In:[1]= Integrate[x^n, x]
x 1 n
Out[1]=
1 n
In:[2]= Integrate[Sqrt[x^2+a],x]
Out[2]=
In:[3]=
In:[4]=
In:[5]=
1
1
2
x a  x  aLog x  a  x 2
2
2
Integrage[Sin[a x], {x,0,Pi}]
Ingegrate[Sin[Sin[x]],x]
NIntegrate[Sin[Sin[x]],{x,0,Pi}]
級数:Sum[] 極限:Lim[]
In:[1]=
Out[1]=
In:[2]=
Out[2]=
In:[3]=
Out[3]=
Sum[x^n/n!,{n,0,5}]
1+x+…(略)
NSum[1/n,{n,1,100}]
5.18738
Sum[x^n,{n,0,Infinity}]
1/(1-x)
In:[1]=
Out[1]=
In:[2]=
Out[2]=
Limit[Sin[x]/x,x->0]
1
Limit[(3x^2-1)/(x^2+5),x->Infinity]
3
Taylor展開: Series[]
Series[f[x],{x,x0,n}]
In:[1]= Series[Sin[x],{x,0,5}]
x3 x5
 O[ x ]6
Out[1]= x  
6 120
In:[2]= Series[Exp[-ax]/Cos[x],{x,0,4}]
 1 a2  2  a a3  3
4
Out[2]= 1  ax     x      x  O[ x ]
2 2 
 2 6