ANALYZE_BEAM

Performs a comprehensive numerical analysis of a 1D beam under various loading conditions. Using the indeterminatebeam library, this function calculates the reaction forces and moments at specified support locations, as well as internal forces (axial, shear, bending moment) and deflections across the beam span.

The analysis considers the equilibrium of forces and moments, solving for indeterminacy using energy methods. Users can specify fixed, pinned, roller, or spring supports, and apply point loads, moments, or distributed loads.

Excel Usage

=ANALYZE_BEAM(span, supports, loads, e_modulus, second_moment, area)
  • span (float, required): Total length of the beam (m).

  • supports (list[list], required): 2D array of support definitions [[x, rx, ry, rm, …]]. x: position (m). rx, ry, rm: 1 for fixed, 0 for free (or stiffness value for spring).

  • loads (list[list], required): 2D array of load definitions [[type, val1, val2, x1, x2]]. type: “point”, “moment”, “udl”, “trap”. val1: force/moment value (N or N/m). val2: ending force for trapezoidal (N/m). x1, x2: start/end positions (m).

  • e_modulus (float, optional, default: 200000000000): Young’s Modulus (Pa).

  • second_moment (float, optional, default: 0.00000905): Second moment of area (m4).

  • area (float, optional, default: 0.23): Cross-sectional area (m2).

Returns (dict): A dictionary containing beam reactions and internal forces at sampled intervals.

Example 1: Simply supported beam with point load

Inputs:

span supports loads
5 0 0 1 0 point -1000 0 2.5 0
5 0 1 0

Excel formula:

=ANALYZE_BEAM(5, {0,0,1,0;5,0,1,0}, {"point",-1000,0,2.5,0})

Expected output:

{"type":"Double","basicValue":5,"properties":{"React":{"type":"Array","elements":[[{"type":"String","basicValue":"Pos"},{"type":"String","basicValue":"Rx"},{"type":"String","basicValue":"Ry"},{"type":"String","basicValue":"Rm"}],[{"type":"Double","basicValue":0},{"type":"Double","basicValue":0},{"type":"Double","basicValue":500},{"type":"Double","basicValue":0}],[{"type":"Double","basicValue":5},{"type":"Double","basicValue":0},{"type":"Double","basicValue":500},{"type":"Double","basicValue":0}]]},"Forces":{"type":"Array","elements":[[{"type":"String","basicValue":"Pos"},{"type":"String","basicValue":"V"},{"type":"String","basicValue":"M"},{"type":"String","basicValue":"v"}],[{"type":"Double","basicValue":0},{"type":"Double","basicValue":500},{"type":"Double","basicValue":0.00005},{"type":"Double","basicValue":1e-10}],[{"type":"Double","basicValue":2.5},{"type":"Double","basicValue":500},{"type":"Double","basicValue":1250},{"type":"Double","basicValue":-0.00143877}],[{"type":"Double","basicValue":5},{"type":"Double","basicValue":-500},{"type":"Double","basicValue":0.00005},{"type":"Double","basicValue":-1e-10}]]}}}

Example 2: Cantilever with UDL

Inputs:

span supports loads
3 0 1 1 1 udl -500 0 0 3

Excel formula:

=ANALYZE_BEAM(3, {0,1,1,1}, {"udl",-500,0,0,3})

Expected output:

{"type":"Double","basicValue":3,"properties":{"React":{"type":"Array","elements":[[{"type":"String","basicValue":"Pos"},{"type":"String","basicValue":"Rx"},{"type":"String","basicValue":"Ry"},{"type":"String","basicValue":"Rm"}],[{"type":"Double","basicValue":0},{"type":"Double","basicValue":0},{"type":"Double","basicValue":1500},{"type":"Double","basicValue":2250}]]},"Forces":{"type":"Array","elements":[[{"type":"String","basicValue":"Pos"},{"type":"String","basicValue":"V"},{"type":"String","basicValue":"M"},{"type":"String","basicValue":"v"}],[{"type":"Double","basicValue":0},{"type":"Double","basicValue":1500},{"type":"Double","basicValue":-2250},{"type":"Double","basicValue":0}],[{"type":"Double","basicValue":1.5},{"type":"Double","basicValue":750},{"type":"Double","basicValue":-562.5},{"type":"Double","basicValue":-0.000990591}],[{"type":"Double","basicValue":3},{"type":"Double","basicValue":0.00005},{"type":"Double","basicValue":0},{"type":"Double","basicValue":-0.00279696}]]}}}

Example 3: Propped cantilever

Inputs:

span supports loads
4 0 1 1 1 point -2000 0 2 0
4 0 1 0

Excel formula:

=ANALYZE_BEAM(4, {0,1,1,1;4,0,1,0}, {"point",-2000,0,2,0})

Expected output:

{"type":"Double","basicValue":4,"properties":{"React":{"type":"Array","elements":[[{"type":"String","basicValue":"Pos"},{"type":"String","basicValue":"Rx"},{"type":"String","basicValue":"Ry"},{"type":"String","basicValue":"Rm"}],[{"type":"Double","basicValue":0},{"type":"Double","basicValue":0},{"type":"Double","basicValue":1375},{"type":"Double","basicValue":1500}],[{"type":"Double","basicValue":4},{"type":"Double","basicValue":0},{"type":"Double","basicValue":625},{"type":"Double","basicValue":0}]]},"Forces":{"type":"Array","elements":[[{"type":"String","basicValue":"Pos"},{"type":"String","basicValue":"V"},{"type":"String","basicValue":"M"},{"type":"String","basicValue":"v"}],[{"type":"Double","basicValue":0},{"type":"Double","basicValue":1375},{"type":"Double","basicValue":-1500},{"type":"Double","basicValue":0}],[{"type":"Double","basicValue":2},{"type":"Double","basicValue":1375},{"type":"Double","basicValue":1250},{"type":"Double","basicValue":-0.000644567}],[{"type":"Double","basicValue":4},{"type":"Double","basicValue":-625},{"type":"Double","basicValue":0.0000625},{"type":"Double","basicValue":-1e-10}]]}}}

Example 4: Beam with trapezoidal load

Inputs:

span supports loads
6 0 0 1 0 trap -1000 -2000 0 6
6 0 1 0

Excel formula:

=ANALYZE_BEAM(6, {0,0,1,0;6,0,1,0}, {"trap",-1000,-2000,0,6})

Expected output:

{"type":"Double","basicValue":6,"properties":{"React":{"type":"Array","elements":[[{"type":"String","basicValue":"Pos"},{"type":"String","basicValue":"Rx"},{"type":"String","basicValue":"Ry"},{"type":"String","basicValue":"Rm"}],[{"type":"Double","basicValue":0},{"type":"Double","basicValue":0},{"type":"Double","basicValue":4000},{"type":"Double","basicValue":0}],[{"type":"Double","basicValue":6},{"type":"Double","basicValue":0},{"type":"Double","basicValue":5000},{"type":"Double","basicValue":0}]]},"Forces":{"type":"Array","elements":[[{"type":"String","basicValue":"Pos"},{"type":"String","basicValue":"V"},{"type":"String","basicValue":"M"},{"type":"String","basicValue":"v"}],[{"type":"Double","basicValue":0},{"type":"Double","basicValue":4000},{"type":"Double","basicValue":0.0004},{"type":"Double","basicValue":7e-10}],[{"type":"Double","basicValue":3},{"type":"Double","basicValue":250},{"type":"Double","basicValue":6750},{"type":"Double","basicValue":-0.0139848}],[{"type":"Double","basicValue":6},{"type":"Double","basicValue":-5000},{"type":"Double","basicValue":0.0005},{"type":"Double","basicValue":-8e-10}]]}}}

Python Code

Show Code
from indeterminatebeam import Beam, Support
from indeterminatebeam.loading import PointLoadV, PointLoadH, PointTorque, UDLV, TrapezoidalLoadV

def analyze_beam(span, supports, loads, e_modulus=200000000000, second_moment=9.05e-06, area=0.23):
    """
    Perform numerical analysis of a structural beam to determine reactions and internal forces.

    See: https://indeterminatebeam.readthedocs.io/en/main/docstrings.html#indeterminatebeam.Beam.analyse

    This example function is provided as-is without any representation of accuracy.

    Args:
        span (float): Total length of the beam (m).
        supports (list[list]): 2D array of support definitions [[x, rx, ry, rm, ...]].
    x: position (m).
    rx, ry, rm: 1 for fixed, 0 for free (or stiffness value for spring).

        loads (list[list]): 2D array of load definitions [[type, val1, val2, x1, x2]].
    type: "point", "moment", "udl", "trap".
    val1: force/moment value (N or N/m).
    val2: ending force for trapezoidal (N/m).
    x1, x2: start/end positions (m).

        e_modulus (float, optional): Young's Modulus (Pa). Default is 200000000000.
        second_moment (float, optional): Second moment of area (m4). Default is 9.05e-06.
        area (float, optional): Cross-sectional area (m2). Default is 0.23.

    Returns:
        dict: A dictionary containing beam reactions and internal forces at sampled intervals.
    """
    try:
        def to2d(value):
            return [[value]] if not isinstance(value, list) else value

        supports = to2d(supports)
        loads = to2d(loads)

        if not isinstance(supports, list) or not all(isinstance(row, list) for row in supports):
            return "Error: Invalid input - supports must be a 2D list"
        if not isinstance(loads, list) or not all(isinstance(row, list) for row in loads):
            return "Error: Invalid input - loads must be a 2D list"

        beam = Beam(span=span, E=e_modulus, I=second_moment, A=area)

        support_rows = []
        has_x_restraint = False
        for row in supports:
            if len(row) < 4:
                continue
            try:
                x_pos = float(row[0])
                rx_raw = float(row[1])
                ry_raw = float(row[2])
                rm_raw = float(row[3])
            except (TypeError, ValueError):
                continue

            kx = rx_raw if rx_raw > 1 else None
            ky = ry_raw if ry_raw > 1 else None
            rx_fixed = int(bool(rx_raw)) if kx is None else 0
            ry_fixed = int(bool(ry_raw)) if ky is None else 0
            rm_fixed = int(bool(rm_raw))

            if rx_fixed == 1 or (kx is not None and kx > 0):
                has_x_restraint = True

            support_rows.append({
                "x": x_pos,
                "fixed": (rx_fixed, ry_fixed, rm_fixed),
                "kx": kx,
                "ky": ky,
            })

        if not support_rows:
            return "Error: At least one valid support is required"

        if not has_x_restraint:
            support_rows[0]["fixed"] = (1, support_rows[0]["fixed"][1], support_rows[0]["fixed"][2])
            support_rows[0]["kx"] = None

        for support in support_rows:
            beam.add_supports(Support(support["x"], fixed=support["fixed"], kx=support["kx"], ky=support["ky"]))

        for row in loads:
            if len(row) < 2:
                continue
            l_type = str(row[0]).lower()
            try:
                val1 = float(row[1])
                val2 = float(row[2]) if len(row) > 2 else 0.0
                x1 = float(row[3]) if len(row) > 3 else 0.0
                x2 = float(row[4]) if len(row) > 4 else 0.0
            except (TypeError, ValueError):
                continue

            if l_type == "point":
                beam.add_loads(PointLoadV(val1, x1))
            elif l_type == "moment":
                beam.add_loads(PointTorque(val1, x1))
            elif l_type == "udl":
                beam.add_loads(UDLV(val1, (x1, x2)))
            elif l_type == "trap":
                beam.add_loads(TrapezoidalLoadV((val1, val2), (x1, x2)))
            elif l_type == "point_h":
                beam.add_loads(PointLoadH(val1, x1))

        beam.analyse()

        reactions_data = []
        for x_pos in sorted({support["x"] for support in support_rows}):
            reaction = beam.get_reaction(x_pos)
            if reaction is None:
                continue
            reactions_data.append([
                {"type": "Double", "basicValue": float(x_pos)},
                {"type": "Double", "basicValue": float(reaction[0])},
                {"type": "Double", "basicValue": float(reaction[1])},
                {"type": "Double", "basicValue": float(reaction[2])}
            ])

        internal_data = []
        step = span / 2.0
        for i in range(3):
            x_query = i * step
            v_val = float(beam.get_shear_force(x_query))
            m_val = float(beam.get_bending_moment(x_query))
            d_val = float(beam.get_deflection(x_query))
            internal_data.append([
                {"type": "Double", "basicValue": float(x_query)},
                {"type": "Double", "basicValue": v_val},
                {"type": "Double", "basicValue": m_val},
                {"type": "Double", "basicValue": d_val}
            ])

        return {
            "type": "Double",
            "basicValue": span,
            "properties": {
                "React": {
                    "type": "Array",
                    "elements": [
                        [{"type": "String", "basicValue": "Pos"}, {"type": "String", "basicValue": "Rx"}, {"type": "String", "basicValue": "Ry"}, {"type": "String", "basicValue": "Rm"}]
                    ] + reactions_data
                },
                "Forces": {
                    "type": "Array",
                    "elements": [
                        [{"type": "String", "basicValue": "Pos"}, {"type": "String", "basicValue": "V"}, {"type": "String", "basicValue": "M"}, {"type": "String", "basicValue": "v"}]
                    ] + internal_data
                }
            }
        }
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator

Total length of the beam (m).
2D array of support definitions [[x, rx, ry, rm, ...]]. x: position (m). rx, ry, rm: 1 for fixed, 0 for free (or stiffness value for spring).
2D array of load definitions [[type, val1, val2, x1, x2]]. type: "point", "moment", "udl", "trap". val1: force/moment value (N or N/m). val2: ending force for trapezoidal (N/m). x1, x2: start/end positions (m).
Young's Modulus (Pa).
Second moment of area (m4).
Cross-sectional area (m2).