Professional Documents
Culture Documents
用mathematica解偏微分方程
用mathematica解偏微分方程
7.1
1
Mathematica DSolve DSolve[
,{}] u x + u y = 0
DSolve[D[u[x,y],x]+D[u[x,y],y] 0,u[x,y],{x,y}]
{{u[x,y]C[1][-x+y]}}
C[1]
u ( x, y ) = C1 ( y x)
u x + u y = 1/( xy )
DSolve[D[u[x,y],x]+D[u[x,y],y] 1/(x y),u[x,y],{x,y}]
::u@x, yD
x y
>>
u ( x, y ) =
ln x + ln y + x C1 ( y x) y C1 ( y x)
ln x ln y
= C1 ( y x)
x y
x y
u x + u y = u
2
DSolve[D[u[x,y],x]+D[u[x,y],y] u[x,y]^2,u[x,y],{x,y}]
::u@x, yD
x C@1D@x + yD
u ( x, y ) =
72
1
x C1 ( y x)
>>
2
utt = a u xx
2
"#####
"#####
::u@t, xD C@1DB a2 t + xF + C@2DB a2 t + xF>>
a a>0
u ( x, t ) = C1 ( x at ) + C2 ( x + at )
DSolve u xx + u yy = 0
DSolve[D[u[x,y],x,x]+D[u[x,y],y,y] 0,u[x,y],{x,y}]
ut = a u xx u ( x, t ) =
2
1
2a t
( s )e
( x s )2
4 at
ds DSolve
DSolve@uH1,0L@t, xD
Mathematica
DSolve
utt a 2u xx = x
DSolve [ D[u[x,t],x,x]+D[u[x,t],t,t] x , u[x,t] , {x,t} ]
DSolve@uH0,2L@x, tD + uH2,0L@x, tD
3
73
DSolve
x2
x2
u |t =0 = e , ut |t =0 = 2 xe
u ( x, t ) = e ( x t )
DSolve
DSolve[{D[u[t,x],t,t] D[u[t,x],x,x],u[0,x] Exp[-x^2],
Derivative[1,0][u][0,x] 2
Exp[-x^2]},u[t,x],{t,x}]
DSolveB:uH2,0L@t, xD
, uH1,0L @0, xD
x2
x2
Mathematica
u xx + u yy = 0
2
u | y =0 = 2 x
DSolve
DSolve[{D[u[x,y],x]+D[u[x,y],y] 0,u[x,0] 2x^2},u[x,y],{x,y}]
DSolve@8uH0,1L@x, yD + uH1,0L@x, yD
0, u@x, 0D
7.2
1
Mathematica DSolve
NDSolve
t [0, 0.3]
ut = u xx , 0 < x < 1
u |x =0 = 0, u |x =1 = 0
u | = x(1 x)
t =0
74
{{uInterpolatingFunction[{{0.,1.},{0.,0.3}},<>]}}
Mathematica x [0,1], t [0, 0.3] u(x, t)
Plot3D
Plot3D[Evaluate[u[x,t]/.First[%]],{x,0,1},{t,0,0.3}]
0.2
0.1
0.2
0
0
0.25
0.1
0.5
0.75
10
u
0.1
Table[ Plot [Evaluate[u[x,t]/.First[%]],{x,0,1}],{t,0,0.3,0.1}]
t=
0.25
0.2
0.15
0.1
0.05
0.2
0.4
0.6
0.8
t=
0.08
0.06
0.04
0.02
0.2
0.4
0.6
0.8
75
t=
0.035
0.03
0.025
0.02
0.015
0.01
0.005
0.2
0.4
0.6
0.8
0.6
0.8
t=
0.012
0.01
0.008
0.006
0.004
0.002
0.2
0.4
Plot [0,
0.25] PlotRange->{0,0.25}
Table[ Plot [Evaluate[u[x,t]/.First[%]],{x,0,1},PlotRange->{0,0.25}],{t,0,0.3,0.1}]
t=
0.25
0.2
0.15
0.1
0.05
0.2
0.4
0.6
0.8
t=
0.25
0.2
0.15
0.1
0.05
0.2
76
0.4
0.6
0.8
t=
0.25
0.2
0.15
0.1
0.05
0.2
0.4
0.6
0.8
t=
0.25
0.2
0.15
0.1
0.05
0.2
0.4
0.6
0.8
{0.1, 0.5,
0.9}
Table[ Plot [Evaluate[u[x,t]/.First[%]],{t,0,0.3},PlotRange->{0,0.25}],{x,0.1,0.9,0.4}]
x=
0.25
0.2
0.15
0.1
0.05
0.05
0.1
0.15
0.2
0.25
0.3
x=
0.25
0.2
0.15
0.1
0.05
0.05
0.1
0.15
0.2
0.25
0.3
77
x=
0.25
0.2
0.15
0.1
0.05
0.05
0.1
0.15
0.2
0.25
0.3
%
Mathematica
1 t [0,1]
ut = u xx , 0 < x <
u x |x =0 = 0, u x |x = = 0
2
u |t =0 = sin x
solution =
NDSolveA9tu@x, tD == x,xu@x, tD, u@x, 0D Sin@xD2, uH1,0L@0, tD == 0,
uH1,0L@ , tD == 0=, u, 8x, 0, <, 8t, 0, 1<E;
Plot3D@Evaluate@u@x, tD . First@solutionDD, 8x, 0, <, 8t, 0, 1<D
1
0.75
0.5
0.25
0
0
1
0.8
0.6
0.4
1
0.2
2
3
78
2 t [0,1]
u |x =0 = 0, u |x = = 0
2
u |t =0 = sin x
solution =
NDSolveA9tu@x, tD == x,xu@x, tD + Sin@2 tD 2, u@x, 0D Sin@xD2, u@0, tD == 0,
u@ , tD == 0=, u, 8x, 0, <, 8t, 0, 1<E;
Plot3D@Evaluate@u@x, tD . First@solutionDD, 8x, 0, <, 8t, 0, 1<D
1
0.75
0.5
0.25
0
0
1
0.8
0.6
0.4
1
0.2
2
3
3
Mathematica DSolve
t [0,1]
u |x =0 = 0, u |x = = 0
u | = sin 2 x, u | = 0
t t =0
t =0
solution =
NDSolveA9t,tu@x, tD == x,xu@x, tD, u@x, 0D Sin@2 xD,
uH0,1L@x, 0D 0, u@0, tD 0, u@ , tD == 0=, u, 8x, 0, <, 8t, 0, 1<E;
Plot3D@Evaluate@u@x, tD . First@solutionDD, 8x, 0, <, 8t, 0, 1<D;
79
1
0.5
0
-0.5
-1
0
1
0.8
0.6
0.4
1
0.2
2
3
t [0,1]
u x |x =0 = 0, u x |x = = 0
u | = cos 2 x, u | = 0
t t =0
t =0
solution =
NDSolveA9t,tu@x, tD == x,xu@x, tD, u@x, 0D Cos@2 xD, uH0,1L@x, 0D 0,
uH1,0L@0, tD == 0, uH1,0L@, tD == 0=, u, 8x, 0, <, 8t, 0, 2<E;
Plot3D@Evaluate@u@x, tD . First@solutionDD, 8x, 0, <, 8t, 0, 2<D;
1
0.5
0
-0.5
-1
0
2
1.5
1
1
0.5
2
3
t [0, 6]
80
u |x =6 = u |x =6
x2
u |t =0 = e , ut |t =0 = 0
1
0.75
0.5
0.25
0
0
5
2.5
0
2
-2.5
4
-5
6
PlotPoints50
NDSolve[{D[u[t, x], t, t] == D[u[t, x], x, x], u[0, x] == Exp[-x^2], Derivative[1,0][u][0, x] == 0, u[t,
-6] == u[t, 6]}, u, {t, 0, 6}, {x, -6, 6}];
Plot3D[Evaluate[u[t,x]/.First[%]],{t,0,6},{x,-6,6}, PlotPoints50]
1
0.75
0.5
0.25
0
0
5
2.5
0
2
-2.5
4
-5
6
81
u |x =0 = 1, u |x = = 0
2
2
u |t =0 = 1 x / , ut |t =0 = 0
solution =
NDSolveA9t,tu@x, tD == x,xu@x, tD, u@x, 0D 1 x2 2, uH0,1L@x, 0D
u@0, tD 1, u@, tD == 0=, u, 8x, 0, <, 8t, 0, 1<E;
Plot3D@Evaluate@u@x, tD . First@solutionDD, 8x, 0, <, 8t, 0, 1<D
0,
1
0.75
0.5
0.25
0
0
1
0.75
0.5
1
0.25
2
3
4
NDSolve y [0,1]
u |x =0 = 1, u |x =1 = 1
u | = cos 2 x, u | = 0
y y =0
y =0
solution =
u .
FirstA NDSolveA9x,xu@x, yD + y,y u@x, yD == 0, u@x, 0D == Cos@2 xD, uH0,1L@x, 0D == 0,
u@0, yD == 1, u@1, yD == 1=, u, 8x, 0, 1<, 8y, 0, 1<EE;
Plot3D@solution@x, yD, 8x, 0, 1<, 8y, 0, 1<D;
82
2.5 10 1 1
0
-2.5 10 1 1
11
-5 10
1
0.8
0.6
0
0.4
0.2
0.4
0.2
0.6
0.8
10
Mathematica
Plot3D[solution[x,y],{x,0,1},{y,0,1},PlotPoints->80]
210 9
1
0
-2 10
0.75
0.5
0
0.25
0.25
0.5
0.75
10
NDSolve
ut = uu x , 0 < x < 1
u |x =0 = u |x =1
u | = sin 2 x
t =0
solution =
u . First@ NDSolve@8tu@x, tD == u@x, tD x u@x, tD, u@x, 0D == Sin@2 xD, u@0, tD == u@1, tD<,
8u<, 8x, 0, 1<, 8t, 0, .5<DD;
Plot3D@solution@x, tD, 8x, 0, 1<, 8t, 0, .5<D;
83
1
0.5
0
0.4
-1
0.3
0
0.2
0.2
0.4
0.1
0.6
0.8
1
u |x =10 = u |x =10
x2
u |t =0 = e , ut |t =0 = 0
{{uInterpolatingFunction[{{0.,10.},{...,-10.,10.,...}},<>]}}
Plot3D[Evaluate[u[t,x]/.First[solution]],{t,0,10},{x,-10,10},PlotPoints80]
10
-1
0
0
2
4
-5
6
8
10 -10
DensityPlot[Evaluate[u[10-t,x]/.First[solution]],{x,-10,10},{t,0,10},PlotPoints200,MeshFalse]
84
10
0
-10
-5
10
7.3
1
ut = u xx , 0 < x < 4
u |x =0 = 0, u |x = 4 = 0
u | = 6sin( x / 2) + 3sin x
t =0
t
U (0) = 0, U (4) = 0
U ( x) u ( x, t ) U ( x)
u ( x, t )
Mathematica
85
F 3 Sin@ xD + s U@xD
U @xD
LaplaceTransform@uH2,0L@x, tD, t, sD
3 2 t
2 t i
j
4 + CosB
j
j
j
x y
x
z
Fz
F
z SinB
2 z
2
{
Plot3D[sol,{x,0,1},{t,0,2}]
4
3
2
1
0
0
2
1.5
1
0.25
0.5
0.5
0.75
10
u |x =0 = 0
u | = 0, u | = b
t t =0
t =0
Mathematica
a2 DiracDelta@tD U @xD
86