Wiki

Clone wiki

Epsilon / Home

Overview

Epsilon is a text-based calculator written in Java. The UI is written with Swing.

General features:

  • Allows the definition of new variables, operators, etc.
  • Real-time syntax highlighting by parsing on a background thread.
  • Performs exact integer arithmetic in some cases, but some operations (such as sin, ln, etc.) will cause a conversion to 64-bit floating-point.

Switching over to BigInteger/BigDecimal is on my to-do list, but to be honest, I don't think Epsilon has much future as a Java desktop app, so I don't anticipate working on it much again. I really like using it, though.

epsilon_sshot_galaxy_fractions.png

Epsilon is free to use, open-source, and released under an MIT license:

Copyright (c) 2017-2018 David Staver

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

How to use

Download the .jar file and run it. You will need at least Java 8 installed, which should not be a problem unless you haven't updated it for a long time. If Windows doesn't automatically open the .jar, try downloading this .bat to the same folder as the .jar and opening it instead.

Epsilon will create a folder called EpsilonApplicationFiles in the directory the .jar is in. If you want to move the .jar to somewhere else, you can move the folder along with it. If the folder is deleted or missing for some reason, Epsilon will re-create it.

Brief tutorial

To use Epsilon as a calculator, type an expression in the text field at the bottom of the interface and press Enter. Epsilon has most of the typical operators and functions built-in.

How to use the := operator

:= is the assignment operator by default, which can be used to define new symbols. For example x := 2 defines a variable named x whose value is 2. Epsilon has the following kinds of symbols:

  • Variables, which are a name associated with a value. For example, pi is a variable. (Epsilon makes no semantic distinction between "variables" and "constants".)

  • Unary operators, which have a single operand. Unary operators can be either prefix (such as e.g. -x) or suffix (such as e.g. x!). Epsilon treats functions as unary prefix operators.

    An example of defining a new unary operator is p% := p/100 which defines a new operator %, which divides its operand by 100. (In other words, 50% would evaluate to 0.5.) An example of defining a new "function-like" unary operator is sq(x) := x*x.

  • Binary operators, which have two operands (such as e.g. x+y).

    An example of defining a new binary operator is (n)choose(k) := (n!) / (k!(n - k)!), where e.g. 4 choose 2 is 6.

  • "Span" operators, such as absolute value (i.e. |x|) and parentheses.

  • "N-ary" operators, which have two or more operands, such as the tuple-creating comma. (For example, x,y,z creates a tuple with 3 elements. Epsilon can e.g. work with vectors this way.)

Symbols can also be defined using the symbol editor. The symbol editor also has more options, such as precedence and associativity.

To delete a symbol, assign it to undefined. For example pi := undefined deletes the symbol pi, and f(x) := undefined deletes the function f. Symbols can also be deleted using the symbol editor.

How to use the ; operator

Expressions can contain an ordered sequence of sub-expressions via the ; operator. The ; operator works similar to the , operator in languages like C++ and JavaScript. In short, what this means is that an expression such as a;b is evaluated by:

  1. evaluating a,

  2. then evaluating b

  3. and the result is b.

The main usefulness of this is that it allows one to define "local" variables inside operator definitions. For example, f(a) := (b := (sqrt a); b*(b - 1)) defines a function-like operator which:

  1. defines b (locally) as the square root of a

  2. and the result is b*(b - 1).

In other words, e.g. f(9) would be equal to (√9)*(√9 - 1), or 3*2 which is 6. This could have also been written f(a) := (sqrt a)*((sqrt a) - 1), but variables are nice for more complicated functions.

Note that when a symbol is defined locally (such as b in the preceding example), it only exists when the surrounding operator is being invoked.

Updated