![]() |
Languages »
VB.NET »
General
Intermediate
License: The Code Project Open License (CPOL)
A multipurpose scientific calculatorBy kbsbngA calculator handling complex numbers and scientific functions |
VBWinXP, Visual Studio, Dev
|
||||||||||
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||

This is a scientific calculator involving many functions such as:
- Normal arithmetic operations.
- Functions such as factorial, permutation, combination etc.
- Scientific functions (sin, cos, sin-1, cos-1, sinh, cosh, sinh-1,etc.).
- Operations on complex numbers.
- Storage of values in variables and operations on these variables.
- Use of abbreviated form of representing values (such as m for milli, M for mega, etc.).
- Evaluation of simple series.
- Expressions involving any combination of the above.
Recursive parser:
The calculator uses a recursive parser for evaluation of expressions. A part of the recursive parser is represented in the diagram below. The parser uses a proper operator precedence. The complete precedence can be known by looking at the code.

Advantage of using the parser for expression evaluation
The complexity of procedure required is broken into many parts thus making each part simpler to understand and the overall structure robust. It becomes easier to to change the operator precedence implemented.
An alternative approach
We might use a stack to do the expression evaluation. But then, breaking down of the complexity to many procedures is not as straightforward as in the recursive function approach and we might stand to lose the advantages of the recursyve function approach.
Easy-to-use interface
The calculator provides an easy-to-use interface. The expressions can be entered easily using the keyboard or by clicking the buttons using the mouse. For expressions using variables(X,Y,A,B,etc.) and symbols like pi(π), it is better to use the mouse since these characters are special characters.
Display of evaluated value in fraction form
Values of expressions can be viewed in normal decimal form or in the fraction form. Default is the decimal form. To change to fraction form check the option fraction in the toolstrip menu options->display.
Display of evaluated value in polar form
Complex numbers can be viewed either in the default form(a+bi) or in the form rLθ. To change to polar form, check the option polar in the toolstrip menu options->display.
Angle measurements in different units
Angle measurements may be in degree, radian, or grade. The selection may be done using the DomainUpDown at the top right of the main form. This selection effects the trignometric calculations as well as the measure of amplitude of complex numbers when they are displayed in polar form. The expression in the expression textbox is re-evaluated as soon as a change in the choice in the DomainUpDown is made.
Memory calculations
Answer memory
Whenever a value appears on the value textbox, it automatically updates Ans memory contents by storing the result. The value can be used in the next expression using the variable Ans at any position of the expression. Ans memory is not updated in case of error in evaluation.Variables
- The calculator provides 9 memory varaibles.
- Values can be stored in these variables and they may be used later in expressions.
- The values remain stored in the computer in a file even after closing the application and retain the values the next time we run the application.
- The value stored in variables can be that of real numbers or co mplex numbers.
Series
We may evaluate series such as sum of first ten natural numbers, or product of even numbers from 20 to 40.
To store values in variables and use them
To evaluate expressions containing trignometric functions
Check the Trignometry radio button. Now, to simply click the button in the trignometry form to get the funcions to the expression. To get the inverse functions to the expression click inv checkbox and then the button of the trignometric function whose inverse is required in the expression.To evaluate expressions containing series
- Check the series radio button.
- Enter the lower value of the variable in the series expression in expression textbox and check Setlow and then I button. Similarly set the high value of the variable in the sries expression.
- The upper and lower limit of the variable have to be integers and upper limit should be greater than lower limit numerically.
- Now enter the expression containing the series expression and press = to view the result.
- For example, to find sum of first ten natural numbers:type 1 -> Setlow -> I; type 10 -> Sethigh -> I; type "SΣI"->=;to view the answer 55 in value textbox.
- At present, for all SΣ and Sπ that appear in a single expression, the range of variable will be same. With a further enhancement, we may get rid of this limitation.
You can visit my webpage to know more about me.
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 17 Apr 2008 Editor: |
Copyright 2007 by kbsbng Everything else Copyright © CodeProject, 1999-2009 Web10 | Advertise on the Code Project |