├── CNAME ├── .bundle └── config ├── favicon.ico ├── _includes ├── footer_custom.html ├── title.html └── head_custom.html ├── apple-touch-icon.png ├── images ├── textbook.png ├── favicon-192.png ├── favicon-32.png ├── favicon-512.png └── logo.svg ├── acknowledgements.md ├── .gitignore ├── euclid ├── index.md ├── intersection.md ├── boolean.md ├── draw-canvas.md ├── draw-svg.md ├── bounds.md ├── types.md ├── utilities.md ├── circle.md └── ellipse.md ├── hilbert ├── index.md ├── expression.md ├── parser.md ├── eval.md ├── symbols.md └── errors.md ├── core ├── index.md ├── events.md ├── strings.md ├── cache.md ├── utilities.md ├── iterable.md └── colors.md ├── index.md ├── fermat ├── index.md ├── combinatorics.md ├── statistics.md ├── number-theory.md ├── regression.md ├── matrix.md ├── complex.md ├── random.md ├── xnumber.md └── arithmetic.md ├── boost ├── index.md ├── router.md ├── confetti.md ├── eval.md ├── thread.md ├── observable.md ├── audio.md ├── browser.md ├── svg.md ├── ajax.md ├── animate.md ├── events.md └── draggable.md ├── 404.html ├── manifest.json ├── _sass ├── color_schemes │ └── custom.scss └── custom │ └── custom.scss ├── studio ├── index.md ├── interactives.md ├── setup.md └── markdown.md ├── contributing.md ├── package.json ├── Gemfile ├── README.md └── _config.yml /CNAME: -------------------------------------------------------------------------------- 1 | mathigon.io 2 | -------------------------------------------------------------------------------- /.bundle/config: -------------------------------------------------------------------------------- 1 | --- 2 | BUNDLE_PATH: "vendor/bundle" 3 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathigon/documentation/HEAD/favicon.ico -------------------------------------------------------------------------------- /_includes/footer_custom.html: -------------------------------------------------------------------------------- 1 | Copyright © {{ "now" | date: "%Y" }} Mathigon.org 2 | -------------------------------------------------------------------------------- /_includes/title.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathigon/documentation/HEAD/apple-touch-icon.png -------------------------------------------------------------------------------- /images/textbook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathigon/documentation/HEAD/images/textbook.png -------------------------------------------------------------------------------- /images/favicon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathigon/documentation/HEAD/images/favicon-192.png -------------------------------------------------------------------------------- /images/favicon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathigon/documentation/HEAD/images/favicon-32.png -------------------------------------------------------------------------------- /images/favicon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathigon/documentation/HEAD/images/favicon-512.png -------------------------------------------------------------------------------- /acknowledgements.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 9 4 | description: Acknowledgements 5 | --- 6 | 7 | # Acknowledgements 8 | 9 | Coming soon… 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _site 2 | .sass-cache 3 | .jekyll-cache 4 | .jekyll-metadata 5 | vendor 6 | .DS_Store 7 | Gemfile.lock 8 | node_modules 9 | npm-debug.log 10 | .idea 11 | *.iml 12 | Thumbs.db 13 | -------------------------------------------------------------------------------- /euclid/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 3 4 | has_children: true 5 | description: Euclid.js API Docs 6 | --- 7 | 8 | # Euclid.js 9 | 10 | 2D Euclidean geometry classes, utilities, and drawing tools. 11 | 12 | [View on GitHub](https://github.com/mathigon/euclid.js){: .btn .btn-blue } 13 | -------------------------------------------------------------------------------- /hilbert/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 4 4 | has_children: true 5 | description: Hilbert.js API Docs 6 | --- 7 | 8 | # Hilbert.js 9 | 10 | JavaScript expression parsing, MathML rendering and CAS. 11 | 12 | [View on GitHub](https://github.com/mathigon/hilbert.js){: .btn .btn-blue } 13 | -------------------------------------------------------------------------------- /core/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 1 4 | has_children: true 5 | --- 6 | 7 | # Core.js 8 | 9 | JavaScript utility function and classes, including array and string helper functions, type checking and event classes. 10 | 11 | [View on GitHub](https://github.com/mathigon/core.js){: .btn .btn-blue } 12 | -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: home 3 | --- 4 | 5 | ![Textbook](/images/textbook.png) 6 | 7 | Welcome to Mathigon – help us build the future of education! 8 | 9 | Here, you can browse the documentation for all our open-source TypeScript libraries, as well as 10 | our public APIs for creating and hosting interactive courses or virtual manipulatives. 11 | -------------------------------------------------------------------------------- /fermat/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 2 4 | has_children: true 5 | description: Fermat.js API Docs 6 | --- 7 | 8 | # Fermat.js 9 | 10 | Powerful mathematics and statistics library, containing everything from number theory to random numbers and linear algebra classes. 11 | 12 | [View on GitHub](https://github.com/mathigon/fermat.js){: .btn .btn-blue } 13 | -------------------------------------------------------------------------------- /boost/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 5 4 | has_children: true 5 | description: Boost.js API Docs 6 | title: Boost.js 7 | --- 8 | 9 | # Boost.js 10 | 11 | Simplifying browser APIs – from DOM manipulation to web components, event handling, animations, routing, multi-threading and AJAX requests. 12 | 13 | [View on GitHub](https://github.com/mathigon/boost.js){: .btn .btn-blue } 14 | -------------------------------------------------------------------------------- /hilbert/expression.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 4 4 | parent: Hilbert.js 5 | --- 6 | 7 | # Expression 8 | 9 |
10 | 11 |
hilbert.js/src/expression.ts#L55
12 | 13 | ## Expression 14 | 15 | Default value: `...` 16 | 17 |
18 | -------------------------------------------------------------------------------- /boost/router.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 12 4 | parent: Boost.js 5 | --- 6 | 7 | # Router 8 | 9 |
10 | 11 |
router.ts#L292
12 | 13 | ## RouterInstance : Router 14 | 15 | Default value: `...` 16 | 17 |
-------------------------------------------------------------------------------- /_includes/head_custom.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /404.html: -------------------------------------------------------------------------------- 1 | --- 2 | permalink: /404.html 3 | layout: default 4 | --- 5 | 6 | 19 | 20 |
21 |

404

22 | 23 |

Page not found :(

24 |

The requested page could not be found.

25 |
26 | -------------------------------------------------------------------------------- /images/logo.svg: -------------------------------------------------------------------------------- 1 | Mathi∫on.io -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Mathigon Documentation", 3 | "short_name": "Mathigon Documentation", 4 | "icons": [{ 5 | "src": "/images/favicon-192.png", 6 | "sizes": "192x192", 7 | "type": "image/png", 8 | "purpose": "any maskable" 9 | }, { 10 | "src": "/images/favicon-512.png", 11 | "sizes": "512x512", 12 | "type": "image/png", 13 | "purpose": "any maskable" 14 | }], 15 | "theme_color": "#181824", 16 | "background_color": "#606072", 17 | "start_url": "/?utm_source=homescreen", 18 | "display": "standalone" 19 | } 20 | -------------------------------------------------------------------------------- /boost/confetti.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 5 4 | parent: Boost.js 5 | --- 6 | 7 | # Confetti 8 | 9 |
10 | 11 |
confetti.ts#L67
12 | 13 | ## confetti (duration: number, maxParticles: number): void 14 | 15 | | Name | Type | Default | Description | 16 | | --- | --- | --- | --- | 17 | | `duration` | number | 2000 | | 18 | | `maxParticles` | number | 150 | | 19 | 20 | 21 |
-------------------------------------------------------------------------------- /euclid/intersection.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 10 4 | parent: Euclid.js 5 | --- 6 | 7 | # Intersection 8 | 9 |
10 | 11 |
intersection.ts#L134
12 | 13 | ## intersections (elements: Array<GeoShape>): Array<Point> 14 | 15 | Returns the intersection of two or more geometry objects. 16 | 17 | | Name | Type | Default | Description | 18 | | --- | --- | --- | --- | 19 | | `elements` | Array<GeoShape> | | | 20 | 21 | 22 |
-------------------------------------------------------------------------------- /_sass/color_schemes/custom.scss: -------------------------------------------------------------------------------- 1 | 2 | 3 | $body-font-family: 'Source Sans Pro', Helvetica, sans-serif; 4 | $root-font-size: 18px; 5 | 6 | $body-background-color: #f4f4f6; 7 | $sidebar-color: #242436; 8 | $border-color: #464661; 9 | $code-background-color: rgba(black, 8%); 10 | 11 | $btn-primary-color: #0f82f2; 12 | $link-color: #0f82f2; 13 | $table-background-color: transparent; 14 | 15 | // $body-heading-color: $grey-dk-300 !default; 16 | // $search-result-preview-color: $grey-dk-000 !default; 17 | // $nav-child-link-color: $grey-dk-100 !default; 18 | // $border: 1px solid !default; 19 | // $border-radius: 4px !default; 20 | // $border-color: $grey-lt-100 !default; 21 | -------------------------------------------------------------------------------- /studio/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 6 4 | has_children: true 5 | description: Mathigon Studion API Docs 6 | --- 7 | 8 | # Mathigon Studio 9 | 10 | Mathigon Studio is an award-winning platform for creating interactive, online courses! The 11 | [@mathigon/studio](https://github.com/mathigon/studio) repository is not intended to be used 12 | standalone. You will need to create a parent repository containing the content, settings, and any 13 | customisations for this course. You can see a sample implementation in the 14 | [docs/example](https://github.com/mathigon/studio/tree/main/docs/example) folder. Then install 15 | Mathigon Studio as a dependency using `npm install @mathigon/studio`. 16 | -------------------------------------------------------------------------------- /contributing.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 8 4 | description: Contributing 5 | --- 6 | 7 | # Contributing 8 | 9 | We welcome community contributions to Mathigon's repositories: from bug fixes to improving 10 | documentations, adding new translations, or developing entirely new features. If you find any bugs 11 | or errors, please file an issue on GitHub. 12 | 13 | Before submitting a pull request, you will need to sign the [Mathigon Individual Contributor License 14 | Agreement](https://gist.github.com/plegner/5ad5b7be2948a4ad073c50b15ac01d39). 15 | 16 | If you want to work for Mathigon, visit our [careers page](https://mathigon.org/careers), and 17 | [contact us](mailto:dev@mathigon.org) if you have any questions. 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@mathigon/documentation", 3 | "version": "1.0.1", 4 | "description": "Discover the open source JavaScript libraries that power Mathigon. Combining functions for DOM manipulation, animations, events handling, UI elements and mathematics, they make web development for modern browsers fun and easy.", 5 | "scripts": { 6 | "start": "bundle exec jekyll serve", 7 | "build": "node build.js" 8 | }, 9 | "repository": "mathigon/documentation", 10 | "license": "UNLICENSED", 11 | "homepage": "https://github.com/Mathigon/documentation#readme", 12 | "dependencies": { 13 | "@mathigon/boost": "^1.1.1", 14 | "@mathigon/core": "^1.1.1", 15 | "@mathigon/euclid": "^1.1.1", 16 | "@mathigon/fermat": "^1.1.1", 17 | "@mathigon/hilbert": "^1.1.1", 18 | "glob": "^7.1.6", 19 | "typedoc": "0.20.9", 20 | "typescript": "^4.2.3" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | # Hello! This is where you manage which Jekyll version is used to run. 3 | # When you want to use a different version, change it below, save the 4 | # file and run `bundle install`. Run Jekyll with `bundle exec`, like so: 5 | # 6 | # bundle exec jekyll serve 7 | # 8 | # This will help ensure the proper Jekyll version is running. 9 | 10 | # For Github Pages 11 | # gem "jekyll", "~> 4.2.0" 12 | gem "github-pages", "~> 212", group: :jekyll_plugins 13 | 14 | # If you have any plugins, put them here! 15 | group :jekyll_plugins do 16 | gem 'jekyll-seo-tag' 17 | end 18 | 19 | # Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem 20 | # and associated library. 21 | platforms :mingw, :x64_mingw, :mswin, :jruby do 22 | gem "tzinfo", "~> 1.2" 23 | gem "tzinfo-data" 24 | end 25 | 26 | # Performance-booster for watching directories on Windows 27 | gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin] 28 | 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mathigon.io 2 | 3 | Discover the open source JavaScript libraries that power Mathigon. Combining 4 | functions for DOM manipulation, animations, events handling, UI elements and 5 | mathematics, they make web development for modern browsers fun and easy. 6 | 7 | 8 | ## Deployment 9 | 10 | Generate typescript documentation using `npm run build`. 11 | Run a Jekyll server using `npm start`. 12 | 13 | 14 | ## Work in Progress 15 | 16 | * [ ] !! Styling improvements, text for homepage, check HTML tags 17 | * [ ] !! Add hyperlinks to type references in API docs 18 | * [ ] !! Ensure that all private interfaces are exported, and internal exports are ignored 19 | * [ ] ! Copy static markdown files from boost.js, polypad and studio repos 20 | * [ ] ! Different colours for each repository (CSS variables?) 21 | * [ ] Group methods, properties and accessors by type 22 | * [ ] Check API renderingg for Enums and interfaces 23 | 24 | 25 | ## Copyright and License 26 | 27 | Copyright © Mathigon ([dev@mathigon.org](mailto:dev@mathigon.org)) 28 | -------------------------------------------------------------------------------- /boost/eval.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 8 4 | parent: Boost.js 5 | --- 6 | 7 | # Eval 8 | 9 |
10 | 11 |
eval.ts#L473
12 | 13 | ## compile (expr: string): (context: {}, local: {}): undefined|T 14 | 15 | Compiles a JS expression into a function that can be evaluated with context. 16 | 17 | | Name | Type | Default | Description | 18 | | --- | --- | --- | --- | 19 | | `expr` | string | | | 20 | 21 | 22 |
23 | 24 |
25 | 26 |
eval.ts#L489
27 | 28 | ## compileString (expr: string, isAttribute: boolean): (vars: any): string 29 | 30 | Converts an expression string into an executable JS function. It will replace 31 | all `${x}` type expressions and evaluate them based on a context. 32 | 33 | | Name | Type | Default | Description | 34 | | --- | --- | --- | --- | 35 | | `expr` | string | | | 36 | | `isAttribute` | boolean | false | | 37 | 38 | 39 |
-------------------------------------------------------------------------------- /boost/thread.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 14 4 | parent: Boost.js 5 | --- 6 | 7 | # Thread 8 | 9 |
10 | 11 |
thread.ts#L15
12 | 13 | ## functionToWorker (fn: (): any): string 14 | 15 | Converts a function into a WebWorker URL object that can be passed into 16 | thread(). Note that `fn` has to be a single function with no external 17 | references or bindings, so that it can be stringified using .toString(). 18 | 19 | | Name | Type | Default | Description | 20 | | --- | --- | --- | --- | 21 | | `fn` | (): any | | | 22 | 23 | 24 |
25 | 26 |
27 | 28 |
thread.ts#L26
29 | 30 | ## thread (url: string|URL, data: any, timeout: number): Promise<T> 31 | 32 | Creates a new web worker, posts it a serializable data object, and returns 33 | when the worker responds (or after a fixed timeout). 34 | 35 | | Name | Type | Default | Description | 36 | | --- | --- | --- | --- | 37 | | `url` | string|URL | | | 38 | | `data` | any | | | 39 | | `timeout` | number | 5000 | | 40 | 41 | 42 |
-------------------------------------------------------------------------------- /boost/observable.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 11 4 | parent: Boost.js 5 | --- 6 | 7 | # Observable 8 | 9 |
10 | 11 |
observable.ts#L22
12 | 13 | ## Type alias Observable 14 | 15 |
16 | 17 |
18 | 19 |
observable.ts#L33
20 | 21 | ## batch (callback: (): void): void 22 | 23 | Batch multiple observable changes together into a single callback. 24 | 25 | | Name | Type | Default | Description | 26 | | --- | --- | --- | --- | 27 | | `callback` | (): void | | | 28 | 29 | 30 |
31 | 32 |
33 | 34 |
observable.ts#L45
35 | 36 | ## observe (state: T, parentModel: any): Observable<T> 37 | 38 | Convert object to an observable Proxy with .watch() callbacks. 39 | 40 | | Name | Type | Default | Description | 41 | | --- | --- | --- | --- | 42 | | `state` | T | | | 43 | | `parentModel` | any | | | 44 | 45 | 46 |
-------------------------------------------------------------------------------- /hilbert/parser.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 7 4 | parent: Hilbert.js 5 | --- 6 | 7 | # Parser 8 | 9 |
10 | 11 |
parser.ts#L259
12 | 13 | ## collapseTerm (tokens: Array<ExprElement>): ExprElement 14 | 15 | | Name | Type | Default | Description | 16 | | --- | --- | --- | --- | 17 | | `tokens` | Array<ExprElement> | | | 18 | 19 | 20 |
21 | 22 |
23 | 24 |
parser.ts#L176
25 | 26 | ## matchBrackets (tokens: Array<ExprElement>, context: {variables?: undefined|Array<string>}): ExprElement 27 | 28 | | Name | Type | Default | Description | 29 | | --- | --- | --- | --- | 30 | | `tokens` | Array<ExprElement> | | | 31 | | `context` | {variables?: undefined|Array<string>} | | | 32 | 33 | 34 |
35 | 36 |
37 | 38 |
parser.ts#L53
39 | 40 | ## tokenize (str: string): Array<ExprString|ExprSpace|ExprNumber|ExprIdentifier|ExprOperator> 41 | 42 | | Name | Type | Default | Description | 43 | | --- | --- | --- | --- | 44 | | `str` | string | | | 45 | 46 | 47 |
-------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | # Welcome to Jekyll! 2 | # 3 | # This config file is meant for settings that affect your whole blog, values 4 | # which you are expected to set up once and rarely edit after that. If you find 5 | # yourself editing this file very often, consider using Jekyll's data files 6 | # feature for the data you need to update frequently. 7 | # 8 | # For technical reasons, this file is *NOT* reloaded automatically when you use 9 | # 'bundle exec jekyll serve'. If you change this file, please restart the server process. 10 | # 11 | # If you need help with YAML syntax, here are some quick references for you: 12 | # https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml 13 | # https://learnxinyminutes.com/docs/yaml/ 14 | # 15 | # Site settings 16 | # These are used to personalize your new site. If you look in the HTML files, 17 | # you will see them accessed via {{ site.title }}, {{ site.email }}, and so on. 18 | # You can create any custom variable you would like, and they will be accessible 19 | # in the templates via {{ site.myvariable }}. 20 | 21 | title: Mathigon Documentation 22 | email: dev@mathigon.org 23 | description: TODO 24 | baseurl: "/" 25 | url: "https://mathigon.io" 26 | twitter: 27 | username: MathigonOrg 28 | card: summary 29 | github_username: jekyll 30 | 31 | logo: /images/logo.png 32 | 33 | plugins: 34 | - jekyll-seo-tag 35 | 36 | color_scheme: custom 37 | ga_tracking: UA-37525836-5 38 | remote_theme: pmarsceill/just-the-docs 39 | 40 | # Exclude from processing. 41 | exclude: 42 | - build.js 43 | - .sass-cache/ 44 | - .jekyll-cache/ 45 | - gemfiles/ 46 | - Gemfile 47 | - Gemfile.lock 48 | - package.json 49 | - package-lock.json 50 | - README.md 51 | - node_modules/ 52 | - vendor/bundle/ 53 | - vendor/cache/ 54 | - vendor/gems/ 55 | - vendor/ruby/ 56 | -------------------------------------------------------------------------------- /boost/audio.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 3 4 | parent: Boost.js 5 | --- 6 | 7 | # Audio 8 | 9 |
10 | 11 |
audio.ts#L7
12 | 13 | ## Class AudioPlayer 14 | 15 |
16 | 17 | ### constructor (src: string, defaultVolume: number, preload: boolean): AudioPlayer 18 | 19 | | Name | Type | Default | Description | 20 | | --- | --- | --- | --- | 21 | | `src` | string | | | 22 | | `defaultVolume` | number | 1 | | 23 | | `preload` | boolean | true | | 24 | 25 | 26 |
27 | 28 |
29 | 30 | ### Property .defaultVolume : number 31 | 32 | Default value: `1` 33 | 34 |
35 | 36 |
37 | 38 |
audio.ts#L8
39 | 40 | ### Property .player : HTMLAudioElement 41 | 42 | Default value: `...` 43 | 44 |
45 | 46 |
47 | 48 | ### Property .src : string 49 | 50 |
51 | 52 |
53 | 54 |
audio.ts#L15
55 | 56 | ### Method .play (volume: number): void 57 | 58 | | Name | Type | Default | Description | 59 | | --- | --- | --- | --- | 60 | | `volume` | number | | | 61 | 62 | 63 |
64 | 65 |
-------------------------------------------------------------------------------- /boost/browser.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 4 4 | parent: Boost.js 5 | --- 6 | 7 | # Browser 8 | 9 |
10 | 11 |
browser.ts#L19
12 | 13 | ## Type alias ResizeEvent 14 | 15 |
16 | 17 |
18 | 19 |
browser.ts#L276
20 | 21 | ## Browser : BrowserInstance 22 | 23 | Default value: `...` 24 | 25 |
26 | 27 |
28 | 29 |
browser.ts#L342
30 | 31 | ## bindAccessibilityEvents (parent: HTMLElement): void 32 | 33 | | Name | Type | Default | Description | 34 | | --- | --- | --- | --- | 35 | | `parent` | HTMLElement | | | 36 | 37 | 38 |
39 | 40 |
41 | 42 |
browser.ts#L338
43 | 44 | ## keyCode (e: KeyboardEvent): string 45 | 46 | | Name | Type | Default | Description | 47 | | --- | --- | --- | --- | 48 | | `e` | KeyboardEvent | | | 49 | 50 | 51 |
52 | 53 |
54 | 55 |
browser.ts#L294
56 | 57 | ## replaceSvgImports (): void 58 | 59 | Replaces SVG `` imports that are not supported by older browsers. 60 | 61 |
-------------------------------------------------------------------------------- /euclid/boolean.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 3 4 | parent: Euclid.js 5 | --- 6 | 7 | # Boolean 8 | 9 |
10 | 11 |
boolean.ts#L633
12 | 13 | ## difference (p1: MultiPolygon, p2: MultiPolygon): Array<Array<Point>> 14 | 15 | | Name | Type | Default | Description | 16 | | --- | --- | --- | --- | 17 | | `p1` | MultiPolygon | | | 18 | | `p2` | MultiPolygon | | | 19 | 20 | 21 |
22 | 23 |
24 | 25 |
boolean.ts#L632
26 | 27 | ## intersect (p1: MultiPolygon, p2: MultiPolygon): Array<Array<Point>> 28 | 29 | | Name | Type | Default | Description | 30 | | --- | --- | --- | --- | 31 | | `p1` | MultiPolygon | | | 32 | | `p2` | MultiPolygon | | | 33 | 34 | 35 |
36 | 37 |
38 | 39 |
boolean.ts#L631
40 | 41 | ## union (p1: MultiPolygon, p2: MultiPolygon): Array<Array<Point>> 42 | 43 | | Name | Type | Default | Description | 44 | | --- | --- | --- | --- | 45 | | `p1` | MultiPolygon | | | 46 | | `p2` | MultiPolygon | | | 47 | 48 | 49 |
50 | 51 |
52 | 53 |
boolean.ts#L634
54 | 55 | ## xor (p1: MultiPolygon, p2: MultiPolygon): Array<Array<Point>> 56 | 57 | | Name | Type | Default | Description | 58 | | --- | --- | --- | --- | 59 | | `p1` | MultiPolygon | | | 60 | | `p2` | MultiPolygon | | | 61 | 62 | 63 |
-------------------------------------------------------------------------------- /boost/svg.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 13 4 | parent: Boost.js 5 | --- 6 | 7 | # Svg 8 | 9 |
10 | 11 |
svg.ts#L11
12 | 13 | ## Type alias PathCommand 14 | 15 |
16 | 17 |
18 | 19 |
svg.ts#L129
20 | 21 | ## cleanSVG (node: El): void 22 | 23 | | Name | Type | Default | Description | 24 | | --- | --- | --- | --- | 25 | | `node` | El | | | 26 | 27 | 28 |
29 | 30 |
31 | 32 |
svg.ts#L157
33 | 34 | ## copySVGStyles (source: El, copy: El, isHTML: boolean): void 35 | 36 | | Name | Type | Default | Description | 37 | | --- | --- | --- | --- | 38 | | `source` | El | | | 39 | | `copy` | El | | | 40 | | `isHTML` | boolean | false | | 41 | 42 | 43 |
44 | 45 |
46 | 47 |
svg.ts#L65
48 | 49 | ## parsePath (d: string): Array<Point> 50 | 51 | Return all points on an SVG path. Essentially, this turns a curved path into 52 | a polygon with just the joins/corners selected. 53 | 54 | | Name | Type | Default | Description | 55 | | --- | --- | --- | --- | 56 | | `d` | string | | | 57 | 58 | 59 |
60 | 61 |
62 | 63 |
svg.ts#L18
64 | 65 | ## pathCommands (path: string): Array<PathCommand> 66 | 67 | | Name | Type | Default | Description | 68 | | --- | --- | --- | --- | 69 | | `path` | string | | | 70 | 71 | 72 |
-------------------------------------------------------------------------------- /hilbert/eval.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 3 4 | parent: Hilbert.js 5 | --- 6 | 7 | # Eval 8 | 9 |
10 | 11 |
eval.ts#L18
12 | 13 | ## Type alias Interval 14 | 15 |
16 | 17 |
18 | 19 |
eval.ts#L40
20 | 21 | ## evaluate : Record<Functions, (args: Array<number>): number> 22 | 23 | Default value: `...` 24 | 25 |
26 | 27 |
28 | 29 |
eval.ts#L122
30 | 31 | ## interval : Record<Functions, (args: Array<Interval>): Interval> 32 | 33 | Default value: `...` 34 | 35 |
36 | 37 |
38 | 39 |
eval.ts#L34
40 | 41 | ## hasZero (a: Interval): boolean 42 | 43 | | Name | Type | Default | Description | 44 | | --- | --- | --- | --- | 45 | | `a` | Interval | | | 46 | 47 | 48 |
49 | 50 |
51 | 52 |
eval.ts#L29
53 | 54 | ## isWhole (a: Interval): boolean 55 | 56 | | Name | Type | Default | Description | 57 | | --- | --- | --- | --- | 58 | | `a` | Interval | | | 59 | 60 | 61 |
62 | 63 |
64 | 65 |
eval.ts#L27
66 | 67 | ## width (a: Interval): number 68 | 69 | | Name | Type | Default | Description | 70 | | --- | --- | --- | --- | 71 | | `a` | Interval | | | 72 | 73 | 74 |
-------------------------------------------------------------------------------- /fermat/combinatorics.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 2 4 | parent: Fermat.js 5 | --- 6 | 7 | # Combinatorics 8 | 9 |
10 | 11 |
combinatorics.ts#L19
12 | 13 | ## binomial (n: number, k: number): number 14 | 15 | Calculates the binomial coefficient nCk of two numbers n and k. 16 | 17 | | Name | Type | Default | Description | 18 | | --- | --- | --- | --- | 19 | | `n` | number | | | 20 | | `k` | number | | | 21 | 22 | 23 |
24 | 25 |
26 | 27 |
combinatorics.ts#L8
28 | 29 | ## factorial (x: number): number 30 | 31 | Calculates the factorial of a number x. 32 | 33 | | Name | Type | Default | Description | 34 | | --- | --- | --- | --- | 35 | | `x` | number | | | 36 | 37 | 38 |
39 | 40 |
41 | 42 |
combinatorics.ts#L35
43 | 44 | ## permutations (arr: Array<T>): Array<Array<T>> 45 | 46 | Returns an array of all possible permutations of an input array arr. In this 47 | implementation, we always have permutations(arr)[0] == arr. From 48 | http://stackoverflow.com/questions/9960908/permutations-in-javascript 49 | 50 | | Name | Type | Default | Description | 51 | | --- | --- | --- | --- | 52 | | `arr` | Array<T> | | | 53 | 54 | 55 |
56 | 57 |
58 | 59 |
combinatorics.ts#L59
60 | 61 | ## subsets (array: Array<T>, length: number): Array<Array<T>> 62 | 63 | Returns an array of all possible subsets of an input array (of given length). 64 | 65 | | Name | Type | Default | Description | 66 | | --- | --- | --- | --- | 67 | | `array` | Array<T> | | | 68 | | `length` | number | 0 | | 69 | 70 | 71 |
-------------------------------------------------------------------------------- /_sass/custom/custom.scss: -------------------------------------------------------------------------------- 1 | footer { display: none; } 2 | .logo { display: block; width: 200px; height: 42px; } 3 | 4 | div.highlighter-rouge, code { border: 1px solid rgba(black, 20%); } 5 | code { padding: 0.2em 0.4em; font-size: 0.8em; } 6 | pre code { background: none; } 7 | .highlight pre.highlight { background: none; } 8 | 9 | // p { color: rgba(white, 75%); } 10 | 11 | 12 | .docs-item { border-top: 1px solid #ccc; position: relative; padding: 28px 0; } 13 | .source { position: absolute; top: 0; right: 0; background: #ccc; line-height: 1.4; font-size: 14px; padding: 0 6px; border-radius: 0 0 4px 4px; } 14 | .docs-item > :first-child, .docs-item > div + * { margin-top: 0 !important; } 15 | .docs-item > :last-child { margin-bottom: 0 !important; } 16 | 17 | .main-content .task-list-item { display: block; } 18 | 19 | h2, h3 { font-weight: 600; } 20 | .main-content h2 { color: #cd0e66; } 21 | 22 | .signature { font-style: normal; font-size: 14px; color: #222; } 23 | .pill { background: #cd0e66; color: white; font-size: 14px; font-weight: 600; 24 | border-radius: 20px; margin-right: 6px; padding: 0 8px; opacity: 0.5; } 25 | 26 | a.souce { float: right; } 27 | 28 | .nav-list .nav-list-item > .nav-list .nav-list-item .nav-list-link { color: rgba(white, 70%); } 29 | .nav-list .nav-list-item .nav-list-link:hover, .nav-list .nav-list-item .nav-list-link.active, .site-title:hover { 30 | background: linear-gradient(-90deg, rgba(white, 20%) 80%, rgba(white, 0) 100%); color: white; 31 | } 32 | .nav-list .nav-list-item .nav-list-expander:hover { background: rgba(white, 20%); } 33 | 34 | .table-wrapper { box-shadow: 0 2px 6px rgba(black, 10%); border: 1px solid; } 35 | table { border-collapse: collapse; } 36 | th { background: rgba(black, 8%); } 37 | // td { background: none; } 38 | 39 | .highlight { 40 | // color: #f8f8f2; 41 | .hll, .s, .sa, .sb, .sc, .dl, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss { color: #22ab24; } 42 | .go { color: #44475a; } 43 | // .err, .g, .l, .n, .x, .p, .ge, .gr, .gh, .gi, .gp, .gs, .gu, .gt, .ld, .no, .nd, .ni, .ne, .nn, .nx, .py, .w, .bp { color: #f8f8f2; } 44 | .gh, .gi, .gu { font-weight: bold; } 45 | .ge { text-decoration: underline; } 46 | .bp { font-style: italic; } 47 | .c, .ch, .cm, .cpf, .c1, .cs { color: #009ea6; } 48 | .kd, .kt, .nb, .nl, .nv, .vc, .vg, .k, .vi, .vm { color: #cd0e66; } 49 | .kd, .nb, .nl, .nv, .vc, .vg, .vi, .vm { font-style: italic; } 50 | .na, .nc, .nf, .fm { color: #fd8c00; } 51 | .kt, .o, .cp, .kc, .kn, .kp, .kr, .nt, .ow { color: #6d3bbf; } 52 | .m, .mb, .mf, .mh, .mi, .mo, .il { color: #0f82f2; } 53 | .gd { color: #eb4726; } 54 | } 55 | -------------------------------------------------------------------------------- /euclid/draw-canvas.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 6 4 | parent: Euclid.js 5 | --- 6 | 7 | # Draw Canvas 8 | 9 |
10 | 11 |
draw-canvas.ts#L13
12 | 13 | ## Interface CanvasDrawingOptions 14 | 15 |
16 | 17 |
draw-canvas.ts#L20
18 | 19 | ### Property .box 20 | 21 |
22 | 23 |
24 | 25 |
draw-canvas.ts#L14
26 | 27 | ### Property .fill 28 | 29 |
30 | 31 |
32 | 33 |
draw-canvas.ts#L18
34 | 35 | ### Property .lineCap 36 | 37 |
38 | 39 |
40 | 41 |
draw-canvas.ts#L19
42 | 43 | ### Property .lineJoin 44 | 45 |
46 | 47 |
48 | 49 |
draw-canvas.ts#L15
50 | 51 | ### Property .opacity 52 | 53 |
54 | 55 |
56 | 57 |
draw-canvas.ts#L16
58 | 59 | ### Property .stroke 60 | 61 |
62 | 63 |
64 | 65 |
draw-canvas.ts#L17
66 | 67 | ### Property .strokeWidth 68 | 69 |
70 | 71 |
72 | 73 |
74 | 75 |
draw-canvas.ts#L27
76 | 77 | ## drawCanvas (ctx: CanvasRenderingContext2D, obj: GeoElement, options: CanvasDrawingOptions): void 78 | 79 | | Name | Type | Default | Description | 80 | | --- | --- | --- | --- | 81 | | `ctx` | CanvasRenderingContext2D | | | 82 | | `obj` | GeoElement | | | 83 | | `options` | CanvasDrawingOptions | ... | | 84 | 85 | 86 |
-------------------------------------------------------------------------------- /euclid/draw-svg.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 7 4 | parent: Euclid.js 5 | --- 6 | 7 | # Draw Svg 8 | 9 |
10 | 11 |
draw-svg.ts#L20
12 | 13 | ## Interface SVGDrawingOptions 14 | 15 |
16 | 17 |
draw-svg.ts#L25
18 | 19 | ### Property .arrows 20 | 21 |
22 | 23 |
24 | 25 |
draw-svg.ts#L26
26 | 27 | ### Property .box 28 | 29 |
30 | 31 |
32 | 33 |
draw-svg.ts#L23
34 | 35 | ### Property .fill 36 | 37 |
38 | 39 |
40 | 41 |
draw-svg.ts#L24
42 | 43 | ### Property .mark 44 | 45 |
46 | 47 |
48 | 49 |
draw-svg.ts#L21
50 | 51 | ### Property .round 52 | 53 |
54 | 55 |
56 | 57 |
draw-svg.ts#L22
58 | 59 | ### Property .size 60 | 61 |
62 | 63 |
64 | 65 |
66 | 67 |
draw-svg.ts#L18
68 | 69 | ## Type alias LineArrow 70 | 71 |
72 | 73 |
74 | 75 |
draw-svg.ts#L17
76 | 77 | ## Type alias LineMark 78 | 79 |
80 | 81 |
82 | 83 |
draw-svg.ts#L111
84 | 85 | ## drawSVG (obj: GeoElement, options: SVGDrawingOptions): string 86 | 87 | | Name | Type | Default | Description | 88 | | --- | --- | --- | --- | 89 | | `obj` | GeoElement | | | 90 | | `options` | SVGDrawingOptions | ... | | 91 | 92 | 93 |
-------------------------------------------------------------------------------- /core/events.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 4 4 | parent: Core.js 5 | --- 6 | 7 | # Events 8 | 9 |
10 | 11 |
events.ts#L15
12 | 13 | ## Class EventTarget 14 | 15 | Base class for event management. 16 | 17 |
18 | 19 | ### constructor (): EventTarget 20 | 21 |
22 | 23 |
24 | 25 |
events.ts#L16
26 | 27 | ### Property .events : Map<string, Array<EventCallback>> 28 | 29 | Default value: `...` 30 | 31 |
32 | 33 |
34 | 35 |
events.ts#L36
36 | 37 | ### Method .off (events: string, fn: EventCallback): void 38 | 39 | Removes an event listener from one or more events. 40 | 41 | | Name | Type | Default | Description | 42 | | --- | --- | --- | --- | 43 | | `events` | string | | | 44 | | `fn` | EventCallback | | | 45 | 46 | 47 |
48 | 49 |
50 | 51 |
events.ts#L19
52 | 53 | ### Method .on (events: string, fn: EventCallback): void 54 | 55 | Adds an event listener for one or more events. 56 | 57 | | Name | Type | Default | Description | 58 | | --- | --- | --- | --- | 59 | | `events` | string | | | 60 | | `fn` | EventCallback | | | 61 | 62 | 63 |
64 | 65 |
66 | 67 |
events.ts#L27
68 | 69 | ### Method .one (events: string, fn: EventCallback): void 70 | 71 | Adds a one-time event listener to one or more events. 72 | 73 | | Name | Type | Default | Description | 74 | | --- | --- | --- | --- | 75 | | `events` | string | | | 76 | | `fn` | EventCallback | | | 77 | 78 | 79 |
80 | 81 |
82 | 83 |
events.ts#L45
84 | 85 | ### Method .trigger (events: string, arg: unknown): void 86 | 87 | Triggers one or more events, and executes all bound event listeners. 88 | 89 | | Name | Type | Default | Description | 90 | | --- | --- | --- | --- | 91 | | `events` | string | | | 92 | | `arg` | unknown | | | 93 | 94 | 95 |
96 | 97 |
-------------------------------------------------------------------------------- /core/strings.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 7 4 | parent: Core.js 5 | --- 6 | 7 | # Strings 8 | 9 |
10 | 11 |
strings.ts#L59
12 | 13 | ## autoCorrect (word: string, dict: Array<string>): undefined|string 14 | 15 | Tries to auto-correct a word from a dictionary. 16 | 17 | | Name | Type | Default | Description | 18 | | --- | --- | --- | --- | 19 | | `word` | string | | | 20 | | `dict` | Array<string> | | | 21 | 22 | 23 |
24 | 25 |
26 | 27 |
strings.ts#L31
28 | 29 | ## isPalindrome (str: string): boolean 30 | 31 | Checks if a string is a palindrome. 32 | 33 | | Name | Type | Default | Description | 34 | | --- | --- | --- | --- | 35 | | `str` | string | | | 36 | 37 | 38 |
39 | 40 |
41 | 42 |
strings.ts#L40
43 | 44 | ## stringDistance (s1: string, s2: string, ignoreTrailing: boolean): number 45 | 46 | Determines the Levenshtein distance between two strings. If ignoreTrailing 47 | is true, we will ignore any additional, trailing characters in s2. 48 | 49 | | Name | Type | Default | Description | 50 | | --- | --- | --- | --- | 51 | | `s1` | string | | | 52 | | `s2` | string | | | 53 | | `ignoreTrailing` | boolean | false | | 54 | 55 | 56 |
57 | 58 |
59 | 60 |
strings.ts#L24
61 | 62 | ## toCamelCase (str: string): string 63 | 64 | Converts a string to camel case. 65 | 66 | | Name | Type | Default | Description | 67 | | --- | --- | --- | --- | 68 | | `str` | string | | | 69 | 70 | 71 |
72 | 73 |
74 | 75 |
strings.ts#L18
76 | 77 | ## toTitleCase (str: string): string 78 | 79 | Converts a string to title case. 80 | 81 | | Name | Type | Default | Description | 82 | | --- | --- | --- | --- | 83 | | `str` | string | | | 84 | 85 | 86 |
87 | 88 |
89 | 90 |
strings.ts#L11
91 | 92 | ## words (str: string, divider: RegExp): Array<string> 93 | 94 | Splits a string into space separated words. 95 | 96 | | Name | Type | Default | Description | 97 | | --- | --- | --- | --- | 98 | | `str` | string | | | 99 | | `divider` | RegExp | ... | | 100 | 101 | 102 |
-------------------------------------------------------------------------------- /studio/interactives.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 3 4 | parent: Mathigon Studio 5 | --- 6 | 7 | # Interactive Elements 8 | 9 | Many interactive elements share common functionality such as animating a DOM element or listening to 10 | a slide gesture. For consistency, browser-compatibility and accessibility, we should use the 11 | shared utility methods in the [__@mathigon/boost__](https://github.com/mathigon/boost.js) library. 12 | Refer to its documentation for more information about: 13 | 14 | * [Element selection](https://github.com/mathigon/boost.js/blob/master/docs/elements.md) 15 | * [SVG and Canvas drawing](https://github.com/mathigon/boost.js/blob/master/docs/elements.md#svg-and-canvas-drawing) 16 | * [Animations](https://github.com/mathigon/boost.js/blob/master/docs/animations.md) 17 | * [Event hand gesture handling](https://github.com/mathigon/boost.js/blob/master/docs/events.md) 18 | * [Custom Web Components](https://github.com/mathigon/boost.js/blob/master/docs/webcomponents.md) 19 | 20 | ## Linking Markdown and TypeScript 21 | 22 | Every course is divided into multiple steps, separated by `---`s. Every step has a unique ID which 23 | is provided in the `>` block at the beginning of a step, in the `content.md` file: 24 | 25 | ``` 26 | --- 27 | > id: my-step-1 28 | 29 | {.my-class} Here is a paragraph 30 | 31 | --- 32 | ``` 33 | 34 | _Note: Specifying an ID for every step is optional, but recommended since the IDs are used to 35 | identify student progress in our database. Missing step IDs could lead to discrepancies if we 36 | insert new steps into an existing course._ 37 | 38 | The step IDs correspond to the names of functions exported in the `functions.ts` file for the 39 | same course. The function is executed whenever the step is revealed for the first time, and takes 40 | a `$step` argument, which is a reference to the custom HTML `` element that wraps around 41 | the step. Check [types.d.ts](content/shared/types.d.ts) for the available properties and methods. 42 | 43 | ``` 44 | export function myStep1($step: Step) { 45 | const $paragraph = $step.$('.my-class'); 46 | } 47 | ``` 48 | 49 | _Note: Step IDs are in `kebab-case` while function names are in `camelCase`._ 50 | 51 | ## Goals and progress 52 | 53 | TODO... 54 | 55 | ## Models and templates 56 | 57 | Every step contains an observable object, which can be used to create reactive 58 | 59 | ```ts 60 | export function myStep1($step: Step) { 61 | $step.model.a = 10 62 | $step.model.b = 11 63 | } 64 | ``` 65 | 66 | Any variables you assign to `$step.model` can then be accessed in Markdown. If the model changes, 67 | the template will update automatically. 68 | 69 | ``` 70 | Here is ${a} and ${b}. 71 | ``` 72 | 73 | Many built-in interactive elements automatically integrate with the model: 74 | 75 | ```md 76 | Here is a variable slider ${a}{a|5|0,10,1} and some variable values: a = ${a}, b = ${b}. 77 | Here is [a button](action:increment(1)) that triggers a function whenever you click it. 78 | 79 | // A large horizontal slider that binds to model.b 80 | x-slider(steps=100 :bind="b") 81 | ``` 82 | 83 | ```ts 84 | export function myStep1($step: Step) { 85 | $step.model.click = (n: number) => $step.model.b += 1; 86 | 87 | console.log($step.model.a); // Get the current value of model.a. 88 | 89 | $step.model.watch(() => { 90 | // This callback is triggered whenever model.a changes, but not when model.b changes. 91 | console.log('a =', $step.model.a); 92 | }); 93 | } 94 | ``` 95 | 96 | _Note: The `model.watch` function is very efficient: when executed for the first time, it tracks 97 | which model properties are accessed within its body. Then it will keep executing the callback any 98 | time these properties change, but not when other properties of `model` change._ 99 | -------------------------------------------------------------------------------- /boost/ajax.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 1 4 | parent: Boost.js 5 | --- 6 | 7 | # Ajax 8 | 9 |
10 | 11 |
ajax.ts#L149
12 | 13 | ## deferredPost (url: string, data: PostData): void 14 | 15 | Utility function to throttle repeated POST requests. A request to the same 16 | URL will be made at most every 5s, and the corresponding data objects will 17 | be deep-merged. 18 | 19 | | Name | Type | Default | Description | 20 | | --- | --- | --- | --- | 21 | | `url` | string | | | 22 | | `data` | PostData | | | 23 | 24 | 25 |
26 | 27 |
28 | 29 |
ajax.ts#L46
30 | 31 | ## fromQueryString (str: string): Obj<string> 32 | 33 | Converts an HTML query string to JSON object. 34 | 35 | | Name | Type | Default | Description | 36 | | --- | --- | --- | --- | 37 | | `str` | string | | | 38 | 39 | 40 |
41 | 42 |
43 | 44 |
ajax.ts#L94
45 | 46 | ## loadImage (url: string, credentials: boolean): Promise<HTMLImageElement> 47 | 48 | Asynchronously loads an Image. 49 | 50 | | Name | Type | Default | Description | 51 | | --- | --- | --- | --- | 52 | | `url` | string | | | 53 | | `credentials` | boolean | false | | 54 | 55 | 56 |
57 | 58 |
59 | 60 |
ajax.ts#L103
61 | 62 | ## loadImageDataURI (args: []): Promise<string> 63 | 64 | | Name | Type | Default | Description | 65 | | --- | --- | --- | --- | 66 | | `args` | [] | | | 67 | 68 | 69 |
70 | 71 |
72 | 73 |
ajax.ts#L83
74 | 75 | ## loadScript (src: string): Promise<unknown> 76 | 77 | Asynchronously loads and executes a JS script. 78 | 79 | | Name | Type | Default | Description | 80 | | --- | --- | --- | --- | 81 | | `src` | string | | | 82 | 83 | 84 |
85 | 86 |
87 | 88 |
ajax.ts#L65
89 | 90 | ## post (url: string, data: PostData|FormData): Promise<string> 91 | 92 | Asynchronously loads a resource using a POST request. This utility function 93 | automatically form-encodes JSON data and adds a CSRF header. 94 | 95 | | Name | Type | Default | Description | 96 | | --- | --- | --- | --- | 97 | | `url` | string | | | 98 | | `data` | PostData|FormData | | | 99 | 100 | 101 |
102 | 103 |
104 | 105 |
ajax.ts#L23
106 | 107 | ## toQueryString (data: PostData): string 108 | 109 | Converts a JSON object to an HTML query string. 110 | 111 | | Name | Type | Default | Description | 112 | | --- | --- | --- | --- | 113 | | `data` | PostData | | | 114 | 115 | 116 |
-------------------------------------------------------------------------------- /core/cache.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 2 4 | parent: Core.js 5 | --- 6 | 7 | # Cache 8 | 9 |
10 | 11 |
cache.ts#L8
12 | 13 | ## Class Cache 14 | 15 | A basic LRU cache implementation. 16 | 17 |
18 | 19 | ### constructor (maxSize: number): Cache<T> 20 | 21 | | Name | Type | Default | Description | 22 | | --- | --- | --- | --- | 23 | | `maxSize` | number | | | 24 | 25 | 26 |
27 | 28 |
29 | 30 |
cache.ts#L10
31 | 32 | ### Property .list 33 | 34 | Default value: `...` 35 | 36 |
37 | 38 |
39 | 40 | ### readonly Property .maxSize : number 41 | 42 |
43 | 44 |
45 | 46 |
cache.ts#L9
47 | 48 | ### Property .store : Map<string, {i: number, val: T}> 49 | 50 | Default value: `...` 51 | 52 |
53 | 54 |
55 | 56 |
cache.ts#L18
57 | 58 | ### Method .get (a: string): undefined|T 59 | 60 | | Name | Type | Default | Description | 61 | | --- | --- | --- | --- | 62 | | `a` | string | | | 63 | 64 | 65 |
66 | 67 |
68 | 69 |
cache.ts#L44
70 | 71 | ### Method .getOrSet (a: string, callback: (a: string): T): T 72 | 73 | | Name | Type | Default | Description | 74 | | --- | --- | --- | --- | 75 | | `a` | string | | | 76 | | `callback` | (a: string): T | | | 77 | 78 | 79 |
80 | 81 |
82 | 83 |
cache.ts#L14
84 | 85 | ### Method .has (a: string): boolean 86 | 87 | | Name | Type | Default | Description | 88 | | --- | --- | --- | --- | 89 | | `a` | string | | | 90 | 91 | 92 |
93 | 94 |
95 | 96 |
cache.ts#L24
97 | 98 | ### Method .set (a: string, b: T): void 99 | 100 | | Name | Type | Default | Description | 101 | | --- | --- | --- | --- | 102 | | `a` | string | | | 103 | | `b` | T | | | 104 | 105 | 106 |
107 | 108 |
109 | 110 |
cache.ts#L53
111 | 112 | ### Method .touch (a: string, item: {i: number, val: T}): void 113 | 114 | | Name | Type | Default | Description | 115 | | --- | --- | --- | --- | 116 | | `a` | string | | | 117 | | `item` | {i: number, val: T} | | | 118 | 119 | 120 |
121 | 122 |
-------------------------------------------------------------------------------- /hilbert/symbols.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 8 4 | parent: Hilbert.js 5 | --- 6 | 7 | # Symbols 8 | 9 |
10 | 11 |
symbols.ts#L139
12 | 13 | ## Type alias SpecialFunction 14 | 15 |
16 | 17 |
18 | 19 |
symbols.ts#L16
20 | 21 | ## BRACKETS : Obj<string> 22 | 23 | Default value: `...` 24 | 25 |
26 | 27 |
28 | 29 |
symbols.ts#L10
30 | 31 | ## CONSTANTS : Obj<number> 32 | 33 | Default value: `...` 34 | 35 |
36 | 37 |
38 | 39 |
symbols.ts#L119
40 | 41 | ## FUNCTION_NAMES : Obj<string> 42 | 43 | Default value: `...` 44 | 45 |
46 | 47 |
48 | 49 |
symbols.ts#L113
50 | 51 | ## IDENTIFIER_SYMBOLS 52 | 53 | Default value: `...` 54 | 55 |
56 | 57 |
58 | 59 |
symbols.ts#L117
60 | 61 | ## OPERATOR_SYMBOLS 62 | 63 | Default value: `...` 64 | 65 |
66 | 67 |
68 | 69 |
symbols.ts#L66
70 | 71 | ## SPECIAL_IDENTIFIERS : Obj<string> 72 | 73 | Default value: `...` 74 | 75 |
76 | 77 |
78 | 79 |
symbols.ts#L22
80 | 81 | ## SPECIAL_OPERATORS : Obj<string> 82 | 83 | Default value: `...` 84 | 85 |
86 | 87 |
88 | 89 |
symbols.ts#L145
90 | 91 | ## VOICE_STRINGS : Obj<string> 92 | 93 | Default value: `...` 94 | 95 |
96 | 97 |
98 | 99 |
symbols.ts#L131
100 | 101 | ## escape (char: string): string 102 | 103 | | Name | Type | Default | Description | 104 | | --- | --- | --- | --- | 105 | | `char` | string | | | 106 | 107 | 108 |
109 | 110 |
111 | 112 |
symbols.ts#L141
113 | 114 | ## isSpecialFunction (fn: string): fn is abs|round|floor|ceil|max|min|mod|lcm|gcd|gcf|log|exp|ln|sqrt|root|sin|cos|tan|sec|csc|cot|cosec|cotan|arcsin|arccos|arctan|sinh|cosh|tanh|sech|csch|coth|cosech 115 | 116 | | Name | Type | Default | Description | 117 | | --- | --- | --- | --- | 118 | | `fn` | string | | | 119 | 120 | 121 |
-------------------------------------------------------------------------------- /fermat/statistics.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 9 4 | parent: Fermat.js 5 | --- 6 | 7 | # Statistics 8 | 9 |
10 | 11 |
statistics.ts#L92
12 | 13 | ## correlation (aX: Array<number>, aY: Array<number>): number 14 | 15 | Calculates the correlation between the numbers in two arrays aX and aY. 16 | 17 | | Name | Type | Default | Description | 18 | | --- | --- | --- | --- | 19 | | `aX` | Array<number> | | | 20 | | `aY` | Array<number> | | | 21 | 22 | 23 |
24 | 25 |
26 | 27 |
statistics.ts#L85
28 | 29 | ## covariance (aX: Array<number>, aY: Array<number>): number 30 | 31 | Calculates the covariance of the numbers in two arrays aX and aY. 32 | 33 | | Name | Type | Default | Description | 34 | | --- | --- | --- | --- | 35 | | `aX` | Array<number> | | | 36 | | `aY` | Array<number> | | | 37 | 38 | 39 |
40 | 41 |
42 | 43 |
statistics.ts#L12
44 | 45 | ## mean (values: Array<number>): number 46 | 47 | Calculates the mean of an array of numbers. 48 | 49 | | Name | Type | Default | Description | 50 | | --- | --- | --- | --- | 51 | | `values` | Array<number> | | | 52 | 53 | 54 |
55 | 56 |
57 | 58 |
statistics.ts#L37
59 | 60 | ## median (values: Array<number>): number 61 | 62 | Calculates the median of an array of numbers. 63 | 64 | | Name | Type | Default | Description | 65 | | --- | --- | --- | --- | 66 | | `values` | Array<number> | | | 67 | 68 | 69 |
70 | 71 |
72 | 73 |
statistics.ts#L45
74 | 75 | ## mode (values: Array<number>): undefined|number 76 | 77 | Calculates the mode of an array of numbers. Returns undefined if no mode 78 | exists, i.e. there are multiple values with the same largest count. 79 | 80 | | Name | Type | Default | Description | 81 | | --- | --- | --- | --- | 82 | | `values` | Array<number> | | | 83 | 84 | 85 |
86 | 87 |
88 | 89 |
statistics.ts#L17
90 | 91 | ## quantile (values: Array<number>, p: number): number 92 | 93 | Finds the quantile of an array of numbers for the cumulative probability p. 94 | 95 | | Name | Type | Default | Description | 96 | | --- | --- | --- | --- | 97 | | `values` | Array<number> | | | 98 | | `p` | number | | | 99 | 100 | 101 |
102 | 103 |
104 | 105 |
statistics.ts#L79
106 | 107 | ## stdDev (values: Array<number>): number 108 | 109 | Calculates the standard deviation of an array of numbers. 110 | 111 | | Name | Type | Default | Description | 112 | | --- | --- | --- | --- | 113 | | `values` | Array<number> | | | 114 | 115 | 116 |
117 | 118 |
119 | 120 |
statistics.ts#L70
121 | 122 | ## variance (values: Array<number>): undefined|number 123 | 124 | Calculates the variance of an array of numbers. 125 | 126 | | Name | Type | Default | Description | 127 | | --- | --- | --- | --- | 128 | | `values` | Array<number> | | | 129 | 130 | 131 |
-------------------------------------------------------------------------------- /fermat/number-theory.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 6 4 | parent: Fermat.js 5 | --- 6 | 7 | # Number Theory 8 | 9 |
10 | 11 |
number-theory.ts#L118
12 | 13 | ## eulerPhi (x: number): number 14 | 15 | Computes Euler's totient function (phi) for a given natural number x. 16 | 17 | | Name | Type | Default | Description | 18 | | --- | --- | --- | --- | 19 | | `x` | number | | | 20 | 21 | 22 |
23 | 24 |
25 | 26 |
number-theory.ts#L11
27 | 28 | ## gcd (numbers: Array<number>): number 29 | 30 | Calculates the greatest common divisor of multiple numbers. 31 | 32 | | Name | Type | Default | Description | 33 | | --- | --- | --- | --- | 34 | | `numbers` | Array<number> | | | 35 | 36 | 37 |
38 | 39 |
40 | 41 |
number-theory.ts#L83
42 | 43 | ## generatePrime (d: number): number 44 | 45 | Generates a random prime number with d digits, where 2 <= d <= 16. 46 | 47 | | Name | Type | Default | Description | 48 | | --- | --- | --- | --- | 49 | | `d` | number | | | 50 | 51 | 52 |
53 | 54 |
55 | 56 |
number-theory.ts#L97
57 | 58 | ## goldbach (x: number): [number, number] 59 | 60 | Tries to write a number x as the sum of two primes. 61 | 62 | | Name | Type | Default | Description | 63 | | --- | --- | --- | --- | 64 | | `x` | number | | | 65 | 66 | 67 |
68 | 69 |
70 | 71 |
number-theory.ts#L31
72 | 73 | ## isPrime (n: number): boolean 74 | 75 | Checks if a number n is prime. 76 | 77 | | Name | Type | Default | Description | 78 | | --- | --- | --- | --- | 79 | | `n` | number | | | 80 | 81 | 82 |
83 | 84 |
85 | 86 |
number-theory.ts#L23
87 | 88 | ## lcm (numbers: Array<number>): number 89 | 90 | Calculates the lowest common multiple of multiple numbers. 91 | 92 | | Name | Type | Default | Description | 93 | | --- | --- | --- | --- | 94 | | `numbers` | Array<number> | | | 95 | 96 | 97 |
98 | 99 |
100 | 101 |
number-theory.ts#L67
102 | 103 | ## listPrimes (n: number): Array<number> 104 | 105 | Lists all prime numbers between 0 and n. 106 | 107 | | Name | Type | Default | Description | 108 | | --- | --- | --- | --- | 109 | | `n` | number | 100 | | 110 | 111 | 112 |
113 | 114 |
115 | 116 |
number-theory.ts#L47
117 | 118 | ## primeFactorisation (n: number): Array<number> 119 | 120 | Finds the prime factorisation of a number n. 121 | 122 | | Name | Type | Default | Description | 123 | | --- | --- | --- | --- | 124 | | `n` | number | | | 125 | 126 | 127 |
128 | 129 |
130 | 131 |
number-theory.ts#L62
132 | 133 | ## primeFactors (n: number): Array<number> 134 | 135 | Finds all prime factors of a number n. 136 | 137 | | Name | Type | Default | Description | 138 | | --- | --- | --- | --- | 139 | | `n` | number | | | 140 | 141 | 142 |
-------------------------------------------------------------------------------- /fermat/regression.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 8 4 | parent: Fermat.js 5 | --- 6 | 7 | # Regression 8 | 9 |
10 | 11 |
regression.ts#L160
12 | 13 | ## bestPolynomial (data: Array<Coordinate>, threshold: number, maxOrder: number): undefined|{coefficients: Array<number>, fn: (x: number): number, order: number} 14 | 15 | Finds the most suitable polynomial regression for a given dataset. 16 | 17 | | Name | Type | Default | Description | 18 | | --- | --- | --- | --- | 19 | | `data` | Array<Coordinate> | | | 20 | | `threshold` | number | 0.85 | | 21 | | `maxOrder` | number | 8 | | 22 | 23 | 24 |
25 | 26 |
27 | 28 |
regression.ts#L142
29 | 30 | ## coefficient (data: Array<Coordinate>, fn: (x: number): number): number 31 | 32 | Finds the regression coefficient of a given data set and regression 33 | function. 34 | 35 | | Name | Type | Default | Description | 36 | | --- | --- | --- | --- | 37 | | `data` | Array<Coordinate> | | | 38 | | `fn` | (x: number): number | | | 39 | 40 | 41 |
42 | 43 |
44 | 45 |
regression.ts#L53
46 | 47 | ## exponential (data: Array<Coordinate>): Array<number> 48 | 49 | Finds an exponential regression that best approximates a set of data. The 50 | result will be an array [a, b], where y = a * e^(bx). 51 | 52 | | Name | Type | Default | Description | 53 | | --- | --- | --- | --- | 54 | | `data` | Array<Coordinate> | | | 55 | 56 | 57 |
58 | 59 |
60 | 61 |
regression.ts#L27
62 | 63 | ## linear (data: Array<Coordinate>, throughOrigin: boolean): Array<number> 64 | 65 | Finds a linear regression that best approximates a set of data. The result 66 | will be an array [c, m], where y = m * x + c. 67 | 68 | | Name | Type | Default | Description | 69 | | --- | --- | --- | --- | 70 | | `data` | Array<Coordinate> | | | 71 | | `throughOrigin` | boolean | false | | 72 | 73 | 74 |
75 | 76 |
77 | 78 |
regression.ts#L76
79 | 80 | ## logarithmic (data: Array<Coordinate>): Array<number> 81 | 82 | Finds a logarithmic regression that best approximates a set of data. The 83 | result will be an array [a, b], where y = a + b * log(x). 84 | 85 | | Name | Type | Default | Description | 86 | | --- | --- | --- | --- | 87 | | `data` | Array<Coordinate> | | | 88 | 89 | 90 |
91 | 92 |
93 | 94 |
regression.ts#L119
95 | 96 | ## polynomial (data: Array<Coordinate>, order: number): Array<number> 97 | 98 | Finds a polynomial regression of given `order` that best approximates a set 99 | of data. The result will be an array giving the coefficients of the 100 | resulting polynomial. 101 | 102 | | Name | Type | Default | Description | 103 | | --- | --- | --- | --- | 104 | | `data` | Array<Coordinate> | | | 105 | | `order` | number | 2 | | 106 | 107 | 108 |
109 | 110 |
111 | 112 |
regression.ts#L97
113 | 114 | ## power (data: Array<Coordinate>): Array<number> 115 | 116 | Finds a power regression that best approximates a set of data. The result 117 | will be an array [a, b], where y = a * x^b. 118 | 119 | | Name | Type | Default | Description | 120 | | --- | --- | --- | --- | 121 | | `data` | Array<Coordinate> | | | 122 | 123 | 124 |
-------------------------------------------------------------------------------- /boost/animate.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 2 4 | parent: Boost.js 5 | --- 6 | 7 | # Animate 8 | 9 |
10 | 11 |
animate.ts#L24
12 | 13 | ## Type alias AnimationCallback 14 | 15 |
16 | 17 |
18 | 19 |
animate.ts#L23
20 | 21 | ## Type alias AnimationCancel 22 | 23 |
24 | 25 |
26 | 27 |
animate.ts#L146
28 | 29 | ## Type alias AnimationProperties : Obj<AnimationValue|Array<AnimationValue>> 30 | 31 |
32 | 33 |
34 | 35 |
animate.ts#L25
36 | 37 | ## Type alias AnimationResponse 38 | 39 |
40 | 41 |
42 | 43 |
animate.ts#L27
44 | 45 | ## ResolvedAnimation 46 | 47 | Default value: `...` 48 | 49 |
50 | 51 |
52 | 53 |
animate.ts#L38
54 | 55 | ## animate (callback: AnimationCallback, duration: number): AnimationResponse 56 | 57 | Runs an animation. If no duration is provided, the animation will run 58 | indefinitely, and call `callback` with the time since start as first 59 | argument. If a duration is provided, the first callback argument is instead 60 | the proportion of the duration passed (between 0 and 1). The second callback 61 | argument is the time difference since the last animation frame, and the 62 | third callback argument is a `cancel()` function to stop the animation. 63 | 64 | | Name | Type | Default | Description | 65 | | --- | --- | --- | --- | 66 | | `callback` | AnimationCallback | | | 67 | | `duration` | number | | | 68 | 69 | 70 |
71 | 72 |
73 | 74 |
animate.ts#L130
75 | 76 | ## ease (type: string, t: number, s: number): number 77 | 78 | Applies an easing function to a number `t` between 0 and 1. Options include 79 | `quad`, `cubic`, `quart`, `quint`, `circ`, `sine`, `exp`, `back`, `elastic`, 80 | `swing`, `spring` and `bounce`, optionally followed by `-in` or `-out`. The 81 | `s` parameter is only used by `back` and `elastic` easing. 82 | 83 | | Name | Type | Default | Description | 84 | | --- | --- | --- | --- | 85 | | `type` | string | | | 86 | | `t` | number | 0 | | 87 | | `s` | number | 0 | | 88 | 89 | 90 |
91 | 92 |
93 | 94 |
animate.ts#L239
95 | 96 | ## enter ($el: ElementView, effect: string, duration: number, _delay: number): AnimationResponse 97 | 98 | | Name | Type | Default | Description | 99 | | --- | --- | --- | --- | 100 | | `$el` | ElementView | | | 101 | | `effect` | string | 'fade' | | 102 | | `duration` | number | 500 | | 103 | | `_delay` | number | 0 | | 104 | 105 | 106 |
107 | 108 |
109 | 110 |
animate.ts#L291
111 | 112 | ## exit ($el: ElementView, effect: string, duration: number, delay: number, remove: boolean): AnimationResponse 113 | 114 | | Name | Type | Default | Description | 115 | | --- | --- | --- | --- | 116 | | `$el` | ElementView | | | 117 | | `effect` | string | 'fade' | | 118 | | `duration` | number | 400 | | 119 | | `delay` | number | 0 | | 120 | | `remove` | boolean | false | | 121 | 122 | 123 |
124 | 125 |
126 | 127 |
animate.ts#L149
128 | 129 | ## transition ($el: ElementView, properties: AnimationProperties, duration: number, _delay: number, easing: string): AnimationResponse 130 | 131 | | Name | Type | Default | Description | 132 | | --- | --- | --- | --- | 133 | | `$el` | ElementView | | | 134 | | `properties` | AnimationProperties | | | 135 | | `duration` | number | 400 | | 136 | | `_delay` | number | 0 | | 137 | | `easing` | string | 'ease-in-out' | | 138 | 139 | 140 |
-------------------------------------------------------------------------------- /fermat/matrix.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 5 4 | parent: Fermat.js 5 | --- 6 | 7 | # Matrix 8 | 9 |
10 | 11 |
matrix.ts#L117
12 | 13 | ## determinant (M: Matrix): number 14 | 15 | Calculates the determinant of a matrix M. 16 | 17 | | Name | Type | Default | Description | 18 | | --- | --- | --- | --- | 19 | | `M` | Matrix | | | 20 | 21 | 22 |
23 | 24 |
25 | 26 |
matrix.ts#L17
27 | 28 | ## fill (value: number, x: number, y: number): Array<Array<number>> 29 | 30 | Fills a matrix of size x, y with a given value. 31 | 32 | | Name | Type | Default | Description | 33 | | --- | --- | --- | --- | 34 | | `value` | number | | | 35 | | `x` | number | | | 36 | | `y` | number | | | 37 | 38 | 39 |
40 | 41 |
42 | 43 |
matrix.ts#L22
44 | 45 | ## identity (n: number): Array<Array<number>> 46 | 47 | Returns the identity matrix of size n. 48 | 49 | | Name | Type | Default | Description | 50 | | --- | --- | --- | --- | 51 | | `n` | number | 2 | | 52 | 53 | 54 |
55 | 56 |
57 | 58 |
matrix.ts#L140
59 | 60 | ## inverse (M: Matrix): Array<Array<number>> 61 | 62 | Calculates the inverse of a matrix M. 63 | 64 | | Name | Type | Default | Description | 65 | | --- | --- | --- | --- | 66 | | `M` | Matrix | | | 67 | 68 | 69 |
70 | 71 |
72 | 73 |
matrix.ts#L74
74 | 75 | ## product (matrices: Array<Matrix>): Matrix 76 | 77 | Calculates the matrix product of multiple matrices. 78 | 79 | | Name | Type | Default | Description | 80 | | --- | --- | --- | --- | 81 | | `matrices` | Array<Matrix> | | | 82 | 83 | 84 |
85 | 86 |
87 | 88 |
matrix.ts#L38
89 | 90 | ## reflection (angle: number): Array<Array<number>> 91 | 92 | | Name | Type | Default | Description | 93 | | --- | --- | --- | --- | 94 | | `angle` | number | | | 95 | 96 | 97 |
98 | 99 |
100 | 101 |
matrix.ts#L28
102 | 103 | ## rotation (angle: number): Array<Array<number>> 104 | 105 | | Name | Type | Default | Description | 106 | | --- | --- | --- | --- | 107 | | `angle` | number | | | 108 | 109 | 110 |
111 | 112 |
113 | 114 |
matrix.ts#L69
115 | 116 | ## scalarProduct (M: Matrix, v: number): Array<Array<number>> 117 | 118 | Multiplies a matrix M by a scalar v. 119 | 120 | | Name | Type | Default | Description | 121 | | --- | --- | --- | --- | 122 | | `M` | Matrix | | | 123 | | `v` | number | | | 124 | 125 | 126 |
127 | 128 |
129 | 130 |
matrix.ts#L34
131 | 132 | ## shear (lambda: number): Array<Array<number>> 133 | 134 | | Name | Type | Default | Description | 135 | | --- | --- | --- | --- | 136 | | `lambda` | number | | | 137 | 138 | 139 |
140 | 141 |
142 | 143 |
matrix.ts#L49
144 | 145 | ## sum (matrices: Array<Matrix>): Matrix 146 | 147 | Calculates the sum of two or more matrices. 148 | 149 | | Name | Type | Default | Description | 150 | | --- | --- | --- | --- | 151 | | `matrices` | Array<Matrix> | | | 152 | 153 | 154 |
155 | 156 |
157 | 158 |
matrix.ts#L104
159 | 160 | ## transpose (M: Matrix): Array<Array<number>> 161 | 162 | Calculates the transpose of a matrix M. 163 | 164 | | Name | Type | Default | Description | 165 | | --- | --- | --- | --- | 166 | | `M` | Matrix | | | 167 | 168 | 169 |
-------------------------------------------------------------------------------- /boost/events.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 9 4 | parent: Boost.js 5 | --- 6 | 7 | # Events 8 | 9 |
10 | 11 |
events.ts#L30
12 | 13 | ## Type alias EventCallback 14 | 15 |
16 | 17 |
18 | 19 |
events.ts#L28
20 | 21 | ## Type alias ScreenEvent 22 | 23 |
24 | 25 |
26 | 27 |
events.ts#L29
28 | 29 | ## Type alias ScrollEvent 30 | 31 |
32 | 33 |
34 | 35 |
events.ts#L594
36 | 37 | ## bindEvent ($el: ElementView, event: string, fn: EventCallback, options: EventListenerOptions): void 38 | 39 | | Name | Type | Default | Description | 40 | | --- | --- | --- | --- | 41 | | `$el` | ElementView | | | 42 | | `event` | string | | | 43 | | `fn` | EventCallback | | | 44 | | `options` | EventListenerOptions | | | 45 | 46 | 47 |
48 | 49 |
50 | 51 |
events.ts#L63
52 | 53 | ## canvasPointerPosition (event: ScreenEvent, $canvas: CanvasView): Point 54 | 55 | Gets the pointer position from an event triggered on an `` element, 56 | in the coordinate system of the `` element. 57 | 58 | | Name | Type | Default | Description | 59 | | --- | --- | --- | --- | 60 | | `event` | ScreenEvent | | | 61 | | `$canvas` | CanvasView | | | 62 | 63 | 64 |
65 | 66 |
67 | 68 |
events.ts#L76
69 | 70 | ## getEventTarget (event: ScreenEvent): ElementView 71 | 72 | Get the target element for an event, including for touch/pointer events 73 | that started on a different element. 74 | 75 | | Name | Type | Default | Description | 76 | | --- | --- | --- | --- | 77 | | `event` | ScreenEvent | | | 78 | 79 | 80 |
81 | 82 |
83 | 84 |
events.ts#L345
85 | 86 | ## hover ($el: ElementView, options: HoverEventOptions): void 87 | 88 | | Name | Type | Default | Description | 89 | | --- | --- | --- | --- | 90 | | `$el` | ElementView | | | 91 | | `options` | HoverEventOptions | | | 92 | 93 | 94 |
95 | 96 |
97 | 98 |
events.ts#L254
99 | 100 | ## pointerOver ($el: ElementView, fns: OverEventOptions): void 101 | 102 | | Name | Type | Default | Description | 103 | | --- | --- | --- | --- | 104 | | `$el` | ElementView | | | 105 | | `fns` | OverEventOptions | | | 106 | 107 | 108 |
109 | 110 |
111 | 112 |
events.ts#L37
113 | 114 | ## pointerPosition (e: any): Point 115 | 116 | Gets the pointer position from an event. 117 | 118 | | Name | Type | Default | Description | 119 | | --- | --- | --- | --- | 120 | | `e` | any | | | 121 | 122 | 123 |
124 | 125 |
126 | 127 |
events.ts#L146
128 | 129 | ## slide ($el: ElementView, fns: SlideEventOptions): void 130 | 131 | | Name | Type | Default | Description | 132 | | --- | --- | --- | --- | 133 | | `$el` | ElementView | | | 134 | | `fns` | SlideEventOptions | | | 135 | 136 | 137 |
138 | 139 |
140 | 141 |
events.ts#L54
142 | 143 | ## svgPointerPosn (event: ScreenEvent, $svg: SVGParentView): Point 144 | 145 | Gets the pointer position from an event triggered on an `` element, in 146 | the coordinate system of the `` element. 147 | 148 | | Name | Type | Default | Description | 149 | | --- | --- | --- | --- | 150 | | `event` | ScreenEvent | | | 151 | | `$svg` | SVGParentView | | | 152 | 153 | 154 |
155 | 156 |
157 | 158 |
events.ts#L607
159 | 160 | ## unbindEvent ($el: ElementView, event: string, fn: EventCallback): void 161 | 162 | | Name | Type | Default | Description | 163 | | --- | --- | --- | --- | 164 | | `$el` | ElementView | | | 165 | | `event` | string | | | 166 | | `fn` | EventCallback | | | 167 | 168 | 169 |
-------------------------------------------------------------------------------- /euclid/bounds.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 4 4 | parent: Euclid.js 5 | --- 6 | 7 | # Bounds 8 | 9 |
10 | 11 |
bounds.ts#L12
12 | 13 | ## Class Bounds 14 | 15 |
16 | 17 | ### constructor (xMin: number, xMax: number, yMin: number, yMax: number, errorHandling: swap|center): Bounds 18 | 19 | Use the `errorHandling` option to decide how to deal with cases where the 20 | min and max values are in the wrong order. 21 | 22 | | Name | Type | Default | Description | 23 | | --- | --- | --- | --- | 24 | | `xMin` | number | | | 25 | | `xMax` | number | | | 26 | | `yMin` | number | | | 27 | | `yMax` | number | | | 28 | | `errorHandling` | swap|center | | | 29 | 30 | 31 |
32 | 33 |
34 | 35 | ### Property .xMax : number 36 | 37 |
38 | 39 |
40 | 41 | ### Property .xMin : number 42 | 43 |
44 | 45 |
46 | 47 | ### Property .yMax : number 48 | 49 |
50 | 51 |
52 | 53 | ### Property .yMin : number 54 | 55 |
56 | 57 |
58 | 59 |
bounds.ts#L69
60 | 61 | ### Accessor .center : Point 62 | 63 |
64 | 65 |
66 | 67 |
bounds.ts#L45
68 | 69 | ### Accessor .dx : number 70 | 71 |
72 | 73 |
74 | 75 |
bounds.ts#L49
76 | 77 | ### Accessor .dy : number 78 | 79 |
80 | 81 |
82 | 83 |
bounds.ts#L73
84 | 85 | ### Accessor .flip : Bounds 86 | 87 |
88 | 89 |
90 | 91 |
bounds.ts#L65
92 | 93 | ### Accessor .rect : Rectangle 94 | 95 |
96 | 97 |
98 | 99 |
bounds.ts#L53
100 | 101 | ### Accessor .xRange 102 | 103 |
104 | 105 |
106 | 107 |
bounds.ts#L57
108 | 109 | ### Accessor .yRange 110 | 111 |
112 | 113 |
114 | 115 |
bounds.ts#L29
116 | 117 | ### Method .contains (p: Point): boolean 118 | 119 | | Name | Type | Default | Description | 120 | | --- | --- | --- | --- | 121 | | `p` | Point | | | 122 | 123 | 124 |
125 | 126 |
127 | 128 |
bounds.ts#L33
129 | 130 | ### Method .containsX (p: Point): boolean 131 | 132 | | Name | Type | Default | Description | 133 | | --- | --- | --- | --- | 134 | | `p` | Point | | | 135 | 136 | 137 |
138 | 139 |
140 | 141 |
bounds.ts#L37
142 | 143 | ### Method .containsY (p: Point): boolean 144 | 145 | | Name | Type | Default | Description | 146 | | --- | --- | --- | --- | 147 | | `p` | Point | | | 148 | 149 | 150 |
151 | 152 |
153 | 154 |
bounds.ts#L61
155 | 156 | ### Method .extend (top: number, right: number, bottom: number, left: number): Bounds 157 | 158 | | Name | Type | Default | Description | 159 | | --- | --- | --- | --- | 160 | | `top` | number | | | 161 | | `right` | number | ... | | 162 | | `bottom` | number | ... | | 163 | | `left` | number | ... | | 164 | 165 | 166 |
167 | 168 |
169 | 170 |
bounds.ts#L41
171 | 172 | ### Method .resize (dx: number, dy: number): Bounds 173 | 174 | | Name | Type | Default | Description | 175 | | --- | --- | --- | --- | 176 | | `dx` | number | | | 177 | | `dy` | number | | | 178 | 179 | 180 |
181 | 182 |
-------------------------------------------------------------------------------- /euclid/types.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 15 4 | parent: Euclid.js 5 | --- 6 | 7 | # Types 8 | 9 |
10 | 11 |
types.ts#L66
12 | 13 | ## isAngle (shape: GeoElement): shape is Angle 14 | 15 | | Name | Type | Default | Description | 16 | | --- | --- | --- | --- | 17 | | `shape` | GeoElement | | | 18 | 19 | 20 |
21 | 22 |
23 | 24 |
types.ts#L58
25 | 26 | ## isArc (shape: GeoElement): shape is Arc 27 | 28 | | Name | Type | Default | Description | 29 | | --- | --- | --- | --- | 30 | | `shape` | GeoElement | | | 31 | 32 | 33 |
34 | 35 |
36 | 37 |
types.ts#L50
38 | 39 | ## isCircle (shape: GeoElement): shape is Circle 40 | 41 | | Name | Type | Default | Description | 42 | | --- | --- | --- | --- | 43 | | `shape` | GeoElement | | | 44 | 45 | 46 |
47 | 48 |
49 | 50 |
types.ts#L54
51 | 52 | ## isEllipse (shape: GeoElement): shape is Ellipse 53 | 54 | | Name | Type | Default | Description | 55 | | --- | --- | --- | --- | 56 | | `shape` | GeoElement | | | 57 | 58 | 59 |
60 | 61 |
62 | 63 |
types.ts#L38
64 | 65 | ## isLine (shape: GeoElement): shape is Line 66 | 67 | | Name | Type | Default | Description | 68 | | --- | --- | --- | --- | 69 | | `shape` | GeoElement | | | 70 | 71 | 72 |
73 | 74 |
75 | 76 |
types.ts#L34
77 | 78 | ## isLineLike (shape: GeoElement): shape is Line|Ray|Segment 79 | 80 | | Name | Type | Default | Description | 81 | | --- | --- | --- | --- | 82 | | `shape` | GeoElement | | | 83 | 84 | 85 |
86 | 87 |
88 | 89 |
types.ts#L70
90 | 91 | ## isPoint (shape: GeoElement): shape is Point 92 | 93 | | Name | Type | Default | Description | 94 | | --- | --- | --- | --- | 95 | | `shape` | GeoElement | | | 96 | 97 | 98 |
99 | 100 |
101 | 102 |
types.ts#L22
103 | 104 | ## isPolygon (shape: GeoElement): shape is Polygon 105 | 106 | | Name | Type | Default | Description | 107 | | --- | --- | --- | --- | 108 | | `shape` | GeoElement | | | 109 | 110 | 111 |
112 | 113 |
114 | 115 |
types.ts#L18
116 | 117 | ## isPolygonLike (shape: GeoElement): shape is Polygon|Rectangle 118 | 119 | | Name | Type | Default | Description | 120 | | --- | --- | --- | --- | 121 | | `shape` | GeoElement | | | 122 | 123 | 124 |
125 | 126 |
127 | 128 |
types.ts#L26
129 | 130 | ## isPolyline (shape: GeoElement): shape is Polyline 131 | 132 | | Name | Type | Default | Description | 133 | | --- | --- | --- | --- | 134 | | `shape` | GeoElement | | | 135 | 136 | 137 |
138 | 139 |
140 | 141 |
types.ts#L42
142 | 143 | ## isRay (shape: GeoElement): shape is Ray 144 | 145 | | Name | Type | Default | Description | 146 | | --- | --- | --- | --- | 147 | | `shape` | GeoElement | | | 148 | 149 | 150 |
151 | 152 |
153 | 154 |
types.ts#L30
155 | 156 | ## isRectangle (shape: GeoElement): shape is Rectangle 157 | 158 | | Name | Type | Default | Description | 159 | | --- | --- | --- | --- | 160 | | `shape` | GeoElement | | | 161 | 162 | 163 |
164 | 165 |
166 | 167 |
types.ts#L62
168 | 169 | ## isSector (shape: GeoElement): shape is Sector 170 | 171 | | Name | Type | Default | Description | 172 | | --- | --- | --- | --- | 173 | | `shape` | GeoElement | | | 174 | 175 | 176 |
177 | 178 |
179 | 180 |
types.ts#L46
181 | 182 | ## isSegment (shape: GeoElement): shape is Segment 183 | 184 | | Name | Type | Default | Description | 185 | | --- | --- | --- | --- | 186 | | `shape` | GeoElement | | | 187 | 188 | 189 |
-------------------------------------------------------------------------------- /studio/setup.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 1 4 | parent: Mathigon Studio 5 | --- 6 | 7 | # Setup and Customisation 8 | 9 | ## Introduction 10 | 11 | Start by creating a new repository and then install Mathigon Studio as a dependency using 12 | `npm install @mathigon/studio`. 13 | 14 | A usage example that shows many of the available customisation options is available in the 15 | [example/](example) directory. When copying the contents of this directory for use elsewhere, 16 | remember to replace `"@mathigon/studio": "file:../.."` in `package.json` with the latest version 17 | of the `@mathigon/studio` module on NPM. 18 | 19 | ## The NodeJS Server 20 | 21 | First, you need to create a TypeScript entrypoint file for the NodeJS server, for example 22 | `server/app.ts`. This file will allow you to set up and configure the server and add any plugins, 23 | extensions or customisations required: 24 | 25 | ```ts 26 | import {MathigonStudioApp} from '@mathigon/studio/server/app'; 27 | 28 | const studio = new MathigonStudioApp() 29 | .setup({sessionSecret: 'archimedes'}) // Setup Express App 30 | .get('/', (req, res) => res.render('home.pug')) // Custom routes 31 | .get('/courses', (req, res) => res.render('courses.pug')) 32 | .course({}) // Bind and configure course endpoints 33 | .errors() // The error routes have to be created last 34 | .listen(8080); // Dev port can be overridden by process.env.PORT 35 | ``` 36 | 37 | Internally, `MathigonStudioApp()` creates an [Express server](https://expressjs.com/). You can 38 | extend this server directly by accessing `studio.app()`. The functions `studio.get()` and 39 | `studio.post()` are wrappers around the native Express handlers that catch any rejected Promises 40 | or async functions and show an error page. 41 | 42 | Notice how the example above creates two custom endpoints, `/` and `/courses`. Their PUG templates 43 | are located in the `server/templates` directory. 44 | 45 | ## Customisation Options 46 | 47 | The `config.yaml` file at the root of your repository can be used to customise and configure the 48 | behaviour of your server. Take a look at [server/interfaces.ts](../server/interfaces.ts#L92) for a 49 | detailed schema of which options are supported. 50 | 51 | TODO: Write more docs for each option. 52 | 53 | ## Static Assets 54 | 55 | In the `frontend/` directory, you can add any custom styles, scripts or assets that you want to 56 | expose to users. Any files in `frontend/assets/` will directly be publicly available. Any top 57 | level `.ts` and `.scss` will be automatically compiled into separate `.js` and and `.css` files 58 | with the same name. 59 | 60 | You can use the `frontend/` directory to overwrite any files in the corresponding 61 | `node_modules/@mathigon/studio/frontend/` directory – for example, to add your own `favicon.ico` 62 | file or to overwrite the `course.ts` script. 63 | 64 | The `frontend/assets/icons/` subdirectory can contain custom `.svg` icons that will get bundled 65 | into a single `/icons.svg` file with symbols and can be used using the `x-icon(name="...")` 66 | custom webcomponent. The `name=` attribute corresponds to the original filename of the icon. 67 | 68 | _Note: We are working on additional customisation options, including providing custom partials for 69 | the PUG templates._ 70 | 71 | ## Add Content 72 | 73 | Now you can start writing your first courses. Every course is located in a subdirectory of 74 | `content/`, but you can customise this path using the `contentDir` property in `config.yaml`. 75 | Once compiled, the course at `content/courseid/` will be available at the URL `/course/courseid`. 76 | 77 | Every course must contain a `content.md` markdown file with the text, subsections and metadata. 78 | [Learn more](markdown.md) about the syntax for these files. You should also include a `styles.scss` 79 | file and a `functions.ts` file for custom styles or interactivity. You can also add images for 80 | courses, as well as `glossary.yaml`, `bios.yaml` and `hints.yaml` files with additional data. 81 | 82 | The `shared/` directory can contain corresponding `.yaml` files that are shared across all courses, 83 | as well as other shared TypeScript components or styles. You cannot have a course with the ID 84 | `shared/`. 85 | 86 | ## Scripts 87 | 88 | To start a server, you can simply run `ts-node server/app.ts`, with your server entry file. You 89 | can also use tools like [Nodemon](https://nodemon.io/) to automatically restart your server when 90 | files change. 91 | 92 | However, first you need to build the courses, static assets, and other dependencies. For this, 93 | Mathigon Studio exposes the `mgon-build` CLI that can be called using `npm run` or `npx`. Here are 94 | some of the supported options: 95 | 96 | * `--assets` builds all courses, SCSS styles, TS scripts and SVG icons. You can optionally add 97 | `--minify` to also minify all assets and `--watch` to continue watching all files for changes. 98 | * `--search` generates the search index for all courses. You need to set `search.enabled` in 99 | `config.yaml`, where you can further customise the search behaviour. 100 | * `--thumbnails` generates preview images for all courses. These are shown, for example, on social 101 | media sites like Twitter when sharing a link. 102 | * `--translate` generate translations for all UI strings referenced using `__()` in templates. 103 | 104 | The [package.json](example/package.json) file in the example directory show how best to use and 105 | combine all these scripts: 106 | 107 | | Production | Development | 108 | | ----------------------------------------- | -------------------------------------- | 109 | | 1. Build the website: `npm run build` | 1. Start a local server: `npm run dev` | 110 | | 2. Deploy to your server host (e.g. AWS) | 2. The server will automatically watch for changes to files and recompile. | 111 | | 3. Start a production server: `npm start` | | 112 | 113 | Finally, you can run `mgon-screenshots --output screenshots` to generate screenshots for all pages 114 | in your app and write them to a new directory. This requires a server running in the background, 115 | and can be useful for screen-diffing any changes. 116 | 117 | ## Translations 118 | 119 | TODO: Write docs for translations 120 | -------------------------------------------------------------------------------- /core/utilities.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 8 4 | parent: Core.js 5 | --- 6 | 7 | # Utilities 8 | 9 |
10 | 11 |
utilities.ts#L8
12 | 13 | ## Type alias Obj 14 | 15 | Object Map Interface. 16 | 17 |
18 | 19 |
20 | 21 |
utilities.ts#L94
22 | 23 | ## cache (fn: (args: Args): T): (args: Args): NonNullable<T> 24 | 25 | Function wrapper that modifies a function to cache its return values. This 26 | is useful for performance intensive functions which are called repeatedly 27 | with the same arguments. However it can reduce performance for functions 28 | which are always called with different arguments. Note that argument 29 | comparison does not work with Objects or nested arrays. 30 | 31 | | Name | Type | Default | Description | 32 | | --- | --- | --- | --- | 33 | | `fn` | (args: Args): T | | | 34 | 35 | 36 |
37 | 38 |
39 | 40 |
utilities.ts#L33
41 | 42 | ## deepExtend (obj1: any, obj2: any, arrayMergeFn: (a: Array<unknown>, b: Array<unknown>): Array<unknown>): void 43 | 44 | Deep extends obj1 with obj2, using a custom array merge function. 45 | 46 | | Name | Type | Default | Description | 47 | | --- | --- | --- | --- | 48 | | `obj1` | any | | | 49 | | `obj2` | any | | | 50 | | `arrayMergeFn` | (a: Array<unknown>, b: Array<unknown>): Array<unknown> | ... | | 51 | 52 | 53 |
54 | 55 |
56 | 57 |
utilities.ts#L65
58 | 59 | ## defer (): {promise: Promise<T>, reject: (reason: unknown): void, resolve: (value: T|PromiseLike<T>): void} 60 | 61 | Creates a new promise together with functions to resolve or reject. 62 | 63 |
64 | 65 |
66 | 67 |
utilities.ts#L48
68 | 69 | ## delay (fn: (): void, t: number): number 70 | 71 | Replacement for setTimeout() that is synchronous for time 0. 72 | 73 | | Name | Type | Default | Description | 74 | | --- | --- | --- | --- | 75 | | `fn` | (): void | | | 76 | | `t` | number | 0 | | 77 | 78 | 79 |
80 | 81 |
82 | 83 |
utilities.ts#L25
84 | 85 | ## isOneOf (x: T, values: Array<T>): boolean 86 | 87 | Checks if x is strictly equal to any one of the following arguments. 88 | 89 | | Name | Type | Default | Description | 90 | | --- | --- | --- | --- | 91 | | `x` | T | | | 92 | | `values` | Array<T> | | | 93 | 94 | 95 |
96 | 97 |
98 | 99 |
utilities.ts#L18
100 | 101 | ## run (val: T|(args: Array<S>): T, args: Array<S>): T 102 | 103 | Executes a function or returns the default value. 104 | 105 | | Name | Type | Default | Description | 106 | | --- | --- | --- | --- | 107 | | `val` | T|(args: Array<S>): T | | | 108 | | `args` | Array<S> | | | 109 | 110 | 111 |
112 | 113 |
114 | 115 |
utilities.ts#L151
116 | 117 | ## safeToJSON (str: |string, fallback: T, allowedKeys: Array<string>): undefined|T 118 | 119 | Safe wrapper for JSON.parse. 120 | 121 | | Name | Type | Default | Description | 122 | | --- | --- | --- | --- | 123 | | `str` | |string | | | 124 | | `fallback` | T | | | 125 | | `allowedKeys` | Array<string> | | | 126 | 127 | 128 |
129 | 130 |
131 | 132 |
utilities.ts#L119
133 | 134 | ## throttle (fn: (args: Args): void, t: number, forceDelay: boolean): (args: Args): void 135 | 136 | Function wrapper that prevents a function from being executed more than once 137 | every t ms. This is particularly useful for optimising callbacks for 138 | continues events like scroll, resize or slider move. Setting `forceDelay` 139 | to `true` means that even the first function call is after the minimum 140 | timout, rather than instantly. 141 | 142 | | Name | Type | Default | Description | 143 | | --- | --- | --- | --- | 144 | | `fn` | (args: Args): void | | | 145 | | `t` | number | 0 | | 146 | | `forceDelay` | boolean | false | | 147 | 148 | 149 |
150 | 151 |
152 | 153 |
utilities.ts#L12
154 | 155 | ## uid (n: number): string 156 | 157 | Creates a random UID string of a given length. 158 | 159 | | Name | Type | Default | Description | 160 | | --- | --- | --- | --- | 161 | | `n` | number | 10 | | 162 | 163 | 164 |
165 | 166 |
167 | 168 |
utilities.ts#L59
169 | 170 | ## wait (t: number): Promise<void> 171 | 172 | Returns a promise that resolves after a fixed time. 173 | 174 | | Name | Type | Default | Description | 175 | | --- | --- | --- | --- | 176 | | `t` | number | | | 177 | 178 | 179 |
-------------------------------------------------------------------------------- /fermat/complex.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 3 4 | parent: Fermat.js 5 | --- 6 | 7 | # Complex 8 | 9 |
10 | 11 |
complex.ts#L18
12 | 13 | ## Class Complex 14 | 15 | Complex number class. 16 | 17 |
18 | 19 | ### constructor (re: number, im: number): Complex 20 | 21 | | Name | Type | Default | Description | 22 | | --- | --- | --- | --- | 23 | | `re` | number | 0 | | 24 | | `im` | number | 0 | | 25 | 26 | 27 |
28 | 29 |
30 | 31 | ### Property .im : number 32 | 33 | Default value: `0` 34 | 35 |
36 | 37 |
38 | 39 | ### Property .re : number 40 | 41 | Default value: `0` 42 | 43 |
44 | 45 |
46 | 47 |
complex.ts#L26
48 | 49 | ### Accessor .argument : number 50 | 51 |
52 | 53 |
54 | 55 |
complex.ts#L30
56 | 57 | ### Accessor .conjugate : Complex 58 | 59 |
60 | 61 |
62 | 63 |
complex.ts#L22
64 | 65 | ### Accessor .modulus : number 66 | 67 |
68 | 69 |
70 | 71 |
complex.ts#L52
72 | 73 | ### Method .add (a: number|Complex): Complex 74 | 75 | | Name | Type | Default | Description | 76 | | --- | --- | --- | --- | 77 | | `a` | number|Complex | | | 78 | 79 | 80 |
81 | 82 |
83 | 84 |
complex.ts#L64
85 | 86 | ### Method .divide (a: number|Complex): Complex 87 | 88 | | Name | Type | Default | Description | 89 | | --- | --- | --- | --- | 90 | | `a` | number|Complex | | | 91 | 92 | 93 |
94 | 95 |
96 | 97 |
complex.ts#L60
98 | 99 | ### Method .multiply (a: number|Complex): Complex 100 | 101 | | Name | Type | Default | Description | 102 | | --- | --- | --- | --- | 103 | | `a` | number|Complex | | | 104 | 105 | 106 |
107 | 108 |
109 | 110 |
complex.ts#L35
111 | 112 | ### Method .root (n: number, i: number): Complex 113 | 114 | Returns the ith nth-root of this complex number. 115 | 116 | | Name | Type | Default | Description | 117 | | --- | --- | --- | --- | 118 | | `n` | number | | | 119 | | `i` | number | 0 | | 120 | 121 | 122 |
123 | 124 |
125 | 126 |
complex.ts#L56
127 | 128 | ### Method .subtract (a: number|Complex): Complex 129 | 130 | | Name | Type | Default | Description | 131 | | --- | --- | --- | --- | 132 | | `a` | number|Complex | | | 133 | 134 | 135 |
136 | 137 |
138 | 139 |
complex.ts#L41
140 | 141 | ### Method .toString (precision: number): string 142 | 143 | | Name | Type | Default | Description | 144 | | --- | --- | --- | --- | 145 | | `precision` | number | 2 | | 146 | 147 | 148 |
149 | 150 |
151 | 152 |
complex.ts#L77
153 | 154 | ### static Method .difference (c1: number|Complex, c2: number|Complex): Complex 155 | 156 | Calculates the difference of two complex numbers c1 and c2. 157 | 158 | | Name | Type | Default | Description | 159 | | --- | --- | --- | --- | 160 | | `c1` | number|Complex | | | 161 | | `c2` | number|Complex | | | 162 | 163 | 164 |
165 | 166 |
167 | 168 |
complex.ts#L111
169 | 170 | ### static Method .exp (c: number|Complex): Complex 171 | 172 | Calculates e^c for a complex number c. 173 | 174 | | Name | Type | Default | Description | 175 | | --- | --- | --- | --- | 176 | | `c` | number|Complex | | | 177 | 178 | 179 |
180 | 181 |
182 | 183 |
complex.ts#L85
184 | 185 | ### static Method .product (c1: number|Complex, c2: number|Complex): Complex 186 | 187 | Calculates the product of two complex numbers c1 and c2. 188 | 189 | | Name | Type | Default | Description | 190 | | --- | --- | --- | --- | 191 | | `c1` | number|Complex | | | 192 | | `c2` | number|Complex | | | 193 | 194 | 195 |
196 | 197 |
198 | 199 |
complex.ts#L95
200 | 201 | ### static Method .quotient (c1: number|Complex, c2: number|Complex): Complex 202 | 203 | Calculates the quotient of two complex numbers c1 and c2. 204 | 205 | | Name | Type | Default | Description | 206 | | --- | --- | --- | --- | 207 | | `c1` | number|Complex | | | 208 | | `c2` | number|Complex | | | 209 | 210 | 211 |
212 | 213 |
214 | 215 |
complex.ts#L69
216 | 217 | ### static Method .sum (c1: number|Complex, c2: number|Complex): Complex 218 | 219 | Calculates the sum of two complex numbers c1 and c2. 220 | 221 | | Name | Type | Default | Description | 222 | | --- | --- | --- | --- | 223 | | `c1` | number|Complex | | | 224 | | `c2` | number|Complex | | | 225 | 226 | 227 |
228 | 229 |
-------------------------------------------------------------------------------- /fermat/random.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 7 4 | parent: Fermat.js 5 | --- 6 | 7 | # Random 8 | 9 |
10 | 11 |
random.ts#L68
12 | 13 | ## bernoulli (p: number): 0|1 14 | 15 | Generates a Bernoulli random variable. 16 | 17 | | Name | Type | Default | Description | 18 | | --- | --- | --- | --- | 19 | | `p` | number | 0.5 | | 20 | 21 | 22 |
23 | 24 |
25 | 26 |
random.ts#L73
27 | 28 | ## binomial (n: number, p: number): number 29 | 30 | Generates a Binomial random variable. 31 | 32 | | Name | Type | Default | Description | 33 | | --- | --- | --- | --- | 34 | | `n` | number | 1 | | 35 | | `p` | number | 0.5 | | 36 | 37 | 38 |
39 | 40 |
41 | 42 |
random.ts#L115
43 | 44 | ## cauchy (): number 45 | 46 | Generates an Cauchy random variable. 47 | 48 |
49 | 50 |
51 | 52 |
random.ts#L168
53 | 54 | ## chiCDF (chi: number, deg: number): number 55 | 56 | The chi CDF function. 57 | 58 | | Name | Type | Default | Description | 59 | | --- | --- | --- | --- | 60 | | `chi` | number | | | 61 | | `deg` | number | | | 62 | 63 | 64 |
65 | 66 |
67 | 68 |
random.ts#L104
69 | 70 | ## exponential (l: number): number 71 | 72 | Generates an exponential random variable. 73 | 74 | | Name | Type | Default | Description | 75 | | --- | --- | --- | --- | 76 | | `l` | number | 1 | | 77 | 78 | 79 |
80 | 81 |
82 | 83 |
random.ts#L36
84 | 85 | ## find (items: Array<T>): T 86 | 87 | Randomly selects an element from an array. 88 | 89 | | Name | Type | Default | Description | 90 | | --- | --- | --- | --- | 91 | | `items` | Array<T> | | | 92 | 93 | 94 |
95 | 96 |
97 | 98 |
random.ts#L109
99 | 100 | ## geometric (p: number): undefined|number 101 | 102 | Generates a geometric random variable. 103 | 104 | | Name | Type | Default | Description | 105 | | --- | --- | --- | --- | 106 | | `p` | number | 0.5 | | 107 | 108 | 109 |
110 | 111 |
112 | 113 |
random.ts#L21
114 | 115 | ## integer (a: number, b: number): number 116 | 117 | Generates a random integer between 0 and a, or between a and b. 118 | 119 | | Name | Type | Default | Description | 120 | | --- | --- | --- | --- | 121 | | `a` | number | | | 122 | | `b` | number | | | 123 | 124 | 125 |
126 | 127 |
128 | 129 |
random.ts#L159
130 | 131 | ## integrate (fn: (x: number): number, xMin: number, xMax: number, dx: number): number 132 | 133 | Riemann-integrates fn(x) from xMin to xMax with an interval size dx. 134 | 135 | | Name | Type | Default | Description | 136 | | --- | --- | --- | --- | 137 | | `fn` | (x: number): number | | | 138 | | `xMin` | number | | | 139 | | `xMax` | number | | | 140 | | `dx` | number | 1 | | 141 | 142 | 143 |
144 | 145 |
146 | 147 |
random.ts#L96
148 | 149 | ## normal (m: number, v: number): number 150 | 151 | Generates a normal random variable with mean m and variance v. 152 | 153 | | Name | Type | Default | Description | 154 | | --- | --- | --- | --- | 155 | | `m` | number | 0 | | 156 | | `v` | number | 1 | | 157 | 158 | 159 |
160 | 161 |
162 | 163 |
random.ts#L130
164 | 165 | ## normalPDF (x: number, m: number, v: number): number 166 | 167 | Generates pdf(x) for the normal distribution with mean m and variance v. 168 | 169 | | Name | Type | Default | Description | 170 | | --- | --- | --- | --- | 171 | | `x` | number | | | 172 | | `m` | number | 1 | | 173 | | `v` | number | 0 | | 174 | 175 | 176 |
177 | 178 |
179 | 180 |
random.ts#L80
181 | 182 | ## poisson (l: number): number 183 | 184 | Generates a Poisson random variable. 185 | 186 | | Name | Type | Default | Description | 187 | | --- | --- | --- | --- | 188 | | `l` | number | 1 | | 189 | 190 | 191 |
192 | 193 |
194 | 195 |
random.ts#L11
196 | 197 | ## shuffle (a: Array<T>): Array<T> 198 | 199 | Randomly shuffles the elements in an array a. 200 | 201 | | Name | Type | Default | Description | 202 | | --- | --- | --- | --- | 203 | | `a` | Array<T> | | | 204 | 205 | 206 |
207 | 208 |
209 | 210 |
random.ts#L50
211 | 212 | ## smart (n: number, id: string): number 213 | 214 | Returns a random number between 0 and n, but avoids returning the same 215 | number multiple times in a row. 216 | 217 | | Name | Type | Default | Description | 218 | | --- | --- | --- | --- | 219 | | `n` | number | | | 220 | | `id` | string | | | 221 | 222 | 223 |
224 | 225 |
226 | 227 |
random.ts#L91
228 | 229 | ## uniform (a: number, b: number): number 230 | 231 | Generates a uniform random variable. 232 | 233 | | Name | Type | Default | Description | 234 | | --- | --- | --- | --- | 235 | | `a` | number | 0 | | 236 | | `b` | number | 1 | | 237 | 238 | 239 |
240 | 241 |
242 | 243 |
random.ts#L28
244 | 245 | ## weighted (weights: Array<number>): number 246 | 247 | Chooses a random index value from weights [2, 5, 3] 248 | 249 | | Name | Type | Default | Description | 250 | | --- | --- | --- | --- | 251 | | `weights` | Array<number> | | | 252 | 253 | 254 |
-------------------------------------------------------------------------------- /boost/draggable.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 6 4 | parent: Boost.js 5 | --- 6 | 7 | # Draggable 8 | 9 |
10 | 11 |
boost.js/src/draggable.ts#L51
12 | 13 | ## Class Draggable 14 | 15 | A draggable and droppable HTML element. 16 | 17 | Extends EventTarget 18 | 19 |
20 | 21 | ### constructor ($el: ElementView, options: DraggableOptions): Draggable 22 | 23 | | Name | Type | Default | Description | 24 | | --- | --- | --- | --- | 25 | | `$el` | ElementView | | | 26 | | `options` | DraggableOptions | ... | | 27 | 28 | 29 |
30 | 31 |
32 | 33 | ### readonly Property .$el : ElementView 34 | 35 |
36 | 37 |
38 | 39 |
boost.js/src/draggable.ts#L54
40 | 41 | ### Property .$over 42 | 43 |
44 | 45 |
46 | 47 |
boost.js/src/draggable.ts#L57
48 | 49 | ### Property .bounds 50 | 51 |
52 | 53 |
54 | 55 |
boost.js/src/draggable.ts#L56
56 | 57 | ### Property .disabled : boolean 58 | 59 | Default value: `false` 60 | 61 |
62 | 63 |
64 | 65 |
boost.js/src/draggable.ts#L52
66 | 67 | ### Property .options : DraggableOptions 68 | 69 |
70 | 71 |
72 | 73 |
boost.js/src/draggable.ts#L55
74 | 75 | ### Property .position : Point 76 | 77 | Default value: `...` 78 | 79 |
80 | 81 |
82 | 83 |
boost.js/src/draggable.ts#L53
84 | 85 | ### Property .startPos : Point 86 | 87 | Default value: `...` 88 | 89 |
90 | 91 |
92 | 93 |
boost.js/src/draggable.ts#L94
94 | 95 | ### Method .addTarget ($target: ElementView): void 96 | 97 | | Name | Type | Default | Description | 98 | | --- | --- | --- | --- | 99 | | `$target` | ElementView | | | 100 | 101 | 102 |
103 | 104 |
105 | 106 |
boost.js/src/draggable.ts#L104
107 | 108 | ### Method .checkTarget (posn: Point): void 109 | 110 | | Name | Type | Default | Description | 111 | | --- | --- | --- | --- | 112 | | `posn` | Point | | | 113 | 114 | 115 |
116 | 117 |
118 | 119 |
core.js/dist/events.d.ts#L10
120 | 121 | ### Method .off (events: string, fn: EventCallback): void 122 | 123 | Removes an event listener from one or more events. 124 | 125 | | Name | Type | Default | Description | 126 | | --- | --- | --- | --- | 127 | | `events` | string | | | 128 | | `fn` | EventCallback | | | 129 | 130 | 131 |
132 | 133 |
134 | 135 |
core.js/dist/events.d.ts#L6
136 | 137 | ### Method .on (events: string, fn: EventCallback): void 138 | 139 | Adds an event listener for one or more events. 140 | 141 | | Name | Type | Default | Description | 142 | | --- | --- | --- | --- | 143 | | `events` | string | | | 144 | | `fn` | EventCallback | | | 145 | 146 | 147 |
148 | 149 |
150 | 151 |
core.js/dist/events.d.ts#L8
152 | 153 | ### Method .one (events: string, fn: EventCallback): void 154 | 155 | Adds a one-time event listener to one or more events. 156 | 157 | | Name | Type | Default | Description | 158 | | --- | --- | --- | --- | 159 | | `events` | string | | | 160 | | `fn` | EventCallback | | | 161 | 162 | 163 |
164 | 165 |
166 | 167 |
boost.js/src/draggable.ts#L99
168 | 169 | ### Method .removeTarget ($target: ElementView): void 170 | 171 | | Name | Type | Default | Description | 172 | | --- | --- | --- | --- | 173 | | `$target` | ElementView | | | 174 | 175 | 176 |
177 | 178 |
179 | 180 |
boost.js/src/draggable.ts#L161
181 | 182 | ### Method .resetPosition (duration: number): Promise<void> 183 | 184 | | Name | Type | Default | Description | 185 | | --- | --- | --- | --- | 186 | | `duration` | number | 250 | | 187 | 188 | 189 |
190 | 191 |
192 | 193 |
boost.js/src/draggable.ts#L142
194 | 195 | ### Method .setPosition (x: number, y: number): void 196 | 197 | Sets the position of the element. 198 | 199 | | Name | Type | Default | Description | 200 | | --- | --- | --- | --- | 201 | | `x` | number | | | 202 | | `y` | number | | | 203 | 204 | 205 |
206 | 207 |
208 | 209 |
core.js/dist/events.d.ts#L12
210 | 211 | ### Method .trigger (events: string, arg: unknown): void 212 | 213 | Triggers one or more events, and executes all bound event listeners. 214 | 215 | | Name | Type | Default | Description | 216 | | --- | --- | --- | --- | 217 | | `events` | string | | | 218 | | `arg` | unknown | | | 219 | 220 | 221 |
222 | 223 |
224 | 225 |
boost.js/src/draggable.ts#L120
226 | 227 | ### Method .updateBounds (): undefined|Bounds 228 | 229 |
230 | 231 |
232 | -------------------------------------------------------------------------------- /euclid/utilities.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 16 4 | parent: Euclid.js 5 | --- 6 | 7 | # Utilities 8 | 9 |
10 | 11 |
utilities.ts#L16
12 | 13 | ## Interface GeoElement 14 | 15 |
16 | 17 |
utilities.ts#L17
18 | 19 | ### Property .type : string 20 | 21 |
22 | 23 |
24 | 25 | ### Method .equals (other: GeoElement, tolerance: number, oriented: boolean): boolean 26 | 27 | | Name | Type | Default | Description | 28 | | --- | --- | --- | --- | 29 | | `other` | GeoElement | | | 30 | | `tolerance` | number | | | 31 | | `oriented` | boolean | | | 32 | 33 | 34 |
35 | 36 |
37 | 38 | ### Method .reflect (l: Line): GeoElement 39 | 40 | | Name | Type | Default | Description | 41 | | --- | --- | --- | --- | 42 | | `l` | Line | | | 43 | 44 | 45 |
46 | 47 |
48 | 49 | ### Method .rotate (angle: number, center: SimplePoint): GeoElement 50 | 51 | | Name | Type | Default | Description | 52 | | --- | --- | --- | --- | 53 | | `angle` | number | | | 54 | | `center` | SimplePoint | | | 55 | 56 | 57 |
58 | 59 |
60 | 61 | ### Method .scale (sx: number, sy: number): GeoElement 62 | 63 | | Name | Type | Default | Description | 64 | | --- | --- | --- | --- | 65 | | `sx` | number | | | 66 | | `sy` | number | | | 67 | 68 | 69 |
70 | 71 |
72 | 73 | ### Method .shift (x: number, y: number): GeoElement 74 | 75 | | Name | Type | Default | Description | 76 | | --- | --- | --- | --- | 77 | | `x` | number | | | 78 | | `y` | number | | | 79 | 80 | 81 |
82 | 83 |
84 | 85 | ### Method .toString (): string 86 | 87 |
88 | 89 |
90 | 91 | ### Method .transform (matrix: TransformMatrix): GeoElement 92 | 93 | | Name | Type | Default | Description | 94 | | --- | --- | --- | --- | 95 | | `matrix` | TransformMatrix | | | 96 | 97 | 98 |
99 | 100 |
101 | 102 | ### Method .translate (p: Point): GeoElement 103 | 104 | | Name | Type | Default | Description | 105 | | --- | --- | --- | --- | 106 | | `p` | Point | | | 107 | 108 | 109 |
110 | 111 |
112 | 113 |
114 | 115 |
utilities.ts#L28
116 | 117 | ## Interface GeoShape 118 | 119 | Extends GeoElement 120 | 121 |
122 | 123 | ### Method .at (t: number): Point 124 | 125 | | Name | Type | Default | Description | 126 | | --- | --- | --- | --- | 127 | | `t` | number | | | 128 | 129 | 130 |
131 | 132 |
133 | 134 | ### Method .contains (p: Point, tolerance: number): boolean 135 | 136 | | Name | Type | Default | Description | 137 | | --- | --- | --- | --- | 138 | | `p` | Point | | | 139 | | `tolerance` | number | | | 140 | 141 | 142 |
143 | 144 |
145 | 146 | ### Method .offset (p: Point): number 147 | 148 | | Name | Type | Default | Description | 149 | | --- | --- | --- | --- | 150 | | `p` | Point | | | 151 | 152 | 153 |
154 | 155 |
156 | 157 | ### Method .project (p: Point): Point 158 | 159 | | Name | Type | Default | Description | 160 | | --- | --- | --- | --- | 161 | | `p` | Point | | | 162 | 163 | 164 |
165 | 166 |
167 | 168 | ### Method .reflect (l: Line): GeoShape 169 | 170 | | Name | Type | Default | Description | 171 | | --- | --- | --- | --- | 172 | | `l` | Line | | | 173 | 174 | 175 |
176 | 177 |
178 | 179 | ### Method .rotate (angle: number, center: SimplePoint): GeoShape 180 | 181 | | Name | Type | Default | Description | 182 | | --- | --- | --- | --- | 183 | | `angle` | number | | | 184 | | `center` | SimplePoint | | | 185 | 186 | 187 |
188 | 189 |
190 | 191 | ### Method .scale (sx: number, sy: number): GeoShape 192 | 193 | | Name | Type | Default | Description | 194 | | --- | --- | --- | --- | 195 | | `sx` | number | | | 196 | | `sy` | number | | | 197 | 198 | 199 |
200 | 201 |
202 | 203 | ### Method .shift (x: number, y: number): GeoShape 204 | 205 | | Name | Type | Default | Description | 206 | | --- | --- | --- | --- | 207 | | `x` | number | | | 208 | | `y` | number | | | 209 | 210 | 211 |
212 | 213 |
214 | 215 | ### Method .translate (p: SimplePoint): GeoShape 216 | 217 | | Name | Type | Default | Description | 218 | | --- | --- | --- | --- | 219 | | `p` | SimplePoint | | | 220 | 221 | 222 |
223 | 224 |
225 | 226 |
227 | 228 |
utilities.ts#L14
229 | 230 | ## Type alias SimplePoint 231 | 232 |
233 | 234 |
235 | 236 |
utilities.ts#L12
237 | 238 | ## Type alias TransformMatrix 239 | 240 |
241 | 242 |
243 | 244 |
utilities.ts#L41
245 | 246 | ## TWO_PI : number 247 | 248 | Default value: `...` 249 | 250 |
251 | 252 |
253 | 254 |
utilities.ts#L49
255 | 256 | ## findClosest (p: Point, items: Array<GeoShape>): undefined|[Point, number] 257 | 258 | | Name | Type | Default | Description | 259 | | --- | --- | --- | --- | 260 | | `p` | Point | | | 261 | | `items` | Array<GeoShape> | | | 262 | 263 | 264 |
265 | 266 |
267 | 268 |
utilities.ts#L43
269 | 270 | ## rad (p: SimplePoint, c: SimplePoint): number 271 | 272 | | Name | Type | Default | Description | 273 | | --- | --- | --- | --- | 274 | | `p` | SimplePoint | | | 275 | | `c` | SimplePoint | | | 276 | 277 | 278 |
-------------------------------------------------------------------------------- /core/iterable.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 6 4 | parent: Core.js 5 | --- 6 | 7 | # Iterable 8 | 9 |
10 | 11 |
iterable.ts#L68
12 | 13 | ## Class Itarray 14 | 15 | Implements Iterable<T> 16 | 17 |
18 | 19 | ### constructor (values: Array<Iterable<T>>): Itarray<T> 20 | 21 | | Name | Type | Default | Description | 22 | | --- | --- | --- | --- | 23 | | `values` | Array<Iterable<T>> | | | 24 | 25 | 26 |
27 | 28 |
29 | 30 |
iterable.ts#L69
31 | 32 | ### readonly Property .values 33 | 34 |
35 | 36 |
37 | 38 |
iterable.ts#L141
39 | 40 | ### Method .[Symbol.iterator] (): Generator<T, void, unknown> 41 | 42 |
43 | 44 |
45 | 46 |
iterable.ts#L137
47 | 48 | ### Method .concat (newValues: Iterable<T>): void 49 | 50 | | Name | Type | Default | Description | 51 | | --- | --- | --- | --- | 52 | | `newValues` | Iterable<T> | | | 53 | 54 | 55 |
56 | 57 |
58 | 59 |
iterable.ts#L88
60 | 61 | ### Method .every (fn: (t: T, i: number): boolean): boolean 62 | 63 | | Name | Type | Default | Description | 64 | | --- | --- | --- | --- | 65 | | `fn` | (t: T, i: number): boolean | | | 66 | 67 | 68 |
69 | 70 |
71 | 72 |
iterable.ts#L124
73 | 74 | ### Method .filter (fn: (t: T, i: number): unknown): Itarray<T> 75 | 76 | | Name | Type | Default | Description | 77 | | --- | --- | --- | --- | 78 | | `fn` | (t: T, i: number): unknown | | | 79 | 80 | 81 |
82 | 83 |
84 | 85 |
iterable.ts#L75
86 | 87 | ### Method .map (fn: (t: T, i: number): S): Itarray<S> 88 | 89 | | Name | Type | Default | Description | 90 | | --- | --- | --- | --- | 91 | | `fn` | (t: T, i: number): S | | | 92 | 93 | 94 |
95 | 96 |
97 | 98 |
iterable.ts#L110
99 | 100 | ### Method .slice (from: number, to: number): Itarray<T> 101 | 102 | | Name | Type | Default | Description | 103 | | --- | --- | --- | --- | 104 | | `from` | number | | | 105 | | `to` | number | | | 106 | 107 | 108 |
109 | 110 |
111 | 112 |
iterable.ts#L99
113 | 114 | ### Method .some (fn: (t: T, i: number): boolean): boolean 115 | 116 | | Name | Type | Default | Description | 117 | | --- | --- | --- | --- | 118 | | `fn` | (t: T, i: number): boolean | | | 119 | 120 | 121 |
122 | 123 |
124 | 125 |
iterable.ts#L152
126 | 127 | ### static Method .make (fn: (i: number): T, max: number): Itarray<T> 128 | 129 | | Name | Type | Default | Description | 130 | | --- | --- | --- | --- | 131 | | `fn` | (i: number): T | | | 132 | | `max` | number | | | 133 | 134 | 135 |
136 | 137 |
138 | 139 |
140 | 141 |
iterable.ts#L11
142 | 143 | ## every (set: Iterable<T>, callback: (v: T): unknown): boolean 144 | 145 | | Name | Type | Default | Description | 146 | | --- | --- | --- | --- | 147 | | `set` | Iterable<T> | | | 148 | | `callback` | (v: T): unknown | | | 149 | 150 | 151 |
152 | 153 |
154 | 155 |
iterable.ts#L51
156 | 157 | ## findMin (items: Iterable<T>, value: (item: T): number, max: number, min: number): undefined|T 158 | 159 | Find the item in an iterable for which value() returns the smallest value. 160 | 161 | | Name | Type | Default | Description | 162 | | --- | --- | --- | --- | 163 | | `items` | Iterable<T> | | | 164 | | `value` | (item: T): number | | | 165 | | `max` | number | ... | | 166 | | `min` | number | | | 167 | 168 | 169 |
170 | 171 |
172 | 173 |
iterable.ts#L7
174 | 175 | ## first (set: Iterable<T>): undefined|T 176 | 177 | | Name | Type | Default | Description | 178 | | --- | --- | --- | --- | 179 | | `set` | Iterable<T> | | | 180 | 181 | 182 |
183 | 184 |
185 | 186 |
iterable.ts#L25
187 | 188 | ## flatMap (set: Iterable<T>, map: (x: T): Iterable<S>): Generator<S, void, unknown> 189 | 190 | | Name | Type | Default | Description | 191 | | --- | --- | --- | --- | 192 | | `set` | Iterable<T> | | | 193 | | `map` | (x: T): Iterable<S> | | | 194 | 195 | 196 |
197 | 198 |
199 | 200 |
iterable.ts#L41
201 | 202 | ## listPairs (list: Array<T>): Iterable<[T, T]> 203 | 204 | | Name | Type | Default | Description | 205 | | --- | --- | --- | --- | 206 | | `list` | Array<T> | | | 207 | 208 | 209 |
210 | 211 |
212 | 213 |
iterable.ts#L33
214 | 215 | ## pairs (a: Iterable<S>, b: Iterable<T>): Iterable<[S, T]> 216 | 217 | | Name | Type | Default | Description | 218 | | --- | --- | --- | --- | 219 | | `a` | Iterable<S> | | | 220 | | `b` | Iterable<T> | | | 221 | 222 | 223 |
224 | 225 |
226 | 227 |
iterable.ts#L18
228 | 229 | ## some (set: Iterable<T>, callback: (v: T): unknown): boolean 230 | 231 | | Name | Type | Default | Description | 232 | | --- | --- | --- | --- | 233 | | `set` | Iterable<T> | | | 234 | | `callback` | (v: T): unknown | | | 235 | 236 | 237 |
-------------------------------------------------------------------------------- /hilbert/errors.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 2 4 | parent: Hilbert.js 5 | --- 6 | 7 | # Errors 8 | 9 |
10 | 11 |
hilbert.js/src/errors.ts#L11
12 | 13 | ## Class ExprError 14 | 15 | Expression Error Class 16 | 17 | Extends Error 18 | 19 |
20 | 21 | ### constructor (name: string, message: string): ExprError 22 | 23 | | Name | Type | Default | Description | 24 | | --- | --- | --- | --- | 25 | | `name` | string | | | 26 | | `message` | string | | | 27 | 28 | 29 |
30 | 31 |
32 | 33 |
documentation/node_modules/typescript/lib/lib.es5.d.ts#L974
34 | 35 | ### Property .message : string 36 | 37 |
38 | 39 |
40 | 41 |
documentation/node_modules/typescript/lib/lib.es5.d.ts#L973
42 | 43 | ### Property .name : string 44 | 45 |
46 | 47 |
48 | 49 |
hilbert.js/node_modules/@types/node/globals.d.ts#L11
50 | 51 | ### Property .prepareStackTrace 52 | 53 | Optional override for formatting stack traces 54 | 55 |
56 | 57 |
58 | 59 |
documentation/node_modules/typescript/lib/lib.es5.d.ts#L975
60 | 61 | ### Property .stack 62 | 63 |
64 | 65 |
66 | 67 |
hilbert.js/node_modules/@types/node/globals.d.ts#L13
68 | 69 | ### Property .stackTraceLimit : number 70 | 71 |
72 | 73 |
74 | 75 | ### Method .captureStackTrace (targetObject: object, constructorOpt: Function): void 76 | 77 | Create .stack property on a target object 78 | 79 | | Name | Type | Default | Description | 80 | | --- | --- | --- | --- | 81 | | `targetObject` | object | | | 82 | | `constructorOpt` | Function | | | 83 | 84 | 85 |
86 | 87 |
88 | 89 |
hilbert.js/src/errors.ts#L45
90 | 91 | ### static Method .conflictingBrackets (x: string): ExprError 92 | 93 | | Name | Type | Default | Description | 94 | | --- | --- | --- | --- | 95 | | `x` | string | | | 96 | 97 | 98 |
99 | 100 |
101 | 102 |
hilbert.js/src/errors.ts#L61
103 | 104 | ### static Method .consecutiveOperators (x: string, y: string): ExprError 105 | 106 | | Name | Type | Default | Description | 107 | | --- | --- | --- | --- | 108 | | `x` | string | | | 109 | | `y` | string | | | 110 | 111 | 112 |
113 | 114 |
115 | 116 |
hilbert.js/src/errors.ts#L57
117 | 118 | ### static Method .endOperator (x: ExprElement): ExprError 119 | 120 | | Name | Type | Default | Description | 121 | | --- | --- | --- | --- | 122 | | `x` | ExprElement | | | 123 | 124 | 125 |
126 | 127 |
128 | 129 |
hilbert.js/src/errors.ts#L33
130 | 131 | ### static Method .evalLoop (x: string): ExprError 132 | 133 | | Name | Type | Default | Description | 134 | | --- | --- | --- | --- | 135 | | `x` | string | | | 136 | 137 | 138 |
139 | 140 |
141 | 142 |
hilbert.js/src/errors.ts#L41
143 | 144 | ### static Method .invalidCharacter (x: string): ExprError 145 | 146 | | Name | Type | Default | Description | 147 | | --- | --- | --- | --- | 148 | | `x` | string | | | 149 | 150 | 151 |
152 | 153 |
154 | 155 |
hilbert.js/src/errors.ts#L66
156 | 157 | ### static Method .invalidExpression (): ExprError 158 | 159 |
160 | 161 |
162 | 163 |
hilbert.js/src/errors.ts#L53
164 | 165 | ### static Method .startOperator (x: ExprElement): ExprError 166 | 167 | | Name | Type | Default | Description | 168 | | --- | --- | --- | --- | 169 | | `x` | ExprElement | | | 170 | 171 | 172 |
173 | 174 |
175 | 176 |
hilbert.js/src/errors.ts#L29
177 | 178 | ### static Method .uncallableExpression (x: string): ExprError 179 | 180 | | Name | Type | Default | Description | 181 | | --- | --- | --- | --- | 182 | | `x` | string | | | 183 | 184 | 185 |
186 | 187 |
188 | 189 |
hilbert.js/src/errors.ts#L49
190 | 191 | ### static Method .unclosedBracket (x: string): ExprError 192 | 193 | | Name | Type | Default | Description | 194 | | --- | --- | --- | --- | 195 | | `x` | string | | | 196 | 197 | 198 |
199 | 200 |
201 | 202 |
hilbert.js/src/errors.ts#L25
203 | 204 | ### static Method .undefinedFunction (x: string): ExprError 205 | 206 | | Name | Type | Default | Description | 207 | | --- | --- | --- | --- | 208 | | `x` | string | | | 209 | 210 | 211 |
212 | 213 |
214 | 215 |
hilbert.js/src/errors.ts#L21
216 | 217 | ### static Method .undefinedVariable (x: string): ExprError 218 | 219 | | Name | Type | Default | Description | 220 | | --- | --- | --- | --- | 221 | | `x` | string | | | 222 | 223 | 224 |
225 | 226 |
-------------------------------------------------------------------------------- /euclid/circle.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 5 4 | parent: Euclid.js 5 | --- 6 | 7 | # Circle 8 | 9 |
10 | 11 |
circle.ts#L16
12 | 13 | ## Class Circle 14 | 15 | A circle with a given center and radius. 16 | 17 | Implements GeoShape 18 | 19 |
20 | 21 | ### constructor (c: Point, r: number): Circle 22 | 23 | | Name | Type | Default | Description | 24 | | --- | --- | --- | --- | 25 | | `c` | Point | ... | | 26 | | `r` | number | 1 | | 27 | 28 | 29 |
30 | 31 |
32 | 33 | ### readonly Property .c : Point 34 | 35 | Default value: `...` 36 | 37 |
38 | 39 |
40 | 41 | ### readonly Property .r : number 42 | 43 | Default value: `1` 44 | 45 |
46 | 47 |
48 | 49 |
circle.ts#L17
50 | 51 | ### readonly Property .type 52 | 53 | Default value: `'circle'` 54 | 55 |
56 | 57 |
58 | 59 |
circle.ts#L31
60 | 61 | ### Accessor .arc : Arc 62 | 63 |
64 | 65 |
66 | 67 |
circle.ts#L27
68 | 69 | ### Accessor .area : number 70 | 71 | The area of this circle. 72 | 73 |
74 | 75 |
76 | 77 |
circle.ts#L22
78 | 79 | ### Accessor .circumference : number 80 | 81 | The length of the circumference of this circle. 82 | 83 |
84 | 85 |
86 | 87 |
circle.ts#L57
88 | 89 | ### Method .at (t: number): Point 90 | 91 | | Name | Type | Default | Description | 92 | | --- | --- | --- | --- | 93 | | `t` | number | | | 94 | 95 | 96 |
97 | 98 |
99 | 100 |
circle.ts#L42
101 | 102 | ### Method .collision (r: Rectangle): boolean 103 | 104 | | Name | Type | Default | Description | 105 | | --- | --- | --- | --- | 106 | | `r` | Rectangle | | | 107 | 108 | 109 |
110 | 111 |
112 | 113 |
circle.ts#L66
114 | 115 | ### Method .contains (p: Point): boolean 116 | 117 | | Name | Type | Default | Description | 118 | | --- | --- | --- | --- | 119 | | `p` | Point | | | 120 | 121 | 122 |
123 | 124 |
125 | 126 |
circle.ts#L98
127 | 128 | ### Method .equals (other: Circle, tolerance: number): boolean 129 | 130 | | Name | Type | Default | Description | 131 | | --- | --- | --- | --- | 132 | | `other` | Circle | | | 133 | | `tolerance` | number | | | 134 | 135 | 136 |
137 | 138 |
139 | 140 |
circle.ts#L62
141 | 142 | ### Method .offset (p: Point): number 143 | 144 | | Name | Type | Default | Description | 145 | | --- | --- | --- | --- | 146 | | `p` | Point | | | 147 | 148 | 149 |
150 | 151 |
152 | 153 |
circle.ts#L52
154 | 155 | ### Method .project (p: Point): Point 156 | 157 | | Name | Type | Default | Description | 158 | | --- | --- | --- | --- | 159 | | `p` | Point | | | 160 | 161 | 162 |
163 | 164 |
165 | 166 |
circle.ts#L82
167 | 168 | ### Method .reflect (l: Line): Circle 169 | 170 | | Name | Type | Default | Description | 171 | | --- | --- | --- | --- | 172 | | `l` | Line | | | 173 | 174 | 175 |
176 | 177 |
178 | 179 |
circle.ts#L77
180 | 181 | ### Method .rotate (a: number, c: Point): Circle 182 | 183 | | Name | Type | Default | Description | 184 | | --- | --- | --- | --- | 185 | | `a` | number | | | 186 | | `c` | Point | ... | | 187 | 188 | 189 |
190 | 191 |
192 | 193 |
circle.ts#L86
194 | 195 | ### Method .scale (sx: number, sy: number): Circle 196 | 197 | | Name | Type | Default | Description | 198 | | --- | --- | --- | --- | 199 | | `sx` | number | | | 200 | | `sy` | number | ... | | 201 | 202 | 203 |
204 | 205 |
206 | 207 |
circle.ts#L90
208 | 209 | ### Method .shift (x: number, y: number): Circle 210 | 211 | | Name | Type | Default | Description | 212 | | --- | --- | --- | --- | 213 | | `x` | number | | | 214 | | `y` | number | ... | | 215 | 216 | 217 |
218 | 219 |
220 | 221 |
circle.ts#L36
222 | 223 | ### Method .tangentAt (t: number): Line 224 | 225 | | Name | Type | Default | Description | 226 | | --- | --- | --- | --- | 227 | | `t` | number | | | 228 | 229 | 230 |
231 | 232 |
233 | 234 |
circle.ts#L102
235 | 236 | ### Method .toString (): string 237 | 238 |
239 | 240 |
241 | 242 |
circle.ts#L72
243 | 244 | ### Method .transform (m: TransformMatrix): Circle 245 | 246 | | Name | Type | Default | Description | 247 | | --- | --- | --- | --- | 248 | | `m` | TransformMatrix | | | 249 | 250 | 251 |
252 | 253 |
254 | 255 |
circle.ts#L94
256 | 257 | ### Method .translate (p: SimplePoint): Circle 258 | 259 | | Name | Type | Default | Description | 260 | | --- | --- | --- | --- | 261 | | `p` | SimplePoint | | | 262 | 263 | 264 |
265 | 266 |
-------------------------------------------------------------------------------- /core/colors.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 3 4 | parent: Core.js 5 | --- 6 | 7 | # Colors 8 | 9 |
10 | 11 |
colors.ts#L43
12 | 13 | ## Class Color 14 | 15 | Color generation and conversion class. 16 | 17 |
18 | 19 | ### constructor (r: number, g: number, b: number, a: number): Color 20 | 21 | | Name | Type | Default | Description | 22 | | --- | --- | --- | --- | 23 | | `r` | number | | | 24 | | `g` | number | | | 25 | | `b` | number | | | 26 | | `a` | number | 1 | | 27 | 28 | 29 |
30 | 31 |
32 | 33 | ### Property .a : number 34 | 35 | Default value: `1` 36 | 37 |
38 | 39 |
40 | 41 | ### Property .b : number 42 | 43 |
44 | 45 |
46 | 47 | ### Property .g : number 48 | 49 |
50 | 51 |
52 | 53 | ### Property .r : number 54 | 55 |
56 | 57 |
58 | 59 |
colors.ts#L62
60 | 61 | ### Accessor .brightness : number 62 | 63 | Get the brightness of this color. 64 | 65 |
66 | 67 |
68 | 69 |
colors.ts#L88
70 | 71 | ### Accessor .chroma : number 72 | 73 |
74 | 75 |
76 | 77 |
colors.ts#L49
78 | 79 | ### Accessor .hex : string 80 | 81 | Converts this color to a hex string. 82 | 83 |
84 | 85 |
86 | 87 |
colors.ts#L67
88 | 89 | ### Accessor .hsl 90 | 91 | Converts this color to an HSL array. 92 | 93 |
94 | 95 |
96 | 97 |
colors.ts#L56
98 | 99 | ### Accessor .rgb : string 100 | 101 | Converts this color to an rgba string. 102 | 103 |
104 | 105 |
106 | 107 |
colors.ts#L97
108 | 109 | ### Method .copy (): Color 110 | 111 | Creates a copy of this color. 112 | 113 |
114 | 115 |
116 | 117 |
colors.ts#L92
118 | 119 | ### Method .toString (): string 120 | 121 |
122 | 123 |
124 | 125 |
colors.ts#L103
126 | 127 | ### static Method .from (color: string|Color): Color 128 | 129 | | Name | Type | Default | Description | 130 | | --- | --- | --- | --- | 131 | | `color` | string|Color | | | 132 | 133 | 134 |
135 | 136 |
137 | 138 |
colors.ts#L117
139 | 140 | ### static Method .fromHex (hex: string): Color 141 | 142 | Creates a Color instance from a hex string. 143 | 144 | | Name | Type | Default | Description | 145 | | --- | --- | --- | --- | 146 | | `hex` | string | | | 147 | 148 | 149 |
150 | 151 |
152 | 153 |
colors.ts#L131
154 | 155 | ### static Method .fromHsl (h: number, s: number, l: number): Color 156 | 157 | | Name | Type | Default | Description | 158 | | --- | --- | --- | --- | 159 | | `h` | number | | | 160 | | `s` | number | | | 161 | | `l` | number | | | 162 | 163 | 164 |
165 | 166 |
167 | 168 |
colors.ts#L108
169 | 170 | ### static Method .fromRgb (color: string): Color 171 | 172 | | Name | Type | Default | Description | 173 | | --- | --- | --- | --- | 174 | | `color` | string | | | 175 | 176 | 177 |
178 | 179 |
180 | 181 |
colors.ts#L156
182 | 183 | ### static Method .gradient (colors: Array<string|Color>, steps: number): Array<Color> 184 | 185 | Generates a rainbow gradient with a given number of steps. 186 | 187 | | Name | Type | Default | Description | 188 | | --- | --- | --- | --- | 189 | | `colors` | Array<string|Color> | | | 190 | | `steps` | number | | | 191 | 192 | 193 |
194 | 195 |
196 | 197 |
colors.ts#L167
198 | 199 | ### static Method .mix (c1: string|Color, c2: string|Color, p: number): Color 200 | 201 | Linearly interpolates two colors or hex strings. 202 | 203 | | Name | Type | Default | Description | 204 | | --- | --- | --- | --- | 205 | | `c1` | string|Color | | | 206 | | `c2` | string|Color | | | 207 | | `p` | number | 0.5 | | 208 | 209 | 210 |
211 | 212 |
213 | 214 |
colors.ts#L179
215 | 216 | ### static Method .mixMany (colors: Array<Color>, weights: Array<number>): Color 217 | 218 | | Name | Type | Default | Description | 219 | | --- | --- | --- | --- | 220 | | `colors` | Array<Color> | | | 221 | | `weights` | Array<number> | | | 222 | 223 | 224 |
225 | 226 |
227 | 228 |
colors.ts#L151
229 | 230 | ### static Method .rainbow (steps: number): Array<Color> 231 | 232 | Generates a rainbow gradient with a given number of steps. 233 | 234 | | Name | Type | Default | Description | 235 | | --- | --- | --- | --- | 236 | | `steps` | number | | | 237 | 238 | 239 |
240 | 241 |
242 | 243 |
colors.ts#L160
244 | 245 | ### static Method .shades (color: string|Color, steps: number, range: number): Array<Color> 246 | 247 | | Name | Type | Default | Description | 248 | | --- | --- | --- | --- | 249 | | `color` | string|Color | | | 250 | | `steps` | number | | | 251 | | `range` | number | 0.5 | | 252 | 253 | 254 |
255 | 256 |
-------------------------------------------------------------------------------- /fermat/xnumber.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 11 4 | parent: Fermat.js 5 | --- 6 | 7 | # Xnumber 8 | 9 |
10 | 11 |
xnumber.ts#L16
12 | 13 | ## Class XNumber 14 | 15 | Extended Number class. 16 | 17 |
18 | 19 | ### constructor (num: number, den: number, unit: Suffix): XNumber 20 | 21 | | Name | Type | Default | Description | 22 | | --- | --- | --- | --- | 23 | | `num` | number | | | 24 | | `den` | number | | | 25 | | `unit` | Suffix | | | 26 | 27 | 28 |
29 | 30 |
31 | 32 |
xnumber.ts#L18
33 | 34 | ### Property .den 35 | 36 |
37 | 38 |
39 | 40 |
xnumber.ts#L17
41 | 42 | ### Property .num : number 43 | 44 |
45 | 46 |
47 | 48 | ### Property .unit ?: Suffix 49 | 50 |
51 | 52 |
53 | 54 |
xnumber.ts#L69
55 | 56 | ### Accessor .inverse : XNumber 57 | 58 | Returns 1/x of this number. 59 | 60 |
61 | 62 |
63 | 64 |
xnumber.ts#L75
65 | 66 | ### Accessor .negative : XNumber 67 | 68 | Returns -x of this number. 69 | 70 |
71 | 72 |
73 | 74 |
xnumber.ts#L57
75 | 76 | ### Accessor .sign : number 77 | 78 |
79 | 80 |
81 | 82 |
xnumber.ts#L62
83 | 84 | ### Accessor .simplified : XNumber 85 | 86 | Simplifies fractions, e.g. 4/8 would become 1/2. 87 | 88 |
89 | 90 |
91 | 92 |
xnumber.ts#L52
93 | 94 | ### Accessor .value : number 95 | 96 | Returns the value of this number as a decimal. For example, 2/5 and 40% 97 | would both return 0.4. 98 | 99 |
100 | 101 |
102 | 103 |
xnumber.ts#L150
104 | 105 | ### Method .add (a: number|XNumber): XNumber 106 | 107 | | Name | Type | Default | Description | 108 | | --- | --- | --- | --- | 109 | | `a` | number|XNumber | | | 110 | 111 | 112 |
113 | 114 |
115 | 116 |
xnumber.ts#L143
117 | 118 | ### Method .clamp (min: number, max: number): XNumber 119 | 120 | | Name | Type | Default | Description | 121 | | --- | --- | --- | --- | 122 | | `min` | number | | | 123 | | `max` | number | | | 124 | 125 | 126 |
127 | 128 |
129 | 130 |
xnumber.ts#L162
131 | 132 | ### Method .divide (a: number|XNumber): XNumber 133 | 134 | | Name | Type | Default | Description | 135 | | --- | --- | --- | --- | 136 | | `a` | number|XNumber | | | 137 | 138 | 139 |
140 | 141 |
142 | 143 |
xnumber.ts#L158
144 | 145 | ### Method .multiply (a: number|XNumber): XNumber 146 | 147 | | Name | Type | Default | Description | 148 | | --- | --- | --- | --- | 149 | | `a` | number|XNumber | | | 150 | 151 | 152 |
153 | 154 |
155 | 156 |
xnumber.ts#L154
157 | 158 | ### Method .subtract (a: number|XNumber): XNumber 159 | 160 | | Name | Type | Default | Description | 161 | | --- | --- | --- | --- | 162 | | `a` | number|XNumber | | | 163 | 164 | 165 |
166 | 167 |
168 | 169 |
xnumber.ts#L39
170 | 171 | ### Method .toMathML (): string 172 | 173 |
174 | 175 |
176 | 177 |
xnumber.ts#L30
178 | 179 | ### Method .toString (precision: number): string 180 | 181 | | Name | Type | Default | Description | 182 | | --- | --- | --- | --- | 183 | | `precision` | number | 4 | | 184 | 185 | 186 |
187 | 188 |
189 | 190 |
xnumber.ts#L26
191 | 192 | ### Method .valueOf (): number 193 | 194 |
195 | 196 |
197 | 198 |
xnumber.ts#L189
199 | 200 | ### static Method .difference (a: XNumber, b: number|XNumber): XNumber 201 | 202 | Calculates the difference of two numbers a and b. 203 | 204 | | Name | Type | Default | Description | 205 | | --- | --- | --- | --- | 206 | | `a` | XNumber | | | 207 | | `b` | number|XNumber | | | 208 | 209 | 210 |
211 | 212 |
213 | 214 |
xnumber.ts#L110
215 | 216 | ### static Method .fractionFromDecimal (x: number, maxDen: number): XNumber 217 | 218 | Converts a decimal into the closest fraction with a given maximum denominator. 219 | 220 | | Name | Type | Default | Description | 221 | | --- | --- | --- | --- | 222 | | `x` | number | | | 223 | | `maxDen` | number | 100 | | 224 | 225 | 226 |
227 | 228 |
229 | 230 |
xnumber.ts#L82
231 | 232 | ### static Method .fromString (s: string): undefined|XNumber 233 | 234 | Parses a number string, e.g. '1/2' or '20.7%'. 235 | 236 | | Name | Type | Default | Description | 237 | | --- | --- | --- | --- | 238 | | `s` | string | | | 239 | 240 | 241 |
242 | 243 |
244 | 245 |
xnumber.ts#L195
246 | 247 | ### static Method .product (a: XNumber, b: number|XNumber): XNumber 248 | 249 | Calculates the product of two numbers a and b. 250 | 251 | | Name | Type | Default | Description | 252 | | --- | --- | --- | --- | 253 | | `a` | XNumber | | | 254 | | `b` | number|XNumber | | | 255 | 256 | 257 |
258 | 259 |
260 | 261 |
xnumber.ts#L211
262 | 263 | ### static Method .quotient (a: XNumber, b: number|XNumber): XNumber 264 | 265 | Calculates the quotient of two fractions a and b. 266 | 267 | | Name | Type | Default | Description | 268 | | --- | --- | --- | --- | 269 | | `a` | XNumber | | | 270 | | `b` | number|XNumber | | | 271 | 272 | 273 |
274 | 275 |
276 | 277 |
xnumber.ts#L167
278 | 279 | ### static Method .sum (a: XNumber, b: number|XNumber): XNumber 280 | 281 | Calculates the sum of two fractions a and b. 282 | 283 | | Name | Type | Default | Description | 284 | | --- | --- | --- | --- | 285 | | `a` | XNumber | | | 286 | | `b` | number|XNumber | | | 287 | 288 | 289 |
290 | 291 |
-------------------------------------------------------------------------------- /euclid/ellipse.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 8 4 | parent: Euclid.js 5 | --- 6 | 7 | # Ellipse 8 | 9 |
10 | 11 |
ellipse.ts#L14
12 | 13 | ## Class Ellipse 14 | 15 | Implements GeoShape 16 | 17 |
18 | 19 | ### constructor (c: Point, a: number, b: number, angle: number): Ellipse 20 | 21 | | Name | Type | Default | Description | 22 | | --- | --- | --- | --- | 23 | | `c` | Point | | | 24 | | `a` | number | | | 25 | | `b` | number | | | 26 | | `angle` | number | 0 | | 27 | 28 | 29 |
30 | 31 |
32 | 33 |
ellipse.ts#L16
34 | 35 | ### readonly Property .a : number 36 | 37 |
38 | 39 |
40 | 41 |
ellipse.ts#L18
42 | 43 | ### readonly Property .angle : number 44 | 45 |
46 | 47 |
48 | 49 |
ellipse.ts#L17
50 | 51 | ### readonly Property .b : number 52 | 53 |
54 | 55 |
56 | 57 | ### readonly Property .c : Point 58 | 59 |
60 | 61 |
62 | 63 |
ellipse.ts#L19
64 | 65 | ### readonly Property .f1 : Point 66 | 67 |
68 | 69 |
70 | 71 |
ellipse.ts#L20
72 | 73 | ### readonly Property .f2 : Point 74 | 75 |
76 | 77 |
78 | 79 |
ellipse.ts#L15
80 | 81 | ### readonly Property .type 82 | 83 | Default value: `'ellipse'` 84 | 85 |
86 | 87 |
88 | 89 |
ellipse.ts#L42
90 | 91 | ### Accessor .rx 92 | 93 |
94 | 95 |
96 | 97 |
ellipse.ts#L46
98 | 99 | ### Accessor .ry 100 | 101 |
102 | 103 |
104 | 105 |
ellipse.ts#L92
106 | 107 | ### Method .at (t: number): Point 108 | 109 | | Name | Type | Default | Description | 110 | | --- | --- | --- | --- | 111 | | `t` | number | | | 112 | 113 | 114 |
115 | 116 |
117 | 118 |
ellipse.ts#L104
119 | 120 | ### Method .contains (p: Point): boolean 121 | 122 | | Name | Type | Default | Description | 123 | | --- | --- | --- | --- | 124 | | `p` | Point | | | 125 | 126 | 127 |
128 | 129 |
130 | 131 |
ellipse.ts#L140
132 | 133 | ### Method .equals (other: Ellipse, tolerance: number): boolean 134 | 135 | | Name | Type | Default | Description | 136 | | --- | --- | --- | --- | 137 | | `other` | Ellipse | | | 138 | | `tolerance` | number | | | 139 | 140 | 141 |
142 | 143 |
144 | 145 |
ellipse.ts#L55
146 | 147 | ### Method .intersect (line: Line): Array<Point> 148 | 149 | Intersection between an ellipse and a line. 150 | 151 | | Name | Type | Default | Description | 152 | | --- | --- | --- | --- | 153 | | `line` | Line | | | 154 | 155 | 156 |
157 | 158 |
159 | 160 |
ellipse.ts#L50
161 | 162 | ### Method .normalAt (p: Point): Line 163 | 164 | | Name | Type | Default | Description | 165 | | --- | --- | --- | --- | 166 | | `p` | Point | | | 167 | 168 | 169 |
170 | 171 |
172 | 173 |
ellipse.ts#L99
174 | 175 | ### Method .offset (p: Point): number 176 | 177 | | Name | Type | Default | Description | 178 | | --- | --- | --- | --- | 179 | | `p` | Point | | | 180 | 181 | 182 |
183 | 184 |
185 | 186 |
ellipse.ts#L86
187 | 188 | ### Method .project (p: Point): Point 189 | 190 | | Name | Type | Default | Description | 191 | | --- | --- | --- | --- | 192 | | `p` | Point | | | 193 | 194 | 195 |
196 | 197 |
198 | 199 |
ellipse.ts#L123
200 | 201 | ### Method .reflect (l: Line): Ellipse 202 | 203 | | Name | Type | Default | Description | 204 | | --- | --- | --- | --- | 205 | | `l` | Line | | | 206 | 207 | 208 |
209 | 210 |
211 | 212 |
ellipse.ts#L118
213 | 214 | ### Method .rotate (a: number, c: Point): Ellipse 215 | 216 | | Name | Type | Default | Description | 217 | | --- | --- | --- | --- | 218 | | `a` | number | | | 219 | | `c` | Point | ... | | 220 | 221 | 222 |
223 | 224 |
225 | 226 |
ellipse.ts#L128
227 | 228 | ### Method .scale (sx: number, sy: number): Ellipse 229 | 230 | | Name | Type | Default | Description | 231 | | --- | --- | --- | --- | 232 | | `sx` | number | | | 233 | | `sy` | number | ... | | 234 | 235 | 236 |
237 | 238 |
239 | 240 |
ellipse.ts#L132
241 | 242 | ### Method .shift (x: number, y: number): Ellipse 243 | 244 | | Name | Type | Default | Description | 245 | | --- | --- | --- | --- | 246 | | `x` | number | | | 247 | | `y` | number | ... | | 248 | 249 | 250 |
251 | 252 |
253 | 254 |
ellipse.ts#L149
255 | 256 | ### Method .toString (): string 257 | 258 |
259 | 260 |
261 | 262 |
ellipse.ts#L113
263 | 264 | ### Method .transform (_m: TransformMatrix): Ellipse 265 | 266 | | Name | Type | Default | Description | 267 | | --- | --- | --- | --- | 268 | | `_m` | TransformMatrix | | | 269 | 270 | 271 |
272 | 273 |
274 | 275 |
ellipse.ts#L136
276 | 277 | ### Method .translate (p: SimplePoint): Ellipse 278 | 279 | | Name | Type | Default | Description | 280 | | --- | --- | --- | --- | 281 | | `p` | SimplePoint | | | 282 | 283 | 284 |
285 | 286 |
287 | 288 |
ellipse.ts#L76
289 | 290 | ### static Method .fromFoci (f1: Point, f2: Point, stringLength: number): Ellipse 291 | 292 | Creates a new Ellipse. StringLength is the length of string from one foci 293 | to a point on the circumference, to the other foci. 294 | 295 | | Name | Type | Default | Description | 296 | | --- | --- | --- | --- | 297 | | `f1` | Point | | | 298 | | `f2` | Point | | | 299 | | `stringLength` | number | | | 300 | 301 | 302 |
303 | 304 |
-------------------------------------------------------------------------------- /studio/markdown.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 2 4 | parent: Mathigon Studio 5 | --- 6 | 7 | # Markdown syntax 8 | 9 | Mathigon's courses are written in a custom flavour of Markdown. Most [standard syntax](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) (titles, bold, italic, links, etc.) is supported, but we have added many new elements, and updated the behaviour of some existing ones. 10 | 11 | Here is the basic outline of a chapter: 12 | 13 | ```markdown 14 | # Chapter Title 15 | 16 | > color: #f42621 17 | > description: Here is a custom course description 18 | > id: step-1 19 | > section: section-id 20 | 21 | ## First section 22 | 23 | Here is a paragraph 24 | 25 | --- 26 | > id: step-2 27 | > goals: my-goal 28 | 29 | Here is another paragraph 30 | ``` 31 | 32 | Notice that every chapter is split into multiple short steps, divided by the `---` lines. Every section contains some *metadata* at the beginning, in lines starting with a `>`. The metadata is parsed as [YAML](http://yaml.org/). (Note that the `>` usually indicates block quotes in standard Markdown syntax.) 33 | 34 | The `# H1` heading is the title of the entire course. Every step that starts with an `# H2` heading creates a new chapter/section, and you can use the `> section:` metadata to (optionally) specify a custom ID for this chapter. This ID will appear in the URL, for example `/course//`. 35 | 36 | Every step should have a unique `id`. You can also specify an optional `title`, as well as `goals`, which is a space-separated list of events that need to be triggered before the next step is revealed. 37 | 38 | ## Equations and code blocks 39 | 40 | Content between backticks is parsed as [AsciiMath](http://asciimath.org/) and converted to MathML. If you want to parse it as code or LaTeX instead, you can specify the language at the beginning: 41 | 42 | ```markdown 43 | The probability of rolling a 6 is `(1+x)/3`. 44 | Here is some Python code: `{py} x = 0` 45 | Here is some LaTeX code: `{latex} \frac{1}{2}` 46 | ``` 47 | 48 | There are a few minor differences compared to the standard AsciiMath syntax. Most importantly, it is possible to have arbitrary multi-letter variables, e.g. `ab` would become `ab` not `ab`. To create multiple chained single-letter variables, simply add a space in between, e.g. `a b`. 49 | 50 | _Note: there are [special functions](#inline-elements-in-equations) for adding inline elements inside equations._ 51 | 52 | ## Blanks and input fields 53 | 54 | You can create blanks for students to fill in using double square brackets. These can contain either be a single number (for input field) or multiple words separated by `|` (for multiple choice popups). 55 | 56 | Input fields except the solution both as digits, or as a typed number string. For multiple choice questions, the first choice is always the correct one (but the answers are shuffled when displayed to students). 57 | 58 | ```markdown 59 | There are numbers like [[10]] or [[ten]] and [[many|few|no]] choices. 60 | ``` 61 | 62 | You can provide specific hints for these blanks, or specify ranges of possible answers: 63 | 64 | ```markdown 65 | Accept answers between 95 and 105 (inclusive): 66 | [[100 ± 5]] 67 | 68 | Show a hint when students make a mistake: 69 | [[100 (Here is a hint.)]] 70 | 71 | Show a series of hints if students make repeated mistakes: 72 | [[100 (Here is the first hint. | Here is the second hint.)]] 73 | 74 | Show specific hints for common errors: 75 | [[100 (50: Double that number. | 100: Half that number. | Here is a hint.)]] 76 | ``` 77 | 78 | ## Custom classes, attributes and tags 79 | 80 | For customisation and styling, it is possible to add ids, classes and attributes to paragraphs or inline elements. Simply start the body of that element with the required CSS selector inside `{}`: 81 | 82 | ```markdown 83 | {.class1.class2(attr="value")} Some _{#id1} text_ and [{.red} link](url). 84 | ``` 85 | 86 | You can even use this method to change the tag name of an element: 87 | 88 | ```markdown 89 | Here is a span element: _{span.red} Text_ 90 | ``` 91 | 92 | ## Variable sliders 93 | 94 | In order to make the content as dynamic and interactive as possible, you can easily add inline variables that can be manipulated by the student. There is a separate syntax for initialising variables (resulting in interactive sliders) and expressions that depend on these variables. This example would produce a slider for a variable `a` that is initially 2 and can be changed from -8 to 8 in steps of 2: 95 | 96 | ```markdown 97 | The square of ${a}{a|2|-8,8,2} is ${a*a}. The square root is ${sqrt(a)}. 98 | ``` 99 | 100 | ## Links, glossary and biography popups 101 | 102 | You can add external links just like in normal markdown: 103 | 104 | ```markdown 105 | Here is a [link](https://mathigon.org). 106 | ``` 107 | 108 | In addition, you can use the `bio:` or `gloss:` prefix to add biography or glossary popups. The corresponding IDs must match one of the items in the corresponding YAML files in the [shared](https://github.com/mathigon/textbooks/tree/master/content/shared) directory: 109 | 110 | ```markdown 111 | The force of [gravity](gloss:gravity) was first explained by [Newton](bio:newton). 112 | ``` 113 | 114 | ## Targets and action buttons 115 | 116 | You can add action buttons that execute a certain snipped of JavScript code: 117 | 118 | ```markdown 119 | Let's [increment](action:fn()) the 120 | ``` 121 | 122 | Other than variable sliders, glossary and biography popups, there are a number of different inline 123 | elements. The `->` symnol greates a __target pointer__ to specific elements of the page. If users hover over the link, Mathigon will highlight all elements that match the given CSS selector (and, if needed, scroll them into view.) 124 | 125 | ```markdown 126 | You should try hovering over the [biography button](->#s1.bio). 127 | ``` 128 | 129 | _Note: Replace whitespace in the CSS query selector by `_`s, so that the string remains a valid "URL"._ 130 | 131 | You can add coloured __pills__, for example to visualise different variables that correspond to specific elements in a diagram. The supported colours are `red`, `purple`, `blue`, `teal`, `green`, `lime`, `yellow` and `orange`: 132 | 133 | ```markdown 134 | Here is [a red pill](pill:red) and [a yellow pill](pill:yellow). 135 | ``` 136 | 137 | **TODO**: `target` elements… 138 | 139 | ## Inline elements in equations 140 | 141 | You can also add any of these elements within AsciiMath equation blocks, using a few different functions: 142 | 143 | | Normal Markdown | Inside equations | 144 | | -------------------------------- | -------------------------------- | 145 | | `A [[blank \ choice]]` | `` `x + blank(y, "choice")` `` | 146 | | `An input [[10]]` | `` `x + input(10) + y` `` | 147 | | `A [pill](pill:red)` | `` `x + pill(y,"red")` `` | 148 | | `A [{.green} target](target:px)` | `` `x + pill(y,"green","px")` `` | 149 | | `A variable instance ${y * 2}` | `` `x + var("y * 2")` `` | 150 | 151 | These elements can then be used in arbitrarily nested equations: 152 | 153 | ```markdown 154 | `blank("a","b")/(input(10) + var("x")) = sqrt(pill(x + y, "blue"))` 155 | ``` 156 | 157 | ## Block elements 158 | 159 | Rather than using the `{...}` syntax for adding classes or elements, you can wrap elements in blocks using `:::` symbols: 160 | 161 | ```markdown 162 | ::: .theorem(style="background: red") 163 | 164 | Here is some text. 165 | 166 | ::: 167 | ``` 168 | 169 | The syntax for specifying tag names, classes, IDs and attributes is the same as in the previous section. 170 | 171 | Some components also also allow chaining of multiple blocks: 172 | 173 | ```markdown 174 | ::: column.grow 175 | 176 | This column will grow to fill the available space 177 | 178 | ::: column(width=300) 179 | 180 | This column is 300px wide. 181 | 182 | ::: 183 | ``` 184 | 185 | ## Reveals 186 | 187 | Consecutive steps are automatically hidden and revealed when students complete all the required exercises and goals. However, you can also add content *within* a step that is dynamically revealed: paragraphs, individual words, or even elements of an SVG diagram. 188 | 189 | The syntax is the same as for custom classes and attributes: you just need the `.reveal` class and a `when=""` attribute with a space-separated list of all required goals: 190 | 191 | ```markdown 192 | Here is a paragraph with a blank: [[10]] 193 | 194 | {.reveal(when="blank-0")} Here is another blank: [[20]] 195 | 196 | {.reveal(when="blank-1")} Here is another blank: [[30]] 197 | ``` 198 | 199 | Notice that blanks within a step automatically indexed, staring at 0. 200 | 201 | It is also possible to change the animation type, duration and delay of these reveal animations: 202 | 203 | ```markdown 204 | {.reveal(when="blank-0" animation="pop" delay=1000 duration=400)} Show me... 205 | ``` 206 | 207 | ## Special characters 208 | 209 | You can add [any of these emoji](https://gist.github.com/rxaviers/7360908) using their name: 210 | 211 | ```markdown 212 | Hey :smile: 213 | ``` 214 | 215 | You can create non-breaking whitespace by prefixing it with a `\`: 216 | 217 | ```markdown 218 | The answer is 12\ m. The price us US$\ 50. 219 | ``` 220 | 221 | ## Custom HTML 222 | 223 | Any content indented by four characters is parsed a [Pug](https://pugjs.org/) and converted to HTML: 224 | 225 | ```markdown 226 | Here is a paragraph 227 | 228 | div 229 | img(src="images/example.jpg") 230 | .caption Here is some custom HTML 231 | ``` 232 | 233 | Pug content before the start for the first step can be used to define mixins than are accessible in all later Pug blogs. 234 | 235 | All relative urls in `src` and `href` attributes are parsed relative to the root directory for this chapter. 236 | 237 | You can use the `.md` class to parse Markdown within HTML blocks; 238 | 239 | ```markdown 240 | This is _markdown_. 241 | 242 | div This is not markdown. 243 | div.md This _is_ markdown. 244 | ``` 245 | 246 | ## Tables 247 | 248 | TODO… 249 | 250 | ## Audio Narration 251 | 252 | Mathigon will automatically generate audio narrations for all text. You can prevent this behaviour using the `.no-voice` class. 253 | 254 | ```markdown 255 | Can you read this _{.no-voice} silent_ text to me. 256 | ``` 257 | 258 | You can use the `voice=` attribute to override the custom text-to-speech parser. However, this should only be used rarely – for example, Mathigon can automatically translate equations into spoken text. 259 | 260 | ```markdown 261 | Here is an equation: _{span(voice="a squared + b squared")} `a^2 + b^2`_. 262 | ``` 263 | -------------------------------------------------------------------------------- /fermat/arithmetic.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | nav_order: 1 4 | parent: Fermat.js 5 | --- 6 | 7 | # Arithmetic 8 | 9 |
10 | 11 |
arithmetic.ts#L218
12 | 13 | ## clamp (x: number, min: number, max: number): number 14 | 15 | Bounds a number between a lower and an upper limit. 16 | 17 | | Name | Type | Default | Description | 18 | | --- | --- | --- | --- | 19 | | `x` | number | | | 20 | | `min` | number | -Infinity | | 21 | | `max` | number | ... | | 22 | 23 | 24 |
25 | 26 |
27 | 28 |
arithmetic.ts#L233
29 | 30 | ## cube (x: number): number 31 | 32 | Cubes a number. 33 | 34 | | Name | Type | Default | Description | 35 | | --- | --- | --- | --- | 36 | | `x` | number | | | 37 | 38 | 39 |
40 | 41 |
42 | 43 |
arithmetic.ts#L176
44 | 45 | ## digits (n: number): Array<number> 46 | 47 | Returns the digits of a number n. 48 | 49 | | Name | Type | Default | Description | 50 | | --- | --- | --- | --- | 51 | | `n` | number | | | 52 | 53 | 54 |
55 | 56 |
57 | 58 |
arithmetic.ts#L25
59 | 60 | ## isBetween (value: number, a: number, b: number, t: number): boolean 61 | 62 | Checks if a number x is between two numbers a and b. 63 | 64 | | Name | Type | Default | Description | 65 | | --- | --- | --- | --- | 66 | | `value` | number | | | 67 | | `a` | number | | | 68 | | `b` | number | | | 69 | | `t` | number | ... | | 70 | 71 | 72 |
73 | 74 |
75 | 76 |
arithmetic.ts#L20
77 | 78 | ## isInteger (x: number, t: number): boolean 79 | 80 | | Name | Type | Default | Description | 81 | | --- | --- | --- | --- | 82 | | `x` | number | | | 83 | | `t` | number | ... | | 84 | 85 | 86 |
87 | 88 |
89 | 90 |
arithmetic.ts#L223
91 | 92 | ## lerp (a: number, b: number, t: number): number 93 | 94 | Linear interpolation 95 | 96 | | Name | Type | Default | Description | 97 | | --- | --- | --- | --- | 98 | | `a` | number | | | 99 | | `b` | number | | | 100 | | `t` | number | 0.5 | | 101 | 102 | 103 |
104 | 105 |
106 | 107 |
arithmetic.ts#L247
108 | 109 | ## log (x: number, b: number): number 110 | 111 | Calculates the logarithm of `x` with base `b`. 112 | 113 | | Name | Type | Default | Description | 114 | | --- | --- | --- | --- | 115 | | `x` | number | | | 116 | | `b` | number | | | 117 | 118 | 119 |
120 | 121 |
122 | 123 |
arithmetic.ts#L242
124 | 125 | ## mod (a: number, m: number): number 126 | 127 | Calculates `a mod m`. The JS implementation of the % operator returns the 128 | symmetric modulo. Both are identical if a >= 0 and m >= 0 but the results 129 | differ if a or m < 0. 130 | 131 | | Name | Type | Default | Description | 132 | | --- | --- | --- | --- | 133 | | `a` | number | | | 134 | | `m` | number | | | 135 | 136 | 137 |
138 | 139 |
140 | 141 |
arithmetic.ts#L14
142 | 143 | ## nearlyEquals (a: number, b: number, t: number): boolean 144 | 145 | Checks if two numbers are nearly equals. 146 | 147 | | Name | Type | Default | Description | 148 | | --- | --- | --- | --- | 149 | | `a` | number | | | 150 | | `b` | number | | | 151 | | `t` | number | ... | | 152 | 153 | 154 |
155 | 156 |
157 | 158 |
arithmetic.ts#L70
159 | 160 | ## numberFormat (n: number, places: number, separators: boolean): string 161 | 162 | Converts a number to a clean string, by rounding, adding power suffixes, and 163 | adding thousands separators. `places` is the number of digits to show in the 164 | result. 165 | 166 | | Name | Type | Default | Description | 167 | | --- | --- | --- | --- | 168 | | `n` | number | | | 169 | | `places` | number | 0 | | 170 | | `separators` | boolean | true | | 171 | 172 | 173 |
174 | 175 |
176 | 177 |
arithmetic.ts#L90
178 | 179 | ## parseNumber (str: string): number 180 | 181 | Converts a number to a string, including . or , decimal points and 182 | thousands separators. 183 | 184 | | Name | Type | Default | Description | 185 | | --- | --- | --- | --- | 186 | | `str` | string | | | 187 | 188 | 189 |
190 | 191 |
192 | 193 |
arithmetic.ts#L261
194 | 195 | ## polynomial (x: number, coefficients: Array<number>): number 196 | 197 | | Name | Type | Default | Description | 198 | | --- | --- | --- | --- | 199 | | `x` | number | | | 200 | | `coefficients` | Array<number> | | | 201 | 202 | 203 |
204 | 205 |
206 | 207 |
arithmetic.ts#L252
208 | 209 | ## quadratic (a: number, b: number, c: number): Array<number> 210 | 211 | Solves the quadratic equation a x^2 + b x + c = 0 212 | 213 | | Name | Type | Default | Description | 214 | | --- | --- | --- | --- | 215 | | `a` | number | | | 216 | | `b` | number | | | 217 | | `c` | number | | | 218 | 219 | 220 |
221 | 222 |
223 | 224 |
arithmetic.ts#L182
225 | 226 | ## round (n: number, precision: number): number 227 | 228 | Rounds a number `n` to `precision` decimal places. 229 | 230 | | Name | Type | Default | Description | 231 | | --- | --- | --- | --- | 232 | | `n` | number | | | 233 | | `precision` | number | 0 | | 234 | 235 | 236 |
237 | 238 |
239 | 240 |
arithmetic.ts#L188
241 | 242 | ## roundTo (n: number, increment: number): number 243 | 244 | Round a number `n` to the nearest multiple of `increment`. 245 | 246 | | Name | Type | Default | Description | 247 | | --- | --- | --- | --- | 248 | | `n` | number | | | 249 | | `increment` | number | 1 | | 250 | 251 | 252 |
253 | 254 |
255 | 256 |
arithmetic.ts#L31
257 | 258 | ## sign (value: number, t: number): 1|0|-1 259 | 260 | Returns the sign of a number x, as +1, 0 or –1. 261 | 262 | | Name | Type | Default | Description | 263 | | --- | --- | --- | --- | 264 | | `value` | number | | | 265 | | `t` | number | ... | | 266 | 267 | 268 |
269 | 270 |
271 | 272 |
arithmetic.ts#L228
273 | 274 | ## square (x: number): number 275 | 276 | Squares a number. 277 | 278 | | Name | Type | Default | Description | 279 | | --- | --- | --- | --- | 280 | | `x` | number | | | 281 | 282 | 283 |
284 | 285 |
286 | 287 |
arithmetic.ts#L196
288 | 289 | ## toFraction (decimal: number, precision: number): Array<number> 290 | 291 | Returns an [numerator, denominator] array that approximated a `decimal` to 292 | `precision`. See http://en.wikipedia.org/wiki/Continued_fraction 293 | 294 | | Name | Type | Default | Description | 295 | | --- | --- | --- | --- | 296 | | `decimal` | number | | | 297 | | `precision` | number | ... | | 298 | 299 | 300 |
301 | 302 |
303 | 304 |
arithmetic.ts#L114
305 | 306 | ## toOrdinal (x: number): string 307 | 308 | Converts a number to an ordinal. 309 | 310 | | Name | Type | Default | Description | 311 | | --- | --- | --- | --- | 312 | | `x` | number | | | 313 | 314 | 315 |
316 | 317 |
318 | 319 |
arithmetic.ts#L153
320 | 321 | ## toWord (n: number): string 322 | 323 | Spells a number as an English word. 324 | 325 | | Name | Type | Default | Description | 326 | | --- | --- | --- | --- | 327 | | `n` | number | | | 328 | 329 | 330 |
--------------------------------------------------------------------------------