Function reference · Assumptions and sets

assume

Adds a real numeric interval assumption for a symbol so assumption-aware operations can use the known range.

Assumptions narrow a plain variable to a non-empty interval of real numeric values. Repeated constraints for the same variable are intersected, and contradictory constraints are rejected without replacing the previous assumption.

Assumptions are used conservatively. They can influence comparisons and transformations that depend on sign or ordering, but they are not a general logical theorem system.

Examples

These examples use Nerdamer Notation.

Intersect repeated constraints to restrict x to [0, 10).

assume(x>=0); assume(x<10)

Use positivity information in a sign-sensitive logarithm simplification.

assume(x>0); assume(y>0); simplify(log(x)+log(y))
// → log(x*y)

The parser form can preserve an exact rational bound.

assume(x==1/3)

Interfaces

The same operation is available through the interfaces below.

Nerdamer Notation · nerdamer API · Direct API

Nerdamer Notation

Use this form inside input passed to nerdamer(...).

assume(arg1)

nerdamer.assume

Call the operation through the default nerdamer import.

nerdamer.assume(expr: string): Assumption
nerdamer.assume(symbol: string, exprOrAssumption: string | Assumption): Assumption

Parameters

NameTypeDescription
exprstringComplete constraint in the supported assumption grammar.

Returns

Assumption — The registered interval after intersection with any existing constraint.

Browse the nerdamer API →

Direct JavaScript / TypeScript API

Import the operation directly from its package entry point.

import { assume } from 'nerdamer/assumptions';
assume(expr: string): Assumption
assume(symbol: string, exprOrAssumption: string | Assumption): Assumption

Parameters

NameTypeDescription
exprstringComplete constraint in the supported assumption grammar.

Returns

Assumption — The registered interval after intersection with any existing constraint.

Browse nerdamer/assumptions

Notes

  • The direct string API accepts a variable, a comparison operator, and a numeric bound. Parser notation can evaluate arithmetic such as 1/3 before storing the bound.
  • Assumption state is process-wide until it is cleared or forgotten.

← Back to Reference