Rayleigh, Ritz-Galerkin

1. Rayleigh - Quotiont berechnen mit Versuchsfunktionen

xL = 1;
R[y_, x1_] := -NIntegrate[y''[x]  y[x], {x, 0, x1}]/
                  NIntegrate[ x y[x]^2, {x, 0, x1}];
y[x_, 1 ] := Sin[(Pi)/xL x];
y[x_, 2 ] := x Sin[(Pi)/xL x];
y[x_, 3 ] := Sqrt[x] Sin[(Pi)/xL x];
y[x_, 4 ] := Sqrt[xL - x] Sin[(Pi)/xL x];
y[x_, 5 ] := x(x - xL);
y[x_, 6 ] := x (x - xL)^2;
y[x_, 7 ] := x^2 (x - xL);
y[x_, 8 ] := x^2 (x - xL)^2;
y[x_, 9 ] := x^3 (x - xL)^3;
y[x_, 10] := x^4 (x - xL)^4;
Table[y[x_] := y[x, k]; {k, y[x], R[y, xL]}, {k, 1, 10}] // MatrixForm

Table[Plot[y[x,s],{x,0,xL}],{s,1,10}];

2. Eigenwert numerisch berechnen

Ausprobieren

Remove["Global`*"]

xL = 1;

solv = 
      DSolve[{y''[x] == -k x y[x]}, y, x] // 
        Flatten

Integrate[AiryAi[z],z]

Integrate[AiryBi[z],z]

yy[x_] := (y[x] /. solv) /. {C[1] -> c1, 
          C[2] -> c2}

yy[x]

yy[0]

yy[0] // N

yy[x][[1]][[2]]

yy[x][[1]][[2]] /. x -> 0

yy[x][[2]][[2]]

yy[x][[2]][[2]] /. x -> 0

solve1 = Solve[yy[0] == 0, {c1}] // Flatten

yy1[x_] := yy[x] /. solve1;  yy1[x]

Nochmals

Remove["Global`*"]

solv = DSolve[{y''[x] == -k x y[x], y[0] == 0}, y, x] // Flatten

solv = DSolve[{y''[x] == -k x y[x], y[0] == 0}, y, x] // Flatten;
yy[x_]:=(y[x]/.solv)/.{C[2]->c2}; yy[x]

Bemerkung: Reelle  k's erzeugen hier komplexe Nenner im Funktionsargument

Plot[
        Re[(yy[x] /. {c2 -> 1, k -> 19.613548583248857})], {x, 
          0, 3}];

Plot[
        Im[(yy[x] /. {c2 -> 1, k -> 19.613548583248857})], {x, 
          0, 3}];

FindRoot[
      Re[(yy[x] /. {c2 -> 1, k -> 19.613548583248857})], {x, 
        1}]

FindRoot[
      Im[(yy[x] /. {c2 -> 1, k -> 19})], {x, 1}]

FindRoot[Im[(yy[x]/.{c2->1,x->1})],{k,19}]

FindRoot[Im[(yy[x]/.{c2->1,k->18.9563})],{x,1}]

Plot[Re[(yy[x]/.{c2->1,k->18.9563})],{x,-0.1,1.1}];
Plot[Im[(yy[x]/.{c2->1,k->18.9563})],{x,-0.1,1.1}];

Plot[Re[(yy[x]/Re[yy[0.6]]/.{c2->1,k->18.9563})] - Im[(yy[x]/Im[yy[0.6]]/.{c2->1,k->18.9563})]
,{x,0,1}];

Plot[Chop[Re[(yy[x]/Re[yy[0.6]]/.{c2->1,k->18.9563})] - Im[(yy[x]/Im[yy[0.6]]/.{c2->1,k->18.9563})]]
,{x,0,3}];

Zum Ritz-Galerkin-Verfahren

xL=1;
y1[x_]:=Sin[(Pi)/xL x];
y2[x_]:=x^2 (x-xL)^2;
y3[x_]:=x(x-xL);
A[ya_,yb_]:= -Integrate[D[ya[x],{x,2}] yb[x],{x,0,xL}];
B[ya_,yb_]:= Integrate[x ya[x] yb[x],{x,0,xL}];
H[ya_,yb_,λ_]:= A[ya,yb] - λ B[ya,yb];
m = {
{H[y1,y1,λ],H[y1,y2,λ],H[y1,y3,λ]},
{H[y2,y1,λ],H[y2,y2,λ],H[y2,y3,λ]},
{H[y3,y1,λ],H[y3,y2,λ],H[y3,y3,λ]}
}; 
Print[m//Simplify//MatrixForm ];
Print[Det[m]//N//ExpandAll//Simplify ];
NSolve[Det[m]==0,{λ}]

Nochmals: Weitere Eigenwerte

Remove["Global`*"]

solv = DSolve[{y''[x] == -k x y[x], y[0] == 0}, y, x] // Flatten

solv = DSolve[{y''[x] == -k x y[x], y[0] == 0}, y, x] // Flatten;
yy[x_]:=(y[x]/.solv)/.{C[2]->c2}; yy[x]

2. Eigenwert

FindRoot[Re[(yy[x]/.{c2->1,x->1})],{k,178.23}]

FindRoot[Im[(yy[x]/.{c2->1,x->1})],{k,189.221}]

FindRoot[Re[(yy[x]/.{c2->1,k->189.221})],{x,1}]

FindRoot[Im[(yy[x]/.{c2->1,k->189.221})],{x,1}]

3. Eigenwert

FindRoot[Re[(yy[x]/.{c2->1,x->1})],{k,692.818}]

FindRoot[Im[(yy[x]/.{c2->1,x->1})],{k,777.698}]

FindRoot[Re[(yy[x]/.{c2->1,k->777.698})],{x,1}]

FindRoot[Im[(yy[x]/.{c2->1,k->777.698})],{x,1}]