Math Notepad is made from math.js, and I’m wondering if it can be embedded in Observable’s notebooks? Thanks in advance.
Like most modules available via npm, math.js can be included in Observable via require
. You could certainly rebuild Math Notepad after that, if you wanted.
I sometimes use the parsing features available in math.js when building interfaces to allow users to enter a function. For example, here’s an overly simple function plotter (just proof of concept, at this point):
If it is possible, could you show me how to do it in an Observable notebook?
BTW, I’m just curious, how do you embed a notebook in this forum?
I think I meant to write that you could emulate Math Notepad within the Observable notebook fairly easily. For example, you could write:
{
let a = math.evaluate('[1, 2; 3, 4]');
return math.det(a);
}
and get -2 back out. I suppose that you could rebuild the whole Notepad, if you wanted, but I’m not sure why one would.
BTW, I’m just curious, how do you embed a notebook in this forum?
It’s super easy - just use the standard embed tool. To embed the notebook above, I just placed the iframe on one line:
<iframe width="100%" height="374" frameborder="0" src="https://observablehq.com/embed/@mcmcclur/math-plot?cells=viewof+f%2Cplot"></iframe>
I think I’ve got your point.
Thanks for your kind help, I’ve learned a lot.
Hi, I did some work on it and thought you may find it usefull. Essentially the same way you can write expressions in latex with tex`2^2`
you could writhe expressions in mathjs using mt`2^2`
inside the following notebook