SOLVE_BEAM_SYMBOLIC

Solves a one-dimensional beam model with symbolic or numeric inputs and returns closed-form expressions for reactions together with the piecewise shear-force and bending-moment equations over each span segment. The implementation uses symbeam to assemble supports, loads, and stiffness properties, then calls the symbolic solver.

The solver enforces static equilibrium and constitutive compatibility to produce piecewise fields. In symbolic form, these satisfy the standard beam differential relation E I \frac{d^4 v(x)}{dx^4} = q(x) together with support and continuity boundary conditions.

Excel Usage

=SOLVE_BEAM_SYMBOLIC(span, supports, loads, young_modulus, inertia)
  • span (str, required): Length of the beam (m or symbolic string).

  • supports (list[list], required): 2D array of support definitions [[x, type]]. x: position. type: “fixed”, “pin”, “roller”, “hinge”.

  • loads (list[list], required): 2D array of load definitions [[type, val, x1, x2]]. type: “point”, “moment”, “dist”. val: magnitude or expression. x1, x2: coordinates.

  • young_modulus (str, optional, default: “E”): Young’s Modulus E (Pa or symbol). Default is ‘E’.

  • inertia (str, optional, default: “I”): Second moment of area I (m4 or symbol). Default is ‘I’.

Returns (dict): Excel data type containing symbolic reactions and piecewise shear-force and bending-moment equations.

Example 1: Cantilever beam with no applied load

Inputs:

span supports loads young_modulus inertia
1 0 fixed point 0 1 200000000000 0.00001

Excel formula:

=SOLVE_BEAM_SYMBOLIC(1, {0,"fixed"}, {"point",0,1}, 200000000000, 0.00001)

Expected output:

{"type":"Double","basicValue":2,"properties":{"Reactions":{"type":"Array","elements":[[{"type":"String","basicValue":"Point"},{"type":"String","basicValue":"Type"},{"type":"String","basicValue":"Expression"}],[{"type":"String","basicValue":"0"},{"type":"String","basicValue":"Force"},{"type":"String","basicValue":"0"}],[{"type":"String","basicValue":"0"},{"type":"String","basicValue":"Moment"},{"type":"String","basicValue":"0"}]]},"Equations":{"type":"Array","elements":[[{"type":"String","basicValue":"Span"},{"type":"String","basicValue":"Field"},{"type":"String","basicValue":"Expression"}],[{"type":"String","basicValue":"[0, 1.00000000000000]"},{"type":"String","basicValue":"V(x)"},{"type":"String","basicValue":"0"}],[{"type":"String","basicValue":"[0, 1.00000000000000]"},{"type":"String","basicValue":"M(x)"},{"type":"String","basicValue":"0"}]]}}}

Example 2: Cantilever beam with zero point load at free end

Inputs:

span supports loads young_modulus inertia
2 0 fixed point 0 2 200000000000 0.00001

Excel formula:

=SOLVE_BEAM_SYMBOLIC(2, {0,"fixed"}, {"point",0,2}, 200000000000, 0.00001)

Expected output:

{"type":"Double","basicValue":2,"properties":{"Reactions":{"type":"Array","elements":[[{"type":"String","basicValue":"Point"},{"type":"String","basicValue":"Type"},{"type":"String","basicValue":"Expression"}],[{"type":"String","basicValue":"0"},{"type":"String","basicValue":"Force"},{"type":"String","basicValue":"0"}],[{"type":"String","basicValue":"0"},{"type":"String","basicValue":"Moment"},{"type":"String","basicValue":"0"}]]},"Equations":{"type":"Array","elements":[[{"type":"String","basicValue":"Span"},{"type":"String","basicValue":"Field"},{"type":"String","basicValue":"Expression"}],[{"type":"String","basicValue":"[0, 2.00000000000000]"},{"type":"String","basicValue":"V(x)"},{"type":"String","basicValue":"0"}],[{"type":"String","basicValue":"[0, 2.00000000000000]"},{"type":"String","basicValue":"M(x)"},{"type":"String","basicValue":"0"}]]}}}

Example 3: Cantilever beam with zero end moment

Inputs:

span supports loads young_modulus inertia
2 0 fixed moment 0 2 200000000000 0.00001

Excel formula:

=SOLVE_BEAM_SYMBOLIC(2, {0,"fixed"}, {"moment",0,2}, 200000000000, 0.00001)

Expected output:

{"type":"Double","basicValue":2,"properties":{"Reactions":{"type":"Array","elements":[[{"type":"String","basicValue":"Point"},{"type":"String","basicValue":"Type"},{"type":"String","basicValue":"Expression"}],[{"type":"String","basicValue":"0"},{"type":"String","basicValue":"Force"},{"type":"String","basicValue":"0"}],[{"type":"String","basicValue":"0"},{"type":"String","basicValue":"Moment"},{"type":"String","basicValue":"0"}]]},"Equations":{"type":"Array","elements":[[{"type":"String","basicValue":"Span"},{"type":"String","basicValue":"Field"},{"type":"String","basicValue":"Expression"}],[{"type":"String","basicValue":"[0, 2.00000000000000]"},{"type":"String","basicValue":"V(x)"},{"type":"String","basicValue":"0"}],[{"type":"String","basicValue":"[0, 2.00000000000000]"},{"type":"String","basicValue":"M(x)"},{"type":"String","basicValue":"0"}]]}}}

Example 4: Cantilever beam with zero distributed load

Inputs:

span supports loads young_modulus inertia
2 0 fixed dist 0 0 2 200000000000 0.00001

Excel formula:

=SOLVE_BEAM_SYMBOLIC(2, {0,"fixed"}, {"dist",0,0,2}, 200000000000, 0.00001)

Expected output:

{"type":"Double","basicValue":2,"properties":{"Reactions":{"type":"Array","elements":[[{"type":"String","basicValue":"Point"},{"type":"String","basicValue":"Type"},{"type":"String","basicValue":"Expression"}],[{"type":"String","basicValue":"0"},{"type":"String","basicValue":"Force"},{"type":"String","basicValue":"0"}],[{"type":"String","basicValue":"0"},{"type":"String","basicValue":"Moment"},{"type":"String","basicValue":"0"}]]},"Equations":{"type":"Array","elements":[[{"type":"String","basicValue":"Span"},{"type":"String","basicValue":"Field"},{"type":"String","basicValue":"Expression"}],[{"type":"String","basicValue":"[0, 2.00000000000000]"},{"type":"String","basicValue":"V(x)"},{"type":"String","basicValue":"0"}],[{"type":"String","basicValue":"[0, 2.00000000000000]"},{"type":"String","basicValue":"M(x)"},{"type":"String","basicValue":"0"}]]}}}

Python Code

Show Code
from symbeam import beam

def solve_beam_symbolic(span, supports, loads, young_modulus='E', inertia='I'):
    """
    Solve a statically determinate beam symbolically and return reactions plus internal-force equations.

    See: https://github.com/amcc1996/symbeam

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

    Args:
        span (str): Length of the beam (m or symbolic string).
        supports (list[list]): 2D array of support definitions [[x, type]].
    x: position.
    type: "fixed", "pin", "roller", "hinge".

        loads (list[list]): 2D array of load definitions [[type, val, x1, x2]].
    type: "point", "moment", "dist".
    val: magnitude or expression.
    x1, x2: coordinates.

        young_modulus (str, optional): Young's Modulus E (Pa or symbol). Default is 'E'. Default is 'E'.
        inertia (str, optional): Second moment of area I (m4 or symbol). Default is 'I'. Default is 'I'.

    Returns:
        dict: Excel data type containing symbolic reactions and piecewise shear-force and bending-moment equations.
    """
    try:
      def to2d(value):
        if not isinstance(value, list):
          return [[value]]
        if value and not any(isinstance(row, list) for row in value):
          return [value]
        return value

      def to_text(value):
        return str(value)

      def to_float_or_raw(value):
        try:
          return float(value)
        except (TypeError, ValueError):
          return value

      span_value = to_float_or_raw(span)
      b = beam(span_value)

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

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

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

      b.set_young(0, span_value, to_float_or_raw(young_modulus))
      b.set_inertia(0, span_value, to_float_or_raw(inertia))

      for row in supports:
        if len(row) < 2:
          continue
        pos = to_float_or_raw(row[0])
        support_type = str(row[1]).lower()
        b.add_support(pos, support_type)

      for row in loads:
        if len(row) < 3:
          continue

        load_type = str(row[0]).lower()
        value = to_float_or_raw(row[1])
        x_one = to_float_or_raw(row[2])
        x_two = to_float_or_raw(row[3]) if len(row) > 3 else None

        if load_type == "point":
          b.add_point_load(x_one, value)
        elif load_type == "moment":
          b.add_point_moment(x_one, value)
        elif load_type in ("dist", "udl", "distributed"):
          if x_two is None:
            return "Error: distributed load requires both x1 and x2"
          b.add_distributed_load(x_one, x_two, value)

      b.solve(output=False)

      reactions = []
      for point in b.points:
        if point.has_reaction_force():
          reactions.append([to_text(point.x_coord), "Force", to_text(point.reaction_force)])
        if point.has_reaction_moment():
          reactions.append([to_text(point.x_coord), "Moment", to_text(point.reaction_moment)])

      equations = []
      for segment in b.segments:
        span_label = f"[{to_text(segment.x_start)}, {to_text(segment.x_end)}]"
        equations.append([span_label, "V(x)", to_text(segment.shear_force)])
        equations.append([span_label, "M(x)", to_text(segment.bending_moment)])

      return {
        "type": "Double",
        "basicValue": float(len(reactions)),
        "properties": {
          "Reactions": {
            "type": "Array",
            "elements": [
              [
                {"type": "String", "basicValue": "Point"},
                {"type": "String", "basicValue": "Type"},
                {"type": "String", "basicValue": "Expression"}
              ]
            ] + [
              [{"type": "String", "basicValue": cell} for cell in row] for row in reactions
            ]
          },
          "Equations": {
            "type": "Array",
            "elements": [
              [
                {"type": "String", "basicValue": "Span"},
                {"type": "String", "basicValue": "Field"},
                {"type": "String", "basicValue": "Expression"}
              ]
            ] + [
              [{"type": "String", "basicValue": cell} for cell in row] for row in equations
            ]
          }
        }
      }
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator

Length of the beam (m or symbolic string).
2D array of support definitions [[x, type]]. x: position. type: "fixed", "pin", "roller", "hinge".
2D array of load definitions [[type, val, x1, x2]]. type: "point", "moment", "dist". val: magnitude or expression. x1, x2: coordinates.
Young's Modulus E (Pa or symbol). Default is 'E'.
Second moment of area I (m4 or symbol). Default is 'I'.