{ "cells": [ { "cell_type": "markdown", "id": "pkg-title", "metadata": {}, "source": "# Installing packages (still no server)\n\nnumbl ships with `mip`, a package manager for numbl packages. Packages are\nfetched from GitHub releases and cached in your browser's IndexedDB, so the\ndownload happens once.\n\nThe first cell you run in a session also bootstraps the engine, so expect a\nshort delay (progress is printed)." }, { "cell_type": "code", "execution_count": null, "id": "pkg-install", "metadata": {}, "outputs": [], "source": [ "mip load --install chebfun" ] }, { "cell_type": "code", "execution_count": null, "id": "pkg-roots", "metadata": {}, "outputs": [], "source": [ "% Chebfun: numerical computing with functions\n", "x = chebfun('x', [0 4]);\n", "f = sin(x.^2);\n", "r = roots(f);\n", "fprintf('sin(x^2) has %d roots in [0, 4]\\n', numel(r));" ] }, { "cell_type": "code", "execution_count": null, "id": "pkg-plot", "metadata": {}, "outputs": [], "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');" } ], "metadata": { "kernelspec": { "display_name": "numbl (MATLAB syntax)", "language": "numbl", "name": "numbl" }, "language_info": { "codemirror_mode": "octave", "file_extension": ".m", "mimetype": "text/x-octave", "name": "numbl", "pygments_lexer": "matlab" } }, "nbformat": 4, "nbformat_minor": 5 }