problems with integration
|
01-09-2015, 04:13 AM
(This post was last modified: 01-09-2015 04:16 AM by resolved.)
Post: #36
|
|||
|
|||
RE: problems with integration
Thanks Claudio for your kind input, I have read your post twice, but I will need more time to absorb it all because this subject was taught to me differently. Below is a sample problem I was given:
This is how I solve the problem in Mathematica. Solving for the two supports: NSolve[{(*Ma*) 0 == -25 + 7*2*(1) + 7*(2) + 14*2*(3) + 11 - dv*(7) + 7*2*(8),(*Fv*) 0 == -7*2 - 7 - 14*2 - 7*2 + av + dv}, {av, dv}] {{av -> 33., dv -> 30.}} Setting the problem up: y21 = -25 + 33 x - (7 x*(x/2) - 7 (x - 2) (x - 2)/2) - 7 (x - 2) - (14 (x - 2) (x - 2)/2 - 14 (x - 4) (x - 4)/2) + 11 (x - 4)^0 + 30 (x - 7) - 7 (x - 7) (x - 7)/2 Mathematica simplified y21 to: y22 = -14 + 30 (-7 + x) - 7/2 (-7 + x)^2 + 7 (-4 + x)^2 - 7 (-2 + x) - 7/2 (-2 + x)^2 + 33 x - (7 x^2)/2 but I manually broke the two couples apart as shown below y22 = -25 + 11 (x - 4)^0 + 30 (-7 + x) - 7/2 (-7 + x)^2 + 7 (-4 + x)^2 - 7 (-2 + x) - 7/2 (-2 + x)^2 + 33 x - (7 x^2)/2 I then integrated manually to get: y11 = -25 x + 11 (x - 4) + 30 (-7 + x)^2/2 - 7/2 (-7 + x)^3/3 + 7 (-4 + x)^3/3 - 7 (-2 + x)^2/2 - 7/2 (-2 + x)^3/3 + 33 x^2/2 - 7 /2 x^3/3 Mathematica simplified y11 to (see below) and I added c1: y12 = 15 (-7 + x)^2 - 7/6 (-7 + x)^3 + 11 (-4 + x) + 7/3 (-4 + x)^3 - 7/2 (-2 + x)^2 - 7/6 (-2 + x)^3 - 25 x + (33 x^2)/2 - (7 x^3)/6 + c1 I then manually integrated a second time to get (below) and added c2: y01 = 15 (-7 + x)^3/3 - 7/6 (-7 + x)^4/4 + 11 (-4 + x)^2/2 + 7/3 (-4 + x)^4/4 - 7/2 (-2 + x)^3/3 - 7/6 (-2 + x)^4/4 - 25 x^2/2 + 33/2 x^3/3 - 7/6 x^4/4 + c1 x + c2 Mathematica simplified to get: y02 = c1 x + c2 + 5 (-7 + x)^3 - 7/24 (-7 + x)^4 + 11/2 (-4 + x)^2 + 7/12 (-4 + x)^4 - 7/6 (-2 + x)^3 - 7/24 (-2 + x)^4 - (25 x^2)/2 + ( 11 x^3)/2 - (7 x^4)/24 I then used "Max" instead of piecewise to solve for c1 and c2: y[x_] = c1 x + c2 + 5 Max[0, (-7 + x)]^3 - 7/24 Max[0, (-7 + x)]^4 + 11/2 Max[0, (-4 + x)]^2 + 7/12 Max[0, (-4 + x)]^4 - 7/6 Max[0, (-2 + x)]^3 - 7/24 Max[0, (-2 + x)]^4 - (25 x^2)/2 + ( 11 x^3)/2 - (7 x^4)/24; NSolve[{y[0] == 0, y[7] == 0}, {c1, c2}] {{c1 -> -48.9048, c2 -> 0.}} I then substituted in for c1 and was able to create a plot of the beam deflection yf[x_] := 5 Max[0, (-7 + x)]^3 - 7/24 Max[0, (-7 + x)]^4 + 11/2 Max[0, (-4 + x)]^2 + 7/12 Max[0, (-4 + x)]^4 - 7/6 Max[0, (-2 + x)]^3 - 7/24 Max[0, (-2 + x)]^4 - (25 x^2)/2 + ( 11 x^3)/2 - (7 x^4)/24 - 48.904761904761905` x; Plot[yf[x], {x, 0, 9}] Now HP Prime's turn using Han's program MINT I set up the initial equation as shown below: y1:=−25*MINT(0,0,2)+11*MINT(4,0,2)+30*MINT(7,1,2)-(7/2)*MINT(7,2,2)+7*MINT(4,2,2)-7*MINT(2,1,2)-(7/2)*MINT(2,2,2)+33*MINT(0,1,2)-(7/2)*MINT(0,2,2) The program worked and I got: (x)->-25*CASE IF 0>x THEN 0 END IF x≥0 THEN 1/2*x^2 END END+11*CASE IF 4>x THEN 0 END IF x≥4 THEN 1/2*(x-4)^2 END END+30*CASE IF 7>x THEN 0 END IF x≥7 THEN 1/6*(x-7)^3 END END-7/2*CASE IF 7>x THEN 0 END IF x≥7 THEN 1/12*(x-7)^4 END END+7*CASE IF 4>x THEN 0 END IF x≥4 THEN 1/12*(x-4)^4 END END-7*CASE IF 2>x THEN 0 END IF x≥2 THEN 1/6*(x-2)^3 END END-7/2*CASE IF 2>x THEN 0 END IF x≥2 THEN 1/12*(x-2)^4 END END+33*CASE IF 0>x THEN 0 END IF x≥0 THEN 1/6*x^3 END END-7/2*CASE IF 0>x THEN 0 END IF x≥0 THEN 1/12*x^4 END END I added c1*x + c2 to y1 y2:=y1 + c1*x + c2 and solved for c1 and c2 fsolve({y2(0)=0,y2(7)=0},{c1,c2}) and got the result: [−48.9047619048,0.] cool, much faster than by hand with less chance for error I then created a new function y3:=y1 -48.9047619048 x (how do you extract just the -48.904... out of the matrix???, had to type it in) I checked my memory in CAS variables and found y1, y2, y3 Great now I have an equation that will give me the deflection of the beam at any point on the beam.. so lets try at the end of the beam, 9 meters from point A y3(9) damn -- soooo close, application crashed and I lost all my variables y1,y2 and y3 so what did I do wrong this time???? |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)