I have a structure shown in figure. It has four members. Each member has represented by two displacement field $W_i$ and $U_i$. I have expressed this displacement field using some functions. I found out the potential energy $v_i$ and kinetic energy $t_i$ associated with these members. Na I have add them together to form total potential energy $V$ and total kinetic energy $T$. Using this total energy I have constructed Lagrangian $Lg$ of this system. I have clearly mentioned the direction of the displacement of these functions using arrows in the figure. To satisfy this displacement I have imposed some kinematic constraints at the location $Z_i$. These are $W_1(x=z_i)=U_{1+i}(x=gamma)$ , $U_1(x=z_i)=W_{1+i}(x=gamma)$ and $frac{dW_1(x=z_i)}{dx}=frac{dW_{i+1}(x=gamma)}{dx}$. These constraints are added in the Lagrangian $Lg$. The modified $Lg$ is minimized with respect to unknown constants (for $W_{i}$ these are $a,b,c,d$) (for $U_{i}$ these are $e,f,g,h$) and the kinematic constraints are imposed with some unknow constants $lambda_{i},alpha_i,beta_{i}$. After minimization, I formed the matrix out of it. I checked The Rank of the matrix it is coming as 16. But the size of the matrix is 17. I don’t know what mistake I am doing.

```
ClearAll("Global`*");
SetDirectory(NotebookDirectory());
Y = 2*^11;
ρ = 7850;
aa = 0.1*0.1;
Iyy = 0.1^4/12;
L1 = 4;
z(1) = L1/4;
z(2) = (2*L1)/4;
z(3) = (3*L1)/4;
γ = 0.5*L1;
k = 1;
beta1 = {1.8751, 4.69409, 7.85476, 10.9955, 14.1372, 17.2788};
mm = Table(((Cos(β*x) -
Cosh(β*
x)) - (((Cos(β*γ) +
Cosh(β*γ))/(Sin(β*γ) +
Sinh(β*γ)))*(Sin(β*x) -
Sinh(β*x)))) /. {β -> beta1((i))/γ}, {i,
1, k});
nn = Table(((Cos(β*x) -
Cosh(β*
x)) - (((Cos(β*L1) +
Cosh(β*L1))/(Sin(β*L1) +
Sinh(β*L1)))*(Sin(β*x) -
Sinh(β*x)))) /. {β -> beta1((i))/L1}, {i, 1, k});
beamV = Flatten({nn});
varbeam1 = Table(Subscript(a, i), {i, 1, k});
W(1) = Total(Table(Subscript(a, i)*beamV((i)), {i, 1, k}));
W1xx = Expand(D(W(1), {x, 2}));
v(1) = 0.5*Y*Iyy*Integrate(Expand((W1xx)^2), {x, 0, L1})
t(1) = 0.5*ρ*aa*ω^2 Integrate(Expand((W(1))^2), {x, 0, L1})
varbeam2 = Table(Subscript(b, i), {i, 1, k});
W(2) = Total(Table(Subscript(b, i)*beamV((i)), {i, 1, k}));
W2xx = Expand(D(W(2), {x, 2}));
v(2) = 0.5*Y*Iyy*Integrate(Expand((W2xx)^2), {x, 0, γ})
t(2) = 0.5*ρ*
aa*ω^2 Integrate(Expand((W(2))^2), {x, 0, γ})
W(3) = W(2) /. b -> c;
W(4) = W(2) /. b -> d;
varbeam3 = varbeam2 /. b -> c;
varbeam4 = varbeam2 /. b -> d;
v(3) = v(2) /. b -> c;
v(4) = v(2) /. b -> d;
t(3) = t(2) /. b -> c;
t(4) = t(2) /. b -> d;
soft = Table(Sin(((2*i + 1)*π*x)/(2*L1)), {i, 0, 0});
barH = Flatten({soft});
Table(Plot(barH(( i)), {x1, 0, γ}), {i, 1, Length(barH)});
U(1) = Expand(
Total(Table(Subscript(e, i)*barH((i)), {i, 1, Length(barH)})))
varbar1 = Table(Subscript(e, i), {i, 1, Length(barH)});
U1x = Expand(D(U(1), {x, 1}));
v(5) = 0.5*aa*Y (Integrate(Expand((U1x)^2), {x, 0, L1}))
t(5) = 0.5*ρ*
aa*ω^2*(Integrate(Expand((U(1))^2), {x, 0, L1}))
vbsf = Table(Sin(((2*i + 1)*π*x)/(2*γ)), {i, 0, 0});
barV = Flatten({vbsf});
Table(Plot(barV(( i)), {x, 0, γ}), {i, 1, Length(barV)});
U(2) = Expand(
Total(Table(Subscript(f, i)*barV((i)), {i, 1, Length(barV)})))
varbar2 = Table(Subscript(f, i), {i, 1, Length(barV)});
U2x = Expand(D(U(2), {x, 1}));
v(6) = 0.5*aa*Y*(Integrate(Expand((U2x)^2), {x, 0, γ}))
t(6) = 0.5*ρ*
aa*ω^2*(Integrate(Expand((U(2))^2), {x, 0, γ}))
U(3) = U(2) /. f -> g;
U(4) = U(2) /. f -> h;
varbar3 = varbar2 /. f -> g;
varbar4 = varbar2 /. f -> h;
v(7) = v(6) /. f -> g;
v(8) = v(6) /. f -> h;
t(7) = t(6) /. f -> g;
t(8) = t(6) /. f -> h;
(*construction of lagrangian*)
T = Sum(t(i), {i, 8});
V = Sum(v(i), {i, 8});
n = 3;
dispcon1 =
Total(Table(
Subscript(λ,
i)*((W(1) /. x -> z(i)) - (U(i + 1) /. x -> γ)), {i, 1,
n}));
dispcon2 =
Total(Table(
Subscript(α,
i)*((U(1) /. x -> z(i)) - (W(i + 1) /. x -> γ)), {i, 1,
n}));
slopcon =
Total(Table(
Subscript(β,
i)*(((D(W(1), {x, 1}) /. x -> (z(i) - 0.001))) - (D(
W(i + 1), {x, 1}) /. x -> (γ - 0.001))), {i, 1, n}))
mp1 = Table(Subscript(λ, i), {i, 1, n});
mp2 = Table(Subscript(α, i), {i, 1, n});
mp3 = Table(Subscript(β, i), {i, 1, n});
varbeam = {varbeam1, varbeam2, varbeam3, varbeam4};
varbar = {varbar1, varbar2, varbar3, varbar4};
var = Flatten({varbeam, varbar, mp1, mp2, mp3})
Lg = (T - V) + dispcon1 + dispcon2 + slopcon
eq = Table(D(Lg, {var((i)), 1}), {i, 1, Length(var)})
Rarz = Normal@CoefficientArrays(eq, var)((2));
MatrixForm(Rarz)
Dimensions(Rarz)
MatrixRank(Rarz)
```