Clear[f,g,x,u,t];M=8;L=1;c=1;
f[x_]=6 x^3 (1-x);g[x]=0;
lam=Table[n Pi/L,{n,1,M}];
A=2/L Integrate[f[x] Sin[lam x],{x,0,L}];
B=lam c 2/L Integrate[g[x] Sin[lam x],{x,0,L}];
u[x_,t_]=(A Cos[lam c t]+B Sin[lam c t]).Sin[lam x];
Plot[u[x,0],{x,0,L}]
Animate[Plot[u[x,t],{x,0,L},PlotStyle->Thick,PlotRange->{{0,L},{-1,1}}],{t,0,(2L)/c,(2L)/(100c)}]

Clear[A,B,U,phi,r]
a=1;b=2;f[phi_]=Sin[2phi];g[phi_]=Sin[phi];
s1=Solve[{A a+B/a==1,A b+B/b==0},{A,B}];
s2=Solve[{A a^2+B/a^2==0,A b^2+B/b^2==1},{A,B}];
U[r_,phi_]=((A r+B r^(-1)) Sin[phi]/.s1)+
((A r^2+B r^(-2)) Sin[2phi]/.s2);
ParametricPlot3D[{r Cos[phi],r Sin[phi],U[r,phi]},{r,a,b},{phi,-Pi,Pi}]
DensityPlot[U[Sqrt[x^2+y^2],ArcTan[x,y]],{x,-2,2},{y,-2,2},ColorFunction->Function[{u},RGBColor[u/2,u,1-u]],RegionFunction->Function[{x,y},1<Sqrt[x^2+y^2]<2]]

f[x_]=2 x^3-x^2;
Integrate[f[x](1+f'[x]^2),{x,0,1}]

Clear[x,f,df,H,L,F];
F[x_,f_,df_]=df^2+3 x f;
L[H_]:=D[H,y[x]]-D[D[H,y'[x]],x];
eq=L[F[x,y[x],y'[x]]];
s=DSolve[{eq==0,y[0]==0,y[Pi/2]==1},y[x],x]//Flatten
Integrate[F[x,y[x]/.s,D[y[x]/.s,x]], {x,0,Pi/2}]

5. Radialna nihanje vpete okrogle menbrane. 
     (((∂^2)u(r,t))/(∂(t^2)))=(c^2) ((((∂^2)u(r,t))/(∂(r^2)))+(1/r)((∂u(r,t))/(∂r)))

Clear[U,R,T,c,k,a,n,A,B,s]
U[r_,t_]:=R[r]*T[t]
eq=Map[#==-k^2&,({D[U[r,t],{r,2}]+1/r D[U[r,t],r],1/c^2*D[U[r,t],{t,2}]}/U[r,t]//FullSimplify)];

de={R[r],T[t]};
nd={r,t};
sol=(MapThread[DSolve[#1,#2,#3]&,{eq,de,nd}]//Flatten);

sx=sol[[1]]/.C[2]->0/.C[1]->1;
sy=sol[[2]]/.C[1]->A[n]/.C[2]->B[n];
s[n_]=R[r]*T[t]/.sx/.sy/.k->BesselJZero[0,n]/a;

Clear[f]
a=1;
c=1;
f[r_,t_]=(s[2]/.A[2]->1/.B[2]-> 0)//N
ξ=BesselJZero[0,1]//N
Animate[ParametricPlot3D[{r Cos[φ],r Sin[φ],f[r,t]},{r,0,a},{φ,0,2 π},PlotPoints->30,PlotRange->{{-a,a},{-a,a},{-1,1}}],{t,0,(2 π a)/(c ξ)}]

6. Valovna enacba v dveh dimezijah 
     (Nihanja vpete pravokotne membrane)
    (((∂^2)u)/(∂(t^2)))==(c^2) ((((∂^2)u)/(∂(x^2)))+(((∂^2)u)/(∂(y^2))))
     Robni pogoji (vpeti rob):
     u(0,y,t)==u(a,y,t)==u(x,0,t)==u(x,b,t)==0.
     Zacetni pogoji (zacetni odmiki in zacene hitrosti):
     u(x,y,0)==f(x,y), ((∂u(x,y,0))/(∂t))==g(x,t).
     Lastne funkcije:
    (Subscript[u, mn])(x,y,t)=((Subscript[A, mn]) cos(π c t (Sqrt[((m^2)/(a^2))+((n^2)/(b^2))]))+(Subscript[B, mn]) sin(π c t (Sqrt[((m^2)/(a^2))+((n^2)/(b^2))])))sin(((π m x)/a)) sin(((π n y)/b))
      
      u(x,y,t)=(∑_m^M)(∑_n^N)(Subscript[u, mn])(x,y,t)
    
      f(x,y)=(∑_m^M)(∑_n^N)(Subscript[A, mn]) sin(((π m x)/a)) sin(((π n x)/b))
      g(x,y)=(∑_m^M)(∑_n^N)c(Sqrt[((m^2)/(a^2))+((n^2)/(b^2))])(Subscript[B, mn]) sin(((π m x)/a)) sin(((π n x)/b))

Clear[u,x,y,t,a,b,c]
a=2.0; b=1.0; c=1;
Nm=5;
Nn=5;
f[x_,y_]:=(a/2-Abs[x-a/2]) (b/2-Abs[y-b/2]);
Lf=Table[Cos[π c t Sqrt[m^2/a^2+n^2/b^2]]*Sin[π m x/a]*Sin[π n y/b],
{m,Nm},{n,Nn}];

Kf=4/(a *b)Integrate[f[x,y]*(Lf/.t->0),{x,0,a},{y,0,b}]//Chop;
u[x_,y_,t_]=Total[Total[Lf*Kf]];

Plot3D[f[x,y],{x,0,a},{y,0,b}]
Plot3D[u[x,y,0],{x,0,a},{y,0,b}]

Animate[Plot3D[u[x,y,t],{x,0,a},{y,0,b},PlotRange->{-0.5,0.5}],{t,0,(2 a b)/(c Sqrt[a^2+b^2])}]

7. Prosta nihanja visece vrvi.
(((∂^2)u)/(∂(t^2)))==(c^2) (∂/(∂x))(x ((∂u)/(∂x)))
u(L,t)=0,  (Abs[u(0,t)])<∞
u(x,0)==f(x),  ((∂u(x,0))/(∂t))==0 
Uvedemo novo spremenljivko x=(ξ^2).
(Subscript[λ, n])==((BesselJZero[0, n])/(Sqrt[L])), (Subscript[ω, n])==(1/2)c (Subscript[λ, n])
(Subscript[u, n])(ξ,t)==(BesselJ[0, (Subscript[λ, n]) ξ]) ( (Subscript[A, n])cos ((Subscript[ω, n]) t)+(Subscript[B, n])sin  ((Subscript[ω, n]) t))

Clear[x,t,ξ,λ,ω,c,L,u]
L=1; c=1;
f[x_]:=(L-x);
M = 8; (*število členov v vrsti*)
λ = Table[BesselJZero[0,n]/Sqrt[L], {n, 1, M}]//N;
ω=(1/2)c λ;
A = 
Integrate[ξ f[ξ^2] BesselJ[0,λ ξ], {ξ, 0, Sqrt[L]}]/Integrate[ξ  BesselJ[0,λ ξ]^2, {ξ, 0, Sqrt[L]}];
u[ξ_,t_]=(A Cos[ω t]).BesselJ[0,λ ξ];
Plot3D[u[Sqrt[x],t],{x,0,L},{t,0,10},PlotRange->All]

Animate[Plot[u[Sqrt[x],t],{x,0,L},PlotStyle->Thick,PlotRange->{{0,L},{-1.2,1.2}}],{t,0,10,0.001}]