Socket
Socket
Sign inDemoInstall

2d-algebra

Package Overview
Dependencies
0
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.2 to 3.1.3

lib/node/Abs.d.ts

4

lib/Expression.d.ts
import { ExpressionStack } from "./ExpressionStack";
import { Identifier, INode, Term } from "./node/index";
export declare type Assignments = Map<Identifier, number>;
export declare type Substitutions = Map<Identifier, Expression>;
export declare type Substitutions = Map<Identifier, Term>;
export declare class Expression {

@@ -14,2 +14,4 @@ readonly a: INode;

toThe(n: number): Expression;
abs(): Expression;
abs(b: Term): ExpressionStack<Expression>;
sin(): Expression;

@@ -16,0 +18,0 @@ sin(b: Term): ExpressionStack<Expression>;

@@ -30,2 +30,8 @@ "use strict";

}
abs(b) {
if (b !== undefined) {
return this.push(b).abs();
}
return new Expression((0, index_1.abs)(this.a));
}
sin(b) {

@@ -32,0 +38,0 @@ if (b !== undefined) {

@@ -20,2 +20,4 @@ import { Expression } from "./Expression";

toThe(c: number): ExpressionStack<N>;
abs(): ExpressionStack<N>;
abs(b: Term): ExpressionStack<ExpressionStack<N>>;
sin(): ExpressionStack<N>;

@@ -28,3 +30,4 @@ sin(b: Term): ExpressionStack<ExpressionStack<N>>;

push(b: Term): ExpressionStack<ExpressionStack<N>>;
toString(indent?: string, inline?: boolean): any;
}
export {};

@@ -5,2 +5,4 @@ "use strict";

const Expression_1 = require("./Expression");
const InlineFormat_1 = require("./format/InlineFormat");
const TreeFormat_1 = require("./format/TreeFormat");
const index_1 = require("./node/index");

@@ -49,2 +51,8 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any

}
abs(b) {
if (b !== undefined) {
return this.push(b).abs();
}
return new ExpressionStack(this.parent, (0, index_1.abs)(this.b));
}
sin(b) {

@@ -71,4 +79,10 @@ if (b !== undefined) {

}
toString(indent = "", inline = true) {
const pStr = this.parent.toString(indent, inline);
const fmt = inline ? new InlineFormat_1.InlineFormat() : new TreeFormat_1.TreeFormat();
const bStr = this.b.toString(indent, fmt);
return pStr + " | " + bStr;
}
}
exports.ExpressionStack = ExpressionStack;
//# sourceMappingURL=ExpressionStack.js.map

@@ -32,2 +32,3 @@ import { Assignments, Expression, Substitutions } from "../Expression";

export declare function eq(a: INode, b: INode): INode;
export declare function abs(a: INode): any;
export declare const degreeSum: Constant;

@@ -34,0 +35,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.degreeComparator = exports.degreeSum = exports.eq = exports.tan = exports.cos = exports.sin = exports.div = exports.pow = exports.mult = exports.sub = exports.add = exports.value = exports.variable = exports.toNode = void 0;
exports.degreeComparator = exports.degreeSum = exports.abs = exports.eq = exports.tan = exports.cos = exports.sin = exports.div = exports.pow = exports.mult = exports.sub = exports.add = exports.value = exports.variable = exports.toNode = void 0;
const Expression_1 = require("../Expression");
const Abs_1 = require("./Abs");
const Add_1 = require("./Add");

@@ -57,2 +58,5 @@ const Constant_1 = require("./Constant");

}
if (a instanceof Abs_1.Absolute && b instanceof Abs_1.Absolute) {
return abs(add(a.a, b.a));
}
// bubble sort the terms

@@ -105,2 +109,5 @@ if (b instanceof Add_1.Add) {

}
if (a instanceof Abs_1.Absolute && b instanceof Abs_1.Absolute) {
return abs(mult(a.a, b.a));
}
// bubble sort the terms

@@ -219,2 +226,18 @@ if (b instanceof Multiply_1.Multiply) {

exports.eq = eq;
function abs(a) {
if (a instanceof Constant_1.Constant) {
return value(Math.abs(a.n));
}
if (a instanceof Abs_1.Absolute) {
return a;
}
if (a instanceof Multiply_1.Multiply && a.a instanceof Constant_1.Constant) {
return mult(value(Math.abs(a.a.n)), abs(a.b));
}
if (a instanceof Power_1.Power && a.b % 2 == 0) {
return a;
}
return new Abs_1.Absolute(a);
}
exports.abs = abs;
// marker used in computing the sort order of terms.

@@ -221,0 +244,0 @@ exports.degreeSum = new Constant_1.Constant(NaN);

@@ -27,3 +27,3 @@ "use strict";

if (r !== undefined) {
return r.a;
return (0, index_1.toNode)(r);
}

@@ -30,0 +30,0 @@ return this;

{
"name": "2d-algebra",
"version": "3.1.2",
"version": "3.1.3",
"description": "Library for building expressions and computing derivatives",

@@ -5,0 +5,0 @@ "repository": "github:abersnaze/2d-algebra",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc