Howto en
Howto en
Content
Fx-Calc – universal desktop calculator for Windows............................................................................... 3
Unique features: .............................................................................................................................. 3
Installation ............................................................................................................................................... 4
Basic concept ........................................................................................................................................... 6
Short reference table .............................................................................................................................. 7
Simple calculations .................................................................................................................................. 8
Calculation with functions and brackets ............................................................................................... 10
Self defined Functions ........................................................................................................................... 11
Calculation with memory ...................................................................................................................... 12
Sum and Product ................................................................................................................................... 13
Further functionalities ........................................................................................................................... 14
Analyse functions .............................................................................................................................. 15
Root calculation, solve functions................................................................................................... 15
Local extreme points: .................................................................................................................... 16
And finally the pole-points: ........................................................................................................... 17
Tangent calculation ........................................................................................................................... 18
2D function plots ............................................................................................................................... 19
3D function plots ............................................................................................................................... 23
Linear regression ............................................................................................................................... 25
Combinatory calculations .................................................................................................................. 26
Constant values DB................................................................................................................................ 27
Root calculation................................................................................................................................. 28
Extreme values .................................................................................................................................. 30
Definite integral................................................................................................................................. 30
Pole point calculation ........................................................................................................................ 31
Missing poles, roots, extreme values ................................................................................................ 31
A message from developer ... ................................................................................................................ 32
2
Fx-Calc How-To 05/2016
fx-Calc let's you define, analyze, visualize and calculate scientific functions and is a full featured
replacement and/or enhancement of the old fashioned Windows calculator. In addition to
calculation and visualization you can analyze and solve scientific functions and perform linear
regression.
Even if the Window concept may not look advanced, it provides the big advantage to open similar
windows multiple times and compare the results as needed. This application requires less than
750kbyte memory and is smaller than the windows integrated calc.exe.
To use the interpreter DLL in your own projects, you can obtain a copy and documentation of this DLL
directly from the author.
Unique features:
3
Fx-Calc How-To 05/2016
Installation
System requirements:
4
Fx-Calc How-To 05/2016
The setup creates an entry in the start menu and offers the optional creation of a desktop icon. In
addition, the uninstaller is being integrated in the programs section of the system control menu. If no
files for your own functions and constants exist, they will be created with initial content. Existing data
from previous versions will be migrated to the new version automatically.
In addition to the shortcut to the program a further shortcut will point to this documentation, which
therefore is offline available:
Fx-Calc contains a function for automatic update checking. If a new version is available this
functionality will offer a shortcut to download the new version at application closing. This kind of
internet communication is read only, which means fx-Calc isn’t sending any data from your pc to the
internet.
5
Fx-Calc How-To 05/2016
Basic concept
Each calculation starts with the input of the expression in the text box.
fx-Calc calculates your results immediately while you type. The format of mathematical expressions is
similar to BASIC and function buttons help to insert functions in correct writing.
In case of any errors in your mathematical expression fx-Calc will display a more specific error
message. It disappears automatically as soon as the expression isn’t containing anymore errors.
IMPORTANT:
Fx-Calc is making use of the normal scientific calculation logic, called DAL – Direct Algebraic Logic. So
“*” and “/“ is executed prior to “+” and “-“, example:
4 + 5 * 3 = 19 and not 27 !
This is how mathematical terms have to be calculated and somehow different from a simple
accounting approach, where you would execute each calculation step by step – regardless of the
correct hierarchy.
6
Fx-Calc How-To 05/2016
7
Fx-Calc How-To 05/2016
Things to consider:
• A general rule is, if you are uncertain about the need of operators and brackets, use brackets
and operators where it makes your expression clear.
• - / * hierarchy
• Input is case sensitive
• Complex values must always contain both, real and imaginary part – brackets can help to let
you consider this, but they are not required)
• This calculator is very tolerant for missing multiplication operators, but using it is reducing
the chance of wrong calculation
• You can use all different types of brackets and work with space, if this helps to improve the
readability of your expressions
Simple calculations
For simple calculations, enter the desired task in the text field - the calculation is happening while
you type. fx-Calc is processing expressions using dash-dot hierarchy.
Example:
8
Fx-Calc How-To 05/2016
Or
You can use the scientific number format, example: 5e-5 is equal to 0.00005.
Furthermore fx-Calc is supporting complex numbers using the following format:
r +/- i z
For doing complex number calculation fx-Calc provides functions to conjugate a complex number and
to calculate the reciproc value of a complex number. A typical example is to calculate the square root
of a negative number:
9
Fx-Calc How-To 05/2016
Example:
All implemented functions can be found on most scientific calculators and by moving your mouse
pointer over the function buttons you get hints on the specific function. A special case is to calculate
other roots than just square root. The following both examples are showing how this can be simply
achieved using the power function, y^x. (examples for 3rd and 4th root)
10
Fx-Calc How-To 05/2016
The easiest way to get familiar with this capability is to use some examples:
All variable values (in our example x1 and x2) can be changed to calculate new function results.
Every Function can be stored in the function database, which allows recalling a function by simply
double clicking the desired entry.
11
Fx-Calc How-To 05/2016
Important: By double clicking the selected item this will be pasted into the calculator immediately.
This applies to all three database windows.
MR recalls the value and inserts it in the editor window and MC is clearing the value to 0.
12
Fx-Calc How-To 05/2016
To sum up all number from 0 to 100 you simply need the following expression:
X can be set via the corresponding variable field, which again is automatically activated.
Even if as well n is recognised and offered as variable field, any value in this field will be ignored and
overwritten by the values from the expression.
S(0;100;f(n,x)=n/(x+n)) contains the following elements:
• S stand for sum (P for product)
• start with n from 0
• to 100
• use the following expression f(n,X)=n/(X+n)
As mentioned, this is exactly the same for products - just use "P" instead of "S".
If the second parameter in our example is set to 0 fx-Calc will run the sum or the product until the
STOP button was pressed by the user.
( of course a mathematical exception would stop this process as well )
13
Fx-Calc How-To 05/2016
All four buttons for sum and product can be found on the left upper corner of the fx-Calc keypad.
While this calculator is performing all calculations while you type, this isn't happening for sum and
product. The reason is obvious: the number of required iterations.
Therefore you need to click the green RUN button to get your calculation launched.
Prominent examples for sum calculations are Pi and a formula for Panini stickers:
Pi: S(0;1000;f(n)=((-1)^n/4^n)(2/(4n+1)+2/(4n+2)+1/(4n+3)))
Panini: S(1;640;f(n)=640/n) … for a total number of 640 different stickers
Further functionalities
fx-Calc provides extended capabilities to:
• plot functions in 2D and 3D
• solve and analyse functions
• perform linear regression
• assist with combinatory calculations
Each of those modules starts with an integrated example, which illustrates the parameters and input
formats per module. All examples can be easily changed and applied to your specific demand.
Important hint:
All extended modules contain integrated methods to validate all input fields on a form. If the form
should contain invalid input content, it disables all calculation capabilities and enables them again as
soon as all errors are corrected. Errors are indicated by:
• red text colour in text boxes
14
Fx-Calc How-To 05/2016
Analyse functions
Analysing functions can be time consuming, specifically for more complex expressions. fx-Calc
provides capabilities to look for multiple roots and local extreme values within a defined interval. All
this is based on numeric algorithms, making use of scanning a given interval for sign changes of a
function or a derivation of it. This is very flexible and stable - but has on the other hand few
limitations. So using reasonable interval boundaries and parameters is often very important.
Furthermore you should use the function plot to verify the solution. The fx-Calc fx analyse module
provides you with:
- roots for functions
- local extreme points
- pole points
- definite integral
- tangent and interactive Newton iteration
Important: The definitions on the function tab will be used in all other tabs. So if you wish to change
your function or the setting for trigonometric functions you must do this on the function tab.
Solving equations is very simple by just changing the target value in the root tab:
15
Fx-Calc How-To 05/2016
The results for roots, local extreme points and pole-points are displayed in tables, allowing a direct
export to the clipboard by using the little button in the right upper corner of each table. You can
paste the content directly in Excel or other documents.
16
Fx-Calc How-To 05/2016
The function plot tab let’s you verify the correctness of all numerical results and provide an
overarching understanding on the functions characteristics within the defined interval:
17
Fx-Calc How-To 05/2016
Another functionality of this module allows calculating the definite integral of an function:
fx-Calc allows to open multiple instances of this window at the same time to compare different
scenarios.
Tangent calculation
Calculating tangent equations is based on the numerical calculation of the first derivate of given
function f(x) at a specific point x. The starting point x is usually the average of the interval for the
function analysis and can be easily changed by adjusting the value in the first text box. For
reasonable results the function needs to be able to be differentiated within the defined interval.
18
Fx-Calc How-To 05/2016
Fx-Calc calculates the tangent equation and provides the possibility to transfer the equation directly
to the calculator window to use it for further purpose. On top of this you can use the “do next
Newton step” button to perform step wise Newton iteration. While doing so, you can observe how
the tangent is getting closer to the next solution for the given function. In most cases the procedure
is fairly quick and in this example it took only 5 steps to get to a close result.
2D function plots
Function plots allow plotting one or multiple functions in one plot area. fx-Calc is plotting the table
content and the editor field content. By using the checkboxes on the bottom of the input window it
allows to select the following options:
• plot just the editor function (default)
• plot all functions from table
• plot both, editor and table functions
Using upper and lower limits for f(x) might help to visualise functions with significant differences for
f(x). Another new feature is to plot parametric functions, which allows visualising the specific
behaviour of a function in dependence to a specific parameter.
19
Fx-Calc How-To 05/2016
To change a function or its options click on the function in the table and the input dialog is
automatically connected to the current selection. Any function change or adjustment of options
changes the corresponding table field immediately. This modus is indicated by a changing
background colour and the changing headline on top of the editor field:
20
Fx-Calc How-To 05/2016
In order to leave this mode you just have to click on an empty row in the table.
Another new and unique option is to plot functions using complex numbers. In this case fx-Calc is
plotting two function graphs, one for the real - and another one for the imaginary part of the
complex function result. Furthermore you can extend the plot by the derived function. So bottom
line you can visualise in one chart:
- multiple functions (editor field and table)
- each with the following options:
o derived function
o complex extension (imaginary part)
o second result for square root
o deg/rad for trigonometric functions
- if needed, limited by defined boundaries
To visualise parametric functions the second tab provides you with a dialogue to define:
- the number of functions to plot
- start value for the parameter
- end value for the parameter
- colours
- the interval
- limiting boundaries
21
Fx-Calc How-To 05/2016
For the parametric function chart fx-Calc allows for up to 40 parameter steps per chart. A graphical
cursor allows seeing the coordinates for a specific point in this chart.
22
Fx-Calc How-To 05/2016
fx-Calc allows to open multiple instances of this window at the same time to compare different
scenarios.
3D function plots
Within this module you can visualise 3D function plots for Z = f(x,y).
OpenGL provides real time manipulation by using the hardware accelerated graphics interface of
your PC. Fx-Calc is allowing for two different methods to define your 3D object:
- define your object as function z (x,y) or
- define x, y and z as vector, defined by the polar coordinates r and phi
(This will not work on PC's without an OpenGL driver installed on your hardware.)
Similar to 2D plots 3D plot provides the possibility to set limits for your Z - values.
In result of those definitions you will get the following 3D chart:
23
Fx-Calc How-To 05/2016
- turn the 3D plot with your mouse by keeping the left mouse button pushed
- show this as grid instead of the collard surface
- zoom in and out
- switch on auto rotation (move)
For the polar coordinate based model your dialogue and the corresponding 3D chart is as follows:
fx-Calc allows to open multiple instances of this window at the same time to compare different
scenarios.
24
Fx-Calc How-To 05/2016
Linear regression
In statistics, simple linear regression is the least squares estimator of a linear regression model with a
single explanatory variable. In other words, simple linear regression fits a straight line through the set
of n points in such a way that makes the sum of squared residuals of the model (that is, vertical
distances between the points of the data set and the fitted line) as small as possible.
As soon as the table contains two pairs of values, fx-Calc calculates the linear function and is plotting
the result. By using the copy button you can transfer the new function to the calculators editor
field to use it for calculations.
fx-Calc allows to open multiple instances of this window at the same time to compare different
scenarios.
25
Fx-Calc How-To 05/2016
Combinatory calculations
Sometimes we need to know the number of possible combinations of the elements of a quantitative
number of objects, extended by conditions like order and repeated use. Fx-Calc supports this with an
inbuilt assistant, making it very easy to make use of the correct formula. Just have a look at the
following self-explanatory screen shots:
26
Fx-Calc How-To 05/2016
Constant values DB
A small database allows storing of scientific constants. By double clicking a selected entry the
corresponding value will be transferred to the editor field and the database window will be closed.
Numerical methods
To calculate roots, solutions, definite integrals and extreme values there are generally two ways:
Firstly, a mathematical expression is being analysed (symbolic), resolved and calculated. This
provides the most accurate results and also provides a rule applicable to all the function in question
results. The disadvantage comes with increasing complexity, caused by nesting of functions and it
gets more and more difficult to derive an analytic expression. Specifically for definitive integrals we
have often the situation that we cannot get to an analytic expression. But even root calculations can
quickly come to this point.
The approach for fx-Calc was to enable this piece of Software to solve almost everything and the only
way of doing this is to look for numerical methods to get this achieved.
27
Fx-Calc How-To 05/2016
However, these have some general pre - and disadvantages, which you should know:
The disadvantages of numerical methods are:
• Necessary definition of the interval to be examined (anything outside of this interval isn’t
part of the results)
• A defined inaccuracy (termination criterion for required iteration)
• roots higher order are not identified as such
Apart from result verification this chart is gives an immediate idea how a specific function behaves.
Root calculation
The calculation of roots (solutions for f(x)=0) is ultimately more complicated than one might think at
first glance. In addition to the sign change, there are special situations such as:
28
Fx-Calc How-To 05/2016
In a second step, the vertices of the function to be determined - is also numerically the difference
quotient. This will then also be investigated for roots.. The Newton method is not applicable because
this converges only in the immediate vicinity of a root and presupposes a continuously differentiable
function.
The calculation of the roots is also used directly for the search of solutions for f (x), since the target
function can be simply defined as:
0 = f (x) - target
This is being analysed by applying exactly the same methods as just explained for roots.
roots
29
Fx-Calc How-To 05/2016
Extreme values
The calculation of the extreme values follows the already known from the roots pattern, whereby
also here values and transformation of intervals is being used. However, formation of the second
derivative on the difference quotient can be quickly unstable
unstable and, therefore, has been omitted in
favour of the stability on the investigation of peaks of the second derivative. This also explains why
fx-Calc does not calculate turnaround points.
points. In any case only the change of sign of the first
derivative is relevant
ant to "real" extremes. Again, apply again the identical pre - and disadvantages, as
already discussed in the roots section.
section
Definite integral
Definite integrals are more frequently the subject of numerical methods than roo ots and extreme
values, since here too often no analytical solution is providing the primitive function F (x).
In the concrete case fx-Calc
Calc uses the tendons trapezoidal formula, which already delivers at 1,000
subintervals a very high accuracy:
The results of the numerical methods were tested with PTS Mathcad Prime using different functions.
30
Fx-Calc How-To 05/2016
For the calculation of poles that function in the denominator of a fractional rational function = 0
while the counter must not be equal 0. So Fx-Calc breaks the function in the denominator and related
counters. In a next step the roots of the denominator are being determined using the method
already presented and tested whether the counter of the calculated denominator zero is not equal 0.
If this is the case, it is a pole. The limitation here is the accuracy of the zeroing calculation and use of
this is not 100% accurate information to answer the question whether the counter is 0.
Fx-Calc solves this by the question is answered with "yes" when the absolute value of the counter
function of the denominator root is less than 1e-5.
In addition, a second pole point condition is using the trigonometric tangent function. Fx-Calc is
determining the solutions for the tangent function argument, which would present a pole if it is an
equivalent of pi/2.
All the described methods have been tested and adjusted to gain the best possible reliability.
Nevertheless it can happen to miss an expected result and this is emphasising the importance to
validate results by comparing them by looking at the visualised functions. If the chart is showing
characteristics that haven’t been found by the numerical methods you can try to repeat the
numerical methods with adjusted parameters:
• The first way is to increase the number of sub-intervals and thus perform a more accurate
scan of the function.
• Other possibilities are
o Adjust the interval for the function
o Change the precision parameter
Of course, the combination of all approaches provides a further improvement in the chances of
success. In case of an adjusted precision you should be certain about the things that you are doing
here:
Accuracy with a deviation of less than 1e-15 are practically not useful, as this would exceed the
precision used in the Double data type - the computer will no longer be able to find solutions.
Critical applications are functions with very small or very large value ranges:
- | F (x) | <1e-50
- | F (x) |> 1e + 100
The software optimises itself in these cases by transforming the function values accordingly.
However, that does not always work. The critical look at the graphic output shows whether you
should not work better with a self defined scaling factor here.
31
Fx-Calc How-To 05/2016
Fx-Calc can be a very powerful tool and its focus on functions rather than algebra has good reason.
Most of statistical and algebraic calculation is anyway part of spread sheet software, just like Excel or
Open Office. So I didn’t see much value in implementing this over and on top of what is included
today.
My second point was to design the application to make it as easy as possible to use this tool for your
calculation demand. And I think this is achieved.
I'd like to ask for your feedback, specifically if you think something could be better or is going wrong,
this will help me to improve the application for you.
32