Home
Blog
Downloads
Photos
Resumé
Stuff
Firefox
OpenOffice.org
Valid HTML 4.0 Transitional
Valid CSS

Paradox



Description

Paradox is an engine (or API, if you prefer that term) which handles all the dirty work of parsing and evaluating infix mathematical expressions. It was written as this school year's (2002/2003) science project. The following is the project abstract:

Evaluating a mathematical expression such as “2 + 1.05e-18[(5^3(sin 4)(pi – 7 log2(3))]” is a unique challenge, even for a computer. Much of the challenge is associated with the act of cutting or “parsing” the actual text of the expression into a form that computers can understand. One method of doing this is with a recursive descent parsing algorithm, which builds an expression tree by recursively parsing an expression according to a special grammar.

Paradox is a set of Java classes I programmed with JDK v1.4.1 that will parse and evaluate a mathematical expression such as the one written above. It supports variables, functions, boolean operators, subexpressions, and developer-defined functions. I also created Calc4, a helper application. It provides a graphical user interface (GUI) for the Paradox engine, allowing the user to type in complex expressions and obtain the numerical answer. Calc4 also demonstrates the benefits of using a simple scripting language to automate routine calculations. Altogether, Paradox is a reliable, expandable engine that has many potential uses at the home, on the job and in the classroom.

So what does all this mean to you as the user? This means that by scrolling down and downloading the pdox_calc4.exe file below, you can install a multiline scientific calculator on your desktop. In addition, it executes scripts and graphs simple functions.

View Readme


Features

  • Supports all major operators (+, -, *, /, %, ^, ==, !=, <, >, <=, >=, etc.)
  • Supports many major functions (sqrt, sin, cos, tan, log, ln, rand, etc.)
  • Supports variables & constants (pi, e, x, y, z, fab, etc.)
  • Supports subexpressions contained by parentheses
  • Reports intelligent error messages
  • Allows developers to add their own custom functions

Demonstration Applet

The demo applet allows you to try out the Paradox engine without having to download the program first. If you are using a brower that properly supports Java applets, you will be able to use the engine directly from within your browser window.

View Applet


Download

The Calc4 program is available in two ways: as a ZIP and as a self-extracting EXE. If you don't know how to unzip and move files, just download the EXE (the first link) to your computer and double-click on it. Click "Unzip" in the window that opens and Calc4 (w/ Paradox) will automatically be installed in C:\Calc4. To run it, browse to the folder you installed to and double-click on "Calc4.exe".

You can also download the class files and source code for Paradox:

In addition, you can download the complete Paradox paper (~38 pages) in several different formats:


NOTE: This project requires that a Java Runtime Environment be installed on your system. If nothing happens when you try to launch the program, try installing the Java Runtime Environment before you send in an error report:

Java 2 1.4.2 SE Downloads


You will want to click "DOWNLOAD" in the "Windows Offline Installation" row under the "JRE" column in the second table.




Last modified: 11/26/06
Copyright (c) 2004 Michael Lam