/ concept-collection / jupyterlite-numbl-kernel
Sign in
concept-collection / jupyterlite-numbl-kernel
jupyterlite-numbl-kernel / demo / content / 01-intro.ipynb
128 lines · 3.1 KBBlameHistoryRaw
1{
2 "cells": [
3 {
4 "cell_type": "markdown",
5 "id": "in-0",
6 "metadata": {},
7 "source": [
8 "# numbl in the browser\n",
9 "\n",
10 "This is **numbl** (https://numbl.org) running as a JupyterLite kernel: MATLAB-syntax numerical\n",
11 "computing that executes entirely in your browser tab. There is no server, no\n",
12 "kernel process, and nothing to install.\n",
13 "\n",
14 "Run each cell with **Shift+Enter**. Variables persist from one cell to the\n",
15 "next, just like a MATLAB session."
16 ]
17 },
18 {
19 "cell_type": "markdown",
20 "id": "in-1",
21 "metadata": {},
22 "source": [
23 "## Compute with matrices"
24 ]
25 },
26 {
27 "cell_type": "code",
28 "execution_count": null,
29 "id": "in-2",
30 "metadata": {},
31 "outputs": [],
32 "source": [
33 "A = magic(4)\n",
34 "b = (1:4)';\n",
35 "x = A \\ b;\n",
36 "fprintf('solved a 4x4 system, residual = %.2e\\n', norm(A * x - b));"
37 ]
38 },
39 {
40 "cell_type": "markdown",
41 "id": "in-3",
42 "metadata": {},
43 "source": [
44 "## Plot, right in the notebook"
45 ]
46 },
47 {
48 "cell_type": "code",
49 "execution_count": null,
50 "id": "in-4",
51 "metadata": {},
52 "outputs": [],
53 "source": [
54 "x = linspace(0, 2 * pi, 400);\n",
55 "plot(x, sin(x), 'b-');\n",
56 "hold on;\n",
57 "plot(x, sin(2 * x), 'r--');\n",
58 "hold off;\n",
59 "legend('sin(x)', 'sin(2x)');\n",
60 "title('plotting works client-side');\n",
61 "xlabel('x'); ylabel('y');"
62 ]
63 },
64 {
65 "cell_type": "markdown",
66 "id": "in-5",
67 "metadata": {},
68 "source": [
69 "## 3-D figures are interactive (drag to rotate)"
70 ]
71 },
72 {
73 "cell_type": "code",
74 "execution_count": null,
75 "id": "in-6",
76 "metadata": {},
77 "outputs": [],
78 "source": [
79 "surf(peaks(40));\n",
80 "title('peaks');"
81 ]
82 },
83 {
84 "cell_type": "markdown",
85 "id": "in-7",
86 "metadata": {},
87 "source": [
88 "## What's in this demo\n",
89 "\n",
90 "A guided tour of the language:\n",
91 "\n",
92 "1. [Data types and operators](./02-data-types-and-operators.ipynb)\n",
93 "2. [Matrices and indexing](./03-matrices-and-indexing.ipynb)\n",
94 "3. [Control flow and functions](./04-control-flow-and-functions.ipynb)\n",
95 "4. [Linear algebra](./05-linear-algebra.ipynb)\n",
96 "5. [Data structures and strings](./06-data-structures-and-strings.ipynb)\n",
97 "6. [Numerical methods](./07-numerical-methods.ipynb)\n",
98 "7. [Plotting gallery](./08-plotting.ipynb)\n",
99 "\n",
100 "Advanced MATLAB features:\n",
101 "\n",
102 "8. [Classes and object-oriented programming](./09-classes-and-oop.ipynb)\n",
103 "9. [Namespaces and packages](./10-namespaces-and-packages.ipynb)\n",
104 "\n",
105 "And finally:\n",
106 "\n",
107 "10. [Installing packages with mip](./11-mip-packages.ipynb)"
108 ]
109 }
110 ],
111 "metadata": {
112 "kernelspec": {
113 "display_name": "numbl (MATLAB syntax)",
114 "language": "numbl",
115 "name": "numbl"
116 },
117 "language_info": {
118 "codemirror_mode": "octave",
119 "file_extension": ".m",
120 "mimetype": "text/x-octave",
121 "name": "numbl",
122 "nbconvert_exporter": "script",
123 "pygments_lexer": "matlab"
124 }
125 },
126 "nbformat": 4,
127 "nbformat_minor": 5
moveopenescclose