simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

config.md (1466B)


      1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
      2 
      3 # Function config
      4 
      5 Set configuration options for math.js, and get current options.
      6 Will emit a 'config' event, with arguments (curr, prev, changes).
      7 
      8 This function is only available on a mathjs instance created using `create`.
      9 
     10 
     11 ## Syntax
     12 
     13 ```js
     14 math.config(config: Object): Object
     15 ```
     16 
     17 ### Parameters
     18 
     19 Parameter | Type | Description
     20 --------- | ---- | -----------
     21 `options` | Object | Available options: {number} epsilon Minimum relative difference between two compared values, used by all comparison functions. {string} matrix A string 'Matrix' (default) or 'Array'. {string} number A string 'number' (default), 'BigNumber', or 'Fraction' {number} precision The number of significant digits for BigNumbers. Not applicable for Numbers. {string} parenthesis How to display parentheses in LaTeX and string output. {string} randomSeed Random seed for seeded pseudo random number generator. Set to null to randomly seed.
     22 
     23 ### Returns
     24 
     25 Type | Description
     26 ---- | -----------
     27 Object | Returns the current configuration
     28 
     29 
     30 ## Examples
     31 
     32 ```js
     33 import { create, all } from 'mathjs'
     34 
     35 // create a mathjs instance
     36 const math = create(all)
     37 
     38 math.config().number                // outputs 'number'
     39 math.evaluate('0.4')                // outputs number 0.4
     40 math.config({number: 'Fraction'})
     41 math.evaluate('0.4')                // outputs Fraction 2/5
     42 ```
     43 
     44