math-exercises 3.0.172 → 3.0.173
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.js +12 -0
- package/lib/exercises/math/functions/trinoms/parabole/index.d.ts +2 -0
- package/lib/exercises/math/functions/trinoms/parabole/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/parabole/index.js +2 -0
- package/lib/exercises/math/functions/trinoms/parabole/parabolaVarTable.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/parabole/parabolaVarTable.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/parabole/parabolaVarTable.js +106 -0
- package/lib/exercises/math/functions/trinoms/parabole/paraboleSolveGraphEquation.d.ts +14 -0
- package/lib/exercises/math/functions/trinoms/parabole/paraboleSolveGraphEquation.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/parabole/paraboleSolveGraphEquation.js +186 -0
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.d.ts +6 -2
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.js +98 -13
- package/lib/exercises/math/geometry/lines/index.d.ts +1 -0
- package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/index.js +1 -0
- package/lib/exercises/math/geometry/lines/readLineNormalVectorOnGraph.d.ts +13 -0
- package/lib/exercises/math/geometry/lines/readLineNormalVectorOnGraph.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/readLineNormalVectorOnGraph.js +195 -0
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts +1 -0
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/index.js +1 -0
- package/lib/exercises/math/probaStat/randomVariable/missingValueInRandomVariableProbabilityLaw.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/missingValueInRandomVariableProbabilityLaw.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/missingValueInRandomVariableProbabilityLaw.js +119 -0
- package/lib/exercises/math/python/sequences/index.d.ts +8 -0
- package/lib/exercises/math/python/sequences/index.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/index.js +7 -0
- package/lib/exercises/math/python/sequences/pySequenceFactorialInstructionFalseOneOut.d.ts +11 -0
- package/lib/exercises/math/python/sequences/pySequenceFactorialInstructionFalseOneOut.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/pySequenceFactorialInstructionFalseOneOut.js +274 -0
- package/lib/exercises/math/python/sequences/pySequenceFirstTermsListInstructionCompletion.d.ts +12 -0
- package/lib/exercises/math/python/sequences/pySequenceFirstTermsListInstructionCompletion.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/pySequenceFirstTermsListInstructionCompletion.js +368 -0
- package/lib/exercises/math/python/sequences/pySequenceFirstTermsSumInstructionCompletion.d.ts +13 -0
- package/lib/exercises/math/python/sequences/pySequenceFirstTermsSumInstructionCompletion.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/pySequenceFirstTermsSumInstructionCompletion.js +254 -0
- package/lib/exercises/math/python/sequences/pySequenceProgramReading.d.ts +14 -0
- package/lib/exercises/math/python/sequences/pySequenceProgramReading.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/pySequenceProgramReading.js +365 -0
- package/lib/exercises/math/python/sequences/pySequenceTermForLoopInstructionCompletion.d.ts +11 -0
- package/lib/exercises/math/python/sequences/pySequenceTermForLoopInstructionCompletion.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/pySequenceTermForLoopInstructionCompletion.js +298 -0
- package/lib/exercises/math/python/sequences/pySequenceTermFromFunctionCallInstructionCompletion.d.ts +12 -0
- package/lib/exercises/math/python/sequences/pySequenceTermFromFunctionCallInstructionCompletion.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/pySequenceTermFromFunctionCallInstructionCompletion.js +408 -0
- package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.d.ts +17 -0
- package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.js +498 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.d.ts +12 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.js +191 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.d.ts +14 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.js +153 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts +15 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js +184 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts +14 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.js +210 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindTermFromSituation.d.ts +15 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindTermFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindTermFromSituation.js +161 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts +17 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.js +188 -0
- package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts +6 -0
- package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/situations/index.js +5 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts +15 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.js +233 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSum.d.ts +13 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSum.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSum.js +111 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSumThreshold.d.ts +13 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSumThreshold.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSumThreshold.js +216 -0
- package/lib/exercises/math/sequences/arithmetic/sum/firstIntegersSum.d.ts +7 -0
- package/lib/exercises/math/sequences/arithmetic/sum/firstIntegersSum.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/sum/firstIntegersSum.js +94 -0
- package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts +5 -0
- package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/sum/index.js +4 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts +14 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.js +301 -0
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.d.ts +15 -0
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.js +260 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts +14 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.js +186 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindRankFromSituation.d.ts +15 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindRankFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindRankFromSituation.js +142 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindRecurrenceFormulaFromSituation.d.ts +14 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindRecurrenceFormulaFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindRecurrenceFormulaFromSituation.js +205 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.d.ts +15 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.js +208 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindThresholdFromSituation.d.ts +17 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindThresholdFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindThresholdFromSituation.js +152 -0
- package/lib/exercises/math/sequences/geometric/situations/index.d.ts +4 -0
- package/lib/exercises/math/sequences/geometric/situations/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/situations/index.js +5 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.d.ts +15 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.js +248 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsGeneralSum.d.ts +14 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsGeneralSum.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsGeneralSum.js +126 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsSum.d.ts +8 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsSum.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsSum.js +91 -0
- package/lib/exercises/math/sequences/geometric/sum/index.d.ts +4 -0
- package/lib/exercises/math/sequences/geometric/sum/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/sum/index.js +3 -0
- package/lib/exercises/math/sequences/seqArithmGeom/index.d.ts +2 -0
- package/lib/exercises/math/sequences/seqArithmGeom/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/seqArithmGeom/index.js +1 -0
- package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.d.ts +14 -0
- package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.d.ts.map +1 -0
- package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.js +202 -0
- package/lib/exercises/options/optionFirstTermRankOne.d.ts +16 -0
- package/lib/exercises/options/optionFirstTermRankOne.d.ts.map +1 -0
- package/lib/exercises/options/optionFirstTermRankOne.js +17 -0
- package/lib/exercises/options/optionIsUsePythonDef.d.ts +16 -0
- package/lib/exercises/options/optionIsUsePythonDef.d.ts.map +1 -0
- package/lib/exercises/options/optionIsUsePythonDef.js +17 -0
- package/lib/exercises/options/optionIsWithSuperfluousData.d.ts +16 -0
- package/lib/exercises/options/optionIsWithSuperfluousData.d.ts.map +1 -0
- package/lib/exercises/options/optionIsWithSuperfluousData.js +17 -0
- package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts +1 -0
- package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts.map +1 -1
- package/lib/exercises/vea/colinearVectorVEA.d.ts +2 -0
- package/lib/exercises/vea/colinearVectorVEA.d.ts.map +1 -0
- package/lib/exercises/vea/colinearVectorVEA.js +11 -0
- package/lib/exercises/vea/varLineVEA.d.ts.map +1 -1
- package/lib/exercises/vea/varLineVEA.js +5 -2
- package/lib/index.d.ts +25 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/line.d.ts +1 -1
- package/lib/math/geometry/line.d.ts.map +1 -1
- package/lib/math/geometry/line.js +3 -3
- package/lib/math/geometry/point.d.ts +1 -1
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +4 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts +53 -0
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -0
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +1928 -0
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts +15 -0
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -0
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +136 -0
- package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts +42 -0
- package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -0
- package/lib/math/utils/sequences/situations/seqGeometricSituations.js +932 -0
- package/lib/math/utils/sequences/situations/seqGeometricUtils.d.ts +12 -0
- package/lib/math/utils/sequences/situations/seqGeometricUtils.d.ts.map +1 -0
- package/lib/math/utils/sequences/situations/seqGeometricUtils.js +90 -0
- package/lib/tests/exosTest.d.ts.map +1 -1
- package/lib/tests/exosTest.js +0 -2
- package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts +3 -3
- package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/binomialCoefficientNode.js +6 -3
- package/lib/tree/parsers/vectorParser.d.ts.map +1 -1
- package/lib/tree/parsers/vectorParser.js +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
|
|
2
|
+
export declare const seqGeometricUtils: {
|
|
3
|
+
valueForRank: (initial: number, reason: number, rank: number) => number;
|
|
4
|
+
valueSumForRank: (initial: number, reason: number, rank: number) => number;
|
|
5
|
+
getAnswerNodeExplicitFormula: (initial: number, reason: number, firstRank: number) => EqualNode;
|
|
6
|
+
getAnswerNodeRecurrenceFormula: (_initial: number, reason: number, _firstRank: number) => EqualNode;
|
|
7
|
+
getAnswerNodeRandomTerm: (initial: number, reason: number, firstRank: number, rankAsked: number) => import("../../../../tree/nodes/operators/multiplyNode.js").MultiplyNode;
|
|
8
|
+
getAnswerNodeRandomRank: (initial: number, reason: number, _firstRank: number, valueAsked: number) => import("../../../../tree/nodes/operators/fractionNode.js").FractionNode;
|
|
9
|
+
randThreshold: (initial: number, reason: number, firstRank: number, roundTo: number) => number;
|
|
10
|
+
randSumThreshold: (initial: number, reason: number, firstRank: number, roundTo: number) => number;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=seqGeometricUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seqGeometricUtils.d.ts","sourceRoot":"","sources":["../../../../../src/math/utils/sequences/situations/seqGeometricUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA4IpE,eAAO,MAAM,iBAAiB;4BAjIC,MAAM,UAAU,MAAM,QAAQ,MAAM;+BAIjC,MAAM,UAAU,MAAM,QAAQ,MAAM;4CAK3D,MAAM,UACP,MAAM,aACH,MAAM;+CAaP,MAAM,UACR,MAAM,cACF,MAAM;uCAWT,MAAM,UACP,MAAM,aACH,MAAM,aACN,MAAM;uCAUR,MAAM,UACP,MAAM,cACF,MAAM,cACN,MAAM;6BAuCT,MAAM,UACP,MAAM,aACH,MAAM,WACR,MAAM;gCAgBN,MAAM,UACP,MAAM,aACH,MAAM,WACR,MAAM;CAwBhB,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
|
|
2
|
+
import { abs } from "../../../../tree/nodes/functions/absNode.js";
|
|
3
|
+
import { LogNode } from "../../../../tree/nodes/functions/logNode.js";
|
|
4
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
5
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
|
+
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
7
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
8
|
+
import { probaFlip } from "../../../../utils/alea/probaFlip.js";
|
|
9
|
+
import { random, randomMany } from "../../../../utils/alea/random.js";
|
|
10
|
+
import { randfloat } from "../../random/randfloat.js";
|
|
11
|
+
const valueForRank = (initial, reason, rank) => {
|
|
12
|
+
return initial * Math.pow(reason, rank);
|
|
13
|
+
};
|
|
14
|
+
const valueSumForRank = (initial, reason, rank) => {
|
|
15
|
+
return (initial * (1 - Math.pow(reason, rank))) / (1 - reason);
|
|
16
|
+
};
|
|
17
|
+
const getAnswerNodeExplicitFormula = (initial, reason, firstRank) => {
|
|
18
|
+
//u_n = u_0 * q ^ n
|
|
19
|
+
const nodeFormula = multiply(initial, power(reason, substract("n".toTree(), firstRank).simplify()));
|
|
20
|
+
const equalNode = new EqualNode("u_n".toTree(), nodeFormula);
|
|
21
|
+
return equalNode;
|
|
22
|
+
};
|
|
23
|
+
const getAnswerNodeRecurrenceFormula = (_initial, reason, _firstRank) => {
|
|
24
|
+
//u_{n+1} = u_n * q
|
|
25
|
+
const nodeFormRecurLhs = "u_{n+1}".toTree();
|
|
26
|
+
const nodeFormRecurRhs = multiply(reason, "u_n".toTree());
|
|
27
|
+
const equalNode = new EqualNode(nodeFormRecurLhs, nodeFormRecurRhs);
|
|
28
|
+
return equalNode;
|
|
29
|
+
};
|
|
30
|
+
const getAnswerNodeRandomTerm = (initial, reason, firstRank, rankAsked) => {
|
|
31
|
+
//u_n = u_0 * q ^ n
|
|
32
|
+
return multiply(initial, power(reason, substract(rankAsked, firstRank).simplify()));
|
|
33
|
+
};
|
|
34
|
+
const getAnswerNodeRandomRank = (initial, reason, _firstRank, valueAsked) => {
|
|
35
|
+
//u_n = u_0 * q ^ n
|
|
36
|
+
//n = ln(|u_n / u_0|) / ln(|q|)
|
|
37
|
+
return frac(new LogNode(abs(frac(valueAsked, initial))), new LogNode(abs(reason)));
|
|
38
|
+
};
|
|
39
|
+
// const getAnswerNodeThresholdRank = (
|
|
40
|
+
// initial: number,
|
|
41
|
+
// reason: number,
|
|
42
|
+
// firstRank: number,
|
|
43
|
+
// valueThreshold: number,
|
|
44
|
+
// inequationSymbol: InequationSymbol,
|
|
45
|
+
// ) => {
|
|
46
|
+
// //u_n = u_0 * q ^ n >= t
|
|
47
|
+
// //depending on u_0:
|
|
48
|
+
// //n >= ln(|t / u_0|) / ln(|q|) ou n <= ln(|t / u_0|) / ln(|q|)
|
|
49
|
+
// const inequationSymbolForRank =
|
|
50
|
+
// reason < 0 ? inequationSymbol.toReversed() : inequationSymbol;
|
|
51
|
+
// const value = (() => {
|
|
52
|
+
// switch (inequationSymbolForRank.symbol) {
|
|
53
|
+
// case "<":
|
|
54
|
+
// case "\\le":
|
|
55
|
+
// return Math.floor((valueThreshold - initial) / reason) + firstRank;
|
|
56
|
+
// case ">":
|
|
57
|
+
// case "\\ge":
|
|
58
|
+
// return Math.ceil((valueThreshold - initial) / reason) + firstRank;
|
|
59
|
+
// }
|
|
60
|
+
// })();
|
|
61
|
+
// return value.toTree();
|
|
62
|
+
// };
|
|
63
|
+
const randThreshold = (initial, reason, firstRank, roundTo) => {
|
|
64
|
+
const poolOfRanks = [...Array(10).keys()].map((i) => i + 5);
|
|
65
|
+
const [minRank, maxRank] = randomMany(poolOfRanks, 2).toSorted((i1, i2) => i1 - i2);
|
|
66
|
+
const [valueMinRank, valueMaxRank] = [minRank, maxRank].map((rank) => getAnswerNodeRandomTerm(initial, reason, firstRank, rank).evaluate());
|
|
67
|
+
const valueThreshold = probaFlip(0.75)
|
|
68
|
+
? randfloat(valueMinRank, valueMaxRank, roundTo)
|
|
69
|
+
: random([valueMinRank, valueMaxRank]);
|
|
70
|
+
return valueThreshold;
|
|
71
|
+
};
|
|
72
|
+
const randSumThreshold = (initial, reason, firstRank, roundTo) => {
|
|
73
|
+
const poolOfRanks = [...Array(10).keys()].map((i) => i + 5);
|
|
74
|
+
const [minRank, maxRank] = randomMany(poolOfRanks, 2).toSorted((i1, i2) => i1 - i2);
|
|
75
|
+
const [valueMinRank, valueMaxRank] = [minRank, maxRank].map((rank) => getAnswerNodeRandomTerm(initial, reason, firstRank, rank).evaluate());
|
|
76
|
+
const valueThreshold = probaFlip(0.75)
|
|
77
|
+
? randfloat(valueMinRank, valueMaxRank, roundTo)
|
|
78
|
+
: random([valueMinRank, valueMaxRank]);
|
|
79
|
+
return valueThreshold;
|
|
80
|
+
};
|
|
81
|
+
export const seqGeometricUtils = {
|
|
82
|
+
valueForRank,
|
|
83
|
+
valueSumForRank,
|
|
84
|
+
getAnswerNodeExplicitFormula,
|
|
85
|
+
getAnswerNodeRecurrenceFormula,
|
|
86
|
+
getAnswerNodeRandomTerm,
|
|
87
|
+
getAnswerNodeRandomRank,
|
|
88
|
+
randThreshold,
|
|
89
|
+
randSumThreshold,
|
|
90
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exosTest.d.ts","sourceRoot":"","sources":["../../src/tests/exosTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAQvD,eAAO,MAAM,QAAQ,GAAI,MAAM,QAAQ,CAAC,MAAM,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"exosTest.d.ts","sourceRoot":"","sources":["../../src/tests/exosTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAQvD,eAAO,MAAM,QAAQ,GAAI,MAAM,QAAQ,CAAC,MAAM,CAAC,EAAE,SAsDhD,CAAC"}
|
package/lib/tests/exosTest.js
CHANGED
|
@@ -11,8 +11,6 @@ export const exosTest = (exos) => {
|
|
|
11
11
|
// const allExos = [MathExercises.inflexionPointQuadrinomials];
|
|
12
12
|
exos.forEach((exo) => {
|
|
13
13
|
console.log(exo.id);
|
|
14
|
-
console.log(exo);
|
|
15
|
-
console.log(exo.label);
|
|
16
14
|
try {
|
|
17
15
|
const times = exoTest(exo);
|
|
18
16
|
veaTimes.push(times.veaTime);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlgebraicNode } from "../algebraicNode.js";
|
|
1
|
+
import { AlgebraicNode, SimplifyOptions } from "../algebraicNode.js";
|
|
2
2
|
import { Node, NodeIds, NodeOptions, NodeType } from "../node.js";
|
|
3
3
|
import { OperatorIds, OperatorNode } from "./operatorNode.js";
|
|
4
4
|
export declare const isBinomialCoefficientNode: (a: Node) => a is BinomialCoefficientNode;
|
|
@@ -17,7 +17,7 @@ export declare class BinomialCoefficientNode implements OperatorNode {
|
|
|
17
17
|
constructor(leftChild: AlgebraicNode, rightChild: AlgebraicNode, opts?: NodeOptions);
|
|
18
18
|
equals(node: AlgebraicNode): boolean;
|
|
19
19
|
evaluate(): number;
|
|
20
|
-
simplify(): AlgebraicNode | BinomialCoefficientNode;
|
|
20
|
+
simplify(_opts?: SimplifyOptions): AlgebraicNode | BinomialCoefficientNode;
|
|
21
21
|
toAllValidTexs(): string[];
|
|
22
22
|
toSignInequationTex(): string;
|
|
23
23
|
toDetailedEvaluation(vars: Record<string, AlgebraicNode>): BinomialCoefficientNode;
|
|
@@ -34,6 +34,6 @@ export declare class BinomialCoefficientNode implements OperatorNode {
|
|
|
34
34
|
toMathString(): string;
|
|
35
35
|
toTex(): string;
|
|
36
36
|
derivative(): AlgebraicNode;
|
|
37
|
-
toSimplificationTex(): string;
|
|
37
|
+
toSimplificationTex(opts?: SimplifyOptions): string;
|
|
38
38
|
}
|
|
39
39
|
//# sourceMappingURL=binomialCoefficientNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binomialCoefficientNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/binomialCoefficientNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"binomialCoefficientNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/binomialCoefficientNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGlE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAG9E,eAAO,MAAM,yBAAyB,GACpC,GAAG,IAAI,KACN,CAAC,IAAI,uBACuD,CAAC;AAEhE,eAAO,MAAM,KAAK,GAChB,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,4BAOnC,CAAC;AACF,qBAAa,uBAAwB,YAAW,YAAY;IAC1D,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IASpB,MAAM,CAAC,IAAI,EAAE,aAAa;IAO1B,QAAQ;IAGR,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe;IAoBhC,cAAc;IAGd,mBAAmB;IAOnB,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAMxD,iBAAiB;IAGjB,aAAa;;;;;;;;;IAOb,YAAY;IAGZ,KAAK;IAGL,UAAU,IAAI,aAAa;IAG3B,mBAAmB,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,MAAM;CAKpD"}
|
|
@@ -38,7 +38,7 @@ export class BinomialCoefficientNode {
|
|
|
38
38
|
evaluate() {
|
|
39
39
|
return combinations(this.rightChild.evaluate(), this.leftChild.evaluate());
|
|
40
40
|
}
|
|
41
|
-
simplify() {
|
|
41
|
+
simplify(_opts) {
|
|
42
42
|
const copy = new BinomialCoefficientNode(this.leftChild.simplify(), this.rightChild.simplify());
|
|
43
43
|
if (copy.leftChild.isNumeric && copy.rightChild.isNumeric) {
|
|
44
44
|
return frac(facto(copy.leftChild), multiply(facto(copy.rightChild), facto(substract(copy.leftChild, copy.rightChild)))).simplify();
|
|
@@ -78,7 +78,10 @@ export class BinomialCoefficientNode {
|
|
|
78
78
|
derivative() {
|
|
79
79
|
throw new Error("unimplemented derivative");
|
|
80
80
|
}
|
|
81
|
-
toSimplificationTex() {
|
|
82
|
-
|
|
81
|
+
toSimplificationTex(opts) {
|
|
82
|
+
const simp = this.simplify(opts);
|
|
83
|
+
if (simp.toTex() !== this.toTex())
|
|
84
|
+
return this.toTex() + "=" + simp.toTex();
|
|
85
|
+
return this.toTex();
|
|
83
86
|
}
|
|
84
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vectorParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/vectorParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"vectorParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/vectorParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAIvD,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,mBAgBvC,CAAC"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { Vector } from "../../math/geometry/vector.js";
|
|
2
|
+
import { isBinomialCoefficientNode } from "../nodes/operators/binomialCoefficientNode.js";
|
|
2
3
|
import { parseAlgebraic } from "./latexParser.js";
|
|
3
4
|
export const vectorParser = (ans) => {
|
|
5
|
+
if (ans.includes("binom")) {
|
|
6
|
+
const parsed = parseAlgebraic(ans);
|
|
7
|
+
if (!isBinomialCoefficientNode(parsed))
|
|
8
|
+
return false;
|
|
9
|
+
const vec = new Vector("u", parsed.leftChild, parsed.rightChild);
|
|
10
|
+
return vec;
|
|
11
|
+
}
|
|
4
12
|
const formated = ans
|
|
5
13
|
.replaceAll("\\left", "")
|
|
6
14
|
.replaceAll("\\right", "")
|