/ concept-collection / jupyterlite-numbl-kernel
Sign in
concept-collection / jupyterlite-numbl-kernel
jupyterlite-numbl-kernel / demo / content / 03-packages.ipynb
67 lines · 1.6 KBCodeBlameHistory
2 "cells": [
3 {
4 "cell_type": "markdown",
5 "id": "pkg-title",
6 "metadata": {},
7 "source": [
8 "# Installing packages — still no server\n",
9 "\n",
10 "numbl ships with `mip`, a package manager for MATLAB-syntax libraries.\n",
11 "Packages are fetched from GitHub releases and cached in your browser's\n",
12 "IndexedDB, so the download happens once.\n",
13 "\n",
14 "The first cell you run in a session also bootstraps the engine, so expect a\n",
15 "short delay (progress is printed)."
16 ]
17 },
18 {
19 "cell_type": "code",
20 "execution_count": null,
21 "id": "pkg-install",
22 "metadata": {},
23 "outputs": [],
24 "source": [
25 "mip load --install chebfun"
26 ]
27 },
28 {
29 "cell_type": "code",
30 "execution_count": null,
31 "id": "pkg-roots",
32 "metadata": {},
33 "outputs": [],
34 "source": [
35 "% Chebfun: numerical computing with functions\n",
36 "x = chebfun('x', [0 4]);\n",
37 "f = sin(x.^2);\n",
38 "r = roots(f);\n",
39 "fprintf('sin(x^2) has %d roots in [0, 4]\\n', numel(r));"
40 ]
41 },
42 {
43 "cell_type": "code",
44 "execution_count": null,
45 "id": "pkg-plot",
46 "metadata": {},
47 "outputs": [],
48 "source": "% Evaluate the chebfun on a grid and mark its roots\nxx = linspace(0, 4, 400);\nplot(xx, f(xx));\nhold on;\nplot(r, f(r), 'ro');\nhold off;\ntitle('sin(x^2) and its roots');"
49 }
50 ],
51 "metadata": {
52 "kernelspec": {
53 "display_name": "MATLAB (numbl)",
54 "language": "matlab",
55 "name": "numbl"
56 },
57 "language_info": {
58 "codemirror_mode": "octave",
59 "file_extension": ".m",
60 "mimetype": "text/x-octave",
61 "name": "matlab",
62 "pygments_lexer": "matlab"
63 }
64 },
65 "nbformat": 4,
66 "nbformat_minor": 5
moveopenescclose