Professional Documents
Culture Documents
a := -2 3
1 0
> restart:
> with(LinearAlgebra);with(linalg);
[ &x, Add, Adjoint, BackwardSubstitute, BandMatrix, Basis, BezoutMatrix, BidiagonalForm,
BilinearForm, CharacteristicMatrix, CharacteristicPolynomial, Column, ColumnDimension,
ColumnOperation, ColumnSpace, CompanionMatrix, ConditionNumber, ConstantMatrix,
ConstantVector, Copy, CreatePermutation, CrossProduct, DeleteColumn, DeleteRow,
Determinant, Diagonal, DiagonalMatrix, Dimension, Dimensions, DotProduct,
EigenConditionNumbers, Eigenvalues, Eigenvectors, Equal, ForwardSubstitute,
b := 1
-8
4
3 3
3 2
3 4
c := 0
0
1
0
> evalf(Eigenvalues(a,b));
0.2914378157
0.66678109222.217375143 I
0.66678109222.217375143 I
> evalf(Eigenvalues(a));
>
4.375478138
1.8122609323.722458079 I
1.8122609323.722458079 I
Soluo de sistemas de equaes no lineares;
> eq[1]:=x*sin(y)-3*x-2=0;
eq1 := x sin( y )3 x20
> eq[2]:=x^2+sin(y)-y=0;
eq2 := x2sin( y )y0
> fsolve({eq[1],eq[2]});
{ x-0.9743529051, y1.896719219 }
NewtonRaphson em sistemas de equaes no lineares;
> J:=jacobian([lhs(eq[1]),lhs(eq[2])],[x,y]);
>
ZeroVector, Zip ]
[ BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp, QRdecomp, Wronskian, addcol,
addrow, adj, adjoint, angle, augment, backsub, band, basis, bezout, blockmatrix, charmat,
charpoly, cholesky, col, coldim, colspace, colspan, companion, concat, cond, copyinto,
crossprod, curl, definite, delcols, delrows, det, diag, diverge, dotprod, eigenvals, eigenvalues,
sin( y )3
J :=
2x
> X[0]:=Vector([-1,1.5]);
-1
X0 :=
1.5
> X[0];
iszero, jacobian, jordan, kernel, laplacian, leastsqrs, linsolve, matadd, matrix, minor, minpoly,
mulcol, mulrow, multiply, norm, normalize, nullspace, orthog, permanent, pivot, potential,
randmatrix, randvector, rank, ratform, row, rowdim, rowspace, rowspan, rref, scalarmul,
singularvals, smith, stackmatrix, submatrix, subvector, sumbasis, swapcol, swaprow, sylvester,
toeplitz, trace, transpose, vandermonde, vecpotent, vectdim, vector, wronskian ]
Problema de Autovalor Genrealizado;
>
> a:=Matrix([[1,3,-8],[-2,3,5],[1,0,4]]);
b:=Matrix([[9,3,3],[1,3,2],[1,3,4]]); c:= IdentityMatrix(3);
x cos( y )
cos( y )1
>
>
>
>
>
>
>
>
-1
1.5
R[0]:=Vector(2): Ji:=Matrix(2,2):
for i to 2 do
R[0][i]:=evalf(subs(x=X[0][1],y=X[0][2],lhs(eq[i])));
for j to 2 do
Ji[i,j]:=evalf(subs(x=X[0][1],y=X[0][2],J[i,j]));
od:
od:
R[0];
0.0025050134
0.4974949866
1 0
1
e sin( 0 ) _C2 e0 cos( 0 ) 74 _C20.05335557310 e0 cos( 0 )
15
15
> dX:=-Ji^(-1).R[0];
-0.0191136376969470723
dX :=
0.576502430715991498
0.05335557310 e0 sin( 0 ) 74
> X[1]:=X[0]+dX;
-1.01911363769694718
X1 :=
2.07650243071599138
> X[0]:=X[1]:
dt
d2
dt
Soluo analtica.
> k:=50; m:=150; c:=0.3;
c := 0.3
sin( 0 )
64
1437665
cos( 0 )1.0
_C21.836673847
_C21.836673847
> assign(%);
Finalmente a soluo da equao diferencial.
> eq_aux;
1.836673847 e
15
74 t
0.8003335965 e 15 cos 74 t
sin
15
15
2398
16
cos( 20 t )
sin( 20 t )
7188325
7188325
Em qualquer instante de tempo pode-se determinar a posio e a velocidade do sistema.
> evalf(subs(t=0.5,eq_aux)); evalf(subs(t=0.5,diff(eq_aux,t)));
1.245205591
k := 50
m := 150
9592
1437665
> isolate(%,_C2); evalf(%);
0.7649618551
Soluo numrica.
> dsys := {eqd, x(0)= 0.8,D(x)(0)=0.0};
> eqd;
dsys :=
d2
d
t
dt
> resultado:=dsolve(eqd,x(t));
d2
dt
Soluo pelo mtodo de Runge-Kutta.
> dsol := dsolve(dsys, numeric, method=rkf45,
output=procedurelist,range=0..30):
> dsol(0.5);
resultado := x( t )e
15
74 t
2398
16
cos( 20 t )
sin( 20 t )
7188325
7188325
Determinao de C1 e C2. Para x(0) = 0.8 e D(x)(0) = 1.0
> eq_aux:=rhs(resultado);
eq_aux := e
15
74 t
16
sin( 20 t )
7188325
> evalf(subs(t=0, eq_aux)=0.8);
0.00033359649151. _C10.8
> isolate(%,_C1);
_C10.8003335965
> assign(%);
> subs(t=0, diff(eq_aux,t))=1.0;
> with(plots):
> odeplot(dsol,[t,x(t)]);
> odeplot(dsol,[t,D(x)(t)]);
Plano de fase
> odeplot(dsol,[x(t),D(x)(t)]);
d
t2.5, x( t )0.170201756173711305, x( t )-0.391783712259251127
dt
d
t3.0, x( t )-0.0221309348718498125, x( t )-0.378671062576175720
dt
d
d
t4.5, x( t )-0.465273035475648744, x( t )-0.177343468464130876
dt
d
d
t5.5, x( t )-0.555098037248683008, x( t )0.00375143682108820300
dt
d
d
t7.5, x( t )-0.245957893365722020, x( t )0.253898456133835881
dt
d
d
t1.0, x( t )0.675982512402666824, x( t )-0.230038011523358205
dt
d
d
t8.5, x( t )0.0209981009622273764, x( t )0.262832740153134403
dt
d
t9.0, x( t )0.144895410738542646, x( t )0.224607865387992462
dt
d
d
t11.0, x( t )0.385074491532969244, x( t )-0.00501406632308102392
dt
d
t11.5, x( t )0.367374376110609302, x( t )-0.0704866677429301232
dt
d
t12.0, x( t )0.320502235527798940, x( t )-0.111485886120185715
dt
d
t21.5, x( t )0.180697789562740185, x( t )0.0285171037753668700
dt
d
t12.5, x( t )0.251354109408570725, x( t )-0.162989617868577241
dt
d
d
t22.0, x( t )0.185148975884325384, x( t )-0.00419476011922327152
dt
d
d
t14.0, x( t )-0.0184464532665153981, x( t )-0.182763487493766169
dt
d
t23.5, x( t )0.117669615661472674, x( t )-0.0829969072115040452
dt
d
t15.0, x( t )-0.175269080662888016, x( t )-0.132066802116669102
dt
d
t24.5, x( t )0.0312858967776036834, x( t )-0.0910424596581187046
dt
d
t17.0, x( t )-0.254018729763795636, x( t )0.0521410815369881264
dt
d
t26.5, x( t )-0.111372994107368284, x( t )-0.0335218179330710742
dt
d
t18.0, x( t )-0.172018240514709292, x( t )0.115971262373570902
dt
d
t27.5, x( t )-0.128313650047365112, x( t )0.00317888915644208528
dt
d
t18.5, x( t )-0.113129986817283437, x( t )0.121243472000395883
dt
d
d
t28.0, x( t )-0.121428066740509211, x( t )0.0294539535110590854
dt
d
d
t20.5, x( t )0.123558313312326099, x( t )0.0925502445904156646
dt
d
t30.0, x( t )-0.0202328932435542237, x( t )0.0630325305362972183
dt
Sistemas de equaes diferenciais Lienares;
O comando Dsolve, resolve tambm sistemas de equaes diferencias lineares;
> sys_ode := diff(y(t),t) = x(t), diff(x(t),t) = -x(t);
d
t21.0, x( t )0.159324516139128874, x( t )0.0518069813453820444
dt
sys_ode :=
d
d
y( t )x( t ), x( t )x( t )
dt
dt
> dsolve([sys_ode]);
{ x( t )_C4 e
( t )
, y( t )_C4 e
( t )
_C3 }
condies iniciais.
> ics := x(0)=1, y(1)=0;
ics := x( 0 )1, y( 1 )0
Solve the system of ODEs subject to the initial conditions ics.
> dsolve([sys_ode, ics]);
{ x( t )e
>
>
>
>
( t )
, y( t )e
1
}
e
( t )