TEHT2

a)

a=DSolve[f'[x]==6*f[x], f[x], x]

Plot[f[x]/.a[[1]]/. C[1]->1, {x,0,10}]

s=NDSolve[{y'[x]==6*y[x],y[0]==1},y,{x,0,10}]

Plot[y[x]/.s, {x,0,10}]

b)

f[x]=.; x=.

b=DSolve[f'[x]+3*f[x]==4, f[x], x]

Plot[f[x]/.b /.C[1]->2, {x,0,10}]

b2=NDSolve[{f'[x]+3*f[x]==4, f[0]==2},f,{x,0,10}]

Plot[f[x]/.b2, {x,0,10}]

c)

c=DSolve[4*f''[x]-3*f'[x]+5*f[x]==2, f[x], x]

Re[f[x]/.c/.{C[1]->1, C[2]->1}]

Plot[Re[f[x]/.c/.{C[1]->1, C[2]->1}], {x,0,10}]

c2=NDSolve[{3*f''[x]-3*f'[x]+5*f[x]==2, f[0]==1, f'[0]==1},f,{x,0,10}]

Plot[f[x]/.c2,{x,0,10}]

TEHT3

u=.
a=DSolve[u''[t]==-9.81, u[t], t]

y[t_]:=u[t]/.a[[1]]/.C[1]->y0/.C[2]->vy0

b=DSolve[r'[t]==vx0, r[t], t]

x[t_]:=r[t]/.b[[1]]/.C[1]-> x0

vx0=10
vy0=20
x0=0
y0=0

x[t]
y[t]

ParametricPlot[{x[t],y[t]},{t,0,5}]

Etäisyys :

Solve[y[t]==0, t]

x[t]/.%[[2]]

Lakikorkeus :

D[y[t],t]

y[t]/.Solve[D[y[t],t]==0,t]

TEHT 4

m=1
g=-9.81
k=0.1

a2=DSolve[{d''[t]==g-k/m*d'[t], d[0]==0, d'[0]==20}, d[t], t]

l[t_]=d[t]/.a2[[1]]/.m->10/.g->9.81

Plot[l[t], {t,0,10}]

y2[t_]=u[t]/.a2[[1]]/.C[1]->20/.C[2]->0

Plot[y2[t],{t,0,10}]

b2=DSolve[{m*p''[t]==-k*p'[t], p'[0]==10, p[0]==0},p[t],t]

Plot[]

x2[t_]=p[t]/.b2[[1]]

Plot[x2[t],{t,0,10}]

ParametricPlot[{x2[t],l[t]}, {t,0,5}, AspectRatio->1/GoldenRatio]

lakipiste :

l[t]/.FindRoot[D[l[t],t]==0,{t,1}]

Heiton pituus :

x2[t]/.FindRoot[l[t]==0,{t,5}]

l[t]

D[l[t],t]

Y : n suuntainen rajanopeus :

Limit[%291, t->1000000]

Plot[%, {t,0,100}]