/ concept-collection / jupyterlite-numbl-kernel
Sign in
concept-collection / jupyterlite-numbl-kernel
jupyterlite-numbl-kernel / demo / content / 01-intro.ipynb
75 lines · 2.7 KBBlameHistoryRaw
1{
2 "cells": [
3 {
4 "cell_type": "markdown",
5 "id": "in-0",
6 "metadata": {},
7 "source": "# numbl in the browser\n\nThis is **numbl** running as a JupyterLite kernel: MATLAB-syntax numerical\ncomputing that executes entirely in your browser tab. There is no server, no\nkernel process, and nothing to install.\n\nRun each cell with **Shift+Enter**. Variables persist from one cell to the\nnext, just like a MATLAB session."
8 },
9 {
10 "cell_type": "markdown",
11 "id": "in-1",
12 "metadata": {},
13 "source": "## Compute with matrices"
14 },
15 {
16 "cell_type": "code",
17 "id": "in-2",
18 "metadata": {},
19 "execution_count": null,
20 "outputs": [],
21 "source": "A = magic(4)\nb = (1:4)';\nx = A \\ b;\nfprintf('solved a 4x4 system, residual = %.2e\\n', norm(A * x - b));"
22 },
23 {
24 "cell_type": "markdown",
25 "id": "in-3",
26 "metadata": {},
27 "source": "## Plot, right in the notebook"
28 },
29 {
30 "cell_type": "code",
31 "id": "in-4",
32 "metadata": {},
33 "execution_count": null,
34 "outputs": [],
35 "source": "x = linspace(0, 2 * pi, 400);\nplot(x, sin(x), 'b-');\nhold on;\nplot(x, sin(2 * x), 'r--');\nhold off;\nlegend('sin(x)', 'sin(2x)');\ntitle('plotting works client-side');\nxlabel('x'); ylabel('y');"
36 },
37 {
38 "cell_type": "markdown",
39 "id": "in-5",
40 "metadata": {},
41 "source": "## 3-D figures are interactive (drag to rotate)"
42 },
43 {
44 "cell_type": "code",
45 "id": "in-6",
46 "metadata": {},
47 "execution_count": null,
48 "outputs": [],
49 "source": "surf(peaks(40));\ntitle('peaks');"
50 },
51 {
52 "cell_type": "markdown",
53 "id": "in-7",
54 "metadata": {},
55 "source": "## What's in this demo\n\nA guided tour of the language:\n\n1. [Data types and operators](./02-data-types-and-operators.ipynb)\n2. [Matrices and indexing](./03-matrices-and-indexing.ipynb)\n3. [Control flow and functions](./04-control-flow-and-functions.ipynb)\n4. [Linear algebra](./05-linear-algebra.ipynb)\n5. [Data structures and strings](./06-data-structures-and-strings.ipynb)\n6. [Numerical methods](./07-numerical-methods.ipynb)\n7. [Plotting gallery](./08-plotting.ipynb)\n\nAdvanced MATLAB features:\n\n8. [Classes and object-oriented programming](./09-classes-and-oop.ipynb)\n9. [Namespaces and packages](./10-namespaces-and-packages.ipynb)\n\nAnd finally:\n\n10. [Installing packages with mip](./11-mip-packages.ipynb)"
56 }
57 ],
58 "metadata": {
59 "kernelspec": {
60 "display_name": "numbl (MATLAB syntax)",
61 "language": "numbl",
62 "name": "numbl"
63 },
64 "language_info": {
65 "codemirror_mode": "octave",
66 "file_extension": ".m",
67 "mimetype": "text/x-octave",
68 "name": "numbl",
69 "nbconvert_exporter": "script",
70 "pygments_lexer": "matlab"
71 }
72 },
73 "nbformat": 4,
74 "nbformat_minor": 5
moveopenescclose