Public
Edited
Apr 25, 2024
2 forks
Importers
Insert cell
Insert cell
Insert cell
toVectotize.map(e=> m.evaluate(e)) //.entries.map(e => math.format(e,6)).join('\n')
Insert cell
Insert cell
functionsToVectorize = [
"exp", "gamma", "square", "sqrt", "cube", "cbrt",
"sin", "cos", "tan", "csc", "sec", "cot",
"sinh", "cosh", "tanh", "csch", "sech", "coth",
"asin", "acos", "atan", "acsc", "asec", "acot",
"asinh", "acosh", "atanh", "acsch", "asech", 'acoth'
]
Insert cell
math = {
let math = await require("mathjs@12.4.1");

function mapped(f) {
return math.typed({
"Array | Matrix": (X) => math.map(X, (x) => f(x))
});
}

math.import(
{
...Object.fromEntries(
functionsToVectorize.map((f) => [f, mapped(math[f])])
),
log: math.typed({
"Array | Matrix": (x) => math.map(x, (x1) => math.log(x1, math.e)),
"Array | Matrix, number": (x, base) =>
math.map(x, (x1) => math.log(x1, base))
})
},
{ override: false }
);
return math;
}
Insert cell
m = math.parser()
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more