Atom package for evaluating mathematical expressions using Math.js as interpreter.
When working with a buffer, just write an expression to be evaluated like 3 + 2
or cos(pi)
, then press the default hotkey ctrl-alt-m
and the output will be
inserted in a new line.
More complex expressions can be evaluated too.
f(x) = x^2 + log(x)
> saved
f(3)
> 10.09861228866811
g(x, y) = 2 + y + f(x)
> saved
g(2, 3)
> 9.693147180559945
atom-math
is also able to evaluate some inner commands that will not evaluate
any expression through Math.js
.
Inner commands can be triggered with /
at the beginning. Commands implemented so
far are:
printFunctions
returns a list of all the functions defined in the historyclearHistory
empties the history contentclipHistory
copies history into clipboardhelp
prints the full command list
f(x) = 1 + 3 * x
> saved
g(x) = 1 - 3 * x
> saved
/functionList
>
f(x) = 1 + 3 * x
g(x) = 1 - 3 * x
/help
> Full command list below
functionList - Print a list of all defined functions
clearHistory - Empty the history
clipHistory - Copy history into clipboard
help - Print the full command list
Definite integration may be executed in atom-math
with the usage of
this awesome
package from scijs. This feature is still
unstable, so it does not behave as expected when provided evaluation
points are floating point. Please refer to this issue to get some examples of how the malfunction can manifest.
The current integrate function status will be tracked here.
A simple integration usage example follows:
f(x) = x + 3
> saved
integrate(f, 0, 10, 0.1)
> 80
Command history can be navigated by using ctrl-up
and ctrl-down
. Browsing
the command history implies that the current line is emptied and replaced either
with a command when any is available in that direction, or with an empty line.
Please feel free to contribute anyway you feel might be useful. New feature suggestions or merge requests are more than welcome!