// beam2.java ordinary differential equation for a loaded beam // handle Neumann boundary dy/dx=0 at x=0 and x=L better // // given a beam of length L, from 0 < x < L // with Young's Modulus of E // with moment of inertia I // with p(x) being the load density e.g. force per unit length // with both ends fixed, meaning: // y=0 at x=0, y=0 at x=L, dy/dx=0 at x=0, dy/dx=0 at x=L // then the differential equation that defines the y position of // the beam at every x coordinate is // // d^4 y // EI ----- = p(x) with the convention for downward is negative // dx^4 // // for uniformly distributed force (weight) p(x) becomes - W/L // This simple case can be integrated and solved analytically: // // d^4 y // EI ----- = -W/L // dx^4 // // d^3 y // EI ----- = -W/L x + A ( A is constant of integration, value found later) // dx^3 // // d^2 y // EI ----- = -W/L x^2/2 + A x + B // dx^2 // // dy // EI -- = -W/L x^3/6 + A x^2/2 + B x + C we see C=0 because dy/dx=0 at x=0 // dx // // EI y = -W/L x^4/24 + A x^3/6 + B x^2/2 + D we see D=0 because y=0 at x=0 // // substituting y=0 at x=L in the equation above gives // // 0 = -W/L L^4/24 + A L^3/6 + B L^2/2 // // substituting dy/dx=0 at x=L in the equation above the above gives // // 0 = -W/L L^3/6 + A L^2/2 + B L // // solving two equations in two unknowns A = W/2 B = - WL/12 // then substituting for A and B in EI y = ... and combining terms // // W // y = -------- x^2 (x-L)^2 // 24 L EI // // The known solution for a specific case is valuable to check your // programming of a numerical solution before computing a more // general case of p(x) where no closed form solution may exists. // // needs simeq.java class beam2 { // problem definitions double E = 10.0; // constants, values and units can be found double I = 9.0; double W = 7.0; double L = 8.0; double h; // the right hand side of d^4 y / dx^4 double F1(double x, double y) // uniform load { return -W/(L*E*I); } // end F1 beam2() { double x, y, slope; double k1,k2,k3,k4; double y4, y3, y2, y1; int i, n; System.out.println("beam2.java running "); n = 9; h = L/(double)(n-1); System.out.println("E="+E+", I="+I+", W="+W+", L="+L+", h="+h+", n="+n); System.out.println("Analytic Solution."); for(i=0; i