1. Naloga

Clear[Y, x,c,n,pp,p];M=6;
p[x_]=Sum[c[n]x^n,{n,0,M}];
D[p[x],{x,2}]-2x^2D[p[x],x]+p[x];
Take[CoefficientList[%,x],M-1]

(*
Solve[%==0,Table[c[n],{n,2,M}]]
pp[x_]=p[x]/.%/.c[0]->0/.c[1]->1
pa[x_]=y[x]/.DSolve[{y''[x]-2x y'[x]+y[x]==0,y[0]==0,y'[0]==1},y[x],x]//N
Plot[{pp[x],pa[x]},{x,0,2}]
*)

2. Naloga

Clear[x,y,u, subs];
subs=y[x]->u[x]/Sqrt[x]; 
eq=x^2 D[y[x],{x,2}]+x D[y[x],x]+(x^2-1/4) y[x]==0;
neq=eq/.subs/.D[subs,x]/.D[subs,{x,2}]//FullSimplify
DSolve[neq,u[x],x]
subs/.%

3. Naloga

Clear[x,y,z,ξ,λ,pp,qq]
eq0=y''[x]+1/x y'[x]==-λ^2 y[x]
pp=y[x]->  z[ξ[x]]
eq1=eq0/.D[D[pp,x],x]\
/.D[ pp,x]/.pp

qq=ξ[x]->λ x
eq=eq1/.qq\
/.D[qq,{x,2}]\
/.D[qq,x]/.x ->ξ/λ
DSolve[eq,z[ξ],ξ]/.z[ξ]->y[x]/.ξ->λ x

Clear[x,y,z,ξ,λ,pp,qq]
eq0=x/4y''[x]-1/4y'[x]+ω^2 x^3y[x]==0
pp=y[x]->  z[ξ[x]]
eq1=eq0/.D[D[pp,x],x]\
/.D[ pp,x]/.pp

qq=ξ[x]-> x^2
eq=eq1/.qq\
/.D[qq,{x,2}]\
/.D[qq,x]/.x ->Sqrt[ξ]//FullSimplify
DSolve[eq,z[ξ],ξ]/.z[ξ]->y[x]/.ξ->x^2

3. Naloga

bes0=Plot[BesselJ[0,x],{x,0,20},PlotStyle->Red];
bes1=Plot[BesselJ[1,x],{x,0,20},PlotStyle->Green];
b1=BesselJZero[1,1];b2=BesselJZero[1,2];
crta1=ListLinePlot[{{b1,0},{b1,BesselJ[0,b1]}}];
crta2=ListLinePlot[{{b2,0},{b2,BesselJ[0,b2]}}];
Show[bes0,bes1,crta1,crta2]

4. Naloga

Clear[f,g,x]
l=Table[LegendreP[i,x], {i,0,5}];
f[x_]=x^7-x^2+2;
cp=Integrate[l*f[x],{x,-1,1}]/Integrate[l^2,{x,-1,1}];
g[x_]=cp.l
Plot[{g[x],f[x]}, {x,-1.2,1.2}]

5. Naloga

Psi[n_,x_]:=
HermiteH[n,x] E^(-x^2/2)/Sqrt[2^n n!Sqrt[Pi]]
Plot[Psi[10,x], {x,-6,6},PlotStyle->Thick]
Psi[10,x]//FullSimplify
FourierTransform[Psi[10,x],x,ω]//FullSimplify

Clear[f,g,l,x]
nn=5;
f[x_]=x*(1-x)
l[x_]=Table[BesselJ[0,BesselJZero[0,n]x],{n,1,nn}];
	coff=NIntegrate[f[x]*l[x] x,{x,0,1}];
	norm=NIntegrate[l[x]*l[x] x,{x,0,1}];
cs=FullSimplify[(coff/norm)];
Plot[{f[x],(coff/norm).l[x]},{x,0,1}]
Total[cs];