```python
# Header starts here.
from sympy.physics.units import *
from sympy import *

# Rounding:
import decimal
from decimal import Decimal as DX
from copy import deepcopy
def iso_round(obj, pv, rounding=decimal.ROUND_HALF_EVEN):
    import sympy
    """
    Rounding acc. to DIN EN ISO 80000-1:2013-08
    place value = Rundestellenwert
    """
    assert pv in set([
        # place value   #  round to:
        1,              #  1
        0.1,            #  1st digit after decimal
        0.01,           #  2nd
        0.001,          #  3rd
        0.0001,         #  4th
        0.00001,        #  5th
        0.000001,       #  6th
        0.0000001,      #  7th
        0.00000001,     #  8th
        0.000000001,    #  9th
        0.0000000001,   # 10th
        ])
    objc = deepcopy(obj)
    try:
        tmp = DX(str(float(objc)))
        objc = tmp.quantize(DX(str(pv)), rounding=rounding)
    except:
        for i in range(len(objc)):
            tmp = DX(str(float(objc[i])))
            objc[i] = tmp.quantize(DX(str(pv)), rounding=rounding)
    return objc

# LateX:
kwargs = {}
kwargs["mat_str"] = "bmatrix"
kwargs["mat_delim"] = ""
# kwargs["symbol_names"] = {FB: "F^{\mathsf B}", }

# Units:
(k, M, G ) = ( 10**3, 10**6, 10**9 )
(mm, cm) = ( m/1000, m/100 )
Newton = kg*m/s**2
Pa     = Newton/m**2
MPa    = M*Pa
GPa    = G*Pa
kN     = k*Newton
deg    = pi/180

half = S(1)/2

# Header ends here.
#
half = S(1)/2

c, EI, l, F = var("c, EI, l, F")
a1, a2 = var("a_1, a_2")
x  = var("x")

# Ansatz:
(x2, x3) = (x*x, x*x*x)
w = (a1*x2 + a2*x3)
wl = w.subs(x,l)

# w', w'':
wp   = diff(w,x)
wpp  = diff(wp,x)
wpp2 = wpp*wpp

# Energy:
I = integrate(wpp2, x)
I = I.subs(x,l)
# Definite integral:
U1 = half*EI*I
U2 = half*c*wl*wl
UF = F*wl
U  = U1 + U2 - UF

pprint("\nU1:")
pprint(U1)
pprint("\nU2:")
pprint(U2)
pprint("\nUF:")
pprint(UF)

# Find Min:
eq1 = diff(U,a1)
eq2 = diff(U,a2)
pprint("\n")
pprint(eq1)
pprint("\n")
pprint(eq2)

Eqs = [eq1, eq2]

# Solve for a1 and a2:
sol=solve(Eqs,[a1,a2])
pprint("\nSolution:")
pprint(sol)

# U1:
#    ⎛    2               2        2  3⎞
# EI⋅⎝4⋅a₁ ⋅l + 12⋅a₁⋅a₂⋅l  + 12⋅a₂ ⋅l ⎠
# ──────────────────────────────────────
#                   2
#
# U2:
#                  2
#   ⎛    2       3⎞
# c⋅⎝a₁⋅l  + a₂⋅l ⎠
# ──────────────────
#         2
#
# UF:
#    ⎛    2       3⎞
# -F⋅⎝a₁⋅l  + a₂⋅l ⎠
#
# Solution:
# ⎧         3⋅F⋅l                -F      ⎫
# ⎪a₁: ───────────────, a₂: ─────────────⎪
# ⎨      ⎛          3⎞                  3⎬
# ⎪    2⋅⎝3⋅EI + c⋅l ⎠      6⋅EI + 2⋅c⋅l ⎪
# ⎩                                      ⎭

```

9ad8e8d7b129d61d6df2244c119fed1e30fd2a5e
ipynb
Jupyter Notebook
ipynb/EMS_02A/Selbst/4.1_cc.ipynb
kassbohm/wb-snippets
f1ac5194e9f60a9260d096ba5ed1ce40b844a3fe
MIT
ipynb/EMS_02A/Selbst/4.1_cc.ipynb
kassbohm/wb-snippets
f1ac5194e9f60a9260d096ba5ed1ce40b844a3fe
MIT
ipynb/EMS_02A/Selbst/4.1_cc.ipynb
kassbohm/wb-snippets
f1ac5194e9f60a9260d096ba5ed1ce40b844a3fe
MIT
Qwen/Qwen-72B
1. YES
2. YES