# Calculation of a bending line

Hi everybody,

i have two problems by using Sage to solve a technical difficulty and hope you can help me with it.

I want to calculate a bending line of a girder with two regions with different second moments of areas.

The first Problem is About the handling of sage. I get a solution, but i can't extract the single variables of the solution list.

The second Problem is that the solution isn't correct. I calculated the bending line at Excel and the area of the greater diameter has a wrong position and gradient. I don't know where the error is.

I hope you can help me and please excuse my bad english talent!

Greatings

Forceman

```
reset
var ('a_s,a,b,c,M,F,Delta,x_I,x_II')
var ('E,I_R,I_W')
var ('C_1_I,C_1_II,C_1_III,C_1_IV,C_2_I,C_2_II,C_2_III,C_2_IV')
MI=function('MI')(x_I)
MII=function('MII')(x_II)
MI = F*(a_s-x_I)
MII = M-M/c*x_II
w_sI = MI.integral(x_I)+C_1_I
w_I = (w_sI.integral(x_I)+C_2_I)/(E*I_W)
w_sI = w_sI/(E*I_W)
w_sII = MII.integral(x_II)+C_1_II
w_II = (w_sII.integral(x_II)+C_2_II)/(E*I_W)
w_sII = w_sII/(E*I_W)
w_sIII = MII.integral(x_II)+C_1_III
w_III = (w_sIII.integral(x_II)+C_2_III)/(E*I_R)
w_sIII = w_sIII/(E*I_R)
w_sIV = MII.integral(x_II)+C_1_IV
w_IV = (w_sIV.integral(x_II)+C_2_IV)/(E*I_W)
w_sIV = w_sIV/(E*I_W)
sols = solve([
w_I(x_I=0)==0,
w_sI(x_I=0)==w_sII(x_II=0),
w_II(x_II=0)==0,
w_II(x_II=a)==w_III(x_II=a),
w_sII(x_II=a)==w_sIII(x_II=a),
w_III(x_II=b)==w_IV(x_II=b),
w_sIII(x_II=b)==w_sIV(x_II=b),
w_IV(x_II=c)==0],
C_2_IV,C_2_III,C_2_II,C_2_I,C_1_IV,C_1_III,C_1_II,C_1_I,solution_dict=true)
C_1_I = C_1_I.subs(sols[0])
C_1_II = C_1_II.subs(sols[0])
C_1_III = C_1_III.subs(sols[0])
C_1_IV = C_1_IV.subs(sols[0])
C_2_I = C_2_I.subs(sols[0])
C_2_II = C_2_II.subs(sols[0])
C_2_III = C_2_III.subs(sols[0])
C_2_IV = C_2_IV.subs(sols[0])
```

**Update that the OP added as an "answer"; I have removed the answer and updated the question:**

```
MI = F*(a_s-x_I)
MII = M-M/c*x_II
```

This is the definition of the the moment course. The Moment is caused by the force at point V. Till the first bearing position the Moment increases, between the two bearings it decreases till 0.

If the moment course is integrated two times, you get the bending line.

```
w_sI = MI.integral(x_I)+C_1_I
w_I = (w_sI.integral(x_I)+C_2_I)/(E*I_W)
w_sI = w_sI/(E*I_W)
```

Divided with the local stiffness `w_I`

returns the displacement at position `x_I`

in the area `I`

, `w_sI`

the inclation.

The constants of integration are received by the boundary conditions

```
sols = solve([
w_I(x_I=0)==0,
w_sI(x_I=0)==w_sII(x_II=0),
w_II(x_II=0)==0,
w_II(x_II=a)==w_III(x_II=a),
w_sII(x_II=a)==w_sIII(x_II=a),
w_III(x_II=b)==w_IV(x_II=b),
w_sIII(x_II=b)==w_sIV(x_II=b),
w_IV(x_II=c)==0],
C_2_IV,C_2_III,C_2_II,C_2_I,C_1_IV,C_1_III,C_1_II,C_1_I,solution_dict=true)
```

Here: Displacement at the Bearing positions = 0, displacement and inclinations at the transition points are equal at both sides.

```
C_1_I = C_1_I.subs(sols[0])
C_1_II = C_1_II.subs(sols[0])
C_1_III = C_1_III.subs(sols[0])
C_1_IV = C_1_IV.subs(sols[0])
C_2_I = C_2_I.subs(sols[0])
C_2_II = C_2_II.subs(sols[0])
C_2_III = C_2_III.subs(sols[0])
C_2_IV = C_2_IV.subs(sols[0])
```

This part of the code only returns the equation `C_1_I`

to all constants. The expression `sols[1]`

returns an error.

The second error i think isn't a Sage error, rather an error of the mathematical approach, which i can't detect.

Please document the code and/ or explain the mathematical situation. Then explicitly, which data cannot be extracted from the above solution? Which is the object that cannot be inspected? And which is the expected solution. Is there maybe some simpler situation with the same problem (but with less and/or simpler equations)? Why does the simple extraction

`sage: sols[0][C_2_III]`

with the answer`1/6*(2*(I_R - I_W)*M*a^3 - 3*(I_R - I_W)*M*a^2*c)/(I_W*c)`

not work?@Forceman Please note you can

editthe contents of your question using the "edit" link at the bottom of the post. Please add updates as edits or comments, and not as "answers". I have gone ahead and deleted the updates you posted as an "answer" and added them as edits to your question.