Advertisement |
js("your JS code here")
helper function. You can also pass your defined matrices and arrays to this JS function to perform some of the work in the friendly JavaScript environment.What is the "Math Studio" extension and how does it work?
This extension is meant to replace your need to a native mathematical software if you don't need intensive calculation power (not that it is not capable of!). The extension is integrated with two powerful libraries that can fulfill the normal mathematical needs. You can also add custom JavaScript functions to the computational sandbox to enrich your environment to your needs. Read the relevant FAQ for more info. To compute a simple expression, write the expression in a new computational box and press the Enter key. If you need to write in multiple lines, use the Shift + Enter shortcut to switch to a new line without performing the computation. To move to the previous box, use the UP key and to go to the next one use the DOWN key. You can edit a box and re-compute it with the Enter key. Note that the extension creates a sandbox for each window, so to write complex expressions, you can define different things in different boxes like variables in the first box and so on.
recommended "Reader View" extension for Chrome, Safari, Edge, Opera and Firefox browsers.
The "Reader View" extension improves readability by removing clutter like buttons and background images, and adjusting text layout and contrast. It uses Mozilla's Readability library and has a Firefox-style interface. Features include highlighting, note-taking, quick editing, and saving or printing in HTML, Markdown, or screenshot format. Read more here.
What are the supported math functions?
The extension supports all the functions that are available in the mathjs environment. To get help with each function, type help("function_name")
and press the Enter key.
Construction functions:
Expression functions:
Arithmetic functions:
Bitwise functions:
Combinatorics functions:
Complex functions:
Geometry functions:
Logical functions:
Matrix functions:
Probability functions:
Relational functions:
Set functions:
Special functions:
Statistics functions:
String functions:
Trigonometry functions:
Unit functions:
Utils functions:
How can I plot an array or several arrays with this extension?
This extension has a plotting utility exposed to the mathjs environment which helps with your plotting needs. The format of the function is plot(datasets, labels, type, options)
. The datasets array is the actual data that needs to be plotted. The other arguments are optional. Note that this function by default uses "line" type plotting. Other supported types are "pie", "doughnut" and "bar" (see the example section). You can group multiple plots by appending your plotting data to the datasets array. Also, you can change the color of each plot with "backgroudColor" and "borderColor" keys. See the following examples:
simple line plot
plot(1:10, 'line')
simple line plot that is combined with a math function
plot(sin(1:10), 'line')
simple bar chart
plot([10, -30, 40], 'bar')
simple pie chart
plot([10, 30, 40], 'pie')
#simple doughnut chart
plot([10, 30, 40], 'doughnut')
you can use {x, y} objects to provide the x axis and y axis data
plot([{data: 1:10}], 'line')
how to add label to each plot and change the background color. Also we have two plots in a single group
plot([{
data: [{x: 1, y: 1}, {x: 2, y: 2}],
backgroundColor: 'blue',
label: 'one'
}, {
data: [{x: 1, y: 1}, {x: 2, y: 3}],
backgroundColor: 'red',
label: 'blue'
}], 'line')
grouping a bar plot
plot([{
data: [1,2,3,4]
}, {
data: [1,2,3,-4]
}], 'bar')
a "doughnut" plot with labels and background color
plot('doughnut', [{
data: [10, 30, 40],
backgroundColor: ['red', 'blue', 'green']
}], ['plot a', 'plot b', 'plot c'])
use a JavaScript function inside our plot
plot(js("x => x.map(() => Math.random())", 1:10))
What's new in this version?
Please check the Logs section.
Is it possible to add a custom function to the mathjs environment for later use?
This extension supports executing user-defined JS code with js()
format. If your JS function is big or you might need it later, write your JS code in a *.js file and drop the file into the window whenever it is needed! This way it will get executed and all the methods will be accessible in the current window. For instance to add a custom function to the mathjs environment write the following code in a *.js file and drop the file into the window. Now call the function like all other math functions
// import to mathjs context
math.import({
myFunction: m => alert(m),
mySecondFunction: x => x + 1
});
Note: to use the js()
function, always surround the JS code with double quotes. This is the standard string format in the mathjs.
How can I get more info about usage of the function?
Use help("the function name")
in a new computational box and hit the Enter key.
Please keep reviews clean, avoid improper language, and do not post any personal information. Also, please consider sharing your valuable input on the official store.
Permission | Description |
---|---|
storage | to save internal preferences |
contextMenus | to add context menu items to the browser action button to switch mode from the page to the popup mode and vice-versa |