b3by / atom-math

Atom package for evaluating simple mathematical expressions using Math.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

atom-math

Build Status Dependencies! Plugin installations! Package version! License!

atom.io pkg

Atom package for evaluating mathematical expressions using Math.js as interpreter.

Simple expressions

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.

Example

Functions

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

Inner commands

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 history
  • clearHistory empties the history content
  • clipHistory copies history into clipboard
  • help 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 (:exclamation::exclamation:EXPERIMENTAL❗❗)

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.

integrate(functionName, startPoint, endPoint, tolerance)

A simple integration usage example follows:

f(x) = x + 3
> saved
integrate(f, 0, 10, 0.1)
> 80

Command history

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.

Like what you see?

Please feel free to contribute anyway you feel might be useful. New feature suggestions or merge requests are more than welcome!

About

Atom package for evaluating simple mathematical expressions using Math.js

License:MIT License


Languages

Language:CoffeeScript 98.0%Language:CSS 2.0%