Files
docmost_custom/test-math.js
T

23 lines
834 B
JavaScript

const w = [
0.4025, 1.4612, 3.3458, 15.6922, 5.8483, 1.2081, 1.2946, 0.0014, 1.5478,
0.133, 1.0124, 2.4467, 0.0641, 0.5044, 1.242, 0.2836, 2.8536,
];
const stability = 1.4612;
const difficulty = 7.05; // calculated for hard
const elapsedDays = 0;
const retrievability = Math.pow(0.9, elapsedDays / stability);
console.log("R:", retrievability);
let nextStability = 0;
const quality = 1;
nextDifficulty = Math.min(Math.max(difficulty + w[6], 1), 10);
console.log("D':", nextDifficulty);
nextStability = w[10] * Math.pow(nextDifficulty, -w[11]) * (Math.pow(stability + 1, w[12]) - 1) * Math.exp(w[13] * (1 - retrievability));
console.log("S':", nextStability);
const nextReviewDate = new Date();
nextReviewDate.setMinutes(nextReviewDate.getMinutes() + Math.round(nextStability * 24 * 60));
console.log("Date:", nextReviewDate);