jrus
June 1, 2019, 10:45am
1
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)
jrus
June 1, 2019, 1:36pm
3
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”)
2 Likes
jrus
June 1, 2019, 1:46pm
5
Ah thank you! That one does work at first glance.
All the properties are there, e.g. numeric.version
.
2 Likes
jrus
June 1, 2019, 11:47pm
7
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…
# Using Pyodide from Javascript
This document describes using Pyodide directly from Javascript. For information
about using Pyodide from Iodide, see [Using Pyodide from
Iodide](using_pyodide_from_iodide.md).
## Startup
Include `pyodide.js` in your project.
The recommended way to include Pyodide in your project is to download a release
from [here](https://github.com/iodide-project/pyodide/releases) and include the
contents in your distribution, and import the `pyodide.js` file there from a
`<script>` tag.
For prototyping purposes, you may also use the following CDN URL, though doing
so is not recommended, since it isn't versioned and could change or be unstable
at any time:
https://pyodide.cdn.iodide.io/pyodide.js
This file has been truncated. show original
jrus
June 7, 2019, 4:35pm
10
2 Likes
tom
June 7, 2019, 6:17pm
11
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")
5 Likes