Back to functions
nerdamer.set
set
Some settings within nerdamer can be changed if needed to accommodate your current needs. Below is a table and
a description of the settings which can be changes.
Setting |
Default |
Description |
IMAGINARY: |
i |
Use this to set the letter used for imaginary numbers. For instance for using 'j' instead of 'i' for imaginary numbers |
VALIDATION_REGEX |
new RegExp('^[a-z_'+
'αAβBγΓδΔϵEζZηHθΘιI'+
'κKλΛμMνNξΞoOπΠρPσΣ'+
'τTυϒϕΦχXψΨωΩ][a-z\'+
'd\_αAβBγΓδΔϵEζZηHθΘ'+
'ιIκKλΛμMνNξΞoOπΠρPσ'+
'ΣτTυϒϕΦχXψΨωΩ]*$','i')
|
This regex is used to validate variables. Changes this to allow other characters to be used. Caution: this might break the library
so proceed carefully. |
PARSE2NUMBER |
false |
Forces evaluation to a number for functions and variables |
SOLVE_RADIUS |
1000 |
The distance around a suspected root within which nerdamer searches for a root numerically. |
ROOTS_PER_SIDE |
5 |
When numerically searching for roots nerdamer stops if either this number is satisfied or the distance is exceeded. |
SYMBOLIC_MIN_MAX |
false |
The library returns a symbolic min or max e.g. min(sqrt(2), sqrt(3)) returns sqrt(2) |
SOLUTIONS_AS_OBJECT |
false |
Set to true to have solutions returned as an object instead of an array when using nerdamer.solveEquations |
USE_MULTICHARACTER_VARS |
true |
When this is set to false nerdamer will treat each letter as a variable so the input 'six' will be treated as 's*i*x' |
integration_depth |
10 |
When integrating nerdamer makes recursive calls. Nerdamer will stop searching for a solution after this many recursive calls.
Be careful as setting this too high may result in poor preformance |
Laplace_integration_depth |
40 |
Because Laplace transforms typically need more room to calculate the transform, this number
needs to be higher than integration_depth. It's strongly recommended to never set this number lower than 40. |
Usage: nerdamer.set(setting, value)
Parameters
setting
setting
|
The setting to be changed |
VARIES
value
|
The value to set the setting to. Pass in an object for multiple settings. |
Returns
nerdamer
nerdamer.set('PARSE2NUMBER', true);
var x = nerdamer('cos(9)+1');
console.log(x.toString());
nerdamer.set('IMAGINARY', 'j');
x = nerdamer('sqrt(-1)');
console.log(x.toString());