Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/piratta/gymApp/llms.txt

Use this file to discover all available pages before exploring further.

FocusFlow’s workout math utilities, located in src/utils/workoutMath.ts, provide pure functions for estimating one-rep maxima and generating percentage-based load tables. These functions power the in-app 1RM calculator and the progressive overload suggestions shown to both coaches and athletes during session planning.
All three functions are fully tree-shakeable exports. Import only the functions you need to keep client bundles lean.

calculate1RM

Calculates the estimated one-repetition maximum (1RM) from a sub-maximal lift using either the Epley or Brzycki formula. This is the foundational building block used by both getRMPercentage and generateRMTable.
export function calculate1RM(
  weight: number,
  reps: number,
  formula: 'epley' | 'brzycki' = 'epley'
): number

Parameters

ParameterTypeDescription
weightnumberLoad lifted in kg (or lbs — unit is consistent throughout)
repsnumberNumber of repetitions performed at that load
formula'epley' | 'brzycki'Formula to use (defaults to 'epley')

Return value

The estimated 1RM rounded to 1 decimal place. Returns 0 if weight ≤ 0 or reps ≤ 0. Returns weight unchanged when reps === 1 (the lift itself is the 1RM).

Formulas

Epley:
1RM = weight × (1 + reps / 30)
Brzycki:
1RM = weight / (1.0278 − 0.0278 × reps)
Brzycki’s denominator approaches zero as reps approach 37. When reps ≥ 37, FocusFlow automatically falls back to the Epley formula to avoid a division-by-zero or negative result.

Usage example

import { calculate1RM } from './utils/workoutMath';

// Athlete lifted 80 kg for 5 reps
const oneRM = calculate1RM(80, 5, 'epley');
// => 93.3

// Same lift using Brzycki
const oneRMBrzycki = calculate1RM(80, 5, 'brzycki');
// => 94.6

// Edge cases
calculate1RM(0, 5, 'epley');  // => 0  (invalid weight)
calculate1RM(80, 1, 'epley'); // => 80 (single rep: already the 1RM)

getRMPercentage

Calculates the target training load for a given percentage of a known 1RM. Use this to prescribe warm-up sets, back-off sets, or any intensity zone.
export function getRMPercentage(
  oneRM: number,
  percentage: number
): number

Parameters

ParameterTypeDescription
oneRMnumberThe athlete’s one-rep max (from calculate1RM or a tested max)
percentagenumberDesired intensity as a whole number (e.g. 80 for 80%)

Return value

oneRM × (percentage / 100), rounded to 1 decimal place. Returns 0 if either argument is ≤ 0.

Usage example

import { calculate1RM, getRMPercentage } from './utils/workoutMath';

const oneRM = calculate1RM(80, 5, 'epley'); // 93.3

// Target weight for an 80% intensity set
const targetWeight = getRMPercentage(oneRM, 80);
// => 74.6

// Warm-up set at 60%
const warmUp = getRMPercentage(oneRM, 60);
// => 56.0
Pair getRMPercentage with the intensity field on RoutineExercise to auto-fill suggested weights when the coach prescribes a load as a percentage of the athlete’s last tested 1RM.

generateRMTable

Generates a full 12-entry repetition-maximum table from a single sub-maximal effort. Each entry maps a rep count (1–12) to the corresponding recommended weight and percentage of 1RM, using the standard strength-training percentage map.
export function generateRMTable(
  weight: number,
  reps: number,
  formula: 'epley' | 'brzycki' = 'epley'
): { reps: number; weight: number; percentage: number }[]

Parameters

ParameterTypeDescription
weightnumberLoad used in the reference set
repsnumberReps performed at that load
formula'epley' | 'brzycki'Formula used to estimate the 1RM (defaults to 'epley')

Return value

An array of 12 objects { reps, weight, percentage } covering rep counts 1 through 12. Returns an empty array [] if the computed 1RM is ≤ 0.

Percentage map

The function uses the following standard resistance-training percentage map:
Reps% of 1RM
1100%
295%
393%
490%
587%
685%
783%
880%
977%
1075%
1172%
1270%

Example output for a 100 kg 1RM

When the estimated 1RM is 100 kg, generateRMTable produces the following load table:
Reps% of 1RMTarget Weight (kg)
1100%100.0
295%95.0
393%93.0
490%90.0
587%87.0
685%85.0
783%83.0
880%80.0
977%77.0
1075%75.0
1172%72.0
1270%70.0

Usage example

import { generateRMTable } from './utils/workoutMath';

// Athlete squatted 90 kg for 6 reps
const table = generateRMTable(90, 6, 'epley');

// table[0] => { reps: 1,  percentage: 100, weight: 105.9 }
// table[4] => { reps: 5,  percentage: 87,  weight: 92.1  }
// table[7] => { reps: 8,  percentage: 80,  weight: 84.7  }
// table[11]=> { reps: 12, percentage: 70,  weight: 74.1  }

Build docs developers (and LLMs) love