Resources Numerical accuracy

Calculations

Every calculation under our calculation policies: what it works out, its formula and the precision it runs at. Open one to see its code as it is in the released app.

  • 6,917 calculations in 1,248 source files
  • 143 exact
  • 6,286 in 64-bit
  • 335 with a 32-bit step
  • Last reviewed

Calculations

  • Solve with a Cholesky factorization

    Solves RᵀR X = B by two triangular substitutions.

    CraftScript dense linear algebra cs-lib-linalg.js
    • PartCraft
    64-bit
  • QR factorization

    Factors a matrix as an orthogonal matrix times an upper triangular one.

    H = I − β v vᵀ, β = 2 ÷ (vᵀv)

    CraftScript dense linear algebra cs-lib-linalg.js
    • PartCraft
    64-bit
  • Symmetric eigenvalues and vectors

    All eigenvalues, and optionally eigenvectors, of a symmetric matrix, in ascending order.

    CraftScript dense linear algebra cs-lib-linalg.js
    • PartCraft
    64-bit
  • Generalized symmetric eigenproblem

    Eigenvalues and vectors of K v = λ M v for symmetric K and positive definite M.

    M = RᵀR; C = R⁻ᵀ K R⁻¹; C y = λ y; v = R⁻¹ y

    CraftScript dense linear algebra cs-lib-linalg.js
    • PartCraft
    64-bit
  • Choice of solver for A x = b

    Picks the method for the backslash operator and linsolve, for dense and sparse matrices.

    CraftScript dense linear algebra cs-lib-linalg.js
    • PartCraft
    64-bit
  • Matrix inverse

    The inverse of a square matrix.

    CraftScript dense linear algebra cs-lib-linalg.js
    • PartCraft
    64-bit
  • Determinant

    The determinant of a square matrix.

    det A = sign × Π U_ii

    CraftScript dense linear algebra cs-lib-linalg.js
    • PartCraft
    64-bit
  • Vector and matrix norms

    The 1, 2, infinity, p and Frobenius norms.

    ‖x‖₂ = √(Σ xᵢ²); ‖A‖₂ = √(λ_max(AᵀA))

    CraftScript dense linear algebra cs-lib-linalg.js
    • PartCraft
    64-bit
  • Condition number

    The 2-norm condition number of a matrix.

    cond A = √(λ_max(AᵀA) ÷ λ_min(AᵀA))

    CraftScript dense linear algebra cs-lib-linalg.js
    • PartCraft
    64-bit
  • Sparse matrix from triplets

    Builds a sparse matrix from row, column and value lists, adding values that share a place.

    CraftScript sparse matrices and direct factorization cs-lib-linalg.js
    • PartCraft
    64-bit
  • Weighted sum of two sparse matrices

    a·A + b·B for matrices of the same size.

    C_ij = a × A_ij + b × B_ij

    CraftScript sparse matrices and direct factorization cs-lib-linalg.js
    • PartCraft
    64-bit
  • Sparse matrix times vector

    The product of a sparse matrix and a vector.

    y_r = Σ_k val_k × x_col(k)

    CraftScript sparse matrices and direct factorization cs-lib-linalg.js
    • PartCraft
    64-bit
  • Sparse matrix times sparse matrix

    The product of two sparse matrices.

    CraftScript sparse matrices and direct factorization cs-lib-linalg.js
    • PartCraft
    64-bit
  • Symmetry test

    Decides whether a sparse matrix is symmetric, which selects the solver.

    max |S − Sᵀ| ≤ 1e-10 × max |S|

    CraftScript sparse matrices and direct factorization cs-lib-linalg.js
    • PartCraft
    64-bit
  • Envelope size after reordering

    Counts the stored entries and the work of the skyline factorization for an ordering.

    entries = Σ wᵢ; work = Σ wᵢ² ÷ 2, wᵢ = i − firstᵢ + 1

    CraftScript sparse matrices and direct factorization cs-lib-linalg.js
    • PartCraft
    64-bit
  • Envelope Cholesky factorization and solve

    Factors a symmetric positive definite sparse matrix and solves with the factor.

    L_ij = (A_ij − Σ_k L_ik L_jk) ÷ L_jj; L_ii = √(A_ii − Σ_k L_ik²)

    CraftScript sparse matrices and direct factorization cs-lib-linalg.js
    • PartCraft
    64-bit
  • Assembly of element matrices

    Adds weighted element matrices into one sparse matrix.

    K = Σ_e w_e × P_eᵀ Ke P_e

    CraftScript sparse matrices and direct factorization cs-lib-linalg.js
    • PartCraft
    64-bit
  • Preconditioned conjugate gradients

    Solves a symmetric positive definite sparse system with the pcg builtin.

    CraftScript iterative solvers and sparse eigenvalues cs-lib-linalg.js
    • PartCraft
    64-bit
  • Jacobi preconditioner

    Scales a residual by the inverse of the matrix diagonal.

    zᵢ = rᵢ ÷ A_ii

    CraftScript iterative solvers and sparse eigenvalues cs-lib-linalg.js
    • PartCraft
    64-bit
  • Incomplete LU factorization

    The ILU(0) preconditioner used by BiCGSTAB.

    CraftScript iterative solvers and sparse eigenvalues cs-lib-linalg.js
    • PartCraft
    64-bit
  • BiCGSTAB

    Solves a general sparse system by iteration.

    stop when ‖r‖ ÷ ‖b‖ < tol

    CraftScript iterative solvers and sparse eigenvalues cs-lib-linalg.js
    • PartCraft
    64-bit
  • Rigid-body vectors for AMG

    Builds the translation and rotation vectors the multigrid preconditioner uses.

    rotation about the centroid: (−(y − c_y), x − c_x)

    CraftScript iterative solvers and sparse eigenvalues cs-lib-linalg.js
    • PartCraft
    64-bit
  • Smallest eigenvalues of a sparse problem

    The k smallest eigenvalues and vectors of K v = λ M v.

    stop when |λⱼ − λⱼ(previous)| ≤ tol × |λⱼ| for every j ≤ k

    CraftScript iterative solvers and sparse eigenvalues cs-lib-linalg.js
    • PartCraft
    64-bit
  • One operator on two numbers

    Adds, subtracts, multiplies, divides, compares or takes the remainder of two numbers.

    mod(x, y) = x − ⌊x ÷ y⌋ × y; rem(x, y) = x − trunc(x ÷ y) × y

    CraftScript array arithmetic cs-tensor.js
    • PartCraft
    64-bit
  • Hypotenuse

    √(x² + y²) for two numbers.

    m × √((x ÷ m)² + (y ÷ m)²), m = max(|x|, |y|)

    CraftScript array arithmetic cs-tensor.js
    • PartCraft
    64-bit
  • Power

    x raised to the power y.

    CraftScript array arithmetic cs-tensor.js
    • PartCraft
    64-bit
  • Elementwise loops

    Applies an operator to every element of one or two arrays.

    CraftScript array arithmetic cs-tensor.js
    • PartCraft
    64-bit
  • Matrix product

    The product of two dense matrices in a script expression.

    C_ij = Σ_p A_ip × B_pj

    CraftScript array arithmetic cs-tensor.js
    • PartCraft
    64-bit
  • Backslash for dense matrices

    Solves A x = b, or the least-squares problem when A is not square.

    CraftScript array arithmetic cs-tensor.js
    • PartCraft
    64-bit
  • Number of elements in a range

    How many values a:s:b has.

    n = ⌊(b − a) ÷ s + max(3ε × max(|a|, |b|) ÷ |s|, 1e-10)⌋ + 1

    CraftScript array arithmetic cs-tensor.js
    • PartCraft
    64-bit
  • Values of a range

    The values a, a + s, a + 2s … up to b.

    x_k = a + k × s

    CraftScript array arithmetic cs-tensor.js
    • PartCraft
    64-bit
  • Sum, product, mean, maximum and minimum

    Reduces an array along one dimension.

    mean = (Σ xₖ) ÷ n

    CraftScript array arithmetic cs-tensor.js
    • PartCraft
    64-bit
  • Unit factors

    The factors that turn the given force, length and torque units into newtons, millimeters and newton millimeters.

    Design-it sizing and hand checks design-it.js
    • PartCraft
    64-bit
  • Arguments to working units

    Converts the given force, lengths and torque to N, mm and N·mm.

    value × unit factor

    Design-it sizing and hand checks design-it.js
    • PartCraft
    64-bit
  • Rounding to stock sizes and to reported decimals

    Rounds a thickness up to a stock plate or a 0.5 mm step, and rounds reported values.

    r2(v) = round(100 v) ÷ 100; r3(v) = round(1000 v) ÷ 1000

    Design-it sizing and hand checks design-it.js
    • PartCraft
    64-bit
  • Bolt positions in the flange

    The heights of the two bolts and the flange height.

    y_b = t + 1.5 × hole; spacing = clamp(round(a ÷ 10) × 5, 30, 100); H = y_t + 1.5 × hole

    Design-it sizing and hand checks design-it.js
    • PartCraft
    64-bit
  • Bracket checks

    Bending and shear stress, tip deflection and bolt loads of the bracket, each with its limit and safety factor.

    σ = 6 F a ÷ (b t²); τ = 1.5 F ÷ (b t); δ = F a³ ÷ (3 E I), I = b t³ ÷ 12; T = M y₂ ÷ (y₁² + y₂²); (T ÷ T_all)² + (V ÷ V_all)² ≤ 1

    Design-it sizing and hand checks design-it.js
    • PartCraft
    64-bit
  • Bracket sizing, volume and mass

    The thickness for strength and for the deflection limit, the bolt size, and the bracket's volume and mass.

    t = √(6 M ÷ (b σ_allow)); t = ∛(4 F a³ ÷ (E b δ)); V = b (L t + (H − t) t) − 2 (π ÷ 4) hole² t; mass = V × density × 1e-6

    Design-it sizing and hand checks design-it.js
    • PartCraft
    64-bit
  • Shaft checks

    Von Mises stress, torsional shear and twist of a round shaft.

    σ' = 32 ÷ (π d³) × √(M² + ¾T²); τ = 16 T ÷ (π d³); θ = T L ÷ (G J), G = E ÷ (2(1 + ν)), J = π d⁴ ÷ 32

    Design-it sizing and hand checks design-it.js
    • PartCraft
    64-bit
  • Shaft sizing, volume and mass

    The required diameter, the standard size above it, and the shaft's volume and mass.

    d = ∛(32 SF √(M² + ¾T²) ÷ (π S_y)); V = (π ÷ 4) d² L

    Design-it sizing and hand checks design-it.js
    • PartCraft
    64-bit
  • The built part

    Sketches and extrudes the sized bracket or shaft as part features.

    density (g/cm³) = density (kg/m³) ÷ 1000

    Design-it sizing and hand checks design-it.js
    • PartCraft
    64-bit
  • Edges and facet normals

    Finds the mesh's edges, each facet's unit normal, and which edges are sharp.

    sharp when n₁ · n₂ < cos 20°

    Drawing sheet views, dimensions and PDF drawing.js
    • PartCraft
    64-bit
  • One projected view with hidden lines

    Projects the mesh onto a view plane, finds the view's extents, and splits each drawn edge into visible and hidden parts.

    (u, v, w) = (p · right, p · up, p · dir)

    Drawing sheet views, dimensions and PDF drawing.js
    • PartCraft
    64-bit
  • Merging collinear segments

    Joins touching or overlapping segments on the same line and removes hidden lines under visible ones.

    Drawing sheet views, dimensions and PDF drawing.js
    • PartCraft
    64-bit
  • Section hatching

    Hatch lines at an angle inside the cut outline.

    Drawing sheet views, dimensions and PDF drawing.js
    • PartCraft
    64-bit
  • Clip to the detail circle

    Keeps the parts of segments inside the detail view's circle.

    A t² + B t + C = 0; t = (−B ± √(B² − 4AC)) ÷ 2A

    Drawing sheet views, dimensions and PDF drawing.js
    • PartCraft
    64-bit
  • Holes for the hole table

    Collects each hole's axis, diameter and callout from the kernel's cylindrical faces.

    diameter = 2 × smallest radius on the axis

    Drawing sheet views, dimensions and PDF drawing.js
    • PartCraft
    64-bit
  • Hole table rows

    The X and Y of each hole measured from the view's lower-left corner, and its tag.

    x = o · right − u₀; y = o · up − v₀

    Drawing sheet views, dimensions and PDF drawing.js
    • PartCraft
    64-bit
  • Sheet scale

    Picks the drawing scale for a paper size.

    first s in the ISO 5455 series with width × s ≤ 0.82 × area width and height × s ≤ 0.82 × area height

    Drawing sheet views, dimensions and PDF drawing.js
    • PartCraft
    Exact
  • Dimension text

    The text of an overall dimension or a hole table position.

    text = value rounded to 2 decimals

    Drawing sheet views, dimensions and PDF drawing.js
    • PartCraft
    64-bit

A calculation is added only after its source was read. Each statement can be checked in the code shown on its policy's page; the app repositories are public. When a release changes a calculation, its page says so until it has been read again.