Skip to content

houbysoft/hc

Repository files navigation

HC -- HoubySoft Calculator readme
=================================
(c) Jan Dlabal, 2009-2010. Provided under the GNU GPLv3, see LICENSE for more information.
http://hc.houbysoft.com/
http://houbysoft.com/

The objective for this program is to provide a calculator with a simple and easy-to-use interface, similar to a command prompt, but a lot of options and abundant functions.

You can also type "help" in the command prompt if you need any help - or contact me (http://houbysoft.com/en/about.php).

RELEASE NOTES
=============
6.0
  - completely new graphing interface that is much easier to use
  - added (interactive) zooming and moving to all 2D graphs in the GUI
  - added way to change graph labels, both from command line and in the new graphing interface
  - more conversions added, conversion menu improved - now the second item will contain only units filtered according to what was selected as the input unit
  - added graphpolar() to make it easier to draw polar graphs
  - added matrix multiplication
  - many small fixes and optimizations
5.1
  - unified conversion functions into convert(), and made the whole conversion system more versatile and easy to extend
  - in the Windows GUI, automatic updates were added and integrated directly into the main executable
  - many internal changes and optimizations
  - a few bugfixes and feature requests done (#0017/1, #0016/2, #0015/2)
5.0.1
  - added gamma() function (feature request #0015/1)
  - added Ctrl+Q shortcut to quit GUI (muunleit's feature request)
  - added graphpoints()
  - added log(base, x) function (feature request #0017/2)
  - small bugfixes and adjustments, code improvements
5.0
  - complete rewrite of GUI now using Qt instead of GTK
    - cleaner interface
    - improved help system
    - possibility to open more than one window (only one thread can run at any one time though, for now)
    - added a script editor
    - other small improvements
    - better responsiveness, as Qt threads are now used for doing computation, update checking, etc.
  - added count() to count number of occurences of an element in an array
  - added kgtolbs() and lbstokg()
  - various small fixes
4.0.1
  - added history support with up/down arrows to the GTK GUI
  - small code improvements
4.0
  - added some functional programming -- lambda functions, map()
  - added linreg() to do linear regressions of data
  - made stats() and boxplot() more consistent
  - added graphvalues() to draw tables of values
  - added sort(), range()
  - win32: added updater program to the GUI version
  - bugfixes and other minor changes
3.1
  - added more detailed syntax error messages
  - fixes and enhancements to vectors; for example, it is now possible to use assignment by index (ie. v[2] = 3)
  - on *NIX, it is now possible to use ~ in filenames and it will get properly expanded
  - added zeros() and ones()
  - bugfixes
3.0
  - completely new help system with the help() function
  - completely new control structure system -- control structures are now functions. Why? No new syntax to learn for newbies, easier (therefore faster) parsing, consistent syntax.
  - added -e command line argument for direct evaluation from cli arguments
  - numbers can now be also entered in hex (with the 0x prefix) and in binary (with the 0b prefix)
  - added a few synonyms : quit for exit, and arc* for asin, acos, atan
  - added join() to join lists/vectors
  - added re()/real() and im()/imag() to get only real / imaginary part of a number
  - logic operators precedence bugfix, and added ! as the logical NOT operator
  - added codetochar() and chartocode() to work with character codes and made strings indexable
  - added length() to get length of lists/vectors and strings
  - many bugfixes, optimizations, etc.
2.0:
  - added vectors; they can be used with normal operators where appropriate, and can also be used with functions crossP() and dotP().
    example usage : crossp([1,2,3],[4,5,6])
  - added graphpeq() to draw parametric equations
  - added slpfld() to draw slope fields
  - a few bugfixes and optimizations
1.2:
  - extended string support; now it is possible to concatenate strings simply using the '+' operator, and multiply strings and integers using the '*' operator
  - added str() and num() functions for conversion between numbers and strings
  - a few optimizations
  - fixed a bug with nested for loops
1.1:
  - added basic string support and the function mmass() which expects a string as its first argument, a valid molecule, and returns its molar mass
  - added input(), a function to request user input mainly in programs
  - added write(), a function that behaves like print(), but writes to a file, which needs to be specified as its first argument
  - print() and write() can now also print strings
  - added possibility to pass a filename to hc (CLI only) which will then be executed
  - some fixes and optimizations
1.0:
  - added boolean/logic operators : < > <= >= == != | || & &&
  - added a simple programming language - including if (else), for, and while control structures - for more info, type "logic" in hc or visit http://houbysoft.com/hc/logic.php
  - added the print() function for printing inside loops, etc.
0.9.4:
  - added \load - a direction that allows you to read in a text files with HC commands, definitions, etc. Can be used for example for storing functions that you use often, etc.
  - added rand() and round()
  - rewrite of a part of the hc_result_() function; should now be faster for the most common case, and also provides "better" (==more informative) error messages to the user
  - small bugfix for user functions/vars with names including numbers
0.9.3:
  - added implied multiplication support (for example you can now type 2sin(5))
0.9.2:
  - added gmul() - graph multiple 2D functions in one frame/image
  - fixed discontinuities bug (due to the fact that previously I was checking for discontinuities by looking whether hc_result_() returned an error - but since I added complex numbers, things such as sqrt(-1) no longer give an error, yet are impossible to draw on a 2D graph)
0.9.1:
  - only minor change : graph() and graph3() now 'remember' the last xmin, etc. provided, and can then be used without those to use the last ones - xmin, etc. are now optional arguments
0.9:
  - added statistics with functions stats(), statseff(), boxplot(), boxploteff()
  - bugfix
0.8:
  - added support for complex numbers
  - added support for engineering notation
  - added floor() and ceil()
  - bugfixes
0.7:
  - added 3D graphing support with the graph3() function
  - added tab-completion using GNU readline
0.6.1:
  - added better editing capabilities with GNU readline and history
  - small bug fix
0.6:
  - added graph generation (generates a PNG file in command-line) - see graph() function
  - bugfixes
0.5:
  - added support for user-defined functions
  - added support for user-defined variables
  - many bugfixes
0.4.2.1:
  - fixed a bug in the syntax-checking function
0.4.2:
  - created a GUI version (Linux, Windows experimental)
  - squashed a few bugs
0.4.1:
  - added support for the '!' notation for factorial
  - added support for the C-style '%' notation for modulus
  - added a new function : totient()
0.4:
  - all functions are now in high-precision - including sum(), product(), nCr() and nPr()
  - the calculator does not quit now after syntax errors, only shows a message (finally :)
  - added a cbrt() function; remember though that you can also use x^(1/n) etc. to get the nth root of x
0.3.1:
  - important internal changes in the hc_postfix_result function, now stack elements are allocated dynamically
  - fixed a bug with very large numbers
  - added g (9.80655) and a well-known h2g2 constant :)
0.3:
  - added a few new constants
  - big change - constants are now 'fully' supported, ie you don't have to use constant_name(), just constant_name, for example "pi" instead of "pi()"
  - fixed a bug in the strreplace function which caused malfunctions when attempting to calculate for example sum(exp(x)+x,1,5)
  - fixed a bug in the syntax checker
  - added a "credits" command which displays credits and license info
  - updated compiling instructions, finally :)
0.2.5:
  - added some other conversion functions - mltofloz(), floztoml(), inchtocm(), cmtoinch(), mtoft(), fttom()
  - added the command "conversions" which will print the list of the converter functions
0.2.4:
  - added commands to switch between RAD / DEG / GRAD modes (\rad, \deg and \grad)
  - added some conversion functions - ctof(), ftoc(), ctok(), ktoc(), ftok(), ktof(), mitokm(), kmtomi() -- see functions list for details
  - now hc announces its configuration in a smaller, one-line format :)
0.2.3:
  - added a function to generate the fibonacci numbers sequence : fibo()
  - another small change to improve stability
0.2.2:
  - improved stability, bug fixes
  - included functions to prevent overflows in the result buffer if you supply very large expressions as input
  - "locked" precision to 128 decimal places maximum for improved stability    - and default constants in MAPM are ~128 decimal places accurate only anyway
0.2.1:
  - greatly improved precision for most functions and basic arithmetic using the MAPM (arbitrary precision math) library (http://www.tc.umn.edu/~ringx004/mapm-main.html) - default precision is 16 decimal places, but you can go very high - the maximum stable value right now seems to be 515 decimal places
0.2:
  - added RPN entry mode (to switch between RPN and infix notation, use \rpn)
  - added a configuration file - ~/.hc on Operating Systems and %APPDATA%\hc.cfg on Windows
  - added "exit" - because from now on if you use CTRL+C, configuration will not be saved
  - fixed a few bugs
0.1.6:
  - added two functions : lcm() and gcd()
  - fixed "syntax errors" when results are infinity or undefined (like 1/0)
0.1.5:
  - added two functions : sum() and product()
  - started implementing variables - for now you can only use x in sum and product, but this will definitively change in the future
  - fixed bad behavior with functions with a prepended minus sign, ie in older versions pi() + -pi() would give 6.283...; now it will correctly return 0
0.1.4:
  - function names are now all case-insensitive
  - added a convenience function - ans(), which will get replaced by the result of the last entered expression
  - changed the name of the binomc() function to nCr()
  - added nPr() - number of permutations (combinatorics)
0.1.3:
  - added new functions : binomc (binomial coefficient), exp, ln, log10
  - fixed an issue with "encapsulated" functions
  - changed output format - unnecessary 0's are not shown (ie 2.00... is shown as 2), and the program switches to an exponential notation when the results get large
0.1.2:
  - added help - simply type help in the prompt
  - added factorial
0.1.1:
  - added "Did you know?" tips (you can disable them with -DI_HATE_TIPS
  - a few new functions : abs, pi, acos, asin, atan, cos, sin, tan, cosh, sinh, tanh
0.1 :
  - This is the first public beta version
  - The core of the calculator is written
  - Only two functions are included as of now, but this will rapidly change
  - Because this is only a beta, bugs may be present - if you find any, please contact me using one of the methods at http://houbysoft.com/en/about.php.

FEATURES
========
Warning: this list may not be up to date. Hit TAB twice in HC (CLI) to get the complete list of functions, or use the menus in the GUI version.
All functions are implemented with the MAPM library allowing for high precision.
Constants are stored with 128 decimal places.

- RPN / infix modes of input
- simple operations (+,-,*,/,%,!)
- powers (use the ^ sign, for example 2^5)
- user-defined functions (see the USER-DEFINED VARIABLES AND FUNCTIONS section)
- procedural programming (for, while, if, etc.)
- functional programming (lambda functions, etc.)
- graphing
- statistics
- and much more.

To get all functions and constants, hit TAB twice in the CLI version or check the GUI's menus. To get help about any function, constant, or topic, call help("name of function or topic"), for example to get help about the linreg() function, enter help("linreg").


USER-DEFINED VARIABLES AND FUNCTIONS
====================================
From hc version 0.5, there is support for user-defined variables and functions in the calculator.
This is a brief description of how to use them and how they work.

Naming
------
Names must consist of only numbers and letters. The first character must be a letter.

Defining
--------
To define a variable, use this syntax:
VAR_NAME = VAR_VALUE
VAR_NAME is the variable's name (surprisingly), and VAR_VALUE is any valid expression.
So, for example, to define a new variable named x and having the value 27, you would type for example this:
x = 20+7+sqrt(0)
Then, you can use x in calculations, so after this definition, if you type x^2, you will get this answer:
> x^2
 729

To define a function, use this syntax:
FUNC_NAME(ARG1, ARG2, ..., ARGN) = EXPRESSION
FUNC_NAME is again the function's name, ARG1...N are its arguments, and EXPRESSION is the function's expression.
I'll give you an example again since I think this is the best way to demonstrate how to use this.
Let's say you want to create a function that will square its first argument, and you want to name it func. To accomplish that, you would type (for example):
func(x) = x^2
Then you can test your new function by typing for example func(3) in the prompt; you will get 9 as the answer.

Clearing
--------
If you want to clear all custom variables and functions that you defined, either restart the program, or type \clear in the command line version.
Please also keep in mind that you can always redefine a variable that you defined, so if you made for example a squaring function:
> func(x) = x^2
but then you want it to be a cubeing function, just type:
> func(x) = x^3

USAGE
=====
Source code:
  - download and install the MAPM library if you don't have it already
    (URL : www.tc.umn.edu/~ringx004/mapm-main.html)
  - download and install the plplot library if you don't have it already
    (URL : plplot.sf.net)
  - a simple "make" should then be enough
  - then run "./hc"
  - enter the expression of which you want to know the result, for example "1 + 2 * 3 / sqrt(mod(4,5))", and then press ENTER

Linux version:
  - run the "hc" binary provided in the package (either double click on it in your file manager, or open a terminal, then "cd" to the appropriate folder, and run "./hc")
  - enter the expression of which you want to know the result, for example "1 + 2 * 3 / sqrt(mod(4,5))", and then press ENTER

Windows version:
  - run "hc.exe"
  - enter the expression of which you want to know the result, for example "1 + 2 * 3 / sqrt(mod(4,5))", and then press ENTER

About

An open source calculator with a simple and easy-to-use interface, similar to a command prompt, but a lot of options and a multitude of functions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages