function removeCol($arr, $xv)
{
    $A = array();
    for ($i = 0; $i < count($arr); $i++) {
        $A[$i] = removeRow($arr[$i], $xv);
    }
    return $A;
}
$K = removeCol($K, $xv);
//K(:,xv)=[];
$F = removeRow($F, $xv);
//F(xv)=[];% apply the homogeneous GBCs
echo "\nF 2 = \n\n";
showArray($F, count($F));
$w0 = LUPsolve($K, $F);
//w0=K\F; % nodal displacements
$w1 = array_fill(0, $ndof, 0);
//w1=zeros(ndof,1);
$xv1 = array_fill(0, $ndof, 0);
//xv1=[1:ndof];
for ($i = 0; $i < $ndof; $i++) {
    $xv1[$i] = $i;
}
$xv1 = removeRow($xv1, $xv);
//xv1(xv)=[];
$w1 = replaceVec($w1, $xv1, $w0);
//w1(xv1)=w0; % add the GBCs back
echo "\nw1 = \n\n";
showArray($w1, $ndof);
// %(4) exact solution
// xi=[0:L/99:L]';
// w4=0.01*xi.^5-(1/30)*xi.^3+(7/300)*xi;
$c = 99;
for ($i = 0; $i <= $c; $i++) {
    $xi = $i * $L / $c;
    $w4[$i] = 0.01 * pow($xi, 5) - 1 / 30 * pow($xi, 3) + 7 / 300 * $xi;
}
echo "\nw4 = \n\n";
showArray($w4, $c + 1);