can anyone get numeric.js imported?

I’m having a lot of trouble with this library (but I admit I am no observable require expert).

The website is now down (still on wayback) but code is still on github and distributed various places, and it can e.g. be found at
https://unpkg.com/numeric@1.2.6/numeric-1.2.6.js

I can’t get require to work, and my attempts at just eval-ing the string source isn’t working either.

Edit: apparently a topic can only have one “answer”.

mootari and bgchen’s both work. Respectively:

numeric = require('https://unpkg.com/numeric@1.2.6/numeric-1.2.6.js').catch(() => window.numeric)
numeric = require('https://bundle.run/numericjs@1.2.6')

Try this:

numeric = require('https://unpkg.com/numeric@1.2.6/numeric-1.2.6.js').catch(() => window.numeric)

That returns a function, whereas the “numeric” name is supposed to be an object with a number of properties representing various numerical functions.

How about:

numeric = require('https://bundle.run/numericjs@1.2.6')

(You can see this in action in a few notebooks by searching Observable for “numericjs”)

Ah thank you! That one does work at first glance.

All the properties are there, e.g. numeric.version.

Oh huh. So what’s the function part about? I was trying to call it before, and getting inscrutable errors out.

Supposedly node support. ¯\_(ツ)_/¯

Sure would be great if we could get a new owner of that repo. Although there are alternatives poking up.

This looks interesting: a port of python/numpy etc with a JavaScript interface…

Folks looking for alternative linear algebra libraries might check out these I found:

http://mlweb.loria.fr/lalolab/lalolib.html

https://mateogianolio.github.io/vectorious/

https://enkimute.github.io/linalg.js/

http://mil-tokyo.github.io/miljs.html

https://github.com/datascience-js/numjs.linalg

http://sylvester.jcoglan.com/

https://github.com/google/closure-library

https://github.com/timqian/mathlab

If anyone knows about good reviews evaluating / comparing these or other libraries (e.g. comparing their available tools, APIs, performance, …) please do tell.

For folks who want to use numeric, I wrote a quick version of it with support for UMD and ES modules, so you can do

numeric = require("@tmcw/numeric@1.0.2")

// or
numeric = import("@tmcw/numeric@1.0.2")