# Having problems with integration

Posted 9 years ago
7071 Views
|
6 Replies
|
2 Total Likes
|
 Using the Double Integration Method to determine the deflection in a beam.What am I doing wrong when I integrate the below equationy[x_] := 168 (-8 + x) + 10 (-8 + x)^2 - 4 (-6 + x) + 5 (-4 + x)^2 + 96 x - 15 x^2This is the result I got in MathematicaOkay, I change the function name, (I don't know why y[x_] doesn't work)a[x_] := 168 (-8 + x) + 10 (-8 + x)^2 - 4 (-6 + x) + 5 (-4 + x)^2 + 96 x - 15 x^2Clearly, if I am integrating I should have an x^3 term, but none, what am I doing wrong here????
6 Replies
Sort By:
Posted 9 years ago
 It might help to use PiecewiseExpand here. Integrate will have an easier time dealing with explicit Piecewise objects than with various other formulations thereof. ycc[x_] = PiecewiseExpand[ 3 Max[0, (-9 + x)]^3 + 1/4 Max[0, (-9 + x)]^4 + 7/2 Max[0, (-3 + x)]^3 - 1/4 Max[0, (-3 + x)]^4 - 12 x^2 + c1 x + c2] (* Out[86]= Piecewise[{{c2 + c1*x - 12*x^2, x <= 3}, {(1/2)*(-1323 + 2*c2 + 243*x + 2*c1*x - 33*x^2 + x^3), x > 9}}, (1/4)*(-459 + 4*c2 + 486*x + 4*c1*x - 228*x^2 + 26*x^3 - x^4)] *) Integrate[ycc[x], x, x] (* Out[87]= Piecewise[{{(1/2)*(c2*x^2 + (c1*x^3)/3 - 2*x^4), x <= 3}, {(9/2)*(-18 + c1 + c2) - (9/10)*(-36 + 5*c1 + 5*c2) + (1/40)*(3321*x + 5*(-459 + 4*c2)*x^2 + (10/3)*(243 + 2*c1)*x^3 - 190*x^4 + 13*x^5 - x^6/3), Inequality[3, Less, x, LessEqual, 9]}}, (81/2)*(-138 + 3*c1 + c2) - (81/40)*(-549 + 60*c1 + 20*c2) + (1/40)*(82053*x + 10*(-1323 + 2*c2)*x^2 + (10/3)*(243 + 2*c1)*x^3 - 55*x^4 + x^5)] *) I was not able to figure out what it was about the solving for the constants that you did not like. In particular that NSolve formulation looked fine. If it is giving something incorrect then there needs to be a better explanation of why, and of what is the desired result.
Posted 9 years ago
 unfortunately I spent an hour explaining my problem but lost all this work because the forum became unavailable. so now of the much shorten explanation. my problem is I have a beam with a couple, two loads, two supports and has the following moment equation:c2 + 3 (-9 + x)^3 + 1/4 (-9 + x)^4 + 7/2 (-3 + x)^3 - 1/4 (-3 + x)^4 + c1 x - 12 x^2to solve for c1 and c2 requires that I use 'singular functions' that is, the term drops out if it evaluates less than zero. In mathematica it looks like thisycc[x_] := 3 Max[0, (-9 + x)]^3 + 1/4 Max[0, (-9 + x)]^4 + 7/2 Max[0, (-3 + x)]^3 - 1/4 Max[0, (-3 + x)]^4 - 12 x^2 + c1 x + c2NSolve[{0 == ycc[x] /. x -> 3, 0 == ycc[x] /. x -> 9}, {c1, c2}]the results are: {{c1 -> 72., c2 -> -108.}}my first expression above has been integrated twice generating the c1 and c2 terms, then I have to solve for them to have a complete equation that represents the deflection on the loaded beam. so if I "just simplify" my first equation I will get the wrong values for c1 and c2 as they evaluate at different location differently along the beam and different terms will drop out at different locations on the beam. This is reason why I can't integrate a simplified form of the equation, as terms will be combined losing the ability to drop those terms (representing different loads) that come after the location I am determining the deflection in the beam.
Posted 9 years ago
 I know how frustrating it is to loose the outcome of an hour of work. Nevertheless, I would need to know the equations which 'create' the c1 and c2.
Posted 9 years ago
 thanks IvanI had tried Clearing the function without success before, but it worked this time, possibly I was focusing on the wrong variables. Regarding the integration, I now understand that the command Integrate will simplify the expression before it integrates. This doesn't work for me as each term needs to be evaluate separately after it has been integrated twice.y2 is my original function, y1 after integration and y after the second integration. After solving for C2 and C1x, in yf[x] each term is evaluated depending how far along the beam one needs to determine the deflection of the beam at that location. By simplifying the expression before integration destroys the whole value of the expression. Is there anyway in Mathematica to integrate this expression without having it simplified first????
Posted 9 years ago
 Unfortunately, you don't tell us what C2 and C1 stand for. So what you intend to do is not clear to me (I don't take the time to figure out all possibilities which are consistent with the incomplete information you give). It sounds absolutely strange to me that the simplification of a term should render any meaningful computational strategy impossible. Could you provide a full description of the beam deflection problem?
Posted 9 years ago
 Hi, I don't know why y[x_] doesn't work The reason for this is clear from the error message, y was set to 168 (-8+ x)+10 (-8+ x)^2- 4 (-6+ x)+ 5 (-4+ x)^2+96 x-15 x^2. You just need to Clear[] the definition of y. what am I doing wrong here????  y[x_] = 168 (-8 + x) + 10 (-8 + x)^2 - 4 (-6 + x) + 5 (-4 + x)^2 + 96 x - 15 x^2 ; y[x] // Simplify (* 60 (-10 + x) *) I.M.