@mathigon/hilbert
Advanced tools
Comparing version 0.6.4 to 0.6.5
@@ -427,3 +427,3 @@ 'use strict'; | ||
return [0, Math.max(a[0] ** k, a[1] ** k)]; | ||
return [a[1] ** k, a[0] ** k]; | ||
return range(a[1] ** k, a[0] ** k); | ||
} | ||
@@ -440,5 +440,9 @@ return EMPTY; // TODO Implement this! | ||
const interval = { | ||
add: (a, b) => int(a[0] + b[0], a[1] + b[1]), | ||
add: (...args) => int(core.total(args.map(a => a[0])), core.total(args.map(a => a[1]))), | ||
sub: (a, b) => b !== undefined ? int(a[0] - b[1], a[1] - b[0]) : int(-a[1], -a[0]), | ||
mul: (a, b) => range(a[0] * b[0], a[0] * b[1], a[1] * b[0], a[1] * b[1]), | ||
mul: (a, ...b) => { | ||
if (b.length > 1) | ||
b = [interval.mul(...b)]; | ||
return range(a[0] * b[0][0], a[0] * b[0][1], a[1] * b[0][0], a[1] * b[0][1]); | ||
}, | ||
div: (a, b) => hasZero(b) ? WHOLE : range(a[0] / b[0], a[0] / b[1], a[1] / b[0], a[1] / b[1]), | ||
@@ -758,2 +762,5 @@ abs: (a) => { | ||
} | ||
interval(vars = {}) { | ||
return this.collapse().interval(vars); | ||
} | ||
substitute(vars = {}) { | ||
@@ -760,0 +767,0 @@ return this.collapse().substitute(vars); |
@@ -1,3 +0,3 @@ | ||
import { words, repeat, unique, flatten, isOneOf, join, last, cache } from '@mathigon/core'; | ||
import { lcm, gcd, isBetween, nearlyEquals } from '@mathigon/fermat'; | ||
import { total, words, repeat, unique, flatten, isOneOf, join, last, cache } from '@mathigon/core'; | ||
import { isBetween, lcm, gcd, nearlyEquals } from '@mathigon/fermat'; | ||
@@ -423,3 +423,3 @@ // ============================================================================= | ||
return [0, Math.max(a[0] ** k, a[1] ** k)]; | ||
return [a[1] ** k, a[0] ** k]; | ||
return range(a[1] ** k, a[0] ** k); | ||
} | ||
@@ -436,5 +436,9 @@ return EMPTY; // TODO Implement this! | ||
const interval = { | ||
add: (a, b) => int(a[0] + b[0], a[1] + b[1]), | ||
add: (...args) => int(total(args.map(a => a[0])), total(args.map(a => a[1]))), | ||
sub: (a, b) => b !== undefined ? int(a[0] - b[1], a[1] - b[0]) : int(-a[1], -a[0]), | ||
mul: (a, b) => range(a[0] * b[0], a[0] * b[1], a[1] * b[0], a[1] * b[1]), | ||
mul: (a, ...b) => { | ||
if (b.length > 1) | ||
b = [interval.mul(...b)]; | ||
return range(a[0] * b[0][0], a[0] * b[0][1], a[1] * b[0][0], a[1] * b[0][1]); | ||
}, | ||
div: (a, b) => hasZero(b) ? WHOLE : range(a[0] / b[0], a[0] / b[1], a[1] / b[0], a[1] / b[1]), | ||
@@ -754,2 +758,5 @@ abs: (a) => { | ||
} | ||
interval(vars = {}) { | ||
return this.collapse().interval(vars); | ||
} | ||
substitute(vars = {}) { | ||
@@ -756,0 +763,0 @@ return this.collapse().substitute(vars); |
{ | ||
"name": "@mathigon/hilbert", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"description": "JavaScript expression parsing, MathML rendering and CAS.", | ||
@@ -35,13 +35,13 @@ "keywords": [ | ||
"@types/tape": "4.13.0", | ||
"rollup": "2.46.0", | ||
"rollup": "2.50.5", | ||
"tape": "5.2.2", | ||
"ts-node": "9.1.1", | ||
"ts-node": "10.0.0", | ||
"tslib": "2.2.0", | ||
"typescript": "4.2.4", | ||
"@typescript-eslint/eslint-plugin": "4.22.0", | ||
"@typescript-eslint/parser": "4.22.0", | ||
"eslint": "7.25.0", | ||
"typescript": "4.3.2", | ||
"@typescript-eslint/eslint-plugin": "4.26.0", | ||
"@typescript-eslint/parser": "4.26.0", | ||
"eslint": "7.27.0", | ||
"eslint-config-google": "0.14.0", | ||
"eslint-plugin-import": "2.22.1" | ||
"eslint-plugin-import": "2.23.4" | ||
} | ||
} |
@@ -7,2 +7,3 @@ // ============================================================================= | ||
import {total} from '@mathigon/core'; | ||
import {gcd, isBetween, lcm} from '@mathigon/fermat'; | ||
@@ -106,3 +107,3 @@ import {SpecialFunction} from './symbols'; | ||
if (hasZero(a)) return [0, Math.max(a[0] ** k, a[1] ** k)]; | ||
return [a[1] ** k, a[0] ** k]; | ||
return range(a[1] ** k, a[0] ** k); | ||
} | ||
@@ -124,5 +125,8 @@ | ||
export const interval: Record<Functions, (...args: Interval[]) => Interval> = { | ||
add: (a, b) => int(a[0] + b[0], a[1] + b[1]), | ||
add: (...args) => int(total(args.map(a => a[0])), total(args.map(a => a[1]))), | ||
sub: (a, b) => b !== undefined ? int(a[0] - b[1], a[1] - b[0]) : int(-a[1], -a[0]), | ||
mul: (a, b) => range(a[0] * b[0], a[0] * b[1], a[1] * b[0], a[1] * b[1]), | ||
mul: (a, ...b) => { | ||
if (b.length > 1) b = [interval.mul(...b)]; | ||
return range(a[0] * b[0][0], a[0] * b[0][1], a[1] * b[0][0], a[1] * b[0][1]); | ||
}, | ||
div: (a, b) => hasZero(b)? WHOLE : range(a[0] / b[0], a[0] / b[1], a[1] / b[0], a[1] / b[1]), | ||
@@ -129,0 +133,0 @@ |
@@ -249,2 +249,6 @@ // ============================================================================= | ||
interval(vars: VarMap = {}) { | ||
return this.collapse().interval(vars); | ||
} | ||
substitute(vars: ExprMap = {}) { | ||
@@ -251,0 +255,0 @@ return this.collapse().substitute(vars); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
137678
3664
2