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.
Calculations
-
Solve with a Cholesky factorization
Solves RᵀR X = B by two triangular substitutions.
CraftScript dense linear algebra cs-lib-linalg.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
Symmetric eigenvalues and vectors
All eigenvalues, and optionally eigenvectors, of a symmetric matrix, in ascending order.
CraftScript dense linear algebra cs-lib-linalg.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
Matrix inverse
The inverse of a square matrix.
CraftScript dense linear algebra cs-lib-linalg.js64-bit- PartCraft
-
Determinant
The determinant of a square matrix.
det A = sign × Π U_ii
CraftScript dense linear algebra cs-lib-linalg.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
Sparse matrix times sparse matrix
The product of two sparse matrices.
CraftScript sparse matrices and direct factorization cs-lib-linalg.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
Preconditioned conjugate gradients
Solves a symmetric positive definite sparse system with the pcg builtin.
CraftScript iterative solvers and sparse eigenvalues cs-lib-linalg.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
Incomplete LU factorization
The ILU(0) preconditioner used by BiCGSTAB.
CraftScript iterative solvers and sparse eigenvalues cs-lib-linalg.js64-bit- PartCraft
-
BiCGSTAB
Solves a general sparse system by iteration.
stop when ‖r‖ ÷ ‖b‖ < tol
CraftScript iterative solvers and sparse eigenvalues cs-lib-linalg.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
Hypotenuse
√(x² + y²) for two numbers.
m × √((x ÷ m)² + (y ÷ m)²), m = max(|x|, |y|)
CraftScript array arithmetic cs-tensor.js64-bit- PartCraft
-
Power
x raised to the power y.
CraftScript array arithmetic cs-tensor.js64-bit- PartCraft
-
Elementwise loops
Applies an operator to every element of one or two arrays.
CraftScript array arithmetic cs-tensor.js64-bit- PartCraft
-
Matrix product
The product of two dense matrices in a script expression.
C_ij = Σ_p A_ip × B_pj
CraftScript array arithmetic cs-tensor.js64-bit- PartCraft
-
Backslash for dense matrices
Solves A x = b, or the least-squares problem when A is not square.
CraftScript array arithmetic cs-tensor.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
Values of a range
The values a, a + s, a + 2s … up to b.
x_k = a + k × s
CraftScript array arithmetic cs-tensor.js64-bit- PartCraft
-
Sum, product, mean, maximum and minimum
Reduces an array along one dimension.
mean = (Σ xₖ) ÷ n
CraftScript array arithmetic cs-tensor.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
Section hatching
Hatch lines at an angle inside the cut outline.
Drawing sheet views, dimensions and PDF drawing.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.js64-bit- PartCraft
-
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.jsExact- PartCraft
-
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.js64-bit- PartCraft
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.