{ "cells": [ { "cell_type": "markdown", "id": "pkg-title", "metadata": {}, "source": [ "# Installing packages — still no server\n", "\n", "numbl ships with `mip`, a package manager for MATLAB-syntax libraries.\n", "Packages are fetched from GitHub releases and cached in your browser's\n", "IndexedDB, so the download happens once.\n", "\n", "The first cell you run in a session also bootstraps the engine, so expect a\n", "short 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": "MATLAB (numbl)", "language": "matlab", "name": "numbl" }, "language_info": { "codemirror_mode": "octave", "file_extension": ".m", "mimetype": "text/x-octave", "name": "matlab", "pygments_lexer": "matlab" } }, "nbformat": 4, "nbformat_minor": 5 }