Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
O 
O 
O 
O 
O 
O 
O 
O 
O 
Math 2650
A. J. Meir
Copyright (C) A. J. Meir. All rights reserved.
This worksheet is for educational use only. No part of this publication may be reproduced or transmitted for profit in any form or by any means, electronic or
mechanical, including photocopy, recording, or any information storage and retrieval system without prior written permission from the author. Not for profit 
distribution of the software is allowed without prior written permission, providing that the worksheet is not modified in any way and full credit to the author 
is acknowledged.
Laplace Transforms
In order to use Laplace transforms we must load the integral transforms package.
restart:with(inttrans):
We compute some transforms of functions and some inverse transforms
laplace(sinh(t),t,s);
1
s2K 1
invlaplace(1/(s^2-1),s,t);
sinh t
laplace(t^2*sinh(t),t,s);
1
sK 1 3
K
1
sC 1 3
invlaplace(1/((s-1)^3)-1/((s+1)^3),s,t);
t2 sinh t
laplace(Heaviside(t-3),t,s);
eK3 s
s
invlaplace(exp(-3*s)/s,s,t);
Heaviside tK 3
Discontinuous Functions
Now lets look at some discontinuous functions
f(t):=piecewise(0<=t and t<1, 1-t, 1<=t, 1);
f t :=
1K t 0 % t and t! 1
1 1 % t
plot(f(t),t=0..5,discont=true);
O 
O 
O 
O 
O 
O 
t
0 1 2 3 4 5
0
0.2
0.4
0.6
0.8
1.0
laplace(f(t),t,s);
1
s
C
K1C eKs sC 1
s2
This is not too good! so lets try to help Maple along.
g(t):=(1-t)*(Heaviside(t)-Heaviside(t-1))+Heaviside(t-1);
g t := 1K t  Heaviside t KHeaviside K1C t CHeaviside K1C t
plot(g(t),t=0..5,discont=true);
t
0 1 2 3 4 5
0
0.2
0.4
0.6
0.8
1.0
laplace(g(t),t,s);
1
s
C
K1C eKs sC 1
s2
h(t):=Heaviside(sin(2*t));
h t := Heaviside sin 2 t
plot(h(t),t=0..12,discont=true);
O 
O 
O 
O 
O 
O 
O 
t
0 2 4 6 8 10 12
0
0.2
0.4
0.6
0.8
1.0
laplace(h(t),t,s);
laplace Heaviside sin 2 t , t, s
1/(1-exp(-Pi*s))*int(exp(-s*t),t=0..Pi/2);
K
K1C e
K
1
2
 p s
1K eKp s  s
invlaplace(-(exp(-1/2*Pi*s)-1)/((1-exp(-Pi*s))*s),s,t);
1
2
C
1
2
 K1
floor
2 t
p
Differential Equations
Consider the differential equation
d2 x
dt2
C 2
dx
dt
C x = f t      x 0 = 0     
dx
dt
(0)=0,
where f t =
1 Kt% 0 and t! 1
0 1 % t
.
We define the right hand side, differential equation, and initial conditions.
f(t):=Heaviside(t)-Heaviside(t-2);
f t := Heaviside t KHeaviside tK 2
de:=diff(x(t),t,t)+2*diff(x(t),t)+x(t)=f(t);
de :=
d2
dt2
 x t C 2 
d
dt
 x t C x t = Heaviside t KHeaviside tK 2
ic:={x(0)=0,D(x)(0)=0};
ic := D x 0 = 0, x 0 = 0
Laplace transform the differential equation.
LEq:=laplace(de,t,s);
LEq := s2 laplace x t , t, s KD x 0 K s x 0 C 2 s laplace x t , t, s K 2 x 0
O 
O 
(3.1)
O 
O 
O 
O 
C laplace x t , t, s =
1K eK2 s
s
Substitute the values for the initial conditions and solve the resulting algebraic equation for the 
transform of the solution.
LEqIc:=subs(ic,LEq);
LEqIc := s2 laplace x t , t, s C 2 s laplace x t , t, s C laplace x t , t, s =
1K eK2 s
s
LT:=solve(LEqIc,laplace(x(t),t,s));
LT := K
K1C eK2 s
s s2C 2 sC 1
Invert to find the solution.
invlaplace(LT,s,t);
Error, (in gcd/LinZip) input must be polynomials over the 
integers
invlaplace(1/(s*(s^2+2*s+1)),s,t)-invlaplace(exp(-2*s)/(s*
(s^2+2*s+1)),s,t);
1K eKt tC 1 KHeaviside tK 2  1K eKtC 2 K1C t
sol:=%;
sol := 1K eKt tC 1 KHeaviside tK 2  1K eKtC 2 K1C t
And finally graph the solution.
plot(sol,t=0..8);
t
0 1 2 3 4 5 6 7 8
0
0.1
0.2
0.3
0.4
0.5
0.6
Consider the differential equation
d2 x
dt2
 + 4 x = f t      x 0 =
1
2
     
dx
dt
(0)=0,
where f t =
4K 2 t Kt% 0 and t! 4
0 4 % t
.
O 
O 
(3.2)
O 
O 
O 
O 
O 
O 
O 
We define the right hand side, differential equation, and initial conditions.
f(t) := piecewise(0 <= t and t < 4,4-2*t,4 <= t,0);
f t :=
4K 2 t 0 % t and t! 4
0 4 % t
Note: Maple can convert automatically to notation using the Heaviside function.
f(t):=convert(%,Heaviside);
f t := 4 Heaviside t K 4 Heaviside K4C t K 2 t Heaviside t C 2 t Heaviside K4C t
de:=diff(x(t),t,t)+4*x(t)=f(t);
de :=
d2
dt2
 x t C 4 x t = 4 Heaviside t K 4 Heaviside K4C t K 2 t Heaviside t
C 2 t Heaviside K4C t
ic:={x(0)=1/2,D(x)(0)=0};
ic := D x 0 = 0, x 0 =
1
2
Laplace transform the differential equation.
LEq:=laplace(de,t,s);
LEq := s2 laplace x t , t, s KD x 0 K s x 0 C 4 laplace x t , t, s =
4
s
C
2 K1C eK4 s 2 sC 1
s2
Substitute the values for the initial conditions and solve the resulting algebraic equation for the 
transform of the solution.
LEqIc:=subs(ic,LEq);
LEqIc := s2 laplace x t , t, s K
1
2
 sC 4 laplace x t , t, s =
4
s
C
2 K1C eK4 s 2 sC 1
s2
LT:=solve(LEqIc,laplace(x(t),t,s));
Warning, solutions may have been lost
LT :=
LT:=(4/s+(2*(-1+exp(-4*s)*(2*s+1)))/s^2+s/2)/(s^2+4);
LT :=
4
s
C
2 K1C eK4 s 2 sC 1
s2
C
1
2
 s
s2C 4
Invert to find the solution.
invlaplace(LT,s,t);
Error, (in gcd/LinZip) input must be polynomials over the 
O 
(3.3)
O 
O 
integers
invlaplace(4/(s*(s^2+4)),s,t)+invlaplace(2*(-1+exp(-4*s)*(2*
s+1))/(s^2*(s^2+4)),s,t)+invlaplace(s/(2*(s^2+4)),s,t);
1K
1
2
 cos 2 t K
1
2
 tC
1
4
 sin 2 t C
1
4
 Heaviside K4C t  K8C 8 sin K4C t 2
K sin K8C 2 t C 2 t
sol:=%;
sol := 1K
1
2
 cos 2 t K
1
2
 tC
1
4
 sin 2 t C
1
4
 Heaviside K4C t  K8C 8 sin K4
C t 2K sin K8C 2 t C 2 t
And finally graph the solution.
plot(sol,t=0..9);
t
1 2 3 4 5 6 7 8 9
K1.0
K0.8
K0.6
K0.4
K0.2
0
0.2
0.4
0.6
0.8