@zushah/chalkboard 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,74 @@
1
1
  # Chalkboard changelog
2
2
  All notable changes of every update of the Chalkboard library are recorded in this file.
3
3
 
4
+ ## [v2.2.0 Galois](https://www.github.com/Zushah/Chalkboard/releases/tag/v2.2.0) - 04/07/2024
5
+ The twelfth release of the Chalkboard library.
6
+ Commits: [`v2.1.0...v2.2.0`](https://www.github.com/Zushah/Chalkboard/compare/v2.1.0...v2.2.0)
7
+ - Added abstract algebra functionalities with the new `abal` category containing 76 commands, so only a few notable ones are mentioned below
8
+ - Added `abal.set` which defines a mathematical set, as well as `abal.Z` which defines the set of integers or the set of integers modulo n, `abal.Q` which defines the set of rational numbers, `abal.R` which defines the set of real numbers, and `abal.C` which defines the set of complex numbers or the set of nth roots of unity
9
+ - Added `abal.union`, `abal.intersection`, `abal.complement`, `abal.difference`, `abal.symmetricDifference`, `abal.Cartesian`, `abal.powerSet`, `abal.isSubset`, and `abal.isSuperset` which respectively calculate the union of two sets, the intersection of two sets, the complement of a set, the difference of two sets, the symmetric difference of two sets, the Cartesian product of two sets, the power set of a set, whether or not a set is a subset of another set, and whether or not a set is a superset of another set
10
+ - Added `abal.group`, `abal.ring`, and `abal.field` which define the algebraic structures known as groups, rings, and fields
11
+ - Added `abal.direct` which calculates the direct sum or direct product of two algebraic structures
12
+ - Added `abal.cosets` and `abal.quotient` which respectively calculate the cosets or quotient structure of two inputted algebraic structures
13
+ - Added `abal.homomorphism`, `abal.endomorphism`, `abal.isomorphism`, `abal.automorphism`, `abal.idmorphism`, and `abal.invmorphism` which define various types of morphisms between one or two algebraic structures
14
+ - Added `abal.compose` which calculates the composition morphism of two given morphisms
15
+ - Added `abal.image`, `abal.preimage`, and `abal.kernel` which respectively calculate the image, preimage, or kernel of a given morphism
16
+ - Added `abal.cardinality` which calculates the cardinality of a set or the set of a structure
17
+ - Added `abal.isEqual` which checks if two sets, structures, or morphisms are equal
18
+ - Added `abal.copy` which creates a copy of a set, structure, or morphism
19
+ - Added `abal.toArray`, `abal.toMatrix`, `abal.toObject`, `abal.toString`, `abal.toTensor`, and `abal.toVector` which convert sets or structures to arrays, matricies, objects, strings, tensors, or vectors, and `abal.print` prints a set or structure in the console
20
+ - Added `stat.Bayes` which calculates the posterior probability given prior probabilities
21
+ - Added `stat.expected` which calculates the expected value of an array given the probabilities of its elements
22
+ - Added `stat.normal` and `stat.inormal` which respectively calculate the values of the standard normal distribution and cumulative distribution function of the standard normal distribution
23
+ - Added `stat.resampling` which resamples an array either by the bootstrap or jackknife methods
24
+ - Added `stat.interpolate` which linearly or quadratically interpolates missing elements in an array
25
+ - Added `stat.absolute` which takes the absolute value of the elements of an array, `stat.negate` which negates the elements of an array, `stat.add` which adds the elements of two arrays, `stat.sub` which subtracts the elements of two arrays, `stat.dot` which calculates the dot product of two arrays, `stat.scl` which scales the elements of an array by a given number, `stat.sum` which calculates the sum of the elements of an array, `stat.mul` which calculates the product of the elements of an array, and `stat.reverse` which reverses the elements of an array
26
+ - Added `stat.cumsum`, `stat.cummul`, `stat.cummax`, and `stat.cummin` which respectively calculate the cumululative sum, product, maximum, and minimum of an array
27
+ - Added `stat.meanMoving` and `stat.meanWeighted` which respectively calculate the moving and weighted averages of an array
28
+ - Added `stat.covariance` which calculates the covariance of two arrays and `stat.correlationCoefficient` which calculates the correlation coefficient of two arrays
29
+ - Added `stat.interquartileRange` which calculates the interquartile range of an array
30
+ - Added `stat.zscored` which standardizes the elements of an array by their mean and standard deviation
31
+ - Added `stat.pad` which pads an array by a given element to a given length
32
+ - Added `stat.unique` which deduplicates an array of numbers, arrays, objects, etc.
33
+ - Added `matr.toSet`, `stat.toSet` and `tens.toSet` to convert matrices, arrays, and tensors to sets
34
+ - Added `numb.toFraction` to convert decimals to fractions and `numb.isRational` to check if a number is rational
35
+ - Changed `APPLY` to work for sets and algebraic structures introduced in the `abal` category
36
+ - Changed `stat.change` and `stat.chiSquared` to be written more succinctly
37
+ - Changed `stat.confidenceInterval` to use an adjustable confidence level
38
+ - Changed `stat.toMatrix` to be able to use only one parameter for the size of the matrix instead of requiring two
39
+ - Changed `matr.rotator` to be faster
40
+ - Changed `comp.toString` to output 1, i, -1, or -i when 1+0i, 0+1i, -1+0i, or 0-1i are inputted
41
+ - Fixed `comp.div` which was broken for who knows how long because it was using the wrong formula for some reason
42
+ - Fixed `matr.resize` which was always returning zero matrices
43
+ - Fixed `matr.zero` which was unnecessarily using erasing operations
44
+ - Fixed `tens.init` which had an expression assigned to itself
45
+
46
+ ## [v2.1.0 Seki](https://www.github.com/Zushah/Chalkboard/releases/tag/v2.1.0) - 01/22/2024
47
+ The eleventh release of the Chalkboard library.
48
+ Commits: [`v2.0.0...v2.1.0`](https://www.github.com/Zushah/Chalkboard/compare/v2.0.0...v2.1.0)
49
+ - Added a total of 26 `.isFoo` commands in the `matr`, `tens`, and `vect` categories that check if a matrix, tensor, or vector fulfills a particular property (for example, `matr.isDiagonal` checks if a matrix is a diagonal matrix)
50
+ - Added `matr.norm`, `matr.normsq`, and `matr.normalize` to calculate the norm of a matrix or normalize a matrix
51
+ - Added `matr.eigenvalue` and `matr.eigenvector` to calculate the dominant eigenvalue and eigenvector of a matrix
52
+ - Added `matr.diagonal`, `matr.lowerTriangular`, and `matr.upperTriangular` to initialize a diagonal or triangular matrix
53
+ - Added `matr.lowerBinomial`, `matr.symmetricBinomial`, `matr.upperBinomial`, `matr.lowerShift`, and `matr.upperShift` to replace the removed `matr.binomial` and `matr.shift` commands
54
+ - Added `matr.perm` to calculate the permanent of a matrix
55
+ - Added `comp.toMatrix` and `quat.toMatrix` to convert a complex number or a quaternion to a matrix
56
+ - Added `comp.argBetween` to calculate the argument between two complex numbers
57
+ - Added `numb.isApproxEqual` to check if two numbers are approximately equal
58
+ - Added `numb.mod` to calculate the mathematically-correct modulo (instead of the symmetric modulo which is what the `%` operator does)
59
+ - Added `numb.roundTo` to round a number to the nearest inputted positional index (or place value)
60
+ - Removed `matr.binomial` and `matr.shift`
61
+ - Changed nearly all of the `matr` commands to work significantly faster for 2x2, 3x3, and 4x4 matrices (for example, multiplications are about 67% faster, inversions are about 85% faster, and determinants are about 95% faster) when compared with previous versions of Chalkboard
62
+ - Changed `matr.adjugate`, `matr.cofactor`, `matr.push`, `matr.pull`, and `matr.toVector` to use a zero-based index instead of a one-based index
63
+ - Changed `matr.concat`, `matr.push`, `matr.pull`, `matr.toVector`, and `vect.toMatrix` to use an `axis` parameter instead of a `type` parameter
64
+ - Changed `matr.push`, `matr.pull`, and `matr.toVector` to have their `rowORcol` parameter be renamed as `index`
65
+ - Changed `calc.fds` and `calc.fnds` to work with the changes in `matr.toVector`
66
+ - Changed `matr.reduce` to be renamed as `matr.Gaussian`
67
+ - Changed nearly all of the `vect` commands to use the new `vect.isDimensionOf` command instead of a ridiculous amount of `typeof` operators
68
+ - Changed `tens.rank` to use the length of `tens.size` instead of doing its own calculation
69
+ - Changed `tens.empty`, `tens.fill`, `tens.random`, and `tens.resize` to use a ternary operator instead of an `if` statement to check whether a sequence of arguments or an array is inputted into their `size` parameters
70
+ - Changed `numb.Bernoullian` to not have an unnecessary `if` statement for its optional parameter
71
+
4
72
  ## [v2.0.0 al-Khwarizmi](https://www.github.com/Zushah/Chalkboard/releases/tag/v2.0.0) - 01/08/2024
5
73
  The tenth release of the Chalkboard library.
6
74
  Commits: [`v1.7.0...v2.0.0`](https://www.github.com/Zushah/Chalkboard/compare/v1.7.0...v2.0.0)
@@ -16,7 +84,7 @@ Commits: [`v1.7.0...v2.0.0`](https://www.github.com/Zushah/Chalkboard/compare/v1
16
84
  - Changed `real.function` to be renamed as `real.define`, `comp.function` to be renamed as `comp.define`, and `plot.function` to be renamed as `plot.definition`
17
85
  - Changed `LOGO` to draw the logo as a circle instead of a square
18
86
  - Changed `matr.mulvec` to be renamed as `matr.mulVector`
19
- - Fixed `matr.mulVector`` which didn't work when the rows of the matrix equaled the dimension of the vector
87
+ - Fixed `matr.mulVector` which didn't work when the rows of the matrix equaled the dimension of the vector
20
88
  - Discontinued the Processsing.js edition of the library, meaning it will no longer be updated and it will only be available on the Khan Academy release (it will no longer be available on GitHub)
21
89
 
22
90
  ## [v1.7.0 Descartes](https://www.github.com/Zushah/Chalkboard/releases/tag/v1.7.0) - 01/01/2024
@@ -48,7 +116,6 @@ Commits: [`v1.6.0...v1.7.0`](https://www.github.com/Zushah/Chalkboard/compare/v1
48
116
  - Fixed (rewrote) `numb.binomial` which kept giving "callstack size exceeded" errors for some reason
49
117
  - Fixed (rewrote) `matr.QRdecomp` thanks to [@JentGent](https://www.github.com/JentGent)'s [implementation](https://www.github.com/JentGent/linalg/blob/main/linalg.js#L519)
50
118
 
51
-
52
119
  ## [v1.6.0 Fermat](https://www.github.com/Zushah/Chalkboard/releases/tag/v1.6.0) - 12/25/2023
53
120
  The eighth release of the Chalkboard library.
54
121
  Commits: [`v1.5.0...v1.6.0`](https://www.github.com/Zushah/Chalkboard/compare/v1.5.0...v1.6.0)
@@ -74,7 +141,6 @@ Commits: [`v1.5.0...v1.6.0`](https://www.github.com/Zushah/Chalkboard/compare/v1
74
141
  - Fixed `real.pow` which returned `NaN` for 0 raised to the power of 0
75
142
  - Fixed the default domain for `plot.function` which was incorrectly using the domain for domain colorings instead of normal graphs
76
143
 
77
-
78
144
  ## [v1.5.0 Cauchy](https://www.github.com/Zushah/Chalkboard/releases/tag/v1.5.0) - 12/18/2023
79
145
  The seventh release of the Chalkboard library.
80
146
  Commits: [`v1.4.0...v1.5.0`](https://www.github.com/Zushah/Chalkboard/compare/v1.4.0...v1.5.0)
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023-2024 Zushah
3
+ Copyright (c) 2023-2025 Zushah
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  <p align="center"><a href="https://www.github.com/Zushah/Chalkboard"><img src="https://raw.githubusercontent.com/Zushah/Chalkboard/main/assets/Chalkboard-logo.png" width="50%"></a></p>
2
2
  <p align="center">
3
- <a href="https://www.github.com/Zushah/Chalkboard/releases/tag/v2.0.0"><img src="https://img.shields.io/badge/release-v2.0.0_al--Khwarizmi-blueviolet?logo=github&logoColor=white" alt="Latest release"></a>
3
+ <a href="https://www.github.com/Zushah/Chalkboard/releases/tag/v2.2.0"><img src="https://img.shields.io/badge/release-v2.2.0_Galois-blueviolet?logo=github&logoColor=white" alt="Latest release"></a>
4
4
  <a href="https://www.codefactor.io/repository/github/zushah/chalkboard"><img src="https://img.shields.io/codefactor/grade/github/Zushah/Chalkboard?color=blue&logo=codefactor&logoColor=white" alt="CodeFactor grade"></a>
5
- <a href="https://bundlephobia.com/package/@zushah/chalkboard@2.0.0"><img src="https://img.shields.io/bundlephobia/min/%40zushah/chalkboard?color=darkgreen&logo=files&logoColor=white" alt="Minified size"></a>
5
+ <a href="https://bundlephobia.com/package/@zushah/chalkboard@2.2.0"><img src="https://img.shields.io/bundlephobia/min/%40zushah/chalkboard?color=darkgreen&logo=files&logoColor=white" alt="Minified size"></a>
6
6
  <a href="https://www.npmjs.com/package/@zushah/chalkboard"><img src="https://img.shields.io/npm/dm/%40zushah/chalkboard?logo=npm&logoColor=white" alt="npm downloads"></a>
7
7
  <a href="https://www.github.com/Zushah/Chalkboard/blob/main/LICENSE.md"><img src="https://img.shields.io/github/license/Zushah/Chalkboard?color=yellow&logo=opensourceinitiative&logoColor=white" alt="MIT License"></a>
8
- <a href="https://en.wikipedia.org/wiki/TypeScript"><img src="https://img.shields.io/github/languages/top/Zushah/Chalkboard?color=orange&logo=typescript&logoColor=white" alt="Written in TypeScript"></a>
8
+ <a href="https://www.github.com/microsoft/TypeScript"><img src="https://img.shields.io/github/languages/top/Zushah/Chalkboard?color=blue&logo=typescript&logoColor=white" alt="Written in TypeScript"></a>
9
9
  <a href="https://www.jsdelivr.com/package/gh/Zushah/Chalkboard"><img src="https://img.shields.io/jsdelivr/gh/hm/Zushah/Chalkboard?color=crimson&logo=jsdelivr&logoColor=white" alt="jsDelivr requests"></a>
10
10
  <br>
11
11
  <a href="https://zushah.github.io/Chalkboard">https://zushah.github.io/Chalkboard</a>
@@ -23,23 +23,24 @@
23
23
  </ol>
24
24
 
25
25
  # About
26
- The Chalkboard library is a JavaScript namespace that provides a plethora of both practical and abstract mathematical functionalities for its user. It was developed by [Zushah](https://www.github.com/Zushah) during 2022 and 2023 and then [released](https://www.github.com/Zushah/Chalkboard/releases/tag/v1.0.0) on November 6, 2023. As per the latest release of [v2.0.0 al-Khwarizmi](https://www.github.com/Zushah/Chalkboard/releases/tag/v2.0.0), Chalkboard has 410 different commands. The library is available for regular JavaScript on both the client-side and the server-side as well as [Proccesing.js](https://www.processing.org/) (fully compatible with [Khan Academy](https://www.khanacademy.org/cs/chalkboard/6708642430369792)). Chalkboard's website can be visited [here](https://zushah.github.io/Chalkboard).
26
+ The Chalkboard library is a JavaScript namespace that provides a plethora of both practical and abstract mathematical functionalities for its user. It was developed by [Zushah](https://www.github.com/Zushah) during 2022 and 2023 and then [released](https://www.github.com/Zushah/Chalkboard/releases/tag/v1.0.0) on November 6, 2023. As per the latest release of [v2.2.0 Galois](https://www.github.com/Zushah/Chalkboard/releases/tag/v2.2.0), Chalkboard has 564 unique commands. The library is available for regular JavaScript on both the client-side and the server-side as well as [Proccesing.js](https://www.processing.org/) (fully compatible with [Khan Academy](https://www.khanacademy.org/cs/chalkboard/6708642430369792)). Chalkboard's website can be visited [here](https://zushah.github.io/Chalkboard).
27
27
 
28
28
  # Installation
29
29
  If your JavaScript project is being run on the client-side within a webpage, you can install Chalkboard with this HTML tag:
30
30
  ```html
31
- <script src="https://cdn.jsdelivr.net/gh/Zushah/Chalkboard@2.0.0/dist/Chalkboard.min.js"></script>
31
+ <script src="https://cdn.jsdelivr.net/gh/Zushah/Chalkboard@2.2.0/dist/Chalkboard.min.js"></script>
32
32
  ```
33
33
  If your JavaScript project is being run on the server-side within the [Node.js](https://nodejs.org/en) environment, you can install Chalkboard with this console command:
34
34
  ```bash
35
35
  npm install @zushah/chalkboard
36
36
  ```
37
- Alternatively, you can simply download the [latest release](https://www.github.com/Zushah/Chalkboard/releases/tag/v2.0.0) and put the relevant files in your project's directory.
37
+ Alternatively, you can simply download the [latest release](https://www.github.com/Zushah/Chalkboard/releases/tag/v2.2.0) and put the relevant files in your project's directory.
38
38
 
39
39
  Chalkboard can also be downloaded on [Khan Academy](https://www.khanacademy.org) from the code in the corresponding [release](https://www.khanacademy.org/cs/chalkboard/6708642430369792).
40
40
 
41
41
  # Documentation
42
- Chalkboard has twelve categories of commands:
42
+ Chalkboard has thirteen categories of commands:
43
+ - `abal` - Abstract algebra definitions, sets, operations, structures, and morphisms
43
44
  - `calc` - Single/multi-variable real/complex-valued calculus operations
44
45
  - `comp` - Complex number and complex function operations
45
46
  - `geom` - Geometric operations
@@ -64,11 +65,15 @@ There are also eight "global" commands and constants, which are:
64
65
  - `VERSION` - The installed version of Chalkboard
65
66
  - `VERSIONALIAS` - The alias of the installed version of Chalkboard
66
67
 
67
- Lastly, Chalkboard has seven data types (also known as Chalkboard objects):
68
+ Lastly, Chalkboard has eleven data types (also known as Chalkboard objects):
68
69
  - `ChalkboardComplex` - Complex numbers
69
70
  - `ChalkboardFunction` - Mathematical functions
70
71
  - `ChalkboardMatrix` - Matrices
72
+ - `ChalkboardMorphism` - Morphisms
71
73
  - `ChalkboardQuaternion` - Quaternions
74
+ - `ChalkboardSet` - Sets
75
+ - `ChalkboardStructure` - Algebraic structures
76
+ - `ChalkboardStructureExtension` - Algebraic structure extensions
72
77
  - `ChalkboardTensor` - Tensors
73
78
  - `ChalkboardVector` - Vectors
74
79
  - `ChalkboardVectorField` - Vector fields
@@ -83,51 +88,49 @@ Chalkboard.category.command(parameters);
83
88
  Here is some code that shows off only a few features of Chalkboard:
84
89
  ```js
85
90
  const cb = Chalkboard; // Initialize in a browser
86
- // or
87
91
  const cb = require("@zushah/chalkboard"); // Initialize in Node with CommonJS
88
- // or
89
92
  import cb from "@zushah/chalkboard"; // Initiialize in Node with ES Modules
90
93
 
91
- let f = cb.real.define("Math.cos(2 * x)"); // f(x) = cos(2x)
92
- let dfdx = cb.calc.dfdx(f, 2); // Derivative of f at x = 0
93
- let fxdx = cb.calc.fxdx(f, 0, 2); // Antiderivative of f from x = 0 to x = 2
94
- let fourier = cb.calc.Fourier(f, 2); // Fourier transform of f at x = 2
94
+ const f = cb.real.define("Math.cos(2 * x)"); // f(x) = cos(2x)
95
+ const dfdx = cb.calc.dfdx(f, 2); // Derivative of f at x = 0
96
+ const fxdx = cb.calc.fxdx(f, 0, 2); // Antiderivative of f from x = 0 to x = 2
97
+ const fourier = cb.calc.Fourier(f, 2); // Fourier transform of f at x = 2
95
98
 
96
- let f = cb.vec3.field("x", "y", "z"); // f(x, y, z) = (x, y, z)
97
- let r = cb.real.define(["Math.cos(s) * Math.cos(t)", "Math.sin(s) * Math.cos(t)", "Math.sin(t)"], "surf"); // r(s, t) = (cos(s)cos(t), sin(s)cos(t), sin(t))
98
- let fnds = cb.calc.fnds(f, r, cb.PI(-1/2), cb.PI(1/2), 0, cb.PI(2)); // Flux of the radial vector field through the unit sphere
99
+ const f = cb.vect.field("x", "y", "z"); // f(x, y, z) = (x, y, z)
100
+ const r = cb.real.define(["Math.cos(s) * Math.cos(t)", "Math.sin(s) * Math.cos(t)", "Math.sin(t)"], "surf"); // r(s, t) = (cos(s)cos(t), sin(s)cos(t), sin(t))
101
+ const fnds = cb.calc.fnds(f, r, cb.PI(-1/2), cb.PI(1/2), 0, cb.PI(2)); // Flux of the radial vector field through the unit sphere
99
102
 
100
- let primes = cb.numb.primeArr(0, 100); // Array of prime numbers between 0 and 100
101
- let midPrime = cb.stat.median(primes); // Median number in the primes array
103
+ const primes = cb.numb.primeArr(0, 100); // Array of prime numbers between 0 and 100
104
+ const midPrime = cb.stat.median(primes); // Median number in the primes array
102
105
  cb.plot.barplot(primes, cb.stat.array(0, 100, 11), {size: 5, strokeStyle: "black", fillStyle: "blue"}); // Barplot of the primes array with a bin size of 10, a scale of 2, a stroke color of black, and a fill color of blue
103
106
 
104
- let z = cb.comp.init(1, 1); // z = 1 + i
105
- let zsqsqrt = cb.comp.sqrt(cb.comp.sq(z)); // The square root of z squared equals z
106
- let f = cb.comp.define("a*a - b*b + 1", "2*a*b"); // f(z) = z^2 + 1
107
+ const z = cb.comp.init(1, 1); // z = 1 + i
108
+ const zsqsqrt = cb.comp.sqrt(cb.comp.sq(z)); // The square root of z squared equals z
109
+ const f = cb.comp.define("a*a - b*b + 1", "2*a*b"); // f(z) = z^2 + 1
107
110
  cb.plot.definition(f); // Plots the domain coloring of f
108
111
 
109
- let r = cb.real.define(["Math.cos(t)", "Math.sin(t)"], "curv"); // r(t) = (cos(t), sin(t))
112
+ const r = cb.real.define(["Math.cos(t)", "Math.sin(t)"], "curv"); // r(t) = (cos(t), sin(t))
110
113
  cb.plot.xyplane({size: 2}); // Draws the Cartesian coordinate plane scaled by 2
111
114
  cb.plot.definition(r, {size: 2, strokeStyle: "rgb(255, 100, 100)", domain: [0, cb.PI(2)]}); // Plots r(t) scaled by 2 colored light red from t = 0 to t = π/2
112
115
 
113
- let a = cb.vect.init(1, 2, 3); // Vector a = (1, 2, 3)
114
- let b = cb.vect.init(4, 5, 6); // Vector b = (4, 5, 6)
115
- let c = cb.vect.init(7, 8, 9); // Vector c = (7, 8, 9)
116
- let axbxc = cb.vect.vectorTriple(a, b, c); // Triple cross product between a, b, and c
116
+ const a = cb.vect.init(1, 2, 3); // Vector a = (1, 2, 3)
117
+ const b = cb.vect.init(4, 5, 6); // Vector b = (4, 5, 6)
118
+ const c = cb.vect.init(7, 8, 9); // Vector c = (7, 8, 9)
119
+ const axbxc = cb.vect.vectorTriple(a, b, c); // Triple cross product between a, b, and c
117
120
  cb.vect.print(axbxc); // Prints axbxc in the console
118
121
 
119
- let m = cb.matr.init( // m is a 5x5 matrix
122
+ const m = cb.matr.init( // m is a 5x5 matrix
120
123
  [0, 1, 1, 1, 1],
121
124
  [1, 0, 1, 1, 1],
122
125
  [1, 1, 0, 1, 1],
123
126
  [1, 1, 1, 0, 1],
124
127
  [1, 1, 1, 1, 0]
125
128
  );
126
- let mi = cb.matr.invert(m); // mi is the inverse of m
127
- let mmi = cb.matr.mul(m, mi); // mmi is the product of m and mi
129
+ const mi = cb.matr.invert(m); // mi is the inverse of m
130
+ const mmi = cb.matr.mul(m, mi); // mmi is the product of m and mi
128
131
  cb.matr.print(mmi); // Prints mmi in the console
129
132
 
130
- let t = cb.tens.init( // t is a 2x2x2 rank-3 tensor
133
+ const t = cb.tens.init( // t is a 2x2x2 rank-3 tensor
131
134
  [
132
135
  [1, 2],
133
136
  [3, 4]
@@ -137,21 +140,23 @@ let t = cb.tens.init( // t is a 2x2x2 rank-3 tensor
137
140
  [7, 8]
138
141
  ]
139
142
  );
140
- let tt = cb.tens.mul(t, t); // tt is a 2x2x2x2x2x2 rank-6 tensor
141
- let ttm = cb.tens.resize(tt, 8, 8); // ttm is an 8x8 matrix (or rank-2 tensor)
143
+ const tt = cb.tens.mul(t, t); // tt is a 2x2x2x2x2x2 rank-6 tensor
144
+ const ttm = cb.tens.resize(tt, 8, 8); // ttm is an 8x8 matrix (or rank-2 tensor)
142
145
  cb.tens.print(tt); // Prints tt in the console just to see what it looks like for fun
146
+ const factorialt = cb.APPLY(t, (x) => cb.numb.factorial(x)); // Calculates the factorial of each element of t
143
147
 
144
- // Takes the factorial of each element of t
145
- let factorialt = cb.APPLY(t, (x) => {
146
- return cb.numb.factorial(x);
147
- });
148
+ const Z4 = cb.abal.Z(4); // The set of integers modulo 4 is the set {0, 1, 2, 3}
149
+ const C4 = cb.abal.C(4); // The set of fourth roots of unity is the set {1, i, -1, -i}
150
+ const G = cb.abal.group(Z4, (a, b) => (a + b) % 4); // The group G is the set Z4 with mod 4 addition
151
+ const H = cb.abal.group(C4, (z, w) => cb.comp.mul(z, w)); // The group H is the set C4 with complex multiplication
152
+ const F = cb.abal.isomorphism(G, H, (n) => cb.comp.round(cb.comp.pow(cb.comp.init(0, 1), n))); // The isomorphism F: G → H is defined by F(n) = i^n for all n in Z4
148
153
  ```
149
- More examples that are more interesting can be seen [here](https://zushah.github.io/Chalkboard/examples/index.html) with their source code [here](https://www.github.com/Zushah/Chalkboard/tree/main/examples).
154
+ Several examples that are rather interesting can be seen [here](https://zushah.github.io/Chalkboard/examples/index.html), and their source code is [here](https://www.github.com/Zushah/Chalkboard/tree/main/examples).
150
155
 
151
156
  # Contributing
152
157
  <ol>
153
158
  <li>Fork Chalkboard's GitHub repository. Make sure the fork is based on the main branch.</li>
154
- <li>Clone the repository, download the dependencies with `npm install`, and then make your contributions to your fork.</li>
159
+ <li>Clone the repository, download the dev dependencies with `npm install`, and then make your contributions to your fork.</li>
155
160
  <li>When you're done, commit the changes to your fork with a detailed description.</li>
156
161
  <li>Open a pull request. It will be reviewed soon and then merged to the main branch.</li>
157
162
  </ol>
@@ -163,9 +168,9 @@ The changelog can be read [here](https://www.github.com/Zushah/Chalkboard/blob/m
163
168
  The Chalkboard library is available under the [MIT License](https://www.github.com/Zushah/Chalkboard/blob/main/LICENSE.md).
164
169
 
165
170
  # Acknowledgments
166
- Thanks to [@bhavjitChauhan](https://www.github.com/bhavjitChauhan) for his [contribution](https://www.github.com/Zushah/Chalkboard/pull/1) to [v1.3.0 Heaviside](https://www.github.com/Zushah/Chalkboard/releases/tag/v1.3.0).\
167
- Thanks to [@gyang0](https://www.github.com/gyang0) for his [contribution](https://www.github.com/Zushah/zushah.github.io/pull/1) to the [documentation](https://www.github.com/Zushah/zushah.github.io/tree/main/Chalkboard).\
168
- Thanks to [@JentGent](https://www.github.com/JentGent) for his [implementation](https://www.github.com/JentGent/linalg/blob/main/linalg.js#L519) for calculating QR decomposition which was [adapted](https://www.github.com/Zushah/Chalkboard/commit/1dce0dbac82b38f9a550dd496bc878c402a92442) into [v1.7.0 Descartes](https://www.github.com/Zushah/Chalkboard/releases/tag/v1.7.0).
171
+ Thanks to [@bhavjitChauhan](https://www.github.com/bhavjitChauhan) for his contribution ([here](https://www.github.com/Zushah/Chalkboard/pull/1)) to [v1.3.0 Heaviside](https://www.github.com/Zushah/Chalkboard/releases/tag/v1.3.0).\
172
+ Thanks to [@gyang0](https://www.github.com/gyang0) for his contributions ([here](https://www.github.com/Zushah/zushah.github.io/pull/1) and [here](https://github.com/Zushah/Chalkboard/pull/5)) to the [documentation](https://www.github.com/Zushah/zushah.github.io/tree/main/Chalkboard).\
173
+ Thanks to [@JentGent](https://www.github.com/JentGent) for his implementation ([here](https://www.github.com/JentGent/linalg/blob/main/linalg.js#L519)) for calculating QR decomposition which was [adapted](https://www.github.com/Zushah/Chalkboard/commit/1dce0dbac82b38f9a550dd496bc878c402a92442) into [v1.7.0 Descartes](https://www.github.com/Zushah/Chalkboard/releases/tag/v1.7.0).
169
174
 
170
175
  # Contact
171
176
  [GitHub](https://www.github.com/Zushah)\