Simplify alias definitions

This commit is contained in:
thepaperpilot 2023-03-23 19:22:27 -05:00
parent 6e4c61155a
commit f589184c9e

View file

@ -421,23 +421,13 @@ export default class Formula<T extends [FormulaSource] | FormulaSource[]> {
integrate: ops.integrateNeg integrate: ops.integrateNeg
}); });
} }
public static negate<T extends GenericFormula>(value: T): Omit<T, "invertIntegral">; public static negate = Formula.neg;
public static negate(value: FormulaSource): GenericFormula; public static negated = Formula.neg;
public static negate(value: FormulaSource) {
return Formula.neg(value);
}
public static negated<T extends GenericFormula>(value: T): Omit<T, "invertIntegral">;
public static negated(value: FormulaSource): GenericFormula;
public static negated(value: FormulaSource) {
return Formula.neg(value);
}
public static sign(value: FormulaSource): GenericFormula { public static sign(value: FormulaSource): GenericFormula {
return new Formula({ inputs: [value], evaluate: Decimal.sign }); return new Formula({ inputs: [value], evaluate: Decimal.sign });
} }
public static sgn(value: FormulaSource) { public static sgn = Formula.sign;
return Formula.sign(value);
}
public static round(value: FormulaSource): GenericFormula { public static round(value: FormulaSource): GenericFormula {
return new Formula({ inputs: [value], evaluate: Decimal.round }); return new Formula({ inputs: [value], evaluate: Decimal.round });
@ -469,12 +459,7 @@ export default class Formula<T extends [FormulaSource] | FormulaSource[]> {
invertIntegral: ops.invertIntegrateAdd invertIntegral: ops.invertIntegrateAdd
}); });
} }
public static plus<T extends GenericFormula>(value: T, other: FormulaSource): T; public static plus = Formula.add;
public static plus<T extends GenericFormula>(value: FormulaSource, other: T): T;
public static plus(value: FormulaSource, other: FormulaSource): GenericFormula;
public static plus(value: FormulaSource, other: FormulaSource) {
return Formula.add(value, other);
}
public static sub<T extends GenericFormula>(value: T, other: FormulaSource): T; public static sub<T extends GenericFormula>(value: T, other: FormulaSource): T;
public static sub<T extends GenericFormula>(value: FormulaSource, other: T): T; public static sub<T extends GenericFormula>(value: FormulaSource, other: T): T;
@ -490,18 +475,8 @@ export default class Formula<T extends [FormulaSource] | FormulaSource[]> {
invertIntegral: ops.invertIntegrateSub invertIntegral: ops.invertIntegrateSub
}); });
} }
public static subtract<T extends GenericFormula>(value: T, other: FormulaSource): T; public static subtract = Formula.sub;
public static subtract<T extends GenericFormula>(value: FormulaSource, other: T): T; public static minus = Formula.sub;
public static subtract(value: FormulaSource, other: FormulaSource): GenericFormula;
public static subtract(value: FormulaSource, other: FormulaSource) {
return Formula.sub(value, other);
}
public static minus<T extends GenericFormula>(value: T, other: FormulaSource): T;
public static minus<T extends GenericFormula>(value: FormulaSource, other: T): T;
public static minus(value: FormulaSource, other: FormulaSource): GenericFormula;
public static minus(value: FormulaSource, other: FormulaSource) {
return Formula.sub(value, other);
}
public static mul<T extends GenericFormula>(value: T, other: FormulaSource): T; public static mul<T extends GenericFormula>(value: T, other: FormulaSource): T;
public static mul<T extends GenericFormula>(value: FormulaSource, other: T): T; public static mul<T extends GenericFormula>(value: FormulaSource, other: T): T;
@ -516,18 +491,8 @@ export default class Formula<T extends [FormulaSource] | FormulaSource[]> {
invertIntegral: ops.invertIntegrateMul invertIntegral: ops.invertIntegrateMul
}); });
} }
public static multiply<T extends GenericFormula>(value: T, other: FormulaSource): T; public static multiply = Formula.mul;
public static multiply<T extends GenericFormula>(value: FormulaSource, other: T): T; public static times = Formula.mul;
public static multiply(value: FormulaSource, other: FormulaSource): GenericFormula;
public static multiply(value: FormulaSource, other: FormulaSource) {
return Formula.mul(value, other);
}
public static times<T extends GenericFormula>(value: T, other: FormulaSource): T;
public static times<T extends GenericFormula>(value: FormulaSource, other: T): T;
public static times(value: FormulaSource, other: FormulaSource): GenericFormula;
public static times(value: FormulaSource, other: FormulaSource) {
return Formula.mul(value, other);
}
public static div<T extends GenericFormula>(value: T, other: FormulaSource): T; public static div<T extends GenericFormula>(value: T, other: FormulaSource): T;
public static div<T extends GenericFormula>(value: FormulaSource, other: T): T; public static div<T extends GenericFormula>(value: FormulaSource, other: T): T;
@ -542,12 +507,9 @@ export default class Formula<T extends [FormulaSource] | FormulaSource[]> {
invertIntegral: ops.invertIntegrateDiv invertIntegral: ops.invertIntegrateDiv
}); });
} }
public static divide<T extends GenericFormula>(value: T, other: FormulaSource): T; public static divide = Formula.div;
public static divide<T extends GenericFormula>(value: FormulaSource, other: T): T; public static divideBy = Formula.div;
public static divide(value: FormulaSource, other: FormulaSource): GenericFormula; public static dividedBy = Formula.div;
public static divide(value: FormulaSource, other: FormulaSource) {
return Formula.div(value, other);
}
public static recip<T extends GenericFormula>(value: T): T; public static recip<T extends GenericFormula>(value: T): T;
public static recip(value: FormulaSource): GenericFormula; public static recip(value: FormulaSource): GenericFormula;
@ -560,16 +522,8 @@ export default class Formula<T extends [FormulaSource] | FormulaSource[]> {
invertIntegral: ops.invertIntegrateRecip invertIntegral: ops.invertIntegrateRecip
}); });
} }
public static reciprocal<T extends GenericFormula>(value: T): T; public static reciprocal = Formula.recip;
public static reciprocal(value: FormulaSource): GenericFormula; public static reciprocate = Formula.recip;
public static reciprocal(value: FormulaSource): GenericFormula {
return Formula.recip(value);
}
public static reciprocate<T extends GenericFormula>(value: T): T;
public static reciprocate(value: FormulaSource): GenericFormula;
public static reciprocate(value: FormulaSource) {
return Formula.recip(value);
}
public static max(value: FormulaSource, other: FormulaSource): GenericFormula { public static max(value: FormulaSource, other: FormulaSource): GenericFormula {
return new Formula({ return new Formula({
@ -641,12 +595,7 @@ export default class Formula<T extends [FormulaSource] | FormulaSource[]> {
invertIntegral: ops.invertIntegrateLog invertIntegral: ops.invertIntegrateLog
}); });
} }
public static logarithm<T extends GenericFormula>(value: T, base: FormulaSource): T; public static logarithm = Formula.log;
public static logarithm<T extends GenericFormula>(value: FormulaSource, base: T): T;
public static logarithm(value: FormulaSource, base: FormulaSource): GenericFormula;
public static logarithm(value: FormulaSource, base: FormulaSource) {
return Formula.log(value, base);
}
public static log2<T extends GenericFormula>(value: T): T; public static log2<T extends GenericFormula>(value: T): T;
public static log2(value: FormulaSource): GenericFormula; public static log2(value: FormulaSource): GenericFormula;
@ -1048,23 +997,13 @@ export default class Formula<T extends [FormulaSource] | FormulaSource[]> {
public neg(this: GenericFormula) { public neg(this: GenericFormula) {
return Formula.neg(this); return Formula.neg(this);
} }
public negate<T extends GenericFormula>(this: T): Omit<T, "invertIntegral">; public negate = this.neg;
public negate(this: GenericFormula): GenericFormula; public negated = this.neg;
public negate(this: GenericFormula) {
return Formula.neg(this);
}
public negated<T extends GenericFormula>(this: T): Omit<T, "invertIntegral">;
public negated(this: GenericFormula): GenericFormula;
public negated(this: GenericFormula) {
return Formula.neg(this);
}
public sign() { public sign() {
return Formula.sign(this); return Formula.sign(this);
} }
public sgn() { public sgn = this.sign;
return this.sign();
}
public round() { public round() {
return Formula.round(this); return Formula.round(this);
@ -1088,12 +1027,7 @@ export default class Formula<T extends [FormulaSource] | FormulaSource[]> {
public add(this: GenericFormula, value: FormulaSource) { public add(this: GenericFormula, value: FormulaSource) {
return Formula.add(this, value); return Formula.add(this, value);
} }
public plus<T extends GenericFormula>(this: T, value: FormulaSource): T; public plus = this.add;
public plus<T extends GenericFormula>(this: GenericFormula, value: T): T;
public plus(this: GenericFormula, value: FormulaSource): GenericFormula;
public plus(value: FormulaSource) {
return Formula.add(this, value);
}
public sub<T extends GenericFormula>(this: T, value: FormulaSource): T; public sub<T extends GenericFormula>(this: T, value: FormulaSource): T;
public sub<T extends GenericFormula>(this: GenericFormula, value: T): T; public sub<T extends GenericFormula>(this: GenericFormula, value: T): T;
@ -1101,18 +1035,8 @@ export default class Formula<T extends [FormulaSource] | FormulaSource[]> {
public sub(value: FormulaSource) { public sub(value: FormulaSource) {
return Formula.sub(this, value); return Formula.sub(this, value);
} }
public subtract<T extends GenericFormula>(this: T, value: FormulaSource): T; public subtract = this.sub;
public subtract<T extends GenericFormula>(this: GenericFormula, value: T): T; public minus = this.sub;
public subtract(this: GenericFormula, value: FormulaSource): GenericFormula;
public subtract(value: FormulaSource) {
return Formula.sub(this, value);
}
public minus<T extends GenericFormula>(this: T, value: FormulaSource): T;
public minus<T extends GenericFormula>(this: GenericFormula, value: T): T;
public minus(this: GenericFormula, value: FormulaSource): GenericFormula;
public minus(value: FormulaSource) {
return Formula.sub(this, value);
}
public mul<T extends GenericFormula>(this: T, value: FormulaSource): T; public mul<T extends GenericFormula>(this: T, value: FormulaSource): T;
public mul<T extends GenericFormula>(this: GenericFormula, value: T): T; public mul<T extends GenericFormula>(this: GenericFormula, value: T): T;
@ -1120,18 +1044,8 @@ export default class Formula<T extends [FormulaSource] | FormulaSource[]> {
public mul(value: FormulaSource) { public mul(value: FormulaSource) {
return Formula.mul(this, value); return Formula.mul(this, value);
} }
public multiply<T extends GenericFormula>(this: T, value: FormulaSource): T; public multiply = this.mul;
public multiply<T extends GenericFormula>(this: GenericFormula, value: T): T; public times = this.mul;
public multiply(this: GenericFormula, value: FormulaSource): GenericFormula;
public multiply(value: FormulaSource) {
return Formula.mul(this, value);
}
public times<T extends GenericFormula>(this: T, value: FormulaSource): T;
public times<T extends GenericFormula>(this: GenericFormula, value: T): T;
public times(this: GenericFormula, value: FormulaSource): GenericFormula;
public times(value: FormulaSource) {
return Formula.mul(this, value);
}
public div<T extends GenericFormula>(this: T, value: FormulaSource): T; public div<T extends GenericFormula>(this: T, value: FormulaSource): T;
public div<T extends GenericFormula>(this: GenericFormula, value: T): T; public div<T extends GenericFormula>(this: GenericFormula, value: T): T;
@ -1139,40 +1053,17 @@ export default class Formula<T extends [FormulaSource] | FormulaSource[]> {
public div(value: FormulaSource) { public div(value: FormulaSource) {
return Formula.div(this, value); return Formula.div(this, value);
} }
public divide<T extends GenericFormula>(this: T, value: FormulaSource): T; public divide = this.div;
public divide<T extends GenericFormula>(this: GenericFormula, value: T): T; public divideBy = this.div;
public divide(this: GenericFormula, value: FormulaSource): GenericFormula; public dividedBy = this.div;
public divide(value: FormulaSource) {
return Formula.div(this, value);
}
public divideBy<T extends GenericFormula>(this: T, value: FormulaSource): T;
public divideBy<T extends GenericFormula>(this: GenericFormula, value: T): T;
public divideBy(this: GenericFormula, value: FormulaSource): GenericFormula;
public divideBy(value: FormulaSource) {
return Formula.div(this, value);
}
public dividedBy<T extends GenericFormula>(this: T, value: FormulaSource): T;
public dividedBy<T extends GenericFormula>(this: GenericFormula, value: T): T;
public dividedBy(this: GenericFormula, value: FormulaSource): GenericFormula;
public dividedBy(value: FormulaSource) {
return Formula.div(this, value);
}
public recip<T extends GenericFormula>(this: T): T; public recip<T extends GenericFormula>(this: T): T;
public recip(this: FormulaSource): GenericFormula; public recip(this: FormulaSource): GenericFormula;
public recip() { public recip() {
return Formula.recip(this); return Formula.recip(this);
} }
public reciprocal<T extends GenericFormula>(this: T): T; public reciprocal = this.recip;
public reciprocal(this: FormulaSource): GenericFormula; public reciprocate = this.recip;
public reciprocal() {
return Formula.recip(this);
}
public reciprocate<T extends GenericFormula>(this: T): T;
public reciprocate(this: FormulaSource): GenericFormula;
public reciprocate() {
return Formula.recip(this);
}
public max(value: FormulaSource) { public max(value: FormulaSource) {
return Formula.max(this, value); return Formula.max(this, value);
@ -1222,12 +1113,7 @@ export default class Formula<T extends [FormulaSource] | FormulaSource[]> {
public log(value: FormulaSource) { public log(value: FormulaSource) {
return Formula.log(this, value); return Formula.log(this, value);
} }
public logarithm<T extends GenericFormula>(this: T, value: FormulaSource): T; public logarithm = this.log;
public logarithm<T extends GenericFormula>(this: FormulaSource, value: T): T;
public logarithm(this: FormulaSource, value: FormulaSource): GenericFormula;
public logarithm(value: FormulaSource) {
return Formula.log(this, value);
}
public log2<T extends GenericFormula>(this: T): T; public log2<T extends GenericFormula>(this: T): T;
public log2(this: FormulaSource): GenericFormula; public log2(this: FormulaSource): GenericFormula;